Ejemplo n.º 1
0
    /**
     * Update Service Level Settings
     */
    public function actionUpdateServiceLevelSettings()
    {
        if (isset($_POST['ServiceLevelSettings']) && is_array($_POST['ServiceLevelSettings'])) {

            foreach ($_POST['ServiceLevelSettings'] as  $settings) {
                $serviceLevelSettings = ServiceLevelSettings::model()->findByPk($settings['Service_Level_ID']);
                if (!$serviceLevelSettings) {
                    $serviceLevelSettings = new ServiceLevelSettings();
                }

                $serviceLevelSettings->setAttributes($settings);

                if ($serviceLevelSettings->validate()) {
                    $serviceLevelSettings->save();
                }
            }
            Yii::app()->user->setFlash('success', "Service Level Settings have been saved!");
        }
        $this->redirect('/admin?tab=service_settings');
    }