/**
  * Generates sidebar for a given page object
  *
  * Displays child level pages in a list, if there are any, else nothing
  * TODO Add Approrpiate Image as per funcspec
  * TODO Consider showing sibling pages instead of child
  */
 public function sidebar()
 {
     $children = $this->content->getLiveChildren();
     if (($image = $this->content->getImage()) == null) {
         $image_mapper = RequestRegistry::getImageMapper();
         $pcs_code = SessionRegistry::getStyleCode();
         $image = $image_mapper->findRandomLiveImageForPcs($pcs_code);
     }
     $sidebar = "<div id='sidebar'>\n";
     if (count($children) > 0) {
         $sidebar .= "<div class='sidebar-links-title'>\n" . "<p>{$this->content->getTitle()}</p>\n" . "</div>\n" . "<ul class='sidebar-links-list'>\n";
         foreach ($children as $child) {
             $sidebar .= "<li><a href='{$this->url($child)}'>{$child->getTitle()}</a></li>";
         }
         $sidebar .= "</ul>\n";
     }
     if ($image != null) {
         $sidebar .= "<img src='{$image->getSource()}' id='post-image' />\n";
     }
     $sidebar .= "</div>\n";
     return $sidebar;
 }