コード例 #1
0
 protected function addField($name)
 {
     switch ($name) {
         case 'authorizedFormOfName':
             $this->form->setValidator('authorizedFormOfName', new sfValidatorString());
             $this->form->setWidget('authorizedFormOfName', new sfWidgetFormSelect(array('choices' => array())));
             break;
         case 'type':
             $this->form->setDefault('type', $this->context->routing->generate(null, array(QubitTerm::getById(QubitTerm::DONOR_ID), 'module' => 'term')));
             $this->form->setValidator('type', new sfValidatorString());
             $this->form->setWidget('type', new sfWidgetFormInputHidden());
             break;
         case 'countryCode':
             $this->form->setValidator('countryCode', new sfValidatorI18nChoiceCountry());
             $this->form->setWidget('countryCode', new sfWidgetFormI18nChoiceCountry(array('add_empty' => true, 'culture' => $this->context->user->getCulture())));
             break;
         case 'city':
         case 'contactPerson':
         case 'email':
         case 'postalCode':
         case 'region':
         case 'streetAddress':
         case 'telephone':
             $this->form->setValidator($name, new sfValidatorString());
             $this->form->setWidget($name, new sfWidgetFormInput());
         default:
             return parent::addField($name);
     }
 }
コード例 #2
0
 public static function parse($doc, $options = array())
 {
     $terms = array();
     libxml_use_internal_errors(true);
     // Report XML errors
     if (!$doc) {
         foreach (libxml_get_errors() as $error) {
             //TODO echo errors in template. Use custom validator?
             var_dump($error);
         }
     }
     $skos = new sfSkosPlugin();
     $skos->xpath = new DOMXPath($doc);
     // Create Xpath object, register namespaces
     $skos->xpath->registerNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#');
     $skos->xpath->registerNamespace('skos', 'http://www.w3.org/2004/02/skos/core#');
     $skos->xpath->registerNamespace('dc', 'http://purl.org/dc/elements/1.1/');
     // Set taxonomy
     $skos->taxonomy = QubitTaxonomy::getById(QubitTaxonomy::SUBJECT_ID);
     if (isset($options['taxonomy'])) {
         $skos->taxonomy = $options['taxonomy'];
     }
     $skos->parent = QubitTerm::getById(QubitTerm::ROOT_ID);
     if (isset($options['parent'])) {
         $skos->parent = $options['parent'];
     }
     // XPath selector for expanded RDF syntax
     $rdfsel = "rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#Concept']]";
     // Get all concepts
     $concepts = $skos->xpath->query("skos:Concept | {$rdfsel}");
     // Create terms from concepts
     foreach ($concepts as $concept) {
         if (!$concept instanceof domElement) {
             continue;
         }
         $skos->addTerm($concept);
     }
     // Built term associations (including hierarchy)
     foreach ($concepts as $concept) {
         if (!$concept instanceof domElement) {
             continue;
         }
         // Add parent
         if (0 < $skos->xpath->query('./skos:broader', $concept)->length) {
             $skos->setParent($concept);
         }
         // Add children
         if (0 < $skos->xpath->query('./skos:narrower', $concept)->length) {
             $skos->setChildren($concept);
         }
         // Add relations
         if (0 < $skos->xpath->query('./skos:related', $concept)->length) {
             $skos->addTermRelations($concept);
         }
     }
     return $skos;
 }
