public function getSelect()
 {
     $select = parent::getSelect();
     $permissions = new Omeka_Db_Select_PublicPermissions('UserProfiles_Profile');
     $permissions->apply($select, 'user_profiles_profiles');
     return $select;
 }
Beispiel #2
0
 /**
  * Apply permissions checks to all SQL statements retrieving collections from the table
  * 
  * @param string
  * @return void
  */
 public function getSelect()
 {
     $select = parent::getSelect();
     $permissions = new Omeka_Db_Select_PublicPermissions('Collections');
     $permissions->apply($select, 'collections');
     return $select;
 }
 public function getSelect()
 {
     $select = parent::getSelect();
     $permissions = new Omeka_Db_Select_PublicPermissions('NeatlineTime_Timelines');
     $permissions->apply($select, 'neatline_time_timelines', null);
     return $select;
 }
 /**
  * Use SQL-based low-level permissions checking for exhibit queries.
  *
  * @return Omeka_Db_Select
  */
 public function getSelect()
 {
     $select = parent::getSelect();
     $permissions = new Omeka_Db_Select_PublicPermissions('ExhibitBuilder_Exhibits');
     $permissions->apply($select, 'exhibits');
     return $select;
 }
 /**
  * Add permission check to location queries.
  * 
  * Since all locations belong to an item we can override this method to join 
  * the items table and add a permission check to the select object.
  * 
  * @return Omeka_Db_Select
  */
 public function getSelect()
 {
     $select = parent::getSelect();
     $select->join(array('items' => $this->_db->Item), 'items.id = locations.item_id', array());
     $permissions = new Omeka_Db_Select_PublicPermissions('Items');
     $permissions->apply($select, 'items');
     return $select;
 }
Beispiel #6
0
 /**
  * Overriding getSelect() to always return the type_name and type_regex
  * for retrieved elements.
  * 
  * @return Omeka_Db_Select
  */
 public function getSelect()
 {
     $select = parent::getSelect();
     $db = $this->getDb();
     // Join on the element_sets table to retrieve set name
     $select->joinLeft(array('element_sets' => $db->ElementSet), 'element_sets.id = elements.element_set_id', array('set_name' => 'element_sets.name'));
     return $select;
 }
Beispiel #7
0
 /**
  * All files should only be retrieved if they join properly on the items
  * table.
  *
  * @return Omeka_Db_Select
  */
 public function getSelect()
 {
     $select = parent::getSelect();
     $db = $this->getDb();
     $select->joinInner(array('items' => $db->Item), 'items.id = files.item_id', array());
     $permissions = new Omeka_Db_Select_PublicPermissions('Items');
     $permissions->apply($select, 'items');
     $select->group('files.id');
     return $select;
 }
