-----------------------------------------------------------------------------
334362
public function setRequestColumns()
    {
        $sessionClass = ReporticoSession();

        if (array_key_exists("clearform", $_REQUEST)) {
            $this->clearform = true;
            $this->first_criteria_selection = true;
        }

        // Store filter group open close state
        if (isset($_REQUEST["closedfilters"]) || isset($_REQUEST["openfilters"])) {
            if (isset($_REQUEST["closedfilters"])) {
                //$sessionClass::setReporticoSessionParam("closedfilters", $_REQUEST["closedfilters"]);
            } else {
                $sessionClass::setReporticoSessionParam("closedfilters", false);
            }

            if (isset($_REQUEST["openfilters"])) {
                $sessionClass::setReporticoSessionParam("openfilters", $_REQUEST["openfilters"]);
            } else {
                $sessionClass::setReporticoSessionParam("openfilters", false);
            }

        }
        //echo ">>>";var_dump($sessionClass::getReporticoSessionParam("openfilters"));

        // If an initial set of parameter values has been set then parameters are being
        // set probably from a framework. In this case we need clear any MANUAL and HIDDEN requests
        // and set MANUAL ones from the external ones
        if ($this->initial_execution_parameters) {
            foreach ($_REQUEST as $k => $v) {
                if (preg_match("/^MANUAL_/", $k) || preg_match("/^HIDDEN_/", $k)) {
                    unset($_REQUEST[$k]);
                }
            }

        }

        $execute_mode = $this->getExecuteMode();
        foreach ($this->lookup_queries as $col) {
            // If this is first time into screen and we have defaults then
            // use these instead
            if ($sessionClass::getReporticoSessionParam("firstTimeIn")) {
                $this->lookup_queries[$col->query_name]->column_value =
                $this->lookup_queries[$col->query_name]->defaults;
                if (is_array($this->lookup_queries[$col->query_name]->column_value)) {
                    $this->lookup_queries[$col->query_name]->column_value =
                    implode(",", $this->lookup_queries[$col->query_name]->column_value);
                }

                // Daterange defaults needs to  eb converted to 2 values
                if ($this->lookup_queries[$col->query_name]->criteria_type == "DATERANGE" && !$this->lookup_queries[$col->query_name]->defaults) {
                    $this->lookup_queries[$col->query_name]->defaults = array();
                    $this->lookup_queries[$col->query_name]->defaults[0] = "TODAY-TODAY";
                    $this->lookup_queries[$col->query_name]->defaults[1] = "TODAY";
                    $this->lookup_queries[$col->query_name]->column_value = "TODAY-TODAY";
                }
                if ($this->lookup_queries[$col->query_name]->criteria_type == "DATE" && !$this->lookup_queries[$col->query_name]->defaults) {
                    $this->lookup_queries[$col->query_name]->defaults = array();
                    $this->lookup_queries[$col->query_name]->defaults[0] = "TODAY";
                    $this->lookup_queries[$col->query_name]->defaults[1] = "TODAY";
                    $this->lookup_queries[$col->query_name]->column_value = "TODAY";
                }
                $this->defaults = $this->lookup_queries[$col->query_name]->defaults;
                if (isset($this->defaults)) {
                    if ($this->lookup_queries[$col->query_name]->criteria_type == "DATERANGE") {
                        if (!ReporticoLocale::convertDateRangeDefaultsToDates("DATERANGE",
                            $this->lookup_queries[$col->query_name]->column_value,
                            $this->lookup_queries[$col->query_name]->column_value,
                            $this->lookup_queries[$col->query_name]->column_value2)) {
                            trigger_error("Date default '" . $this->defaults[0] . "' is not a valid date range. Should be 2 values separated by '-'. Each one should be in date format (e.g. yyyy-mm-dd, dd/mm/yyyy) or a date type (TODAY, TOMMORROW etc", E_USER_ERROR);
                        }

                    }
                    if ($this->lookup_queries[$col->query_name]->criteria_type == "DATE") {
                        $dummy = "";
                        if (!ReporticoLocale::convertDateRangeDefaultsToDates("DATE", $this->defaults[0], $this->range_start, $dummy)) {
                            if (!ReporticoLocale::convertDateRangeDefaultsToDates("DATE",
                                $this->lookup_queries[$col->query_name]->column_value,
                                $this->lookup_queries[$col->query_name]->column_value,
                                $this->lookup_queries[$col->query_name]->column_value2)) {
                                trigger_error("Date default '" . $this->defaults[0] . "' is not a valid date. Should be in date format (e.g. yyyy-mm-dd, dd/mm/yyyy) or a date type (TODAY, TOMMORROW etc", E_USER_ERROR);
                            }
                        }

                    }
                }
            }
        }

        if (array_key_exists("clearform", $_REQUEST)) {
            $sessionClass::setReporticoSessionParam("firstTimeIn", true);
            $sessionClass::setReporticoSessionParam("openfilters", false);
            $sessionClass::setReporticoSessionParam("closedfilters", false);
        }

        // Set up show option check box settings

        // If initial form style specified use it
        if ($this->initial_output_style) {
            $sessionClass::setReporticoSessionParam("target_style", $this->initial_output_style);
        }

        // If default starting "show" setting provided by calling framework then use them
        if ($this->show_print_button) {
            $sessionClass::setReporticoSessionParam("show_print_button", ($this->show_print_button == "show"));
        }

        if ($this->show_refresh_button) {
            $sessionClass::setReporticoSessionParam("show_refresh_button", ($this->show_refresh_button == "show"));
        }

        if ($this->initial_show_detail) {
            $sessionClass::setReporticoSessionParam("target_show_detail", ($this->initial_show_detail == "show"));
        }

        if ($this->initial_show_graph) {
            $sessionClass::setReporticoSessionParam("target_show_graph", ($this->initial_show_graph == "show"));
        }

        if ($this->initial_show_group_headers) {
            $sessionClass::setReporticoSessionParam("target_show_group_headers", ($this->initial_show_group_headers == "show"));
        }

        if ($this->initial_show_group_trailers) {
            $sessionClass::setReporticoSessionParam("target_show_group_trailers", ($this->initial_show_group_trailers == "show"));
        }

        if ($this->initial_show_criteria) {
            $sessionClass::setReporticoSessionParam("target_show_criteria", ($this->initial_show_criteria == "show"));
        }

        $this->target_show_detail = $sessionClass::sessionRequestItem("target_show_detail", true, !$sessionClass::issetReporticoSessionParam("target_show_detail"));
        $this->target_show_graph = $sessionClass::sessionRequestItem("target_show_graph", true, !$sessionClass::issetReporticoSessionParam("target_show_graph"));
        $this->target_show_group_headers = $sessionClass::sessionRequestItem("target_show_group_headers", true, !$sessionClass::issetReporticoSessionParam("target_show_group_headers"));
        $this->target_show_group_trailers = $sessionClass::sessionRequestItem("target_show_group_trailers", true, !$sessionClass::issetReporticoSessionParam("target_show_group_trailers"));
        $this->target_show_criteria = $sessionClass::sessionRequestItem("target_show_criteria", true, !$sessionClass::issetReporticoSessionParam("target_show_criteria"));

        if ($sessionClass::getReporticoSessionParam("firstTimeIn")
            && !$this->initial_show_detail && !$this->initial_show_graph && !$this->initial_show_group_headers
            && !$this->initial_show_group_trailers && !$this->initial_showColumnHeaders && !$this->initial_show_criteria
        ) {
            // If first time in default output hide/show elements to what is passed in URL params .. if none supplied show all
            if ($this->execute_mode == "EXECUTE") {
                $this->target_show_detail = ReporticoUtility::getRequestItem("target_show_detail", false);
                $this->target_show_graph = ReporticoUtility::getRequestItem("target_show_graph", false);
                $this->target_show_group_headers = ReporticoUtility::getRequestItem("target_show_group_headers", false);
                $this->target_show_group_trailers = ReporticoUtility::getRequestItem("target_show_group_trailers", false);
                $this->target_show_criteria = ReporticoUtility::getRequestItem("target_show_criteria", false);
                if (!$this->target_show_detail && !$this->target_show_graph && !$this->target_show_group_headers
                    && !$this->target_show_group_trailers && !$this->target_showColumnHeaders && !$this->target_show_criteria) {
                    $this->target_show_detail = true;
                    $this->target_show_graph = true;
                    $this->target_show_group_headers = true;
                    $this->target_show_group_trailers = true;
                    $this->target_show_criteria = true;
                }
                $sessionClass::setReporticoSessionParam("target_show_detail", $this->target_show_detail);
                $sessionClass::setReporticoSessionParam("target_show_graph", $this->target_show_graph);
                $sessionClass::setReporticoSessionParam("target_show_group_headers", $this->target_show_group_headers);
                $sessionClass::setReporticoSessionParam("target_show_group_trailers", $this->target_show_group_trailers);
                $sessionClass::setReporticoSessionParam("target_show_criteria", $this->target_show_criteria);
            } else {
                //$this->target_show_detail = true;
                //$this->target_show_graph = true;
                //$this->target_show_group_headers = true;
                //$this->target_show_group_trailers = true;
                //$this->target_showColumnHeaders = true;
                //$this->target_show_criteria = false;
                //$sessionClass::setReporticoSessionParam("target_show_detail",true);
                //$sessionClass::setReporticoSessionParam("target_show_graph",true);
                //$sessionClass::setReporticoSessionParam("target_show_group_headers",true);
                //$sessionClass::setReporticoSessionParam("target_show_group_trailers",true);
                //$sessionClass::setReporticoSessionParam("target_showColumnHeaders",true);
                //$sessionClass::setReporticoSessionParam("target_show_criteria",false);
            }
        } else {
            // If not first time in, then running report would have come from
            // prepare screen which provides details of what report elements to include
            if ($this->execute_mode == "EXECUTE") {
                $runfromcriteriascreen = ReporticoUtility::getRequestItem("user_criteria_entered", false);
                if ($runfromcriteriascreen) {
                    $this->target_show_detail = ReporticoUtility::getRequestItem("target_show_detail", false);
                    $this->target_show_graph = ReporticoUtility::getRequestItem("target_show_graph", false);
                    $this->target_show_group_headers = ReporticoUtility::getRequestItem("target_show_group_headers", false);
                    $this->target_show_group_trailers = ReporticoUtility::getRequestItem("target_show_group_trailers", false);
                    $this->target_show_criteria = ReporticoUtility::getRequestItem("target_show_criteria", false);
                    if (!$this->target_show_detail && !$this->target_show_graph && !$this->target_show_group_headers
                        && !$this->target_show_group_trailers && !$this->target_showColumnHeaders && !$this->target_show_criteria) {
                        $this->target_show_detail = true;
                        $this->target_show_graph = true;
                        $this->target_show_group_headers = true;
                        $this->target_show_group_trailers = true;
                        $this->target_show_criteria = true;
                    }
                    $sessionClass::setReporticoSessionParam("target_show_detail", $this->target_show_detail);
                    $sessionClass::setReporticoSessionParam("target_show_graph", $this->target_show_graph);
                    $sessionClass::setReporticoSessionParam("target_show_group_headers", $this->target_show_group_headers);
                    $sessionClass::setReporticoSessionParam("target_show_group_trailers", $this->target_show_group_trailers);
                    $sessionClass::setReporticoSessionParam("target_show_criteria", $this->target_show_criteria);
                }
            }
        }
        if (isset($_REQUEST["target_show_detail"])) {
            $sessionClass::setReporticoSessionParam("target_show_detail", $_REQUEST["target_show_detail"]);
        }

        if (isset($_REQUEST["target_show_graph"])) {
            $sessionClass::setReporticoSessionParam("target_show_graph", $_REQUEST["target_show_graph"]);
        }

        if (isset($_REQUEST["target_show_group_headers"])) {
            $sessionClass::setReporticoSessionParam("target_show_group_headers", $_REQUEST["target_show_group_headers"]);
        }

        if (isset($_REQUEST["target_show_group_trailers"])) {
            $sessionClass::setReporticoSessionParam("target_show_group_trailers", $_REQUEST["target_show_group_trailers"]);
        }

        if (isset($_REQUEST["target_show_criteria"])) {
            $sessionClass::setReporticoSessionParam("target_show_criteria", $_REQUEST["target_show_criteria"]);
        }

        if (array_key_exists("clearform", $_REQUEST)) {
            return;
        }

        // Fetch current criteria choices from HIDDEN_ section
        foreach ($this->lookup_queries as $col) {
            // criteria name could be a field name or could be "groupby" or the like
            $crit_name = $col->query_name;
            $crit_value = null;

            if (array_key_exists($crit_name, $_REQUEST)) {
                // Since using Select2, we find unselected list boxes still send an empty array with a single character which we dont want to include
                // as a criteria selection
                if (!(is_array($_REQUEST[$crit_name]) && $_REQUEST[$col->query_name][0] == "")) {
                    $crit_value = $_REQUEST[$crit_name];
                }

            }

            if (array_key_exists("HIDDEN_" . $crit_name, $_REQUEST)) {
                $crit_value = $_REQUEST["HIDDEN_" . $crit_name];
            }

            // applying multi-column values
            if (array_key_exists("HIDDEN_" . $crit_name . "_FROMDATE", $_REQUEST)) {
                $crit_value_1 = $_REQUEST["HIDDEN_" . $crit_name . "_FROMDATE"];
                $this->lookup_queries[$crit_name]->column_value1 = $crit_value_1;
            }

            if (array_key_exists("HIDDEN_" . $crit_name . "_TODATE", $_REQUEST)) {
                $crit_value_2 = $_REQUEST["HIDDEN_" . $crit_name . "_TODATE"];
                $this->lookup_queries[$crit_name]->column_value2 = $crit_value_2;
            }
            // end applying multi-column values

            if (array_key_exists("EXPANDED_" . $crit_name, $_REQUEST)) {
                $crit_value = $_REQUEST["EXPANDED_" . $crit_name];
            }

            // in case of single column value, we apply it now
            if (!is_null($crit_value)) {
                $this->lookup_queries[$crit_name]->column_value = $crit_value;

                // for groupby criteria, we need to show and hide columns accordingly
                if ($crit_name == 'showfields' || $crit_name == 'groupby') {
                    foreach ($this->columns as $q_col) {
                        //show the column if it matches a groupby value
                        if (in_array($q_col->column_name, $crit_value)) {
                            $q_col->attributes['column_display'] = "show";
                        }
                        // if it doesn't match, hide it if this is the first
                        // groupby column we are going through; otherwise
                        // leave it as it is
                        elseif (!isset($not_first_pass)) {
                            $q_col->attributes['column_display'] = "hide";
                        }
                    }
                    $not_first_pass = true;
                }
            }
        }

        // Fetch current criteria choices from MANUAL_ section
        foreach ($this->lookup_queries as $col) {
            $identified_criteria = false;

            // If an initial set of parameter values has been set then parameters are being
            // set probably from a framework. Use these for setting criteria
            if ($this->initial_execution_parameters) {
                if (isset($this->initial_execution_parameters[$col->query_name])) {
                    $val1 = false;
                    $val2 = false;
                    $criteriaval = $this->initial_execution_parameters[$col->query_name];
                    if ($col->criteria_type == "DATERANGE") {
                        if (!ReporticoLocale::convertDateRangeDefaultsToDates("DATERANGE",
                            $criteriaval,
                            $val1,
                            $val2)) {
                            trigger_error("Date default '" . $criteriaval . "' is not a valid date range. Should be 2 values separated by '-'. Each one should be in date format (e.g. yyyy-mm-dd, dd/mm/yyyy) or a date type (TODAY, TOMMORROW etc", E_USER_ERROR);
                        } else {
                            $_REQUEST["MANUAL_" . $col->query_name . "_FROMDATE"] = $val1;
                            $_REQUEST["MANUAL_" . $col->query_name . "_TODATE"] = $val2;
                            if ($sessionClass::getReporticoSessionParam('latestRequest')) {
                                $sessionClass::setReporticoSessionParam("MANUAL_" . $col->query_name . "_FROMDATE", $val1, $sessionClass::reporticoNamespace(), "latestRequest");
                                $sessionClass::setReporticoSessionParam("MANUAL_" . $col->query_name . "_TODATE", $val2, $sessionClass::reporticoNamespace(), "latestRequest");
                            }
                        }
                    } else if ($col->criteria_type == "DATE") {
                        if (!ReporticoLocale::convertDateRangeDefaultsToDates("DATE",
                            $criteriaval,
                            $val1,
                            $val2)) {
                            trigger_error("Date default '" . $criteriaval . "' is not a valid date. Should be in date format (e.g. yyyy-mm-dd, dd/mm/yyyy) or a date type (TODAY, TOMMORROW etc", E_USER_ERROR);
                        } else {
                            $_REQUEST["MANUAL_" . $col->query_name . "_FROMDATE"] = $val1;
                            $_REQUEST["MANUAL_" . $col->query_name . "_TODATE"] = $val1;
                            $_REQUEST["MANUAL_" . $col->query_name] = $val1;
                            if ($sessionClass::getReporticoSessionParam('latestRequest')) {
                                $sessionClass::setReporticoSessionParam("MANUAL_" . $col->query_name . "_FROMDATE", $val1, $sessionClass::reporticoNamespace(), "latestRequest");
                                $sessionClass::setReporticoSessionParam("MANUAL_" . $col->query_name . "_TODATE", $val1, $sessionClass::reporticoNamespace(), "latestRequest");
                                $sessionClass::setReporticoSessionParam("MANUAL_" . $col->query_name, $val1, $sessionClass::reporticoNamespace(), "latestRequest");
                            }
                        }
                    } else {
                        $_REQUEST["MANUAL_" . $col->query_name] = $criteriaval;
                        if ($sessionClass::getReporticoSessionParam('latestRequest')) {
                            $sessionClass::setReporticoSessionParam("MANUAL_" . $col->query_name, $val1, $sessionClass::reporticoNamespace(), "latestRequest");
                        }
                    }
                }
            }

            // Fetch the criteria value summary if required for displaying
            // the criteria entry summary at top of report
            if ($execute_mode && $execute_mode != "MAINTAIN" && $this->target_show_criteria &&
                ((array_key_exists($col->query_name, $_REQUEST) && !(is_array($_REQUEST[$col->query_name]) && $_REQUEST[$col->query_name][0] == ""))
                    || array_key_exists("MANUAL_" . $col->query_name, $_REQUEST)
                    || array_key_exists("HIDDEN_" . $col->query_name, $_REQUEST)
                )) {
                $lq = &$this->lookup_queries[$col->query_name];
                if ($lq->criteria_type == "LOOKUP") {
                    $lq->executeCriteriaLookup();
                }

                $lq->criteriaSummaryDisplay();
                $identified_criteria = true;
            }

            if (array_key_exists($col->query_name, $_REQUEST)) {
                // Since using Select2, we find unselected list boxes still send an empty array with a single character which we dont want to include
                // as a criteria selection
                if (!(is_array($_REQUEST[$col->query_name]) && $_REQUEST[$col->query_name][0] == "")) {
                    $this->lookup_queries[$col->query_name]->column_value =
                    $_REQUEST[$col->query_name];
                }

            }

            if (array_key_exists("MANUAL_" . $col->query_name, $_REQUEST)) {
                $this->lookup_queries[$col->query_name]->column_value =
                $_REQUEST["MANUAL_" . $col->query_name];

                $lq = &$this->lookup_queries[$col->query_name];
                if ($lq->criteria_type == "LOOKUP" && $_REQUEST["MANUAL_" . $col->query_name]) {
                    if (array_key_exists("MANUAL_" . $col->query_name, $_REQUEST)) {
                        foreach ($lq->lookup_query->columns as $k => $col1) {
                            if ($col1->lookup_display_flag) {
                                $lab = &$lq->lookup_query->columns[$k];
                            }

                            if ($col1->lookup_return_flag) {
                                $ret = &$lq->lookup_query->columns[$k];
                            }

                            if ($col1->lookup_abbrev_flag) {
                                $abb = &$lq->lookup_query->columns[$k];
                            }

                        }
                    }

                    if ($abb && $ret && $abb->query_name != $ret->query_name) {
                        if (!$identified_criteria) {
                            $lq->executeCriteriaLookup();
                        }

                        $res = &$lq->lookup_query->targets[0]->results;
                        $choices = $lq->column_value;
                        if (!is_array($choices)) {
                            $choices = explode(',', $choices);
                        }

                        $lq->column_value;
                        $choices = array_unique($choices);
                        $target_choices = array();
                        foreach ($choices as $k => $v) {
                            if (isset($res[$abb->query_name])) {
                                foreach ($res[$abb->query_name] as $k1 => $v1) {
                                    //echo "$v1 / $v<br>";
                                    if ($v1 == $v) {
                                        $target_choices[] = $res[$ret->query_name][$k1];
                                        //echo "$k -> ".$choices[$k]."<BR>";
                                    }
                                }
                            }

                        }
                        $choices = $target_choices;
                        $lq->column_value = implode(",", $choices);

                        if (!$choices) {
                            // Need to set the column value to a arbitrary value when no data found
                            // matching users MANUAL entry .. if left blank then would not bother
                            // creating where clause entry
                            $lq->column_value = "(NOTFOUND)";
                        }
                        $_REQUEST["HIDDEN_" . $col->query_name] = $choices;
                    } else {
                        if (!is_array($_REQUEST["MANUAL_" . $col->query_name])) {
                            $_REQUEST["HIDDEN_" . $col->query_name] = explode(",", $_REQUEST["MANUAL_" . $col->query_name]);
                        } else {
                            $_REQUEST["HIDDEN_" . $col->query_name] = $_REQUEST["MANUAL_" . $col->query_name];
                        }

                    }
                }
            }

            if (array_key_exists($col->query_name . "_FROMDATE_DAY", $_REQUEST)) {
                $this->lookup_queries[$col->query_name]->column_value =
                $this->lookup_queries[$col->query_name]->collateRequestDate(
                    $col->query_name, "FROMDATE",
                    $this->lookup_queries[$col->query_name]->column_value,
                    ReporticoApp::getConfig("prep_dateformat"));
            }

            if (array_key_exists($col->query_name . "_TODATE_DAY", $_REQUEST)) {
                $this->lookup_queries[$col->query_name]->column_value2 =
                $this->lookup_queries[$col->query_name]->collateRequestDate(
                    $col->query_name, "TODATE",
                    $this->lookup_queries[$col->query_name]->column_value2,
                    ReporticoApp::getConfig("prep_dateformat"));
            }

            if (array_key_exists("MANUAL_" . $col->query_name . "_FROMDATE", $_REQUEST)) {
                $this->lookup_queries[$col->query_name]->column_value =
                $_REQUEST["MANUAL_" . $col->query_name . "_FROMDATE"];

            }

            if (array_key_exists("MANUAL_" . $col->query_name . "_TODATE", $_REQUEST)) {
                $this->lookup_queries[$col->query_name]->column_value2 =
                $_REQUEST["MANUAL_" . $col->query_name . "_TODATE"];
            }

            if (array_key_exists("EXPANDED_" . $col->query_name, $_REQUEST)) {
                $this->lookup_queries[$col->query_name]->column_value =
                $_REQUEST["EXPANDED_" . $col->query_name];
            }

        }

        // If external page has supplied an initial output format then use it
        if ($this->initial_output_format) {
            $_REQUEST["target_format"] = $this->initial_output_format;
        }

        // If printable HTML requested force output type to HTML
        if (ReporticoUtility::getRequestItem("printable_html")) {
            $_REQUEST["target_format"] = "HTML";
        }

        // Prompt user for report destination if target not already set - default to HTML if not set
        if (!array_key_exists("target_format", $_REQUEST) && $execute_mode == "EXECUTE") {
            $_REQUEST["target_format"] = "HTML";
        }


        if (array_key_exists("target_format", $_REQUEST) && $execute_mode == "EXECUTE" && count($this->targets) == 0) {
            $tf = $_REQUEST["target_format"];
            if (isset($_GET["target_format"])) {
                $tf = $_GET["target_format"];
            }
            $this->target_format = strtolower($tf);

            if ($this->target_format == "pdf") {
                $this->pdf_engine_file = "Report" . strtoupper($this->pdf_engine) . ".php";
                if ( $this->pdf_engine == "phantomjs" ) {
                    require_once "ReportPhantomJSPDF.php";
                }
                else
                    require_once $this->pdf_engine_file;
            } 
            else {
                require_once "Report" . ucwords($this->target_format) . ".php";
            }


            $this->target_format = strtoupper($tf);
            //$this->target_format = "HTML2PDF";
            switch ($tf) {
                case "CSV":
                case "csv":
                case "Microsoft Excel":
                case "EXCEL":
                    $rep = new ReportCsv();
                    $this->addTarget($rep);
                    $rep->setQuery($this);
                    break;

                case "soap":
                case "SOAP":
                    $rep = new ReportSoapTemplate();
                    $this->addTarget($rep);
                    $rep->setQuery($this);
                    break;

                case "html":
                case "HTML":
                    $rep = new ReportHtml();
                    $this->addTarget($rep);
                    $rep->setQuery($this);
                    break;

                case "htmlpdf":
                case "HTML2PDF":
                    $rep = new ReportHtml2pdf();
                    $this->addTarget($rep);
                    $rep->setQuery($this);
                    break;

                case "htmlgrid":
                case "HTMLGRID":
                    $rep = new ReportHtml_grid_template();
                    $this->addTarget($rep);
                    $rep->setQuery($this);
                    break;

                case "pdf":
                case "PDF":
                    if ($this->pdf_engine == "phantomjs") {
                        $rep = new ReportPhantomJSPDF();
                    } else if ($this->pdf_engine == "tcpdf") {
                        $rep = new ReportTCPDF();
                    } else {
                        $rep = new ReportFPDF();
                    }

                    $rep->page_length = 80;
                    $this->addTarget($rep);
                    $rep->setQuery($this);
                    break;

                case "json":
                case "JSON":
                    $rep = new ReportJson();
                    $rep->page_length = 80;
                    $this->addTarget($rep);
                    $rep->setQuery($this);
                    break;

                case "jquerygrid":
                case "JQUERYGRID":
                    $rep = new ReportJQueryGrid();
                    $rep->page_length = 80;
                    $this->addTarget($rep);
                    $rep->setQuery($this);
                    break;

                case "xml":
                case "XML":
                    $rep = new ReportXml();
                    $rep->page_length = 80;
                    $this->addTarget($rep);
                    $rep->setQuery($this);
                    break;

                //case "array" :
                case "ARRAY":
                    $rep = new ReportArray();
                    $rep->page_length = 80;
                    $this->addTarget($rep);
                    $rep->setQuery($this);
                    break;

                default:
                    // Should not get here
            }
        }

        if (array_key_exists("mailto", $_REQUEST)) {
            $this->email_recipients = $_REQUEST["mailto"];
        }

    }
