/** * Show reporting index page * * @param void * @return null */ function add_chart() { if (logged_user()->isGuest()) { flash_error(lang('no access permissions')); ajx_current("empty"); return; } $factory = new ProjectChartFactory(); $types = $factory->getChartTypes(); $chart_data = array_var($_POST, 'chart'); if(!is_array($chart_data)) { $chart_data = array( 'type_id' => 1, 'display_id' => 20, 'show_in_project' => 1, 'show_in_parents' => 0 ); // array } // if tpl_assign('chart_data', $chart_data); if (is_array(array_var($_POST, 'chart'))) { $project = Projects::findById(array_var($chart_data, 'project_id')); if (!$project instanceof Project) { flash_error(lang('project dnx')); ajx_current("empty"); return; } $chart = $factory->getChart(array_var($chart_data, 'type_id')); $chart->setDisplayId(array_var($chart_data, 'display_id')); $chart->setTitle(array_var($chart_data, 'title')); if (array_var($chart_data, 'save') == 1){ $chart->setFromAttributes($chart_data); try { DB::beginWork(); $chart->save(); $chart->setProject($project); DB::commit(); flash_success(lang('success add chart', $chart->getTitle())); ajx_current('back'); } catch(Exception $e) { DB::rollback(); flash_error($e->getMessage()); ajx_current("empty"); } return; } $chart->ExecuteQuery(); tpl_assign('chart', $chart); ajx_replace(true); } tpl_assign('chart_displays', $factory->getChartDisplays()); tpl_assign('chart_list', $factory->getChartTypes()); }
echo $c != count($charts) ? 'border-bottom:1px solid #DDDDDD' : ''; ?> "> <div style="font-size:120%;font-weight:bold"><?php echo clean($chart->getTitle()); ?> </div> <?php $chart2 = $pcf->loadChart($chart->getId()); $chart2->ExecuteQuery(); echo $chart2->DashboardDraw(); echo $chart2->PrintInfo(); $c++; } // foreach ?> <?php } // if isset ?> <?php if (isset($billing_chart_data) && is_array($billing_chart_data) && count($billing_chart_data) > 0) { $billing_chart = $pcf->getChart(6); $billing_chart->setData($billing_chart_data); $billing_chart->setTitle(lang('total billing by user')); echo $billing_chart->DashboardDraw(); echo $billing_chart->PrintInfo(); } ?> </div> </div>