Ejemplo n.º 1
0
// 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') {
    ?>
<div id="<?php 
    echo $elName;
    ?>
" class="blockelement<?php 
    echo $required ? ' el-required' : ' el-optional';
    echo $complete ? ' el-complete' : ' el-incomplete';
    echo $curatorStatus->status == 1 ? ' el-passed' : '';
Ejemplo n.º 2
0
 /**
  * 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();
 }
Ejemplo n.º 3
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>

<?php 
Ejemplo n.º 4
0
 /**
  * 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;
 }