model() public static method

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : Specialty
return Specialty the static model class
    public static function eventTypeProperties($event_type_id)
    {
        $event_type = EventType::model()->findByPk($event_type_id);
        $event_type_short_name = EventTypeModuleCode::getEventShortName($event_type);
        if (empty($_POST)) {
            if (!preg_match('/^([A-Z][a-z]+)([A-Z][a-z]+)([A-Z][a-zA-Z]+)$/', $event_type->class_name, $m)) {
                die("ERROR: {$event_type->class_name}");
            }
            $specialty_id = Specialty::model()->find('abbreviation=?', array(strtoupper($m[1])))->id;
            $event_group_id = EventGroup::model()->find('code=?', array($m[2]))->id;
            $event_type_name = $event_type->name;
        } else {
            $specialty_id = @$_REQUEST['Specialty']['id'];
            $event_group_id = @$_REQUEST['EventGroup']['id'];
            $event_type_name = @$_REQUEST['EventTypeModuleCode']['moduleSuffix'];
        }
        ?>
		<label>Specialty: </label>
		<?php 
        echo CHtml::dropDownList('Specialty[id]', $specialty_id, CHtml::listData(Specialty::model()->findAll(array('order' => 'name')), 'id', 'name'));
        ?>
<br/>
		<label>Event group: </label><?php 
        echo CHtml::dropDownList('EventGroup[id]', $event_group_id, CHtml::listData(EventGroup::model()->findAll(array('order' => 'name')), 'id', 'name'));
        ?>
<br />
		<label>Name of event type: </label> <?php 
        echo CHtml::textField('EventTypeModuleCode[moduleSuffix]', $event_type_name, array('size' => 65, 'id' => 'moduleSuffix'));
        ?>
<br />
		<label>Event type short name: </label> <?php 
        echo CHtml::textField('EventTypeModuleCode[moduleShortSuffix]', $event_type_short_name, array('size' => 65, 'id' => 'moduleShortSuffix'));
        ?>
<br />
		<?php 
    }
Example #2
0
 public static function getList()
 {
     $list = array();
     if (!empty(Yii::app()->params['contact_labels'])) {
         foreach (Yii::app()->params['contact_labels'] as $label) {
             if (preg_match('/{SPECIALTY}/', $label)) {
                 if (!($specialty = Specialty::model()->find('code=?', array(Yii::app()->params['institution_specialty'])))) {
                     throw new Exception("Institution specialty not configured");
                 }
                 $list['nonspecialty'] = preg_replace('/{SPECIALTY}/', $specialty->adjective, $label);
             } else {
                 $list[$label] = $label;
             }
         }
     }
     return $list;
 }
Example #3
0
 /**
  * Get the Specialty of the Firm
  *
  * @return Specialty|null
  */
 public function getSpecialty()
 {
     $result = Yii::app()->db->createCommand()->select('su.specialty_id as id')->from('subspecialty su')->join('service_subspecialty_assignment svc_ass', 'svc_ass.subspecialty_id = su.id')->join('firm f', 'f.service_subspecialty_assignment_id = svc_ass.id')->where('f.id = :fid', array(':fid' => $this->id))->queryRow();
     if (empty($result)) {
         return null;
     } else {
         return Specialty::model()->findByPk($result['id']);
     }
 }
Example #4
0
 public function removeDiagnosis($diagnosis_id)
 {
     if (!($sd = SecondaryDiagnosis::model()->findByPk($diagnosis_id))) {
         throw new Exception('Unable to find secondary_diagnosis: ' . $diagnosis_id);
     }
     if (!($disorder = Disorder::model()->findByPk($sd->disorder_id))) {
         throw new Exception('Unable to find disorder: ' . $sd->disorder_id);
     }
     if ($disorder->specialty_id) {
         $type = strtolower(Specialty::model()->findByPk($disorder->specialty_id)->code);
     } else {
         $type = 'sys';
     }
     if (!$sd->delete()) {
         throw new Exception('Unable to delete diagnosis: ' . print_r($sd->getErrors(), true));
     }
     $this->audit('patient', "remove-{$type}-diagnosis");
 }
 public function actionPossiblecontacts()
 {
     $term = strtolower(trim($_GET['term'])) . '%';
     switch (strtolower(@$_GET['filter'])) {
         case 'staff':
             $contacts = User::model()->findAsContacts($term);
             break;
         case 'nonspecialty':
             if (!($specialty = Specialty::model()->find('code=?', array(Yii::app()->params['institution_specialty'])))) {
                 throw new Exception("Unable to find specialty: " . Yii::app()->params['institution_specialty']);
             }
             $contacts = Contact::model()->findByLabel($term, $specialty->default_title, true, 'person');
             break;
         default:
             $contacts = Contact::model()->findByLabel($term, @$_GET['filter'], false, 'person');
     }
     echo CJavaScript::jsonEncode($contacts);
 }
