public function hookPublicAppendToCollectionsShow() { $db = get_db(); $collection = get_current_collection(); // first example uses the simple, straightforward method in CollectorTable $collectors = $db->getTable('Collector')->findForCollectionId($collection->id); if (count($collectors) != 0) { foreach ($collectors as $collector) { echo "<h4>" . $collector->name . "</h4>"; echo "<p>" . $collector->bio . "</p>"; } } }
/** *nested_colletions_show() modifies the public collection browse page. * If the collection is a parent to other collections it displays * the corresponding links to the childrens page. If the Collection * is a child of a another collection it displays the link to the parent * at the bottom of the page. * @param <type> $collection */ function nested_collections_show($collection = null) { if (!$collection) { $coll = get_current_collection(); $nst = get_db()->getTable('Nest'); $parent = $nst->getParent($coll->id); $chld = $nst->getCollectionsChildren($coll['id']); $html = "<br><hr><br>"; if (count($chld) != 0) { $html .= "<h3>Sub collections</h3><div class='child'><ul>"; foreach ($chld as $key => $value) { $html .= '<li>' . '<h3><a href="' . html_escape(public_uri('collections/show/' . $key)) . '"> ' . $value . '</a></h3></li>'; } $html .= "</ul></div>"; } else { // $parent = $nst->getParent($coll['id']); if (array_key_exists('id', $parent)) { $html .= '<h3>Root Collection</h3><span class="collections-parent-page">' . '<h4><a href="' . html_escape(public_uri('collections/show/' . $parent['id'])) . '">' . $parent['name'] . '</a></h4></span><br><br>'; } } echo $html; } }