public function showItem($id, $guid) { global $config, $tmpl; if ($this->item_name != "Document") { static::raiseError(__METHOD__ . ' can only work with documents!'); return false; } try { $this->item = new \Mtlda\Models\DocumentModel(array('idx' => $id, 'guid' => $guid)); } catch (\Exception $e) { static::raiseError("Failed to load DocumentModel!"); return false; } if (!isset($this->item) || empty($this->item)) { return false; } $descendants = array(); if ($this->item->hasDescendants()) { if (!($descendants = $this->item->getDescendants())) { static::raiseError(get_class($this->item) . '::getDescendants() returned false!'); return false; } } if (!($base_path = $config->getWebPath())) { static::raiseError("Web path is missing!"); return false; } if ($config->isPdfIndexingEnabled()) { $tmpl->assign('pdf_indexing_is_enabled', true); } if ($base_path == '/') { $base_path = ''; } try { $this->keywords = new \Mtlda\Models\KeywordsModel(); } catch (\Exception $e) { static::raiseError("Failed to load KeywordsModel!"); return false; } $tmpl->assign('latest_document_version', $this->item->getLastestDocumentVersionNumber()); $tmpl->assign('keywords_rpc_url', $base_path . '/keywords/rpc.html'); $tmpl->assign('item_versions', $descendants); $tmpl->assign('item', $this->item); $tmpl->assign('keywords', $this->keywords->getItems()); $tmpl->assign("item_safe_link", "document-" . $this->item->getIdx() . "-" . $this->item->getGuid()); try { $this->document_properties = new \Mtlda\Models\DocumentPropertiesModel(array('idx' => $this->item->getIdx(), 'guid' => $this->item->getGuid())); } catch (\Exception $e) { static::raiseError(__METHOD__ . '(), failed to load DocumentPropertiesModel!'); return false; } $tmpl->registerPlugin("block", "document_properties", array(&$this, "listDocumentProperties"), false); return parent::showItem($id, $guid); }