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'];
 }
 public function getEmailConfiguration() {
     $config = EmailConfigurationTable::instance()->getEmailConfiguration()->toArray();
     return $config[0];
 }
예제 #3
0
    /**
     * Create the config file with the database settings and write email settings
     *
     * @param sfWebRequest $request
     * @return <type>
     */
    public function executeSaveData(sfWebRequest $request) {
        $sysObj = new SystemSetting();
        $installer = new Installer();
        $data = $request->getPostParameters();
        $installer->createConfigFile($data); // write settings in database.yml
        // create DB
        $task = new sfDoctrineBuildAllReLoadTask(sfContext::getInstance()->getEventDispatcher(), new sfFormatter());
        chdir(sfConfig::get('sf_root_dir'));
        $task->run(array(),array('--no-confirmation', '--env=all', '--dir='.sfConfig::get('sf_root_dir').'/data/fixtures/'.$data['productive_data'].''));
        $data = $sysObj->buildEmailSetting($data);
        UserLoginTable::instance()->updateEmail($data['productive_emailadresse']);
        EmailConfigurationTable::instance()->updateEmailConfiguration($data);
        // clear cache
        $taskCC = new sfCacheClearTask(sfContext::getInstance()->getEventDispatcher(), new sfFormatter());
        $taskCC->run(array(), array());
        // create JS Cache
        $ccCache = new TemplateCaching();
        $ccCache->checkCacheDir();
        $ccCache->setFiles();
        $lastModified = $ccCache->getLastModifiedFile();
        $cacheCreated = $ccCache->getCurrentCacheStamp();

        if($lastModified > $cacheCreated OR $cacheCreated == '') {
            if($cacheCreated == '') {
                $cacheCreated = $lastModified;
            }
            $ccCache->createCache($lastModified, $cacheCreated);
        }
        // return success, then JS redirect
        $this->renderText('{success:true}');
        return sfView::NONE;
    }
예제 #4
0
    /**
     *
     * Saves SystemSettings to additional Tables in database
     * @param sfWebRequest $request
     * @return <type>
     */
    public function executeSaveSystem(sfWebRequest $request) {
        $sysObj = new SystemSetting();
        $data = $request->getPostParameters();

        
        // save auth settings
        if (isset($data['authentication_type'])) {
            if($data['authentication_type'] == 'DBONLY') {
                AuthenticationConfigurationTable::instance()->updateAuthenticationConfigurationCuteflowDatabase($data);
            }
            elseif ($data['authentication_type'] == 'DATABASE_LDAP') {
                AuthenticationConfigurationTable::instance()->updateAuthenticationConfigurationCuteflowDatabaseAndLDAP($data);
            }
            else {
                AuthenticationConfigurationTable::instance()->updateAuthenticationConfigurationCuteflowDatabaseAndOpenId($data);
            }
        }

        // save systemsetting
        if (isset($data['systemsetting_language'])) {
            $data = $sysObj->buildSystemSetting($data);
            SystemConfigurationTable::instance()->updateSystemConfiguration($data);
        }

        // store Email tab
        if (isset($data['emailtab_emailtype'])) {
            $data = $sysObj->buildEmailSetting($data);
            EmailConfigurationTable::instance()->updateEmailConfiguration($data);
        }

        // store user tab
        if (isset($data['userTab_defaultdurationtype'])) {
            $data = $sysObj->buildUserSetting($data);
            UserConfigurationTable::instance()->updateUserConfiguration($data);
        }
        // save authorization
        if(isset($data['authorizationTab_hiddenpanel'])) {
            AuthorizationConfigurationTable::instance()->setAuthorizationConfigurationToNull();
            $items = $data['authorizationTab'];
            foreach ($items as $item => $key) {
                $item_data = array();
                $item_data = explode('__', $item);
                AuthorizationConfigurationTable::instance()->updateAuthorizationConfigurationById($item_data[0],$item_data[1]);
            }
        }
        // save theme
        if(isset($data['guitab_theme'])) {
            UserConfigurationTable::instance()->updateTheme($data['guitab_theme']);
        }

        // store useragent settings tab
        if(isset($data['useragent_useragentsettings']) OR isset($data['useragent_useragentcreation'])) {
            $data = $sysObj->prepareUserAgentData($data);
            SystemConfigurationTable::instance()->updateUserAgent($data);
        }
        else {
            $data['useragent_useragentsettings'] = 0;
            $data['useragent_useragentcreation'] = 0;
            $data['writeDays'] = 0;
        }
        SystemConfigurationTable::instance()->updateUserAgent($data);

        // save worklfow config 
        WorkflowConfigurationTable::instance()->deleteSettings();
        $worklfow = $data['worklfow'];
        $position = 1;
        foreach($worklfow as $item => $key) {
            $workflow = new WorkflowConfiguration();
            $workflow->setColumntext($item);
            $workflow->setIsactive($key);
            $workflow->setPosition($position++);
            $workflow->save();
        }

        $this->renderText('{success:true}');
        return sfView::NONE;
    }