當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Appointment::populateWithArray方法代碼示例

本文整理匯總了PHP中Appointment::populateWithArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP Appointment::populateWithArray方法的具體用法?PHP Appointment::populateWithArray怎麽用?PHP Appointment::populateWithArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Appointment的用法示例。


在下文中一共展示了Appointment::populateWithArray方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _processEditAppointment

 public function _processEditAppointment(array $params)
 {
     $paramProviders = array();
     foreach ($params as $key => $val) {
         $providerPrefix = 'providerId-';
         if (substr($key, 0, strlen($providerPrefix)) == $providerPrefix) {
             $paramProviders[] = $val;
             unset($params[$key]);
         }
     }
     if (count($paramProviders) > 0) {
         // assign the first providerId
         $params['providerId'] = array_shift($paramProviders);
     }
     // extra providers if any, can be retrieved using $paramProviders variable, not sure where to place it
     $forced = (int) $this->_getParam('forced');
     $filter = $this->getCurrentDisplayFilter();
     $app = new Appointment();
     if (isset($params['appointmentId']) && $params['appointmentId'] > 0) {
         $app->appointmentId = (int) $params['appointmentId'];
         $app->populate();
     }
     $app->populateWithArray($params);
     if ($app->appointmentId > 0) {
         $app->lastChangeId = (int) Zend_Auth::getInstance()->getIdentity()->personId;
         $app->lastChangeDate = date('Y-m-d H:i:s');
     } else {
         $app->creatorId = (int) Zend_Auth::getInstance()->getIdentity()->personId;
         $app->createdDate = date('Y-m-d H:i:s');
     }
     $date = isset($params['date']) ? date('Y-m-d', strtotime($params['date'])) : date('Y-m-d');
     $app->walkin = isset($params['walkin']) ? 1 : 0;
     $app->start = $date . ' ' . date('H:i:s', strtotime($params['start']));
     $app->end = $date . ' ' . date('H:i:s', strtotime($params['end']));
     $data = array();
     if (!$forced && ($error = $app->checkRules())) {
         // prompt the user if the appointment being made would be a double book or is outside of schedule time.
         $data['error'] = $error;
     } else {
         $app->persist();
         //trigger_error(print_r($params,true));
         $data['appointmentId'] = $app->appointmentId;
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }
開發者ID:dragonlet,項目名稱:clearhealth,代碼行數:47,代碼來源:CalendarController.php

示例2: processAddAppointmentAction

 public function processAddAppointmentAction()
 {
     $appointment = $this->_getParam('appointment');
     $paramProviders = array();
     foreach ($appointment as $key => $val) {
         $providerPrefix = 'providerId-';
         if (substr($key, 0, strlen($providerPrefix)) == $providerPrefix) {
             $paramProviders[] = $val;
             unset($appointment[$key]);
         }
     }
     if (count($paramProviders) > 0) {
         // assign the first providerId
         $appointment['providerId'] = array_shift($paramProviders);
     }
     // extra providers if any, can be retrieved using $paramProviders variable, not sure where to place it
     $columnId = $this->_getParam('columnId');
     $rowId = $this->_getParam('rowId');
     $filter = $this->getCurrentDisplayFilter();
     if (strlen($columnId) <= 0) {
         // look for the column of the input provider
         if (strlen($appointment['providerId']) > 0) {
             foreach ($filter->columns as $index => $column) {
                 if ($column['providerId'] == $appointment['providerId']) {
                     $columnId = $index;
                     break;
                 }
             }
         }
         // in the meantime, no room checked, how are we going to check for the room?
     }
     if (!isset($filter->columns[$columnId])) {
         throw new Exception(__("Cannot generate column with that index, there is no filter defined for that column Index: ") . $columnId);
     }
     $column = $filter->columns[$columnId];
     $app = new Appointment();
     $app->populateWithArray($appointment);
     if ($app->appointmentId > 0) {
         $app->lastChangeId = (int) Zend_Auth::getInstance()->getIdentity()->personId;
         $app->lastChangeDate = date('Y-m-d H:i:s');
     } else {
         $app->creatorId = (int) Zend_Auth::getInstance()->getIdentity()->personId;
         $app->createdDate = date('Y-m-d H:i:s');
     }
     //$app->providerId = $appointment['providerId'];
     //$app->patientId = substr($appointment['patient'],stripos($appointment['patient'],'PID:') + 4);
     $app->walkin = isset($appointment['walkin']) ? 1 : 0;
     $app->start = $filter->date . ' ' . date('H:i:s', strtotime($appointment['start']));
     $app->end = $filter->date . ' ' . date('H:i:s', strtotime($appointment['end']));
     $app->persist();
     $data = array();
     $data['columnId'] = $columnId;
     $data['rowId'] = $rowId;
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }
開發者ID:jakedorst,項目名稱:ch3-dev-preview,代碼行數:57,代碼來源:CalendarController.php


注:本文中的Appointment::populateWithArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。