public function applySearchFilters($select, $params) { $boolean = new Omeka_Filter_Boolean(); foreach ($params as $key => $value) { switch ($key) { case 'user': case 'owner': case 'user_id': case 'owner_id': $this->filterByUser($select, $value, 'owner_id'); break; case 'public': $this->filterByPublic($select, $boolean->filter($value)); break; case 'featured': $this->filterByFeatured($select, $boolean->filter($value)); break; case 'added_since': $this->filterBySince($select, $value, 'added'); break; case 'modified_since': $this->filterBySince($select, $value, 'modified'); break; case 'range': $this->filterByRange($select, $value); break; } } }
function social_bookmarking_toolbar($url, $title, $description = '') { $html = ''; $html .= '<!-- AddThis Button BEGIN -->'; $html .= '<div class="addthis_toolbox addthis_default_style addthis_32x32_style"'; $html .= ' addthis:url="' . html_escape($url) . '" addthis:title="' . html_escape($title) . '" addthis:description="' . html_escape($description) . '">'; $html .= '<h2>Social</h2>'; $services = social_bookmarking_get_services(); if ($services) { $serviceSettings = social_bookmarking_get_service_settings(); $booleanFilter = new Omeka_Filter_Boolean(); foreach ($serviceSettings as $serviceCode => $value) { if ($booleanFilter->filter($value) && array_key_exists($serviceCode, $services)) { $html .= '<a class="addthis_button_' . html_escape($serviceCode) . '"></a>'; } } } else { $html .= __('Sociale functies tijdelijk offline.'); } $html .= '<a class="addthis_button_compact"></a>'; //$html .= '<a class="addthis_counter addthis_bubble_style"></a>'; $html .= '</div>'; $html .= '<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js"></script>'; $html .= '<!-- AddThis Button END -->'; return $html; }
/** * Map a row to whether the row corresponding to an item is public or not * * @param array $row The row to map * @param array $result * @return bool Whether the row corresponding to an item is public or not */ public function map($row, $result) { $filter = new Omeka_Filter_Boolean(); $flag = strtolower(trim($row[$this->_columnName])); if ($flag == 'no') { return 0; } else { if ($flag == 'yes') { return 1; } else { return $filter->filter($flag); } } }
public function applySearchFilters($select, $params) { $alias = $this->getTableAlias(); if (isset($params['name'])) { $select->where("`{$alias}`.`name` = ?", $params['name']); } if (isset($params['active'])) { $boolean = new Omeka_Filter_Boolean(); $select->where("`{$alias}`.`active` = ?", $boolean->filter($params['active'])); } if (isset($params['version'])) { $boolean = new Omeka_Filter_Boolean(); $select->where("`{$alias}`.`version` = ?", $params['version']); } }
/** * Map a row to whether the row corresponding to a record is public or not. * * @param array $row The row to map * @param array $result * @return bool Whether the row corresponding to a record is public or not */ public function map($row, $result) { $filter = new Omeka_Filter_Boolean(); $flag = strtolower(trim($row[$this->_columnName])); // Don't use empty, because the value can be "0". if ($flag === '') { return $this->_isPublic; } if ($flag == 'no') { return 0; } if ($flag == 'yes') { return 1; } return $filter->filter($flag); }
public function applySearchFilters($select, $params) { // Show only users with a specific role. if (array_key_exists('role', $params) and !empty($params['role'])) { $select->where('users.role = ?', $params['role']); } // Show only users who are active if (array_key_exists('active', $params) and $params['active'] !== '') { $boolean = new Omeka_Filter_Boolean(); $select->where('users.active = ?', $boolean->filter($params['active'])); } if (isset($params['name'])) { $select->where('users.name LIKE ?', "%" . $params['name'] . "%"); } if (isset($params['username'])) { $select->where('users.username LIKE ?', "%" . $params['username'] . "%"); } if (isset($params['email'])) { $select->where('users.email = ?', $params['email']); } }
public function applySearchFilters($select, $params) { $boolean = new Omeka_Filter_Boolean(); foreach ($params as $paramName => $paramValue) { if ($paramValue === null || is_string($paramValue) && trim($paramValue) == '') { continue; } switch ($paramName) { case 'item': case 'item_id': $select->where('files.item_id = ?', $paramValue); break; case 'order': if ($paramValue == 'null') { $select->where('files.order IS NULL'); } else { $select->where('files.order = ?', $paramValue); } break; case 'original_filename': $select->where('files.original_filename = ?', $paramValue); break; case 'size_greater_then': $select->where('files.size > ?', $paramValue); break; case 'has_derivative_image': $this->filterByHasDerivativeImage($select, $boolean->filter($paramValue)); break; case 'mime_type': $select->where('files.mime_type = ?', $paramValue); break; case 'added_since': $this->filterBySince($select, $paramValue, 'added'); break; case 'modified_since': $this->filterBySince($select, $paramValue, 'modified'); break; } } }
/** * Sets whether the imported items are featured * * @param mixed $flag A boolean representation */ public function setItemsAreFeatured($flag) { $booleanFilter = new Omeka_Filter_Boolean(); $this->is_featured = $booleanFilter->filter($flag); }
/** * Sets whether the record is featured or not. * * @param boolean $flag Whether the record is featured or not */ public function setFeatured($flag) { $filter = new Omeka_Filter_Boolean(); $this->_record->featured = $filter->filter($flag); }
/** * Set the options from the config form input. */ public function hookConfig($args) { $post = $args['post']; unset($post['install_plugin']); set_option(SocialBookmarkingPlugin::ADD_TO_OMEKA_ITEMS_OPTION, $post[SocialBookmarkingPlugin::ADD_TO_OMEKA_ITEMS_OPTION]); unset($post[SocialBookmarkingPlugin::ADD_TO_OMEKA_ITEMS_OPTION]); set_option(SocialBookmarkingPlugin::ADD_TO_OMEKA_COLLECTIONS_OPTION, $post[SocialBookmarkingPlugin::ADD_TO_OMEKA_COLLECTIONS_OPTION]); unset($post[SocialBookmarkingPlugin::ADD_TO_OMEKA_COLLECTIONS_OPTION]); $serviceSettings = social_bookmarking_get_service_settings(); $booleanFilter = new Omeka_Filter_Boolean(); foreach ($post as $key => $value) { if (array_key_exists($key, $serviceSettings)) { $serviceSettings[$key] = $booleanFilter->filter($value); } } social_bookmarking_set_service_settings($serviceSettings); }
/** * @param Omeka_Db_Select * @param array * @return void */ public function applySearchFilters($select, $params) { $boolean = new Omeka_Filter_Boolean(); foreach ($params as $key => $value) { if ($value === null || is_string($value) && trim($value) == '') { continue; } switch ($key) { case 'user': case 'owner': case 'user_id': case 'owner_id': $this->filterByUser($select, $value, 'owner_id'); break; case 'public': $this->filterByPublic($select, $boolean->filter($value)); break; case 'featured': $this->filterByFeatured($select, $boolean->filter($value)); break; case 'collection': case 'collection_id': $this->filterByCollection($select, $value); break; case 'type': case 'item_type': case 'item_type_id': $this->filterByItemType($select, $value); break; case 'tag': case 'tags': $this->filterByTags($select, $value); break; case 'excludeTags': $this->filterByExcludedTags($select, $value); break; case 'hasImage': $this->filterByHasDerivativeImage($select, $boolean->filter($value)); break; case 'range': $this->filterByRange($select, $value); break; case 'added_since': $this->filterBySince($select, $value, 'added'); break; case 'modified_since': $this->filterBySince($select, $value, 'modified'); break; } } $this->filterBySearch($select, $params); // If we returning the data itself, we need to group by the item ID $select->group('items.id'); }
/** * Sets whether the import is raw text or html. * * @param mixed $flag A boolean representation */ public function setIsHtml($flag) { $booleanFilter = new Omeka_Filter_Boolean(); $this->_isHtml = $booleanFilter->filter($flag); }
public function geolocationShortcode($args) { static $index = 0; $index++; $booleanFilter = new Omeka_Filter_Boolean(); if (isset($args['lat'])) { $latitude = $args['lat']; } else { $latitude = get_option('geolocation_default_latitude'); } if (isset($args['lon'])) { $longitude = $args['lon']; } else { $longitude = get_option('geolocation_default_longitude'); } if (isset($args['zoom'])) { $zoomLevel = $args['zoom']; } else { $zoomLevel = get_option('geolocation_default_zoom_level'); } $center = array('latitude' => (double) $latitude, 'longitude' => (double) $longitude, 'zoomLevel' => (double) $zoomLevel); $options = array(); if (isset($args['fit'])) { $options['fitMarkers'] = $booleanFilter->filter($args['fit']); } else { $options['fitMarkers'] = '1'; } if (isset($args['type'])) { $options['mapType'] = $args['type']; } if (isset($args['collection'])) { $options['params']['collection'] = $args['collection']; } if (isset($args['tags'])) { $options['params']['tags'] = $args['tags']; } $pattern = '#^[0-9]*(px|%)$#'; if (isset($args['height']) && preg_match($pattern, $args['height'])) { $height = $args['height']; } else { $height = '436px'; } if (isset($args['width']) && preg_match($pattern, $args['width'])) { $width = $args['width']; } else { $width = '100%'; } $attrs = array('style' => "height:{$height};width:{$width}"); return get_view()->googleMap("geolocation-shortcode-{$index}", $options, $attrs, $center); }
/** * @param Omeka_Db_Select * @param array * @return void */ public function applySearchFilters($select, $params, $retrieveInfos = false) { // for Url /items/browse $boolean = new Omeka_Filter_Boolean(); foreach ($params as $key => $value) { if ($value === null || is_string($value) && trim($value) == '') { continue; } switch ($key) { case 'user': case 'owner': case 'user_id': case 'owner_id': $this->filterByUser($select, $value, 'owner_id'); break; case 'public': $this->filterByPublic($select, $boolean->filter($value)); break; case 'featured': $this->filterByFeatured($select, $boolean->filter($value)); break; case 'collection': case 'collection_id': $this->filterByCollection($select, $value); break; case 'type': case 'item_type': case 'item_type_id': $this->filterByItemType($select, $value); break; case 'tag': case 'tags': $this->filterByTags($select, $value); break; case 'excludeTags': $this->filterByExcludedTags($select, $value); break; case 'hasImage': $this->filterByHasDerivativeImage($select, $boolean->filter($value)); break; case 'image': $this->filterByImage($select, $boolean->filter($value)); break; case 'range': $this->filterByRange($select, $value); break; case 'added_since': $this->filterBySince($select, $value, 'added'); break; case 'modified_since': $this->filterBySince($select, $value, 'modified'); break; case 'volets': $db = $this->getDb(); $sql = "SELECT id FROM omeka_hierarchies WHERE atom_top_parent_id = {$value}"; $res = $db->fetchAll($sql); foreach ($res as $r) { $range .= $r['id'] . ','; } $this->filterByRange($select, $range); // $this->filterByVolet($select, $value); break; case 'partie': if (isset($_SESSION['RANGE'])) { $this->filterByRange($select, $_SESSION['RANGE']); } break; case 'coverages': $tab = explode(',', $value); $coverages = array(); foreach ($tab as $t) { $coverages[] = array('element_id' => '38', 'type' => 'is exactly', 'terms' => $t); } $this->_advancedSearch($select, $coverages); break; case 'publishers': $tab = explode(',', $value); $publishers = array(); foreach ($tab as $t) { $publishers[] = array('element_id' => '45', 'type' => 'is exactly', 'terms' => $t); } $this->_advancedSearch($select, $publishers); break; case 'autocomplete': $this->_autocompleteSearch($select, $params['autocomplete']); break; } } //echo "oo"; $this->filterBySearch($select, $params); if ($retrieveInfos) { $select->joinLeft(array('hierarchies' => 'omeka_hierarchies'), 'items.id = hierarchies.id', array('hierarchies.atom_top_parent_id', 'hierarchies.atom_id')); } // If we returning the data itself, we need to group by the item ID $select->group('items.id'); }