Example #6
0
 /**
  * @covers Specialty::model
  *
  * @todo   Implement testModel().
  */
 public function testModel()
 {
     $this->assertEquals('Specialty', get_class(Specialty::model()), 'Class name should match model.');
 }
Example #7
0
 /**
  * Get the Specialty for this event type (as defined by the first camelcase section of the module name)
  *
  * @return Specialty
  */
 public function getSpecialty()
 {
     preg_match('/^([A-Z][a-z]+)([A-Z][a-z]+)([A-Z][a-z]+)$/', $this->class_name, $m);
     return Specialty::model()->find('code=?', array(strtoupper($m[1])));
 }
Example #8
0
 public function findAllByCurrentSpecialty()
 {
     if (!isset(Yii::app()->params['institution_specialty'])) {
         throw new Exception('institution_specialty code is not set in params');
     }
     if (!($specialty = Specialty::model()->find('code=?', array(Yii::app()->params['institution_specialty'])))) {
         throw new Exception('Specialty not found: ' . Yii::app()->params['institution_specialty']);
     }
     $criteria = new CDbCriteria();
     $criteria->addCondition('specialty_id = :specialty_id');
     $criteria->params[':specialty_id'] = $specialty->id;
     $criteria->order = 'name asc';
     return self::model()->findAll($criteria);
 }
		<h3>Describe your event type:</h3>
		<label>Specialty:</label>
		<?php 
echo CHtml::dropDownList('Specialty[id]', empty($_REQUEST) ? Specialty::model()->find('code=?', array(130))->id : @$_REQUEST['Specialty']['id'], CHtml::listData(Specialty::model()->findAll(array('order' => 'name')), 'id', 'name'));
?>
<br />
		<label>Event group:</label>
		<?php 
echo CHtml::dropDownList('EventGroup[id]', empty($_REQUEST) ? EventGroup::model()->find('code=?', array('Mi'))->id : @$_REQUEST['EventGroup']['id'], CHtml::listData(EventGroup::model()->findAll(array('order' => 'name')), 'id', 'name'));
?>
<br />
		<label>Name of event type:</label>
		<input type="text" name="EventTypeModuleCode[moduleSuffix]" value="<?php 
echo @$_POST['EventTypeModuleCode']['moduleSuffix'];
?>
" size="65" id="moduleSuffix" /><br/>
		<?php 
if (isset($this->form_errors['EventTypeModuleCode[moduleSuffix]'])) {
    ?>
			<span style="color: #f00; margin-bottom: 10px; display: inline-block;"><?php 
    echo $this->form_errors['EventTypeModuleCode[moduleSuffix]'];
    ?>
</span>
		<?php 
}
?>

		<label>Event type short name:</label>
		<input type="text" name="EventTypeModuleCode[moduleShortSuffix]" value="<?php 
echo @$_POST['EventTypeModuleCode']['moduleShortSuffix'];
?>
Example #10
0
                </ul>
            </nav>
            <ul class="link">
                <li class="twitter"><a href="https://twitter.com/#!/65doctor" target="_bank"><?php 
echo Yii::t('translation', 'layout.site.Follow_us_on_Twitter');
?>
</a></li>
            	<li><a href="https://www.facebook.com/pages/65doctor/267042123402667" target="_bank"><?php 
echo Yii::t('translation', 'layout.site.Find_us_on_Facebook');
?>
</a></li>
            </ul>
        </div>
    </header><!-- //header -->
     <?php 
$specialty = Specialty::model()->findAll(array('order' => 'first_char ASC'));
$banner = Banners::model()->findAll(array('order' => 'RAND()', 'limit' => '1'));
$body_part = BodyPart::model()->findAll(array('condition' => 'parent_id IS NULL'));
Yii::app()->clientScript->registerScript('search', "\n        \$('#search_submit').click(function(){\n            if( \$('#specialty').val()=='' && \$('#doctor_clinic').val() == ''){\n                alert('" . Yii::t('translation', 'layout.site.Please_choose_Specialty_OR_type_Doctor_name_to_search_for_doctor') . "');\n                return false;\n            }\n        });\n    ");
?>
    <div class="banner">
    	<div class="wrapper">
        	<div class="search-form">
                <p class="title"><strong><?php 
echo Yii::t('translation', 'layout.site.It_s_FREE');
?>
</strong></p>
                <?php 
echo CHtml::form(Yii::app()->createAbsoluteUrl('/search/index/'), 'get', array('id' => 'search-form', 'class' => 'jNice'));
?>
                	<input type="hidden" name="find-doctor" value="1" />