コード例 #3
0
 protected function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     $conn = $databaseManager->getDatabase('propel')->getConnection();
     $criteria = new Criteria();
     $criteria->add(QubitSlug::SLUG, $arguments['slug']);
     $criteria->addJoin(QubitSlug::OBJECT_ID, QubitObject::ID);
     $resource = QubitInformationObject::get($criteria)->__get(0);
     $publicationStatus = QubitTerm::getById($arguments['publicationStatusId']);
     // Check if the resource exists
     if (!isset($resource)) {
         throw new sfException('Resource not found');
     }
     // Check if the given status is correct and exists
     if (!isset($publicationStatus)) {
         throw new sfException('Publication status not found');
     }
     if (QubitTaxonomy::PUBLICATION_STATUS_ID != $publicationStatus->taxonomyId) {
         throw new sfException('Given term is not part of the publication status taxonomy');
     }
     // Final confirmation
     if (!$options['no-confirm']) {
         if (!$this->askConfirmation(array('Please, confirm that you want to change', 'the publication status of "' . $resource . '"', 'to "' . $publicationStatus . '" (y/N)'), 'QUESTION_LARGE', false)) {
             $this->logSection('tools', 'Bye!');
             return 1;
         }
     }
     // Start work
     $resource->setPublicationStatus($publicationStatus->id);
     $resource->save();
     echo '+';
     // Update pub status of descendants
     if (!$options['ignore-descendants']) {
         foreach ($resource->descendants as $descendant) {
             if (null === ($descendantPubStatus = $descendant->getPublicationStatus())) {
                 $descendantPubStatus = new QubitStatus();
                 $descendantPubStatus->typeId = QubitTerm::STATUS_TYPE_PUBLICATION_ID;
                 $descendantPubStatus->objectId = $descendant->id;
             }
             if ($options['force'] || $publicationStatus->id != $descendantPubStatus->statusId) {
                 $descendantPubStatus->statusId = $publicationStatus->id;
                 $descendantPubStatus->save();
                 echo '^';
             }
         }
     }
     echo "\n";
 }
コード例 #4
0
 public function execute($request)
 {
     $resource = $this->getRoute()->resource;
     if (!isset($resource)) {
         $this->forward404();
     }
     if ('QubitTerm' == $resource->className) {
         $term = QubitTerm::getById($resource->id);
         $this->terms = $term->descendants->andSelf()->orderBy('lft');
         $this->taxonomy = $term->taxonomy;
         $this->topLevelTerms = array($term);
     } else {
         $this->terms = QubitTaxonomy::getTaxonomyTerms($resource->id);
         $this->taxonomy = QubitTaxonomy::getById($resource->id);
         $this->topLevelTerms = QubitTaxonomy::getTaxonomyTerms($resource->id, array('level' => 'top'));
     }
 }
コード例 #5
0
 public function execute($request)
 {
     $this->form = new sfForm();
     $this->timer = new QubitTimer();
     $this->terms = array();
     $this->termsPerPage = intval(sfConfig::get('app_hits_per_page'));
     $this->taxonomy = null;
     $this->parent = QubitTerm::getById(QubitTerm::ROOT_ID);
     if (isset($this->getRoute()->resource)) {
         $resource = $this->getRoute()->resource;
         if ('QubitTaxonomy' == $resource->className) {
             $this->taxonomy = QubitTaxonomy::getById($resource->id);
         } else {
             $this->parent = QubitTerm::getById($resource->id);
             $this->taxonomy = $this->parent->taxonomy;
         }
     }
     if (!isset($this->taxonomy)) {
         $this->forward404();
     }
     // Check user authorization
     if (!QubitAcl::check($this->parent, 'create')) {
         QubitAcl::forwardUnauthorized();
     }
     $this->form->setWidget('file', new sfWidgetFormInputFile());
     $this->form->setValidator('file', new sfValidatorFile());
     if ($request->isMethod('post')) {
         $this->form->bind($request->getPostParameters(), $request->getFiles());
         if ($this->form->isValid()) {
             if (null !== ($file = $this->form->getValue('file'))) {
                 $doc = new domDocument();
                 $doc->substituteEntities = true;
                 $doc->load($file->getTempName());
                 $this->skos = sfSkosPlugin::parse($doc, array('taxonomy' => $this->taxonomy, 'parent' => $this->parent));
             }
         }
     } else {
         $this->setTemplate('importSelect');
     }
 }
