예제 #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new CaseType();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['CaseType'])) {
         $model->attributes = $_POST['CaseType'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->case_type));
         }
     }
     $this->render('create', array('model' => $model));
 }
예제 #2
0
require "connectToDataBase.inc.php";
if (isset($_REQUEST['save'])) {
    // handle ajax save request (do not show the interface)
    $ID = @$_REQUEST['ID'];
    // we posted . characters, but something converts them to _ (HTTP 1.1 standard)
    $r = array();
    foreach ($_REQUEST as $i => $v) {
        $r[join('.', explode('_', $i))] = $v;
        //convert _ back to .
    }
    $Cases = array();
    for ($i0 = 0; isset($r['0.' . $i0]); $i0++) {
        $Cases[$i0] = array('id' => @$r['0.' . $i0 . '.0'], 'nr' => @$r['0.' . $i0 . '.0'], 'area of law' => @$r['0.' . $i0 . '.1']);
    }
    $CaseType = new CaseType($ID, $Cases);
    if ($CaseType->save() !== false) {
        die('ok:' . $_SERVER['PHP_SELF'] . '?CaseType=' . urlencode($CaseType->getId()));
    } else {
        die('');
    }
    exit;
    // do not show the interface
}
$buttons = "";
if (isset($_REQUEST['new'])) {
    $new = true;
} else {
    $new = false;
}
if (isset($_REQUEST['edit']) || $new) {
    $edit = true;