当前位置: 首页>>代码示例>>PHP>>正文


PHP getUserContext函数代码示例

本文整理汇总了PHP中getUserContext函数的典型用法代码示例。如果您正苦于以下问题:PHP getUserContext函数的具体用法?PHP getUserContext怎么用?PHP getUserContext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getUserContext函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: view

 /**
  * Display a page with this order of priority (based on the provided page name) :
  *  1. Does the page exist into local/pages/{lang}/ (this allows you to overwrite default pages)?
  *  2. Does the page exist into the views available in views/pages/ folder?
  * Pages are not public and we take into account the language of the connected user.
  * If the page name contains the keyword export, then we don't output the default template.
  * @param string $page Name of the view (and of the corresponding PHP file)
  * @author Benjamin BALET <benjamin.balet@gmail.com>
  */
 public function view($page = 'home')
 {
     $data = getUserContext($this);
     $trans = array("-" => " ", "_" => " ", "." => " ");
     $data['title'] = ucfirst(strtr($page, $trans));
     // Capitalize the first letter
     //The page containing export in their name are returning another MIMETYPE
     if (strpos($page, 'export') === FALSE) {
         //Don't include header and menu
         $this->load->view('templates/header', $data);
         $this->load->view('menu/index', $data);
     }
     $view = 'pages/' . $this->language_code . '/' . $page . '.php';
     $pathCI = APPPATH . 'views/';
     $pathLocal = FCPATH . 'local/';
     //Check if we have a user-defined view
     if (file_exists($pathLocal . $view)) {
         $this->load->customView($pathLocal, $view, $data);
     } else {
         //Load the page from the default location (CI views folder)
         if (!file_exists($pathCI . $view)) {
             redirect('notfound');
         }
         $this->load->view($view, $data);
     }
     if (strpos($page, 'export') === FALSE) {
         $this->load->view('templates/footer', $data);
     }
 }
开发者ID:ishawge,项目名称:jorani,代码行数:38,代码来源:pages.php

示例2: counters

 /**
  * Display the details of leaves taken/entitled for a given employee
  * This page can be displayed only if the connected user is the manager of the employee
  * @param string $refTmp Timestamp (reference date)
  * @author Benjamin BALET <benjamin.balet@gmail.com>
  */
 public function counters($id, $refTmp = NULL)
 {
     $data = getUserContext($this);
     $this->lang->load('datatable', $this->language);
     $this->lang->load('entitleddays', $this->language);
     $this->lang->load('hr', $this->language);
     $this->load->model('users_model');
     $employee = $this->users_model->get_users($id);
     if ($this->user_id != $employee['manager'] && $this->is_hr == false) {
         log_message('error', 'User #' . $this->user_id . ' illegally tried to access to leave counter of employee #' . $id);
         $this->session->set_flashdata('msg', lang('requests_summary_flash_msg_forbidden'));
         redirect('requests/collaborators');
     } else {
         $refDate = date("Y-m-d");
         if ($refTmp != NULL) {
             $refDate = date("Y-m-d", $refTmp);
             $data['isDefault'] = 0;
         } else {
             $data['isDefault'] = 1;
         }
         $data['refDate'] = $refDate;
         $data['summary'] = $this->leaves_model->get_user_leaves_summary($id, FALSE, $refDate);
         if (!is_null($data['summary'])) {
             $this->load->model('entitleddays_model');
             $this->load->model('types_model');
             $data['types'] = $this->types_model->get_types();
             $this->load->model('users_model');
             $data['employee_name'] = $this->users_model->get_label($id);
             $user = $this->users_model->get_users($id);
             $this->load->model('contracts_model');
             $contract = $this->contracts_model->get_contracts($user['contract']);
             $data['contract_name'] = $contract['name'];
             $data['contract_start'] = $contract['startentdate'];
             $data['contract_end'] = $contract['endentdate'];
             $data['employee_id'] = $id;
             $data['contract_id'] = $user['contract'];
             $data['entitleddayscontract'] = $this->entitleddays_model->get_entitleddays_contract($user['contract']);
             $data['entitleddaysemployee'] = $this->entitleddays_model->get_entitleddays_employee($id);
             expires_now();
             $data['title'] = lang('requests_summary_title');
             $data['help'] = $this->help->create_help_link('global_link_doc_page_leave_balance_collaborators');
             $this->load->view('templates/header', $data);
             $this->load->view('menu/index', $data);
             $this->load->view('requests/counters', $data);
             $this->load->view('templates/footer');
         } else {
             $this->session->set_flashdata('msg', lang('requests_summary_flash_msg_error'));
             redirect('requests/collaborators');
         }
     }
 }
