public function indexAction() { $model = new OpenSKOS_Db_Table_Tenants(); $context = $this->_helper->contextSwitch()->getCurrentContext(); if ($context == 'json' || $context == 'jsonp') { $this->view->assign('institutions', $model->fetchAll()->toArray()); } else { $this->view->tenants = $model->fetchAll(); } }
/** * @return Editor_Forms_SearchOptions */ protected function buildTenants() { $modelTenants = new OpenSKOS_Db_Table_Tenants(); $tenants = $modelTenants->fetchAll(); $tenantsOptions = array(); foreach ($tenants as $tenant) { $tenantsOptions[$tenant->code] = $tenant->name; } $this->addElement('multiselect', 'tenants', array('label' => _('Tenants'), 'multiOptions' => $tenantsOptions)); $this->getElement('tenants')->setValue(array($this->_getCurrentTenant()->code)); return $this; }
/** * Parses the part of the query for searching for specified tenants. * By default the search is performed for the current tenant. * * @return OpenSKOS_Solr_Queryparser_Editor */ protected function _parseSearchForTenants() { $modelTenants = new OpenSKOS_Db_Table_Tenants(); $allTenants = $modelTenants->fetchAll(); $searchInTenants = array(); if (isset($this->_searchOptions['tenants']) && !empty($this->_searchOptions['tenants'])) { $searchInTenants = $this->_searchOptions['tenants']; } else { $searchInTenants[] = $this->_tenant->code; } if (!empty($searchInTenants) && count($allTenants) != count($searchInTenants)) { $query = ''; foreach ($searchInTenants as $tenantCode) { $query .= !empty($query) ? ' OR ' : ''; $query .= 'tenant:' . $tenantCode; } if (!empty($query) && count($searchInTenants) > 1) { $query = '(' . $query . ')'; } if (!empty($query)) { $this->_addDefaultQuerySeparator(); $this->_query .= $query; } } return $this; }
public function ListSets() { $model = new OpenSKOS_Db_Table_Tenants(); $this->_view->tenants = $model->fetchAll(); $model = new OpenSKOS_Db_Table_Collections(); $collections = array(); foreach ($model->fetchAll() as $collection) { if (!isset($collections[$collection->tenant])) { $collections[$collection->tenant] = array(); } $collections[$collection->tenant][$collection->id] = $collection; } $this->_view->collections = $collections; $this->_view->assign('conceptSchemes', $this->loadAllConceptSchemes()); return $this->_view->render('index/ListSets.phtml'); }