示例#1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Court();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Court'])) {
         $model->attributes = $_POST['Court'];
         $model->state_id = $_POST['Court']['state_id'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
示例#2
0
 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param PropelPDO $con
  * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their corresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aPlayer !== null) {
             if ($this->aPlayer->isModified() || $this->aPlayer->isNew()) {
                 $affectedRows += $this->aPlayer->save($con);
             }
             $this->setPlayer($this->aPlayer);
         }
         if ($this->aCourt !== null) {
             if ($this->aCourt->isModified() || $this->aCourt->isNew()) {
                 $affectedRows += $this->aCourt->save($con);
             }
             $this->setCourt($this->aCourt);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
示例#3
0
    }
    $courtofappeal = @$r['6'];
    $schedule = array();
    for ($i0 = 0; isset($r['7.' . $i0]); $i0++) {
        $schedule[$i0] = array('id' => @$r['7.' . $i0 . '.0'], 'casenr' => @$r['7.' . $i0 . '.0']);
        $schedule[$i0]['defendant'] = array();
        for ($i1 = 0; isset($r['7.' . $i0 . '.1.' . $i1]); $i1++) {
            $schedule[$i0]['defendant'][$i1] = @$r['7.' . $i0 . '.1.' . $i1 . ''];
        }
        $schedule[$i0]['plaintiff'] = array();
        for ($i1 = 0; isset($r['7.' . $i0 . '.2.' . $i1]); $i1++) {
            $schedule[$i0]['plaintiff'][$i1] = @$r['7.' . $i0 . '.2.' . $i1 . ''];
        }
    }
    $Court = new Court($ID, $Sessions, $panels, $members, $cases, $mainoffice, $localoffices, $courtofappeal, $schedule);
    if ($Court->save() !== false) {
        die('ok:' . $_SERVER['PHP_SELF'] . '?Court=' . urlencode($Court->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;
<?php

require_once $base_path . 'classes/checkframework.php';
$did = $_GET['did'];
if ($did != "") {
    $court = Court::get_by_id($did);
}
if (count($_POST) > 0) {
    if ($did == "") {
        $court = new Court($_POST);
    } else {
        $court->set_data_for_change($_POST);
    }
    $errors = array();
    $valid = $court->is_valid();
    if ($valid === true) {
        $court->save();
    } else {
        $errors = $valid;
    }
    $smarty->assign('errors', $errors);
    $smarty->display('return.tpl');
} else {
    $smarty->assign('court', $court);
    $smarty->display('admin-courts-modify.tpl');
}