This is an old revision of the document!


Collapsed breadcrumb


Main breadcrumb (not Search breadcrumb) format defined in sites/all/modules/islandora-github/ObjectHelper.inc

Edit file:

...
 
  /**
   * Builds an array of drupal links for use in breadcrumbs. 
   *
   * @global type $base_url
   * @param type $pid
   * @param type $breadcrumbs
   * @param type $level 
   */
  function getBreadcrumbs($pid, &$breadcrumbs, $level=10) {
    module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
    // Before executing the query, we hve a base case of accessing the top-level collection
    global $base_url;
    if ($pid == variable_get('fedora_repository_pid', 'islandora:root')) {
      $breadcrumbs[] = l(t('Digital repository'), 'fedora/repository');
      $breadcrumbs[] = l(t('Home'), $base_url);
    }
    else {
      $query_string = 'select $parentObject $title $content from <#ri>
                               where (<info:fedora/' . $pid . '> <dc:title> $title
                               and $parentObject <fedora-model:hasModel> $content
                               and (<info:fedora/' . $pid . '> <fedora-rels-ext:isMemberOfCollection> $parentObject
                               or <info:fedora/' . $pid . '> <fedora-rels-ext:isMemberOf> $parentObject
                               or <info:fedora/' . $pid . '> <fedora-rels-ext:isPartOf> $parentObject)
                               and $parentObject <fedora-model:state> <info:fedora/fedora-system:def/model#Active>)
                               minus $content <mulgara:is> <info:fedora/fedora-system:FedoraObject-3.0>

Tip

                               order by $title';
      $query_string = htmlentities(urlencode($query_string));
 
      $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch');
      $url .= "?type=tuples&flush=TRUE&format=CSV&limit=1&offset=0&lang=itql&stream=on&query=" . $query_string;
 
      $result = preg_split('/[\r\n]+/', do_curl($url));
      array_shift($result); // throw away first line
      $matches = str_getcsv(join("\n", $result));
      if ($matches !== FALSE) {
        $parent = preg_replace('/^info:fedora\//', '', $matches[0]);

Tip

/*        $breadcrumbs[] = l($matches[1], 'fedora/repository/' . $pid); */
 
        if ((strlen($parent) >0) && ($level <10)) {
/*        if (substr($matches[1],-11,6) == '- page') { */
          if (substr($matches[1],-11,6) != '- page') {
/*          $breadcrumbs[] = l(substr($matches[1],-9), 'fedora/repository/' . $pid); */
/*        } */
/*        else if (strlen($matches[1]) > 20){ */
            if (strlen($matches[1]) > 25){
              $breadcrumbs[] = l(htmlentities(substr($matches[1],0,25)) . '...', 'fedora/repository/' . $pid);
            }
            else {
              $breadcrumbs[] = l($matches[1], 'fedora/repository/' . $pid);
            }
          }
        }
        if ($parent == variable_get('fedora_repository_pid', 'islandora:root')) {
          $breadcrumbs[] = l(t('Digital repository'), 'fedora/repository');
          $breadcrumbs[] = l(t('Home'), $base_url);
        }
        elseif ($level > 0) {
          $this->getBreadcrumbs($parent, $breadcrumbs, $level - 1);
        }
      }
    }
  }
...
 
 
frontend/breadcrumb.1369302331.txt.gz ยท Last modified: 2013/05/23 11:45 by giancarlo

Developers: CNR IRCrES IT Office and Library
Giancarlo Birello (giancarlo.birello _@_ ircres.cnr.it) and Anna Perin (anna.perin _@_ ircres.cnr.it)
DigiBess is licensed under: Creative Commons License
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki
Drupal Garland Theme for Dokuwiki