PageRenderTime 69ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/web/sa/admin/list.php

http://webgloo.googlecode.com/
PHP | 252 lines | 162 code | 87 blank | 3 comment | 3 complexity | ebca33e726a0de3e1be8183724c0a64b MD5 | raw file
  1. <?php
  2. include 'gloo.inc' ;
  3. require_once ($_SERVER['GLOO_INC_DIR'].'class_loader.inc' );
  4. require_once ($_SERVER['GLOO_INC_DIR'].'session.inc' );
  5. require_once ($_SERVER['GLOO_INC_DIR'].'error.inc' );
  6. //sa/admin/list.php
  7. $glooWeb = Gloo_Core_Web::getInstance();
  8. $context = $glooWeb->getContext();
  9. //check context for required role
  10. $loginPage = '/sa/login.php';
  11. if(!Gloo_UI_Security::hasSuperAdminLogin($context)) {
  12. header('Location: '.$loginPage);
  13. }
  14. $orgId = NULL ;
  15. // org_id should be set in request
  16. if(empty($_GET['org_id'])) {
  17. trigger_error('wrong navigation >> org_id is empty ',E_USER_ERROR);
  18. } else {
  19. $orgId = $_GET['org_id'];
  20. }
  21. $organizationDao = new Gloo_Dao_Organization();
  22. $organization = $organizationDao->getOnId($orgId);
  23. $orgName = $organization['name'];
  24. $admins= $organizationDao->getOrgAdmins($orgId);
  25. $glooConfig = Gloo_Config::getInstance();
  26. $glooBackURI = $_GET['g_back_uri'];
  27. $glooBackURIDecoded = Gloo_Util::base64Decrypt($glooBackURI);
  28. $glooAdminURI = Gloo_Util::base64Encrypt($_SERVER['REQUEST_URI']);
  29. ?>
  30. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  31. <html><head><title> <?php echo $glooConfig->getFarmName(); ?> </title>
  32. <meta http-equiv="keywords" content="cms,webgloo">
  33. <meta http-equiv="description" content="webgloo admin application">
  34. <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  35. <link REL=StyleSheet HREF="/art/common/yui/2.9.0/reset-fonts-grids.css" TYPE="text/css" MEDIA=screen>
  36. <link REL=StyleSheet HREF="/art/minimal/main.css" TYPE="text/css" MEDIA=screen>
  37. <link REL=StyleSheet HREF="/art/minimal/admin.css" TYPE="text/css" MEDIA=screen>
  38. <script type="text/javascript" src="/js/jquery/1.6.4/jquery-1.6.4.min.js"></script>
  39. <script type="text/javascript" src="/js/validation/1.9.0/jquery.validate.min.js"></script>
  40. <script type="text/javascript" src="/js/gloo/gloo.js"></script>
  41. <script type="text/javascript">
  42. function jquery_fns() {
  43. $("#admin_add_form").validate({
  44. errorLabelContainer: $("#admin_add_form div.error")
  45. });
  46. }
  47. $(document).ready(function(){
  48. jquery_fns();
  49. });
  50. </script>
  51. </head>
  52. <body>
  53. <?php include($location->SA_TOP_BAR) ?>
  54. <div id="custom-doc" class="yui-t1">
  55. <div id="hd" role="banner">
  56. <?php include($location->SA_HEADER) ?>
  57. <div id="crumbs-container">
  58. <div class="crumbs_right_bg">
  59. <ul id="bread-crumbs">
  60. <li> <a href="<?php echo $glooBackURIDecoded; ?>">Home </a> </li>
  61. <li class="last"> <a href="<?php echo $_SERVER['REQUEST_URI']; ?>">admins</a> </li>
  62. </ul>
  63. </div>
  64. </div>
  65. </div>
  66. <div id="bd" role="main">
  67. <div id="yui-main">
  68. <div class="yui-b">
  69. <div class="yui-g">
  70. <div id="content">
  71. <?php
  72. $sticky = $glooWeb->getStickyMap('admin_add_form');
  73. $glooPageSection = 'admin_add_form';
  74. include ($_SERVER['GLOO_INC_DIR'].'script_message.inc');
  75. ?>
  76. <h2> Admins &dash; <?php echo $orgName ;?> </h2>
  77. <div class="box_top_bg">
  78. <div> <div> </div> </div>
  79. </div>
  80. <div id="form">
  81. <form class="sform" id="admin_add_form" name="admin_add_form"
  82. action="<?php echo url::base() ?>/sa/admin/frm/add.php" method="POST">
  83. <div class="error" > </div>
  84. <table cellspacing="5" class="formGroup">
  85. <tr>
  86. <td class="field">First name<span class="red-label">*</span> &nbsp; </td>
  87. <td> <input type="text" name="first_name" maxlength="32" class="required" title="First Name is required" value="<?php echo $sticky->get('first_name'); ?>" /></td>
  88. </tr>
  89. <tr>
  90. <td class="field">Last name<span class="red-label">*</span> &nbsp; </td>
  91. <td> <input type="text" name="last_name" maxlength="32" class="required" title="Last Name is required" value="<?php echo $sticky->get('last_name'); ?>" /></td>
  92. </tr>
  93. <tr>
  94. <td class="field"> Email<span class="red-label">*</span>&nbsp; </td>
  95. <td> <input type="text" name="email" maxlength="64" class="required validate-email" title="Admin needs a valid email " value="<?php echo $sticky->get('email'); ?>" /></td>
  96. </tr>
  97. <tr>
  98. <td class="field">Password<span class="red-label">*</span> &nbsp; </td>
  99. <td> <input id="password1" type="password" name="password1" maxlength="32" class="required" minlength="6" title="Minimum lenght of password is 6!" value="" /></td>
  100. </tr>
  101. <tr>
  102. <td class="field">Password again <span class="red-label">*</span> &nbsp;</td>
  103. <td> <input id="password2" type="password" name="password2" maxlength="32" class="required" minlength="6" equalTo="#password1" title="Passwords do not match" value="" /></td>
  104. </tr>
  105. <tr>
  106. <td> &nbsp; </td>
  107. <td>
  108. <div>
  109. <div class="submit">
  110. <div>
  111. <button type="submit" name="save" value="Save" onclick="this.setAttribute('value','Save');" ><span>Save</span></button>
  112. </div>
  113. </div>
  114. <div class="button">
  115. <div>
  116. <button type="button" name="cancel" onClick="javascript:go_back('<?php echo $glooBackURIDecoded ?>');"><span>Cancel</span></button>
  117. </div>
  118. </div>
  119. </div>
  120. </td>
  121. </tr>
  122. </table>
  123. <input type="hidden" name="org_id" value="<?php echo $orgId ?>" />
  124. <input type="hidden" name="g_page_uri" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/>
  125. </form>
  126. </div> <!-- form -->
  127. <div class="box_bottom_bg">
  128. <div> <div> </div> </div>
  129. </div>
  130. <!-- Admins table -->
  131. <div class="padded-container">
  132. <table class="data">
  133. <tr>
  134. <th> <span> Name </span> </th>
  135. <th> <span> Email </span> </th>
  136. <th><span> &nbsp; </span> </th>
  137. <th> <span> &nbsp; </span> </th>
  138. </tr>
  139. <?php
  140. foreach ($admins as $admin) {
  141. ?>
  142. <tr>
  143. <td> <?php echo $admin['first_name']; ?> &nbsp;<?php echo $admin['last_name']; ?> </td>
  144. <td> <a href="mailto:<?php echo $admin['login'];?> "><?php echo $admin['login'];?></a> </td>
  145. <td>
  146. <a href="/sa/admin/reset.php?org_id=<?php echo $orgId ?>&admin_id=<?php echo $admin['id'] ?>&g_home_uri=<?php echo $glooBackURI;?>&g_admin_uri=<?php echo $glooAdminURI;?>"> reset password </a>
  147. </td>
  148. <td>
  149. <a href="/sa/admin/delete.php?org_id=<?php echo $orgId ?>&admin_id=<?php echo $admin['id'] ?>&g_home_uri=<?php echo $glooBackURI;?>&g_admin_uri=<?php echo $glooAdminURI;?>"> delete </a>
  150. </td>
  151. </tr>
  152. <?php } ?>
  153. </table>
  154. </div>
  155. </div> <!-- content -->
  156. </div>
  157. </div> <!-- block1 -->
  158. </div> <!-- yui-main -->
  159. <div class="yui-b">
  160. </div> <!-- block2 -->
  161. </div> <!-- bd -->
  162. </div> <!-- custom-doc -->
  163. <div id="ft" role="contentinfo"> <?php include($location->GLOO_PAGE_FOOTER); ?> </div>
  164. </body>
  165. </html>