$req .= ' ' . Lang::txt('PLG_PROJECTS_FILES_SELECTOR_OF_FORMAT'); $req .= count($allowed) > 1 ? 's - ' : ' - '; $x = 1; foreach ($allowed as $al) { $req .= '.' . strtoupper($al); $req .= $x == count($allowed) ? '' : ', '; $x++; } } else { $req .= ' ' . Lang::txt('PLG_PROJECTS_FILES_SELECTOR_OF_ANY_TYPE'); } $req .= ':'; // Get attached items $attachments = $this->publication->attachments(); $attachments = isset($attachments['elements'][$elId]) ? $attachments['elements'][$elId] : NULL; $attachments = $attModel->getElementAttachments($elId, $attachments, $params->type); $used = array(); if (!$reuse && $this->publication->_attachments['elements']) { foreach ($this->publication->_attachments['elements'] as $o => $elms) { if ($o != $elId) { foreach ($elms as $elm) { $used[] = $elm->path; } } } } // Get preselected items $selected = array(); if ($attachments) { foreach ($attachments as $attach) { $selected[] = $attach->path;
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ // No direct access defined('_HZEXEC_') or die; // Get requirements $element = $this->publication->curation('blocks', $this->step, 'elements', $this->element); $params = $element->params; // Get attachment type model $attModel = new \Components\Publications\Models\Attachments($this->database); // Get attached items $attachments = $this->publication->attachments(); $attachments = isset($attachments['elements'][$this->element]) ? $attachments['elements'][$this->element] : NULL; $attachments = $attModel->getElementAttachments($this->element, $attachments, $params->type); // Get preselected items $selected = array(); if ($attachments) { foreach ($attachments as $attach) { $selected[] = $attach->object_name; } } ?> <div id="abox-content-wrap"> <div id="abox-content"> <script src="/core/plugins/projects/publications/assets/js/selector.js"></script> <h3><?php echo Lang::txt('PLG_PROJECTS_DATABASES_SELECTOR'); ?> <span class="abox-controls">
/** * 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(); }