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


PHP X2Model::getMOdelOfTypeWithId方法代码示例

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


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

示例1: formatActionToEvent

 public function formatActionToEvent($action, $id)
 {
     if (!($action->visibility >= 1 || $action->assignedTo == Yii::app()->user->name || Yii::app()->params->isAdmin)) {
         // admin sees all
         return false;
     }
     $linked = !empty($action->associationType) && strtolower($action->associationType) != 'none' && class_exists(X2Model::getModelName($action->associationType));
     if ($linked) {
         $associatedModel = X2Model::getMOdelOfTypeWithId(X2Model::getModelName($action->associationType), $action->associationId);
         if ($associatedModel) {
             $associationUrl = $associatedModel->getUrl();
         } else {
             $associationUrl = '';
         }
     }
     $title = $action->shortActionText;
     //Email formatting
     $title = preg_replace('/<b>/', '', $title);
     $title = preg_replace('/<\\/b>/', '', $title);
     $title = preg_replace('/\\n\\n/', "\n", $title);
     $title = preg_replace('/<!--EndSig-->/', '', $title);
     $title = preg_replace('/<!--BeginOpenedEmail-->/', '', $title);
     $title = preg_replace('/<!--BeginSignature-->/', '', $title);
     if (in_array($action->type, array('email', 'emailFrom', 'email_quote', 'email_invoice', 'emailOpened', 'emailOpened_quote', 'emailOpened_invoice'))) {
         $title = 'Email: ' . $title;
     }
     $event = array('title' => $title, 'description' => $title, 'start' => date('Y-m-d H:i', $action->dueDate), 'id' => $action->id, 'complete' => $action->complete, 'calendarAssignment' => $id, 'allDay' => false);
     if ($action->allDay) {
         $event['allDay'] = $action->allDay;
     }
     if ($action->color) {
         $event['color'] = $action->color;
     } else {
         $event['color'] = '#6389de';
         // old default color
         //$event['color'] = '#3a87ad';
     }
     static $brightnesses = array();
     if (!isset($brightnesses[$event['color']])) {
         $brightnesses[$event['color']] = X2Color::getColorBrightness($event['color']);
     }
     if ($brightnesses[$event['color']] < 115) {
         $event['textColor'] = 'white';
     }
     if ($action->type == 'event') {
         if ($action->completeDate) {
             $event['end'] = date('Y-m-d H:i', $action->completeDate);
         }
         $event['type'] = 'event';
         $event['associationType'] = $action->associationType;
     }
     $event['linked'] = $linked;
     if ($linked) {
         $event['associationType'] = $action->associationType;
         $event['associationUrl'] = $associationUrl;
         $event['associationName'] = $action->associationName;
     }
     $editable = X2CalendarPermissions::getEditableUserCalendarNames();
     // If it is a group id, we don't need to check this
     $userEditable = !is_int($id) && isset($editable[$id]);
     $event['editable'] = $userEditable && Yii::app()->user->checkAccess('ActionsUpdate', array('X2Model' => $action));
     return $event;
 }
开发者ID:shuvro35,项目名称:X2CRM,代码行数:63,代码来源:CalendarController.php


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