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


PHP X2Model::getAssociationType方法代码示例

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


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

示例1: getAssociationType

 public function getAssociationType()
 {
     if (!isset($this->_associationType)) {
         $this->_associationType = X2Model::getAssociationType(get_class($this->model));
     }
     return $this->_associationType;
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:7,代码来源:WorkflowStageDetailsWidget.php

示例2: associateAction

 /**
  * Add note to model 
  * @param X2Model $model model to which note should be added
  * @param string $note
  */
 public static function associateAction(X2Model $model, array $attributes)
 {
     $now = time();
     $action = new Actions();
     $action->setAttributes(array_merge(array('assignedTo' => $model->assignedTo, 'visibility' => '1', 'associationType' => X2Model::getAssociationType(get_class($model)), 'associationId' => $model->id, 'associationName' => $model->name, 'createDate' => $now, 'lastUpdated' => $now, 'completeDate' => $now, 'complete' => 'Yes', 'updatedBy' => 'admin'), $attributes), false);
     return $action->save();
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:12,代码来源:Actions.php

示例3: getModelTypesWhichSupportWorkflow

 /**
  * Like getModelTypes () except that only types of models which support workflow are 
  * returned
  * @param boolean $assoc
  * @return array 
  */
 public static function getModelTypesWhichSupportWorkflow($assoc = false, $associationTypes = false)
 {
     $modelTypes = self::getModelTypes($assoc);
     $tmp = $assoc ? array_flip($modelTypes) : $modelTypes;
     $tmp = array_filter($tmp, function ($a) use($assoc) {
         return X2Model::Model($a)->supportsWorkflow;
     });
     $tmp = $assoc ? array_flip($tmp) : $tmp;
     $tmp = array_intersect($modelTypes, $tmp);
     if ($associationTypes) {
         $arr = array();
         foreach ($tmp as $k => $v) {
             if ($assoc) {
                 $arr[X2Model::getAssociationType($k)] = $v;
             } else {
                 $arr[] = X2Model::getAssociationType($v);
             }
         }
         $tmp = $arr;
     }
     return $tmp;
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:28,代码来源:X2Model.php

示例4: actionCreate

 /**
  * Creates a new model.
  *
  * If creation is successful, the browser will be redirected to the 'view' page.
  *
  * @param bool $quick If true, this indicates the action is being requested via AJAX
  */
 public function actionCreate($quick = false, $duplicate = false)
 {
     $model = new Quote();
     if ($duplicate && !isset($_POST['Quote'])) {
         $copiedModel = Quote::model()->findByPk($duplicate);
         if (!empty($copiedModel)) {
             foreach ($copiedModel->attributes as $name => $value) {
                 if ($name != 'id') {
                     $model->{$name} = $value;
                 }
             }
             $model->setLineItems($this->duplicateLineItems($copiedModel), false, true);
         }
     }
     $users = User::getNames();
     if ($quick && !Yii::app()->request->isAjaxRequest) {
         throw new CHttpException(400);
     }
     $currency = Yii::app()->params->currency;
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Quote'])) {
         $model->setX2Fields($_POST['Quote']);
         $model->currency = $currency;
         $model->createDate = time();
         $model->lastUpdated = $model->createDate;
         $model->createdBy = Yii::app()->user->name;
         $model->updatedBy = $model->createdBy;
         if (empty($model->name)) {
             $model->name = '';
         }
         if (isset($_POST['lineitem'])) {
             $model->lineItems = $_POST['lineitem'];
         }
         if (!$model->hasLineItemErrors) {
             if ($model->save()) {
                 $model->createEventRecord();
                 $model->createActionRecord();
                 $model->saveLineItems();
                 if (!$quick) {
                     $this->redirect(array('view', 'id' => $model->id));
                 } else {
                     if (isset($_GET['recordId']) && isset($_GET['recordType'])) {
                         $recordId = $_GET['recordId'];
                         $recordType = $_GET['recordType'];
                         $relatedModel = X2Model::model($_GET['recordType'])->findByPk($recordId);
                         // tie record to quote
                         if ($relatedModel) {
                             $relate = new Relationships();
                             $relate->firstId = $model->id;
                             $relate->firstType = "Quote";
                             $relate->secondId = $relatedModel->id;
                             $relate->secondType = $recordType;
                             $relate->save();
                             $model->createAssociatedAction(X2Model::getAssociationType(get_class($relatedModel)), $relatedModel->id);
                         }
                     }
                     return;
                 }
             }
         }
     }
     // get products
     $products = Product::activeProducts();
     $viewData = array('model' => $model, 'users' => $users, 'products' => $products, 'quick' => $quick);
     if (!$quick) {
         $this->render('create', $viewData);
     } else {
         if ($model->hasErrors() || $model->hasLineItemErrors) {
             // Sneak into the response that validation failed via setting
             // the response code manually:
             header('HTTP/1.1 400 Validation Error');
         }
         $this->renderPartial('create', $viewData, false, true);
     }
 }
开发者ID:xl602,项目名称:X2CRM,代码行数:83,代码来源:QuotesController.php

示例5: getDataProvider

 /**
  * @return object Data provider object to be used for the grid view
  */
 public function getDataProvider()
 {
     if (!isset($this->_dataProvider)) {
         $resultsPerPage = $this->getWidgetProperty('resultsPerPage');
         $historyCmd = History::getCriteria($this->model->id, X2Model::getAssociationType(get_class($this->model)), Yii::app()->params->profile->historyShowRels, $this->historyType);
         $this->_dataProvider = new CSqlDataProvider($historyCmd['cmd'], array('totalItemCount' => $historyCmd['count'], 'params' => $historyCmd['params'], 'pagination' => array('pageSize' => $resultsPerPage)));
         //            $this->_dataProvider = $this->getSearchModel()->search(
         //                    History::getCriteria(
         //                            $this->model->id, X2Model::getAssociationType(get_class($this->model)), $this->getWidgetProperty('showRelatedRecords'), $this->historyType), $resultsPerPage
         //            );
         // clear order set by Actions::search and History::getCriteria
         //$this->_dataProvider->criteria->order = '';
     }
     return $this->_dataProvider;
 }
开发者ID:keyeMyria,项目名称:CRM,代码行数:18,代码来源:TransactionalViewWidget.php

示例6: array

 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY X2ENGINE, X2ENGINE DISCLAIMS THE WARRANTY
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 * 
 * You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley,
 * California 95067, USA. or at email address contact@x2engine.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * X2Engine" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by X2Engine".
 *****************************************************************************************/
$associationType = X2Model::getAssociationType(get_class($model));
$this->widget('Publisher', array('associationType' => $associationType, 'associationId' => $model->id, 'assignedTo' => Yii::app()->user->getName(), 'calendar' => false));
$this->widget('History', array('associationType' => $associationType, 'associationId' => $model->id));
开发者ID:tymiles003,项目名称:X2CRM,代码行数:31,代码来源:_publisherWidget.php

示例7: getActionHeader

 /**
  * Magic getter for {@link actionHeader}
  *
  * Composes an informative header for the action record.
  *
  * @return type
  */
 public function getActionHeader()
 {
     if (!isset($this->_actionHeader)) {
         $recipientContacts = $this->recipientContacts;
         // Add email headers to the top of the action description's body
         // so that the resulting recorded action has all the info of the
         // original email.
         $fromString = $this->from['address'];
         if (!empty($this->from['name'])) {
             $fromString = '"' . $this->from['name'] . '" <' . $fromString . '>';
         }
         $header = CHtml::tag('strong', array(), Yii::t('app', 'Subject: ')) . CHtml::encode($this->subject) . '<br />';
         $header .= CHtml::tag('strong', array(), Yii::t('app', 'From: ')) . CHtml::encode($fromString) . '<br />';
         // Put in recipient lists, and if any correspond to contacts, make links
         // to them in place of their names.
         foreach (array('to', 'cc', 'bcc') as $recList) {
             if (!empty($this->mailingList[$recList])) {
                 $header .= CHtml::tag('strong', array(), ucfirst($recList) . ': ');
                 foreach ($this->mailingList[$recList] as $target) {
                     if ($recipientContacts[$target[1]] != null) {
                         $header .= $recipientContacts[$target[1]]->link;
                     } else {
                         $header .= CHtml::encode("\"{$target[0]}\"");
                     }
                     $header .= CHtml::encode(" <{$target[1]}>,");
                 }
                 $header = rtrim($header, ', ') . '<br />';
             }
         }
         // Include special quote information if it's a quote being issued or emailed to a random contact
         if ($this->modelName == 'Quote') {
             $header .= '<br /><hr />';
             $header .= CHtml::tag('strong', array(), Yii::t('quotes', $this->targetModel->type == 'invoice' ? 'Invoice' : 'Quote')) . ':';
             $header .= ' ' . $this->targetModel->link . ($this->targetModel->status ? ' (' . $this->targetModel->status . '), ' : ' ') . Yii::t('app', 'Created') . ' ' . $this->targetModel->renderAttribute('createDate') . ';';
             $header .= ' ' . Yii::t('app', 'Updated') . ' ' . $this->targetModel->renderAttribute('lastUpdated') . ' by ' . $this->userProfile->fullName . '; ';
             $header .= ' ' . Yii::t('quotes', 'Expires') . ' ' . $this->targetModel->renderAttribute('expirationDate');
             $header .= '<br />';
         }
         // Attachments info
         if (!empty($this->attachments)) {
             $header .= '<br /><hr />';
             $header .= CHtml::tag('strong', array(), Yii::t('media', 'Attachments:')) . "<br />";
             $i = 0;
             foreach ($this->attachments as $attachment) {
                 if ($i++) {
                     $header .= '<br />';
                 }
                 if ($attachment['type'] === 'temp') {
                     // attempt to convert temporary file to media record
                     if ($this->modelId && $this->modelName) {
                         $associationId = $this->modelId;
                         $associationType = X2Model::getAssociationType($this->modelName);
                     } elseif ($contact = reset($recipientContacts)) {
                         $associationId = $contact->id;
                         $associationType = 'contacts';
                     }
                     if (isset($associationId) && ($media = $attachment['model']->convertToMedia(array('associationType' => $associationType, 'associationId' => $associationId)))) {
                         $attachment['type'] = 'media';
                         $attachment['id'] = $media->id;
                     }
                 }
                 if ($attachment['type'] === 'media' && ($media = Media::model()->findByPk($attachment['id']))) {
                     $header .= $media->getLink() . '&nbsp;|&nbsp;' . $media->getDownloadLink();
                 } else {
                     $header .= CHtml::tag('span', array('class' => 'email-attachment-text'), $attachment['filename']) . '<br />';
                 }
             }
         }
         $this->_actionHeader = $header . '<br /><hr />';
     }
     return $this->_actionHeader;
 }
开发者ID:shuvro35,项目名称:X2CRM,代码行数:79,代码来源:InlineEmail.php

示例8: mergeActions

 /**
  * Transfers all related Actions from $model to $this->owner
  */
 public function mergeActions(X2Model $model, $logMerge = false)
 {
     $ret = array();
     $associationType = X2Model::getAssociationType(get_class($model));
     $tartgetAssociationType = X2Model::getAssociationType(get_class($this->owner));
     if ($logMerge) {
         $ids = Yii::app()->db->createCommand()->select('id')->from('x2_actions')->where('associationType = :type AND associationId = :id', array(':type' => $associationType, ':id' => $model->id))->queryColumn();
         $ret = $ids;
     }
     X2Model::model('Actions')->updateAll(array('associationType' => $tartgetAssociationType, 'associationId' => $this->owner->id), 'associationType = :type AND associationId = :id', array(':type' => $associationType, ':id' => $model->id));
     return $ret;
 }
开发者ID:dsyman2,项目名称:X2CRM,代码行数:15,代码来源:X2MergeableBehavior.php

示例9: getAction

 public function getAction()
 {
     if (!isset($this->_action)) {
         $action = new Actions();
         $action->setAttributes(array('associationType' => X2Model::getAssociationType($this->secondModelName), 'associationId' => $this->secondModelId, 'assignedTo' => Yii::app()->user->getName()), true);
         $this->_action = $action;
     }
     return $this->_action;
 }
开发者ID:keyeMyria,项目名称:CRM,代码行数:9,代码来源:ActionsQuickCreateRelationshipBehavior.php

示例10: array

echo Yii::t('workflow', 'Please summarize how this stage was completed.');
?>
</div>
        <div class="row">
            <?php 
echo CHtml::textArea('workflowComment', '', array('style' => 'width:260px;height:80px;'));
echo CHtml::hiddenField('workflowCommentWorkflowId', '', array('id' => 'workflowCommentWorkflowId'));
echo CHtml::hiddenField('workflowCommentStageNumber', '', array('id' => 'workflowCommentStageNumber'));
?>
        </div>
    </form>
</div>

<!-- dialog to contain Workflow Stage Details-->
<div id="workflowStageDetails"></div>

<div class="row">
    <div id="workflow-diagram">
        <?php 
// true = include dropdowns
$workflowStatus = Workflow::getWorkflowStatus($currentWorkflow, $model->id, X2Model::getAssociationType(get_class($model)));
//echo Workflow::renderWorkflow($workflowStatus);
if (sizeof($workflowStatus['stages']) > 1) {
    $workflow = Workflow::model()->findByPk($workflowStatus['id']);
    $colors = $workflow->getWorkflowStageColors(sizeof($workflowStatus['stages']));
    Yii::app()->controller->renderPartial('application.modules.workflow.views.workflow._inlineFunnel', array('workflowStatus' => $workflowStatus, 'stageCount' => sizeof($workflowStatus['stages']), 'colors' => $colors));
}
?>
    </div>
</div>
开发者ID:tymiles003,项目名称:X2CRM,代码行数:30,代码来源:_workflowStageDetailsWidget.php


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