本文整理汇总了PHP中Library\Utility\Helper::incrementDateByTimezone方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::incrementDateByTimezone方法的具体用法?PHP Helper::incrementDateByTimezone怎么用?PHP Helper::incrementDateByTimezone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library\Utility\Helper
的用法示例。
在下文中一共展示了Helper::incrementDateByTimezone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIncrementedDateCity
/**
* @param $cityId
* @param $hours
* @return bool|string
*/
public function getIncrementedDateCity($cityId, $hours)
{
$cityDao = new \DDD\Dao\Geolocation\Cities($this->getServiceLocator(), 'ArrayObject');
$city = $cityDao->fetchOne(['id' => $cityId], ['timezone']);
if ($city && $city['timezone']) {
return Helper::incrementDateByTimezone($city['timezone'], $hours, 'Y-m-d H:i:s');
}
return date('Y-m-d H:i:s');
}
示例2: ajaxReportIncidentAction
public function ajaxReportIncidentAction()
{
/**
* @var \DDD\Dao\Booking\Booking $reservationDao
* @var \DDD\Service\Task $taskService
*/
$user = $this->getServiceLocator()->get('library_backoffice_auth');
$taskService = $this->getServiceLocator()->get('service_task');
$request = $this->getRequest();
$result = ['status' => 'success', 'msg' => 'Incident report has been created.', 'title' => '', 'taskId' => 0];
$taskId = (int) $request->getPost('task_id', 0);
try {
if ($request->isXmlHttpRequest() && $taskId) {
$task = $taskService->getTaskDao()->getTaskById($taskId);
$apartmentId = $task->getProperty_id();
$buildingId = $task->getBuildingId();
$resId = $task->getResId();
$timezone = $task->getTimezone();
$currentDateCity = Helper::getCurrenctDateByTimezone($timezone, 'Y-m-d H:i:s');
$ninetySixHoursLaterDateCity = Helper::incrementDateByTimezone($timezone, 96, 'Y-m-d H:i:s');
$userId = $user->getIdentity()->id;
$creator = $user->getIdentity()->id;
switch ((int) $request->getPost('incident_type', 0)) {
case HouseKeeping::INCIDENT_REPORT_EVIDENCE_OF_SMOKING:
$damageType = 'There was evidence of smoking';
break;
case HouseKeeping::INCIDENT_REPORT_KEYS_WERE_NOT_RETURNED:
$damageType = 'The keys were not returned';
break;
case HouseKeeping::INCIDENT_REPORT_DIRTY_HOUSE:
$damageType = 'The house was left in a unusually dirty condition';
break;
case HouseKeeping::INCIDENT_REPORT_BROKEN_FURNITURE:
$damageType = 'There was broken furniture';
break;
case HouseKeeping::INCIDENT_REPORT_OTHER:
$damageType = $request->getPost('description', 'Incident Report');
break;
}
$title = $damageType;
$description = '';
$incidentTaskId = $taskService->createReportIncidentTask($resId, $apartmentId, $buildingId, $currentDateCity, $ninetySixHoursLaterDateCity, $title, $creator, $description, $userId, $taskId);
$result['title'] = $title;
$result['taskId'] = $incidentTaskId;
}
} catch (\Exception $e) {
$result['status'] = 'error';
$result['msg'] = TextConstants::SERVER_ERROR;
}
return new JsonModel($result);
}