开发者ID:roidelapluie,项目名称:jorani,代码行数:57,代码来源:requests.php

示例3: settings

 /**
  * Display the settings of the system (extract of config.php)
  * @author Benjamin BALET <benjamin.balet@gmail.com>
  */
 public function settings()
 {
     $this->auth->checkIfOperationIsAllowed('list_settings');
     $data = getUserContext($this);
     $data['title'] = 'application/config/config.php';
     $data['help'] = $this->help->create_help_link('global_link_doc_page_settings');
     $this->load->view('templates/header', $data);
     $this->load->view('menu/index', $data);
     $this->load->view('admin/settings', $data);
     $this->load->view('templates/footer');
 }
开发者ID:shawnyeh,项目名称:jorani,代码行数:15,代码来源:admin.php

示例4: balance

 /**
  * Landing page of the shipped-in balance report
  * @author Benjamin BALET <benjamin.balet@gmail.com>
  */
 public function balance($refTmp = NULL)
 {
     $this->auth->checkIfOperationIsAllowed('native_report_balance');
     $data = getUserContext($this);
     $refDate = date("Y-m-d");
     if ($refTmp != NULL) {
         $refDate = date("Y-m-d", $refTmp);
     }
     $data['refDate'] = $refDate;
     $data['title'] = lang('reports_balance_title');
     $data['help'] = $this->help->create_help_link('global_link_doc_page_leave_balance_report');
     $this->load->view('templates/header', $data);
     $this->load->view('menu/index', $data);
     $this->load->view('reports/balance/index', $data);
     $this->load->view('templates/footer');
 }
开发者ID:GIP-RECIA,项目名称:jorani,代码行数:20,代码来源:reports.php

示例5: view

 /**
  * Display a static web page. We try to find if a filename matches with the
  * views available in views/pages/ folder
  * @param type $page
  * @author Benjamin BALET <benjamin.balet@gmail.com>
  */
 public function view($page = 'home')
 {
     $data = getUserContext($this);
     $path = 'pages/' . $this->session->userdata('language_code') . '/' . $page . '.php';
     if (!file_exists('application/views/' . $path)) {
         $path = 'pages/en/' . $page . '.php';
         if (!file_exists('application/views/' . $path)) {
             //fallback on default language
             show_404();
         }
     }
     $data['title'] = ucfirst($page);
     // Capitalize the first letter
     $this->load->view('templates/header', $data);
     $this->load->view('menu/index', $data);
     $this->load->view($path, $data);
     $this->load->view('templates/footer', $data);
 }
开发者ID:roidelapluie,项目名称:jorani,代码行数:24,代码来源:pages.php

示例6: edit

 /**
  * Display a form that allows editing a leave type
  * @param int $id Identitier of the leave type
  * @author Benjamin BALET <benjamin.balet@gmail.com>
  */
 public function edit($id)
 {
     $this->auth->checkIfOperationIsAllowed('leavetypes_edit');
     $data = getUserContext($this);
     $this->load->helper('form');
     $this->load->library('form_validation');
     $data['title'] = lang('leavetypes_popup_update_title');
     $data['id'] = $id;
     $data['type_name'] = $this->types_model->getName($id);
     $this->form_validation->set_rules('name', lang('leavetypes_popup_update_field_name'), 'required|xss_clean|strip_tags');
     if ($this->form_validation->run() === FALSE) {
         $this->load->view('leavetypes/edit', $data);
     } else {
         $this->types_model->updateTypes($id, $this->input->post('name'));
         $this->session->set_flashdata('msg', lang('leavetypes_popup_update_flash_msg'));
         redirect('leavetypes');
     }
 }
开发者ID:bodun,项目名称:jorani,代码行数:23,代码来源:leavetypes.php

示例7: edit

 /**
  * Display a form that allows editing a leave type
  * @author Benjamin BALET <benjamin.balet@gmail.com>
  */
 public function edit($id)
 {
     $this->auth->check_is_granted('leavetypes_edit');
     expires_now();
     $data = getUserContext($this);
     $this->load->helper('form');
     $this->load->library('form_validation');
     $data['title'] = lang('leavetypes_popup_update_title');
     $data['id'] = $id;
     $data['type_name'] = $this->types_model->get_label($id);
     $this->form_validation->set_rules('name', lang('leavetypes_popup_update_field_name'), 'required|xss_clean');
     if ($this->form_validation->run() === FALSE) {
         $this->load->view('leavetypes/edit', $data);
     } else {
         $this->types_model->update_types();
         $this->session->set_flashdata('msg', lang('leavetypes_popup_update_flash_msg'));
         redirect('leavetypes');
     }
 }
