Esempio n. 1
0
 /**
  * Load the theme a user wants to use
  *
  * @param sfWebRequest $request
  * @return <type>
  */
 public function executeLoadUserTheme(sfWebRequest $request) {
     $tm = new ThemeManagement();
     $defaultTheme = UserSettingTable::instance()->getUserSettingById($request->getParameter('id'))->toArray();
     $tm->setContext($this->getContext());
     $data = $tm->getThemes();
     $data = $tm->checkDefault($data, $defaultTheme[0]['theme']);
     $this->renderText('({"result":'.json_encode($data).'})');
     return sfView::NONE;
 }
 public function setData() {
     $userSettings = UserSettingTable::instance()->getUserSettingById($this->user_id)->toArray();
     $replayAdress = EmailConfigurationTable::instance()->getEmailConfiguration()->toArray();
     $userLogin = UserLoginTable::instance()->findActiveUserById($this->user_id);
     $userData = UserDataTable::instance()->getUserDataByUserId($this->user_id)->toArray();
     $this->userSettings = $userSettings[0];
     $this->userSettings['systemreplyaddress'] = $replayAdress[0]['systemreplyaddress'];
     $this->userData['username'] = $userLogin[0]->getUsername();
     $this->userData['user_id'] = $userLogin[0]->getId();
     $this->userData['email'] = $userLogin[0]->getEmail();
     $this->userData['firstname'] = $userData[0]['firstname'];
     $this->userData['lastname'] = $userData[0]['lastname'];
 }
 /**
  * Add the useragents for the user in the process to the array
  */
 public function addUserAgentsAndUserSettingsAndTime() {
     for($a=0;$a<count($this->openProcesses);$a++) {
         $user = UserAgentTable::instance()->getAllUserAgents($this->openProcesses[$a]['user_id'])->toArray(); // get useraegnts for the user
         if(empty($user) == true) {
             $this->openProcesses[$a]['hasUserAgent'] = 0;
         }
         else {
             $this->openProcesses[$a]['hasUserAgent'] = 1;
             $this->openProcesses[$a]['useragents'] = $user;
             $userSettings = UserSettingTable::instance()->getUserSettingById($this->openProcesses[$a]['user_id'])->toArray();
             $this->openProcesses[$a]['usersettings'] = $userSettings[0];
             $this->openProcesses[$a]['useragenttime'] = $this->calculateUserAgentTime($userSettings[0]['durationtype'],$userSettings[0]['durationlength']);
         }
     } 
 }
 /**
  * Get first login flag of an user
  *
  * @return boolean
  */
 public static function getFirstLogin() {
     $result = UserSettingTable::instance()->getFirstLogin(sfContext::getInstance()->getUser()->getAttribute('id'))->toArray();
     return $result[0]['firstlogin'];
 }
Esempio n. 5
0
 /**
  * Create new user
  * @param sfWebRequest $request
  * @return <type>
  */
 public function executeSaveUser(sfWebRequest $request) {
     $store = new UserCRUD();
     $result = UserConfigurationTable::instance()->getUserConfiguration()->toArray();
     $data = $request->getPostParameters();
     $data = $store->prepareCreateData($data, $result[0]);
     $user_id = $store->saveLoginDataTab($data);
     UserSettingTable::instance()->updateUserSettingDurationtypeAndDurationlength($data, $user_id);
     UserDataTable::instance()->updateUserAdditinalData($data,$user_id);
     UserSettingTable::instance()->updateUserSetting($data,$user_id);
     $store->addUserAgent($data, $user_id);
     $store->saveWorklfowSettings($data['worklfow'], $user_id, 1);
     $this->renderText('{success:true}');
     return sfView::NONE;
 }
Esempio n. 6
0
    /**
     * Function allows LinkLogin by an email and redirects to the needed actions
     * the redirect depends on systemsettings. it allows direct linklogin without authentication using loginmask
     * other possibility is, if no session is set using emaillogin, loginmask is shown and user needs to login
     * to fill the workflow
     *
     * @param sfWebRequest $request
     * @return <type>
     */
    public function executeLinklogin(sfWebRequest $request) {

        $settings = AuthenticationConfigurationTable::instance()->getAuthenticationConfiguration()->toArray();
        $user_id = $request->getParameter('userid');
        if($settings[0]['allowdirectlogin'] == 1) { // allow direct login, without using login form
            $userLogin = UserLoginTable::instance()->findUserById($user_id);
            $arr = $userLogin->toArray(); // load User Data
            if($this->getUser()->isAuthenticated() == false) { // check if user is already logged in
                if(empty($arr) == false) { // a user has been found, -> user is not deleted
                    $settings = UserSettingTable::instance()->getUserSettingById($user_id); // user is not logged in, set the settings
                    $this->getUser()->setAuthenticated(true);
                    $this->getUser()->setAttribute('id',$user_id);
                    $this->getUser()->setAttribute('userrole',$userLogin[0]->getRoleId());
                    $this->getUser()->setCulture($settings[0]->getLanguage());
                    $this->getUser()->setAttribute('env', str_replace('/', '', $request->getScriptName()));
                    $this->redirect($this->generateUrl('default', array('module' => 'layout', 'action' => 'index', 'versionid' => $request->getParameter('versionid'), 'workflow' => $request->getParameter('workflowid'), 'window' => $request->getParameter('window'))));
                }
                else { // user is not found or is deleted
                    $this->redirect('login/index');
                }
            }
            else { // user is already logged in
                $this->redirect($this->generateUrl('default', array('module' => 'layout', 'action' => 'index', 'versionid' => $request->getParameter('versionid'), 'workflow' => $request->getParameter('workflowid'), 'window' => $request->getParameter('window'))));
            }
        }
        else { // allow direct login is denied
            if($this->getUser()->isAuthenticated() == true) { // user is already logged in
                $this->redirect($this->generateUrl('default', array('module' => 'layout', 'action' => 'index', 'versionid' => $request->getParameter('versionid'), 'workflow' => $request->getParameter('workflowid'), 'window' => $request->getParameter('window'))));
            }
            else { // move to login page
                $this->redirect($this->generateUrl('default', array('module' => 'login', 'action' => 'index', 'versionid' => $request->getParameter('versionid'), 'workflow' => $request->getParameter('workflowid'), 'window' => $request->getParameter('window'))));
            }
        }
        return sfView::NONE;
    }