コード例 #6
0
 public function execute($request)
 {
     if (!isset($request->limit)) {
         $request->limit = 25;
     }
     $this->mediaType = QubitTerm::getById($request->mediatype);
     if (!$this->mediaType instanceof QubitTerm) {
         $this->forward404();
     }
     $criteria = new Criteria();
     $criteria->add(QubitDigitalObject::MEDIA_TYPE_ID, $this->mediaType->id);
     $criteria->add(QubitDigitalObject::SEQUENCE);
     $criteria->addJoin(QubitDigitalObject::INFORMATION_OBJECT_ID, QubitInformationObject::ID);
     // Sort by name ascending
     $criteria->addAscendingOrderByColumn(QubitDigitalObject::NAME);
     // Filter draft descriptions
     $criteria = QubitAcl::addFilterDraftsCriteria($criteria);
     $this->pager = new QubitPager('QubitDigitalObject');
     $this->pager->setCriteria($criteria);
     $this->pager->setMaxPerPage($request->limit);
     $this->pager->setPage($request->page);
 }
コード例 #7
0
 protected function addField($name)
 {
     switch ($name) {
         case 'className':
             $choices = array('QubitInformationObject' => sfConfig::get('app_ui_label_informationobject'), 'QubitActor' => sfConfig::get('app_ui_label_actor'), 'QubitRepository' => sfConfig::get('app_ui_label_repository'), 'QubitTerm' => sfConfig::get('app_ui_label_term'), 'QubitFunction' => sfConfig::get('app_ui_label_function'));
             $this->form->setValidator($name, new sfValidatorString());
             $this->form->setWidget($name, new sfWidgetFormSelect(array('choices' => $choices)));
             break;
         case 'dateStart':
             $this->form->setValidator($name, new sfValidatorDate(array(), array('invalid' => $this->context->i18n->__('Invalid start date'))));
             $this->form->setWidget($name, new sfWidgetFormInput(array(), array('style' => 'width: auto')));
             break;
         case 'dateEnd':
             $this->form->setValidator($name, new sfValidatorDate(array(), array('invalid' => $this->context->i18n->__('Invalid end date'))));
             $this->form->setWidget($name, new sfWidgetFormInput(array(), array('style' => 'width: auto')));
             break;
         case 'dateOf':
             $choices = array('CREATED_AT' => 'Creation', 'UPDATED_AT' => 'Revision', 'both' => 'Both');
             $this->form->setValidator($name, new sfValidatorChoice(array('choices' => array_keys($choices))));
             $this->form->setWidget($name, new sfWidgetFormSelectRadio(array('choices' => $choices, 'class' => 'radio inline')));
             break;
         case 'publicationStatus':
             $choices = array(QubitTerm::PUBLICATION_STATUS_PUBLISHED_ID => QubitTerm::getById(QubitTerm::PUBLICATION_STATUS_PUBLISHED_ID)->name, QubitTerm::PUBLICATION_STATUS_DRAFT_ID => QubitTerm::getById(QubitTerm::PUBLICATION_STATUS_DRAFT_ID)->name, 'all' => 'All');
             $this->form->setValidator($name, new sfValidatorChoice(array('choices' => array_keys($choices))));
             $this->form->setWidget($name, new sfWidgetFormSelectRadio(array('choices' => $choices, 'class' => 'radio inline')));
             break;
         case 'limit':
             $this->form->setValidator($name, new sfValidatorString());
             $this->form->setWidget($name, new sfWidgetFormInputHidden());
             break;
         case 'sort':
             $this->form->setValidator($name, new sfValidatorString());
             $this->form->setWidget($name, new sfWidgetFormInputHidden());
             break;
     }
 }
コード例 #8
0
</li>
                        <li><input type="radio" name="acl[<?php 
                echo $item[$action]->id;
                ?>
]" value="<?php 
                echo QubitAcl::INHERIT;
                ?>
"><?php 
                echo __('Inherit');
                ?>
