/** * index function. * * @access public * @return void */ public function index() { $this->output->enable_profiler(false); $this->benchmark->mark('auth_start'); if (!$this->auth->loggedin()) { redirect('user/login'); } $uid = intval($this->auth->userid()); $this->benchmark->mark('auth_end'); $user = $this->user_model->get_user($uid); $greeting = ''; if (isset($user['firstname'])) { $greeting = ' ' . $user['firstname']; $data['firstname'] = $user['firstname']; } else { $greeting = ' ' . $user['username']; $data['firstname'] = $user['firstname']; } $data['title'] = $this->system_model->get('app_name'); $data['stylesheets'] = array('buttons_purple'); $data['partial'] = 'home'; $data['org_name'] = $this->system_model->get('org_name'); $data['app_name'] = $this->system_model->get('app_name'); $data['members'] = $this->member_model->count_members(); $data['users'] = $this->user_model->count_users(); $memberdata = heading(ucfirst(lang('members')), 5); $ofeachtype = array(); $this->benchmark->mark('members_process_start'); foreach ($this->member_model->get_types() as $type) { $count = $this->member_model->count_members_type($type['id']); array_push($ofeachtype, $count . ' ' . strtolower($type['plural'])); } $data['membertypes'] = $ofeachtype; $memberdata .= p(ucfirst($data['org_name']) . ' har totalt ' . anchor('members', $data['members'] . ' ' . lang('members')) . ' varav:'); $memberdata .= ul($data['membertypes'], array('class' => 'disc')); $memberdata .= button_group(array(button_anchor('members', ucfirst(lang('administer')) . ' ' . lang('members'), 'radius'), button_anchor('member/register', ucfirst(lang('register_member')), 'radius')), 'radius'); $this->benchmark->mark('members_process_end'); $userdata = heading(ucfirst(lang('users')), 5); $this->benchmark->mark('users_process_start'); $userdata .= p(ucfirst($data['app_name']) . ' har totalt ' . anchor('admin/users', $data['users'] . ' ' . lang('users')) . '.'); $active = $this->user_model->get_active(); $ausers = array(); foreach ($active as $aid) { $auser = $this->user_model->get_user($aid); array_push($ausers, $auser['firstname'] . ' ' . $auser['lastname']); } $data['loggedon'] = $ausers; $userdata .= heading(ucfirst(lang('currently_logged_on')) . ':', 6) . ul($ausers, array('class' => 'disc')); $userdata .= button_group(array(button_anchor('admin/users', ucfirst(lang('administer')) . ' ' . lang('users'), 'radius'), button_anchor('user/create', ucfirst(lang('create_user')), 'radius')), 'radius'); $this->benchmark->mark('users_process_end'); $content = heading(ucfirst(lang('welcome')) . $greeting . '!', 1); $content .= row(columns($memberdata, 6) . columns($userdata, 6)); $html = $content; $data['html'] = $html; $this->system_model->view('template', $data); }
use_helper('Button', 'Field'); $module = $sf_context->getModuleName(); $lang = $sf_user->getCulture(); $id = $sf_params->get('id'); ?> <nav id="nav_anchor" class="nav_box"> <div id="nav_anchor_top"></div> <div id="nav_anchor_content"> <ul> <li><?php echo button_anchor('Article', 'description', 'action_description', $module, $id, $lang); ?> </li> <li><?php echo button_anchor('Information', 'data', 'action_informations', $module, $id, $lang); ?> </li> <li><?php echo button_anchor('Linked documents', 'associated_docs', 'picto_documents', $module, $id, $lang); ?> </li> <li><?php echo button_anchor('Images', 'images', 'picto_images', $module, $id, $lang); ?> </li> </ul> </div> <div id="nav_anchor_down"></div> </nav>
$lang = $sf_user->getCulture(); $id = $sf_params->get('id'); ?> <nav id="nav_anchor" class="nav_box"> <div id="nav_anchor_top"></div> <div id="nav_anchor_content"> <ul> <li><?php echo button_anchor('Information', 'data', 'action_informations', $module, $id, $lang); ?> </li> <li><?php echo button_anchor('Description', 'description', 'action_description', $module, $id, $lang); ?> </li> <?php if ($section_list['map']) { echo li(button_anchor('Interactive map', 'map_container', 'picto_maps', $module, $id, $lang)); } if ($section_list['elevation_profile']) { echo li(button_anchor('Elevation profile', 'elevation_profile_container', 'picto_routes', $module, $id, $lang), array('id' => 'elevation_profile_nav')); } if ($section_list['images']) { echo li(button_anchor('Images', 'images', 'picto_images', $module, $id, $lang), array('id' => 'images_anchor')); } ?> </ul> </div> <div id="nav_anchor_down"></div> </nav>
/** * edit function. * * @access public * @param int $id (default: 0) * @return void */ public function edit($id = 0) { $this->output->enable_profiler(false); if (!$this->auth->loggedin()) { redirect('user/login'); } $uid = $id > 0 ? intval($id) : intval($this->auth->userid()); $user = $this->user_model->get_user($uid); $data['title'] = $this->system_model->get('app_name'); $data['partial'] = 'admin_users'; $data['stylesheets'] = array('buttons_purple'); $data['breadcrumbs'] = array(array('data' => anchor('/', $data['title']), 'mode' => 'unavailable'), array('data' => anchor('admin', ucfirst(lang('administration')))), array('data' => anchor('admin/users', ucfirst(lang('users')))), array('data' => anchor('user/edit', ucfirst(lang('edit_user'))), 'mode' => 'current')); $html = '<br>'; //heading(ucfirst(lang('edit_user')), 1); $html .= div_open('row') . div_open('eight centered columns'); if ($this->input->post()) { // !Process updated fields. $user = array(); $username = $this->input->post('username'); $firstname = $this->input->post('firstname'); $lastname = $this->input->post('lastname'); $email = $this->input->post('email'); $phone = $this->input->post('phone'); if ($username) { $user['username'] = $username; } if ($firstname) { $user['firstname'] = $firstname; } if ($lastname) { $user['lastname'] = $lastname; } if ($email) { $user['email'] = $email; } if ($phone) { $user['phone'] = $phone; } $ok = $this->user_model->update_user($id, $user); $html .= p('updated: ' . $ok); } $html .= form_open(uri_string(), array('class' => 'custom')); $html .= form_hidden('id', $id); $html .= row(columns(form_label(ucfirst(lang('username')) . ':' . span('*', 'required'), 'username') . form_input(array('type' => 'text', 'name' => 'username', 'id' => 'username', 'class' => 'expand', 'value' => $user['username'])), 6, 'end')); $html .= row(columns(form_label(ucfirst(lang('email_address')) . ':' . span('*', 'required'), 'email') . form_input(array('type' => 'email', 'name' => 'email', 'id' => 'email', 'class' => 'expand', 'value' => $user['email'])), 6) . columns(form_label(ucfirst(lang('phone_number')) . ':', 'phone') . form_input(array('type' => 'text', 'name' => 'phone', 'id' => 'phone', 'class' => 'expand', 'value' => $user['phone'])), 6)); $html .= row(columns(form_label(ucfirst(lang('firstname')) . ':', 'firstname') . form_input(array('type' => 'text', 'name' => 'firstname', 'id' => 'firstname', 'class' => 'expand', 'value' => $user['firstname'])), 6) . columns(form_label(ucfirst(lang('lastname')) . ':', 'lastname') . form_input(array('type' => 'text', 'name' => 'lastname', 'id' => 'lastname', 'value' => $user['lastname'])), 6)); $html .= button_group(array(button_anchor('admin/users', lang('button_cancel'), 'radius'), form_input(array('type' => 'submit', 'class' => 'radius button', 'value' => lang('button_save')))), 'radius right'); $html .= form_close() . div_close(); /* $html .= div_open('four columns'); $html .= div_open('radius panel'); $html .= heading(ucfirst(lang('role')), 4); $html .= form_open('user/role', array('class' => 'custom')); $html .= form_hidden('source', $this->encrypt->encode(current_url())); $allroles = $this->role_model->list_roles(); $role = $this->role_model->user_mapping($uid); $role = $this->role_model->get_role($role['role']); $html .= form_label( ucfirst(lang('select')).' '.lang('role').':', 'role'); $html .= form_dropdown( 'role', $allroles, $role['id'], 'class="expand" id="role"'); $html .= form_input(array( 'type' => 'submit', 'class' => 'small radius button', 'value' => lang('button_save'))); $html .= form_close(); */ $html .= div_close(); $data['html'] = $html; $this->system_model->view('template', $data); }
/** * users function. * * @access public * @return void */ public function users() { $this->output->enable_profiler(false); if (!$this->auth->loggedin()) { redirect('user/login'); } $uid = intval($this->auth->userid()); $user = $this->user_model->get_user($uid); $data['title'] = $this->system_model->get('app_name'); $data['partial'] = 'admin_users'; $data['stylesheets'] = array('buttons_pink'); $allroles = $this->role_model->list_roles(); $default_role = $this->role_model->get_default_role(); $this->javascript->ready('$.get("/role/rights/role/' . $default_role['id'] . '", function(html) { $("#role_rights_div").html(html); $("#role_rights_div").foundationCustomForms(); }, "html");'); $content = '<br>'; $users = $this->user_model->list_users(); $userlist = array(); // $tdata = array(array(ucfirst(lang('name')), ucfirst(lang('role')), ucfirst(lang('email')), nbs())); // $tdata = array(array(ucfirst(lang('name')), nbs())); foreach ($users as $user) { // $role = $this->role_model->user_mapping($user['id']); // $role = $this->role_model->get_role($role['role']); // $row = array( // , // form_open('user/role', array('class' => 'custom collapse', 'style' => 'margin: 0;')). // form_hidden('role_'.$user['id'], $role['id']). // form_hidden('source', $this->encrypt->encode(current_url())). // form_dropdown('user_role_'.$user['id'], $allroles, $role['id'], 'class="expand" style="margin: 0;"').form_close(), // mailto($user['email'], // '<i class="general-foundicon-mail"></i>'.nbs().$user['email']), // anchor('user/edit/'.$user['id'], '<i class="general-foundicon-edit"></i>'.nbs().'Visa').nbs(). // anchor(current_url().'#', '<i class="general-foundicon-trash"></i>'.nbs().'Ta bort')); $userlink = anchor('user/edit/' . $user['id'], $user['firstname'] . ' ' . $user['lastname']); array_push($userlist, $userlink); } /* $roles = heading('Användarroller', 4). form_open('role/add', array('class' => 'custom')). form_hidden('source', $this->encrypt->encode(current_url())). form_label('Skapa ny roll:', 'new_role_name'). form_input(array('type' => 'text', 'name' => 'new_role_name', 'id' => 'new_role_name')). form_submit(array('type' => 'submit', 'name' => 'submit_new_role', 'id' => 'submit_new_role', 'class' => 'radius button', 'value' => 'Skapa roll')). form_close(). hr(). form_open('role/update', array('class' => 'custom')). form_hidden('source', $this->encrypt->encode(current_url())). form_label('Uppdatera befintlig roll:', 'select_role'). form_dropdown('select_role', $allroles, $default_role['id'], 'class="expand" id="select_role"'). form_fieldset('Rättigheter för “'.span($default_role['name'], '', 'role_name_span').'”'). div('','','role_rights_div'). form_fieldset_close(). button_group(array(form_submit(array('type' => 'submit', 'name' => 'submit_update_role', 'id' => 'submit_update_role', 'class' => 'radius button', 'value' => 'Uppdatera roll')), form_button(array('type' => 'button', 'name' => 'delete_role', 'id' => 'delete_role', 'content' => 'Radera roll', 'class' => 'radius button'))), 'radius'). form_close(); */ // $this->javascript->change('#select_role', 'roleRights("select_role", "role_rights_div", "role_name_span");'); $content .= row(columns(ul($userlist, array('class' => 'no-bullet')), 8, 'end')) . row(columns(button_group(array(button_anchor('user/create', 'Skapa ny användare', 'radius'))), 8)); //. // columns($roles, 4)); $html = $content; $data['html'] = $html; // $data['useredit'] = reveal_modal($content = '', $id = '', $class = '', $append_close_anchor = true); $this->system_model->view('template', $data); }