本文整理汇总了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);
}
示例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);
}