</li>
                      <?php 
            } else {
                ?>
                        <?php 
                $rootTermUrl = url_for(array(QubitTerm::getById(QubitTerm::ROOT_ID), 'module' => 'term'));
                ?>
                        <li><input type="radio" name="acl[<?php 
                echo $action . '_' . $rootTermUrl;
                ?>
]" value="<?php 
                echo QubitAcl::GRANT;
                ?>
"><?php 
                echo __('Grant');
                ?>
</li>
                        <li><input type="radio" name="acl[<?php 
                echo $action . '_' . $rootTermUrl;
                ?>
]" value="<?php 
コード例 #9
0
 public function execute($request)
 {
     // Default items per page
     if (!isset($request->limit)) {
         $request->limit = sfConfig::get('app_hits_per_page');
     }
     $this->form = new sfForm();
     $this->resource = $this->getRoute()->resource;
     // Check that the object exists and that it is not the root
     if (!isset($this->resource) || !isset($this->resource->parent)) {
         $this->forward404();
     }
     // Check authorization
     if (!QubitAcl::check($this->resource, 'update')) {
         QubitAcl::forwardUnauthorized();
     }
     // "parent" form field
     $this->form->setValidator('parent', new sfValidatorString(array('required' => true)));
     $this->form->setWidget('parent', new sfWidgetFormInputHidden());
     // Root is default parent
     if ($this->resource instanceof QubitInformationObject) {
         $this->form->bind($request->getGetParameters() + array('parent' => $this->context->routing->generate(null, array(QubitInformationObject::getById(QubitInformationObject::ROOT_ID), 'module' => 'informationobject'))));
     } else {
         if ($this->resource instanceof QubitTerm) {
             $this->form->bind($request->getGetParameters() + array('parent' => $this->context->routing->generate(null, array(QubitTerm::getById(QubitTerm::ROOT_ID), 'module' => 'term'))));
         }
     }
     if ($request->isMethod('post')) {
         $this->form->bind($request->getPostParameters());
         if ($this->form->isValid()) {
             $params = $this->context->routing->parse(Qubit::pathInfo($this->form->parent->getValue()));
             // In term treeview, root node links (href) to taxonomy, but it represents the term root object
             if ($this->resource instanceof QubitTerm && QubitObject::getById($params['_sf_route']->resource->id) instanceof QubitTaxonomy) {
                 $this->resource->parentId = QubitTerm::ROOT_ID;
             } else {
                 $this->resource->parentId = $params['_sf_route']->resource->id;
             }
             $this->resource->save();
             if ($request->isXmlHttpRequest()) {
                 return $this->renderText('');
             } else {
                 if ($this->resource instanceof QubitInformationObject) {
                     $this->redirect(array($this->resource, 'module' => 'informationobject'));
                 } else {
                     if ($this->resource instanceof QubitTerm) {
                         $this->redirect(array($this->resource, 'module' => 'term'));
                     }
                 }
             }
         }
     }
     $params = $this->context->routing->parse(Qubit::pathInfo($this->form->parent->getValue()));
     $this->parent = QubitObject::getById($params['_sf_route']->resource->id);
     $query = QubitSearch::getInstance()->addTerm($this->parent->slug, 'parent');
     if (isset($request->query)) {
         $query = $request->query;
     }
     $this->pager = new QubitArrayPager();
     $this->pager->hits = QubitSearch::getInstance()->getEngine()->getIndex()->find($query);
     $this->pager->setMaxPerPage($request->limit);
     $this->pager->setPage($request->page);
     $ids = array();
     foreach ($this->pager->getResults() as $hit) {
         $ids[] = $hit->getDocument()->id;
     }
     $criteria = new Criteria();
     $criteria->add(QubitObject::ID, $ids, Criteria::IN);
     $this->results = QubitObject::get($criteria);
 }
