public function googleMap($divId = 'map', $options = array(), $attrs = array(), $center = array())
 {
     if (!$center) {
         $center = array('latitude' => (double) get_option('geolocation_default_latitude'), 'longitude' => (double) get_option('geolocation_default_longitude'), 'zoomLevel' => (double) get_option('geolocation_default_zoom_level'));
     }
     if (!array_key_exists('params', $options)) {
         $options['params'] = array();
     }
     if (!array_key_exists('uri', $options)) {
         // This should not be a link to the public side b/c then all the URLs that
         // are generated inside the KML will also link to the public side.
         $options['uri'] = url('geolocation/map.kml');
     }
     if (!array_key_exists('mapType', $options)) {
         $options['mapType'] = get_option('geolocation_map_type');
     }
     if (!array_key_exists('fitMarkers', $options)) {
         $options['fitMarkers'] = (bool) get_option('geolocation_auto_fit_browse');
     }
     $class = 'map geolocation-map';
     if (isset($attrs['class'])) {
         $class .= ' ' . $attrs['class'];
     }
     $options = js_escape($options);
     $center = js_escape($center);
     $varDivId = Inflector::variablize($divId);
     $divAttrs = array_merge($attrs, array('id' => $divId, 'class' => $class));
     $html = '<div ' . tag_attributes($divAttrs) . '></div>';
     $js = "var {$varDivId}" . "OmekaMapBrowse = new OmekaMapBrowse(" . js_escape($divId) . ", {$center}, {$options}); ";
     $html .= "<script type='text/javascript'>{$js}</script>";
     return $html;
 }
 public static function embedPdfJs($file, $options)
 {
     $height = (int) $options['height'];
     $pdfJsViewer = web_path_to('pdf-embed-js/web/viewer.html');
     $hash = ($lang = get_html_lang()) == 'en-US' ? '' : '#locale=' . rawurlencode($lang);
     $attrs['src'] = $pdfJsViewer . '?file=' . rawurlencode($file->getWebPath('original')) . $hash;
     $attrs['style'] = "width: 100%; height: {$height}px";
     $attrString = tag_attributes($attrs);
     return "<iframe {$attrString}></iframe>";
 }
 /**
  * Get HTML for a link to the item search form.
  *
  * @package Omeka\Function\View\Navigation
  * @param string $text Text of the link. Default is 'Search Items'.
  * @param array $props HTML attributes for the link.
  * @param string $uri Action for the form.  Defaults to 'items/browse'.
  * @return string
  */
 public static function link_to_advanced_search($text = null, $props = array(), $uri = null)
 {
     if (!$text) {
         $text = __('Search Items');
     }
     if (!$uri) {
         $uri = apply_filters('items_search_default_url', url('solr-search/results/search-form'));
     }
     $props['href'] = $uri . (!empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '');
     return '<a ' . tag_attributes($props) . '>' . $text . '</a>';
 }
Example #4
0
function custom_item_image_gallery($attrs = array(), $imageType = 'square_thumbnail', $filesShow = false, $item = null)
{
    if (!$item) {
        $item = get_current_record('item');
    }
    $files = $item->Files;
    if (!$files) {
        return '';
    }
    $defaultAttrs = array('wrapper' => array('id' => 'item-images'), 'linkWrapper' => array(), 'link' => array(), 'image' => array());
    $attrs = array_merge($defaultAttrs, $attrs);
    $html = '';
    if ($attrs['wrapper'] !== null) {
        $html .= '<div ' . tag_attributes($attrs['wrapper']) . '>' . "\n";
    }
    foreach ($files as $file) {
        if ($attrs['linkWrapper'] !== null) {
            $html .= '<div ' . tag_attributes($attrs['linkWrapper']) . '>' . "\n";
        }
        $fileTitle = metadata($file, 'display title');
        $webPath = $file->getWebPath('original');
        // Taille de l'image en fonction du type de fichier
        if (preg_match("/\\.jpg\$/", $webPath)) {
            $imageType = 'fullsize';
            $attrs['image'] = array('style' => 'max-width: 100%');
        } else {
            $imageType = 'thumbnail';
            $attrs['image'] = array('style' => 'width:5em;vertical-align:middle;');
        }
        $image = file_image($imageType, $attrs['image'], $file);
        $html .= '<h2 class="title" style="text-align:center;">' . $fileTitle . '</h2>' . "\n";
        if ($filesShow) {
            $html .= link_to($file, 'show', $image, $attrs['link']);
        } else {
            if (preg_match("/\\.pdf\$/", $webPath)) {
                $html .= '<p style="padding:0 1em 1em 1em;color: #333333;">T&eacute;l&eacute;charger le fichier PDF : ';
            }
            $linkAttrs = $attrs['link'] + array('href' => $webPath);
            $html .= '<a ' . tag_attributes($linkAttrs) . '>' . $image . '</a>' . "\n";
            if (preg_match("/\\.pdf\$/", $webPath)) {
                $html .= '</p>';
            }
        }
        if ($attrs['linkWrapper'] !== null) {
            $html .= '</div>' . "\n";
        }
    }
    if ($attrs['wrapper'] !== null) {
        $html .= '</div>' . "\n";
    }
    return $html;
}
/**
 * Return a link to an item within an exhibit.
 *
 * @param string $text Link text (by default, the item title is used)
 * @param array $props Link attributes
 * @param Item $item If null, will use the current item.
 * @return string
 */
