model() публичный статический Метод

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : the
Результат the static model class
Пример #1
0
 public function actionDeleteTreatments()
 {
     $result = 1;
     foreach (OphCoTherapyapplication_Treatment::model()->findAllByPK($_POST['treatments']) as $treatment) {
         if (!$treatment->delete()) {
             $result = 0;
         }
     }
     echo $result;
 }
Пример #2
0
 protected function getTreatment($treatment_id)
 {
     if (!@$this->_treatment_cache[$treatment_id]) {
         $this->_treatment_cache[$treatment_id] = OphCoTherapyapplication_Treatment::model()->findByPk($treatment_id);
     }
     return $this->_treatment_cache[$treatment_id];
 }
 /**
  * get the treatment options for this intervention.
  *
  * @return array $options key,value pair list
  */
 public function getTreatmentOptions($selected_id)
 {
     if ($this->is_relevant) {
         return OphCoTherapyapplication_RelevantTreatment::model()->activeOrPk($selected_id)->findAll();
     } else {
         return OphCoTherapyapplication_Treatment::model()->availableOrPk($selected_id)->findAll();
     }
 }
 /**
  * returns list of treatment for the given side.
  *
  * @param string $side - left or right
  *
  * @return OphTrIntravitrealinjection_Treatment_Drug[]
  */
 public function getTreatments($side)
 {
     if (is_null($this->_available_treatments)) {
         $this->_available_treatments = OphCoTherapyapplication_Treatment::model()->availableOrPk($this->{$side . '_treatment_id'})->findAll();
     }
     $treatments = $this->_available_treatments;
     if ($curr_id = $this->{$side . '_treatment_id'}) {
         $treatment_array = array();
         foreach ($treatments as $treatment) {
             if ($curr_id == $treatment->id) {
                 // current treatment is in the list so we don't need to append
                 return $treatments;
             }
             $treatment_array[] = $treatment;
         }
         // got this far so the current drug for this side is no longer available
         $treatment_array[] = $this->{$side . '_treatment'};
         $treatments = $treatment_array;
     }
     return $treatments;
 }
Пример #5
0
 /**
  * ajax action to retrieve a specific decision tree (which can then be populated with appropriate default values.
  *
  * @throws CHttpException
  */
 public function actionGetDecisionTree()
 {
     if (!($this->patient = Patient::model()->findByPk((int) @$_GET['patient_id']))) {
         throw new CHttpException(403, 'Invalid patient_id.');
     }
     if (!($treatment = OphCoTherapyapplication_Treatment::model()->findByPk((int) @$_GET['treatment_id']))) {
         throw new CHttpException(403, 'Invalid treatment_id.');
     }
     $element = new Element_OphCoTherapyapplication_PatientSuitability();
     $side = @$_GET['side'];
     if (!in_array($side, array('left', 'right'))) {
         throw Exception('Invalid side argument');
     }
     $element->{$side . '_treatment'} = $treatment;
     $form = Yii::app()->getWidgetFactory()->createWidget($this, 'BaseEventTypeCActiveForm', array('id' => 'clinical-create', 'enableAjaxValidation' => false, 'htmlOptions' => array('class' => 'sliding')));
     $this->renderPartial('form_OphCoTherapyapplication_DecisionTree', array('element' => $element, 'form' => $form, 'side' => $side), false, false);
 }