function plot_graph(&$graph, $graph_ct = false)
 {
     if ($graph_ct == 0) {
         if ($this->page_started) {
             $this->text .= '</TBODY></TABLE>';
         }
         $this->page_started = false;
     }
     $this->graph_session_placeholder++;
     $graph->width_actual = check_for_default("GraphWidth", $graph->width);
     $graph->height_actual = check_for_default("GraphHeight", $graph->height);
     $graph->title_actual = reportico_assignment::reportico_meta_sql_criteria($this->query, $graph->title, true);
     $graph->xtitle_actual = reportico_assignment::reportico_meta_sql_criteria($this->query, $graph->xtitle, true);
     $graph->ytitle_actual = reportico_assignment::reportico_meta_sql_criteria($this->query, $graph->ytitle, true);
     $url_string = $graph->generate_url_params("HTML", $this->graph_session_placeholder);
     $this->text .= '<div class="swRepResultGraph">';
     if ($url_string) {
         $this->text .= $url_string;
     }
     $this->text .= '</div>';
 }
Ejemplo n.º 2
0
	function & get_attribute ( $attrib_name )
		{
			if ( $this->attributes[$attrib_name] )
			{
				$val = check_for_default($attrib_name, $this->attributes[$attrib_name]);
				return $val;
			}
			else
			{
				$val = check_for_default($attrib_name, $this->attributes[$attrib_name]);
				return $val;
			}
		}
 function apply_defaults_internal()
 {
     $this->graphcolor = check_for_default("GraphColor", $this->graphcolor);
     $this->xaxiscolor = check_for_default("XAxisColor", $this->xaxiscolor);
     $this->xticklabelinterval = check_for_default("XTickLabelInterval", $this->xticklabelinterval);
     $this->xtickinterval = check_for_default("XTickInterval", $this->xtickinterval);
     $this->yaxiscolor = check_for_default("YAxisColor", $this->yaxiscolor);
     $this->yticklabelinterval = check_for_default("YTickLabelInterval", $this->yticklabelinterval);
     $this->ytickinterval = check_for_default("YTickInterval", $this->ytickinterval);
     $this->graphcolor = check_for_default("GraphColor", $this->graphcolor);
     $this->marginbottom = check_for_default("MarginBottom", $this->marginbottom);
     $this->margintop = check_for_default("MarginTop", $this->margintop);
     $this->marginleft = check_for_default("MarginLeft", $this->marginleft);
     $this->marginright = check_for_default("MarginRight", $this->marginright);
     $this->margincolor = check_for_default("MarginColor", $this->margincolor);
     $this->gridpos = check_for_default("GridPosition", $this->gridpos);
     $this->xgriddisplay = check_for_default("XGridDisplay", $this->xgriddisplay);
     $this->xgridcolor = check_for_default("XGridColor", $this->xgridcolor);
     $this->ygriddisplay = check_for_default("YGridDisplay", $this->ygriddisplay);
     $this->ygridcolor = check_for_default("YGridColor", $this->ygridcolor);
     $this->titlefont = check_for_default("TitleFont", $this->titlefont);
     $this->titlefontstyle = check_for_default("TitleFontStyle", $this->titlefontstyle);
     $this->titlefontsize = check_for_default("TitleFontSize", $this->titlefontsize);
     $this->titlecolor = check_for_default("TitleColor", $this->titlecolor);
     $this->xtitlefont = check_for_default("XTitleFont", $this->xtitlefont);
     $this->xtitlefontstyle = check_for_default("XTitleFontStyle", $this->xtitlefontstyle);
     $this->xtitlefontsize = check_for_default("XTitleFontSize", $this->xtitlefontsize);
     $this->xtitlecolor = check_for_default("XTitleColor", $this->xtitlecolor);
     $this->ytitlefont = check_for_default("YTitleFont", $this->ytitlefont);
     $this->ytitlefontstyle = check_for_default("YTitleFontStyle", $this->ytitlefontstyle);
     $this->ytitlefontsize = check_for_default("YTitleFontSize", $this->ytitlefontsize);
     $this->ytitlecolor = check_for_default("YTitleColor", $this->ytitlecolor);
     $this->xaxisfont = check_for_default("XAxisFont", $this->xaxisfont);
     $this->xaxisfontstyle = check_for_default("XAxisFontStyle", $this->xaxisfontstyle);
     $this->xaxisfontsize = check_for_default("XAxisFontSize", $this->xaxisfontsize);
     $this->xaxisfontcolor = check_for_default("XAxisFontColor", $this->xaxisfontcolor);
     $this->xaxiscolor = check_for_default("XAxisColor", $this->xaxiscolor);
     $this->yaxisfont = check_for_default("YAxisFont", $this->yaxisfont);
     $this->yaxisfontstyle = check_for_default("YAxisFontStyle", $this->yaxisfontstyle);
     $this->yaxisfontsize = check_for_default("YAxisFontSize", $this->yaxisfontsize);
     $this->yaxisfontcolor = check_for_default("YAxisFontColor", $this->yaxisfontcolor);
     $this->yaxiscolor = check_for_default("YAxisColor", $this->yaxiscolor);
 }
 function after_group_trailers()
 {
     $this->any_trailers = false;
     $this->any_custom_trailers = false;
     // Dont apply trailers in FORM style
     if (session_request_item("target_style", "TABLE") == "FORM") {
         return;
     }
     $trailer_first = true;
     $group_changed = false;
     if ($this->line_count <= 0) {
         // No group trailers as it's the first page
     } else {
         //Plot After Group Trailers
         if (count($this->query->groups) == 0) {
             return;
         }
         $rct = 0;
         // Work out which groups have triggered trailer by passing
         // through highest to lowest level .. group changes at level cause change at lower
         // also last line does too!!
         $uppergroupchanged = false;
         reset($this->query->groups);
         do {
             $group = current($this->query->groups);
             $group->change_triggered = false;
             if ($uppergroupchanged || $this->query->changed($group->group_name) || $this->last_line) {
                 $group->change_triggered = true;
                 $uppergroupchanged = true;
             }
         } while (next($this->query->groups));
         end($this->query->groups);
         do {
             $group = current($this->query->groups);
             if ($group->change_triggered) {
                 if ($rct == 1) {
                     $this->format_report_detail_end();
                 }
                 $rct++;
                 $group_changed = true;
                 $lev = 0;
                 $tolev = 0;
                 while ($lev < $group->max_level) {
                     if ($lev == 0) {
                         $this->apply_format($group, "before_trailer");
                     }
                     $this->format_group_trailer_start($trailer_first);
                     $this->format_column_trailer_before_line();
                     $junk = 0;
                     $wc = count($this->columns);
                     // In PDF mode all trailer lines must be passed through twice
                     // to allow calculation of line height. Otherwise
                     // Only one pass through
                     $number_group_rows = 0;
                     for ($passno = 1; $passno <= 2; $passno++) {
                         if ($this->query->target_format == "PDF") {
                             if ($passno == 1) {
                                 $this->draw_mode = "CALCULATE";
                             }
                             if ($passno == 2) {
                                 $this->draw_mode = "DRAW";
                                 $this->unapply_style_tags("GROUPTRAILER", $this->query->output_group_trailer_styles);
                                 $this->check_page_overflow();
                                 $this->apply_style_tags("GROUPTRAILER", $this->query->output_group_trailer_styles);
                             }
                         } else {
                             if ($passno == 2) {
                                 break;
                             }
                         }
                         // Column Trailers
                         $linedrawn = false;
                         if ($this->draw_mode == "DRAW" && $number_group_rows == 0) {
                             $linedrawn = true;
                         } else {
                             $number_group_rows = 0;
                         }
                         foreach ($this->query->display_order_set["column"] as $w) {
                             if (!$this->show_column_header($w)) {
                                 continue;
                             }
                             if (array_key_exists($w->query_name, $group->trailers_by_column)) {
                                 $number_group_rows++;
                                 if (count($group->trailers_by_column[$w->query_name]) >= $lev + 1 && !$group->trailers_by_column[$w->query_name][$lev]["GroupTrailerCustom"]) {
                                     if (!$linedrawn) {
                                         $this->unapply_style_tags("GROUPTRAILER", $this->query->output_group_trailer_styles);
                                         $this->new_report_page_line("3");
                                         $this->apply_style_tags("GROUPTRAILER", $this->query->output_group_trailer_styles);
                                         $linedrawn = true;
                                     }
                                     $this->format_column_trailer($w, $group->trailers_by_column[$w->query_name][$lev], $trailer_first);
                                 } else {
                                     if (!$linedrawn) {
                                         $this->unapply_style_tags("GROUPTRAILER", $this->query->output_group_trailer_styles);
                                         $this->new_report_page_line("3");
                                         $this->apply_style_tags("GROUPTRAILER", $this->query->output_group_trailer_styles);
                                         $linedrawn = true;
                                     }
                                     $this->format_column_trailer($w, $junk, $trailer_first);
                                 }
                                 $this->any_trailers = true;
                                 if ($group->max_level > $tolev) {
                                     $tolev = $group->max_level;
                                 }
                             } else {
                                 if (!$linedrawn) {
                                     $this->unapply_style_tags("GROUPTRAILER", $this->query->output_group_trailer_styles);
                                     $this->new_report_page_line("3");
                                     $this->apply_style_tags("GROUPTRAILER", $this->query->output_group_trailer_styles);
                                     $linedrawn = true;
                                 }
                                 $this->format_column_trailer($w, $junk, $trailer_first);
                             }
                         }
                         // foreach
                     }
                     if (get_class($this) != "reportico_report_html") {
                         $this->format_group_trailer_end();
                     }
                     if ($trailer_first) {
                         $trailer_first = false;
                     }
                     $lev++;
                     $this->end_line();
                 }
                 // while
             }
         } while (prev($this->query->groups));
         if ($group_changed && get_class($this) == "reportico_report_html") {
             $this->format_group_trailer_end();
         }
         if ($group_changed && $this->query->target_format == "PDF") {
             $this->end_of_page_block();
         }
         // Custom trailers
         end($this->query->groups);
         do {
             $group = current($this->query->groups);
             if ($this->query->changed($group->group_name) || $this->last_line) {
                 $this->format_group_custom_trailer_start();
                 // In PDF mode all trailer lines must be passed through twice
                 // to allow calculation of line height. Otherwise
                 // Only one pass through
                 for ($passno = 1; $passno <= 2; $passno++) {
                     if ($this->query->target_format == "PDF") {
                         if ($passno == 1) {
                             $this->draw_mode = "CALCULATE";
                         }
                         if ($passno == 2) {
                             $this->draw_mode = "DRAW";
                             $this->check_page_overflow();
                             $this->custom_trailer_wrappers();
                         }
                     } else {
                         if ($passno == 2) {
                             break;
                         }
                     }
                     // Column Trailers
                     if ($this->query->target_format == "PDF") {
                         foreach ($group->trailers_by_column as $kk => $trailer) {
                             foreach ($trailer as $kk2 => $colgrp) {
                                 $this->format_custom_trailer($w, $colgrp);
                             }
                         }
                         // foreach
                     }
                 }
                 $this->format_group_custom_trailer_end();
             }
         } while (prev($this->query->groups));
         // Plot After Group Graphs
         $graph_ct = 0;
         end($this->query->groups);
         do {
             $group = current($this->query->groups);
             if ($this->query->changed($group->group_name) || $this->last_line) {
                 if (!function_exists("imagecreatefromstring")) {
                     trigger_error("Function imagecreatefromstring does not exist - ensure PHP is installed with GD option");
                 }
                 if (function_exists("imagecreatefromstring") && $this->graph_display && get_reportico_session_param("target_show_graph")) {
                     if ($graphs =& $this->query->get_graph_by_name($group->group_name)) {
                         foreach ($graphs as $graph) {
                             $graph->width_pdf_actual = check_for_default("GraphWidthPDF", $graph->width_pdf);
                             $graph->height_pdf_actual = check_for_default("GraphHeightPDF", $graph->height_pdf);
                             $graph->title_actual = reportico_assignment::reportico_meta_sql_criteria($this->query, $graph->title, true);
                             $graph->xtitle_actual = reportico_assignment::reportico_meta_sql_criteria($this->query, $graph->xtitle, true);
                             $graph->ytitle_actual = reportico_assignment::reportico_meta_sql_criteria($this->query, $graph->ytitle, true);
                             if ($url_string = $graph->generate_url_params($this->query->target_format)) {
                                 $this->plot_graph($graph, $graph_ct);
                                 $graph_ct++;
                             }
                         }
                     }
                 }
             }
         } while (prev($this->query->groups));
     }
 }