コード例 #10
0
 public function execute($request)
 {
     if (!isset($request->limit)) {
         $request->limit = sfConfig::get('app_hits_per_page');
     }
     // For term module show only preferred term
     $params = $this->context->routing->parse(Qubit::pathInfo($request->getReferer()));
     if ('term' == $params['module']) {
         $criteria = new Criteria();
         // Exclude the calling object and it's descendants from the list (prevent
         // circular inheritance)
         if (isset($params['id'])) {
             // TODO Self join would be ideal
             $term = QubitTerm::getById($params['id']);
             if (isset($term)) {
                 $criteria->add($criteria->getNewCriterion(QubitTerm::LFT, $term->lft, Criteria::LESS_THAN)->addOr($criteria->getNewCriterion(QubitTerm::RGT, $term->rgt, Criteria::GREATER_THAN)));
             }
         }
         $params = $this->context->routing->parse(Qubit::pathInfo($request->taxonomy));
         $criteria->add(QubitTerm::TAXONOMY_ID, $params['_sf_route']->resource->id);
         $criteria->addJoin(QubitTerm::ID, QubitTermI18n::ID);
         $criteria->add(QubitTermI18n::CULTURE, $this->context->user->getCulture());
         // Narrow results by query
         if (isset($request->query)) {
             $criteria->add(QubitTermI18n::NAME, "{$request->query}%", Criteria::LIKE);
         }
         // Sort by name
         $criteria->addAscendingOrderByColumn(QubitTermI18n::NAME);
         $criteria->setLimit(10);
         $this->terms = QubitTerm::get($criteria);
     } else {
         $s1 = 'SELECT qt.id, null, qti.name
     FROM ' . QubitTerm::TABLE_NAME . ' qt
       LEFT JOIN ' . QubitTermI18n::TABLE_NAME . ' qti
         ON qt.id = qti.id
     WHERE taxonomy_id = :p1
       AND qti.culture = :p2';
         $s2 = 'SELECT qt.id, qon.id as altId, qoni.name
     FROM ' . QubitOtherName::TABLE_NAME . ' qon
       INNER JOIN ' . QubitOtherNameI18n::TABLE_NAME . ' qoni
         ON qon.id = qoni.id
       INNER JOIN ' . QubitTerm::TABLE_NAME . ' qt
         ON qon.object_id = qt.id
     WHERE qt.taxonomy_id = :p1
       AND qoni.culture = :p2';
         // Narrow results by query
         if (isset($request->query)) {
             $s1 .= ' AND qti.name LIKE :p3';
             $s2 .= ' AND qoni.name LIKE :p3';
         }
         $connection = Propel::getConnection();
         $statement = $connection->prepare("({$s1}) UNION ALL ({$s2}) ORDER BY name LIMIT 10");
         $params = $this->context->routing->parse(Qubit::pathInfo($request->taxonomy));
         $statement->bindValue(':p1', $params['_sf_route']->resource->id);
         $statement->bindValue(':p2', $this->context->user->getCulture());
         if (isset($request->query)) {
             $statement->bindValue(':p3', "{$request->query}%");
         }
         $statement->execute();
         $this->terms = array();
         $rows = $statement->fetchAll();
         foreach ($rows as $row) {
             if (isset($row[1])) {
                 // Alternative term
                 $this->terms[] = array(QubitTerm::getById($row[0]), $row[2]);
             } else {
                 // Preferred term
                 $this->terms[] = QubitTerm::getById($row[0]);
             }
         }
     }
 }
