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;
 }
  <fieldset class="collapsible collapsed" id="repositoryArea">

    <legend><?php 
echo __('Permissions by %1%', array('%1%' => sfConfig::get('app_ui_label_repository')));
?>
</legend>

    <?php 
if (0 < count($repositories)) {
    ?>
      <?php 
    foreach ($repositories as $repositoryId => $permissions) {
        ?>
        <div class="form-item">
          <?php 
        echo get_component('aclGroup', 'aclTable', array('object' => QubitRepository::getById($repositoryId), 'permissions' => $permissions, 'actions' => $basicActions));
        ?>
        </div>
      <?php 
    }
    ?>
    <?php 
}
?>

    <?php 
echo javascript_tag(<<<EOL
Drupal.behaviors.dialog2 = {
  attach: function (context)
  {
    Qubit.repoDialog = new QubitAclDialog('addRepository', '{$tableTemplate}', jQuery);
              <td colspan="<?php 
            echo $tableCols;
            ?>
"><strong>
                <?php 
            if ('' == $repoId && '' == $objectId) {
                ?>
                  <em><?php 
                echo __('All %1%', array('%1%' => sfConfig::get('app_ui_label_informationobject')));
                ?>
</em>
                <?php 
            } elseif ('' != $repoId) {
                ?>
                  <?php 
                echo sfConfig::get('app_ui_label_repository') . ': ' . render_title(QubitRepository::getById($repoId));
                ?>
                <?php 
            } else {
                ?>
                  <?php 
                echo render_title(QubitInformationObject::getById($objectId));
                ?>
                <?php 
            }
            ?>
              </strong></td>
            </tr>
            <?php 
            $row = 0;
            ?>
 public function setIdentifierWithCodes($identifier, $options)
 {
     $this->setIdentifier($identifier);
     if ($repository = QubitRepository::getById($this->getRepositoryId())) {
         // if the repository doesn't already have a code, set it using the <unitid repositorycode=""> value
         if (isset($options['repositorycode'])) {
             if (!$repository->getIdentifier()) {
                 $repository->setIdentifier($options['repositorycode']);
                 $repository->save();
             }
         }
         // if the repository doesn't already have an country code, set it using the <unitid countrycode=""> value
         if (isset($options['countrycode'])) {
             if (!$repository->getCountryCode()) {
                 if ($primaryContact = $repository->getPrimaryContact()) {
                     $primaryContact->setCountryCode(strtoupper($options['countrycode']));
                     $primaryContact->save();
                 } else {
                     if (count($contacts = $repository->getContactInformation()) > 0) {
                         $contacts[0]->setCountryCode(strtoupper($options['countrycode']));
                         $contacts[0]->save();
                     } else {
                         $contactInformation = new QubitContactInformation();
                         $contactInformation->setCountryCode(strtoupper($options['countrycode']));
                         $contactInformation->setActorId($repository->id);
                         $contactInformation->save();
                     }
                 }
             }
         }
     }
 }
 public function getRepository()
 {
     if (null !== ($repositoryId = $this->getConstants(array('name' => 'repositoryId')))) {
         return QubitRepository::getById($repositoryId);
     }
 }
        <td colspan="<?php 
            echo $tableCols;
            ?>
"><strong>
        <?php 
            if ('' == $repoId && '' == $objectId) {
                ?>
          <em><?php 
                echo __('All %1%', array('%1%' => sfConfig::get('app_ui_label_informationobject')));
                ?>
</em>
        <?php 
            } elseif ('' != $repoId) {
                ?>
          <?php 
                echo __('%1%: %2%', array('%1%' => sfConfig::get('app_ui_label_repository'), '%2%' => render_title(QubitRepository::getById($repoId))));
                ?>
        <?php 
            } else {
                ?>
          <?php 
                echo render_title(QubitInformationObject::getById($objectId));
                ?>
        <?php 
            }
            ?>
        </strong></td>
      </tr>

    <?php 
            $row = 0;