720769
protected void onColumn(EntityMetadata m, boolean isRelation, List<String> relations, List<Object> entities,
        List<Column> columns, List<AbstractManagedType> subManagedType, ByteBuffer key) {
        if (!columns.isEmpty()) {
            Object id = PropertyAccessorHelper.getObject(m.getIdAttribute().getJavaType(), key.array());
            ThriftRow tr = new ThriftRow(id, m.getTableName(), columns, new ArrayList<SuperColumn>(0),
                new ArrayList<CounterColumn>(0), new ArrayList<CounterSuperColumn>(0));
            Object o = null;

            if (!subManagedType.isEmpty()) {
                for (AbstractManagedType subEntity : subManagedType) {
                    EntityMetadata subEntityMetadata =
                        KunderaMetadataManager.getEntityMetadata(kunderaMetadata, subEntity.getJavaType());

                    o = getDataHandler().populateEntity(tr, subEntityMetadata, KunderaCoreUtils.getEntity(o),
                        subEntityMetadata.getRelationNames(), isRelation);
                    if (o != null) {
                        break;
                    }
                }
            } else {
                o = getDataHandler().populateEntity(tr, m, KunderaCoreUtils.getEntity(o), relations, isRelation);
            }

            if (log.isInfoEnabled()) {
                log.info("Populating data for entity of clazz {} and row key {}.", m.getEntityClazz(), tr.getId());
            }

            if (o != null) {
                entities.add(o);
            }
        }
    }
