/**
  * Tests whether exhibit_builder_exhibit_uri returns correct URI.
  *
  * @uses exhibit_builder_exhibit_uri
  */
 public function testGetCorrectExhibitUri()
 {
     $this->helper->createNewExhibit(1, 0, 'Exhibit Title', 'Exhibit description.', 'Jim Safley');
     $this->dispatch('exhibits/show/exhibit-title');
     $exhibitUri = exhibit_builder_exhibit_uri();
     $this->assertThat($exhibitUri, $this->stringContains('exhibits/show/exhibit-title'));
 }
Ejemplo n.º 2
0
function emiglio_exhibit_builder_page_nav($exhibitPage = null, $currentPageId)
{
    if (!$exhibitPage) {
        $exhibitPage = get_current_record('exhibit_page');
    }
    $parents = array();
    $currentPage = get_record_by_id('Exhibit Page', $currentPageId);
    while ($currentPage->parent_id) {
        $currentPage = $currentPage->getParent();
        array_unshift($parents, $currentPage->id);
    }
    $class = '';
    $class .= $exhibitPage->id == $currentPageId ? 'current' : '';
    $parent = array_search($exhibitPage->id, $parents) !== false ? ' parent' : '';
    $html = '<li class="' . $class . $parent . '">' . '<a href="' . exhibit_builder_exhibit_uri(get_current_record('exhibit'), $exhibitPage) . '">' . metadata($exhibitPage, 'title') . '</a>';
    $children = $exhibitPage->getChildPages();
    if ($children) {
        $html .= '<ul>';
        foreach ($children as $child) {
            $html .= emiglio_exhibit_builder_page_nav($child, $currentPageId);
            release_object($child);
        }
        $html .= '</ul>';
    }
    $html .= '</li>';
    return $html;
}
/**
 * Return a link to an exhibit.
 *
 * @param Exhibit $exhibit If null, it uses the current exhibit
 * @param string $text The text of the link
 * @param array $props Link attributes
 * @param ExhibitPage $exhibitPage A specific page to link to
 * @return string
 */
function exhibit_builder_link_to_exhibit($exhibit = null, $text = null, $props = array(), $exhibitPage = null)
{
    if (!$exhibit) {
        $exhibit = get_current_record('exhibit');
    }
    $uri = exhibit_builder_exhibit_uri($exhibit, $exhibitPage);
    $text = !empty($text) ? $text : html_escape($exhibit->title);
    return '<a href="' . html_escape($uri) . '" ' . tag_attributes($props) . '>' . $text . '</a>';
}
 /**
  * Recursively create the HTML for a "branch" (a page and its descendants)
  * of the tree.
  *
  * @param ExhibitPage $page
  * @param ExhibitPage|null $currentPage
  * @param array $ancestorIds
  * @return string
  */
 protected function _renderPageBranch($page, $currentPage, $ancestorIds)
 {
     if ($currentPage && $page->id === $currentPage->id) {
         $html = '<li class="active" role="presentation">';
     } else {
         if ($ancestorIds && isset($ancestorIds[$page->id])) {
             $html = '<li class="active parent" role="presentation">';
         } else {
             $html = '<li role="presentation">';
         }
     }
     $html .= '<a href="' . exhibit_builder_exhibit_uri($this->_exhibit, $page) . '">' . metadata($page, 'title') . '</a>';
     if (isset($this->_pages[$page->id])) {
         $html .= '<ul class="dropdown">';
         foreach ($this->_pages[$page->id] as $childPage) {
             $html .= $this->_renderPageBranch($childPage, $currentPage, $ancestorIds);
         }
         $html .= '</li>';
     }
     return $html;
 }
Ejemplo n.º 5
0
/**
 * Get a list item for a page, containing a sublist of all its children.
 */
function exhibit_builder_page_summary($exhibitPage = null)
{
    if (!$exhibitPage) {
        $exhibitPage = get_current_record('exhibit_page');
    }
    $html = '<li>' . '<a href="' . exhibit_builder_exhibit_uri(get_current_record('exhibit'), $exhibitPage) . '">' . metadata($exhibitPage, 'title') . '</a>';
    $children = $exhibitPage->getChildPages();
    if ($children) {
        $html .= '<ul>';
        foreach ($children as $child) {
            $html .= exhibit_builder_page_summary($child);
            release_object($child);
        }
        $html .= '</ul>';
    }
    $html .= '</li>';
    return $html;
}
Ejemplo n.º 6
0
<?php

$pageNav = array();
if ($exhibitPages = $exhibit->getTopPages()) {
    foreach ($exhibitPages as $exhibitPage) {
        $pageNav[] = array('label' => metadata($exhibitPage, 'title', array('no_escape' => true)), 'uri' => exhibit_builder_exhibit_uri($exhibit, $exhibitPage));
    }
}
return nav($pageNav)->setUlClass('nav navbar-nav');
 /**
  * Get a URL to this exhibit with the specified action.
  *
  * @param string $action Action to link to
  * @return string
  */
 public function getRecordUrl($action = 'show')
 {
     if ('show' == $action) {
         return exhibit_builder_exhibit_uri($this);
     }
     $urlHelper = new Omeka_View_Helper_Url();
     $params = array('action' => $action, 'id' => $this->id);
     return $urlHelper->url($params, 'exhibitStandard');
 }
