public function actionDetails($id)
 {
     $contact = static::getModelAndCatchNotFoundAndDisplayError('Contact', intval($id));
     ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($contact);
     if (!LeadsUtil::isStateALead($contact->state)) {
         $urlParams = array('/contacts/' . $this->getId() . '/details', 'id' => $contact->id);
         $this->redirect($urlParams);
     } else {
         AuditEvent::logAuditEvent('ZurmoModule', ZurmoModule::AUDIT_EVENT_ITEM_VIEWED, array(strval($contact), 'LeadsModule'), $contact);
         $getData = GetUtil::getData();
         $isKanbanBoardInRequest = ArrayUtil::getArrayValue($getData, 'kanbanBoard');
         if ($isKanbanBoardInRequest == 0 || $isKanbanBoardInRequest == null || Yii::app()->userInterface->isMobile() === true) {
             $breadCrumbView = StickySearchUtil::resolveBreadCrumbViewForDetailsControllerAction($this, 'LeadsSearchView', $contact);
             $detailsAndRelationsView = $this->makeDetailsAndRelationsView($contact, 'LeadsModule', 'LeadDetailsAndRelationsView', Yii::app()->request->getRequestUri(), $breadCrumbView);
             $view = new LeadsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $detailsAndRelationsView));
         } else {
             $kanbanItem = new KanbanItem();
             $kanbanBoard = new TaskKanbanBoard($kanbanItem, 'type', $contact, get_class($contact));
             $kanbanBoard->setIsActive();
             $params['relationModel'] = $contact;
             $params['relationModuleId'] = $this->getModule()->getId();
             $params['redirectUrl'] = null;
             $listView = new TasksForLeadKanbanView($this->getId(), 'tasks', 'Task', null, $params, null, array(), $kanbanBoard);
             $view = new LeadsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $listView));
         }
         echo $view->render();
     }
 }
 protected function renderControlContentNonEditable()
 {
     if (!isset($this->properties['backend']['services'])) {
         return null;
     }
     $content = null;
     $sizeClass = null;
     if (isset($this->properties['backend']['sizeClass'])) {
         $sizeClass = $this->properties['backend']['sizeClass'];
     }
     foreach ($this->properties['backend']['services'] as $serviceName => $serviceDetails) {
         if (ArrayUtil::getArrayValue($serviceDetails, 'enabled') and ArrayUtil::getArrayValue($serviceDetails, 'url')) {
             $properties = array();
             $properties['frontend']['href'] = $serviceDetails['url'];
             $properties['frontend']['target'] = '_blank';
             $properties['backend']['text'] = $serviceName;
             $properties['backend']['sizeClass'] = 'button social-button ' . $serviceName . ' ' . $sizeClass;
             $id = $this->id . '_' . $serviceName;
             $element = BuilderElementRenderUtil::resolveElement('BuilderSocialButtonElement', $this->renderForCanvas, $id, $properties);
             $content .= $element->renderNonEditable();
             $content .= $this->resolveSpacerContentForVerticalLayout();
             $content .= $this->resolveTdCloseAndOpenContentForHorizontalLayout();
         }
     }
     return $content;
 }
