model() public static method

public static model ( $className = __CLASS__ )
Exemplo n.º 1
0
 public function actionEditSocialHistory()
 {
     if (!($patient = Patient::model()->findByPk(@$_POST['patient_id']))) {
         throw new Exception("Patient not found:" . @$_POST['patient_id']);
     }
     if (!($social_history = SocialHistory::model()->find('patient_id=?', array($patient->id)))) {
         $social_history = new SocialHistory();
     }
     $social_history->patient_id = $patient->id;
     $social_history->attributes = $_POST['SocialHistory'];
     if (!$social_history->save()) {
         throw new Exception("Unable to save social history: " . print_r($social_history->getErrors(), true));
     } else {
         $this->redirect(array('patient/view/' . $patient->id));
     }
 }
Exemplo n.º 2
0
 *
 * @package OpenEyes
 * @link http://www.openeyes.org.uk
 * @author OpenEyes <*****@*****.**>
 * @copyright Copyright (C) 2014, OpenEyes Foundation
 * @license http://www.gnu.org/licenses/gpl-3.0.html The GNU General Public License V3.0
 */
$this->renderPartial('//base/_messages');
?>
<div class="box admin">
	<h2>Social History</h2>
	<ul>
		<li><a href="/admin/socialHistoryOccupation"><?php 
echo CHtml::encode(SocialHistory::model()->getAttributeLabel('occupation_id'));
?>
</a></li>
		<li><a href="/admin/socialHistoryDrivingStatus"><?php 
echo CHtml::encode(SocialHistory::model()->getAttributeLabel('driving_status_id'));
?>
</a></li>
		<li><a href="/admin/socialHistorySmokingStatus"><?php 
echo CHtml::encode(SocialHistory::model()->getAttributeLabel('smoking_status_id'));
?>
</a></li>
		<li><a href="/admin/socialHistoryAccommodation"><?php 
echo CHtml::encode(SocialHistory::model()->getAttributeLabel('accommodation_id'));
?>
</a></li>
	</ul>
</div>
Exemplo n.º 3
0
		<span class="icon-patient-clinician-hd_flag"></span>
		Social History
	</h3>
	<a href="#" class="toggle-trigger toggle-hide js-toggle">
			<span class="icon-showhide">
			Show/hide this section
			</span>
	</a>
</header>
<div class="js-toggle-body">
<?php 
if ($this->checkAccess('OprnEditSocialHistory')) {
    ?>
	<?php 
    $this->patient->id;
    $social_history = SocialHistory::model()->find('patient_id=?', array($this->patient->id));
    ?>
	<table class="plain patient-data">
		<thead>
		<tr>
			<th>Social History</th>
			<th>Status</th>
		</tr>
		</thead>
		<tbody>
		<?php 
    if (isset($social_history->occupation)) {
        ?>
			<tr>
				<td><?php 
        echo CHtml::encode($social_history->getAttributeLabel('occupation_id'));
Exemplo n.º 4
0
 public function actionSocialHistoryAccommodation()
 {
     $this->genericAdmin(SocialHistory::model()->getAttributeLabel('accommodation_id'), 'SocialHistoryAccommodation');
 }