开发者ID:sksree,项目名称:Jorani_new,代码行数:23,代码来源:leavetypes.php

示例8: index

 public function index($filter = 'requested')
 {
     $this->auth->checkIfOperationIsAllowed('list_overtime');
     if ($filter == 'all') {
         $showAll = TRUE;
     } else {
         $showAll = FALSE;
     }
     $data = getUserContext($this);
     $this->lang->load('datatable', $this->language);
     $data['filter'] = $filter;
     $data['title'] = lang('overtime_index_title');
     $data['requests'] = $this->overtime_model->requests($this->user_id, $showAll);
     $data['flash_partial_view'] = $this->load->view('templates/flash', $data, TRUE);
     $this->load->view('templates/header', $data);
     $this->load->view('menu/index', $data);
     $this->load->view('overtime/index', $data);
     $this->load->view('templates/footer');
 }
开发者ID:HarkiratGhotra,项目名称:application,代码行数:19,代码来源:overtime.php

示例9: select

 /**
  * Pop-up showing the tree of the organization and allowing a
  * user to choose an entity (filter of a report or a calendar)
  * @author Benjamin BALET <benjamin.balet@gmail.com>
  */
 public function select()
 {
     if ($this->config->item('public_calendar') == TRUE && !$this->session->userdata('logged_in')) {
         $this->load->library('polyglot');
         $data['language'] = $this->config->item('language');
         $data['language_code'] = $this->polyglot->language2code($data['language']);
         $this->lang->load('organization', $data['language']);
         $this->lang->load('treeview', $data['language']);
         $data['help'] = '';
         $data['logged_in'] = FALSE;
         $this->load->view('organization/select', $data);
     } else {
         setUserContext($this);
         $this->auth->checkIfOperationIsAllowed('organization_select');
         $data = getUserContext($this);
         $this->lang->load('organization', $this->language);
         $this->lang->load('treeview', $this->language);
         $this->load->view('organization/select', $data);
     }
 }
开发者ID:GIP-RECIA,项目名称:jorani,代码行数:25,代码来源:organization.php

示例10: contract

 /**
  * Display an ajax-based form that list entitled days of a contract
  * and allow updating the list by adding or removing one item
  * @param int $id contract identifier
  * @author Benjamin BALET <benjamin.balet@gmail.com>
  */
 public function contract($id)
 {
     $this->auth->check_is_granted('entitleddays_contract');
     $data = getUserContext($this);
     $data['id'] = $id;
     $data['entitleddays'] = $this->entitleddays_model->get_entitleddays_contract($id);
     $this->load->model('types_model');
     $data['types'] = $this->types_model->get_types();
     $this->load->model('contracts_model');
     $contract = $this->contracts_model->get_contracts($id);
     $data['contract_name'] = $contract['name'];
     $data['contract_start_month'] = intval(substr($contract['startentdate'], 0, 2));
     $data['contract_start_day'] = intval(substr($contract['startentdate'], 3));
     $data['contract_end_month'] = intval(substr($contract['endentdate'], 0, 2));
     $data['contract_end_day'] = intval(substr($contract['endentdate'], 3));
     $data['title'] = lang('entitleddays_contract_index_title');
     $data['help'] = $this->help->create_help_link('global_link_doc_page_entitleddays_contract');
     $this->load->view('templates/header', $data);
     $this->load->view('menu/index', $data);
     $this->load->view('entitleddays/contract', $data);
     $this->load->view('templates/footer');
 }
开发者ID:sksree,项目名称:Jorani_new,代码行数:28,代码来源:entitleddays.php

示例11: index

 /**
  * Display the list of all overtime requests submitted to you
  * Status is submitted
  * @author Benjamin BALET <benjamin.balet@gmail.com>
  */
 public function index($filter = 'requested')
 {
     $this->auth->check_is_granted('list_overtime');
     expires_now();
     if ($filter == 'all') {
         $showAll = true;
     } else {
         $showAll = false;
     }
     $data = getUserContext($this);
     $data['filter'] = $filter;
     $data['title'] = lang('overtime_index_title');
     $data['requests'] = $this->overtime_model->requests($this->user_id, $showAll);
     $this->load->model('status_model');
     for ($i = 0; $i < count($data['requests']); ++$i) {
         $data['requests'][$i]['status_label'] = $this->status_model->get_label($data['requests'][$i]['status']);
     }
     $data['flash_partial_view'] = $this->load->view('templates/flash', $data, true);
     $this->load->view('templates/header', $data);
     $this->load->view('menu/index', $data);
     $this->load->view('overtime/index', $data);
     $this->load->view('templates/footer');
 }