예제 #3
0
 /**
  * Given post data and an email message, populate the sender and account on the email message if possible.
  * Also add message recipients and any attachments.
  * @param array $postData
  * @param CreateEmailMessageForm $emailMessageForm
  * @param User $userToSendMessagesFrom
  * @return CreateEmailMessageForm
  */
 public static function resolveEmailMessageFromPostData(array &$postData, CreateEmailMessageForm $emailMessageForm, User $userToSendMessagesFrom)
 {
     $postVariableName = get_class($emailMessageForm);
     $toRecipients = explode(",", $postData[$postVariableName]['recipientsData']['to']);
     // Not Coding Standard
     static::attachRecipientsToMessage($toRecipients, $emailMessageForm->getModel(), EmailMessageRecipient::TYPE_TO);
     if (ArrayUtil::getArrayValue($postData[$postVariableName]['recipientsData'], 'cc') != null) {
         $ccRecipients = explode(",", $postData[$postVariableName]['recipientsData']['cc']);
         // Not Coding Standard
         static::attachRecipientsToMessage($ccRecipients, $emailMessageForm->getModel(), EmailMessageRecipient::TYPE_CC);
     }
     if (ArrayUtil::getArrayValue($postData[$postVariableName]['recipientsData'], 'bcc') != null) {
         $bccRecipients = explode(",", $postData[$postVariableName]['recipientsData']['bcc']);
         // Not Coding Standard
         static::attachRecipientsToMessage($bccRecipients, $emailMessageForm->getModel(), EmailMessageRecipient::TYPE_BCC);
     }
     if (isset($postData['filesIds'])) {
         static::attachFilesToMessage($postData['filesIds'], $emailMessageForm->getModel());
     }
     $emailAccount = EmailAccount::getByUserAndName($userToSendMessagesFrom);
     $sender = new EmailMessageSender();
     $sender->fromName = $emailAccount->fromName;
     $sender->fromAddress = $emailAccount->fromAddress;
     $sender->personsOrAccounts->add($userToSendMessagesFrom);
     $emailMessageForm->sender = $sender;
     $emailMessageForm->account = $emailAccount;
     $box = EmailBoxUtil::getDefaultEmailBoxByUser($userToSendMessagesFrom);
     $emailMessageForm->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_OUTBOX);
     return $emailMessageForm;
 }
 protected function resolveNonEditableWrapperHtmlOptions()
 {
     $htmlOptions = parent::resolveNonEditableWrapperHtmlOptions();
     $htmlOptions['class'] .= ' button-wrapper';
     $htmlOptions['align'] = ArrayUtil::getArrayValue($this->properties['backend'], 'align');
     return $htmlOptions;
 }
예제 #5
0
 /**
  * Given post data and an email message, populate the sender and account on the email message if possible.
  * Also add message recipients and any attachments.
  * @param array $postData
  * @param EmailMessage $emailMessage
  * @param User $userToSendMessagesFrom
  * @return boolean
  */
 public static function resolveEmailMessageFromPostData(array &$postData, CreateEmailMessageForm $emailMessageForm, User $userToSendMessagesFrom)
 {
     $postVariableName = get_class($emailMessageForm);
     Yii::app()->emailHelper->loadOutboundSettingsFromUserEmailAccount($userToSendMessagesFrom);
     $toRecipients = explode(",", $postData[$postVariableName]['recipientsData']['to']);
     // Not Coding Standard
     static::attachRecipientsToMessage($toRecipients, $emailMessageForm->getModel(), EmailMessageRecipient::TYPE_TO);
     if (ArrayUtil::getArrayValue($postData[$postVariableName]['recipientsData'], 'cc') != null) {
         $ccRecipients = explode(",", $postData[$postVariableName]['recipientsData']['cc']);
         // Not Coding Standard
         static::attachRecipientsToMessage($ccRecipients, $emailMessageForm->getModel(), EmailMessageRecipient::TYPE_CC);
     }
     if (ArrayUtil::getArrayValue($postData[$postVariableName]['recipientsData'], 'bcc') != null) {
         $bccRecipients = explode(",", $postData[$postVariableName]['recipientsData']['bcc']);
         // Not Coding Standard
         static::attachRecipientsToMessage($bccRecipients, $emailMessageForm->getModel(), EmailMessageRecipient::TYPE_BCC);
     }
     if (isset($postData['filesIds'])) {
         static::attachFilesToMessage($postData['filesIds'], $emailMessageForm->getModel());
     }
     $emailAccount = EmailAccount::getByUserAndName($userToSendMessagesFrom);
     $sender = new EmailMessageSender();
     $sender->fromName = Yii::app()->emailHelper->fromName;
     $sender->fromAddress = Yii::app()->emailHelper->fromAddress;
     $sender->personOrAccount = $userToSendMessagesFrom;
     $emailMessageForm->sender = $sender;
     $emailMessageForm->account = $emailAccount;
     $emailMessageForm->content->textContent = EmailMessageUtil::resolveTextContent(ArrayUtil::getArrayValue($postData[$postVariableName]['content'], 'htmlContent'), null);
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $emailMessageForm->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_OUTBOX);
     return $emailMessageForm;
 }
 /**
  * Renders the editable dropdown content.
  * @return A string containing the element's content.
  */
 protected function renderControlEditable()
 {
     if (ArrayUtil::getArrayValue($this->params, 'defaultToBlank')) {
         return ZurmoHtml::dropDownList($this->getNameForSelectInput(), null, $this->getDropDownArray(), $this->resolveHtmlOptions());
     } else {
         return $this->form->dropDownList($this->model->{$this->attribute}->currency, 'id', $this->getDropDownArray(), $this->resolveHtmlOptions());
     }
 }
 /**
  * Supports setting metadata on both models.  The MyListForm model and the SearchModel
  * @see ModalConfigEditView::setMetadataFromPost()
  */
 public function setMetadataFromPost($postArray)
 {
     parent::setMetadataFromPost($postArray);
     $sanitizedPostArray = PostUtil::sanitizePostByDesignerTypeForSavingModel($this->searchModel, ArrayUtil::getArrayValue($_POST, $this->getSearchModelPostArrayName()));
     $searchAttributes = SearchUtil::getSearchAttributesFromSearchArrayForSavingExistingSearchCriteria($sanitizedPostArray);
     $searchAttributesAdaptedToSetInModel = SearchUtil::adaptSearchAttributesToSetInRedBeanModel($searchAttributes, $this->searchModel);
     $this->searchAttributes = $searchAttributesAdaptedToSetInModel;
 }
