/**
  * retrieve a specific chart by its id
  */
 public function getChart($renderer, $id, $store_in_session = true)
 {
     $c = null;
     $chart_data = null;
     if ($renderer != null && $store_in_session) {
         $session = new Tracker_Report_Session($renderer->report->id);
         $session->changeSessionNamespace("renderers.{$renderer->id}");
         // look for the chart in the session
         $chart_data = $session->get("charts.{$id}");
     }
     if (!$chart_data) {
         // not found. look in the db
         $dao = new GraphOnTrackersV5_ChartDao(CodendiDataAccess::instance());
         $chart_data = $dao->searchById($id)->getRow();
     }
     if ($chart_data) {
         if (!$renderer) {
             $report = null;
             //We don't know the report
             $renderer = Tracker_Report_RendererFactory::instance()->getReportRendererById($chart_data['report_graphic_id'], $report, $store_in_session);
         }
         if ($renderer) {
             $c = $this->instanciateChart($chart_data, $renderer, $store_in_session);
         }
     }
     return $c;
 }
 private function getSiblingsForRankSelectbox()
 {
     $siblings = array();
     $session = new Tracker_Report_Session($this->renderer->report->id);
     $session->changeSessionNamespace("renderers.{$this->renderer->id}");
     $charts = $session->get('charts');
     uasort($charts, array(GraphOnTrackersV5_ChartFactory::instance(), 'sortArrayByRank'));
     foreach ($charts as $sibling) {
         $siblings[] = array('id' => $sibling['id'], 'name' => $sibling['title'], 'rank' => $sibling['rank']);
     }
     return $siblings;
 }
 /**
  * @param Report $report the id of the report
  * @param array
  */
 public function getReportRendererByReportAndId($report, $renderer_id, $store_in_session = true)
 {
     $renderer = null;
     $row = null;
     if ($store_in_session) {
         $session = new Tracker_Report_Session($report->id);
         $session->changeSessionNamespace('renderers');
         $row = $session->get($renderer_id);
     }
     if (!$row) {
         $row = $this->getDao()->searchByIdAndReportId($renderer_id, $report->id)->getRow();
     }
     if ($row) {
         $renderer = $this->getInstanceFromRow($row, $report, $store_in_session);
     }
     return $renderer;
 }