当前位置: 首页>>代码示例>>PHP>>正文


PHP X2Model::getModelTypesWhichSupportRelationships方法代码示例

本文整理汇总了PHP中X2Model::getModelTypesWhichSupportRelationships方法的典型用法代码示例。如果您正苦于以下问题:PHP X2Model::getModelTypesWhichSupportRelationships方法的具体用法?PHP X2Model::getModelTypesWhichSupportRelationships怎么用?PHP X2Model::getModelTypesWhichSupportRelationships使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在X2Model的用法示例。


在下文中一共展示了X2Model::getModelTypesWhichSupportRelationships方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute(&$params)
 {
     // make sure this is a valid model type
     if (!is_subclass_of($this->config['modelClass'], 'X2Model')) {
         return array(false, "");
     }
     if (!isset($this->config['attributes']) || empty($this->config['attributes'])) {
         return array(false, "");
     }
     // verify that if create relationship option was set, that a relationship can be made
     if ($this->parseOption('createRelationship', $params)) {
         $acceptedModelTypes = X2Model::getModelTypesWhichSupportRelationships();
         if (!in_array($this->config['modelClass'], $acceptedModelTypes)) {
             return array(false, Yii::t('x2flow', 'Relationships cannot be made with records ' . 'of type {type}.', array('{type}' => $this->config['modelClass'])));
         }
         if (!isset($params['model'])) {
             // no model passed to trigger
             return array(false, '');
         }
         if (!in_array(get_class($params['model']), $acceptedModelTypes)) {
             return array(false, Yii::t('x2flow', 'Relationships cannot be made with records ' . 'of type {type}.', array('{type}' => get_class($params['model']))));
         }
     }
     $model = new $this->config['modelClass']();
     $model->setScenario('X2FlowCreateAction');
     if ($this->setModelAttributes($model, $this->config['attributes'], $params) && $model->save()) {
         if ($this->parseOption('createRelationship', $params)) {
             Relationships::create(get_class($params['model']), $params['model']->id, get_class($model), $model->id);
         }
         return array(true, Yii::t('studio', 'View created record: ') . $model->getLink());
     } else {
         $errors = $model->getErrors();
         return array(false, array_shift($errors));
     }
 }
开发者ID:keyeMyria,项目名称:CRM,代码行数:35,代码来源:X2FlowRecordCreate.php

示例2: array

?>
</span>
		</div>
		<div class="tableWrapper">
			<table>
				<tbody>
					<tr class="formSectionRow">
						<td style="">
							<div class="formItem leftLabel">
								<label><?php 
echo Yii::t('media', 'Association Type');
?>
</label>
								<div class="formInputBox" style="height: auto;">
									<?php 
$linkableModels = X2Model::getModelTypesWhichSupportRelationships(true);
$this->widget('MultiTypeAutocomplete', array('selectName' => 'Media[associationType]', 'hiddenInputName' => 'Media[associationId]', 'selectValue' => '', 'options' => array_merge(array('' => Yii::t('app', 'None')), array_diff_key($linkableModels, array_flip(array('Media', 'Groups', 'X2List', 'Actions', 'Reports'))), array('bg' => Yii::t('app', 'Background'))), 'staticOptions' => array('', 'bg'), 'htmlOptions' => array('class' => 'media-association-type')));
//                                    echo $form->dropDownList($model,'associationType',
//										array(
//											'none'=>Yii::t('actions','None'),
//											'contacts'=>Yii::t('actions','Contact'),
//											'opportunities'=>Yii::t('actions','Opportunity'),
//											'accounts'=>Yii::t('actions','Account'),
//											'bg'=>Yii::t('media', 'Background'),
//										), array('onChange'=>'showAssociationAutoComplete(this)'));
?>
								</div>
							</div>
							
						</td>
					</tr>
开发者ID:dsyman2,项目名称:X2CRM,代码行数:31,代码来源:upload.php

示例3: validateType

 /**
  * Ensure that type corresponds to child of X2Model which supports relationships 
  */
 public function validateType($attr)
 {
     $value = $this->{$attr};
     $validTypes = X2Model::getModelTypesWhichSupportRelationships(true);
     if (!class_exists($value) || !isset($validTypes[$value])) {
         $this->addError($attr, Yii::t('app', 'Invalid record type'));
     }
 }
开发者ID:dsyman2,项目名称:X2CRM,代码行数:11,代码来源:Relationships.php

示例4: getViewFileParams

 public function getViewFileParams()
 {
     if (!isset($this->_viewFileParams)) {
         $linkableModels = X2Model::getModelTypesWhichSupportRelationships(true);
         asort($linkableModels);
         // used to instantiate html dropdown
         $linkableModelsOptions = $linkableModels;
         $hasUpdatePermissions = $this->checkModuleUpdatePermissions();
         $this->_viewFileParams = array_merge(parent::getViewFileParams(), array('model' => $this->model, 'modelName' => get_class($this->model), 'linkableModelsOptions' => $linkableModelsOptions, 'hasUpdatePermissions' => $hasUpdatePermissions, 'height' => $this->getWidgetProperty('height')));
     }
     return $this->_viewFileParams;
 }
开发者ID:shayanyi,项目名称:CRM,代码行数:12,代码来源:InlineRelationshipsWidget.php


注:本文中的X2Model::getModelTypesWhichSupportRelationships方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。