예제 #8
0
 protected function getAddBlank()
 {
     if (ArrayUtil::getArrayValue($this->params, 'addBlank')) {
         return true;
     } else {
         return false;
     }
 }
예제 #9
0
 /**
  * Override from parent class in order to
  * accomodate the 'wide' param option.
  * @return The element's content.
  */
 protected function renderEditable()
 {
     $data = array();
     $data['label'] = $this->renderLabel();
     $data['content'] = $this->renderControlEditable();
     $data['error'] = $this->renderError();
     $data['colspan'] = ArrayUtil::getArrayValue($this->params, 'wide') ? 3 : 1;
     return $this->resolveContentTemplate($this->editableTemplate, $data);
 }
예제 #10
0
 /**
  * Check if the request is to display kanban view
  * @return boolean
  */
 public static function isKanbanRequest()
 {
     $getData = GetUtil::getData();
     $isKanbanBoardInRequest = ArrayUtil::getArrayValue($getData, 'kanbanBoard');
     if ($isKanbanBoardInRequest == 0 || $isKanbanBoardInRequest == null || Yii::app()->userInterface->isMobile() === true) {
         return false;
     }
     return true;
 }
예제 #11
0
 /**
  * @param CController $controller
  * @param $stickySearchKey
  * @param RedBeanModel $model
  * @return mixed
  */
 public static function resolveBreadCrumbViewForDetailsControllerAction(CController $controller, $stickySearchKey, RedBeanModel $model)
 {
     assert('is_string($stickySearchKey)');
     if (ArrayUtil::getArrayValue(GetUtil::getData(), 'stickyOffset') !== null && StickySearchUtil::getDataByKey($stickySearchKey) != null) {
         $stickyLoadUrl = Yii::app()->createUrl($controller->getModule()->getId() . '/' . $controller->getId() . '/renderStickyListBreadCrumbContent', array('stickyKey' => $stickySearchKey, 'stickyOffset' => ArrayUtil::getArrayValue(GetUtil::getData(), 'stickyOffset'), 'stickyModelId' => $model->id));
     } else {
         $stickyLoadUrl = null;
     }
     $className = static::resolveStickyDetailsAndRelationsBreadCrumbViewClassName();
     return new $className($controller->getId(), $controller->getModule()->getId(), static::resolveBreadcrumbLinks($model), $controller->getModule()->getModuleLabelByTypeAndLanguage('Plural'), $stickyLoadUrl);
 }
 protected static function getZurmoControllerUtil()
 {
     $getData = GetUtil::getData();
     $relatedUserId = ArrayUtil::getArrayValue($getData, 'relatedUserId');
     if ($relatedUserId == null) {
         $relatedUser = null;
     } else {
         $relatedUser = User::getById((int) $relatedUserId);
     }
     return new SocialItemZurmoControllerUtil($relatedUser);
 }
 protected function resolveNonEditableWrapperHtmlOptions()
 {
     $parentOptions = parent::resolveNonEditableWrapperHtmlOptions();
     $columnLength = ArrayUtil::getArrayValue($this->params, static::TABLE_CSS_CLASSES_PARAM_KEY);
     if (!isset($columnLength)) {
         $columnLength = BuilderRowElement::MAX_COLUMN_WIDTH;
         $columnLength = NumberToWordsUtil::convert($columnLength);
     }
     $parentOptions['class'] .= " {$columnLength} columns";
     return $parentOptions;
 }
 /**
  * Renders the editable email address content.
  * Takes the model attribute value and converts it into
  * at most 3 items. Email Address display, Opt Out checkbox,
  * and Invalid Email checkbox.
  * @return A string containing the element's content
  */
 protected function renderControlEditable()
 {
     assert('$this->model->{$this->attribute} instanceof Email');
     $addressModel = $this->model->{$this->attribute};
     $content = $this->renderEditableEmailAddressTextField($addressModel, $this->form, $this->attribute, 'emailAddress') . "\n";
     if (ArrayUtil::getArrayValue($this->params, 'hideOptOut') != true) {
         $content = ZurmoHtml::tag('div', array('class' => 'beforeOptOutCheckBox'), '<div>' . $content . '</div>');
         $content .= $this->renderEditableEmailAddressCheckBoxField($addressModel, $this->form, $this->attribute, 'optOut') . "\n";
     }
     return $content;
 }
 protected function renderNewSocialItemContent()
 {
     if (ArrayUtil::getArrayValue(GetUtil::getData(), 'ajax') != null) {
         return;
     }
     $socialItem = new SocialItem();
     $urlParameters = array('redirectUrl' => $this->getPortletDetailsUrl());
     //After save, the url to go to.
     $uniquePageId = get_called_class();
     $inlineView = new SocialItemInlineEditView($socialItem, 'default', 'socialItems', 'inlineCreateSave', $urlParameters, $uniquePageId);
     return $inlineView->render();
 }
