本文整理汇总了PHP中Formatter::formatDateDynamic方法的典型用法代码示例。如果您正苦于以下问题:PHP Formatter::formatDateDynamic方法的具体用法?PHP Formatter::formatDateDynamic怎么用?PHP Formatter::formatDateDynamic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formatter
的用法示例。
在下文中一共展示了Formatter::formatDateDynamic方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMessage
public function getMessage()
{
if (empty($this->modelId) || empty($this->modelType)) {
// skip if there is no association
$record = null;
} else {
if (class_exists($this->modelType)) {
$record = X2Model::model($this->modelType)->findByPk($this->modelId);
} else {
return 'Error: unknown record <b>' . $this->modelType . '</b>';
}
if ($record === null) {
$this->delete();
return null;
}
}
if (!isset($record) && $this->type !== 'lead_failure' && $this->type !== 'custom') {
// return var_dump($this->attributes);
return null;
}
$passive = $this->createdBy === 'API' || empty($this->createdBy);
switch ($this->type) {
case 'action_complete':
if ($passive) {
return Yii::t('actions', 'Action completed: {action}', array('{action}' => $record->getLink()));
} else {
return Yii::t('actions', '{user} completed an action: {action}', array('{user}' => User::getUserLinks($record->completedBy), '{action}' => $record->getLink(20)));
}
case 'action_reminder':
return Yii::t('actions', '<b>Reminder!</b> The following action is due: {action}', array('{action}' => $record->getLink()));
// case 'workflow_complete':
// if($passive)
// return Yii::t('actions','Stage {n}: {stage} was completed for {record}',array('{record}'=>$record->getLink()));
// else
// return Yii::t('actions','{user} completed stage {n}: {stage} was completed for {record}',array('{record}'=>$record->getLink()));
// case 'workflow_complete':
// if($passive)
// return Yii::t('actions','Stage {n}: {stage} was completed for {record}',array('{record}'=>$record->getLink()));
// else
// return Yii::t('actions','{user} completed stage {n}: {stage} was completed for {record}',array('{record}'=>$record->getLink()));
case 'create':
return Yii::t('app', 'New record assigned to you: {link}.', array('{link}' => $record->getLink()));
case 'change':
if ($this->comparison == 'change') {
$msg = $passive ? '{record}\'s {field} was changed to {value}' : '{user} changed {record}\'s {field} to {value}';
return Yii::t('app', $msg, array('{field}' => $record->getAttributeLabel($this->fieldName), '{value}' => $record->renderAttribute($this->fieldName, true, true), '{record}' => $record->getLink(), '{user}' => Yii::app()->user->getName() == $this->createdBy ? CHtml::link('You', array('/profile/view', 'id' => Yii::app()->user->getId())) : User::getUserLinks($this->createdBy)));
} else {
// > < =
$msg = $passive ? '{record}\'s {field} was changed to {value}' : '{user} changed {record}\'s {field} to {value}';
return Yii::t('app', $msg, array('{field}' => $record->getAttributeLabel($this->fieldName), '{value}' => $record->renderAttribute($this->fieldName, true, true), '{record}' => $record->getLink(), '{user}' => Yii::app()->user->getName() == $this->createdBy ? CHtml::link('You', array('/profile/view', 'id' => Yii::app()->user->getId())) : User::getUserLinks($this->createdBy)));
}
case 'lead_failure':
return Yii::t('app', 'A lead failed to come through Lead Capture. Check {link} to recover it.', array('{link}' => CHtml::link(Yii::t('app', 'here'), Yii::app()->controller->createUrl('/contacts/contacts/cleanFailedLeads'))));
case 'assignment':
if ($passive) {
return Yii::t('app', 'You have been assigned a record: {record}', array('{record}' => $record->getLink()));
} else {
return Yii::t('app', '{user} assigned a record to you: {record}', array('{user}' => User::getUserLinks($this->createdBy), '{record}' => $record->getLink()));
}
case 'delete':
if ($passive) {
return Yii::t('app', 'Record deleted: {record}', array('{record}' => $this->modelType . ' ' . $this->modelId));
} else {
return Yii::t('app', '{user} deleted a record: {record}', array('{user}' => User::getUserLinks($this->createdBy), '{record}' => $this->modelType . ' ' . $this->modelId));
}
case 'event_broadcast':
return Yii::t('app', '{user} broadcast an event: {event}', array('{user}' => User::getUserLinks($record->user), '{event}' => $record->getText()));
case 'update':
if ($passive) {
return Yii::t('app', 'Record updated: {record}', array('{record}' => $record->getLink()));
} else {
return Yii::t('app', '{user} updated a record: {record}', array('{user}' => User::getUserLinks($this->createdBy), '{record}' => $record->getLink()));
}
case 'dup_discard':
if ($passive) {
return Yii::t('app', 'A record has been marked as a duplicate and hidden to everyone but the admin: {record}', array('{record}' => $record->getLink()));
} else {
return Yii::t('app', '{user} marked a record as a duplicate. This record is hidden to everyone but the admin: {record}', array('{user}' => User::getUserLinks($this->createdBy), '{record}' => $record->getLink()));
}
case 'email_clicked':
return Yii::t('app', '{record} clicked an email link: {campaign}', array('{record}' => $record->getLink(), '{campaign}' => $this->value));
case 'email_opened':
return Yii::t('app', '{record} opened an email: {campaign}', array('{record}' => $record->getLink(), '{campaign}' => $this->value));
case 'email_unsubscribed':
return Yii::t('app', '{record} unsubscribed from a campaign: {campaign}', array('{record}' => $record->getLink(), '{campaign}' => $this->value));
case 'social_post':
return Yii::t('app', '{user} posted on {link}', array('{user}' => User::getUserLinks($this->createdBy), '{link}' => $record->getLink()));
case 'social_comment':
return Yii::t('app', '{user} replied on {link}', array('{user}' => User::getUserLinks($this->createdBy), '{link}' => $record->getLink()));
case 'voip_call':
return Yii::t('app', 'Incoming call from <b>{phone}</b> ({record}) {time}', array('{record}' => $record->getLink(), '{phone}' => $this->value, '{time}' => Formatter::formatDateDynamic($this->createDate)));
case 'weblead':
return Yii::t('app', 'New web lead: {link}.', array('{link}' => $record->getLink()));
case 'webactivity':
if ($record instanceof Actions) {
if ($link = $record->getAssociationLink()) {
return Yii::t('app', '{name} is currently on {url}', array('{name}' => $link, '{url}' => $record->actionDescription));
}
} elseif ($record instanceof Contacts) {
return Yii::t('app', '{name} is currently on your website.', array('{name}' => $record->getLink()));
//.........这里部分代码省略.........
示例2: dynamicDate
public static function dynamicDate($date)
{
return '<span title="' . CHtml::encode(Formatter::formatCompleteDate($date)) . '">' . CHtml::encode(Formatter::formatDateDynamic($date)) . '</span>';
}