?> " /> <div class="field-row row"> <div class="<?php echo $form->columns('label'); ?> "> <label for="relative_id">Relative:</label> </div> <div class="<?php echo $form->columns('field'); ?> "> <?php echo CHtml::dropDownList('relative_id', '', CHtml::listData(FamilyHistoryRelative::model()->findAll(array('order' => 'display_order')), 'id', 'name'), array('empty' => '- Select -')); ?> </div> </div> <div class="field-row row"> <div class="<?php echo $form->columns('label'); ?> "> <label for="side_id">Side:</label> </div> <div class="<?php echo $form->columns('field'); ?> ">
public function actionAddFamilyHistory() { if (!($patient = Patient::model()->findByPk(@$_POST['patient_id']))) { throw new Exception("Patient not found:" . @$_POST['patient_id']); } if (!($relative = FamilyHistoryRelative::model()->findByPk(@$_POST['relative_id']))) { throw new Exception("Unknown relative: " . @$_POST['relative_id']); } if (!($side = FamilyHistorySide::model()->findByPk(@$_POST['side_id']))) { throw new Exception("Unknown side: " . @$_POST['side_id']); } if (!($condition = FamilyHistoryCondition::model()->findByPk(@$_POST['condition_id']))) { throw new Exception("Unknown condition: " . @$_POST['condition_id']); } if (@$_POST['edit_family_history_id']) { if (!($fh = FamilyHistory::model()->findByPk(@$_POST['edit_family_history_id']))) { throw new Exception("Family history not found: " . @$_POST['edit_family_history_id']); } $fh->relative_id = $relative->id; $fh->side_id = $side->id; $fh->condition_id = $condition->id; $fh->comments = @$_POST['comments']; if (!$fh->save()) { throw new Exception("Unable to save family history: " . print_r($fh->getErrors(), true)); } } else { $patient->addFamilyHistory($relative->id, $side->id, $condition->id, @$_POST['comments']); } $this->redirect(array('patient/view/' . $patient->id)); }
?> > <div class="field-row row"> <div class="<?php echo $form->columns('label'); ?> "> <label for="relative_id">Relative:</label> </div> <div class="<?php echo $form->columns('field'); ?> "> <?php $relatives = FamilyHistoryRelative::model()->findAll(array('order' => 'display_order')); $relatives_opts = array('options' => array(), 'empty' => '- select -'); foreach ($relatives as $rel) { $relatives_opts['options'][$rel->id] = array('data-other' => $rel->is_other ? '1' : '0'); } echo CHtml::dropDownList('relative_id', '', CHtml::listData($relatives, 'id', 'name'), $relatives_opts); ?> </div> </div> <div class="field-row row hidden" id="family-history-o-rel-wrapper"> <div class="<?php echo $form->columns('label'); ?> "> <label for="comments">Other Relative:</label>