示例#1
0
    public static function generate_navbar($id)
    {
        $index = array_search($id, Timeline_Controller::$TIMELINE);
        if ($index > 0) {
            $left_id = Timeline_Controller::$TIMELINE[$index - 1];
            $left_class = Timeline_Controller::id_to_class_name($left_id);
            $left_name = constant($left_class . '::' . 'TIMELINE_NAME');
            $left_url = '/' . $left_id;
            $left_elm = '<a href="' . $left_url . '">&larr; ' . $left_name . '</a>';
        } else {
            $left_name = 'Nothing older yet...';
            $left_elm = '<span class="fakelink">' . $left_name . '</a>';
        }
        if ($index < count(Timeline_Controller::$TIMELINE) - 1) {
            $right_id = Timeline_Controller::$TIMELINE[$index + 1];
            $right_class = Timeline_Controller::id_to_class_name($right_id);
            $right_name = constant($right_class . '::' . 'TIMELINE_NAME');
            $right_url = '/' . $right_id;
            $right_elm = '<a href="' . $right_url . '">' . $right_name . ' &rarr;</a>';
        } else {
            $right_name = 'Nothing newer yet...';
            $right_elm = '<span class="fakelink">' . $right_name . '</a>';
        }
        return <<<NAVBAR
<div id="navbar">
  <div class="previous">{$left_elm}</div>
  <div class="next">{$right_elm}</div>
  <div class="title"><a href="/timeline">Jeff Verkoeyen's Timeline</a></div>
</div> <!-- #navbar -->
NAVBAR;
    }
示例#2
0
 public function __construct($id)
 {
     parent::__construct();
     $this->template->navbar_html = Timeline_Controller::generate_navbar($id);
     $this->add_css_file('css/timelinenode.css');
 }