当前位置: 首页>>代码示例>>PHP>>正文


PHP Institution::model方法代码示例

本文整理汇总了PHP中Institution::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Institution::model方法的具体用法?PHP Institution::model怎么用?PHP Institution::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Institution的用法示例。


在下文中一共展示了Institution::model方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionEdit

 /**
  * Edits or adds a Procedure.
  *
  * @param bool|int $id
  *
  * @throws CHttpException
  */
 public function actionEdit($id = false)
 {
     if ($id) {
         $this->admin->setModelId($id);
     }
     $this->admin->setEditFields(array('name' => 'text', 'siteLetterStrings' => array('widget' => 'RelationList', 'relation' => 'siteLetterStrings', 'action' => 'OphCoCorrespondence/oeadmin/snippet', 'search' => array('site_id' => array('type' => 'dropdown', 'options' => CHtml::listData(Institution::model()->getCurrent()->sites, 'id', 'short_name'), 'default' => Yii::app()->session['selected_site_id'])), 'listFields' => array('display_order', 'name', 'body', 'element_type.name', 'eventTypeName'))));
     $this->admin->editModel();
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:15,代码来源:SnippetGroupController.php

示例2: actionEdit

 /**
  * Edits or adds a snippets.
  *
  * @param bool|int $id
  *
  * @throws CHttpException
  */
 public function actionEdit($id = false)
 {
     if ($id) {
         $this->admin->setModelId($id);
     }
     $this->admin->setEditFields(array('site_id' => array('widget' => 'DropDownList', 'options' => CHtml::listData(Institution::model()->getCurrent()->sites, 'id', 'short_name'), 'default' => Yii::app()->request->getParam('site_id'), 'htmlOptions' => null, 'hidden' => false, 'layoutColumns' => null), 'letter_string_group_id' => array('widget' => 'DropDownList', 'options' => CHtml::listData(LetterStringGroup::model()->findAll(), 'id', 'name'), 'default' => Yii::app()->request->getParam('group_id'), 'htmlOptions' => null, 'hidden' => false, 'layoutColumns' => null), 'name' => 'text', 'body' => array('widget' => 'CustomView', 'viewName' => '//admin/generic/shortcodeText', 'viewArguments' => array('model' => $this->admin->getModel())), 'event_type' => array('widget' => 'DropDownList', 'options' => CHtml::listData(EventType::model()->findAll(), 'class_name', 'name'), 'htmlOptions' => array('empty' => '- Select -'), 'hidden' => false, 'layoutColumns' => null), 'element_type' => array('widget' => 'DropDownList', 'options' => CHtml::listData(ElementType::model()->findAll(), 'class_name', 'name'), 'htmlOptions' => array('empty' => '- Select -'), 'hidden' => false, 'layoutColumns' => null)));
     $this->admin->editModel();
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:15,代码来源:SnippetController.php

示例3: actionEditContact

 public function actionEditContact()
 {
     if (!($patient = Patient::model()->findByPk(@$_POST['patient_id']))) {
         throw new Exception("Patient not found: " . @$_POST['patient_id']);
     }
     if (!($contact = Contact::model()->findByPk(@$_POST['contact_id']))) {
         throw new Exception("Contact not found: " . @$_POST['contact_id']);
     }
     if (@$_POST['site_id']) {
         if (!($site = Site::model()->findByPk(@$_POST['site_id']))) {
             throw new Exception("Site not found: " . @$_POST['site_id']);
         }
         if (!($cl = ContactLocation::model()->find('contact_id=? and site_id=?', array($contact->id, $site->id)))) {
             $cl = new ContactLocation();
             $cl->contact_id = $contact->id;
             $cl->site_id = $site->id;
             if (!$cl->save()) {
                 throw new Exception("Unable to save contact location: " . print_r($cl->getErrors(), true));
             }
         }
     } else {
         if (!($institution = Institution::model()->findByPk(@$_POST['institution_id']))) {
             throw new Exception("Institution not found: " . @$_POST['institution_id']);
         }
         if (!($cl = ContactLocation::model()->find('contact_id=? and institution_id=?', array($contact->id, $institution->id)))) {
             $cl = new ContactLocation();
             $cl->contact_id = $contact->id;
             $cl->institution_id = $institution->id;
             if (!$cl->save()) {
                 throw new Exception("Unable to save contact location: " . print_r($cl->getErrors(), true));
             }
         }
     }
     if (!($pca = PatientContactAssignment::model()->findByPk(@$_POST['pca_id']))) {
         throw new Exception("PCA not found: " . @$_POST['pca_id']);
     }
     $pca->location_id = $cl->id;
     if (!$pca->save()) {
         throw new Exception("Unable to save patient contact assignment: " . print_r($pca->getErrors(), true));
     }
     $this->redirect(array('/patient/view/' . $patient->id));
 }
开发者ID:openeyeswales,项目名称:OpenEyes,代码行数:42,代码来源:PatientController.php

示例4: actionLogin

 /**
  * Displays the login page
  */
 public function actionLogin()
 {
     if (!Yii::app()->user->isGuest) {
         $this->redirect('/');
         Yii::app()->end();
     }
     if (Yii::app()->params['required_user_agent'] && !preg_match(Yii::app()->params['required_user_agent'], @$_SERVER['HTTP_USER_AGENT'])) {
         if (!Yii::app()->params['required_user_agent_message']) {
             throw new Exception('You must define the required_user_agent_message parameter.');
         }
         return $this->render('login_wrong_browser');
     }
     $model = new LoginForm();
     // collect user input data
     if (isset($_POST['LoginForm'])) {
         $model->attributes = $_POST['LoginForm'];
         // validate user input and redirect to the previous page if valid
         if ($model->validate() && $model->login()) {
             // Flag site for confirmation
             Yii::app()->session['confirm_site_and_firm'] = true;
             $this->redirect(Yii::app()->user->returnUrl);
         }
     }
     $institution = Institution::model()->getCurrent();
     $criteria = new CDbCriteria();
     $criteria->compare('institution_id', $institution->id);
     $criteria->order = 'short_name asc';
     // display the login form
     $this->render('login', array('model' => $model));
 }
开发者ID:code-4-england,项目名称:OpenEyes,代码行数:33,代码来源:SiteController.php

示例5: actionConformance

 public function actionConformance()
 {
     $statement = new \services\FhirConformanceStatement(array('publisher' => Institution::model()->getCurrent()->name, 'date' => new \services\Date(), 'description' => 'OpenEyes at ' . Institution::model()->getCurrent()->short_name, 'url' => $this->createAbsoluteUrl('api/'), 'fhir_version' => self::FHIR_VERSION, 'accept_unknown' => true, 'profiles' => Yii::app()->service->listFhirSupportedProfiles(), 'server_resources' => Yii::app()->service->describeFhirServerResources()));
     $this->sendResource($statement);
 }
开发者ID:code-4-england,项目名称:OpenEyes,代码行数:5,代码来源:ApiController.php

示例6: actionDeleteDataSources

 public function actionDeleteDataSources()
 {
     if (!empty($_POST['source'])) {
         foreach ($_POST['source'] as $source_id) {
             if (Institution::model()->find('source_id=?', array($source_id))) {
                 echo "0";
                 return;
             }
             if (Site::model()->find('source_id=?', array($source_id))) {
                 echo "0";
                 return;
             }
             if (Person::model()->find('source_id=?', array($source_id))) {
                 echo "0";
                 return;
             }
         }
         foreach ($_POST['source'] as $source_id) {
             if ($source = ImportSource::model()->findByPk($source_id)) {
                 if (!$source->delete()) {
                     throw new Exception("Unable to delete import source: " . print_r($source->getErrors(), true));
                 }
             }
         }
         Audit::add('admin-DataSource', 'delete');
     }
     echo "1";
 }
开发者ID:openeyeswales,项目名称:OpenEyes,代码行数:28,代码来源:AdminController.php

示例7: getNotSelectedSiteList

 public function getNotSelectedSiteList()
 {
     $site_ids = array();
     foreach ($this->siteSelections as $site) {
         $site_ids[] = $site->id;
     }
     $criteria = new CDbCriteria();
     $criteria->compare('institution_id', Institution::model()->getCurrent()->id);
     $criteria->compare('active', 1);
     $criteria->addNotInCondition('id', $site_ids);
     $criteria->order = 'name asc';
     return Site::model()->findAll($criteria);
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:13,代码来源:User.php

示例8: actionAddSite

 public function actionAddSite()
 {
     if (@$_POST['site_id'] == 'all') {
         $sites = Institution::model()->getCurrent()->sites;
     } else {
         $sites = Site::model()->findAllByPk(@$_POST['site_id']);
     }
     foreach ($sites as $site) {
         if (!($us = UserSite::model()->find('site_id=? and user_id=?', array($site->id, Yii::app()->user->id)))) {
             $us = new UserSite();
             $us->site_id = $site->id;
             $us->user_id = Yii::app()->user->id;
             if (!$us->save()) {
                 throw new Exception("Unable to save UserSite: " . print_r($us->getErrors(), true));
             }
         }
     }
     echo "1";
 }
开发者ID:code-4-england,项目名称:OpenEyes,代码行数:19,代码来源:ProfileController.php

示例9: array

							</div>
						</div>

						<div class="row field-row">
							<div class="<?php 
    echo $form->columns('label');
    ?>
">
								<div class="label">Institution:</div>
							</div>
							<div class="<?php 
    echo $form->columns('field');
    ?>
">
								<?php 
    echo CHtml::dropDownList('institution_id', '', CHtml::listData(Institution::model()->active()->findAll(array('order' => 'name')), 'id', 'name'), array('empty' => '- Select -'));
    ?>
							</div>
						</div>

						<div class="row field-row siteID">
							<div class="<?php 
    echo $form->columns('label');
    ?>
">
								<div class="label">Site:</div>
							</div>
							<div class="<?php 
    echo $form->columns('field');
    ?>
">
开发者ID:openeyeswales,项目名称:OpenEyes,代码行数:31,代码来源:_patient_contacts.php

示例10: testGetCurrent_NotFound

 /**
  * @expectedException Exception
  * @expectedExceptionMessage Institution with code 'bar' not found
  */
 public function testGetCurrent_NotFound()
 {
     Yii::app()->params['institution_code'] = 'bar';
     Institution::model()->getCurrent();
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:9,代码来源:InstitutionTest.php

示例11: run

 public function run()
 {
     $model = new SiteAndFirmForm();
     $user = User::model()->findByPk(Yii::app()->user->id);
     if (isset($_POST['SiteAndFirmForm'])) {
         $model->attributes = $_POST['SiteAndFirmForm'];
         if ($model->validate()) {
             $user->changeFirm($model->firm_id);
             $user->last_site_id = $model->site_id;
             if (!$user->save(false)) {
                 throw new CException('Error saving user');
             }
             $user->audit('user', 'change-firm', $user->last_firm_id);
             Yii::app()->session['selected_site_id'] = $model->site_id;
             $this->controller->selectedSiteId = $model->site_id;
             Yii::app()->session['selected_firm_id'] = $model->firm_id;
             $this->controller->selectedFirmId = $model->firm_id;
             Yii::app()->session['confirm_site_and_firm'] = false;
             Yii::app()->event->dispatch('firm_changed', array('firm_id' => $model->firm_id));
             $firm = Firm::model()->findByPk($model->firm_id);
             $subspecialty_id = $firm->serviceSubspecialtyAssignment ? $firm->serviceSubspecialtyAssignment->subspecialty_id : null;
             if ($this->patient && ($episode = $this->patient->getOpenEpisodeOfSubspecialty($subspecialty_id))) {
                 Yii::app()->session['episode_hide_status'] = array($episode->id => 1);
             }
             // Redirect browser to clear POST
             $this->controller->redirect($this->returnUrl);
             Yii::app()->end();
         }
     } else {
         $model->firm_id = Yii::app()->session['selected_firm_id'];
         $model->site_id = Yii::app()->session['selected_site_id'];
     }
     if (!($sites = $user->siteSelections)) {
         $sites = Institution::model()->getCurrent()->sites;
     }
     $user_firm_ids = array();
     if (Yii::app()->params['profile_user_can_edit']) {
         // firm selections only apply when the user is able to change them.
         // if firms should be restricted then this should be done through UserFirmRights
         foreach ($user->firmSelections as $firm) {
             $user_firm_ids[] = $firm->id;
         }
     }
     $firms = array();
     if ($preferred_firms = $user->preferred_firms) {
         foreach ($preferred_firms as $preferred_firm) {
             if ($preferred_firm->active && (count($user_firm_ids) === 0 || in_array($preferred_firm->id, $user_firm_ids)) && (!$this->subspecialty || $preferred_firm->serviceSubspecialtyAssignment && $this->subspecialty->id == $preferred_firm->serviceSubspecialtyAssignment->subspecialty_id)) {
                 if ($preferred_firm->serviceSubspecialtyAssignment) {
                     $firms['Recent'][$preferred_firm->id] = "{$preferred_firm->name} ({$preferred_firm->serviceSubspecialtyAssignment->subspecialty->name})";
                 } else {
                     $firms['Recent'][$preferred_firm->id] = "{$preferred_firm->name}";
                 }
             }
         }
     }
     foreach ($this->controller->firms as $firm_id => $firm_label) {
         if ((count($user_firm_ids) === 0 || in_array($firm_id, $user_firm_ids)) && !isset($firms['Recent'][$firm_id])) {
             $firm = Firm::model()->findByPk($firm_id);
             if ($firm->active && (!$this->subspecialty || $firm->serviceSubspecialtyAssignment && $firm->serviceSubspecialtyAssignment->subspecialty_id == $this->subspecialty->id)) {
                 if ($preferred_firms) {
                     $firms['Other'][$firm_id] = $firm_label;
                 } else {
                     $firms[$firm_id] = $firm_label;
                 }
             }
         }
     }
     $this->render('SiteAndFirmWidget', array('model' => $model, 'firms' => $firms, 'sites' => CHtml::listData($sites, 'id', 'short_name')));
 }
开发者ID:code-4-england,项目名称:OpenEyes,代码行数:69,代码来源:SiteAndFirmWidget.php

示例12: getLongListForCurrentInstitution

 public function getLongListForCurrentInstitution()
 {
     $institution = Institution::model()->getCurrent();
     $result = array();
     foreach ($institution->sites as $site) {
         $site_name = '';
         if ($institution->short_name && $site->name != 'Unknown') {
             $site_name = $institution->short_name . ' at ';
         }
         $site_name .= $site->name;
         if ($site->location) {
             $site_name .= ', ' . $site->location;
         }
         $result[$site->id] = $site_name;
     }
     return $result;
 }
开发者ID:code-4-england,项目名称:OpenEyes,代码行数:17,代码来源:Site.php

示例13: getStructuredDataForPrintPDF

 /**
  * Element based name and value pair.
  *
  * @param \Event $event
  * @return array
  */
 protected function getStructuredDataForPrintPDF($event)
 {
     $data = array();
     $elements_array = array('Clinical', 'Clerical', 'ConsentSignature', 'Demographics');
     foreach ($elements_array as $el_name) {
         $element = $this->{"get{$el_name}ElementForEvent"}($event);
         if (method_exists($element, 'getStructuredDataForPrint')) {
             $data = array_merge($data, $element->getStructuredDataForPrint());
         }
     }
     $address = \Institution::model()->getCurrent()->getLetterAddress(array('include_name' => false, 'delimiter' => '\\n'));
     $data['hospitalAddress'] = \Helper::lineLimit($address, 2, 1, '\\n');
     $data['hospitalAddressMultiline'] = \Helper::lineLimit($address, 4, 1, '\\n');
     $data['hospitalNumber'] = $event->episode->patient->hos_num;
     return $data;
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:22,代码来源:OphCoCvi_Manager.php

示例14: getLongListForCurrentInstitution

 public function getLongListForCurrentInstitution()
 {
     $institution = Institution::model()->getCurrent();
     $display_query = SettingMetadata::model()->findByAttributes(array('key' => 'display_institution_name'));
     $display_institution = $display_query->getSettingName();
     $result = array();
     foreach ($institution->sites as $site) {
         $site_name = '';
         if ($institution->short_name && $site->name != 'Unknown') {
             if ($display_institution) {
                 $site_name = $institution->short_name . ' at ';
             }
         }
         $site_name .= $site->name;
         if ($site->location) {
             $site_name .= ', ' . $site->location;
         }
         $result[$site->id] = $site_name;
     }
     return $result;
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:21,代码来源:Site.php


注:本文中的Institution::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。