function exhibit_builder_link_to_exhibit_item($text = null, $props = array(), $item = null)
{
    if (!$item) {
        $item = get_current_record('item');
    }
    if (!isset($props['class'])) {
        $props['class'] = 'exhibit-item-link';
    }
    $uri = exhibit_builder_exhibit_item_uri($item);
    $text = !empty($text) ? $text : strip_formatting(metadata($item, array('Dublin Core', 'Title')));
    $html = '<a href="' . html_escape($uri) . '" ' . tag_attributes($props) . '>' . $text . '</a>';
    $html = apply_filters('exhibit_builder_link_to_exhibit_item', $html, array('text' => $text, 'props' => $props, 'item' => $item));
    return $html;
}
Example #6
0
/**
 * Returns a link to a Neatline exhibit.
 *
 * @param NeatlineExhibit|null $exhibit The exhibit record.
 * @param string $action The action for the link.
 * @param string $text The link text.
 * @param array $props Array of properties for the element.
 * @return string The HTML link.
 */
function nl_getExhibitLink($exhibit, $action, $text, $props = array(), $public = true)
{
    // Get exhibit and link text.
    $exhibit = $exhibit ? $exhibit : nl_getExhibit();
    $text = $text ? $text : nl_getExhibitField('title');
    // Get the exhibit identifier (`id` or `slug`).
    if (in_array($action, array('show', 'fullscreen'))) {
        $identifier = $exhibit->slug;
    } else {
        $identifier = $exhibit->id;
    }
    // Construct the exhibit route.
    $route = 'neatline/' . $action . '/' . $identifier;
    $props['href'] = $public ? public_url($route) : url($route);
    // Return the anchor tag.
    return '<a ' . tag_attributes($props) . '>' . $text . '</a>';
}
Example #7
0
/**
 * Get a link to the admin home page.
 *
 * @package Omeka\Function\View\Navigation
 * @uses admin_url()
 * @see link_to_home_page()
 * @param null|string $text
 * @param array $props
 * @return string
 */
function link_to_admin_home_page($text = null, $props = array())
{
    if (!$text) {
        $text = option('site_title');
    }
    return '<a href="' . html_escape(admin_url('')) . '" ' . tag_attributes($props) . '>' . $text . "</a>\n";
}
<?php

if (!empty($formActionUri)) {
    $formAttributes['action'] = $formActionUri;
} else {
    $formAttributes['action'] = url(array('controller' => 'items', 'action' => 'browse'));
}
$formAttributes['method'] = 'GET';
?>

<div class="container">
  <form <?php 
echo tag_attributes($formAttributes);
?>
 class="col-md-12">
    <div class="section-header col-md-10 col-md-offset-1">
      <small>-SEARCH ITEMS-</small>
      <!-- search-keywords -->
      <div id="search-keywords" class="field col-md-12">
        <?php 
echo $this->formLabel('keyword-search', __(''));
?>
  
        <div class="inputs">
          
          <?php 
