Exemple #1
0
 public function add($post)
 {
     $model = new Cases();
     $model->setAttributes($post);
     if (isset($post['date_prosecution'])) {
         $model->date_prosecution = strtotime($post['date_prosecution']);
     }
     if ($model->save(FALSE)) {
         return TRUE;
     }
     return FALSE;
 }
 /**
  * Creates a new model.
  * @return create view
  */
 public function actionCreate()
 {
     // check if user has permissions to createCases
     if (Yii::app()->user->checkAccess('createCases')) {
         // create Cases object model
         $model = new Cases();
         // if Cases form exist and was sent
         if (isset($_POST['Cases'])) {
             // set form elements to Budgets model attributes
             $model->attributes = $_POST['Cases'];
             $model->case_date = date("Y-m-d");
             $model->project_id = Yii::app()->user->getState('project_selected');
             // validate and save
             if ($model->save()) {
                 // save log
                 $attributes = array('log_date' => date("Y-m-d G:i:s"), 'log_activity' => 'CaseCreated', 'log_resourceid' => $model->primaryKey, 'log_type' => Logs::LOG_CREATED, 'user_id' => Yii::app()->user->id, 'module_id' => Yii::app()->controller->id, 'project_id' => $model->project_id);
                 Logs::model()->saveLog($attributes);
                 // to prevent F5 keypress, redirect to create page
                 $this->redirect(array('view', 'id' => $model->case_id));
             }
         }
         $this->render('create', array('model' => $model));
     } else {
         throw new CHttpException(403, Yii::t('site', '403_Error'));
     }
 }
Exemple #3
0
        $Cases[$i0] = array('id' => @$r['0.' . $i0 . '.0'], 'nr' => @$r['0.' . $i0 . '.0'], 'area of law' => @$r['0.' . $i0 . '.2']);
        $Cases[$i0]['session'] = array();
        for ($i1 = 0; isset($r['0.' . $i0 . '.1.' . $i1]); $i1++) {
            $Cases[$i0]['session'][$i1] = @$r['0.' . $i0 . '.1.' . $i1 . ''];
        }
        $Cases[$i0]['type of case'] = array();
        for ($i1 = 0; isset($r['0.' . $i0 . '.3.' . $i1]); $i1++) {
            $Cases[$i0]['type of case'][$i1] = @$r['0.' . $i0 . '.3.' . $i1 . ''];
        }
        $Cases[$i0]['court'] = array();
        for ($i1 = 0; isset($r['0.' . $i0 . '.4.' . $i1]); $i1++) {
            $Cases[$i0]['court'][$i1] = @$r['0.' . $i0 . '.4.' . $i1 . ''];
        }
    }
    $Cases = new Cases($Cases);
    if ($Cases->save() !== false) {
        die('ok:' . $_SERVER['PHP_SELF']);
    } else {
        die('');
    }
    exit;
    // do not show the interface
}
$buttons = "";
if (isset($_REQUEST['edit'])) {
    $edit = true;
} else {
    $edit = false;
}
$Cases = new Cases();
writeHead("<TITLE>Cases - VIRO - ADL Prototype</TITLE>" . ($edit ? '<SCRIPT type="text/javascript" src="edit.js"></SCRIPT>' : '<SCRIPT type="text/javascript" src="navigate.js"></SCRIPT>') . "\n");