/**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = Source::model()->with('externalSource', 'useCase')->findByPk($id);
     if (isset($model->externalSource)) {
         $this->redirect(array('externalSource/update', 'id' => $id));
     } else {
         if (isset($model->useCase)) {
             $this->redirect(array('useCase/update', 'id' => $id));
         } else {
             throw CHttpException(404, "Can't edit orphaned source :^(");
         }
     }
 }
 protected function createElement($step)
 {
     $element = new Element('addElement');
     if (isset($_POST['Element']['label']) && !isset($_POST['Element']['url'])) {
         $element->attributes = $_POST['Element'];
         if ($element->typeId > 4 && $element->typeId < 8) {
             $multi = $_POST['Element']['multi'];
             $step->addElement($element, $multi);
         } else {
             if (isset($_POST['Rows']) && isset($_POST['Columns'])) {
                 $step->addGrid($element, $_POST['Rows'], $_POST['Columns']);
                 CHttpException(403, "lasjkd" . $element);
             } else {
                 $step->addElement($element);
             }
         }
         $this->refresh();
     }
     return $element;
 }
Example #3
0
 /**
  *  Determines effective user's status (depending on user's group status).
  *  For example, when user's group is disabled, user also becomes disabled.
  *  @return integer Effective status.
  */
 public function getEffectiveStatus()
 {
     if ($this->status != self::STATUS_DISABLED) {
         // Get status of group this user belong to
         $group = UserGroup::model()->find('id=' . $this->usergroup);
         if ($group === Null) {
             throw CHttpException(403, 'Unexpected database state');
         }
         // If group is disabled, than user is also disabled
         if ($group->status == UserGroup::STATUS_DISABLED) {
             return User::STATUS_DISABLED;
         }
     }
     // Return status
     return $this->status;
 }
 public function saveCfg($p)
 {
     $header = '<?php /*** THIS FILE WAS GENERATED BY THE MULTICRAFT FRONT-END ***/' . "\n" . 'return ';
     if (!isset($p['config']['panel_db']) || !isset($p['config']['daemon_db'])) {
         throw CHttpException(500, 'Config file is missing critical settings.');
     }
     $content = $header . var_export($p['config'], true) . ';';
     return file_put_contents($p['config_file'], $content);
 }