예제 #16
0
 public function filters()
 {
     $modelClassName = ArrayUtil::getArrayValue(GetUtil::getData(), 'modelClassName');
     if ($modelClassName === null) {
         return parent::filters();
     }
     $moduleClassName = $modelClassName::getModuleClassName();
     if (!is_subclass_of($moduleClassName, 'SecurableModule')) {
         return parent::filters();
     }
     return array_merge(parent::filters(), array(array(self::getRightsFilterPath(), 'moduleClassName' => $moduleClassName, 'rightName' => $moduleClassName::getAccessRight()), array(self::MASHABLE_INBOX_ZERO_MODELS_CHECK_FILTER_PATH . ' + list', 'controller' => $this)));
 }
예제 #17
0
 /**
  * Override to process the note as a social item when needed.
  * (non-PHPdoc)
  * @see ZurmoBaseController::actionAfterSuccessfulModelSave()
  */
 protected function actionAfterSuccessfulModelSave($model, $modelToStringValue, $redirectUrlParams = null)
 {
     assert('$model instanceof Note');
     if (ArrayUtil::getArrayValue(PostUtil::getData(), 'postToProfile')) {
         $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($model);
         $socialItem = new SocialItem();
         $socialItem->note = $model;
         $saved = $socialItem->save();
         if (!$saved) {
             throw new FailedToSaveModelException();
         }
         ExplicitReadWriteModelPermissionsUtil::resolveExplicitReadWriteModelPermissions($socialItem, $explicitReadWriteModelPermissions);
     }
     parent::actionAfterSuccessfulModelSave($model, $modelToStringValue, $redirectUrlParams);
 }
 protected function reduceColumns($count)
 {
     $extraColumns = array_splice($this->content, $count);
     $lastKey = ArrayUtil::findLastKey($this->content);
     $lastKeyContent = ArrayUtil::getNestedValue($this->content, "{$lastKey}['content']");
     if (!isset($lastKeyContent)) {
         $lastKeyContent = array();
     }
     foreach ($extraColumns as $extraColumn) {
         $extraColumnContent = ArrayUtil::getArrayValue($extraColumn, 'content');
         if (isset($extraColumnContent)) {
             $lastKeyContent = CMap::mergeArray($lastKeyContent, $extraColumnContent);
         }
     }
     $this->content[$lastKey]['content'] = $lastKeyContent;
 }
 protected function renderCustomColorChooser()
 {
     $inputId = $this->getEditableInputId();
     $externalColorChangeEventHandler = ArrayUtil::getArrayValue($this->params, static::COLOR_CHANGE_HANDLER_KEY);
     if (!empty($externalColorChangeEventHandler)) {
         $externalColorChangeEventHandler = "\n                if (typeof {$externalColorChangeEventHandler} == 'function') {\n                    var firstChange = (\$(this).val() == '');\n                    {$externalColorChangeEventHandler}(firstChange);\n                }";
     }
     $cClipWidget = new CClipWidget();
     $cClipWidget->beginClip($this->attribute);
     // Begin Not Coding Standard
     $cClipWidget->widget('application.core.widgets.ZurmoColorPicker', array('inputName' => $this->getEditableInputName(), 'inputId' => $inputId, 'inputValue' => $this->model->{$this->attribute}, 'htmlOptions' => array('class' => 'color-picker'), 'palettes' => 'true', 'change' => "function(event, ui) {\n                                                    {$externalColorChangeEventHandler}\n                                                    \$('#{$inputId}').css('border-color', ui.color.toString());\n                                          }"));
     // End Not Coding Standard
     $cClipWidget->endClip();
     $content = ZurmoHtml::tag('div', array(), $cClipWidget->getController()->clips[$this->attribute]);
     return $content;
 }
 protected function preFilter($filterChain)
 {
     $getData = GetUtil::getData();
     $modelClassName = ArrayUtil::getArrayValue($getData, 'modelClassName');
     if ($modelClassName == null) {
         return true;
     }
     if ($modelClassName::getCount() != 0) {
         return true;
     }
     $moduleClassName = $modelClassName::getModuleClassName();
     $mashableRules = MashableUtil::createMashableInboxRulesByModel($modelClassName);
     if ($mashableRules->getZeroModelViewClassName() == null) {
         return true;
     }
     $messageViewClassName = $mashableRules->getZeroModelViewClassName();
     $messageView = new $messageViewClassName($this->controller->getId(), $moduleClassName::getDirectoryName(), $modelClassName);
     $pageViewClassName = $this->controller->getModule()->getPluralCamelCasedName() . 'PageView';
     $view = new $pageViewClassName(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this->controller, $messageView));
     echo $view->render();
     return false;
 }
