Example #1
0
 * (at your option) any later version.
 *
 * Codendi is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Codendi. If not, see <http://www.gnu.org/licenses/>.
 */
require_once 'pre.php';
require_once 'common/plugin/PluginManager.class.php';
require_once TRACKER_BASE_DIR . '/Tracker/Report/dao/Tracker_Report_RendererDao.class.php';
require_once dirname(__FILE__) . '/../include/data-access/GraphOnTrackersV5_ChartDao.class.php';
$plugin_manager = PluginManager::instance();
$p = $plugin_manager->getPluginByName('graphontrackersv5');
if ($p && $plugin_manager->isPluginAvailable($p)) {
    $request =& HTTPRequest::instance();
    if ($request->valid(new Valid_UInt('id'))) {
        $id = $request->get('id');
        $dao = new GraphOnTrackersV5_ChartDao();
        if ($row = $dao->searchById($id)->getRow()) {
            $renderer_dao = new Tracker_Report_RendererDao();
            if ($renderer = $renderer_dao->searchById($row['report_graphic_id'])->getRow()) {
                header('Location: ' . TRACKER_BASE_URL . '/?' . http_build_query(array('_jpg_csimd' => 1, 'report' => $renderer['report_id'], 'renderer' => $row['report_graphic_id'], 'func' => 'renderer', 'renderer_plugin_graphontrackersv5[stroke]' => $id)));
            }
        }
    }
} else {
    header('Location: ' . get_server_url());
}
 /**
  * retrieve a specific chart by its id from db only
  */
 public function getChartFromDb($renderer, $id)
 {
     //not add in session
     $c = null;
     $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);
         }
         if ($renderer) {
             if ($chart_classname = $this->getChartClassname($chart_data['chart_type'])) {
                 $c = new $chart_classname($renderer, $chart_data['id'], $chart_data['rank'], $chart_data['title'], $chart_data['description'], $chart_data['width'], $chart_data['height']);
             }
         }
     }
     return $c;
 }
 /**
  * retrieve a specific chart by its id
  */
 public function getChart($id)
 {
     $c = null;
     $dao = new GraphOnTrackersV5_ChartDao(CodendiDataAccess::instance());
     $dar = $dao->searchById($id);
     if ($dar && $dar->valid() && ($row = $dar->getRow())) {
         $c = $this->instanciateChart($row);
     }
     return $c;
 }