开发者ID:sksree,项目名称:Jorani_new,代码行数:28,代码来源:overtime.php

示例12: view

 public function view($page = 'home')
 {
     $data = getUserContext($this);
     $trans = array("-" => " ", "_" => " ", "." => " ");
     $data['title'] = ucfirst(strtr($page, $trans));
     if (strpos($page, 'export') === FALSE) {
         $this->load->view('templates/header', $data);
         $this->load->view('menu/index', $data);
     }
     $view = 'pages/' . $this->language_code . '/' . $page . '.php';
     $pathCI = APPPATH . 'views/';
     $pathLocal = FCPATH . 'local/';
     if (file_exists($pathLocal . $view)) {
         $this->load->customView($pathLocal, $view, $data);
     } else {
         if (!file_exists($pathCI . $view)) {
             redirect('notfound');
         }
         $this->load->view($view, $data);
     }
     if (strpos($page, 'export') === FALSE) {
         $this->load->view('templates/footer', $data);
     }
 }
开发者ID:HarkiratGhotra,项目名称:application,代码行数:24,代码来源:pages.php

示例13: edit

 public function edit($id)
 {
     $this->auth->checkIfOperationIsAllowed('edit_positions');
     $data = getUserContext($this);
     $this->load->helper('form');
     $this->load->library('form_validation');
     $data['title'] = lang('positions_edit_title');
     $data['position'] = $this->positions_model->getPositions($id);
     if (empty($data['position'])) {
         redirect('notfound');
     }
     $this->form_validation->set_rules('name', lang('positions_edit_field_name'), 'required|xss_clean|strip_tags');
     $this->form_validation->set_rules('description', lang('positions_edit_field_description'), 'xss_clean|strip_tags');
     if ($this->form_validation->run() === FALSE) {
         $this->load->view('templates/header', $data);
         $this->load->view('menu/index', $data);
         $this->load->view('positions/edit', $data);
         $this->load->view('templates/footer');
     } else {
         $this->positions_model->updatePositions($id, $this->input->post('name'), $this->input->post('description'));
         $this->session->set_flashdata('msg', lang('positions_edit_flash_msg'));
         redirect('positions');
     }
 }
开发者ID:HarkiratGhotra,项目名称:application,代码行数:24,代码来源:positions.php

