/** * Function exports the report in a Excel sheet * @param Vtiger_Request $request */ function GetXLS(Vtiger_Request $request) { $recordId = $request->get('record'); error_reporting(0); //error_reporting(63);ini_set("display_errors",1); if (ITS4YouReports::isStoredITS4YouReport() === true) { $ogReport = ITS4YouReports::getStoredITS4YouReport(); } else { $ogReport = new ITS4YouReports(); } $generateObj = new GenerateObj($ogReport); $report_data = $generateObj->GenerateReport($recordId, "XLS"); //ITS4YouReports::sshow($report_data); //exit; $rootDirectory = vglobal('root_directory'); $tmpDir = vglobal('tmp_dir'); $tempFileName = tempnam($rootDirectory . $tmpDir, 'xls'); $fileName = $ogReport->reportname . '.xls'; $default_charset = vglobal("default_charset"); $fileName = html_entity_decode($fileName, ENT_QUOTES, $default_charset); $generateObj->writeReportToExcelFile($tempFileName, $report_data); //ITS4YouReports::sshow($report_data); //exit; if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { header('Pragma: public'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); } header('Content-Type: application/x-msexcel'); header('Content-Length: ' . @filesize($tempFileName)); header('Content-disposition: attachment; filename="' . $fileName . '"'); $fp = fopen($tempFileName, 'rb'); fpassthru($fp); //unlink($tempFileName); //echo "<pre>";print_r($report_data);echo "</pre>"; }
function ITS4YouReports($reportId = "", $run_construct = true) { $this->db = PearDatabase::getInstance(); GenerateObj::checkInstallationMemmoryLimit(); $this->setLicenseInfo(); if ($run_construct === true) { $this->setITS4YouReport($reportId); } return $this; }
$ITS4YouReports = new ITS4YouReports(true, 90); global $default_charset; if (!isset($default_charset)) { $default_charset = "UTF-8"; } $ITS4YouReports_reportname = generate_cool_url($ITS4YouReports->reportname); $ITS4YouReports_reportdesc = generate_cool_url($ITS4YouReports->reportdesc); $currentTime = date('Y-m-d H:i:s'); $subject = $ITS4YouReports_reportname . ' - ' . $currentTime . ' (' . DateTimeField::getDBTimeZone() . ')'; $contents = getTranslatedString('LBL_AUTO_GENERATED_REPORT_EMAIL', $currentModule) . '<br/><br/>'; $contents .= '<b>' . getTranslatedString('LBL_REPORT_NAME', $currentModule) . ' :</b> ' . $ITS4YouReports_reportname . '<br/>'; $contents .= '<b>' . getTranslatedString('LBL_DESCRIPTION', $currentModule) . ' :</b><br/>' . $ITS4YouReports_reportdesc . '<br/><br/>'; $vtigerMailer->Subject = "=?ISO-8859-15?Q?" . imap_8bit(html_entity_decode($subject, ENT_QUOTES, "UTF-8")) . "?="; $vtigerMailer->Body = $contents; $vtigerMailer->ContentType = "text/html"; $generate = new GenerateObj($ITS4YouReports); //$reportFormat = $this->scheduledFormat; $reportFormat = "pdf;xls"; $reportFormat = explode(";", $reportFormat); $tmpDir = "test/ITS4YouReports/"; $attachments = array(); if (in_array('pdf', $reportFormat)) { $report_html = $generate->generateReport(90, "HTML", false); ITS4YouReports::sshow($report_html); exit; $generate_pdf_filename = $tmpDir . generate_cool_url($generate->pdf_filename); $fileName = $rootDirectory . $tempFileName . $generate->pdf_filename . '.xls'; if ($generate_pdf_filename != "" && file_exists($generate_pdf_filename)) { $fileName_arr = explode(".", $generate->pdf_filename); $fileName_arr[0] .= '_' . preg_replace('/[^a-zA-Z0-9_-\\s]/', '', $currentTime); $fileName = implode(".", $fileName_arr);
public function sendEmail($ownerUser = "") { require_once 'vtlib/Vtiger/Mailer.php'; //error_reporting(63);ini_set('display_errors', 1); $vtigerMailer = new Vtiger_Mailer(); $currentModule = 'ITS4YouReports'; $recipientEmails = $this->getRecipientEmails(); //$recipientEmails = array("*****@*****.**"); foreach ($recipientEmails as $name => $email) { $vtigerMailer->AddAddress($email, $name); } $ITS4YouReports = new ITS4YouReports(true, $this->id); $default_charset = vglobal('default_charset'); if (!isset($default_charset)) { $default_charset = "UTF-8"; } $ITS4YouReports_reportname = $this->generate_cool_url($ITS4YouReports->reportname); $ITS4YouReports_reportdesc = $this->generate_cool_url($ITS4YouReports->reportdesc); $currentTime = date('Y-m-d H:i:s'); $user_id = $ownerUser->id; $report_filename = "Reports4You_{$user_id}" . "_" . $this->id; $subject = $ITS4YouReports_reportname . ' - ' . $currentTime . ' (' . DateTimeField::getDBTimeZone() . ')'; $contents = getTranslatedString('LBL_AUTO_GENERATED_REPORT_EMAIL', $currentModule) . '<br/><br/>'; $contents .= '<b>' . getTranslatedString('LBL_REPORT_NAME', $currentModule) . ' :</b> ' . $ITS4YouReports_reportname . '<br/>'; $contents .= '<b>' . getTranslatedString('LBL_DESCRIPTION', $currentModule) . ' :</b><br/>' . $ITS4YouReports_reportdesc . '<br/><br/>'; //$vtigerMailer->Subject = "=?ISO-8859-15?Q?".imap_8bit($subject)."?="; $vtigerMailer->Subject = html_entity_decode($ITS4YouReports->reportname, ENT_QUOTES, "UTF-8"); $vtigerMailer->Body = $contents; $vtigerMailer->ContentType = "text/html"; $generate = new GenerateObj($ITS4YouReports); $currentModule = 'ITS4YouReports'; $generate->setCurrentModule4You($currentModule); $current_language = $ReportOwnerUser->language; $generate->setCurrentLanguage4You($current_language); $reportFormat = $this->scheduledFormat; //$reportFormat = "pdf;xls"; $reportFormat = explode(";", $reportFormat); $tmpDir = "test/ITS4YouReports/"; $attachments = array(); if (in_array('pdf', $reportFormat)) { $generate->create_pdf_schedule = true; $report_html = $generate->generateReport($this->id, "HTML", false); $generate_pdf_filename = $tmpDir . $generate->pdf_filename; $fileName = $rootDirectory . $tempFileName . $generate->pdf_filename . '.xls'; if ($generate_pdf_filename != "" && file_exists($generate_pdf_filename)) { $fileName_arr = explode(".", $generate->pdf_filename); $fileName_arr[0] .= '_' . preg_replace('/[^a-zA-Z0-9_-\\s]/', '', $currentTime); $fileName = implode(".", $fileName_arr); $attachments[$fileName] = $generate_pdf_filename; } } if (in_array('xls', $reportFormat)) { $report_data = $generate->generateReport($this->id, "XLS", false); $ITS4YouReports_xls = "Reports4You_1_" . $this->id . ".xls"; $fileName_arr = explode(".", $ITS4YouReports_xls); $fileName_arr[0] .= '_' . preg_replace('/[^a-zA-Z0-9_-\\s]/', '', $currentTime); $fileName = implode(".", $fileName_arr); $fileName_path = $tmpDir . $ITS4YouReports_xls; $generate->writeReportToExcelFile($fileName_path, $report_data); $attachments[$fileName] = $fileName_path; } foreach ($attachments as $attachmentName => $path) { $vtigerMailer->AddAttachment($path, "=?ISO-8859-15?Q?" . imap_8bit(html_entity_decode($attachmentName, ENT_QUOTES, "UTF-8")) . "?="); } //exit; $send_result = $vtigerMailer->Send(true); echo "SEND RESULT -> " . $send_result . "<br />"; foreach ($attachments as $attachmentName => $path) { unlink($path); } ITS4YouReports::cleanITS4YouReportsCacheFiles(); //echo "<pre>EXIST ? = ";print_r(method_exists(ITS4YouReports, "cleanITS4YouReportsCacheFiles"));echo "</pre>"; }
public function getStdComparator($comparator, $value, $datatype = "") { $return = ""; global $default_charset; if ($comparator != "custom") { $date_array = GenerateObj::getStandarFiltersStartAndEndDate($comparator); } else { $date_array = explode("<;@STDV@;>", html_entity_decode($value, ENT_QUOTES, $default_charset)); } $s_date = $date_array[0]; $e_date = $date_array[1]; switch ($comparator) { case "today": case "yesterday": case "tomorrow": $return = " = '{$s_date}' "; break; case "thisweek": case "lastweek": case "nextweek": case "thismonth": case "lastmonth": case "nextmonth": case "next7days": case "next15days": case "next30days": case "next60days": case "next90days": case "next120days": case "last7days": case "last15days": case "last30days": case "last60days": case "last90days": case "last120days": case "thisfy": case "prevfy": case "nextfy": case "nextfq": case "prevfq": case "thisfq": $return = " BETWEEN '{$s_date}' AND '{$e_date}' "; break; case "todaymore": $return = " > '{$s_date}' "; break; case "todayless": case "older1days": case "older7days": case "older15days": case "older30days": case "older60days": case "older90days": case "older120days": case "todayless": $return = " < '{$s_date}' "; break; default: $currentUser = Users_Record_Model::getCurrentUserModel(); $js_cal_dateformat = $currentUser->get('date_format'); //$js_cal_dateformat = "dd-mm-yyyy"; if ($s_date != "") { $s_date = DateTimeField::__convertToDBFormat(trim($s_date), $js_cal_dateformat); } if ($e_date != "") { $e_date = DateTimeField::__convertToDBFormat(trim($e_date), $js_cal_dateformat); } if ($s_date != "" && $e_date != "") { $return = " BETWEEN '{$s_date}' AND '{$e_date}' "; } elseif ($s_date != "") { $return = " = '{$s_date}' "; } elseif ($e_date != "") { $return = " = '{$e_date}' "; } else { $return = ""; } break; } return $return; }
function getFilterDateHtml(Vtiger_Request $request) { $return_html = ""; $columnIndex = $request->get("columnIndex"); if ($columnIndex != "") { $currentUser = Users_Record_Model::getCurrentUserModel(); $date_format = $currentUser->get('date_format'); //$date_format = "dd-mm-yyyy"; $moduleName = $request->getModule(); $record = $request->get("record"); $fop_type = $request->get("fop_type"); $reportModel = ITS4YouReports_Record_Model::getCleanInstance($record); $rel_fields = $reportModel->getAdvRelFields(); $r_sel_fields = $request->get("r_sel_fields"); $ctype = "f"; $s_date_value = $e_date_value = ""; if ($r_sel_fields != "") { $default_charset = vglobal("default_charset"); if ($fop_type != "custom") { $std_val_array = GenerateObj::getStandarFiltersStartAndEndDate($fop_type); } else { $std_val_array = explode("<;@STDV@;>", html_entity_decode($r_sel_fields, ENT_QUOTES, $default_charset)); } if (in_array($fop_type, array("todayless"))) { $s_date_value = ""; if ($std_val_array[0] != "--" && $std_val_array[0] != "") { $e_date_value = $std_val_array[0]; } else { $e_date_value = $std_val_array[1]; } } elseif (in_array($fop_type, array("todaymore", "older1days", "older7days", "older15days", "older30days", "older60days", "older90days", "older120days"))) { $s_date_value = $std_val_array[0]; $e_date_value = ""; } else { $s_date_value = $std_val_array[0]; $e_date_value = $std_val_array[1]; } } if ($fop_type != "custom") { $readonly = "true"; } else { $readonly = "false"; } if ($s_date_value != "") { $s_date_value_f = getValidDisplayDate($s_date_value); } if ($e_date_value != "") { $e_date_value_f = getValidDisplayDate($e_date_value); } //'<input id="Invoice_editView_fieldName_invoicedate" class="span9 dateField" name="invoicedate" data-date-format="dd-mm-yyyy" value="21-07-2014" data-fieldinfo="{\'mandatory\':false,\'presence\':true,\'quickcreate\':false,\'masseditable\':true,\'defaultvalue\':false,\'type\':\'date\',\'name\':\'invoicedate\',\'label\':\'Invoice Date\',\'date-format\':\'dd-mm-yyyy\'}" type="text">'; $return_html .= "<div class='row-fluid'>\n <div class='span6'>\n <div class='row-fluid input-append'>\n <div id='jscal_trigger_sdate" . $columnIndex . "' class='span10 row-fluid date hide'>\n <input class='span9 dateField' name='startdate' id='jscal_field_sdate_val_" . $columnIndex . "' data-date-format='" . $date_format . "' maxlength='10' value='" . $s_date_value . "' type='text'>\n <span class='add-on'><i class='icon-calendar'></i></span> \n </div>\n <input data-value='value' class='span10' name='' id='jscal_field_sdate" . $columnIndex . "' readonly='true' value='" . $s_date_value_f . "'>\n </div>\n <!--<div class='row-fluid'>\n <font size='1'><b>" . vtranslate("LBL_SF_STARTDATE", $moduleName) . "</b></font>\n </div>-->\n </div>\n <div class='span6'>\n <div class='row-fluid input-append'>\n <div id='jscal_trigger_edate" . $columnIndex . "' class='span10 row-fluid date hide'>\n <input class='span9 dateField' name='enddate' id='jscal_field_edate_val_" . $columnIndex . "' data-date-format=" . $date_format . "' maxlength='10' value='" . $e_date_value . "' type='text'>\n <span class='add-on'><i class='icon-calendar'></i></span>\n </div>\n <input data-value='value' class='span10' name='' id='jscal_field_edate" . $columnIndex . "' readonly='true' value='" . $e_date_value_f . "'>\n </div>\n <!--<div class='row-fluid'>\n <font size='1'><b>" . vtranslate("LBL_SF_ENDDATE", $moduleName) . "</b></font>\n </div>-->\n </div>\n </div>"; /* $return_html .= " <table> <tr> <td width='20%'> <table><tbody> <tr> <td style='vertical-align:top;'> <input name='startdate' id='jscal_field_sdate$columnIndex' style='border: 1px solid rgb(186, 186, 186);' size='10' maxlength='10' value='$s_date_value' type='text'> <img style='visibility: hidden;' src='themes/softed/images/btnL3Calendar.gif' id='jscal_trigger_sdate$columnIndex' align='absmiddle'><br> <font size='1'><b>".vtranslate("LBL_SF_STARTDATE", $moduleName).":</b><em old='(yyyy-mm-dd)'>(dd-mm-yyyy)</em></font> </td> </tr> </tbody></table> </td> <td width='30%'> <table><tbody> <tr> <td style='vertical-align:top;'> <input name='enddate' id='jscal_field_edate$columnIndex' style='border: 1px solid rgb(186, 186, 186);' size='10' maxlength='10' value='$e_date_value' type='text'> <img style='visibility: hidden;' src='themes/softed/images/btnL3Calendar.gif' id='jscal_trigger_edate$columnIndex' align='absmiddle'><br> <font size='1'><b>".vtranslate("LBL_SF_ENDDATE", $moduleName).":</b><em old='(yyyy-mm-dd)'>(dd-mm-yyyy)</em></font> </td> </tr> </tbody></table> </td> </tr> </table> ";*/ } echo $return_html; }
public function getReportHeaderInfo($noofrows = 0) { $final_return = $return = $return_name = $return_val = ""; $return_arr = $col_order_arr = $summ_order_arr = array(); $colspan = 2; global $default_charset; if (isset($this->reportinformations["reports4youid"]) && $this->reportinformations["reports4youid"] != "") { /* if (isset($this->reportinformations["reports4youid"]) && $this->reportinformations["reports4youid"] != "") { $return_val = $this->reportinformations["reports4youname"]; } else { $return_val = vtranslate("LBL_REPORT_NAME", $this->currentModule); } $return_arr["reportname"] = array("val"=>$return_val,"colspan"=>$colspan); */ $return_val = "<b>" . vtranslate("LBL_Module", $this->currentModule) . ": </b>"; $primarymodule_id = $this->reportinformations["primarymodule"]; $primarymodule = vtlib_getModuleNameById($primarymodule_id); $return_val .= vtranslate($primarymodule, $primarymodule); $return_arr[] = array("val" => $return_val, "colspan" => ""); $return_val = "<b>" . vtranslate("LBL_TOTAL", $this->currentModule) . ": </b><span id='_reportrun_total'>{$noofrows}</span> " . vtranslate("LBL_RECORDS", "ITS4YouReports"); $return_arr[] = array("val" => $return_val, "colspan" => ""); $return_val = "<b>" . vtranslate("LBL_TEMPLATE_OWNER", $this->currentModule) . ": </b>"; $return_val .= getUserFullName($this->reportinformations["owner"]); $return_arr[] = array("val" => $return_val, "colspan" => ""); $return_val = "<b>" . vtranslate("LBL_GroupBy", $this->currentModule) . ": </b>"; for ($gi = 1; $gi < 4; $gi++) { if (isset($this->reportinformations["Group{$gi}"]) && $this->reportinformations["Group{$gi}"] != "" && $this->reportinformations["Group{$gi}"] != "none") { $group_col_info = array(); // columns visibility control !!!!!! if ($this->getColumnVisibilityPerm($this->reportinformations["Group{$gi}"]) == 0) { $gp_column_lbl = $this->getColumnStr_Label($this->reportinformations["Group{$gi}"], "SC"); $group_col_info[] = $gp_column_lbl; $group_col_info[] = vtranslate($this->reportinformations["Sort{$gi}"]); if (isset($this->reportinformations["timeline_columnstr{$gi}"]) && $this->reportinformations["timeline_columnstr{$gi}"] != "" && $this->reportinformations["timeline_columnstr{$gi}"] != "@vlv@") { $tr_arr = explode("@vlv@", $this->reportinformations["timeline_columnstr{$gi}"]); $tl_option = "TL_" . $tr_arr[1]; $group_col_info[] = vtranslate("LBL_BY", $this->currentModule); $group_col_info[] = vtranslate($tl_option, $this->currentModule); } $group_cols[] = implode(" ", $group_col_info); } } } if (empty($group_cols)) { $group_cols[] = vtranslate("LBL_NONE", $this->currentModule); } $return_val .= implode(", ", $group_cols); $return_arr[] = array("val" => $return_val, "colspan" => ""); $return_val = "<b>" . vtranslate("LBL_Sharing", $this->currentModule) . ": </b>"; if (isset($this->reportinformations["sharingtype"]) && $this->reportinformations["sharingtype"] != "") { $sharingtype = vtranslate($this->reportinformations["sharingtype"]); } $sharing_with = ""; if ($this->reportinformations["sharingtype"] == "share") { $sharingMemberArray = $this->reportinformations["members_array"]; $sharingMemberArray = array_unique($sharingMemberArray); if (count($sharingMemberArray) > 0) { $outputMemberArr = array(); foreach ($sharingMemberArray as $setype => $shareIdArr) { $shareIdArr = explode("::", $shareIdArr); $shareIdArray[$shareIdArr[0]] = $shareIdArr[1]; foreach ($shareIdArray as $shareType => $shareId) { switch ($shareType) { case "groups": $groupName_array = getGroupName($shareId); $memberName = $groupName_array[0]; $memberDisplay = "Group::"; break; case "roles": $memberName = getRoleName($shareId); $memberDisplay = "Roles::"; break; case "rs": $memberName = getRoleName($shareId); $memberDisplay = "RoleAndSubordinates::"; break; case "users": $memberName = getUserName($shareId); $memberDisplay = "User::"; break; } // $outputMemberArr[] = $shareType."::".$shareId; $outputMemberArr[] = $memberDisplay . $memberName; } } $outputMemberArr = array_unique($outputMemberArr); } if (!empty($outputMemberArr)) { $sharing_with = " (" . implode(", ", $outputMemberArr) . ")"; } } $return_val .= $sharingtype . $sharing_with; $return_arr[] = array("val" => $return_val, "colspan" => ""); $return_val = "<b>" . vtranslate("LBL_Schedule", $this->currentModule) . ": </b>"; $adb = PearDatabase::getInstance(); require_once 'modules/ITS4YouReports/ScheduledReports4You.php'; $scheduledReport = new ITS4YouScheduledReport($adb, $this->current_user, $this->record); $scheduledReport->getReportScheduleInfo(); $is_scheduled = $scheduledReport->isScheduled; $schedule_info = ""; $scheduled_arr = array(1 => "HOURLY", 2 => "DAILY", 3 => "WEEKLY", 4 => "BIWEEKLY", 5 => "MONTHLY", 6 => "ANNUALLY"); if ($is_scheduled) { $schtypeid = $scheduledReport->scheduledInterval["scheduletype"]; // $schedule_info_arr[] = vtranslate("LBL_SCHEDULE_EMAIL", $this->currentModule); $schedulerFormatArr = explode(";", $scheduledReport->scheduledFormat); if (!empty($schedulerFormatArr)) { foreach ($schedulerFormatArr as $format_str) { $translated_schedulerFormat[] = vtranslate($format_str, $this->currentModule); } } // $schedule_info_arr[] = $scheduledReport->scheduledFormat; $schedule_info_arr[] = implode(", ", $translated_schedulerFormat); $schedule_info_arr[] = vtranslate($scheduled_arr[$schtypeid], $this->currentModule); $schtime = $scheduledReport->scheduledInterval['time']; $schday = $scheduledReport->scheduledInterval['day']; $schweek = $scheduledReport->scheduledInterval['day']; $schmonth = $scheduledReport->scheduledInterval['month']; $WEEKDAY_STRINGS = vtranslate("WEEKDAY_STRINGS", $this->currentModule); $MONTH_STRINGS = vtranslate("MONTH_STRINGS", $this->currentModule); switch ($schtypeid) { case 1: $schedule_info_arr[] = vtranslate("LBL_SCH_AT", $this->currentModule) . " {$schtime}"; break; case 2: $schedule_info_arr[] = vtranslate("LBL_SCH_AT", $this->currentModule) . " {$schtime}"; break; case 3: $schedule_info_arr[] = vtranslate("LBL_SCH_ON", $this->currentModule) . " " . $WEEKDAY_STRINGS[$schday]; $schedule_info_arr[] = vtranslate("LBL_SCH_AT", $this->currentModule) . " {$schtime}"; break; case 4: $schedule_info_arr[] = vtranslate("LBL_SCH_ON", $this->currentModule) . " " . $WEEKDAY_STRINGS[$schday]; $schedule_info_arr[] = vtranslate("LBL_SCH_AT", $this->currentModule) . " {$schtime}"; break; case 5: $schedule_info_arr[] = vtranslate("LBL_SCH_ON", $this->currentModule) . " {$schday}. " . vtranslate("LBL_SCHEDULE_EMAIL_DAY", $this->currentModule); $schedule_info_arr[] = vtranslate("LBL_SCH_AT", $this->currentModule) . " {$schtime}"; break; case 6: $schedule_info_arr[] = vtranslate("LBL_SCH_IN", $this->currentModule) . " " . $MONTH_STRINGS[$schmonth]; $schedule_info_arr[] = vtranslate("LBL_SCH_ON", $this->currentModule) . " {$schday}. " . vtranslate("LBL_SCHEDULE_EMAIL_DAY", $this->currentModule); $schedule_info_arr[] = vtranslate("LBL_SCH_AT", $this->currentModule) . " {$schtime}"; break; } $schedule_info = implode(" ", $schedule_info_arr); } else { $schedule_info = vtranslate("LBL_NONE", $this->currentModule); } $return_val .= $schedule_info; $return_arr[] = array("val" => $return_val, "colspan" => ""); $return_val = "<b>" . vtranslate("LBL_LIMIT", $this->currentModule) . ": </b>"; if (!empty($this->reportinformations["summaries_columns"])) { $return_val .= vtranslate("LBL_Summaries", $this->currentModule) . " "; if (isset($this->reportinformations["summaries_limit"]) && $this->reportinformations["summaries_limit"] != "0") { $summ_limit_str = $this->reportinformations["summaries_limit"] . " " . vtranslate("LBL_RECORDS", $this->currentModule); } else { $summ_limit_str = vtranslate("LBL_ALL", $this->currentModule) . " " . strtolower(vtranslate("LBL_RECORDS", $this->currentModule)); } $return_val .= $summ_limit_str; if ($this->reportinformations["selectedColumnsString"] != "") { $return_val .= ", " . vtranslate("LBL_Details", $this->currentModule) . " "; } } if ($this->reportinformations["selectedColumnsString"] != "") { if (isset($this->reportinformations["columns_limit"]) && $this->reportinformations["columns_limit"] != "0") { $limit_str = $this->reportinformations["columns_limit"] . " " . vtranslate("LBL_RECORDS", $this->currentModule); } else { $limit_str = vtranslate("LBL_ALL", $this->currentModule) . " " . strtolower(vtranslate("LBL_RECORDS", $this->currentModule)); } $return_val .= $limit_str; } $return_arr[] = array("val" => $return_val, "colspan" => ""); $return_val = "<b>" . vtranslate("LBL_CHART_INFO", $this->currentModule) . ": </b>"; $ch_column_populated = false; $new_ch_info = $n_ch_info = $ch_column_str = ""; if (!empty($this->reportinformations["charts"])) { foreach ($this->reportinformations["charts"] as $chi => $ch_array) { $ch_type = $ch_array["charttype"]; if ($ch_column_populated != true) { if ($ch_array["x_group"] == "group1") { $ch_column_lbl = GenerateObj::getHeaderLabel($this->record, "SC", "", $this->reportinformations["Group1"]); if (is_array($ch_column_lbl) && $ch_column_lbl["lbl"] != "") { $ch_column_lbl = $ch_column_lbl["lbl"]; } $ch_column[] = $ch_column_lbl; } elseif ($ch_array["x_group"] == "group2") { $ch_column_lbl = GenerateObj::getHeaderLabel($this->record, "SC", "", $this->reportinformations["Group1"]); if (is_array($ch_column_lbl) && $ch_column_lbl["lbl"] != "") { $ch_column_lbl = $ch_column_lbl["lbl"]; } $ch_column[] = $ch_column_lbl; $ch_column_lbl = GenerateObj::getHeaderLabel($this->record, "SC", "", $this->reportinformations["Group1"]); if (is_array($ch_column_lbl) && $ch_column_lbl["lbl"] != "") { $ch_column_lbl = $ch_column_lbl["lbl"]; } $ch_column[] = $ch_column_lbl; } $ch_column_str = implode(", ", $ch_column); $ch_column_populated = true; } $ch_dataseries = GenerateObj::getHeaderLabel($this->record, "SM", "", $ch_array["dataseries"]); if (is_array($ch_dataseries) && $ch_dataseries["lbl"] != "") { $ch_dataseries = $ch_dataseries["lbl"]; } $n_ch_info[] = vtranslate("LBL_CHART_{$ch_type}", $this->currentModule) . " " . vtranslate("LBL_CHART", $this->currentModule) . " ({$ch_dataseries})"; } $new_ch_info = vtranslate("LBL_CHART_DataSeries", $this->currentModule) . " " . $ch_column_str . " [" . implode(", ", $n_ch_info) . "]"; } else { $new_ch_info = " <small><i>(" . vtranslate("LBL_NO_CHARTS", $this->currentModule) . ")</i></small>"; } $return_val .= $new_ch_info; /* if(isset($this->reportinformations["charts"]) && $this->reportinformations["charts"]["charttype"]=="" && isset($this->reportinformations["charts"]["dataseries"]) && $this->reportinformations["charts"]["dataseries"]!=""){ $ch_info = " <small><i>(".vtranslate("LBL_NO_CHARTS", $this->currentModule).")</i></small>"; }elseif(isset($this->reportinformations["Group1"]) && $this->reportinformations["Group1"]!="none" && isset($this->reportinformations["charts"]) && $this->reportinformations["charts"]["charttype"]!="none" && isset($this->reportinformations["charts"]["dataseries"]) && $this->reportinformations["charts"]["dataseries"]!=""){ // columns visibility control !!!!!! if($this->getColumnVisibilityPerm($this->reportinformations["Group1"])==0 && $this->getColumnVisibilityPerm($this->reportinformations["charts"]["dataseries"])==0){ $ch_column = GenerateObj::getHeaderLabel($this->record,"SC","",$this->reportinformations["Group1"]); if(is_array($ch_column) && $ch_column["lbl"]!=""){ $ch_column = $ch_column["lbl"]; } $ch_dataseries = GenerateObj::getHeaderLabel($this->record,"SM","",$this->reportinformations["charts"]["dataseries"]); if(is_array($ch_dataseries) && $ch_dataseries["lbl"]!=""){ $ch_dataseries = $ch_dataseries["lbl"]; } $ch_type = $this->reportinformations["charts"]["charttype"]; $ch_info = vtranslate("LBL_CHART_$ch_type", $this->currentModule)." ".vtranslate("LBL_CHART", $this->currentModule)." ($ch_column, $ch_dataseries)"; } }else{ $ch_info = " <small><i>(".vtranslate("LBL_CHARE", $this->currentModule)." ".vtranslate("LBL_IGNORED", $this->currentModule)."!)</i></small>"; } $return_val .= $ch_info; */ $return_arr[] = array("val" => $return_val, "colspan" => ""); $return_val = "<b>" . vtranslate("LBL_Columns", $this->currentModule) . ": </b>"; $col_order_str = ""; if (isset($this->reportinformations["selectedColumnsString"]) && $this->reportinformations["selectedColumnsString"] != "") { $selected_column_string = $this->reportinformations["selectedColumnsString"]; $selected_column_array = explode(";", html_entity_decode($selected_column_string, ENT_QUOTES, $default_charset)); if (!empty($selected_column_array)) { foreach ($selected_column_array as $column_str) { if ($column_str != "" && $column_str != "none") { // columns visibility control !!!!!! if ($this->getColumnVisibilityPerm($column_str) == 0) { $column_lbl = $this->getColumnStr_Label($column_str, "SC"); $columns[] = $column_lbl; } } } } if (isset($this->reportinformations["SortByColumn"]) && $this->reportinformations["SortByColumn"] != "none") { $col_order_arr[] = vtranslate("LBL_SORT_FIELD", $this->currentModule); $col_order_column = $this->getColumnStr_Label($this->reportinformations["SortByColumn"], "SC"); $col_order_arr[] = $col_order_column; if ($this->reportinformations["SortOrderColumn"] == "DESC") { $col_order_arr[] = vtranslate("Descending"); } else { $col_order_arr[] = vtranslate("Ascending"); } $col_order_str = implode(" ", $col_order_arr); } } if (empty($columns)) { $columns[] = vtranslate("LBL_NONE", $this->currentModule); } $return_val .= implode(", ", $columns); if ($this->reportinformations["timeline_type2"] == "cols" || $this->reportinformations["timeline_type3"] == "cols") { $return_val .= " <small><i>(" . vtranslate("LBL_NOT_A", $this->currentModule) . " " . vtranslate("LBL_IGNORED", $this->currentModule) . "!)</i></small>"; } if ($col_order_str != "") { $return_val .= " ({$col_order_str})"; } $return_arr[] = array("val" => $return_val, "colspan" => "2"); $return_val = "<b>" . vtranslate("LBL_SummariesColumns", $this->currentModule) . ": </b>"; $summ_order_str = ""; if (isset($this->reportinformations["summaries_columns"]) && !empty($this->reportinformations["summaries_columns"])) { foreach ($this->reportinformations["summaries_columns"] as $column_arr) { $column_str = $column_arr["columnname"]; // columns visibility control !!!!!! if ($this->getColumnVisibilityPerm($column_str) == 0) { $sm_column_lbl = $this->getColumnStr_Label($column_str, "SM"); $summaries_columns[] = $sm_column_lbl; } } if (isset($this->reportinformations["summaries_orderby_columns"]) && !empty($this->reportinformations["summaries_orderby_columns"])) { if ($this->reportinformations["summaries_orderby_columns"][0]["column"] != "none") { $summ_order_arr[] = vtranslate("LBL_SORT_FIELD", $this->currentModule); $summ_order_column = $this->getColumnStr_Label($this->reportinformations["summaries_orderby_columns"][0]["column"], "SM"); $summ_order_arr[] = $summ_order_column; if ($this->reportinformations["summaries_orderby_columns"][0]["type"] == "DESC") { $summ_order_arr[] = vtranslate("Descending"); } else { $summ_order_arr[] = vtranslate("Ascending"); } $summ_order_str = implode(" ", $summ_order_arr); } } } if (empty($summaries_columns)) { $summaries_columns[] = vtranslate("LBL_NONE", $this->currentModule); } $return_val .= implode(", ", $summaries_columns); if ($summ_order_str != "") { $return_val .= " ({$summ_order_str})"; } $return_arr[] = array("val" => $return_val, "colspan" => "2"); $return_val = "<b>" . vtranslate("LBL_Filters", $this->currentModule) . ": </b>"; $std_filter_columns = $this->getStdFilterColumns(); if (isset($_REQUEST["reload"])) { $tmp = $this->getAdvanceFilterOptionsJSON($this->primarymodule); $criteria_columns = $this->getRequestCriteria($this->adv_sel_fields); if (!empty($criteria_columns)) { if (isset($_REQUEST["reload"])) { foreach ($criteria_columns as $group_id => $group_arr) { $criteria_columns = $group_arr["columns"]; if (!empty($criteria_columns)) { foreach ($criteria_columns as $criteria_groups_arr) { if ($criteria_groups_arr["columnname"] != "") { // columns visibility control !!!!!! if ($this->getColumnVisibilityPerm($criteria_groups_arr["columnname"]) == 0) { $column_condition = ""; if ($criteria_groups_arr["column_condition"] != "") { $column_condition = $criteria_groups_arr["column_condition"]; } if (in_array($criteria_groups_arr["columnname"], $std_filter_columns)) { $comparator = $criteria_groups_arr["comparator"]; $comparator_val = $this->Date_Filter_Values[$comparator]; $comparator_info = vtranslate($comparator_val, $this->currentModule); if ($comparator == "custom") { $comparator_info_arr = explode("<;@STDV@;>", html_entity_decode(trim($criteria_groups_arr["value"]), ENT_QUOTES, $default_charset)); if ($comparator_info_arr[0] != "" && $comparator_info_arr[1] != "") { $comparator_info .= vtranslate("BETWEEN", $this->currentModule) . " "; $comparator_info .= $comparator_info_arr[0] . " "; $comparator_info .= vtranslate("LBL_AND", $this->currentModule) . " "; $comparator_info .= $comparator_info_arr[1]; } elseif ($comparator_info_arr[0] != "") { $comparator_info .= vtranslate("LBL_IS", $this->currentModule) . " "; $comparator_info .= $comparator_info_arr[0]; } elseif ($comparator_info_arr[1] != "") { $comparator_info .= vtranslate("LBL_IS", $this->currentModule) . " "; $comparator_info .= $comparator_info_arr[1]; } } $criteria_info_value = ""; } else { $comparator = self::$adv_filter_options[$criteria_groups_arr["comparator"]]; $comparator_info = vtranslate($comparator, $this->currentModule); $criteria_info_value = $criteria_groups_arr["value"]; } $ft_column_lbl = $this->getColumnStr_Label($criteria_groups_arr["columnname"]); $condition_info = $ft_column_lbl . " " . $comparator_info . " " . $criteria_info_value . " " . $column_condition; $conditions_arr[$group_id][] = $condition_info; } } } } $group_conditions[$group_id] = $group_arr["condition"]; } } } } else { $criteria_columns = $this->reportinformations["advft_criteria"]; $criteria_groups = $this->reportinformations["advft_criteria_groups"]; if (!empty($criteria_groups) && !empty($criteria_columns)) { foreach ($criteria_groups as $criteria_groups_arr) { $group_id = $criteria_groups_arr["groupid"]; $group_condition = $criteria_groups_arr["group_condition"]; $group_conditions[$group_id] = $group_condition; } foreach ($criteria_columns as $criteria_groups_arr) { if ($criteria_groups_arr["columnname"] != "") { // filter columns and values visibility control !!!!!! start if ($this->getColumnVisibilityPerm($criteria_groups_arr["columnname"]) == 0) { if (array_key_exists($criteria_groups_arr["columnname"], $this->adv_sel_fields)) { $this->getColumnValuesVisibilityPerm($criteria_groups_arr["value"], $this->adv_sel_fields[$criteria_groups_arr["columnname"]]); } } // filter columns and values visibility control !!!!!! end $column_condition = ""; if ($criteria_groups_arr["column_condition"] != "") { $column_condition = $criteria_groups_arr["column_condition"]; } if (in_array($criteria_groups_arr["columnname"], $std_filter_columns)) { $comparator = $criteria_groups_arr["comparator"]; $comparator_val = $this->Date_Filter_Values[$comparator]; $comparator_info = vtranslate($comparator_val, $this->currentModule); if ($comparator == "custom") { $comparator_info_arr = explode("<;@STDV@;>", html_entity_decode(trim($criteria_groups_arr["value"]), ENT_QUOTES, $default_charset)); if ($comparator_info_arr[0] != "" && $comparator_info_arr[1] != "") { $comparator_info .= vtranslate("BETWEEN", $this->currentModule) . " "; $comparator_info .= $comparator_info_arr[0] . " "; $comparator_info .= vtranslate("LBL_AND", $this->currentModule) . " "; $comparator_info .= $comparator_info_arr[1]; } elseif ($comparator_info_arr[0] != "") { $comparator_info .= vtranslate("LBL_IS", $this->currentModule) . " "; $comparator_info .= $comparator_info_arr[0]; } elseif ($comparator_info_arr[1] != "") { $comparator_info .= vtranslate("LBL_IS", $this->currentModule) . " "; $comparator_info .= $comparator_info_arr[1]; } } $criteria_info_value = ""; } else { $comparator = self::$adv_filter_options[$criteria_groups_arr["comparator"]]; $comparator_info = vtranslate($comparator, $this->currentModule); $criteria_info_value = $criteria_groups_arr["value"]; } $ft_column_lbl = $this->getColumnStr_Label($criteria_groups_arr["columnname"]); $conditions_arr[$criteria_groups_arr["groupid"]][] = $ft_column_lbl . " " . $comparator_info . " " . $criteria_info_value . " " . $column_condition; } } } } $filters_str = ""; if (!empty($group_conditions)) { foreach ($group_conditions as $g_condition_id => $g_condition) { if (isset($conditions_arr[$g_condition_id]) && !empty($conditions_arr[$g_condition_id])) { $filters_str .= " (" . trim(implode(" ", $conditions_arr[$g_condition_id])) . ") "; if ($g_condition != "") { $filters_str .= " " . vtranslate($g_condition, $this->currentModule) . " "; } } } } if ($filters_str == "") { $filters_str .= vtranslate("LBL_NONE", $this->currentModule); } $return_val .= $filters_str; $return_arr[] = array("val" => $return_val, "colspan" => "2"); $td_i = 0; foreach ($return_arr as $ra_key => $ra_arr) { if (isset($ra_arr["colspan"]) && $ra_arr["colspan"] != "") { $ra_colspan = $ra_arr["colspan"]; } else { $ra_colspan = 1; } $ra_val = $ra_arr["val"]; if ($ra_key === "reportname") { $return_name .= "<tr>"; $return_name .= "<td colspan='{$ra_colspan}' class='rpt4youGrpHeadInfoText' width='100%' style='border:0px;'>"; $return_name .= "{$ra_val}"; $return_name .= "</td>"; $return_name .= "</tr>"; } else { if ($td_i == 0) { $return .= "<tr>"; } $return .= "<td colspan='{$ra_colspan}' class='rpt4youGrpHeadInfo' style='text-align:left;padding-left:20px;width:50%;'>"; $return .= $ra_val; $return .= "</td>"; $td_i += $ra_colspan; if ($td_i == $colspan) { $return .= "</tr>"; $td_i = 0; } } /* $ra_val = $ra_arr["val"]; if(isset($ra_arr["colspan"]) && $ra_arr["colspan"]!=""){ $ra_colspan = $ra_arr["colspan"]; }else{ $ra_colspan = 1; } if($td_i==0){ $return .= "<tr>"; } if(is_numeric($ra_key)){ $return .= "<td colspan='$ra_colspan' class='rpt4youGrpHeadInfo' style='text-align:left;padding-left:10px;width:50%;'>"; }else{ $return .= "<td colspan='$ra_colspan' class='rpt4youGrpHeadInfo' style='text-align:center;font-size:25px;width:100%;'>"; } $return .= $ra_val; $return .= "</td>"; $td_i += $ra_colspan; if($td_i==$colspan){ $return .= "</tr>"; $td_i = 0; } */ } //$final_return = "<table class='rpt4youTableText' style='margin-top:1em;' width='100%'>"; $final_return = "<table class='rpt4youTableText' width='100%'>"; $final_return .= $return_name; $final_return .= "</table>"; $final_return .= "<table width='100%' ><tr><td align='center'>"; $final_return .= "<table class='rpt4youTable' width='98%'>"; $final_return .= $return; $final_return .= "</table>"; $final_return .= "</td></tr></table>"; // ITS4YOU-UP SlOl 4. 12. 2014 13:56:43 // ADD PAGE BREAK AFTER HEADER INFO disabled - remove // to enable it please // $final_return .= "<div style='page-break-after:always'></div>"; } return $final_return; }