echo $this->formText('search', @$_REQUEST['search'], array('id' => 'keyword-search', 'size' => '40', 'placeholder' => 'Search for Keywords'));
?>
          <button type="submit" class="submit glyphicon glyphicon-search" name="submit_search" id="submit_search_advanced">
          
        </div><!-- end of inputs -->
 /**
  * Return a valid img tag for an image.
  *
  * @param Omeka_Record_AbstractRecord $record
  * @param array $props Image tag attributes
  * @param string $format Derivative image type (thumbnail, etc.)
  * @return string
  */
 public function image_tag($record, $props, $format)
 {
     if (!($record && $record instanceof Omeka_Record_AbstractRecord)) {
         return false;
     }
     // Use the default representative file.
     $file = $record->getFile();
     if (!$file) {
         return false;
     }
     if ($file->hasThumbnail()) {
         $uri = $file->getWebPath($format);
     } else {
         $uri = img($this->_getFallbackImage($file));
     }
     $props['src'] = $uri;
     /** 
      * Determine alt attribute for images
      * Should use the following in this order:
      * 1. passed 'alt' prop
      * 2. first Dublin Core Title for $file
      * 3. original filename for $file
      */
     $alt = '';
     if (isset($props['alt'])) {
         $alt = $props['alt'];
     } else {
         if ($fileTitle = metadata($file, 'display title', array('no_escape' => true))) {
             $alt = $fileTitle;
         }
     }
     $props['alt'] = $alt;
     $title = '';
     if (isset($props['title'])) {
         $title = $props['title'];
     } else {
         $title = $alt;
     }
     $props['title'] = $title;
     // Build the img tag
     return '<img ' . tag_attributes($props) . '>';
 }
Example #10
0
 /** 
  * Test attributes with a mix of values.
  */
 public function testAttributesWithMixedValues()
 {
     $attributesWithMixedValues = array('id' => null, 'class' => 'element class', 'title' => '');
     $html = 'class="element class" title=""';
     $this->assertEquals($html, tag_attributes($attributesWithMixedValues));
 }
function mh_simple_search($formProperties = array(), $uri = null)
{
    // Always post the 'items/browse' page by default (though can be overridden).
    if (!$uri) {
        $uri = url('items/browse');
    }
    $searchQuery = array_key_exists('search', $_GET) ? $_GET['search'] : '';
    $formProperties['action'] = $uri;
    $formProperties['method'] = 'get';
    $html = '<form ' . tag_attributes($formProperties) . '>' . "\n";
    $html .= '<fieldset>' . "\n\n";
    $html .= get_view()->formText('search', $searchQuery, array('name' => 'search', 'class' => 'textinput', 'placeholder' => 'Search ' . mh_item_label('plural')));
    $html .= get_view()->formSubmit('submit_search', __("Search"));
    $html .= '</fieldset>' . "\n\n";
    // add hidden fields for the get parameters passed in uri
    $parsedUri = parse_url($uri);
    if (array_key_exists('query', $parsedUri)) {
        parse_str($parsedUri['query'], $getParams);
        foreach ($getParams as $getParamName => $getParamValue) {
            $html .= get_view()->formHidden($getParamName, $getParamValue);
        }
    }
    $html .= '</form>';
    return $html;
}
Example #12
0
 /**
  * Return a valid img tag for an image.
  *
  * @param File|Item $record
  * @param array $props
  * @param string $format
  * @return string
  */
 public function image_tag($record, $props, $format)
 {
     if (!$record) {
         return false;
     }
     if ($record instanceof File) {
         $filename = $record->getDerivativeFilename();
         $file = $record;
     } else {
         if ($record instanceof Item) {
             $item = $record;
             $file = get_db()->getTable('File')->getRandomFileWithImage($item->id);
             if (!$file) {
                 return false;
             }
             $filename = $file->getDerivativeFilename();
         } else {
             // throw some exception?
             return '';
         }
     }
     if ($file->hasThumbnail()) {
         $uri = html_escape($file->getWebPath($format));
     } else {
         $uri = img($this->_getFallbackImage($file));
     }
     /** 
      * Determine alt attribute for images
      * Should use the following in this order:
      * 1. alt option 
      * 2. file description
      * 3. file title 
      * 4. item title
      */
     $alt = '';
     if (isset($props['alt'])) {
         $alt = $props['alt'];
     } else {
         if ($fileTitle = metadata($file, 'display title')) {
             $alt = $fileTitle;
         }
     }
     $props['alt'] = $alt;
     $title = '';
     if (isset($props['title'])) {
         $title = $props['title'];
     } else {
         $title = $alt;
     }
     $props['title'] = $title;
     // Build the img tag
     $html = '<img src="' . $uri . '" ' . tag_attributes($props) . '/>' . "\n";
     return $html;
 }