model() 공개 정적인 메소드

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : Benefit
리턴 Benefit the static model class
예제 #1
0
 /**
  * Edits or adds a Procedure.
  *
  * @param bool|int $id
  *
  * @throws CHttpException
  */
 public function actionEdit($id = false)
 {
     $admin = new Admin(Procedure::model(), $this);
     if ($id) {
         $admin->setModelId($id);
     }
     $admin->setEditFields(array('term' => 'text', 'short_format' => 'text', 'default_duration' => 'text', 'snomed_code' => 'text', 'snomed_term' => 'text', 'aliases' => 'text', 'unbooked' => 'checkbox', 'active' => 'checkbox', 'opcsCodes' => array('widget' => 'MultiSelectList', 'relation_field_id' => 'id', 'label' => 'OPCS Code', 'options' => CHtml::encodeArray(CHtml::listData(OPCSCode::model()->findAll(), 'id', function ($model) {
         return $model->name . ': ' . $model->description;
     }))), 'benefits' => array('widget' => 'MultiSelectList', 'relation_field_id' => 'id', 'label' => 'Benefit', 'options' => CHtml::encodeArray(CHtml::listData(Benefit::model()->findAll(), 'id', 'name'))), 'complications' => array('widget' => 'MultiSelectList', 'relation_field_id' => 'id', 'label' => 'Complication', 'options' => CHtml::encodeArray(CHtml::listData(Complication::model()->findAll(), 'id', 'name')))));
     if (isset($admin->getModel()->operationNotes)) {
         $admin->setEditFields(array_merge($admin->getEditFields(), array('operationNotes' => array('widget' => 'MultiSelectList', 'relation_field_id' => 'id', 'label' => 'Operation Note Element', 'options' => CHtml::encodeArray(CHtml::listData(ElementType::model()->findAllByAttributes(array(), 'event_type_id in (select id from event_type where name = "Operation Note")'), 'id', 'name'))))));
     }
     $admin->editModel();
 }
예제 #2
0
 public static function DropDown($groupid = 0)
 {
     $res = array();
     if ($groupid == 0) {
         foreach (Benefit::model()->findAll("visible = :visible", array(":visible" => 1)) as $record) {
             $res[$record->idBenefit] = $record->BenefitName;
         }
     } else {
         foreach (Benefit::model()->findAll("visible = :visible and BenefitGroupID = {$groupid}", array(":visible" => 1)) as $record) {
             $res[$record->idBenefit] = $record->BenefitName;
         }
     }
     return $res;
 }
예제 #3
0
 * @var   $form 
 */
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'benefit-form-modal', 'enableAjaxValidation' => false, 'htmlOptions' => array("class" => "form")));
//$form  = new TbActiveForm();
?>

	
        <div class="row-fluid">
            <?php 
echo $form->errorSummary($model);
?>
            <?php 
echo $form->hiddenField($model, 'PersonID', array('class' => 'span5'));
?>
            <?php 
echo $form->dropDownListRow($model, 'BenefitID', CHtml::listData(Benefit::model()->findAll(), "idBenefit", "BenefitName"), array('class' => 'span12'));
?>
        </div>
        <div class="row-fluid">
            <div class ="span1">
                <?php 
echo $form->labelEx($model, 'Series');
?>
                <?php 
echo $form->textField($model, 'Series', array('class' => 'span12', 'maxlength' => 50));
?>
            </div>
            <div class ="span2">
                <?php 
echo $form->labelEx($model, 'Numbers');
?>
예제 #4
0
 /**
  * Метод асинхронно повертає список типів пільг
  */
 public function actionBenefitgroups()
 {
     $models = Benefit::model()->findAll('1 ORDER BY BenefitName ASC');
     $result = array();
     foreach ($models as $model) {
         /* @var $model Benefit */
         $result[] = array('text' => str_replace('"', "'", $model->BenefitName), 'id' => $model->idBenefit);
     }
     echo CJSON::encode($result);
 }
예제 #5
0
 /**
  * @covers Benefit::model
  * @todo   Implement testModel().
  */
 public function testModel()
 {
     $this->assertEquals('Benefit', get_class(Benefit::model()), 'Class name should match model.');
 }
예제 #6
0
 /**
  * Deletes rows for the model.
  */
 public function actionDelete()
 {
     $admin = new Admin(Benefit::model(), $this);
     $admin->deleteModel();
 }
예제 #7
0
 /**
  * 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 the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Benefit::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }