/** * Duplicate the charts */ public function duplicate($from_renderer, $to_renderer, $field_mapping) { $dao = new GraphOnTrackersV5_ChartDao(CodendiDataAccess::instance()); foreach ($this->getCharts($from_renderer) as $chart) { if ($id = $dao->duplicate($chart->getId(), $to_renderer->id)) { $this->getChart($to_renderer, $id)->duplicate($chart, $field_mapping); } } }
* (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()); }
/** * Get the properties of the chart as a HTML_Element array. * * Default properties are id, title, description, rank and dimensions * * Feel free to override this method to provide your own properties * @return array */ public function getProperties() { $siblings = array(); $dao = new GraphOnTrackersV5_ChartDao(CodendiDataAccess::instance()); foreach ($dao->getSiblings($this->getId()) as $row) { $siblings[] = array('id' => $row['id'], 'name' => $row['title'], 'rank' => $row['rank']); } return array('id' => new HTML_Element_Input_Hidden($GLOBALS['Language']->getText('plugin_graphontrackersv5_property', 'id'), 'chart[id]', $this->getId()), 'title' => new HTML_Element_Input_Text($GLOBALS['Language']->getText('plugin_graphontrackersv5_property', 'title'), 'chart[title]', $this->getTitle()), 'description' => new HTML_Element_Textarea($GLOBALS['Language']->getText('plugin_graphontrackersv5_property', 'description'), 'chart[description]', $this->getDescription()), 'rank' => new HTML_Element_Selectbox_Rank($GLOBALS['Language']->getText('plugin_graphontrackersv5_property', 'rank'), 'chart[rank]', $this->getRank(), $this->getId(), $siblings), 'dimensions' => new HTML_Element_Columns(new HTML_Element_Input_Text($GLOBALS['Language']->getText('plugin_graphontrackersv5_property', 'width'), 'chart[width]', $this->getWidth(), 4), new HTML_Element_Input_Text($GLOBALS['Language']->getText('plugin_graphontrackersv5_property', 'height'), 'chart[height]', $this->getHeight(), 4))); }
public function createChart($chart_type) { $chart = null; if ($chart_classname = $this->getChartClassname($chart_type)) { $dao = new GraphOnTrackersV5_ChartDao(CodendiDataAccess::instance()); $default_title = 'Untitled ' . $chart_type; $default_description = ''; $default_width = call_user_func(array($chart_classname, 'getDefaultWidth')); $default_height = call_user_func(array($chart_classname, 'getDefaultHeight')); $id = $dao->create($this->id, $chart_type, $default_title, $default_description, $default_width, $default_height); $rank = $dao->getRank($id); $chart = call_user_func(array($chart_classname, 'create'), $this, $id, $rank, $default_title, $default_description, $default_width, $default_height); } return $chart; }