示例14: create

 /**
  * Display the form / action Create a new user
  * @author Benjamin BALET <benjamin.balet@gmail.com>
  */
 public function create()
 {
     $this->auth->check_is_granted('create_user');
     expires_now();
     $data = getUserContext($this);
     $this->load->helper('form');
     $this->load->library('form_validation');
     $this->load->library('polyglot');
     $data['title'] = lang('users_create_title');
     $data['help'] = $this->help->create_help_link('global_link_doc_page_create_user');
     $this->load->model('roles_model');
     $data['roles'] = $this->roles_model->get_roles();
     $this->load->model('contracts_model');
     $data['contracts'] = $this->contracts_model->get_contracts();
     $data['public_key'] = file_get_contents('./assets/keys/public.pem', true);
     $this->form_validation->set_rules('firstname', lang('users_create_field_firstname'), 'required|xss_clean|strip_tags');
     $this->form_validation->set_rules('lastname', lang('users_create_field_lastname'), 'required|xss_clean|strip_tags');
     $this->form_validation->set_rules('login', lang('users_create_field_login'), 'required|callback_login_check|xss_clean|strip_tags');
     $this->form_validation->set_rules('email', lang('users_create_field_email'), 'required|xss_clean|strip_tags');
     if (!$this->config->item('ldap_enabled')) {
         $this->form_validation->set_rules('CipheredValue', lang('users_create_field_password'), 'required');
     }
     $this->form_validation->set_rules('role[]', lang('users_create_field_role'), 'required|xss_clean|strip_tags');
     $this->form_validation->set_rules('manager', lang('users_create_field_manager'), 'required|xss_clean|strip_tags');
     $this->form_validation->set_rules('contract', lang('users_create_field_contract'), 'xss_clean|strip_tags');
     $this->form_validation->set_rules('position', lang('users_create_field_position'), 'xss_clean|strip_tags');
     $this->form_validation->set_rules('entity', lang('users_create_field_entity'), 'xss_clean|strip_tags');
     $this->form_validation->set_rules('datehired', lang('users_create_field_hired'), 'xss_clean|strip_tags');
     $this->form_validation->set_rules('identifier', lang('users_create_field_identifier'), 'xss_clean|strip_tags');
     $this->form_validation->set_rules('language', lang('users_create_field_language'), 'xss_clean|strip_tags');
     $this->form_validation->set_rules('timezone', lang('users_create_field_timezone'), 'xss_clean|strip_tags');
     if ($this->config->item('ldap_basedn_db')) {
         $this->form_validation->set_rules('ldap_path', lang('users_create_field_ldap_path'), 'xss_clean|strip_tags');
     }
     if ($this->form_validation->run() === FALSE) {
         $this->load->view('templates/header', $data);
         $this->load->view('menu/index', $data);
         $this->load->view('users/create', $data);
         $this->load->view('templates/footer');
     } else {
         $password = $this->users_model->set_users();
         log_message('info', 'User ' . $this->input->post('login') . ' has been created by user #' . $this->session->userdata('id'));
         //Send an e-mail to the user so as to inform that its account has been created
         $this->load->library('email');
         $usr_lang = $this->polyglot->code2language($this->input->post('language'));
         //We need to instance an different object as the languages of connected user may differ from the UI lang
         $lang_mail = new CI_Lang();
         $lang_mail->load('email', $usr_lang);
         $this->load->library('parser');
         $data = array('Title' => $lang_mail->line('email_user_create_title'), 'BaseURL' => base_url(), 'Firstname' => $this->input->post('firstname'), 'Lastname' => $this->input->post('lastname'), 'Login' => $this->input->post('login'), 'Password' => $password);
         $message = $this->parser->parse('emails/' . $this->input->post('language') . '/new_user', $data, TRUE);
         if ($this->email->mailer_engine == 'phpmailer') {
             $this->email->phpmailer->Encoding = 'quoted-printable';
         }
         if ($this->config->item('from_mail') != FALSE && $this->config->item('from_name') != FALSE) {
             $this->email->from($this->config->item('from_mail'), $this->config->item('from_name'));
         } else {
             $this->email->from('do.not@reply.me', 'LMS');
         }
         $this->email->to($this->input->post('email'));
         if ($this->config->item('subject_prefix') != FALSE) {
             $subject = $this->config->item('subject_prefix');
         } else {
             $subject = '[Jorani] ';
         }
         $this->email->subject($subject . $lang_mail->line('email_user_create_subject'));
         $this->email->message($message);
         $this->email->send();
         $this->session->set_flashdata('msg', lang('users_create_flash_msg_success'));
         redirect('users');
     }
 }
开发者ID:autohausnielsen,项目名称:jorani,代码行数:76,代码来源:users.php

示例15: calendar

 /**
  * Display an interactive calendar that allows to dynamically set the days
  * off, bank holidays, etc. for a given contract
  * @param type $id contract identifier
  * @param type $year optional year number (4 digits), current year if empty
  * @author Benjamin BALET <benjamin.balet@gmail.com>
  */
 public function calendar($id, $year = 0)
 {
     $this->auth->check_is_granted('calendar_contract');
     $data = getUserContext($this);
     $data['title'] = lang('contract_calendar_title');
     $data['help'] = $this->help->create_help_link('global_link_doc_page_contracts_calendar');
     if ($year != 0) {
         $data['year'] = $year;
     } else {
         $data['year'] = date("Y");
     }
     $contract = $this->contracts_model->get_contracts($id);
     $data['contract_id'] = $id;
     $data['contract_name'] = $contract['name'];
     $data['contract_start_month'] = intval(substr($contract['startentdate'], 0, 2));
     $data['contract_start_day'] = intval(substr($contract['startentdate'], 3));
     $data['contract_end_month'] = intval(substr($contract['endentdate'], 0, 2));
     $data['contract_end_day'] = intval(substr($contract['endentdate'], 3));
     $this->load->model('dayoffs_model');
     $data['dayoffs'] = $this->dayoffs_model->get_dayoffs($id, $data['year']);
     $this->load->view('templates/header', $data);
     $this->load->view('menu/index', $data);
     $this->load->view('contracts/calendar', $data);
     $this->load->view('templates/footer');
 }
开发者ID:sksree,项目名称:Jorani_new,代码行数:32,代码来源:contracts.php


注:本文中的getUserContext函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。