662729
function Context() {
	/**
	 * @member {Object}
	 * @property {Object} client
	 * @property {Object<Call>} client.map - map from call name and call id
	 * @property {Array<Call>} client.list
	 * @property {Object} server
	 * @property {Object<Call>} server.map - map from call name and call id
	 * @property {Array<Call>} server.list
	 * @private
	 */
	this._calls = {
		client: {
			map: Object.create(null),
			list: []
		},
		server: {
			map: Object.create(null),
			list: []
		}
	}

	/**
	 * @member {Object}
	 * @property {Object} client
	 * @property {Object<Message>} client.map - map from message name and message id
	 * @property {Array<Message>} client.list
	 * @property {Object} server
	 * @property {Object<Message>} server.map - map from message name and message id
	 * @property {Array<Message>} server.list
	 * @private
	 */
	this._messages = {
		client: {
			map: Object.create(null),
			list: []
		},
		server: {
			map: Object.create(null),
			list: []
		}
	}
}
801860
public function init()
	{
		if($this->nextPageLabel===null)
			$this->nextPageLabel=Yii::t('yii','Next &gt;');
		if($this->prevPageLabel===null)
			$this->prevPageLabel=Yii::t('yii','&lt; Previous');
		if($this->firstPageLabel===null)
			$this->firstPageLabel=Yii::t('yii','&lt;&lt; First');
		if($this->lastPageLabel===null)
			$this->lastPageLabel=Yii::t('yii','Last &gt;&gt;');
		if($this->header===null)
			$this->header=Yii::t('yii','Go to page: ');

		if(!isset($this->htmlOptions['id']))
			$this->htmlOptions['id']=$this->getId();
		if(!isset($this->htmlOptions['class']))
			$this->htmlOptions['class']='yiiPager';
	}
