/**
  * Copy the reports from the tracker $from_id to the tracker $to_id
  * The copied reports must have scope == 'P'
  */
 public function copyReports($from_id, $to_id)
 {
     $user_id = UserManager::instance()->getCurrentUser()->getId();
     $dao = new GraphOnTrackers_ReportDao(CodendiDataAccess::instance());
     foreach ($dao->searchByTrackerIdAndScope($from_id, 'P') as $row) {
         //retrieve the report
         $report = new GraphOnTrackers_Report($row['report_graphic_id']);
         //Create a new one
         $copied_report = GraphOnTrackers_Report::create($to_id, $user_id, $report->getName(), $report->getDescription(), $report->getScope());
         //Copy the charts
         $this->copyCharts($report, $copied_report);
     }
 }
Exemplo n.º 2
0
 function genGraphRepSelBox($value)
 {
     $hp =& Codendi_HTMLPurifier::instance();
     require_once dirname(__FILE__) . "/../data-access/GraphOnTrackers_Report.class.php";
     $reports = $this->grf->getReports_ids();
     $returns = '<form name="plugin_graphontrackers_selectreport_form" action="' . $_SERVER['REQUEST_URI'] . '" method="GET">';
     parse_str($_SERVER['QUERY_STRING'], $url_params);
     foreach ($url_params as $key => $v) {
         if ($key != 'go_graphreport' && $key != 'report_graphic_id') {
             $returns .= $this->_toInputElement($key, $v);
         }
     }
     $returns .= '<B>' . $GLOBALS['Language']->getText('plugin_graphontrackers_graphic_report_label', 'use_graphic_report') . '&nbsp;&nbsp;</B>' . '<SELECT NAME="report_graphic_id" onChange="document.plugin_graphontrackers_selectreport_form.go_graphreport.click()">';
     $returns .= '<OPTION VALUE="0">' . $GLOBALS['Language']->getText('plugin_graphontrackers_empty_select', 'none_value') . '</OPTION>';
     for ($i = 0; $i < count($reports); $i++) {
         $r = new GraphOnTrackers_Report($reports[$i]);
         if ($reports[$i] == $value) {
             $returns .= '<OPTION selected="selected" VALUE="' . $hp->purify($r->getId()) . '">' . $hp->purify(stripslashes($r->getName())) . '</OPTION>';
         } else {
             $returns .= '<OPTION  VALUE="' . $hp->purify($r->getId()) . '">' . $hp->purify($r->getName()) . '</OPTION>';
         }
     }
     $returns .= '</SELECT>&nbsp;<INPUT TYPE="submit" VALUE="' . $GLOBALS['Language']->getText('plugin_graphontrackers_report', 'btn_go') . '" NAME="go_graphreport"/>';
     $returns .= '</form>';
     return $returns;
 }
Exemplo n.º 3
0
 /**
  *  Hook to delete graphic reports afer tracker reports are deleted, when trackers are deleted.
  *  Used in src/common/tracker/ArtifactTypeFactory.class.php
  * 
  * @param params:hook parameters
  */
 function delete_graphical_reports($params)
 {
     require_once 'data-access/GraphOnTrackers_Report.class.php';
     $atid = $params['atid'];
     $sql = "SELECT report_graphic_id FROM plugin_graphontrackers_report_graphic WHERE group_artifact_id='" . db_ei($atid) . "'";
     $res = db_query($sql);
     while ($report_array = db_fetch_array($res)) {
         $report_graphic_id = db_ei($report_array["report_graphic_id"]);
         $gr = new GraphOnTrackers_Report($report_graphic_id);
         $gr->delete();
     }
 }
Exemplo n.º 4
0
require_once 'common/plugin/PluginManager.class.php';
require_once dirname(__FILE__) . '/../include/common/GraphicEngineUserPrefs.class.php';
require_once dirname(__FILE__) . '/../include/data-access/GraphOnTrackers_Report.class.php';
require_once 'common/tracker/ArtifactType.class.php';
require_once 'common/tracker/ArtifactFieldFactory.class.php';
$plugin_manager =& PluginManager::instance();
$p =& $plugin_manager->getPluginByName('graphontrackers');
if ($p && $plugin_manager->isPluginAvailable($p)) {
    $request =& HTTPRequest::instance();
    if ($request->valid(new Valid_GroupId()) && $request->valid(new Valid_UInt('report_graphic_id')) && $request->valid(new Valid_UInt('atid')) && $request->valid(new Valid_WhiteList('type', array('gantt', 'pie', 'bar', 'line')))) {
        $report_graphic_id = $request->get('report_graphic_id');
        $group_id = $request->get('group_id');
        $atid = $request->get('atid');
        $type = $request->get('type');
        $pm = ProjectManager::instance();
        $group = $pm->getProject($group_id);
        if ($group === false) {
            exit;
        }
        if ($request->valid(new Valid_UInt('id'))) {
            $id = $request->get('id');
            $gr = new GraphOnTrackers_Report($report_graphic_id);
            if ($c = $gr->getChart($id)) {
                $c->stroke($group_id, $atid);
                //Layout::showDebugInfo();
            }
        }
    }
} else {
    header('Location: ' . get_server_url());
}