コード例 #11
0
 /**
  * Get a list of child terms of $parentTermId. Prefix $indentStr * depth of child
  * relative to parent
  *
  * @param integer $parentTermId  Primary key of parent term
  * @param string  $indentStr     String to prefix to each sub-level for indenting
  *
  * @return mixed  false on failure, else array of children formatted for select box
  */
 public static function getIndentedChildTree($parentTermId, $indentStr = '&nbsp;', $options = array())
 {
     if (!($parentTerm = QubitTerm::getById($parentTermId))) {
         return false;
     }
     $tree = array();
     $parentDepth = count($parentTerm->getAncestors());
     foreach ($parentTerm->getDescendants()->orderBy('lft') as $i => $node) {
         $relativeDepth = intval(count($node->getAncestors()) - $parentDepth - 1);
         $indentedName = str_repeat($indentStr, $relativeDepth) . $node->getName(array('cultureFallback' => 'true'));
         if (isset($options['returnObjectInstances']) && true == $options['returnObjectInstances']) {
             $node->name = $indentedName;
             $tree[sfContext::getInstance()->routing->generate(null, array($node, 'module' => 'term'))] = $node;
         } else {
             $tree[$node->id] = $indentedName;
         }
     }
     return $tree;
 }
コード例 #12
0
 public function filterQuery($query)
 {
     // limit to a repository if selected
     if (!empty($this->request->repository)) {
         $query->addSubquery(QubitSearch::getInstance()->addTerm($this->request->repository, 'repositoryId'), true);
         $this->queryTerms[] = array('term' => $this->getContext()->i18n->__('Repository') . ': ' . QubitRepository::getById($this->request->repository)->__toString(), 'operator' => 'and');
     }
     // digital object filters
     if ('true' == $this->request->hasDigitalObject) {
         $query->addSubquery(QubitSearch::getInstance()->addTerm('true', 'hasDigitalObject'), true);
         $this->queryTerms[] = array('term' => $this->getContext()->i18n->__('Digital object is available'), 'operator' => 'and');
     } else {
         if ('false' == $this->request->hasDigitalObject) {
             $query->addSubquery(QubitSearch::getInstance()->addTerm('false', 'hasDigitalObject'), true);
             $this->queryTerms[] = array('term' => $this->getContext()->i18n->__('No digital object is available'), 'operator' => 'and');
         }
     }
     if (!empty($this->request->mediatype)) {
         $query->addSubquery(QubitSearch::getInstance()->addTerm($this->request->mediatype, 'do_mediaTypeId'), true);
         $this->queryTerms[] = array('term' => 'mediatype: ' . QubitTerm::getById($this->request->mediatyp)->__toString(), 'operator' => 'and');
     }
     $query = parent::filterQuery($query);
     return $query;
 }
コード例 #13
0
 protected function updateChildLevels()
 {
     if (is_array($updateChildLevels = $this->request->updateChildLevels) && count($updateChildLevels)) {
         foreach ($updateChildLevels as $item) {
             $childLevel = new QubitInformationObject();
             $childLevel->identifier = $item['identifier'];
             $childLevel->title = $item['title'];
             if (null != ($pubStatus = $this->resource->getPublicationStatus())) {
                 $childLevel->setPublicationStatus($pubStatus->statusId);
             }
             if (0 < strlen($item['levelOfDescription']) && null !== QubitTerm::getById($item['levelOfDescription'])) {
                 $childLevel->levelOfDescriptionId = $item['levelOfDescription'];
             }
             if (0 < strlen($item['levelOfDescription']) || 0 < strlen($item['identifier']) || 0 < strlen($item['title'])) {
                 $this->resource->informationObjectsRelatedByparentId[] = $childLevel;
             }
         }
     }
 }
コード例 #14
0
ファイル: _edit.php プロジェクト: nurfiantara/ehri-ica-atom
      <?php 
echo $form->licenseIdentifier->help(__('Can be text value or URI (e.g. to Creative Commons, GNU or other online licenses). Used to identify the granting agreement uniquely within the repository system.'))->renderRow();
?>

      <?php 
echo $form->licenseTerms->help(__('Text describing the license or agreement by which permission was granted or link to full-text hosted online. This can contain the actual text of the license or agreement or a paraphrase or summary.'))->renderRow();
?>

      <?php 
echo $form->licenseNote->help(__('Additional information about the license, such as contact persons, action dates, or interpretations. The note may also indicated the location of the license, if it is available online or embedded in the object itself.'))->renderRow();
?>

    </fieldset>

    <fieldset route="<?php 