202558
public function initializeObject()
    {
        if ($this->cache->has('parsedFormats') && $this->cache->has('parsedFormatsIndices') && $this->cache->has('localizedSymbols')) {
            $this->parsedFormats = $this->cache->get('parsedFormats');
            $this->parsedFormatsIndices = $this->cache->get('parsedFormatsIndices');
            $this->localizedSymbols = $this->cache->get('localizedSymbols');
        }
    }
1009299
public function join($element)
	{
		if($element->slave!==null)
			$this->join($element->slave);
		if(!empty($element->relation->select))
			$this->selects[]=$element->getColumnSelect($element->relation->select);
		$this->conditions[]=$element->relation->condition;
		$this->orders[]=$element->relation->order;
		$this->joins[]=$element->getJoinCondition();
		$this->joins[]=$element->relation->join;
		$this->groups[]=$element->relation->group;
		$this->havings[]=$element->relation->having;

		if(is_array($element->relation->params))
		{
			if(is_array($this->params))
				$this->params=array_merge($this->params,$element->relation->params);
			else
				$this->params=$element->relation->params;
		}
		$this->elements[$element->id]=true;
	}
734008
public function execute()
    {
        $this->insertID = $this->table->insertOne($this->context + $this->data);
        parent::execute();
    }
1107878
public void init() {
    initConfigurators();
    configuratorsBeforeInit();
    initHistoryLevel();
    initExpressionManager();

    if (usingRelationalDatabase) {
      initDataSource();
    }

    initAgendaFactory();
    initHelpers();
    initVariableTypes();
    initBeans();
    initScriptingEngines();
    initClock();
    initBusinessCalendarManager();
    initCommandContextFactory();
    initTransactionContextFactory();
    initCommandExecutors();
    initServices();
    initIdGenerator();
    initBehaviorFactory();
    initListenerFactory();
    initBpmnParser();
    initProcessDefinitionCache();
    initProcessDefinitionInfoCache();
    initKnowledgeBaseCache();
    initJobHandlers();
    initJobManager();
    initAsyncExecutor();

    initTransactionFactory();

    if (usingRelationalDatabase) {
      initSqlSessionFactory();
    }

    initSessionFactories();
    initDataManagers();
    initEntityManagers();
    initHistoryManager();
    initJpa();
    initDeployers();
    initDelegateInterceptor();
    initEventHandlers();
    initFailedJobCommandFactory();
    initEventDispatcher();
    initProcessValidator();
    initDatabaseEventLogging();
    configuratorsAfterInit();
  }
