public function actionEdit($id, $redirectUrl = null) { $productCategory = ProductCategory::getById(intval($id)); $breadcrumbLinks = static::getDetailsAndEditBreadcrumbLinks(); $breadcrumbLinks[] = StringUtil::getChoppedStringContent(strval($productCategory), 25); $view = new ProductCategoriesPageView(ProductDefaultViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $this->makeEditAndDetailsView($this->attemptToSaveModelFromPost($productCategory, $redirectUrl), 'Edit'), $breadcrumbLinks, 'ProductBreadCrumbView')); echo $view->render(); }
public function actionEdit($id, $redirectUrl = null) { $product = Product::getById(intval($id)); ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($product); $breadcrumbLinks = array(StringUtil::getChoppedStringContent(strval($product), 25)); $view = new ProductsPageView(ProductDefaultViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $this->makeEditAndDetailsView($this->attemptToSaveModelFromPost($product, $redirectUrl), 'Edit'), $breadcrumbLinks, 'ProductBreadCrumbView')); echo $view->render(); }
public function actionEdit($id, $redirectUrl = null) { $conversation = Conversation::getById(intval($id)); $conversationsMashableInboxUrl = Yii::app()->createUrl('mashableInbox/default/list', array('modelClassName' => 'Conversation')); $breadcrumbLinks = array(Zurmo::t('ConversationsModule', 'Conversations') => $conversationsMashableInboxUrl, StringUtil::getChoppedStringContent(strval($conversation), 25) => array('default/details', 'id' => $id), Zurmo::t('ConversationModule', 'Edit')); $conversation = Conversation::getById(intval($id)); ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($conversation); $editView = new ConversationEditView($this->getId(), $this->getModule()->getId(), $this->attemptToSaveModelFromPost($conversation), strval($conversation)); $view = new ConversationsPageView(ZurmoDefaultViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $editView, $breadcrumbLinks, 'ConversationBreadCrumbView')); echo $view->render(); }
public function actionEdit($id, $redirectUrl) { $autoresponder = Autoresponder::getById(intval($id)); ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($autoresponder->marketingList); $model = $this->attemptToSaveModelFromPost($autoresponder, $redirectUrl); $editAndDetailsView = $this->makeEditAndDetailsView($model, 'Edit'); $breadcrumbLinks = static::getDetailsAndEditBreadcrumbLinks($autoresponder->marketingList); $breadcrumbLinks[] = StringUtil::getChoppedStringContent(strval($autoresponder), 25); $view = new AutorespondersPageView(MarketingDefaultViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $editAndDetailsView, $breadcrumbLinks, 'MarketingBreadCrumbView')); echo $view->render(); }
public function testGetChoppedStringContentFromString() { $testString = 'This is a test string to test the getchoppedstringcontent method for stringutil class.'; $compairSting = 'This is a test string to test the getchoppedstringcontent...'; $newSting = StringUtil::getChoppedStringContent($testString, 60); $this->assertEquals($compairSting, $newSting); $testString = 'This is a test string to test the getchoppedstringcontent method for stringutil class.'; $compairSting = 'This is a test string to test the getchoppedstringcontent method for stringutil class.'; $newSting = StringUtil::getChoppedStringContent($testString, 100); $this->assertEquals($compairSting, $newSting); $testString = 'This is a test string to test the getchoppedstringcontent method for stringutil class. This is a test string to test the getchoppedstringcontent method for stringutil class.'; $compairSting = 'This is a test string to test the getchoppedstringcontent method for stringutil class. This is a test string to test...'; $newSting = StringUtil::getChoppedStringContent($testString, 119); $this->assertEquals($compairSting, $newSting); }
protected static function stripTagsAndMultipleByteEncode($moduleName) { if ($moduleName == null) { return; } $modelName = strip_tags($moduleName); $modelName = mb_convert_encoding(StringUtil::getChoppedStringContent($modelName, 40, ''), 'HTML-ENTITIES', 'UTF-8'); return $modelName; }
public function actionDetails($id) { $emailTemplate = static::getModelAndCatchNotFoundAndDisplayError('EmailTemplate', intval($id)); ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($emailTemplate); AuditEvent::logAuditEvent('ZurmoModule', ZurmoModule::AUDIT_EVENT_ITEM_VIEWED, array(strval($emailTemplate), 'EmailTemplatesModule'), $emailTemplate); $detailsView = new EmailTemplateDetailsView($this->getId(), $this->getModule()->getId(), $emailTemplate, strval($emailTemplate)); $viewUtil = static::getViewUtilByType($emailTemplate->type); $breadCrumbView = static::getBreadCrumbViewByType($emailTemplate->type); $breadCrumbLinks = static::getBreadCrumbLinksByType($emailTemplate->type); $breadCrumbLinks[] = StringUtil::getChoppedStringContent(strval($emailTemplate), 25); $view = new EmailTemplatesPageView($viewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $detailsView, $breadCrumbLinks, $breadCrumbView)); echo $view->render(); }
public function actionEdit($id) { $marketingList = MarketingList::getById(intval($id)); ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($marketingList); $breadCrumbLinks = static::getDetailsAndEditBreadcrumbLinks(); $breadCrumbLinks[] = StringUtil::getChoppedStringContent(strval($marketingList), 25); $editView = new MarketingListEditView($this->getId(), $this->getModule()->getId(), $this->attemptToSaveModelFromPost($marketingList), strval($marketingList)); $view = new MarketingListsPageView(MarketingDefaultViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $editView, $breadCrumbLinks, 'MarketingBreadCrumbView')); echo $view->render(); }
/** * @param Notification $notification * @return string */ public static function renderShortenedListViewContent(Notification $notification) { $content = strval($notification); if ($content != null) { $content = '<h4>' . StringUtil::getChoppedStringContent($content, 68) . '</h4>'; } if ($notification->notificationMessage->id > 0) { if ($notification->notificationMessage->htmlContent != null && strlen($notification->notificationMessage->htmlContent) < 136) { $content .= '<div>' . Yii::app()->format->raw($notification->notificationMessage->htmlContent) . '</div>'; } elseif ($notification->notificationMessage->textContent != null) { $content .= '<div>' . Yii::app()->format->text(StringUtil::getChoppedStringContent($notification->notificationMessage->textContent, 136)) . '</div>'; } } return $content; }
protected function processEdit(Campaign $campaign) { if ($campaign->status != Campaign::STATUS_ACTIVE) { Yii::app()->user->setFlash('notification', Zurmo::t('CampaignsModule', 'This campaign has already started, you can only edit its name, rights and permissions.')); } $breadCrumbLinks = static::getDetailsAndEditBreadcrumbLinks(); $breadCrumbLinks[] = StringUtil::getChoppedStringContent(strval($campaign), 25); //todo: wizard $editView = new CampaignEditView($this->getId(), $this->getModule()->getId(), $this->attemptToSaveModelFromPost($campaign), strval($campaign)); $view = new CampaignsPageView(MarketingDefaultViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $editView, $breadCrumbLinks, 'MarketingBreadCrumbView')); echo $view->render(); }
public function actionDetails($id, $renderJson = false, $includeFilesInJson = false) { $emailTemplate = static::getModelAndCatchNotFoundAndDisplayError('EmailTemplate', intval($id)); ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($emailTemplate); if ($renderJson) { header('Content-type: application/json'); echo $this->resolveEmailTemplateAsJson($emailTemplate, $includeFilesInJson); Yii::app()->end(0, false); } AuditEvent::logAuditEvent('ZurmoModule', ZurmoModule::AUDIT_EVENT_ITEM_VIEWED, array(strval($emailTemplate), 'EmailTemplatesModule'), $emailTemplate); $detailsView = new EmailTemplateEditAndDetailsView('Details', $this->getId(), $this->getModule()->getId(), $emailTemplate); if ($emailTemplate->type == EmailTemplate::TYPE_WORKFLOW) { $breadcrumbLinks = static::getDetailsAndEditForWorkflowBreadcrumbLinks(); $breadcrumbLinks[] = StringUtil::getChoppedStringContent(strval($emailTemplate), 25); $view = new EmailTemplatesPageView(WorkflowDefaultAdminViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $detailsView, $breadcrumbLinks, 'WorkflowBreadCrumbView')); } elseif ($emailTemplate->type == EmailTemplate::TYPE_CONTACT) { $breadcrumbLinks = static::getDetailsAndEditForMarketingBreadcrumbLinks(); $breadcrumbLinks[] = StringUtil::getChoppedStringContent(strval($emailTemplate), 25); $view = new EmailTemplatesPageView(MarketingDefaultViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $detailsView, $breadcrumbLinks, 'MarketingBreadCrumbView')); } else { throw new NotSupportedException(); } echo $view->render(); }
/** * Copies the project * @param int $id */ public function actionCopy($id, $redirectUrl = null) { $copyToProject = new Project(); $postVariableName = get_class($copyToProject); $project = Project::getById((int) $id); if (!isset($_POST[$postVariableName])) { ProjectZurmoCopyModelUtil::copy($project, $copyToProject); $this->processEdit($copyToProject); } else { $breadCrumbLinks = array(StringUtil::getChoppedStringContent(strval($project), 25)); ProjectZurmoCopyModelUtil::processAfterCopy($project, $copyToProject); $view = new ProjectsPageView(ProjectDefaultViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $this->makeEditAndDetailsView($this->attemptToSaveModelFromPost($copyToProject, $redirectUrl), 'Edit'), $breadCrumbLinks, 'ProjectBreadCrumbView')); echo $view->render(); } }
/** * @param string $attributeString * @param string $attribute * @return string */ public function getLinkString($attributeString, $attribute) { $string = 'ZurmoHtml::link('; $string .= StringUtil::getChoppedStringContent($attributeString, ProductElementUtil::PRODUCT_NAME_LENGTH_IN_PORTLET_VIEW) . ', '; $string .= 'Yii::app()->createUrl("' . $this->getGridViewActionRoute('details') . '", array("id" => $data->id))'; $string .= ')'; return $string; }
/** * Called in CalendarUtil to set the title. * @param CalendarItem $calendarItem * @param RedBeanModel $model */ public function setCalendarItemTitle(CalendarItem $calendarItem, RedBeanModel $model) { $calendarItem->setTitle(StringUtil::getChoppedStringContent($model->name, CalendarItem::MAXIMUM_TITLE_LENGTH)); }
/** * Renders description * @return string */ protected function renderDescriptionContent() { $content = ZurmoHtml::tag('div', array('class' => static::DESCRIPTION_CLASS), StringUtil::getChoppedStringContent($this->model->description, 50)); return $content; }
/** * Resolve task kanban view for relation * @param RedBeanModel $model * @param string $moduleId * @param ZurmoModuleController $controller * @param TasksForRelatedKanbanView $kanbanView * @param ZurmoDefaultPageView $pageView * @return ZurmoDefaultPageView */ public static function resolveTaskKanbanViewForRelation($model, $moduleId, $controller, $kanbanView, $pageView) { assert('$model instanceof RedBeanModel'); assert('is_string($moduleId)'); assert('$controller instanceof ZurmoModuleController'); assert('is_string($kanbanView)'); assert('is_string($pageView)'); $breadCrumbLinks = array(StringUtil::getChoppedStringContent(strval($model), 25)); $kanbanItem = new KanbanItem(); $kanbanBoard = new TaskKanbanBoard($kanbanItem, 'type', $model, get_class($model)); $kanbanBoard->setIsActive(); $params['relationModel'] = $model; $params['relationModuleId'] = $moduleId; $params['redirectUrl'] = null; $listView = new $kanbanView($controller->getId(), 'tasks', 'Task', null, $params, null, array(), $kanbanBoard); $view = new $pageView(ZurmoDefaultViewUtil::makeViewWithBreadcrumbsForCurrentUser($controller, $listView, $breadCrumbLinks, 'KanbanBoardBreadCrumbView')); return $view; }