$about = \Hubzero\Utility\String::truncate($aboutTxt, 200); $about .= ' <a href="#more-' . $elName . '" class="more-content">' . Lang::txt('COM_PUBLICATIONS_READ_MORE') . '</a>'; $about .= ' <div class="hidden">'; $about .= ' <div class="full-content" id="more-' . $elName . '">' . $aboutTxt . '</div>'; $about .= ' </div>'; } else { $about = $aboutTxt; } // Get version params and extract bundle name $bundleName = $this->pub->params->get($elName . 'bundlename', $defaultTitle); $bundleName = $bundleName ? $bundleName : 'bundle'; $bundleName .= '.zip'; // Get attachment model $modelAttach = new \Components\Publications\Models\Attachments($this->database); // Get handler model $modelHandler = new \Components\Publications\Models\Handlers($this->database); // Is there handler choice? $handlers = $this->manifest->params->typeParams->handlers; // Is there handler assigned? $handler = $this->manifest->params->typeParams->handler; $useHandles = $handlers || $handler ? true : false; if ($handler) { // Load handler $handler = $modelHandler->ini($handler); } $bundleUrl = Route::url($this->pub->link('serve') . '&el=' . $this->elementId . '&download=1'); // Get curator status if ($this->name == 'curator') { $curatorStatus = $this->pub->_curationModel->getCurationStatus($this->pub, $this->master->blockId, $this->elementId, 'curator'); } if ($this->name == 'curator') {
$max = $this->manifest->params->max; // Get side text $aboutText = $this->manifest->about ? $this->manifest->about : NULL; if ($this->pub->_project->isProvisioned() && isset($this->manifest->aboutProv)) { $aboutText = $this->manifest->aboutProv; } // Wrap text in a paragraph if (strlen($aboutText) == strlen(strip_tags($aboutText))) { $aboutText = '<p>' . $aboutText . '</p>'; } // Get curator status $curatorStatus = $this->pub->_curationModel->getCurationStatus($this->pub, $this->master->blockId, $this->elementId, 'author'); // Get attachment model $modelAttach = new \Components\Publications\Models\Attachments($this->database); // Get handler model $modelHandler = new \Components\Publications\Models\Handlers($this->database); // Is there handler choice? $handlers = $this->manifest->params->typeParams->handlers; // Is there handler assigned? $handler = $this->manifest->params->typeParams->handler; $useHandles = $handlers || $handler ? true : false; if ($handler) { // Load handler $handler = $modelHandler->ini($handler); } $multiZip = isset($this->manifest->params->typeParams->multiZip) && $this->manifest->params->typeParams->multiZip == 0 ? false : true; $complete = $curatorStatus->status == 1 && $required ? $curatorStatus->status : $complete; $updated = $curatorStatus->updated && ($curatorStatus->status == 3 && !$complete || $curatorStatus->status == 1 || $curatorStatus->status == 0) ? true : false; $handlerOptions = count($this->attachments) > 0 && $useHandles ? $modelHandler->showHandlers($this->pub, $this->elementId, $handlers, $handler, $this->attachments, $props) : NULL; $elementUrl = Route::url($this->pub->link('editversion') . '§ion=' . $this->master->block . '&step=' . $this->master->blockId . '&move=continue' . '&el=' . $this->elementId . '#' . $elName); ?>
/** * Handler manager * * @return string */ public function handler() { // Incoming $props = Request::getVar('p', ''); $ajax = Request::getInt('ajax', 0); $pid = Request::getInt('pid', 0); $vid = Request::getInt('vid', 0); $handler = trim(Request::getVar('h', '')); $action = trim(Request::getVar('do', '')); // Parse props for curation $parts = explode('-', $props); $block = isset($parts[0]) ? $parts[0] : 'content'; $blockId = isset($parts[1]) && is_numeric($parts[1]) && $parts[1] > 0 ? $parts[1] : 1; $element = isset($parts[2]) && is_numeric($parts[2]) && $parts[2] > 0 ? $parts[2] : 0; // Output HTML $view = new \Hubzero\Component\View(array('base_path' => PATH_CORE . DS . 'components' . DS . 'com_publications' . DS . 'site', 'name' => 'handlers', 'layout' => 'editor')); $view->publication = new \Components\Publications\Models\Publication($pid, NULL, $vid); if (!$view->publication->exists()) { $this->setError(Lang::txt('PLG_PROJECTS_PUBLICATIONS_SELECTOR_ERROR_NO_PUBID')); // Output error $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'files', 'name' => 'error')); $view->title = ''; $view->option = $this->_option; $view->setError($this->getError()); return $view->loadTemplate(); } // Set curation $view->publication->setCuration(); // Set block if (!$view->publication->_curationModel->setBlock($block, $blockId)) { $view->setError(Lang::txt('PLG_PROJECTS_PUBLICATIONS_SELECTOR_ERROR_LOADING_CONTENT')); } // Load handler $modelHandler = new \Components\Publications\Models\Handlers($this->_database); $view->handler = $modelHandler->ini($handler); if (!$view->handler) { $this->setError(Lang::txt('PLG_PROJECTS_PUBLICATIONS_ERROR_LOADING_HANDLER')); } else { // Perform request if ($action) { $modelHandler->update($view->handler, $view->publication, $element, $action); } // Load editor $view->editor = $modelHandler->loadEditor($view->handler, $view->publication, $element); } $view->option = $this->_option; $view->database = $this->_database; $view->uid = $this->_uid; $view->ajax = $ajax; $view->task = $this->_task; $view->element = $element; $view->block = $block; $view->blockId = $blockId; $view->props = $props; $view->config = $this->_pubconfig; // Get messages and errors $view->msg = $this->_msg; if ($this->getError()) { $view->setError($this->getError()); } return $view->loadTemplate(); }
preg_match_all("#<nb:(.*?)>(.*?)</nb:(.*?)>#s", $this->publication->metadata, $matches, PREG_SET_ORDER); if (count($matches) > 0) { foreach ($matches as $match) { $data[$match[1]] = $match[2]; } } $category = $this->publication->_category; $customFields = $this->publication->_curationModel->getMetaSchema(); include_once PATH_CORE . DS . 'components' . DS . 'com_publications' . DS . 'models' . DS . 'elements.php'; $metaElements = new \Components\Publications\Models\Elements($data, $customFields); $schema = $metaElements->getSchema(); ?> <div class="pubabout"> <?php // Show gallery images $modelHandler = new \Components\Publications\Models\Handlers($this->database); // Load image handler if ($handler = $modelHandler->ini('imageviewer')) { echo $handler->showImageBand($this->publication); } ?> <h4><?php echo Lang::txt('COM_PUBLICATIONS_ABSTRACT'); ?> </h4> <div class="pub-content"> <?php echo $description; ?> </div>
/** * Update file attachment properties * * * @return boolean or error */ public function updateAttachment($row, $element, $elementId, $pub, $blockParams) { // Incoming $title = Request::getVar('title', ''); $name = Request::getVar('filename', ''); $thumb = Request::getInt('makedefault', 0); // Get configs $configs = $this->getConfigs($element, $elementId, $pub, $blockParams); // Cannot make changes if ($configs->freeze) { return false; } $gone = is_file($configs->path . DS . $row->path) ? false : true; // Update label $row->title = $title; $row->modified_by = User::get('id'); $row->modified = Date::toSql(); // Update record if (!$row->store()) { $this->setError(Lang::txt('Error updating item record')); } $this->set('_message', Lang::txt('Update successful')); // Reflect the update in curation record $this->_parent->set('_update', 1); // Make image default if ($thumb) { // Get handler model $modelHandler = new \Components\Publications\Models\Handlers($this->_parent->_db); // Load image handler $handler = $modelHandler->ini('imageviewer'); if (!$handler) { return false; } if ($handler->makeDefault($row, $pub, $configs)) { $this->set('_message', Lang::txt('Updated default publication thumbnail')); return true; } } return true; }