<?php //echo $form->dropDownListControlGroup($model,'establishment',CHtml::listData(Establishments::model()->findAll(array('order' => 'est_name ASC')), 'est_name', 'est_name'),array('span'=>5)); ?> <?php //echo $form->dropDownListControlGroup($model,'judge_name',CHtml::listData(JudgeName::model()->findAll(array('order' => 'judge_name ASC')), 'judge_name', 'judge_name'),array('span'=>5)); ?> <?php //echo $form->textFieldControlGroup($model,'judge_code',array('span'=>5,'maxlength'=>10)); ?> <?php echo $form->dropDownListControlGroup($model, 'case_type', CHtml::listData(CaseType::model()->findAll(array('order' => 'short_form ASC')), 'short_form', 'short_form'), array('span' => 5)); ?> <?php echo $form->textFieldControlGroup($model, 'case_no', array('span' => 5)); ?> <?php echo $form->textFieldControlGroup($model, 'case_year', array('span' => 5)); ?> <?php //echo $form->textFieldControlGroup($model,'notice_date',array('span'=>5,'data-provide'=>'datepicker')); ?> <?php
function delCaseType($id) { $tobeDeleted = new CaseType($id); if ($tobeDeleted->isNew()) { return true; } // item never existed in the first place if ($tobeDeleted->del()) { return true; } else { return $tobeDeleted; } }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return CaseType the loaded model * @throws CHttpException */ public function loadModel($id) { $model = CaseType::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
require "CaseType.inc.php"; 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) {