本文整理汇总了PHP中DateTimeUtil::isDateTimeStringNull方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeUtil::isDateTimeStringNull方法的具体用法?PHP DateTimeUtil::isDateTimeStringNull怎么用?PHP DateTimeUtil::isDateTimeStringNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeUtil
的用法示例。
在下文中一共展示了DateTimeUtil::isDateTimeStringNull方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderExpirationDateTimeContent
protected static function renderExpirationDateTimeContent(GameReward $gameReward)
{
if (!DateTimeUtil::isDateTimeStringNull($gameReward->expirationDateTime)) {
$content = Zurmo::t('ZurmoModule', 'Until') . ' ';
return $content . DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($gameReward->expirationDateTime);
}
}
示例2: resolveValueAndSetToModel
/**
* Utilized to create or update model attribute values after a workflow's triggers are fired as true.
* @param WorkflowActionProcessingModelAdapter $adapter
* @param $attribute
* @throws NotSupportedException
*/
public function resolveValueAndSetToModel(WorkflowActionProcessingModelAdapter $adapter, $attribute)
{
assert('is_string($attribute)');
if ($this->type == static::TYPE_STATIC) {
$adapter->getModel()->{$attribute} = $this->value;
} elseif ($this->type == self::TYPE_DYNAMIC_FROM_TRIGGERED_DATETIME) {
$newTimeStamp = $this->resolveNewTimeStampForDuration(time());
$adapter->getModel()->{$attribute} = DateTimeUtil::convertTimestampToDbFormatDateTime($newTimeStamp);
} elseif ($this->type == self::TYPE_DYNAMIC_FROM_EXISTING_DATETIME) {
if (!DateTimeUtil::isDateTimeStringNull($adapter->getModel()->{$attribute})) {
$existingTimeStamp = DateTimeUtil::convertDbFormatDateTimeToTimestamp($adapter->getModel()->{$attribute});
$newTimeStamp = $this->resolveNewTimeStampForDuration($existingTimeStamp);
$newDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime($newTimeStamp);
$adapter->getModel()->{$attribute} = $newDateTime;
}
} else {
throw new NotSupportedException();
}
}
示例3: resolveItemToModelAndPopulateLatestActivityDateTime
/**
* @param Item $item
* @param $dateTime
* @param $modelClassName
* @throws FailedToSaveModelException
*/
public static function resolveItemToModelAndPopulateLatestActivityDateTime(Item $item, $dateTime, $modelClassName)
{
assert('is_string($dateTime)');
assert('is_string($modelClassName)');
$modelDerivationPathToItem = RuntimeUtil::getModelDerivationPathToItem($modelClassName);
try {
$castedDownModel = $item->castDown(array($modelDerivationPathToItem));
if (DateTimeUtil::isDateTimeStringNull($castedDownModel->latestActivityDateTime) || $dateTime > $castedDownModel->latestActivityDateTime) {
$castedDownModel->setLatestActivityDateTime($dateTime);
$saved = $castedDownModel->save();
if (!$saved) {
throw new FailedToSaveModelException();
}
}
} catch (NotFoundException $e) {
//do nothing
} catch (AccessDeniedSecurityException $e) {
//do nothing, since the current user cannot update the related model. Fail silently.
}
}
示例4: updateContactLatestActivityDateTimeByEmailMessage
/**
* Given a event, check that the event's sender is a EmailMessage and then check to process updating a related
* contact's latestActivityDateTime if it should
* Both sent and archived emails will have the sentDateTime just populated.
* @param CEvent $event
*/
public function updateContactLatestActivityDateTimeByEmailMessage(CEvent $event)
{
assert('$event->sender instanceof EmailMessage');
//Check for a just sent message
if (array_key_exists('sentDateTime', $event->sender->originalAttributeValues) && !DateTimeUtil::isDateTimeStringNull($event->sender->sentDateTime)) {
foreach ($event->sender->sender->personsOrAccounts as $senderPersonsOrAccount) {
$this->resolveItemToModelAndPopulateLatestActivityDateTime($senderPersonsOrAccount, $event->sender->sentDateTime, 'Contact');
}
foreach ($event->sender->recipients as $emailMessageRecipient) {
foreach ($emailMessageRecipient->personsOrAccounts as $recipientPersonsOrAccount) {
$this->resolveItemToModelAndPopulateLatestActivityDateTime($recipientPersonsOrAccount, $event->sender->sentDateTime, 'Contact');
}
}
}
}
示例5: resolveToAddJobTypeByModelByDateTimeAttribute
/**
* For a given model, and dateTime attribute, resolve to add a job by the job type. The delay is calculated
* based on the value of the dateTime attribute
* @param RedBeanModel $model
* @param $attributeName
* @param $jobType
*/
public function resolveToAddJobTypeByModelByDateTimeAttribute(RedBeanModel $model, $attributeName, $jobType)
{
assert('is_string($attributeName)');
assert('is_string($jobType)');
if ($model->getIsNewModel() || isset($model->originalAttributeValues[$attributeName])) {
if (DateTimeUtil::isDateTimeStringNull($model->{$attributeName})) {
$secondsFromNow = 0;
} else {
$processDateTimeStamp = DateTimeUtil::convertDbFormatDateTimeToTimestamp($model->{$attributeName});
$secondsFromNow = $processDateTimeStamp - time();
}
if ($secondsFromNow <= 0) {
$delay = 0;
} else {
$delay = $secondsFromNow;
}
Yii::app()->jobQueue->add($jobType, $delay + 5);
}
}
示例6: resolveTimeStampForDateTimeAttributeForProcessDateTime
/**
* @param TimeTriggerForWorkflowForm $trigger
* @param RedBeanModel $model
* @return int
* @throws ValueForProcessDateTimeIsNullException
*/
protected static function resolveTimeStampForDateTimeAttributeForProcessDateTime(TimeTriggerForWorkflowForm $trigger, RedBeanModel $model)
{
$dateTime = static::resolveModelValueByTimeTrigger($trigger, $model);
if (DateTimeUtil::isDateTimeStringNull($dateTime)) {
throw new ValueForProcessDateTimeIsNullException();
} else {
return $trigger->resolveNewTimeStampForDuration(DateTimeUtil::convertDbFormatDateTimeToTimestamp($dateTime));
}
}
示例7: processDataProviderAndGetCalendarItems
/**
* Process data provider and get calendar items.
* @param CalendarItemsDataProvider $dataProvider
* @return boolean
*/
public static function processDataProviderAndGetCalendarItems(CalendarItemsDataProvider $dataProvider)
{
$calendarItems = $dataProvider->getData(true);
$fullCalendarItems = array();
for ($k = 0; $k < count($calendarItems); $k++) {
$fullCalendarItem = array();
$calItem = $calendarItems[$k];
$fullCalendarItem['title'] = $calItem->getTitle();
$fullCalendarItem['start'] = $calItem->getStartDateTime();
if (!DateTimeUtil::isDateTimeStringNull($calItem->getEndDateTime())) {
$fullCalendarItem['end'] = $calItem->getEndDateTime();
} else {
$fullCalendarItem['end'] = '';
}
$fullCalendarItem['color'] = $calItem->getColor();
$fullCalendarItem['modelClass'] = $calItem->getModelClass();
$fullCalendarItem['modelId'] = $calItem->getModelId();
$fullCalendarItem['calendarId'] = $calItem->getCalendarId();
$fullCalendarItem['allDay'] = true;
$fullCalendarItems[] = $fullCalendarItem;
}
if (count($fullCalendarItems) > 0) {
ArrayUtil::sortArrayByElementField('compareCalendarItemsByDateTime', 'usort', $fullCalendarItems, 'CalendarUtil');
}
return $fullCalendarItems;
}