/** * Tag an entity. * */ public function entityAction() { // Valid upload for a page. $clientId = (int) $this->_request->getParam('client_id'); $entityType = $this->_request->getParam('entity_type'); $entityId = $this->_request->getParam('entity_id'); $tags = Zend_Json::decode($this->_request->getParam('tags')); Repo_TagEntity::getInstance()->addEntityTags($clientId, $tags, $entityType, $entityId); $this->_sendAjaxResponse(); }
/** * List portals. * * @param Zend_Db_Table_Rowset_Abstract $portals * @return string */ public static function listResourceLibrary($docs) { $html = Functions_View::HTML_DEFAULT_EMPTY; if ($docs->count() == 0) { $html .= '<table class="table table-striped table-bordered">'; $html .= '<thead> <tr><th class="text-center">Sorry, No record(s) found!</th> </thead>'; $html .= '<tbody>'; return $html; exit; } if ($docs && $docs->count()) { $html .= '<table class="table table-striped table-bordered">'; $html .= '<thead> <tr > <th class="text-center"><div onclick="event.stopPropagation()"><a href="javascript:void(0)" onclick="setSortOrder(\'name\')">File Name</a></div></th> <th class="text-center"><div onclick="event.stopPropagation()">Kind</div></th> <th class="text-center"><div onclick="event.stopPropagation()"><a href="javascript:void(0)" onclick="setSortOrder(\'created_datetime\')">Date Added</a></div></th> <th class="text-center" style="width: 320px;"><div onclick="event.stopPropagation()">Tags</div></th> <th class="text-center"><div onclick="event.stopPropagation()">Download Link</div></th> </tr> </thead>'; $html .= '<tbody>'; foreach ($docs as $_doc) { $current_doc_boj = new Object_Document($_doc->id); //getting docuemnt tags $doc_tags = ""; $doc_tags = Repo_TagEntity::getInstance()->getEntityTags("document_asset", $_doc->id); $tagArray = array(); foreach ($doc_tags as $tag) { $tagArray[] = isset($tag->tag_name) ? $tag->tag_name : ""; } $tags_str = @implode(", ", $tagArray); $limit = 100; if (strlen($tags_str) > $limit) { $tags_str = substr($tags_str, 0, strrpos(substr($tags_str, 0, $limit), ' ')) . '...'; } //echo $tags_str; $html .= '<tr rel="' . $_doc->id . '" class="noClickThrough">'; $html .= '<td>' . $_doc->name . '</td>'; $html .= '<td>' . strtoupper(pathinfo($_doc->file_path, PATHINFO_EXTENSION)) . '</td>'; $html .= '<td>' . Functions_Common::formattedDay($_doc->created_datetime, parent::STD_DATE_FORMAT) . '</td>'; $html .= '<td>' . $tags_str . '</td>'; $html .= '<td><a class="btn btn-success" id="download" onclick="event.stopPropagation()" href="' . $current_doc_boj->getDownloadLink() . '" target="_blank">Download</a></td>'; $html .= '</tr>'; } $html .= '</tbody>'; $html .= '</table>'; } return $html; }
/** * Get tags belonging to an entity. * * @return array */ public function getTagIds($entityType, $entityId) { $tags = Repo_TagEntity::getInstance()->getEntityTags($entityType, $entityId); $tagArray = array(); if ($tags) { foreach ($tags as $_tag) { $tagArray[] = $_tag->tag_id; } } return $tagArray; }
/** * Page detail page: edit/delete functionality. * * It is the central place for a page object. */ public function pageDetailAction() { $id = $this->_request->getParam('id'); $page = new Object_Page($id); $pageId = $page->getId(); if (empty($pageId)) { // No page defined, redirec to list page. $this->_redirect('/admin/client/page'); return false; } // Whenever a page is visited, refresh the thumb. $page->refreshThumb(); $form = new Form_Admin_Client_Page(false, array('page' => $page)); // Check for page update if ($this->_request->isPost()) { $params = $this->_request->getPost(); if ($params['form-object-tag-list']) { Repo_TagEntity::getInstance()->removeEntityTags($id, 'page'); $tags = Zend_Json::decode($params['form-object-tag-list']); if (!empty($tags[0])) { Repo_TagEntity::getInstance()->addEntityTags($page->client_id, $tags, 'page', $id); $this->view->updateMessage = "Tags saved"; } } else { if ($form->isValid($params)) { // Update page if necessary $form->updatePage($page); $form->updatePageNavigation($page); $form->setPage($page); $form->updateStaticContent($pageId, true); } else { $form->populate($params); } } } $this->view->lang = $page->getPageLanguage(); $this->view->page = $page; $this->view->client = new Object_Client($page->client_id); $this->view->form = $form; // Survey ad page questions $this->view->surveyQuestions = Repo_Survey::getInstance()->getSurveyQuestions(); $this->view->pageQuestions = Repo_PageQuestion::getInstance()->getPageQuestionGroup($pageId); // Extra js for file upload $this->view->headScript()->prependFile('/js/libraries/jquery/jquery.fileupload.js'); $this->view->headScript()->prependFile('/js/libraries/jquery/jquery.iframe-transport.js'); $this->view->headLink()->appendStylesheet('/css/jquery.fileupload.css'); // get tags $this->view->tagTree = Repo_Tag::getInstance()->getTagTree($page->client_id); $this->view->assetTags = Manager_Tag_Helper::getInstance()->getTagIds("page", $id); $this->view->assetTagNames = $page->getTags(); //Tag management js $this->view->headScript()->prependFile('/js/managers/TagManager.js'); // js for list sort and search $this->view->headScript()->prependFile('/js/libraries/list/list.min.js'); // Page navigation $this->view->headScript()->prependFile('/js/PageNavigationUi.js'); // Page pdf template $this->view->pagePdfTemplates = Repo_PagePdfTemplate::getInstance()->getPagePdfTemplates($pageId); // Page versions $this->view->pageVersions = Repo_PageVersion::getInstance()->getPageVersions($pageId); }