$pluginclass = new $pluginclassname($report); $editcell = ''; if ($pluginclass->form) { $editcell .= '<a href="editplugin.php?id=' . $id . '&comp=' . $comp . '&pname=' . $e['pluginname'] . '&cid=' . $e['id'] . '"><img src="' . $OUTPUT->pix_url('/t/edit') . '" class="iconsmall"></a>'; } $editcell .= '<a href="editplugin.php?id=' . $id . '&comp=' . $comp . '&pname=' . $e['pluginname'] . '&cid=' . $e['id'] . '&delete=1&sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('/t/delete') . '" class="iconsmall"></a>'; if ($compclass->ordering && $i != 0 && count($elements) > 1) { $editcell .= '<a href="editplugin.php?id=' . $id . '&comp=' . $comp . '&pname=' . $e['pluginname'] . '&cid=' . $e['id'] . '&moveup=1&sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('/t/up') . '" class="iconsmall"></a>'; } if ($compclass->ordering && $i != count($elements) - 1) { $editcell .= '<a href="editplugin.php?id=' . $id . '&comp=' . $comp . '&pname=' . $e['pluginname'] . '&cid=' . $e['id'] . '&movedown=1&sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('/t/down') . '" class="iconsmall"></a>'; } $table->data[] = array('c' . ($i + 1), $e['pluginfullname'], $e['summary'], $editcell); $i++; } cr_print_table($table); } else { if ($compclass->plugins) { echo $OUTPUT->heading(get_string('no' . $comp . 'yet', 'block_configurable_reports')); } } if ($compclass->plugins) { echo '<div class="boxaligncenter">'; echo '<p class="centerpara">'; print_string('add'); echo ': '; //choose_from_menu($optionsplugins,'plugin','',get_string('choose'),"location.href = 'editplugin.php?id=".$id."&comp=".$comp."&pname='+document.getElementById('menuplugin').value"); $attributes = array('id' => 'menuplugin'); echo html_writer::select($optionsplugins, 'plugin', '', array('' => get_string('choose')), $attributes); $OUTPUT->add_action_handler(new component_action('change', 'menuplugin', array('url' => "editplugin.php?id=" . $id . "&comp=" . $comp . "&pname=")), 'menuplugin'); echo '</p>';
function generate_dashboardreport($reportclass, $reporttype, $blockinstanceid) { global $CFG, $PAGE; $html = ''; $reportclass->create_report($blockinstanceid); $output = ''; $renderer = $PAGE->get_renderer('block_cobalt_reports'); if ($reporttype === 'table') { $html .= cr_print_table($reportclass->finalreport->table, true); $html .= $renderer->add_jsordering($reportclass, true, $blockinstanceid); } else { $components = cr_unserialize($reportclass->config->components); $seriesvalues = (isset($components['plot']['elements'])) ? $components['plot']['elements'] : array(); switch (get_config('block_cobalt_reports', 'reportchartui')) { case 'highcharts': require_once $CFG->dirroot . '/blocks/cobalt_reports/components/highcharts/graphicalreport.php'; $highcharts = new highreports(); foreach ($seriesvalues as $g) { $g['formdata']->showlegend = 0; if ($g['pluginname'] === $reporttype) { switch ($g['pluginname']) { case 'pie': $html .= $highcharts->piechart($reportclass->finalreport->table->data, $g['formdata'], $reportclass->config, $blockinstanceid); break; case 'line': $html .= $highcharts->lbchart($reportclass->finalreport->table->data, $g['formdata'], $reportclass->config, 'line', $blockinstanceid, $reportclass->finalreport->table->head); break; case 'bar': $html .= $highcharts->lbchart($reportclass->finalreport->table->data, $g['formdata'], $reportclass->config, 'bar', $blockinstanceid, $reportclass->finalreport->table->head); break; } } } break; case 'd3': require_once $CFG->dirroot . '/blocks/cobalt_reports/components/nvd3/nvd3graphs.php'; $nvd = new nvd3(); foreach ($seriesvalues as $g) { $g['formdata']->showlegend = 0; if ($g['pluginname'] === $reporttype) { switch ($g['pluginname']) { case 'pie': $html .= $nvd->piechart($reportclass->finalreport->table->data, $g['formdata'], $reportclass->config); break; case 'bar': $html .= $nvd->multibarchart($reportclass->finalreport->table->data, $g['formdata'], $reportclass->config, $reportclass->finalreport->table->head); break; } } } break; case 'default': if (!empty($seriesvalues)) { $series = array(); foreach ($seriesvalues as $g) { if ($g['pluginname'] === $reporttype && $g['pluginname'] !== 'bar') { require_once($CFG->dirroot . '/blocks/cobalt_reports/components/plot/' . $g['pluginname'] . '/plugin.class.php'); $classname = 'plugin_' . $g['pluginname']; $class = new $classname($reportclass->config); $reporturi = $class->execute($g['id'], $g['formdata'], $reportclass->finalreport->table->data); } } } $output .= '<div class="centerpara">'; $output .= ' <img src="' . $reporturi . '" alt="' . $reportclass->config->name . '"><br />'; $output .= '</div>'; if (isset($reporturi)) $html .=$output; else $html .= ''; break; } } return $html; }
function print_report_page() { global $DB, $CFG, $OUTPUT, $USER; cr_print_js_function(); $components = cr_unserialize($this->config->components); $template = isset($components['template']['config']) && $components['template']['config']->enabled && $components['template']['config']->record ? $components['template']['config'] : false; if ($template) { $this->print_template($template); return true; } // Debug $debug = optional_param('debug', false, PARAM_BOOL); if ($debug or !empty($this->config->debug)) { echo html_writer::empty_tag('hr'); echo html_writer::tag('div', $this->sql, array('id' => 'debug', 'style' => 'direction:ltr;text-align:left;')); echo html_writer::empty_tag('hr'); } echo '<div class="centerpara">'; echo format_text($this->config->summary); echo '</div>'; $this->print_filters(); if ($this->finalreport->table && !empty($this->finalreport->table->data[0])) { echo "<div id=\"printablediv\">\n"; $this->print_graphs(); if ($this->config->jsordering) { $this->add_jsordering(); } $this->totalrecords = count($this->finalreport->table->data); if ($this->config->pagination) { $page = optional_param('page', 0, PARAM_INT); $this->totalrecords = count($this->finalreport->table->data); $this->finalreport->table->data = array_slice($this->finalreport->table->data, $page * $this->config->pagination, $this->config->pagination); } cr_print_table($this->finalreport->table); if ($this->config->pagination) { $postfiltervars = ''; $request = array_merge($_POST, $_GET); if ($request) { foreach ($request as $key => $val) { if (strpos($key, 'filter_') !== false) { if (is_array($val)) { foreach ($val as $k => $v) { $postfiltervars .= "&{$key}[{$k}]=" . $v; } } else { $postfiltervars .= "&{$key}=" . $val; } } } } //print_paging_bar($this->totalrecords,$page,$this->config->pagination,"viewreport.php?id=".$this->config->id."$postfiltervars&"); $pagingbar = new paging_bar($this->totalrecords, $page, $this->config->pagination, "viewreport.php?id=" . $this->config->id . "&courseid=" . $this->config->courseid . "{$postfiltervars}&"); $pagingbar->pagevar = 'page'; echo $OUTPUT->render($pagingbar); } // Report statistics $a = new stdClass(); $a->totalrecords = $this->totalrecords; echo html_writer::tag('div', get_string('totalrecords', 'block_configurable_reports', $a), array('id' => 'totalrecords')); echo html_writer::tag('div', get_string('lastexecutiontime', 'block_configurable_reports', $this->config->lastexecutiontime / 1000), array('id' => 'lastexecutiontime')); if (!empty($this->finalreport->calcs->data[0])) { echo '<br /><br /><br /><div class="centerpara"><b>' . get_string("columncalculations", "block_configurable_reports") . '</b></div><br />'; echo html_writer::table($this->finalreport->calcs); } echo "</div>"; $this->print_export_options(); } else { echo '<div class="centerpara">' . get_string('norecordsfound', 'block_configurable_reports') . '</div>'; } echo '<div class="centerpara"><br />'; echo $OUTPUT->pix_icon('print', get_string('printreport', 'block_configurable_reports'), 'block_configurable_reports'); echo " <a href=\"javascript: printDiv('printablediv')\">" . get_string('printreport', 'block_configurable_reports') . "</a>"; echo "</div>\n"; }
function print_report_page() { global $CFG, $FULLME, $USER; cr_print_js_function(); $components = cr_unserialize($this->config->components); $template = isset($components['template']['config']) && $components['template']['config']->enabled && $components['template']['config']->record ? $components['template']['config'] : false; if ($template) { $this->print_template($template); return true; } echo '<div class="centerpara">'; echo format_text($this->config->summary); echo '</div>'; $this->print_filters(); if ($this->finalreport->table && !empty($this->finalreport->table->data[0])) { echo "<div id=\"printablediv\">\n"; $this->print_graphs(); if ($this->config->jsordering) { $this->add_jsordering(); } if ($this->config->pagination) { $page = optional_param('page', 0, PARAM_INT); $this->totalrecords = count($this->finalreport->table->data); $this->finalreport->table->data = array_slice($this->finalreport->table->data, $page * $this->config->pagination, $this->config->pagination); } cr_print_table($this->finalreport->table); if ($this->config->pagination) { $postfiltervars = ''; $request = array_merge($_POST, $_GET); if ($request) { foreach ($request as $key => $val) { if (strpos($key, 'filter_') !== false) { if (is_array($val)) { foreach ($val as $k => $v) { $postfiltervars .= "&{$key}[{$k}]=" . $v; } } else { $postfiltervars .= "&{$key}=" . $val; } } } } print_paging_bar($this->totalrecords, $page, $this->config->pagination, "viewreport.php?id=" . $this->config->id . "{$postfiltervars}&"); } if (!empty($this->finalreport->calcs->data[0])) { echo '<br /><br /><br /><div class="centerpara"><b>' . get_string("columncalculations", "block_configurable_reports") . '</b></div><br />'; print_table($this->finalreport->calcs); } echo "</div>"; // Display Records (Rows / Items) count (nadavkav 11-6-11) echo "<br/><div id=\"totalitems\">" . get_string('totalitems', "block_configurable_reports") . " " . count($this->finalreport->table->data) . "</div>"; $this->print_export_options(); } else { echo '<div class="centerpara">' . get_string('norecordsfound', 'block_configurable_reports') . '</div>'; } echo '<div class="centerpara"><br />'; echo "<img src=\"{$CFG->wwwroot}/blocks/configurable_reports/img/print.png\" alt=\".get_string('printreport','block_configurable_reports')\"> <a href=\"javascript: printDiv('printablediv')\">" . get_string('printreport', 'block_configurable_reports') . "</a>"; echo "</div>\n"; }