示例#1
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;
    }