示例#1
0
 /**
  *
 * Load Userrights and User Id to Sesseion.
 *
 * @param sfRequest $request A request object
 */
 public function executeIndex(sfWebRequest $request) {
     $loginObject = new Login();
     
     /*
     * Load the userrole, userrigths, userSettings, userId, workflowSettings for the logged user and store to session
     */
     $userSettings = UserSettingTable::instance()->getUserSettingById($this->getUser()->getAttribute('id'));
     $userWorkflowSetting = UserWorkflowConfigurationTable::instance()->getSingleUserWorkflowConfigurattion($this->getUser()->getAttribute('id'))->toArray();
     $this->getUser()->setAttribute('userSettings', $userSettings[0]->toArray()); // set userSettings
     $config = SystemConfigurationTable::instance()->getSystemConfiguration()->toArray();
     $this->getUser()->setAttribute('userWorkflowSettings', $loginObject->generateUserWorklowView($userWorkflowSetting, sfContext::getInstance())); // set workflowsettings
     $data = $this->getUser()->getAttribute('userWorkflowSettings');
     $credentials = CredentialTable::instance()->getAllCredentials();
     $userrights = CredentialRoleTable::instance()->getCredentialRoleById($this->getUser()->getAttribute('id'));
     $rights = $loginObject->loadUserRight($credentials, $userrights);
     $this->getUser()->setAttribute('credential', $rights); // set rights and role
     $this->systemConfiguration = $config[0];
     $this->theTheme = $userSettings[0]->getTheme(); // load the users theme
     /*
      * -1 is set when user uses login form to login
      * int is set, when user logges in from en email link, then a workflow needs to opened
      */
     $this->version_id  = $request->getParameter('versionid',-1);
     $this->workflow_id  = $request->getParameter('workflow',-1);
     $this->window  = $request->getParameter('window',-1);
     return sfView::SUCCESS;
 }
示例#2
0
 /**
  * Load circulationsettings for an exisitng user
  * @param sfWebRequest $request
  * @return <type>
  */
 public function executeLoadUserCirculationColumns(sfWebRequest $request) {
     $sysObj = new SystemSetting();
     $worklfosettings = UserWorkflowConfigurationTable::instance()->getSingleUserWorkflowConfigurattion($request->getParameter('id'));
     $worklfosettings = $sysObj->buildColumns($worklfosettings->toArray(), $this->getContext());
     $this->renderText('{"result":'.json_encode($worklfosettings).'}');
     return sfView::NONE;
     
 }
示例#3
0
 /**
  * Store function when edit user
  *
  * @param sfWebRequest $request
  */
 public function executeUpdateUser(sfWebRequest $request) {
     $store = new UserCRUD();
     $data = $store->prepareUpdateData($request->getPostParameters());
     UserLoginTable::instance()->updateUser($data, $request->getParameter('id'));
     UserDataTable::instance()->updateUserFirstnameAndLastname($data, $request->getParameter('id'));
     UserSettingTable::instance()->updateUserEmailformatAndEmailtype($data, $request->getParameter('id'));
     isset($data['userThirdTab_street']) ? UserDataTable::instance()->updateUserAdditinalData($data, $request->getParameter('id')) : '';
     isset($data['userSecondTab_durationlength_type']) ? UserSettingTable::instance()->updateUserSettingDurationtypeAndDurationlength($data, $request->getParameter('id')) : '';
     isset($data['userFourthTab_itemsperpage']) ? UserSettingTable::instance()->updateUserSetting($data, $request->getParameter('id')) : '';
     isset($data['userSecondTab_durationlength_type']) ? $store->addUserAgent($data, $request->getParameter('id')) : '';
     isset($data['userFourthTab_itemsperpage']) ? UserWorkflowConfigurationTable::instance()->deleteSingleUserWorkflowConfigurattion($request->getParameter('id')) : '';
     isset($data['userFourthTab_itemsperpage']) ? $store->saveWorklfowSettings($data['worklfow'], $request->getParameter('id'), 1) : '';
     $this->renderText('{success:true}');
     return sfView::NONE;
 }