Ejemplo n.º 8
0
 /**
  * Get the URL to this page, with the specified action.
  *
  * @param string $action The action to link to
  * @return string
  */
 public function getRecordUrl($action = 'show')
 {
     if ('show' == $action) {
         return exhibit_builder_exhibit_uri($this->getExhibit(), $this);
     }
     return array('module' => 'exhibit-builder', 'controller' => 'exhibits', 'action' => $action, 'id' => $this->id);
 }
Ejemplo n.º 9
0
            	<?php 
        }
        ?>
				
				<h2><?php 
        echo link_to_exhibit();
        ?>
</h2>
		        <?php 
        if ($exhibitDescription = metadata('exhibit', 'description', array('no_escape' => true))) {
            ?>
					<div class="description"><?php 
            echo $exhibitDescription;
            ?>
 <p class="read-more"><a href="<?php 
            echo exhibit_builder_exhibit_uri();
            ?>
">Read More &raquo;</a></p></div>
		        <?php 
        }
        ?>
		        <?php 
        if ($exhibitTags = tag_string('exhibit', 'exhibits')) {
            ?>
		        	<p class="tags">TAGS: <?php 
            echo $exhibitTags;
            ?>
</p>
		        <?php 
        }
        ?>
Ejemplo n.º 10
0
		<?php 
    if (count($exhibitPage->getParent()) == 0) {
        ?>
			<a href="<?php 
        echo exhibit_builder_exhibit_uri($exhibit, $exhibitPage);
        ?>
" class="page"><?php 
        echo $exhibitPage->title;
        ?>
</a>
		<?php 
    }
    ?>
			
		<?php 
    foreach ($exhibitPage->getChildPages() as $child) {
        ?>
			<a class="page child" href="<?php 
        echo exhibit_builder_exhibit_uri($exhibit, $child);
        ?>
" class="page"><?php 
        echo $child->title;
        ?>
</a>
		<?php 
    }
    ?>
	<?php 
}
?>
</div>
Ejemplo n.º 11
0
function sckls_exhibit_builder_page_nav($exhibitPage = null)
{
    $html = '';
    if (!$exhibitPage) {
        if (!($exhibitPage = get_current_record('exhibit_page', false))) {
            return;
        }
    }
    $exhibit = $exhibitPage->getExhibit();
    $pagesTrail = $exhibitPage->getAncestors();
    $pagesTrail[] = $exhibitPage;
    $html .= '<li>';
    $html .= '<a class="exhibit-title" href="' . html_escape(exhibit_builder_exhibit_uri($exhibit)) . '">';
    $html .= html_escape($exhibit->title) . '</a></li>' . "\n";
    foreach ($pagesTrail as $page) {
        $linkText = $page->title;
        $pageExhibit = $page->getExhibit();
        $pageParent = $page->getParent();
        $pageSiblings = $pageParent ? exhibit_builder_child_pages($pageParent) : $pageExhibit->getTopPages();
        $html .= "<li>\n<ul class='nav nav-pills nav-stacked'>\n";
        foreach ($pageSiblings as $pageSibling) {
            $html .= '<li' . ($pageSibling->id == $page->id ? ' class="current"' : '') . '>';
            $html .= '<a class="exhibit-page-title" href="' . html_escape(exhibit_builder_exhibit_uri($exhibit, $pageSibling)) . '">';
            $html .= html_escape($pageSibling->title) . "</a></li>\n";
        }
        $html .= "</ul>\n</li>\n";
    }
    $html = apply_filters('exhibit_builder_page_nav', $html);
    return $html;
}
            echo ' featured';
        }
        ?>
">
            <?php 
        if ($exhibitImage = record_image($exhibit, 'square_thumbnail')) {
            ?>
                <?php 
            echo exhibit_builder_link_to_exhibit($exhibit, $exhibitImage, array('class' => 'image'));
            ?>
            <?php 
        }
        ?>
            <span>
            <a href="<?php 
        echo html_escape(exhibit_builder_exhibit_uri($exhibit));
        ?>
"><?php 
        echo metadata($exhibit, 'title');
        ?>
</a>
            <?php 
        if (!$exhibit->public) {
            ?>
                <?php 
            echo __('(Private)');
            ?>
            <?php 
        }
        ?>
            </span>
Ejemplo n.º 13
0
 /**
  * Show a single page of an exhibit.
  */
 public function showAction()
 {
     $exhibit = $this->_findByExhibitSlug();
     if (!$exhibit) {
         throw new Omeka_Controller_Exception_404();
     }
     $slugParams = array('page_slug_1', 'page_slug_2', 'page_slug_3');
     $pageTable = $this->_helper->db->getTable('ExhibitPage');
     $exhibitPage = null;
     $parentPage = null;
     foreach ($slugParams as $param) {
         $slug = $this->getParam($param);
         if (!empty($slug)) {
             $exhibitPage = $pageTable->findBySlug($slug, $exhibit, $parentPage);
             if ($exhibitPage) {
                 $parentPage = $exhibitPage;
             } else {
                 throw new Omeka_Controller_Exception_404();
             }
         }
     }
     if (!$exhibitPage) {
         throw new Omeka_Controller_Exception_404();
     }
     fire_plugin_hook('show_exhibit', array('exhibit' => $exhibit, 'exhibitPage' => $exhibitPage));
     $this->view->assign(array('exhibit' => $exhibit, 'exhibit_page' => $exhibitPage));
     $ariane['liste des expositions'] = getenv("INSTANCE_URL") . '/exhibits';
     $ariane[$exhibit->title] = exhibit_builder_exhibit_uri($exhibit);
     $ariane[$exhibitPage->title] = null;
     $this->view->ariane = $ariane;
 }