echo $sf_context->routing->generate(null, array(QubitTerm::getById(QubitTerm::RIGHT_BASIS_STATUTE_ID), 'module' => 'term'));
?>
">

      <legend><?php 
echo __('Statute information');
?>
</legend>

      <?php 
echo $form->statuteJurisdiction->help(__('The country or other political body that has enacted the statute.'))->renderRow();
?>

      <?php 
echo $form->statuteCitation->help(__('An identifying designation for the statute. Use standard citation form when applicable, e.g. bibliographic citation.'))->renderRow();
?>
コード例 #15
0
 public static function eventTypes()
 {
     return array(QubitTerm::getById(QubitTerm::CONTRIBUTION_ID), QubitTerm::getById(QubitTerm::CREATION_ID), QubitTerm::getById(QubitTerm::PUBLICATION_ID));
 }
コード例 #16
0
 public static function isAllowed($role, $resource, $action, $options = array())
 {
     if (!$role instanceof myUser) {
         self::getInstance()->addRole($role);
     }
     // If attempting to read a draft information object, check viewDraft permission
     if ('read' == $action && $resource instanceof QubitInformationObject) {
         if (null === $resource->getPublicationStatus()) {
             throw new sfException('No publication status set for information object id: ' . $resource->id);
         }
         if (QubitTerm::PUBLICATION_STATUS_DRAFT_ID == $resource->getPublicationStatus()->statusId) {
             $instance = self::getInstance()->buildAcl($resource, $options);
             return $instance->acl->isAllowed($role, $resource, 'read') && $instance->acl->isAllowed($role, $resource, 'viewDraft');
         }
     }
     // If resource is a new object (no id yet) figure out if we should test
     // authorization against parent (e.g. creating a new resource)
     if (is_object($resource) && !isset($resource->id)) {
         if (!isset($resource->parentId)) {
             return false;
         }
         if ('create' == $action) {
             // For create action always check permissions against parent
             $resource = $resource->parent;
         } else {
             if ($resource instanceof QubitInformationObject) {
                 // Special rules for information object
                 $resource = QubitInformationObjectAcl::getParentForIsAllowed($resource, $action);
             }
         }
         // If we still don't have a valid resource id, then deny access
         if (!isset($resource) || !isset($resource->id)) {
             return false;
         }
     }
     // HACKS for limiting term permissions by taxonomy
     if ($resource instanceof QubitTaxonomy && 'createTerm' == $action) {
         $term = clone QubitTerm::getById(QubitTerm::ROOT_ID);
         $term->taxonomyId = $resource->id;
         $action = 'create';
         $resource = $term;
     } else {
         if ($resource instanceof QubitTerm && array_key_exists('taxonomyId', $options)) {
             // Create clone resource that we can assign to an arbitrary taxonomy
             $resource = clone $resource;
             $resource->taxonomyId = $options['taxonomyId'];
         }
     }
     self::getInstance()->buildAcl($resource, $options);
     return self::getInstance()->acl->isAllowed($role, $resource, $action);
 }
コード例 #17
0
?>

    <?php 
echo get_partial('right/edit', $rightEditComponent->getVarHolder()->getAll());
?>

  </fieldset>

  <?php 
foreach ($representations as $usageId => $representation) {
    ?>

    <fieldset class="collapsible">

      <legend><?php 
    echo __('%1% representation', array('%1%' => QubitTerm::getById($usageId)));
    ?>
</legend>

      <?php 
    if (isset($representation)) {
        ?>

        <?php 
        echo get_component('digitalobject', 'editRepresentation', array('resource' => $resource, 'representation' => $representation));
        ?>

        <?php 
        $rightComponent = "rightEditComponent_{$usageId}";
        ?>
        <?php 
コード例 #18
0
 public static function eventTypes()
 {
     return array(QubitTerm::getById(QubitTerm::CREATION_ID), QubitTerm::getById(QubitTerm::ACCUMULATION_ID));
 }