public function execute($request) { $this->resource = $this->getRoute()->resource; // Check that this isn't the root if (!isset($this->resource->parent)) { $this->forward404(); } // Check user authorization if (!QubitAcl::check($this->resource, 'read')) { QubitAcl::forwardToSecureAction(); } if ('print' == $request->getGetParameter('media', 'screen')) { $this->getResponse()->addStylesheet('print-preview', 'last'); } // Only show link to view/download master copy of digital object if the // user has readMaster permissions OR it's a text object (to allow reading) $this->digitalObjectLink = null; if (0 < count($this->resource->digitalObjects) && (QubitAcl::check($this->resource, 'readMaster') || in_array($this->resource->digitalObjects[0]->mediaTypeId, array(QubitTerm::TEXT_ID, QubitTerm::AUDIO_ID)))) { if (QubitTerm::EXTERNAL_URI_ID == $this->resource->digitalObjects[0]->usageId) { $this->digitalObjectLink = $this->resource->digitalObjects[0]->path; } else { $this->digitalObjectLink = $request->getUriPrefix() . $request->getRelativeUrlRoot() . $this->resource->digitalObjects[0]->getFullPath(); } } QubitImageFlow::addAssets($this->response); QubitTreeView::addAssets($this->response); }
public function execute($request) { parent::execute($request); if ($request->hasParameter('csvimport')) { // if a parent ID is set, use that for parenting $parentId = $request->getParameter('parent', null); if (!empty($parentId)) { $request->getParameterHolder()->remove('parent'); } // make sure we don't pass the import ID $request->getParameterHolder()->remove('id'); $this->form->bind($request->getParameterHolder()->getAll()); if ($this->form->isValid()) { $this->processForm(); if (!empty($parentId)) { $this->resource->parent = QubitInformationObject::getById($parentId); } else { $this->resource->parent = QubitInformationObject::getById(QubitInformationObject::ROOT_ID); } $this->resource->save(); return; // don't bother adding assets etc. for output } } elseif ($request->isMethod('post')) { $this->form->bind($request->getPostParameters()); if ($this->form->isValid()) { $this->processForm(); $this->resource->save(); $this->redirect(array($this->resource, 'module' => 'informationobject')); } } QubitDescription::addAssets($this->response); QubitImageFlow::addAssets($this->response); QubitTreeView::addAssets($this->response); }