Beispiel #8
0
 /**
  * All records should only be retrieved if they join properly on the folder
  * table.
  *
  * @return Omeka_Db_Select
  */
 public function getSelect()
 {
     $select = parent::getSelect();
     $db = $this->_db;
     $alias = $this->getTableAlias();
     $aliasFolder = $this->_db->getTable('ArchiveFolder_Folder')->getTableAlias();
     $select->joinInner(array($aliasFolder => $db->ArchiveFolder_Folder), "`{$aliasFolder}`.`id` = `{$alias}`.`folder_id`", array());
     $select->group($alias . '.id');
     return $select;
 }
 /**
  * Get the basic select query for exhibit pages.
  *
  * @return Omeka_Db_Select
  */
 public function getSelect()
 {
     $select = parent::getSelect();
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $db = $this->getDb();
     $select->join(array('exhibits' => $db->Exhibit), 'exhibits.id = exhibit_pages.exhibit_id', array());
     $permissions = new Omeka_Db_Select_PublicPermissions('ExhibitBuilder_Exhibits');
     $permissions->apply($select, 'exhibits');
     return $select;
 }
 public function getSelect()
 {
     $select = parent::getSelect();
     $request = Zend_Controller_Front::getInstance()->getRequest();
     //only show approved comments to api without a proper key
     if ($request && $request->getControllerName() == 'api') {
         if (!is_allowed('Commenting_Comment', 'update-approved')) {
             $select->where('approved = ?', 1);
         }
     }
     return $select;
 }
 /**
  * Left join the expansion tables onto the query.
  *
  * @return Omeka_Db_Select $select The modified select.
  */
 public function getSelect()
 {
     $select = parent::getSelect();
     // Gather expansion tables.
     $expansions = $this->getExpansionTables();
     if (!$expansions) {
         return $select;
     }
     // Left join the expansions.
     foreach ($expansions as $expansion) {
         // Get name, alias, and columns.
         $name = $expansion->getTableName();
         $alias = $expansion->getTableAlias();
         $cols = $expansion->getColumns();
         $select->joinLeft(array($alias => $name), "{$this->getTableAlias()}.id = {$alias}.parent_id", array_diff($cols, array('id')));
     }
     return $select;
 }
 /**
  * For required profile types, this digs up the types that are incomplete for the current user
  */
 public function getIncompleteProfileTypes()
 {
     $user = current_user();
     if (!$user) {
         return false;
     }
     $db = $this->getDb();
     //need to start with parent's select, since this getSelect filters by public permissions
     $select = parent::getSelect();
     $select->where('required = 1');
     $requiredTypes = $this->fetchObjects($select);
     $incompleteTypes = array();
     $profilesTable = $db->getTable('UserProfilesProfile');
     foreach ($requiredTypes as $type) {
         $count = $profilesTable->count(array('type_id' => $type->id));
         if ($count == 0) {
             $incompleteTypes[] = $type;
         }
     }
     return $incompleteTypes;
 }
 /**
  * Sort blocks by the order column by default.
  *
  * @return Omeka_Db_Select
  */
 public function getSelect()
 {
     $select = parent::getSelect();
     $select->order('exhibit_page_blocks.order');
     return $select;
 }
 /**
  * Get the default select object.
  *
  * Automatically join with Vocabulary table to get vocab data for properties
  * and put custom properties first.
  *
  * @return Omeka_Db_Select
  */
 public function getSelect()
 {
     return parent::getSelect()->join(array('item_relations_vocabularies' => $this->getDb()->ItemRelationsVocabulary), 'item_relations_properties.vocabulary_id = item_relations_vocabularies.id', array('vocabulary_name' => 'name', 'vocabulary_description' => 'description', 'vocabulary_namespace_prefix' => 'namespace_prefix', 'vocabulary_namespace_uri' => 'namespace_uri'))->order('custom DESC')->order('name ASC')->order('label ASC');
 }
 /**
  * Get the default select object.
  *
  * Automatically join with both Property and Vocabulary to get all the
  * data necessary to describe a whole relation.
  *
  * @return Omeka_Db_Select
  */
 public function getSelect()
 {
     $db = $this->getDb();
     return parent::getSelect()->join(array('item_relations_properties' => $db->ItemRelationsProperty), 'item_relations_relations.property_id = item_relations_properties.id', array('property_vocabulary_id' => 'vocabulary_id', 'property_local_part' => 'local_part', 'property_label' => 'label', 'property_description' => 'description'))->join(array('item_relations_vocabularies' => $db->ItemRelationsVocabulary), 'item_relations_properties.vocabulary_id = item_relations_vocabularies.id', array('vocabulary_namespace_prefix' => 'namespace_prefix'));
 }
 /**
  * Get the default select object.
  * 
  * Automatically sorts the custom vocabulary to the top.
  * 
  * @return Omeka_Db_Select
  */
 public function getSelect()
 {
     return parent::getSelect()->order('custom DESC')->order('name ASC');
 }
 public function getSelect()
 {
     $select = parent::getSelect();
     $permissions = new Omeka_Db_Select_PublicPermissions('SimplePages_Page');
     $permissions->apply($select, 'simple_pages_pages', 'created_by_user_id', 'is_published');
     return $select;
 }
 public function getSelect()
 {
     $select = parent::getSelect();
     $select->order('order ASC');
     return $select;
 }
 /**
  * Order by the order column by default.
  *
  * @return Omeka_Db_Select
  */
 public function getSelect()
 {
     $select = parent::getSelect();
     $select->order('exhibit_block_attachments.order');
     return $select;
 }