/**
  * Draw file selector
  *
  * @return  object
  */
 public function drawSelector($elementId, $manifest, $pub = NULL, $status = NULL, $active = 0, $collapse = 0, $total = 0, $master = NULL, $order = 0)
 {
     // Get attachment type model
     $attModel = new \Components\Publications\Models\Attachments($this->_parent->_db);
     // Make sure we have attachments
     if (!isset($pub->_attachments)) {
         // Get attachments
         $pContent = new \Components\Publications\Tables\Attachment($this->_parent->_db);
         $pub->_attachments = $pContent->sortAttachments($pub->version_id);
     }
     // Get attached items
     $attachments = $pub->_attachments;
     $attachments = isset($attachments['elements'][$elementId]) ? $attachments['elements'][$elementId] : NULL;
     $attachments = $attModel->getElementAttachments($elementId, $attachments, $manifest->params->type, $manifest->params->role);
     $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'publications', 'name' => 'blockelement', 'layout' => 'dataselector'));
     $view->type = $manifest->params->type;
     $view->path = $this->path;
     $view->pub = $pub;
     $view->manifest = $manifest;
     $view->status = $status;
     $view->elementId = $elementId;
     $view->attachments = $attachments;
     $view->active = $active;
     $view->collapse = $collapse;
     $view->total = $total;
     $view->master = $master;
     $view->database = $this->_parent->_db;
     $view->order = $order;
     $view->viewer = 'edit';
     $view->git = $this->_git;
     return $view->loadTemplate();
 }
Beispiel #2
0
 /**
  * Load content editor for handler
  *
  * @return  void
  */
 public function loadEditor($handler, $pub, $elementId = 0)
 {
     // Get handler configs
     $configs = $handler->get('_configs');
     if (!$configs) {
         $configs = $handler->getConfig();
     }
     // Start editor
     $editor = new \Components\Publications\Models\Editor($handler, $configs);
     // Make sure we have attachments
     if (!isset($pub->_attachments)) {
         // Get attachments
         $pContent = new \Components\Publications\Tables\Attachment($this->_parent->_db);
         $pub->_attachments = $pContent->sortAttachments($pub->version_id);
     }
     // Sort out attachments for this element
     $attachments = $pub->_attachments;
     $attachments = isset($attachments['elements'][$elementId]) ? $attachments['elements'][$elementId] : NULL;
     // Set editor properties
     $editor->set('pub', $pub);
     $editor->set('attachments', $attachments);
     $editor->set('elementId', $elementId);
     // Check if assigned and get association record
     $objAssoc = new \Components\Publications\Tables\HandlerAssoc($this->_db);
     $association = $objAssoc->getAssociation($pub->version_id, $elementId, $handler->get('_name'));
     $editor->set('assoc', $association);
     // Check status
     $editor->set('configured', $association && $association->params ? true : false);
     $editor->set('assigned', $association ? true : false);
     $editor->set('relevant', self::isRelevant($handler, $attachments));
     // Check for changes
     // TBD
     return $editor;
 }