91524
public function init() {
        parent::init();
        $this->db = Instance::ensure($this->db, Connection::className());
        $this->db->getCollection($this->itemTable)->createIndex(['name' => 1], ['unique' => true]);
        $this->db->getCollection($this->ruleTable)->createIndex(['name' => 1], ['unique' => true]);
    }
1342485
public function init()
	{
		parent::init();

		$db=$this->getDbConnection();
		$db->setActive(true);
		if($this->autoCreateCacheTable)
		{
			$sql="DELETE FROM {$this->cacheTableName} WHERE expire>0 AND expire<".time();
			try
			{
				$db->createCommand($sql)->execute();
			}
			catch(Exception $e)
			{
				$this->createCacheTable($db,$this->cacheTableName);
			}
		}
	}
1033482
public function process()
    {
        parent::process();

        if ($this->value === null) {
            return;
        }

        try {
            $integer_value = $this->getNumericValue($this->value);

            if ($integer_value === null) {
                $this->addMessage($this->getValidationMessage('integer'));
            } else {
                $this->value = $integer_value;
            }
        } catch (SwatIntegerOverflowException $e) {
            if ($e->getSign() > 0) {
                $this->addMessage(
                    $this->getValidationMessage('integer-maximum')
                );
            } else {
                $this->addMessage(
                    $this->getValidationMessage('integer-minimum')
                );
            }

            $integer_value = null;
        }
    }
