本文整理汇总了PHP中X2Model::getModelLink方法的典型用法代码示例。如果您正苦于以下问题:PHP X2Model::getModelLink方法的具体用法?PHP X2Model::getModelLink怎么用?PHP X2Model::getModelLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类X2Model
的用法示例。
在下文中一共展示了X2Model::getModelLink方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getText
public function getText(array $params = array(), array $htmlOptions = array())
{
$truncated = array_key_exists('truncated', $params) ? $params['truncated'] : false;
$requireAbsoluteUrl = array_key_exists('requireAbsoluteUrl', $params) ? $params['requireAbsoluteUrl'] : false;
$text = "";
$authorText = "";
if (Yii::app()->user->getName() == $this->user) {
$authorText = CHtml::link(Yii::t('app', 'You'), Yii::app()->controller->createAbsoluteUrl('/profile/view', array('id' => Yii::app()->user->getId())), $htmlOptions);
} else {
$authorText = User::getUserLinks($this->user);
}
if (!empty($authorText)) {
$authorText .= " ";
}
switch ($this->type) {
case 'notif':
$parent = X2Model::model('Notification')->findByPk($this->associationId);
if (isset($parent)) {
$text = $parent->getMessage();
} else {
$text = Yii::t('app', "Notification not found");
}
break;
case 'record_create':
$actionFlag = false;
if (class_exists($this->associationType)) {
if (count(X2Model::model($this->associationType)->findAllByPk($this->associationId)) > 0) {
if ($this->associationType == 'Actions') {
$action = X2Model::model('Actions')->findByPk($this->associationId);
if (isset($action) && (strcasecmp($action->associationType, 'contacts') === 0 || in_array($action->type, array('call', 'note', 'time')))) {
// Special considerations for publisher-created actions, i.e. call,
// note, time, and anything associated with a contact
$actionFlag = true;
// Retrieve the assigned user from the related action
$relatedAction = Actions::model()->findByPk($this->associationId);
if ($authorText) {
$authorText = User::getUserLinks($relatedAction->assignedTo);
}
}
}
if ($actionFlag) {
$authorText = empty($authorText) ? Yii::t('app', 'Someone') : $authorText;
switch ($action->type) {
case 'call':
$text = Yii::t('app', '{authorText} logged a call ({duration}) with {modelLink}: "{logAbbrev}"', array('{authorText}' => $authorText, '{duration}' => empty($action->dueDate) || empty($action->completeDate) ? Yii::t('app', 'duration unknown') : Formatter::formatTimeInterval($action->dueDate, $action->completeDate, '{hoursMinutes}'), '{modelLink}' => X2Model::getModelLink($action->associationId, ucfirst($action->associationType), $requireAbsoluteUrl), '{logAbbrev}' => CHtml::encode($action->actionDescription)));
break;
case 'note':
$text = Yii::t('app', '{authorText} posted a comment on {modelLink}: "{noteAbbrev}"', array('{authorText}' => $authorText, '{modelLink}' => X2Model::getModelLink($action->associationId, ucfirst($action->associationType), $requireAbsoluteUrl), '{noteAbbrev}' => CHtml::encode($action->actionDescription)));
break;
case 'time':
$text = Yii::t('app', '{authorText} logged {time} on {modelLink}: "{noteAbbrev}"', array('{authorText}' => $authorText, '{time}' => Formatter::formatTimeInterval($action->dueDate, $action->dueDate + $action->timeSpent, '{hoursMinutes}'), '{modelLink}' => X2Model::getModelLink($action->associationId, ucfirst($action->associationType)), '{noteAbbrev}' => CHtml::encode($action->actionDescription)));
break;
default:
if (!empty($authorText)) {
$text = Yii::t('app', "A new {actionLink} associated with the contact {contactLink} has been assigned to " . $authorText, array('{actionLink}' => CHtml::link(Events::parseModelName($this->associationType), '#', array_merge($htmlOptions, array('class' => 'action-frame-link', 'data-action-id' => $this->associationId))), '{contactLink}' => X2Model::getModelLink($action->associationId, ucfirst($action->associationType), $requireAbsoluteUrl)));
} else {
$text = Yii::t('app', "A new {actionLink} associated with the contact {contactLink} has been created.", array('{actionLink}' => CHtml::link(Events::parseModelName($this->associationType), '#', array_merge($htmlOptions, array('class' => 'action-frame-link', 'data-action-id' => $this->associationId))), '{contactLink}' => X2Model::getModelLink($action->associationId, ucfirst($action->associationType), $requireAbsoluteUrl)));
}
}
} else {
if (!empty($authorText)) {
$modelLink = X2Model::getModelLink($this->associationId, $this->associationType, $requireAbsoluteUrl);
if (isset($action) && $this->user !== $action->assignedTo) {
// Include the assignee if this is for an action assigned to someone other than the creator
$translateText = "created a new {modelName} for {assignee}, {modelLink}";
} elseif ($modelLink !== '') {
$translateText = "created a new {modelName}, {modelLink}";
} else {
$translateText = "created a new {modelName}";
}
$text = $authorText . Yii::t('app', $translateText, array('{modelName}' => Events::parseModelName($this->associationType), '{modelLink}' => $modelLink, '{assignee}' => isset($action) ? User::getUserLinks($action->assignedTo) : null));
} else {
$text = Yii::t('app', "A new {modelName}, {modelLink}, has been created.", array('{modelName}' => Events::parseModelName($this->associationType), '{modelLink}' => X2Model::getModelLink($this->associationId, $this->associationType, $requireAbsoluteUrl)));
}
}
} else {
$deletionEvent = X2Model::model('Events')->findByAttributes(array('type' => 'record_deleted', 'associationType' => $this->associationType, 'associationId' => $this->associationId));
if (isset($deletionEvent)) {
if (!empty($authorText)) {
$text = $authorText . Yii::t('app', "created a new {modelName}, {deletionText}. It has been deleted.", array('{modelName}' => Events::parseModelName($this->associationType), '{deletionText}' => $deletionEvent->text));
} else {
$text = Yii::t('app', "A {modelName}, {deletionText}, was created. It has been deleted.", array('{modelName}' => Events::parseModelName($this->associationType), '{deletionText}' => $deletionEvent->text));
}
} else {
if (!empty($authorText)) {
$text = $authorText . Yii::t('app', "created a new {modelName}, but it could not be found.", array('{modelName}' => Events::parseModelName($this->associationType)));
} else {
$text = Yii::t('app', "A {modelName} was created, but it could not be found.", array('{modelName}' => Events::parseModelName($this->associationType)));
}
}
}
}
break;
case 'weblead_create':
if (count(X2Model::model($this->associationType)->findAllByPk($this->associationId)) > 0) {
$text = Yii::t('app', "A new web lead has come in: {modelLink}", array('{modelLink}' => X2Model::getModelLink($this->associationId, $this->associationType)));
} else {
$deletionEvent = X2Model::model('Events')->findByAttributes(array('type' => 'record_deleted', 'associationType' => $this->associationType, 'associationId' => $this->associationId));
if (isset($deletionEvent)) {
$text = Yii::t('app', "A new web lead has come in: {deletionText}. It has been deleted.", array('{deletionText}' => $deletionEvent->text));
//.........这里部分代码省略.........
示例2: echo
echo ($legacy ? '<br />' : '') . CHtml::link(Yii::t('app', '[View email]'), '#', array('onclick' => 'return false;', 'id' => $data->id, 'class' => 'email-frame'));
} elseif ($data->type == 'quotesDeleted') {
echo $data->actionDescription;
} elseif ($data->type == 'quotes') {
$data->renderInlineViewLink();
} else {
echo Yii::app()->controller->convertUrls(CHtml::encode($data->actionDescription));
}
}
// convert LF and CRLF to <br />
?>
</div>
<div class="footer">
<?php
if (isset($relationshipFlag) && $relationshipFlag && $data->associationId !== 0 && X2Model::getModelName($data->associationType) !== false) {
$relString = " | " . X2Model::getModelLink($data->associationId, X2Model::getModelName($data->associationType));
} else {
$relString = "";
}
if (empty($data->type) || $data->type == 'weblead' || $data->type == 'workflow') {
if ($data->complete == 'Yes') {
echo Yii::t('actions', 'Completed by {name}', array('{name}' => User::getUserLinks($data->completedBy))) . $relString;
} else {
$userLink = User::getUserLinks($data->assignedTo);
$userLink = empty($userLink) ? Yii::t('actions', 'Anyone') : $userLink;
echo Yii::t('actions', 'Assigned to {name}', array('{name}' => $userLink)) . $relString;
}
} else {
if (in_array($data->type, array('note', 'call', 'emailOpened', 'time'))) {
echo $data->completedBy == 'Guest' ? "Guest" : User::getUserLinks($data->completedBy) . $relString;
// echo ' '.Formatter::formatDate($data->completeDate);
示例3: array
<?php
if (!empty($model->associationType) && is_numeric($model->associationId) && !is_null(X2Model::getAssociationModel($model->associationType, $model->associationId)) && ($publisher == 'false' || !$publisher)) {
?>
<div id="recordBody" class="form">
<?php
echo '<div class="page-title"><h3>' . Yii::t('actions', 'Associated Record') . '</h3></div>';
?>
<?php
if ($model->associationType == 'contacts') {
$this->widget('DetailView', array('model' => X2Model::model('Contacts')->findByPk($model->associationId), 'scenario' => 'Inline', 'nameLink' => true));
// $this->renderPartial('application.modules.contacts.views.contacts._@DETAILVIEWMini', array(
// 'model' => X2Model::model('Contacts')->findByPk($model->associationId),
// 'actionModel' => $model,
// ));
} else {
echo ucwords(Events::parseModelName(X2Model::getModelName($model->associationType))) . ": <span class='model-link'>" . X2Model::getModelLink($model->associationId, X2Model::getModelName($model->associationType)) . "</span>";
}
?>
</div>
<?php
}
?>
</div>
<div id="actionFooter">
</div>
</body>
</html>
<script>
$(document).on('ready',function(){
$.datepicker.setDefaults( $.datepicker.regional[ '<?php
echo $language;