Exemple #1
0
 public static function ReportGrouping(Vtiger_Request $request, $viewer)
 {
     //error_reporting(63);ini_set("display_errors",1);
     //global $adb;$adb->setDebug(true);
     $moduleName = $request->getModule();
     $record = $request->get('record');
     $R_Data = $request->getAll();
     $viewer->assign("MODULE", $moduleName);
     $reportModel = ITS4YouReports_Record_Model::getCleanInstance($record);
     if ($request->has("primarymodule") && !$request->isEmpty("primarymodule")) {
         $primary_moduleid = $request->get("primarymodule");
         $primary_module = vtlib_getModuleNameById($primary_moduleid);
     } else {
         $primary_module = $reportModel->getPrimaryModule();
         $primary_moduleid = $reportModel->getPrimaryModuleId();
     }
     // $primarymodule = $reportModel->getPrimaryModule();
     // $primarymoduleid = $reportModel->getPrimaryModuleId();
     $reportModel->module_list = $reportModel->report->module_list;
     $primary_df_arr = getPrimaryTLStdFilter($primary_module, $this);
     $date_options = array();
     if (!empty($primary_df_arr)) {
         foreach ($primary_df_arr as $val_arr) {
             foreach ($val_arr as $val_dtls) {
                 $date_options[] = $val_dtls["value"];
             }
         }
     }
     $date_options_json = Zend_JSON::encode($date_options);
     $viewer->assign("date_options_json", $date_options_json);
     $timelinecolumn = $reportModel->getTimeLineColumnHTML();
     $viewer->assign("timelinecolumn", $timelinecolumn);
     $Report_Informations = array();
     $secondarymodule = '';
     $secondarymodules = array();
     if ($record != "") {
         $Report_Informations = $reportModel->getReportInformations();
         if ($request->has('summaries_limit') && !$request->isEmpty('summaries_limit')) {
             $summaries_limit = $request->get("summaries_limit");
         } else {
             $summaries_limit = $Report_Informations["summaries_limit"];
         }
     } else {
         $summaries_limit = "20";
     }
     $viewer->assign("SUMMARIES_LIMIT", $summaries_limit);
     if ($primary_module != "") {
         $reportModel->getPriModuleColumnsList($primary_module);
         foreach ($reportModel->report->related_modules[$primary_module] as $key => $secmodid) {
             $rp = $reportModel->report->getSecModuleColumnsList($secmodid["id"]);
             if (!in_array($secmodid["id"], $reportModel->report->relatedmodulesarray)) {
                 $reportModel->report->relatedmodulesarray[] = $secmodid["id"];
             }
         }
     }
     for ($tc_i = 1; $tc_i < 4; $tc_i++) {
         $timelinecol = $selected_timeline_column = "";
         if ($request->has("group{$tc_i}") && !$request->isEmpty("group{$tc_i}")) {
             $group = $request->get("group{$tc_i}");
             $selected_timeline_column = $request->get("timeline_column{$tc_i}");
         } else {
             $group = $Report_Informations["Group{$tc_i}"];
             $selected_timeline_column = $Report_Informations["timeline_columnstr{$tc_i}"];
         }
         if (isset($selected_timeline_column) && !in_array($selected_timeline_column, array("", "none", "@vlv@"))) {
             $timelinecol = $reportModel->getTimeLineColumnHTML($tc_i, $selected_timeline_column);
             $viewer->assign("timelinecolumn" . $tc_i . "_html", $timelinecol);
         }
         $RG_BLOCK = getPrimaryColumns_GroupingHTML($primary_module, $group, $reportModel->report);
         if (!empty($reportModel->report->relatedmodulesarray)) {
             foreach ($reportModel->report->relatedmodulesarray as $secmodid) {
                 $secmodule_arr = explode("x", $secmodid);
                 $module_id = $secmodule_arr[0];
                 $field_id = isset($secmodule_arr[1]) && $secmodule_arr[1] != "" ? $secmodule_arr[1] : "";
                 if ($field_id != "MIF") {
                     // getSecondaryColumns_GroupingHTML($moduleid, $selected = "", $ogReport = "") -> return $shtml;
                     $RG_BLOCK .= getSecondaryColumns_GroupingHTML($secmodid, $group, $reportModel->report);
                 }
             }
         }
         // ITS4YOU-UP SlOl |24.8.2015 11:09
         // ITS4YOU-END
         $viewer->assign("RG_BLOCK{$tc_i}", $RG_BLOCK);
         if ($tc_i > 1) {
             if ($request->has("timeline_type{$tc_i}") && !$request->isEmpty("timeline_type{$tc_i}")) {
                 $timeline_type = $request->get("timeline_type{$tc_i}");
             } else {
                 $timeline_type = $Report_Informations["timeline_type{$tc_i}"];
             }
             $viewer->assign("timeline_type{$tc_i}", $timeline_type);
         }
     }
     //ITS4YouReports::sshow($RG_BLOCK);
     for ($sci = 1; $sci < 4; $sci++) {
         if ($request->has("sort{$sci}") && !$request->isEmpty("sort{$sci}")) {
             $sortorder = $request->get("sort{$sci}");
         } else {
             $sortorder = $Report_Informations["Sort" . $sci];
         }
         $sa = $sd = "";
         if ($sortorder == "Descending") {
             $sd = " selected='selected' ";
         } elseif ($sortorder == "Ascending") {
             $ss = " selected='selected' ";
         }
         /*
         $shtml =  '<input type="radio" id="Sort'.$sci.'a" name="Sort'.$sci.'" value="Ascending" '.$sa.'>'.vtranslate('Ascending').' &nbsp; 
                   <input type="radio" id="Sort'.$sci.'d" name="Sort'.$sci.'" value="Descending" '.$sd.'>'.vtranslate('Descending');
         */
         $shtml = '<select id="Sort' . $sci . '" name="Sort' . $sci . '" class="txtBox" style="float:left;width:8em;margin:auto;" >
                 <option value="Ascending" ' . $sa . ' >' . vtranslate('Ascending', $moduleName) . '</option>
                 <option value="Descending" ' . $sd . ' >' . vtranslate('Descending', $moduleName) . '</option>
             </select>';
         $viewer->assign("ASCDESC" . $sci, $shtml);
     }
     $module_id = $primary_moduleid;
     $modulename_prefix = "";
     $module_array["module"] = $primary_module;
     $module_array["id"] = $module_id;
     $selectedmodule = $module_array["id"];
     $modulename = $module_array["module"];
     $modulename_lbl = getTranslatedString($modulename, $modulename);
     $availModules[$module_array["id"]] = $modulename_lbl;
     $modulename_id = $module_array["id"];
     if (isset($selectedmodule)) {
         $secondarymodule_arr = $reportModel->getReportRelatedModules($module_array["id"]);
         $reportModel->getSecModuleColumnsList($selectedmodule);
         $RG_BLOCK4 = sgetSummariesHTMLOptions($module_array["id"], $module_id);
         $available_modules[] = array("id" => $module_id, "name" => $modulename_lbl, "checked" => "checked");
         foreach ($secondarymodule_arr as $key => $value) {
             $exploded_mid = explode("x", $value["id"]);
             if (strtolower($exploded_mid[1]) != "mif") {
                 $available_modules[] = array("id" => $value["id"], "name" => "- " . $value["name"], "checked" => "");
             }
         }
         $viewer->assign("RG_BLOCK4", $RG_BLOCK4);
     }
     $viewer->assign("SummariesModules", $available_modules);
     $SumOptions = sgetSummariesOptions($selectedmodule);
     if (empty($SumOptions)) {
         $SumOptions = getTranslatedString("NO_SUMMARIES_COLUMNS", $currentModule);
     }
     $SPSumOptions[$module_array["id"]][$module_array["id"]] = $SumOptions;
     $viewer->assign("SUMOPTIONS", $SPSumOptions);
     if ($request->has("selectedSummariesString")) {
         $selectedSummariesString = $request->get("selectedSummariesString");
         //$selectedSummariesString = str_replace("@AMPKO@", "&", $selectedSummariesString);
         $selectedSummariesString = str_replace("&", "@AMPKO@", $selectedSummariesString);
         $selectedSummariesArr = explode(";", $selectedSummariesString);
         $summaries_orderby = vtlib_purify($request->get("summaries_orderby"));
         $RG_BLOCK6 = sgetSelectedSummariesHTMLOptions($selectedSummariesArr, $summaries_orderby);
     } else {
         if (!empty($Report_Informations["summaries_columns"])) {
             foreach ($Report_Informations["summaries_columns"] as $key => $summaries_columns_arr) {
                 $selectedSummariesArr[] = $summaries_columns_arr["columnname"];
             }
             if ($selectedSummariesString != "") {
                 $selectedSummariesString = implode(";", $selectedSummariesString);
             }
         }
         $summaries_orderby = "";
         if (isset($Report_Informations["summaries_orderby_columns"][0]) && $Report_Informations["summaries_orderby_columns"][0] != "") {
             $summaries_orderby = $Report_Informations["summaries_orderby_columns"][0];
         }
         $RG_BLOCK6 = sgetSelectedSummariesHTMLOptions($selectedSummariesArr, $summaries_orderby);
     }
     // sum_group_columns for group filters start
     $sm_arr = sgetSelectedSummariesOptions($selectedSummariesArr);
     $sm_str = "";
     if (!empty($sm_arr)) {
         foreach ($sm_arr as $key => $opt_arr) {
             if ($sm_str != "") {
                 $sm_str .= "(|@!@|)";
             }
             $sm_str .= $opt_arr["value"] . "(|@|)" . $opt_arr["text"];
         }
     }
     $viewer->assign("sum_group_columns", $sm_str);
     // sum_group_columns for group filters end
     $viewer->assign("selectedSummariesString", $selectedSummariesString);
     $viewer->assign("RG_BLOCK6", $RG_BLOCK6);
     $RG_BLOCKx2 = array();
     $all_fields_str = "";
     foreach ($SPSumOptions as $module_key => $SumOptions) {
         $RG_BLOCKx2 = "";
         $r_modulename = vtlib_getModuleNameById($module_key);
         $r_modulename_lbl = getTranslatedString($r_modulename, $r_modulename);
         foreach ($SumOptions as $SumOptions_key => $SumOptions_value) {
             if (is_array($SumOptions_value)) {
                 foreach ($SumOptions_value as $optgroup => $optionsdata) {
                     if ($RG_BLOCKx2 != "") {
                         $RG_BLOCKx2 .= "(|@!@|)";
                     }
                     $RG_BLOCKx2 .= $optgroup;
                     $RG_BLOCKx2 .= "(|@|)";
                     $RG_BLOCKx2 .= Zend_JSON::encode($optionsdata);
                 }
             } else {
                 $RG_BLOCKx2 .= $SumOptions_value;
                 $RG_BLOCKx2 .= "(|@|)";
                 $optionsdata[] = array("value" => "none", "text" => getTranslatedString("LBL_NONE", $currentModule));
                 $RG_BLOCKx2 .= Zend_JSON::encode($optionsdata);
             }
             $all_fields_str .= $module_key . "(!#_ID@ID_#!)" . $r_modulename_lbl . "(!#_ID@ID_#!)" . $RG_BLOCKx2;
         }
     }
     $viewer->assign("ALL_FIELDS_STRING", $all_fields_str);
     // ITS4YOU-END 5. 3. 2014 14:50:47  SUMMARIES END
     if ($request->has("summaries_orderby") && !$request->isEmpty("summaries_orderby")) {
         $summaries_orderby = $request->get("summaries_orderby");
         $summaries_orderby_type = $request->get("summaries_orderby_type");
     } elseif (isset($Report_Informations["summaries_orderby_columns"]) && !empty($Report_Informations["summaries_orderby_columns"])) {
         $summaries_orderby = $Report_Informations["summaries_orderby_columns"][0]["column"];
         $summaries_orderby_type = $Report_Informations["summaries_orderby_columns"][0]["type"];
     } else {
         $summaries_orderby = "none";
         $summaries_orderby_type = "ASC";
     }
     $viewer->assign("summaries_orderby", $summaries_orderby);
     $viewer->assign("summaries_orderby_type", $summaries_orderby_type);
     return $viewer->view('ReportGrouping.tpl', $moduleName, true);
 }
    public function getSelectedValuesToSmarty($smarty_obj = "", $step_name = "")
    {
        if ($smarty_obj != "" && $step_name != "") {
            global $app_strings;
            global $mod_strings;
            global $default_charset;
            global $current_language;
            global $image_path;
            global $theme;
            $theme_path = "themes/" . $theme . "/";
            $image_path = $theme_path . "images/";
            $smarty_obj->assign("THEME", $theme_path);
            $smarty_obj->assign("IMAGE_PATH", $image_path);
            $adb = PEARDatabase::getInstance();
            $get_all_steps = "all";
            if (isset($_REQUEST["record"]) && $_REQUEST['record'] != '') {
                $recordid = vtlib_purify($_REQUEST["record"]);
            } else {
                $recordid = "";
            }
            $smarty_obj->assign("RECORDID", $recordid);
            $smarty_obj->assign("DISPLAY_FILTER_HEADER", false);
            if (in_array($step_name, array("ReportsStep1"))) {
                if (isset($_REQUEST["reportname"]) && $_REQUEST["reportname"] != "") {
                    $reportname = htmlspecialchars(vtlib_purify($_REQUEST["reportname"]));
                } else {
                    $reportname = $this->reportinformations["reports4youname"];
                }
                $smarty_obj->assign("REPORTNAME", $reportname);
                if (isset($_REQUEST["reportdesc"]) && $_REQUEST["reportdesc"] != "") {
                    $reportdesc = htmlspecialchars(vtlib_purify($_REQUEST["reportdesc"]));
                } else {
                    $reportdesc = $this->reportinformations["reportdesc"];
                }
                $smarty_obj->assign("REPORTDESC", $reportdesc);
                $smarty_obj->assign("REP_MODULE", $this->reportinformations["primarymodule"]);
                $smarty_obj->assign("PRIMARYMODULES", $this->getPrimaryModules());
                $smarty_obj->assign("REP_FOLDERS", $this->getReportFolders());
                if (isset($this->primarymodule) && $this->primarymodule != '') {
                    $rel_modules = $this->getReportRelatedModules($this->primarymoduleid);
                    foreach ($rel_modules as $key => $relmodule) {
                        $restricted_modules .= $relmodule['id'] . ":";
                    }
                    $smarty_obj->assign("REL_MODULES_STR", trim($restricted_modules, ":"));
                    $smarty_obj->assign("RELATEDMODULES", $rel_modules);
                }
                $smarty_obj->assign("FOLDERID", vtlib_purify($_REQUEST['folder']));
            }
            if (in_array($step_name, array("ReportsStep2", $get_all_steps))) {
                if (isset($this->primarymodule) && $this->primarymodule != '') {
                    $rel_modules = $this->getReportRelatedModules($this->primarymoduleid);
                    foreach ($rel_modules as $key => $relmodule) {
                        $restricted_modules .= $relmodule['id'] . ":";
                    }
                    $smarty_obj->assign("REL_MODULES_STR", trim($restricted_modules, ":"));
                    $smarty_obj->assign("RELATEDMODULES", $rel_modules);
                }
            }
            if (in_array($step_name, array("ReportGrouping", $get_all_steps))) {
                // TIMELINE COLUMNS DEFINITION CHANGED New Code 13.5.2014 11:58
                // ITS4YOU-CR SlOl | 13.5.2014 11:53
                if (isset($_REQUEST["primarymodule"]) && $_REQUEST["primarymodule"] != "") {
                    $primary_moduleid = $_REQUEST["primarymodule"];
                    $primary_module = vtlib_getModuleNameById($_REQUEST["primarymodule"]);
                    if (vtlib_isModuleActive($primary_module)) {
                        $primary_df_arr = getPrimaryTLStdFilter($primary_module, $this);
                    }
                } else {
                    $primary_module = $this->primarymodule;
                    $primary_moduleid = $this->primarymoduleid;
                    $primary_df_arr = getPrimaryTLStdFilter($primary_module, $this);
                }
                $date_options = array();
                if (!empty($primary_df_arr)) {
                    foreach ($primary_df_arr as $val_arr) {
                        foreach ($val_arr as $val_dtls) {
                            $date_options[] = $val_dtls["value"];
                        }
                    }
                }
                $date_options_json = Zend_JSON::encode($date_options);
                $smarty_obj->assign("date_options_json", $date_options_json);
                $timelinecolumn = $this->getTimeLineColumnHTML();
                $smarty_obj->assign("timelinecolumn", $timelinecolumn);
                // ITS4YOU-END 13.5.2014 11:53
                if (isset($_REQUEST["record"]) && $_REQUEST['record'] != '') {
                    $reportid = vtlib_purify($_REQUEST["record"]);
                    $secondarymodule = '';
                    $secondarymodules = array();
                    if (!empty($this->related_modules[$primary_module])) {
                        foreach ($this->related_modules[$primary_module] as $key => $value) {
                            if (isset($_REQUEST["secondarymodule_" . $value])) {
                                $secondarymodules[] = vtlib_purify($_REQUEST["secondarymodule_" . $value]);
                            }
                        }
                    }
                    if ($primary_moduleid == getTabid('Invoice')) {
                        $secondarymodules[] = getTabid('Products');
                        $secondarymodules[] = getTabid('Services');
                    }
                    $secondarymodule = implode(":", $secondarymodules);
                    if ($secondarymodule != '') {
                        $this->secondarymodules .= $secondarymodule;
                    }
                    if (isset($_REQUEST["summaries_limit"])) {
                        $summaries_limit = vtlib_purify($_REQUEST["summaries_limit"]);
                    } else {
                        $summaries_limit = $this->reportinformations["summaries_limit"];
                    }
                } else {
                    $secondarymodule = '';
                    $secondarymodules = array();
                    $this->getPriModuleColumnsList($primary_module);
                    foreach ($this->secondarymodules as $key => $secmodid) {
                        $this->getSecModuleColumnsList(vtlib_getModuleNameById($secmodid));
                    }
                    $summaries_limit = "20";
                }
                $smarty_obj->assign("SUMMARIES_MAX_LIMIT", $summaries_limit);
                for ($tc_i = 1; $tc_i < 4; $tc_i++) {
                    $timelinecol = $selected_timeline_column = "";
                    if (isset($_REQUEST["group{$tc_i}"]) && $_REQUEST["group{$tc_i}"] != "" && $step_name != "ReportGrouping") {
                        $group = vtlib_purify($_REQUEST["group{$tc_i}"]);
                        if (isset($_REQUEST["timeline_column{$tc_i}"]) && $_REQUEST["timeline_column{$tc_i}"] != "") {
                            $selected_timeline_column = vtlib_purify($_REQUEST["timeline_column{$tc_i}"]);
                        }
                    } else {
                        $group = $this->reportinformations["Group{$tc_i}"];
                        $selected_timeline_column = $this->reportinformations["timeline_columnstr{$tc_i}"];
                    }
                    if (isset($selected_timeline_column) && !in_array($selected_timeline_column, array("", "none", "@vlv@"))) {
                        $timelinecol = $this->getTimeLineColumnHTML($tc_i, $selected_timeline_column);
                        $smarty_obj->assign("timelinecolumn" . $tc_i . "_html", $timelinecol);
                    }
                    $RG_BLOCK = getPrimaryColumns_GroupingHTML($primary_module, $group, $this);
                    $smarty_obj->assign("RG_BLOCK{$tc_i}", $RG_BLOCK);
                    if ($tc_i > 1) {
                        if (isset($_REQUEST["timeline_type{$tc_i}"]) && $_REQUEST["timeline_type{$tc_i}"] != "") {
                            $timeline_type = vtlib_purify($_REQUEST["timeline_type{$tc_i}"]);
                        } else {
                            $timeline_type = $this->reportinformations["timeline_type{$tc_i}"];
                        }
                        $smarty_obj->assign("timeline_type{$tc_i}", $timeline_type);
                    }
                }
                for ($sci = 1; $sci < 4; $sci++) {
                    if (isset($_REQUEST["sort" . $sci]) && $_REQUEST["sort" . $sci] != "") {
                        $sortorder = vtlib_purify($_REQUEST["sort" . $sci]);
                    } else {
                        $sortorder = $this->reportinformations["Sort" . $sci];
                    }
                    $sa = $sd = "";
                    if ($sortorder != "Descending") {
                        $sa = "checked";
                    } else {
                        $sd = "checked";
                    }
                    $shtml = '<input type="radio" id="Sort' . $sci . 'a" name="Sort' . $sci . '" value="Ascending" ' . $sa . '>' . vtranslate('Ascending') . ' &nbsp; 
				              <input type="radio" id="Sort' . $sci . 'd" name="Sort' . $sci . '" value="Descending" ' . $sd . '>' . vtranslate('Descending');
                    $smarty_obj->assign("ASCDESC" . $sci, $shtml);
                }
                // ITS4YOU-CR SlOl 5. 3. 2014 14:50:45 SUMMARIES START
                $module_id = $primary_moduleid;
                $modulename_prefix = "";
                $module_array["module"] = $primary_module;
                $module_array["id"] = $module_id;
                $selectedmodule = $module_array["id"];
                $modulename = $module_array["module"];
                $modulename_lbl = vtranslate($modulename, $modulename);
                $availModules[$module_array["id"]] = $modulename_lbl;
                $modulename_id = $module_array["id"];
                if (isset($selectedmodule)) {
                    $secondarymodule_arr = $this->getReportRelatedModules($module_array["id"]);
                    $this->getSecModuleColumnsList($selectedmodule);
                    $RG_BLOCK4 = sgetSummariesHTMLOptions($module_array["id"], $module_id);
                    $available_modules[] = array("id" => $module_id, "name" => $modulename_lbl, "checked" => "checked");
                    foreach ($secondarymodule_arr as $key => $value) {
                        $exploded_mid = explode("x", $value["id"]);
                        if (strtolower($exploded_mid[1]) != "mif") {
                            $available_modules[] = array("id" => $value["id"], "name" => "- " . $value["name"], "checked" => "");
                        }
                    }
                    $smarty_obj->assign("RG_BLOCK4", $RG_BLOCK4);
                }
                $smarty_obj->assign("SummariesModules", $available_modules);
                $SumOptions = sgetSummariesOptions($selectedmodule);
                if (empty($SumOptions)) {
                    $SumOptions = vtranslate("NO_SUMMARIES_COLUMNS", $this->currentModule);
                }
                $SPSumOptions[$module_array["id"]][$module_array["id"]] = $SumOptions;
                $smarty_obj->assign("SUMOPTIONS", $SPSumOptions);
                if (isset($_REQUEST["selectedSummariesString"])) {
                    $selectedSummariesString = vtlib_purify($_REQUEST["selectedSummariesString"]);
                    $selectedSummariesArr = explode(";", $selectedSummariesString);
                    $summaries_orderby = vtlib_purify($_REQUEST["summaries_orderby"]);
                    $RG_BLOCK6 = sgetSelectedSummariesHTMLOptions($selectedSummariesArr, $summaries_orderby);
                } else {
                    if (!empty($this->reportinformations["summaries_columns"])) {
                        foreach ($this->reportinformations["summaries_columns"] as $key => $summaries_columns_arr) {
                            $selectedSummariesArr[] = $summaries_columns_arr["columnname"];
                        }
                    }
                    $selectedSummariesString = implode(";", $selectedSummariesString);
                    $summaries_orderby = "";
                    if (isset($this->reportinformations["summaries_orderby_columns"][0]) && $this->reportinformations["summaries_orderby_columns"][0] != "") {
                        $summaries_orderby = $this->reportinformations["summaries_orderby_columns"][0];
                    }
                    $RG_BLOCK6 = sgetSelectedSummariesHTMLOptions($selectedSummariesArr, $summaries_orderby);
                }
                // sum_group_columns for group filters start
                $sm_arr = sgetSelectedSummariesOptions($selectedSummariesArr);
                $sm_str = "";
                foreach ($sm_arr as $key => $opt_arr) {
                    if ($sm_str != "") {
                        $sm_str .= "(|@!@|)";
                    }
                    $sm_str .= $opt_arr["value"] . "(|@|)" . $opt_arr["text"];
                }
                $smarty_obj->assign("sum_group_columns", $sm_str);
                // sum_group_columns for group filters end
                $smarty_obj->assign("selectedSummariesString", $selectedSummariesString);
                $smarty_obj->assign("RG_BLOCK6", $RG_BLOCK6);
                $RG_BLOCKx2 = array();
                $all_fields_str = "";
                foreach ($SPSumOptions as $module_key => $SumOptions) {
                    $RG_BLOCKx2 = "";
                    $r_modulename = vtlib_getModuleNameById($module_key);
                    $r_modulename_lbl = vtranslate($r_modulename, $r_modulename);
                    foreach ($SumOptions as $SumOptions_key => $SumOptions_value) {
                        if (is_array($SumOptions_value)) {
                            foreach ($SumOptions_value as $optgroup => $optionsdata) {
                                if ($RG_BLOCKx2 != "") {
                                    $RG_BLOCKx2 .= "(|@!@|)";
                                }
                                $RG_BLOCKx2 .= $optgroup;
                                $RG_BLOCKx2 .= "(|@|)";
                                $RG_BLOCKx2 .= Zend_JSON::encode($optionsdata);
                            }
                        } else {
                            $RG_BLOCKx2 .= $SumOptions_value;
                            $RG_BLOCKx2 .= "(|@|)";
                            $optionsdata[] = array("value" => "none", "text" => vtranslate("LBL_NONE", $this->currentModule));
                            $RG_BLOCKx2 .= Zend_JSON::encode($optionsdata);
                        }
                        $all_fields_str .= $module_key . "(!#_ID@ID_#!)" . $r_modulename_lbl . "(!#_ID@ID_#!)" . $RG_BLOCKx2;
                    }
                }
                $smarty_obj->assign("ALL_FIELDS_STRING", $all_fields_str);
                // ITS4YOU-END 5. 3. 2014 14:50:47  SUMMARIES END
                if (isset($_REQUEST["summaries_orderby"]) && $_REQUEST["summaries_orderby"] != "" && isset($_REQUEST["summaries_orderby_type"]) && $_REQUEST["summaries_orderby_type"] != "") {
                    $summaries_orderby = vtlib_purify($_REQUEST["summaries_orderby"]);
                    $summaries_orderby_type = vtlib_purify($_REQUEST["summaries_orderby_type"]);
                } elseif (isset($this->reportinformations["summaries_orderby_columns"]) && !empty($this->reportinformations["summaries_orderby_columns"])) {
                    $summaries_orderby = $this->reportinformations["summaries_orderby_columns"][0]["column"];
                    $summaries_orderby_type = $this->reportinformations["summaries_orderby_columns"][0]["type"];
                } else {
                    $summaries_orderby = "none";
                    $summaries_orderby_type = "ASC";
                }
                $smarty_obj->assign("summaries_orderby", $summaries_orderby);
                $smarty_obj->assign("summaries_orderby_type", $summaries_orderby_type);
            }
            if (in_array($step_name, array("ReportColumns", $get_all_steps))) {
                if (isset($_REQUEST["record"]) && $_REQUEST['record'] != '') {
                    $RC_BLOCK1 = getPrimaryColumnsHTML($this->primarymodule);
                    $secondarymodule = '';
                    $secondarymodules = array();
                    if (!empty($this->related_modules[$this->primarymodule])) {
                        foreach ($this->related_modules[$this->primarymodule] as $key => $value) {
                            if (isset($_REQUEST["secondarymodule_" . $value])) {
                                $secondarymodules[] = $_REQUEST["secondarymodule_" . $value];
                            }
                        }
                    }
                    $secondarymodule = implode(":", $secondarymodules);
                    $RC_BLOCK2 = $this->getSelectedColumnsList($this->selected_columns_list_arr);
                    $smarty_obj->assign("RC_BLOCK1", $RC_BLOCK1);
                    $smarty_obj->assign("RC_BLOCK2", $RC_BLOCK2);
                    $sreportsortsql = "SELECT columnname, sortorder FROM  its4you_reports4you_sortcol WHERE reportid =? AND sortcolid = 4";
                    $result_sort = $adb->pquery($sreportsortsql, array($recordid));
                    $num_rows = $adb->num_rows($result_sort);
                    if ($num_rows > 0) {
                        $columnname = $adb->query_result($result_sort, 0, "columnname");
                        $sortorder = $adb->query_result($result_sort, 0, "sortorder");
                        $RC_BLOCK3 = $this->getSelectedColumnsList($this->selected_columns_list_arr, $columnname);
                    } else {
                        $RC_BLOCK3 = $RC_BLOCK2;
                    }
                    $smarty_obj->assign("RC_BLOCK3", $RC_BLOCK3);
                    $this->secmodule = $secondarymodule;
                    $RC_BLOCK4 = "";
                    $RC_BLOCK4 = getSecondaryColumnsHTML($this->relatedmodulesstring, $this);
                    $smarty_obj->assign("RC_BLOCK4", $RC_BLOCK4);
                } else {
                    $primarymodule = vtlib_purify($_REQUEST["primarymodule"]);
                    $RC_BLOCK1 = getPrimaryColumnsHTML($primarymodule);
                    if (!empty($this->related_modules[$primarymodule])) {
                        foreach ($this->related_modules[$primarymodule] as $key => $value) {
                            $RC_BLOCK1 .= getSecondaryColumnsHTML($_REQUEST["secondarymodule_" . $value], $this);
                        }
                    }
                    $smarty_obj->assign("RC_BLOCK1", $RC_BLOCK1);
                    $this->reportinformations["columns_limit"] = "20";
                }
                $smarty_obj->assign("MAX_LIMIT", $this->reportinformations["columns_limit"]);
                if ($sortorder != "DESC") {
                    $shtml = '<input type="radio" name="SortOrderColumn" value="ASC" checked>' . vtranslate('Ascending') . ' &nbsp; 
								<input type="radio" name="SortOrderColumn" value="DESC">' . vtranslate('Descending');
                } else {
                    $shtml = '<input type="radio" name="SortOrderColumn" value="ASC">' . vtranslate('Ascending') . ' &nbsp; 
								<input type="radio" name="SortOrderColumn" value="DESC" checked>' . vtranslate('Descending');
                }
                $smarty_obj->assign("COLUMNASCDESC", $shtml);
                $timelinecolumns .= '<input type="radio" name="TimeLineColumn" value="DAYS" checked>' . $mod_strings['TL_DAYS'] . ' ';
                $timelinecolumns .= '<input type="radio" name="TimeLineColumn" value="WEEK" >' . $mod_strings['TL_WEEKS'] . ' ';
                $timelinecolumns .= '<input type="radio" name="TimeLineColumn" value="MONTH" >' . $mod_strings['TL_MONTHS'] . ' ';
                $timelinecolumns .= '<input type="radio" name="TimeLineColumn" value="YEAR" >' . $mod_strings['TL_YEARS'] . ' ';
                $timelinecolumns .= '<input type="radio" name="TimeLineColumn" value="QUARTER" >' . $mod_strings['TL_QUARTERS'] . ' ';
                $smarty_obj->assign("TIMELINE_FIELDS", $timelinecolumns);
                // ITS4YOU-CR SlOl  19. 2. 2014 16:30:20
                $SPSumOptions = $availModules = array();
                $RC_BLOCK0 = "";
                $smarty_obj->assign("availModules", $availModules);
                $smarty_obj->assign("ALL_FIELDS_STRING", $RC_BLOCK0);
                // ITS4YOU-END 19. 2. 2014 16:30:23
                $smarty_obj->assign("currentModule", $this->currentModule);
            }
            if (in_array($step_name, array("ReportColumnsTotal", $get_all_steps))) {
                $Objects = array();
                $curl_array = array();
                if (isset($_REQUEST["curl"])) {
                    $curl = vtlib_purify($_REQUEST["curl"]);
                    $curl_array = explode('$_@_$', $curl);
                    $selectedColumnsString = str_replace("@AMPKO@", "&", $_REQUEST["selectedColumnsStr"]);
                    $R_Objects = explode("<_@!@_>", $selectedColumnsString);
                } else {
                    $curl_array = $this->getSelectedColumnsToTotal($this->record);
                    $curl = implode('$_@_$', $curl_array);
                    $selectedColumnsString = str_replace("@AMPKO@", "&", $this->reportinformations["selectedColumnsString"]);
                    $R_Objects = explode(";", $selectedColumnsString);
                }
                $smarty_obj->assign("CURL", $curl);
                $Objects = sgetNewColumnstoTotalHTMLScript($R_Objects);
                $this->columnssummary = $Objects;
                $CT_BLOCK1 = $this->sgetNewColumntoTotalSelected($recordid, $R_Objects, $curl_array);
                $smarty_obj->assign("CT_BLOCK1", $CT_BLOCK1);
                //added to avoid displaying "No data avaiable to total" when using related modules in report.
                $rows_count = 0;
                $rows_count = count($CT_BLOCK1);
                $smarty_obj->assign("ROWS_COUNT", $rows_count);
            }
            if (in_array($step_name, array("ReportLabels", $get_all_steps))) {
                // selected labels from url
                $lbl_url_string = html_entity_decode(vtlib_purify($_REQUEST["lblurl"]), ENT_QUOTES, $default_charset);
                if ($lbl_url_string != "") {
                    $lbl_url_arr = explode('$_@_$', $lbl_url_string);
                    foreach ($lbl_url_arr as $key => $lbl_value) {
                        if (strpos($lbl_value, 'hidden_') === false) {
                            if (strpos($lbl_value, '_SC_lLbLl_') !== false) {
                                $temp = explode('_SC_lLbLl_', $lbl_value);
                                $temp_lbls = explode('_lLGbGLl_', $temp[1]);
                                $lbl_key = trim($temp_lbls[0]);
                                $lbl_value = trim($temp_lbls[1]);
                                $lbl_url_selected["SC"][$lbl_key] = $lbl_value;
                            }
                            if (strpos($lbl_value, '_SM_lLbLl_') !== false) {
                                $temp = explode('_SM_lLbLl_', $lbl_value);
                                $temp_lbls = explode('_lLGbGLl_', $temp[1]);
                                $lbl_key = trim($temp_lbls[0]);
                                $lbl_value = trim($temp_lbls[1]);
                                $lbl_url_selected["SM"][$lbl_key] = $lbl_value;
                            }
                            if (strpos($lbl_value, '_CT_lLbLl_') !== false) {
                                $temp = explode('_CT_lLbLl_', $lbl_value);
                                $temp_lbls = explode('_lLGbGLl_', $temp[1]);
                                $lbl_key = trim($temp_lbls[0]);
                                $lbl_value = trim($temp_lbls[1]);
                                $lbl_url_selected["CT"][$lbl_key] = $lbl_value;
                            }
                        }
                    }
                }
                // COLUMNS labeltype SC
                if (isset($_REQUEST["selectedColumnsStr"]) && $_REQUEST["selectedColumnsStr"] != "") {
                    $selectedColumnsString = vtlib_purify($_REQUEST["selectedColumnsStr"]);
                    $selectedColumnsString = html_entity_decode($selectedColumnsString, ENT_QUOTES, $default_charset);
                    $selected_columns_array = explode("<_@!@_>", $selectedColumnsString);
                    $decode_labels = true;
                } else {
                    $selectedColumnsString = html_entity_decode($this->reportinformations["selectedColumnsString"], ENT_QUOTES, $default_charset);
                    $selected_columns_array = explode(";", $selectedColumnsString);
                    $decode_labels = false;
                }
                $labels_html["SC"] = $this->getLabelsHTML($selected_columns_array, "SC", $lbl_url_selected, $decode_labels);
                // SUMMARIES labeltype SM
                $selectedSummariesString = vtlib_purify($_REQUEST["selectedSummariesString"]);
                if ($selectedSummariesString != "") {
                    $selectedSummaries_array = explode(";", trim($selectedSummariesString, ";"));
                } else {
                    foreach ($this->reportinformations["summaries_columns"] as $key => $sum_arr) {
                        $selectedSummaries_array[] = $sum_arr["columnname"];
                    }
                }
                $labels_html["SM"] = $this->getLabelsHTML($selectedSummaries_array, "SM", $lbl_url_selected, $decode_labels);
                $smarty_obj->assign("labels_html", $labels_html);
                $smarty_obj->assign("LABELS", $curl);
                //added to avoid displaying "No data avaiable to total" when using related modules in report.
                $rows_count = count($labels_html);
                foreach ($labels_html as $key => $labels_type_arr) {
                    $rows_count += count($labels_type_arr);
                }
                $smarty_obj->assign("ROWS_COUNT", $rows_count);
            }
            if (in_array($step_name, array("ReportFilters", $get_all_steps))) {
                require_once 'modules/ITS4YouReports/FilterUtils.php';
                if (isset($_REQUEST["primarymodule"]) && $_REQUEST["primarymodule"] != "") {
                    $primary_moduleid = $_REQUEST["primarymodule"];
                    $primary_module = vtlib_getModuleNameById($_REQUEST["primarymodule"]);
                } else {
                    $primary_module = $this->primarymodule;
                    $primary_moduleid = $this->primarymoduleid;
                }
                // NEW ADVANCE FILTERS START
                $this->getGroupFilterList($this->record);
                $this->getAdvancedFilterList($this->record);
                $this->getSummariesFilterList($this->record);
                $sel_fields = Zend_Json::encode($this->adv_sel_fields);
                $smarty_obj->assign("SEL_FIELDS", $sel_fields);
                if (isset($_REQUEST["reload"])) {
                    $criteria_groups = $this->getRequestCriteria($sel_fields);
                } else {
                    $criteria_groups = $this->advft_criteria;
                }
                $smarty_obj->assign("CRITERIA_GROUPS", $criteria_groups);
                $smarty_obj->assign("EMPTY_CRITERIA_GROUPS", empty($criteria_groups));
                $smarty_obj->assign("SUMMARIES_CRITERIA", $this->summaries_criteria);
                $FILTER_OPTION = getAdvCriteriaHTML();
                $smarty_obj->assign("FOPTION", $FILTER_OPTION);
                $COLUMNS_BLOCK_JSON = $this->getAdvanceFilterOptionsJSON($primary_module);
                $smarty_obj->assign("COLUMNS_BLOCK", $COLUMNS_BLOCK);
                if ($mode != "ajax") {
                    echo "<textarea style='display:none;' id='filter_columns'>" . $COLUMNS_BLOCK_JSON . "</textarea>";
                    $smarty_obj->assign("filter_columns", $COLUMNS_BLOCK_JSON);
                    $sel_fields = Zend_Json::encode($this->adv_sel_fields);
                    $smarty_obj->assign("SEL_FIELDS", $sel_fields);
                    global $default_charset;
                    $std_filter_columns = $this->getStdFilterColumns();
                    $std_filter_columns_js = implode("<%jsstdjs%>", $std_filter_columns);
                    $std_filter_columns_js = html_entity_decode($std_filter_columns_js, ENT_QUOTES, $default_charset);
                    $smarty_obj->assign("std_filter_columns", $std_filter_columns_js);
                    $std_filter_criteria = Zend_Json::encode($this->Date_Filter_Values);
                    $smarty_obj->assign("std_filter_criteria", $std_filter_criteria);
                }
                $rel_fields = $this->adv_rel_fields;
                $smarty_obj->assign("REL_FIELDS", Zend_Json::encode($rel_fields));
                // NEW ADVANCE FILTERS END
                $BLOCKJS = $this->getCriteriaJS();
                $smarty_obj->assign("BLOCKJS_STD", $BLOCKJS);
            }
            if (in_array($step_name, array("ReportSharing", $get_all_steps))) {
                $roleid = $this->current_user->column_fields['roleid'];
                $user_array = getRoleAndSubordinateUsers($roleid);
                $userIdStr = "";
                $userNameStr = "";
                $m = 0;
                foreach ($user_array as $userid => $username) {
                    if ($userid != $this->current_user->id) {
                        if ($m != 0) {
                            $userIdStr .= ",";
                            $userNameStr .= ",";
                        }
                        $userIdStr .= "'" . $userid . "'";
                        $userNameStr .= "'" . escape_single_quotes(decode_html($username)) . "'";
                        $m++;
                    }
                }
                require_once 'include/utils/GetUserGroups.php';
                // ITS4YOU-UP SlOl 26. 4. 2013 9:47:59
                $template_owners = get_user_array(false);
                if (isset($this->reportinformations["owner"]) && $this->reportinformations["owner"] != "") {
                    $selected_owner = $this->reportinformations["owner"];
                } else {
                    $selected_owner = $this->current_user->id;
                }
                $smarty_obj->assign("TEMPLATE_OWNERS", $template_owners);
                $owner = isset($_REQUEST['template_owner']) && $_REQUEST['template_owner'] != '' ? $_REQUEST['template_owner'] : $selected_owner;
                $smarty_obj->assign("TEMPLATE_OWNER", $owner);
                $sharing_types = array("public" => vtranslate("PUBLIC_FILTER"), "private" => vtranslate("PRIVATE_FILTER"), "share" => vtranslate("SHARE_FILTER"));
                $smarty_obj->assign("SHARINGTYPES", $sharing_types);
                $sharingtype = "public";
                if (isset($_REQUEST['sharing']) && $_REQUEST['sharing'] != '') {
                    $sharingtype = $_REQUEST['sharing'];
                } elseif (isset($this->reportinformations["sharingtype"]) && $this->reportinformations["sharingtype"] != "") {
                    $sharingtype = $this->reportinformations["sharingtype"];
                }
                $smarty_obj->assign("SHARINGTYPE", $sharingtype);
                $cmod = return_specified_module_language($current_language, "Settings");
                $smarty_obj->assign("CMOD", $cmod);
                $sharingMemberArray = array();
                if (isset($_REQUEST['sharingSelectedColumns']) && $_REQUEST['sharingSelectedColumns'] != '') {
                    $sharingMemberArray = explode("|", trim($_REQUEST['sharingSelectedColumns'], "|"));
                } elseif (isset($this->reportinformations["members_array"]) && !empty($this->reportinformations["members_array"])) {
                    $sharingMemberArray = $this->reportinformations["members_array"];
                }
                $sharingMemberArray = array_unique($sharingMemberArray);
                if (count($sharingMemberArray) > 0) {
                    $outputMemberArr = array();
                    foreach ($sharingMemberArray as $setype => $shareIdArr) {
                        $shareIdArr = explode("::", $shareIdArr);
                        $shareIdArray = array();
                        $shareIdArray[$shareIdArr[0]] = $shareIdArr[1];
                        foreach ($shareIdArray as $shareType => $shareId) {
                            switch ($shareType) {
                                case "groups":
                                    $memberName = fetchGroupName($shareId);
                                    $memberDisplay = "Group::";
                                    break;
                                case "roles":
                                    $memberName = getRoleName($shareId);
                                    $memberDisplay = "Roles::";
                                    break;
                                case "rs":
                                    $memberName = getRoleName($shareId);
                                    $memberDisplay = "RoleAndSubordinates::";
                                    break;
                                case "users":
                                    $memberName = getUserFullName($shareId);
                                    $memberDisplay = "User::";
                                    break;
                            }
                            $outputMemberArr[] = $shareType . "::" . $shareId;
                            $outputMemberArr[] = $memberDisplay . $memberName;
                        }
                    }
                    $smarty_obj->assign("MEMBER", array_chunk($outputMemberArr, 2));
                }
                // ITS4YOU-END
                $userGroups = new GetUserGroups();
                $userGroups->getAllUserGroups($this->current_user->id);
                $user_groups = $userGroups->user_groups;
                $groupIdStr = "";
                $groupNameStr = "";
                $l = 0;
                foreach ($user_groups as $i => $grpid) {
                    $grp_details = getGroupDetails($grpid);
                    if ($l != 0) {
                        $groupIdStr .= ",";
                        $groupNameStr .= ",";
                    }
                    $groupIdStr .= "'" . $grp_details[0] . "'";
                    $groupNameStr .= "'" . escape_single_quotes(decode_html($grp_details[1])) . "'";
                    $l++;
                }
                $visiblecriteria = getVisibleCriteria();
                $smarty_obj->assign("VISIBLECRITERIA", $visiblecriteria);
                $smarty_obj->assign("GROUPNAMESTR", $groupNameStr);
                $smarty_obj->assign("USERNAMESTR", $userNameStr);
                $smarty_obj->assign("GROUPIDSTR", $groupIdStr);
                $smarty_obj->assign("USERIDSTR", $userIdStr);
            }
            if (in_array($step_name, array("ReportScheduler", $get_all_steps))) {
                // SEE ReportScheduler.php for this step for a reason of problem with incomplemete ReportScheduler object
            }
            if (in_array($step_name, array("ReportGraphs", $get_all_steps))) {
                if (isset($_REQUEST["chart_type"]) && $_REQUEST["chart_type"] != "" && $_REQUEST["chart_type"] != "none") {
                    $selected_chart_type = vtlib_purify($_REQUEST["chart_type"]);
                } else {
                    $selected_chart_type = $this->reportinformations["charts"]["charttype"];
                }
                $smarty_obj->assign("IMAGE_PATH", $chart_type);
                if (isset($_REQUEST["data_series"]) && $_REQUEST["data_series"] != "" && $_REQUEST["data_series"] != "none") {
                    $selected_data_series = vtlib_purify($_REQUEST["data_series"]);
                } else {
                    $selected_data_series = $this->reportinformations["charts"]["dataseries"];
                }
                if (isset($_REQUEST["charttitle"]) && $_REQUEST["charttitle"] != "") {
                    $selected_charttitle = htmlspecialchars(vtlib_purify($_REQUEST["charttitle"]));
                } else {
                    $selected_charttitle = $this->reportinformations["charts"]["charttitle"];
                }
                $chart_type["horizontal"] = array("value" => vtranslate("LBL_CHART_horizontal", $this->currentModule), "selected" => $selected_chart_type == "horizontal" ? "selected" : "");
                $chart_type["vertical"] = array("value" => vtranslate("LBL_CHART_vertical", $this->currentModule), "selected" => $selected_chart_type == "vertical" ? "selected" : "");
                $chart_type["linechart"] = array("value" => vtranslate("LBL_CHART_linechart", $this->currentModule), "selected" => $selected_chart_type == "linechart" ? "selected" : "");
                $chart_type["pie"] = array("value" => vtranslate("LBL_CHART_pie", $this->currentModule), "selected" => $selected_chart_type == "pie" ? "selected" : "");
                $chart_type["pie3d"] = array("value" => vtranslate("LBL_CHART_pie3D", $this->currentModule), "selected" => $selected_chart_type == "pie3d" ? "selected" : "");
                $chart_type["funnel"] = array("value" => vtranslate("LBL_CHART_funnel", $this->currentModule), "selected" => $selected_chart_type == "funnel" ? "selected" : "");
                $smarty_obj->assign("CHART_TYPE", $chart_type);
                // selected labels from url
                if (isset($_REQUEST["lblurl"])) {
                    global $default_charset;
                    $lbl_url_string = html_entity_decode(vtlib_purify($_REQUEST["lblurl"]), ENT_QUOTES, $default_charset);
                }
                $lbl_url_string = str_replace("@AMPKO@", "&", $lbl_url_string);
                if ($lbl_url_string != "") {
                    $lbl_url_arr = explode('$_@_$', $lbl_url_string);
                    foreach ($lbl_url_arr as $key => $lbl_value) {
                        if (strpos($lbl_value, 'hidden_') === false) {
                            if (strpos($lbl_value, '_SC_lLbLl_') !== false) {
                                $temp = explode('_SC_lLbLl_', $lbl_value);
                                $temp_lbls = explode('_lLGbGLl_', $temp[1]);
                                $lbl_key = $temp_lbls[0];
                                $lbl_value = $temp_lbls[1];
                                $lbl_url_selected["SC"][$lbl_key] = $lbl_value;
                            }
                            if (strpos($lbl_value, '_SM_lLbLl_') !== false) {
                                $temp = explode('_SM_lLbLl_', $lbl_value);
                                $temp_lbls = explode('_lLGbGLl_', $temp[1]);
                                $lbl_key = $temp_lbls[0];
                                $lbl_value = $temp_lbls[1];
                                $lbl_url_selected["SM"][$lbl_key] = $lbl_value;
                            }
                            if (strpos($lbl_value, '_CT_lLbLl_') !== false) {
                                $temp = explode('_CT_lLbLl_', $lbl_value);
                                $temp_lbls = explode('_lLGbGLl_', $temp[1]);
                                $lbl_key = $temp_lbls[0];
                                $lbl_value = $temp_lbls[1];
                                $lbl_url_selected["CT"][$lbl_key] = $lbl_value;
                            }
                        }
                    }
                }
                $selectedSummariesString = vtlib_purify($_REQUEST["selectedSummariesString"]);
                if ($selectedSummariesString != "") {
                    $selectedSummariesArray = explode(";", $selectedSummariesString);
                    if (!empty($selectedSummariesArray)) {
                        foreach ($selectedSummariesArray as $column_str) {
                            if ($column_str != "") {
                                if (isset($lbl_url_selected["SM"][$column_str]) && $lbl_url_selected["SM"][$column_str] != "") {
                                    $column_lbl = $lbl_url_selected["SM"][$column_str];
                                } else {
                                    $column_str_arr = explode(":", $column_str);
                                    $translate_arr = explode("_", $column_str_arr[2]);
                                    $translate_module = $translate_arr[0];
                                    unset($translate_arr[0]);
                                    $translate_str = implode("_", $translate_arr);
                                    $translate_mod_str = return_module_language($current_language, $translate_module);
                                    if (isset($translate_mod_str[$translate_str])) {
                                        $column_lbl = $translate_mod_str[$translate_str];
                                    } else {
                                        $column_lbl = $translate_str;
                                    }
                                }
                                $data_series[$column_str] = array("value" => $column_lbl, "selected" => $column_str == $selected_data_series ? "selected" : "");
                            }
                        }
                    }
                }
                if (empty($data_series) && $selected_data_series != "") {
                    $column_lbl = $this->getColumnStr_Label($selected_data_series, "SM");
                    $data_series[$selected_data_series] = array("value" => $column_lbl, "selected" => "selected");
                }
                $smarty_obj->assign("DATA_SERIES", $data_series);
                $smarty_obj->assign("CHART_TITLE", $selected_charttitle);
            }
            return $smarty_obj;
        }
    }