617827
public function initialize()
    {
        if ($this->isInitialize) {
            return ;
        }

        $this->isInitialize = true;

        $this->getEventManager()->trigger(self::EVENT_INITIALIZE, $this);
    }
228964
public function initialize()
    {
        $this->data = new stdClass();
        $this->data->type = null;
        $this->data->createdAt = null;
        $this->data->descriotion = null;
    }
6957
private void init() {
        quantiles = new double[data.length][8];
        for (int i = 0; i < data.length; i++) {
            int n = data[i].length;
            Arrays.sort(data[i]);
            quantiles[i][1] = data[i][n / 4];
            quantiles[i][2] = data[i][n / 2];
            quantiles[i][3] = data[i][3 * n / 4];
            quantiles[i][5] = quantiles[i][3] - quantiles[i][1]; // interquartile range
            quantiles[i][6] = quantiles[i][1] - 1.5 * quantiles[i][5];
            quantiles[i][7] = quantiles[i][3] + 1.5 * quantiles[i][5];
            quantiles[i][0] = quantiles[i][6] < data[i][0] ? data[i][0] : quantiles[i][6];
            quantiles[i][4] = quantiles[i][7] > data[i][data[i].length - 1] ? data[i][data[i].length - 1] : quantiles[i][7];
        }
    }
649406
protected function initItems()
	{
		$initItems = null;
		
		if ($this->items != null)
		{
			foreach ($this->items as $item)
			{
				if (isset($item['value']))
				{
					$i = $item['value'];
					unset($item['value']);
					$initItems[$i] = $item;
				}
				else 
				{
					$initItems = $this->items;	
				}
			}
			
			$this->items = array_replace($this->defaults, $initItems);
		}
		else 
		{
			$this->items = $this->defaults;
		}
	}
1317871
public function done()
    {
        if ($this->watcher) {
            if ($this->watcher->count > 0) {
                $this->watcher->count--;
            }
            
            $this->watcher = null;
        }
    }
670056
public function init()
    {
        parent::init();

        if (is_array($this->pager) && !ArrayHelper::keyExists('class', $this->pager)) {
            $this->pager = [
                'class' => LinkPager::class,
            ];
        }
    }