예제 #21
0
 public function actionDetails($id)
 {
     $id = intval($id);
     $modelName = $this->getModule()->getPrimaryModelName();
     $model = $modelName::getById($id);
     ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($model, true);
     $portlet = Portlet::getById(intval($_GET['portletId']));
     if (null != ($redirectUrl = ArrayUtil::getArrayValue($_GET, 'redirectUrl'))) {
         $redirectUrl = $redirectUrl;
     } else {
         $redirectUrl = Yii::app()->request->getRequestUri();
     }
     $portlet->params = array('controllerId' => 'default', 'relationModuleId' => $this->getModule()->getId(), 'relationModel' => $model, 'redirectUrl' => $redirectUrl);
     $portletView = $portlet->getView();
     if (!RightsUtil::canUserAccessModule($portletView::getModuleClassName(), Yii::app()->user->userModel)) {
         $messageView = new AccessFailureView();
         $view = new AccessFailurePageView($messageView);
         echo $view->render();
         Yii::app()->end(0, false);
     }
     $view = new AjaxPageView($portletView);
     echo $view->render();
 }
 protected function resolveMakeTemplateFunctionDefinitionById($id, &$functionDefinitions, array &$functionNames)
 {
     $name = null;
     $builttype = null;
     $serializeddata = null;
     $emailTemplate = ZurmoRedBean::getRow('select name, builttype, serializeddata from emailtemplate where id =' . $id);
     if (empty($emailTemplate)) {
         throw new NotFoundException("Unable to load model for id: {$id}");
     }
     extract($emailTemplate);
     if ($builttype != EmailTemplate::BUILT_TYPE_BUILDER_TEMPLATE) {
         throw new NotSupportedException("id: {$id} is not a builder template");
     }
     $unserializedData = CJSON::decode($serializeddata);
     if (json_last_error() != JSON_ERROR_NONE || empty($unserializedData)) {
         throw new NotSupportedException("JSON could not be translated");
     }
     $unserializedData['baseTemplateId'] = '';
     $unserializedData['icon'] = ArrayUtil::getArrayValue($this->templateNameToIconMapping, $name);
     $unserializedData = var_export($unserializedData, true);
     $functionName = $this->resolveFunctionNameFromTemplateName($name);
     $functionNames[] = $functionName;
     $functionDefinitions .= "\n\nprotected function {$functionName}()\n{\n    \$name              = '{$name}';\n    \$unserializedData  = {$unserializedData};\n    \$this->makeBuilderPredefinedEmailTemplate(\$name, \$unserializedData);\n}";
 }
 protected function resolveThumbnail()
 {
     $unserializedData = CJSON::decode($this->model->serializedData);
     $icon = ArrayUtil::getArrayValue($unserializedData, 'icon');
     if (!empty($icon)) {
         return ZurmoHtml::icon($icon);
     } else {
         return ZurmoHtml::icon('icon-user-template');
     }
 }
 /**
  * @depends testSaveWithValidDataWithValidation
  * @depends testGetHtmlContentActionForBuilder
  */
 public function testSaveWithBaseTemplateIdUpdate()
 {
     $emailTemplateId = self::getModelIdByModelNameAndName('EmailTemplate', 'builder 02');
     $emailTemplate = EmailTemplate::getById($emailTemplateId);
     $oldUnserializedData = CJSON::decode($emailTemplate->serializedData);
     $oldBaseTemplateId = ArrayUtil::getArrayValue($oldUnserializedData, 'baseTemplateId');
     $baseTemplateId = self::getModelIdByModelNameAndName('EmailTemplate', 'builder 01');
     $baseTemplate = EmailTemplate::getById($baseTemplateId);
     $expectedUnserializedData = CJSON::decode($baseTemplate->serializedData);
     unset($expectedUnserializedData['icon']);
     $expectedUnserializedData['baseTemplateId'] = $baseTemplate->id;
     $expectedHtmlContent = EmailTemplateSerializedDataToHtmlUtil::resolveHtmlByUnserializedData($expectedUnserializedData);
     $post = array('BuilderEmailTemplateWizardForm' => array('name' => 'builder 02', 'subject' => 'builder 02', 'type' => 2, 'builtType' => 3, 'isDraft' => 0, 'language' => '', 'hiddenId' => $emailTemplateId, 'modelClassName' => 'Contact', 'ownerId' => 1, 'ownerName' => 'Super User', 'explicitReadWriteModelPermissions' => array('nonEveryoneGroup' => 3, 'type' => 1), 'baseTemplateId' => $baseTemplateId, 'serializedData' => array('baseTemplateId' => $baseTemplateId, 'dom' => CJSON::encode($oldUnserializedData['dom'])), 'originalBaseTemplateId' => $oldBaseTemplateId, 'textContent' => 'some text changed'), 'validationScenario' => BuilderEmailTemplateWizardForm::PLAIN_AND_RICH_CONTENT_VALIDATION_SCENARIO, 'ajax' => 'edit-form');
     $this->setGetArray(array('builtType' => EmailTemplate::BUILT_TYPE_BUILDER_TEMPLATE));
     $this->setPostArray($post);
     $content = $this->runControllerWithExitExceptionAndGetContent('emailTemplates/default/save');
     $jsonDecodedContent = CJSON::decode($content);
     $this->assertEmpty($jsonDecodedContent);
     // now send the actual save request
     unset($post['ajax']);
     $this->setPostArray($post);
     $content = $this->runControllerWithExitExceptionAndGetContent('emailTemplates/default/save');
     $jsonDecodedContent = CJSON::decode($content);
     $this->assertNotEmpty($jsonDecodedContent);
     $this->assertCount(3, $jsonDecodedContent);
     $this->assertArrayHasKey('id', $jsonDecodedContent);
     $this->assertEquals($emailTemplateId, $jsonDecodedContent['id']);
     $this->assertArrayHasKey('redirectToList', $jsonDecodedContent);
     $this->assertFalse($jsonDecodedContent['redirectToList']);
     $this->assertArrayHasKey('moduleClassName', $jsonDecodedContent);
     $this->assertEquals('ContactsModule', $jsonDecodedContent['moduleClassName']);
     // ensure htmlContent was generated.
     $emailTemplate->forgetAll();
     unset($emailTemplate);
     $emailTemplate = EmailTemplate::getById($emailTemplateId);
     $unserializedData = CJSON::decode($emailTemplate->serializedData);
     $this->assertEquals($expectedUnserializedData, $unserializedData);
     $this->assertEquals('some text changed', $emailTemplate->textContent);
     $this->assertEquals($expectedHtmlContent, $emailTemplate->htmlContent);
 }
 /**
  * Will only grab first available email signature for user if available
  * @param $model
  */
 protected static function resolveOwnersEmailSignature($model, $params = array())
 {
     if ($model instanceof OwnedSecurableItem && $model->owner->id > 0) {
         if ($model->owner->emailSignatures->count() > 0) {
             $isHtmlContent = ArrayUtil::getArrayValue($params, 'isHtmlContent', true);
             if ($isHtmlContent) {
                 return $model->owner->emailSignatures[0]->htmlContent;
             } else {
                 return $model->owner->emailSignatures[0]->textContent;
             }
         }
     }
 }
 /**
  * @return A string containing the element's content.
  */
 protected function renderControlNonEditable()
 {
     $dropDownArray = $this->getDropDownArray();
     return Yii::app()->format->text(ArrayUtil::getArrayValue($dropDownArray, $this->model->{$this->attribute}));
 }
 protected function resolveSelectiveLoadOfTabs()
 {
     return (bool) ArrayUtil::getArrayValue($this->params, static::SELECTIVE_TAB_LOAD_KEY);
 }
 protected static function resolvePreviewFromArray(array &$queryStringArray)
 {
     $preview = ArrayUtil::getArrayValue($queryStringArray, 'preview', false);
     return $preview;
 }
 protected function getPortletViewForDetails($id)
 {
     $id = intval($id);
     $modelName = $this->getModule()->getPrimaryModelName();
     $model = $modelName::getById($id);
     ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($model, true);
     $portlet = Portlet::getById(intval($_GET['portletId']));
     if (null != ($redirectUrl = ArrayUtil::getArrayValue($_GET, 'redirectUrl'))) {
         $redirectUrl = $redirectUrl;
     } else {
         $redirectUrl = Yii::app()->request->getRequestUri();
     }
     $portlet->params = array('controllerId' => 'default', 'relationModuleId' => $this->getModule()->getId(), 'relationModel' => $model, 'redirectUrl' => $redirectUrl);
     $portletView = $portlet->getView();
     return $portletView;
 }
예제 #30
0
 public function getAllowDownloadOnEditable()
 {
     return ArrayUtil::getArrayValue($this->params, static::ALLOW_DOWNLOAD_ON_EDITABLE_KEY, $this->getAllowDownloadOnEditableDefault());
 }