本文整理汇总了PHP中X2Model::getAssociationModel方法的典型用法代码示例。如果您正苦于以下问题:PHP X2Model::getAssociationModel方法的具体用法?PHP X2Model::getAssociationModel怎么用?PHP X2Model::getAssociationModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类X2Model
的用法示例。
在下文中一共展示了X2Model::getAssociationModel方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assertActionCreated
public function assertActionCreated($type, $message = null)
{
$action = Actions::model()->findBySql("SELECT * FROM x2_actions WHERE type='{$type}' ORDER BY createDate DESC,id DESC LIMIT 1");
$this->assertTrue((bool) $action, "Failed asserting that an action was created. {$type}");
$associatedModel = X2Model::getAssociationModel($action->associationType, $action->associationId);
// Test that the models are identical:
$this->eml->targetModel->refresh();
foreach (array('myModelName', 'id', 'name', 'lastUpdated', 'createDate', 'assignedTo', 'status') as $property) {
if ($this->eml->targetModel->hasProperty($property) && $associatedModel->hasProperty($property)) {
$this->assertEquals($this->eml->targetModel->{$property}, $associatedModel->{$property}, "Failed asserting that an action's associated model record was the same, property: {$property}. {$message}");
}
}
// Assert that the username fields are set properly:
foreach (array('assignedTo', 'completedBy') as $attr) {
$this->assertEquals('testuser', $action->assignedTo, "Failed asserting that {$attr} was set properly on the action record. {$message}");
}
}
示例2: recordEmailOpen
public function recordEmailOpen()
{
if ($this->opened === null) {
$openedAction = $this->createEmailOpenedAction();
$event = $this->createEmailOpenedEvent();
if ($openedAction->save() && $event->save()) {
$this->opened = time();
$this->update();
$model = X2Model::getAssociationModel($openedAction->associationType, $openedAction->associationId);
X2Flow::trigger('EmailOpenTrigger', array('model' => $model));
}
}
}
示例3: afterSave
public function afterSave()
{
$this->saveMetaData();
if ($this->reminder) {
if (!$this->isNewRecord) {
$this->deleteOldNotifications($this->notificationUsers);
}
$this->createNotifications($this->notificationUsers, $this->dueDate - $this->notificationTime * 60, 'action_reminder');
}
parent::afterSave();
$association = X2Model::getAssociationModel($this->associationType, $this->associationId);
if ($this->isNewRecord && $association && $association->hasAttribute('lastActivity')) {
$association->lastActivity = time();
$association->update(array('lastActivity'));
X2Flow::trigger('RecordUpdateTrigger', array('model' => $association));
}
}
示例4: getAssociation
public function getAssociation($type, $id)
{
return X2Model::getAssociationModel($type, $id);
}
示例5: array
echo "</span>";
echo "<span class='field-value'>";
echo Formatter::convertLineBreaks($model->actionDescription);
echo "</span>";
echo '<div>';
echo CHtml::ajaxSubmitButton(Yii::t('app', 'Submit'), 'update?id=' . $model->id, array(), array('id' => 'action-edit-submit-button', 'style' => 'display:none;float:left;', 'class' => 'hidden-frame-form x2-button highlight'));
echo CHtml::link(Yii::t('actions', 'View Full Edit Page'), array('update', 'id' => $model->id), array('style' => 'float:right;display:none;', 'target' => '_parent', 'class' => 'x2-button hidden-frame-form'));
echo '</div>';
?>
</div>
</div>
<?php
$this->endWidget();
?>
<?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>";
}
示例6: array
<?php
echo X2Html::editRecordbutton($model);
?>
</div>
<div class='<?php
echo $imageExists ? 'x2-layout-island ' : '';
?>
tray media-tray'>
<?php
if ($imageExists) {
?>
<div class='column'>
<?php
}
$assoc = X2Model::getAssociationModel($model->associationType, $model->associationId);
$this->widget('DetailView', array('model' => $model, 'scenario' => 'Default', 'specialFields' => array('associationId' => $assoc ? $assoc->link : ''), 'htmlOptions' => array('class' => $imageLink ? 'x2-layout-island' : '')));
echo $downloadLink;
?>
<?php
if ($imageExists) {
?>
</div>
<div class='column'>
<div class="media-image">
<div class='full-size-screen'>
<?php
echo X2Html::fa('expand') . ' ';
echo Yii::t('media', 'View Full Size');
?>
</div>
示例7: validateAssociationName
/**
* Synchronize association name with association type and id
*/
public function validateAssociationName($attribute)
{
$association = X2Model::getAssociationModel($this->associationType, $this->associationId);
if ($association) {
$this->associationName = $association->name;
}
}