/** * Show userss * * @return void */ public function users($id_group) { // load dictionaries $this->dict->get_wordarray(array('users')); $mod = new User_model(); $group = $mod->get_var($id_group, 'groups', 'name'); // content $view = new X4View_core('editor'); $view->title = $group . _TRAIT_ . _USERS_LIST; // list $view->form = new X4View_core('ul'); $view->form->items = $mod->get_users($id_group); $view->form->link = BASE_URL . 'users/detail'; $view->form->class = 'class="btr"'; $view->form->title = 'username'; $view->form->value = 'username'; $view->js = ' <script> window.addEvent("domready", function() { buttonize("simple-modal", "btr", "tdown"); }); </script>'; $view->render(TRUE); }
protected function render_body() { echo "<h1>Alumni</h1>\n\t\t\t Sort alumni\n\t\t\t <select id='sort-alumni'>\n\t\t\t <option selected disabled>Choose here</option>\n\t\t <option value='last-name-asc'>By last name in ascending order</option>\n\t\t <option value='last-name-desc'>By last name in descending order</option>\n\t\t \t <option value='academic-year-asc'>By academic year in ascending order</option>\n\t\t \t <option value='academic-year-desc'>By academic year in descending order</option>\n\t\t\t </select><br />\n\t\t\t \n\t\t\t <p id='error-message'></p>\n\t\t\t Filter alumni\n\t\t\t <select id='filter-alumni'>\n\t\t\t <option selected disabled>Choose here</option>\n\t\t <option value='year'>By year</option>\n\t\t <option value='first-name'>By first name</option>\n\t\t <option value='last-name'>By last name</option>\n\t\t\t </select>\n\n\t\t\t <div id='filter-alumni-form'>\n\t\t\t <input id='filter-alumni-text' type='text'></input>\n\t\t\t <button id='alumni-filter-button'>Filter</button>\n\t\t\t <button id='alumni-all-button'>Get All</button>\n\t\t\t </div>\n\n\n\t\t\t <table id='alumni-list'>\n\t\t\t <tr>\n\t\t\t \t<th>Name</th>\n\t\t\t \t<th>Academic year</th>\n\t\t\t </tr>"; $user_model = new User_model(); $users = $user_model->get_users(); foreach ($users as $user) { $username = $user->get_username(); echo "<tr>\n\t\t\t\t <td><a href='alumni.php?page=profile&username={$username}'</a>" . $user->get_first_name() . " " . $user->get_last_name() . "</td>\n\t\t\t\t <td>" . $user->get_academic_year() . "</td>\n\t\t\t\t </tr>"; } echo "</table>"; }
/** * Perform a permission's refactory on all users of a group * * @param integer $id_group group ID * @return array Array(0, boolean) */ private function refactory_group($id_group) { // get users $user = new User_model(); $u = $user->get_users($id_group); // refactory user permission foreach ($u as $i) { $res = $this->refactory($i->id); } return empty($u) ? array(0, 1) : $res; }
<?php require_once 'model/user_model.php'; if (isset($_GET['data'])) { switch ($_GET['data']) { case "users": $user_model = new User_model(); $users = $user_model->get_users(); header('Content-type: application/json'); echo parse_users_to_json($users); break; case "users-sorted-by-last-name": if (isset($_GET['order'])) { $user_model = new User_model(); $users = $user_model->get_users_sorted_by_last_name($_GET['order']); header('Content-type: application/json'); echo parse_users_to_json($users); } break; case "users-sorted-by-academic-year": if (isset($_GET['order'])) { $user_model = new User_model(); $users = $user_model->get_users_sorted_by_academic_year($_GET['order']); header('Content-type: application/json'); echo parse_users_to_json($users); } break; case "users-filtered-by-first-name": if (isset($_GET['filter'])) { $user_model = new User_model(); $users = $user_model->get_users_filtered_by_first_name($_GET['filter']);