Another great feature in PHPMaker 9 is the ability to define which records will be exported to the certain media/files. There are three options available that you can choose from PHP tab -> List/View Page Options (Global) sub-tab -> Export groupbox -> Export Type selection. The first option is All pages which means that records in all pages are exported. The second option is Current page which means that all records in current page are exported. And the last/third option is Selected records which means a checkbox will be displayed in each row for selection. Only selected records in the current page are exported (selecting records in different pages is not allowed). To select records primary key is required, Current Page export type will be used for tables without primary key.
Unfortunately, PHPMaker 9 only allows you to choose one of the three options above. If — for example — someday you want to switch from the current option to another, then you have to change it from your PHPMaker project application, afterwards you have to re-generate all the related pages that contain this export feature. Imagine now if you have to re-generate the hundred pages and then you have to re-upload them again to your web server. I think there should be another efficient and effective way to overcome this issue, right?
Well, I have successfully customized the PHPMaker template in order to make it come true. Besides that, there is a new constant I added into the configuration (ewcfg9.php) file. Now you only need to change this constant value and save the change, afterwards, your users will use the new settings in all pages that contain the export feature. In other words, you don’t have to re-generate your .php files anymore each time you want to change from the old option to the new option of the three options above.
If you disable Use global settings from the Table setup of PHPMaker, then the export setting that belongs to the table will being used. In other words, this customization will also handle the possibility of using the table setting instead of the global setting that derived from the constants value in the configuration file.
Since this customization is related to the article titled How to Restrict the Permission Access in “Export to …” Feature in Websites that Created with PHPMaker 9.0.1, then you have to implement the customization in that article first before doing this customization below. So, please make sure you have already implemented the customization in that article!
Updated on May 30, 2012: This customization has been implemented in PHPMaker version 9.0.2, it matches to each other, and as a result, it works properly.
Updated on July 22, 2012: This customization has been implemented in PHPMaker version 9.0.3, it matches to each other, and as a result, it works properly.
Updated on September 4, 2012: This customization has been implemented in PHPMaker version 9.0.4, it matches to each other, and as a result, it works properly.
Updated on November 28, 2012: This customization has been implemented in PHPMaker version 9.1.0, it matches to each other, and as a result, it works properly.
Updated on February 9, 2013: This customization has been implemented in PHPMaker version 9.2.0, it matches to each other, and as a result, it works properly.
Updated on June 17, 2013: This customization below has been handled by using MasinoFixedWidthSite extension. You don’t need to implement the customization below if you use my extensions together with the original PHPMaker Template and Extension files.
[hidepost]
-
Open your \Script\ewcfg.php file, and find this code:
// General
before that line, please insert the following code:
// Begin of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 <!--## if (PROJ.ExportType == "SELECTED") { ##--> define("MS_EXPORT_RECORD_OPTIONS", "selectedrecords", TRUE); // available values: "allpages", "currentpage", "selectedrecords" <!--## } else if (PROJ.ExportType == "ALL") { ##--> define("MS_EXPORT_RECORD_OPTIONS", "allpages", TRUE); // available values: "allpages", "currentpage", "selectedrecords" <!--## } else { ##--> define("MS_EXPORT_RECORD_OPTIONS", "currentpage", TRUE); // available values: "allpages", "currentpage", "selectedrecords" <!--## } ##--> // End of modification Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012
As you can see from the customization, we can define the default value for MS_EXPORT_RECORD_OPTIONS based on the related value in PHPMaker application -> PHP -> List/View Page Options (Global) -> Export -> Export type.
-
Open your \Script\info.php file, and find this code:
$this->ExportAll = <!--##=ew_Val(bExportAll)##-->;
then replace it with the following code:
// Begin of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 <!--## if (TABLE.TblUseGlobal) { ##--> $this->ExportAll = MS_EXPORT_RECORD_OPTIONS; <!--## } else { ##--> $this->ExportAll = <!--##=ew_Val(bExportAll)##-->; <!--## } ##--> // End of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012
-
Open your \Script\list-script.php file, and find this code (only for you who are using PHPMaker <= 9.0.3):
[code lang="php"]
// Export selected records
if ($this->Export <> "")
$this->CurrentFilter = $this->BuildExportSelectedFilter();
[/code]and for those of you who are using PHPMaker >= 9.0.4, then find this code:
<!--## if (bExportSelectedOnly && CTRL.CtrlID == "list") { ##--> // Export selected records if ($this->Export <> "") $this->CurrentFilter = $this->BuildExportSelectedFilter(); <!--## } ##-->
then replace it with the following code:
// Begin of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 <!--## if (TABLE.TblUseGlobal) { ##--> if ((MS_EXPORT_RECORD_OPTIONS=="selectedrecords") && (CurrentPageID() == "list")) { // Export selected records if ($this->Export <> "") $this->CurrentFilter = $this->BuildExportSelectedFilter(); } <!--## } else { ##--> <!--## if (bExportSelectedOnly && CTRL.CtrlID == "list") { ##--> // Export selected records if ($this->Export <> "") $this->CurrentFilter = $this->BuildExportSelectedFilter(); <!--## } ##--> <!--## } ##--> // End of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012
-
Still in that \Script\list-script.php file, find again this code:
<!--## if (bExportSelectedOnly) { ##--> <input type="hidden" name="exporttype" id="exporttype" value="" /> <!--## } ##-->
then replace it with the following code:
<?php // Begin of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 ?> <!--## if (TABLE.TblUseGlobal) { ##--> <?php if (MS_EXPORT_RECORD_OPTIONS=="selectedrecords") { ?> <input type="hidden" name="exporttype" id="exporttype" value="" /> <?php } ?> <!--## } else { ##--> <!--## if (bExportSelectedOnly) { ##--> <input type="hidden" name="exporttype" id="exporttype" value="" /> <!--## } ##--> <!--## } ##--> <?php // End of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 ?>
-
Still in that \Script\list-script.php file, find again this code:
if ($<!--##=sPageObj##-->->DisplayRecs <= 0 || ($<!--##=gsTblVar##-->->Export <> "" && $<!--##=gsTblVar##-->->ExportAll)) // Display all records $<!--##=sPageObj##-->->DisplayRecs = $<!--##=sPageObj##-->->TotalRecs; if (!($<!--##=gsTblVar##-->->Export <> "" && $<!--##=gsTblVar##-->->ExportAll)) $<!--##=sPageObj##-->->SetUpStartRec(); // Set up start record position
then replace it with the following code:
// Begin of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 if ($<!--##=sPageObj##-->->DisplayRecs <= 0 || ($<!--##=gsTblVar##-->->Export <> "" && $<!--##=gsTblVar##-->->ExportAll=="allpages")) // Display all records $<!--##=sPageObj##-->->DisplayRecs = $<!--##=sPageObj##-->->TotalRecs; if (!($<!--##=gsTblVar##-->->Export <> "" && $<!--##=gsTblVar##-->->ExportAll=="allpages")) $<!--##=sPageObj##-->->SetUpStartRec(); // Set up start record position // End of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012
-
Still in that \Script\list-script.php file, find again this code:
if ($<!--##=gsTblVar##-->->ExportAll && $<!--##=gsTblVar##-->->Export <> "") { $<!--##=sPageObj##-->->StopRec = $<!--##=sPageObj##-->->TotalRecs;
then replace it with the following code:
// Begin of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 if ($<!--##=gsTblVar##-->->ExportAll=="allpages" && $<!--##=gsTblVar##-->->Export <> "") { $<!--##=sPageObj##-->->StopRec = $<!--##=sPageObj##-->->TotalRecs; // End of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012
-
Open your \Script\share-script.php file, and find this code:
<!--## if (bExportSelectedOnly && CTRL.CtrlID == "list") { ##--> // Build export filter for selected records function BuildExportSelectedFilter() { global $Language; $sWrkFilter = ""; if ($this->Export <> "") { $sWrkFilter = $this->GetKeyFilter(); } return $sWrkFilter; } <!--## } ##-->
then replace it with the following code:
// Begin of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 // Build export filter for selected records function BuildExportSelectedFilter() { global $Language; $sWrkFilter = ""; if ($this->Export <> "") { $sWrkFilter = $this->GetKeyFilter(); } return $sWrkFilter; } // End of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012
-
Still in that \Script\share-script.php file, find again this code:
// Set up export options function SetupExportOptions() { // Begin of modification Permission Access for Export To Feature, by Masino Sinaga, May 5, 2012 global $Language, $Security; // <-- Added $Security variable by Masino Sinaga [/code] then replace it with the following code: [code lang="php"] // Begin of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 // Set up export options function SetupExportOptions() { // Begin of modification Permission Access for Export To Feature, by Masino Sinaga, May 5, 2012 global $Language, $Security, $<!--##=gsTblVar##-->; // <-- Added $Security variable by Masino Sinaga // End of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 [/code] </li> <li> Still in that <strong>\Script\share-script.php</strong> file, find again this code: $item->Body = <!--##=sExportPrintUrl##--> . <!--##=sPrinterFriendlyCaption##--> . "</a>";
then replace it with the following code:
// $item->Body = <!--##=sExportPrintUrl##--> . <!--##=sPrinterFriendlyCaption##--> . "</a>"; // Begin of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 <!--## if (TABLE.TblUseGlobal) { ##--> if (MS_EXPORT_RECORD_OPTIONS=="selectedrecords") { $item->Body = "<a href=\"javascript:void(0);\" onclick=\"var f=document.<!--##=sFormName##-->;ew_SubmitSelectedExport(f,'" . ew_CurrentPage() . "','print');\">" . "<img src=\"phpimages/print.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("PrinterFriendly")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("PrinterFriendly")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; } else { $item->Body = "<a href=\"" . $this->ExportPrintUrl . "\">" . "<img src=\"phpimages/print.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("PrinterFriendly")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("PrinterFriendly")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; } <!--## } else { ##--> <!--## if (bExportSelectedOnly) { ##--> $item->Body = "<a href=\"javascript:void(0);\" onclick=\"var f=document.<!--##=sFormName##-->;ew_SubmitSelectedExport(f,'" . ew_CurrentPage() . "','print');\">" . "<img src=\"phpimages/print.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("PrinterFriendly")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("PrinterFriendly")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; <!--## } else { ##--> $item->Body = "<a href=\"" . $this->ExportPrintUrl . "\">" . "<img src=\"phpimages/print.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("PrinterFriendly")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("PrinterFriendly")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; <!--## } ##--> <!--## } ##--> // End of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012
-
Still in that \Script\share-script.php file, find again this code:
$item->Body = <!--##=sExportExcelUrl##--> . <!--##=sExportToExcelCaption##--> . "</a>";
then replace it with the following code:
// Begin of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 <!--## if (TABLE.TblUseGlobal) { ##--> if (MS_EXPORT_RECORD_OPTIONS=="selectedrecords") { $item->Body = "<a href=\"javascript:void(0);\" onclick=\"var f=document.<!--##=sFormName##-->;ew_SubmitSelectedExport(f,'" . ew_CurrentPage() . "','excel');\">" . "<img src=\"phpimages/exportxls.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToExcel")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToExcel")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; } else { $item->Body = "<a href=\"" . $this->ExportExcelUrl . "\">" . "<img src=\"phpimages/exportxls.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToExcel")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToExcel")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; } <!--## } else { ##--> <!--## if (bExportSelectedOnly) { ##--> $item->Body = "<a href=\"javascript:void(0);\" onclick=\"var f=document.<!--##=sFormName##-->;ew_SubmitSelectedExport(f,'" . ew_CurrentPage() . "','excel');\">" . "<img src=\"phpimages/exportxls.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToExcel")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToExcel")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; <!--## } else { ##--> $item->Body = "<a href=\"" . $this->ExportExcelUrl . "\">" . "<img src=\"phpimages/exportxls.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToExcel")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToExcel")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; <!--## } ##--> <!--## } ##--> // End of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012
-
Still in that \Script\share-script.php file, find again this code:
$item->Body = <!--##=sExportWordUrl##--> . <!--##=sExportToWordCaption##--> . "</a>";
then replace it with the following code:
// Begin of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 <!--## if (TABLE.TblUseGlobal) { ##--> if (MS_EXPORT_RECORD_OPTIONS=="selectedrecords") { $item->Body = "<a href=\"javascript:void(0);\" onclick=\"var f=document.<!--##=sFormName##-->;ew_SubmitSelectedExport(f,'" . ew_CurrentPage() . "','word');\">" . "<img src=\"phpimages/exportdoc.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToWord")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToWord")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; } else { $item->Body = "<a href=\"" . $this->ExportWordUrl . "\">" . "<img src=\"phpimages/exportdoc.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToWord")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToWord")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; } <!--## } else { ##--> <!--## if (bExportSelectedOnly) { ##--> $item->Body = "<a href=\"javascript:void(0);\" onclick=\"var f=document.<!--##=sFormName##-->;ew_SubmitSelectedExport(f,'" . ew_CurrentPage() . "','word');\">" . "<img src=\"phpimages/exportdoc.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToWord")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToWord")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; <!--## } else { ##--> $item->Body = "<a href=\"" . $this->ExportWordUrl . "\">" . "<img src=\"phpimages/exportdoc.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToWord")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToWord")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; <!--## } ##--> <!--## } ##--> // End of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012
-
Still in that \Script\share-script.php file, find again this code:
$item->Body = <!--##=sExportHtmlUrl##--> . <!--##=sExportToHtmlCaption##--> . "</a>";
then replace it with the following code:
// Begin of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 <!--## if (TABLE.TblUseGlobal) { ##--> if (MS_EXPORT_RECORD_OPTIONS=="selectedrecords") { $item->Body = "<a href=\"javascript:void(0);\" onclick=\"var f=document.<!--##=sFormName##-->;ew_SubmitSelectedExport(f,'" . ew_CurrentPage() . "','html');\">" . "<img src=\"phpimages/exporthtml.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToHtml")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToHtml")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; } else { $item->Body = "<a href=\"" . $this->ExportHtmlUrl . "\">" . "<img src=\"phpimages/exporthtml.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToHtml")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToHtml")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; } <!--## } else { ##--> <!--## if (bExportSelectedOnly) { ##--> $item->Body = "<a href=\"javascript:void(0);\" onclick=\"var f=document.<!--##=sFormName##-->;ew_SubmitSelectedExport(f,'" . ew_CurrentPage() . "','html');\">" . "<img src=\"phpimages/exporthtml.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToHtml")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToHtml")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; <!--## } else { ##--> $item->Body = "<a href=\"" . $this->ExportHtmlUrl . "\">" . "<img src=\"phpimages/exporthtml.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToHtml")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToHtml")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; <!--## } ##--> <!--## } ##--> // End of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012
-
Still in that \Script\share-script.php file, find again this code:
$item->Body = <!--##=sExportXmlUrl##--> . <!--##=sExportToXmlCaption##--> . "</a>";
then replace it with the following code:
//$item->Body = <!--##=sExportXmlUrl##--> . <!--##=sExportToXmlCaption##--> . "</a>"; // Begin of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 <!--## if (TABLE.TblUseGlobal) { ##--> if (MS_EXPORT_RECORD_OPTIONS=="selectedrecords") { $item->Body = "<a href=\"javascript:void(0);\" onclick=\"var f=document.<!--##=sFormName##-->;ew_SubmitSelectedExport(f,'" . ew_CurrentPage() . "','xml');\">" . "<img src=\"phpimages/exportxml.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToXml")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToXml")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; } else { $item->Body = "<a href=\"" . $this->ExportXmlUrl . "\">" . "<img src=\"phpimages/exportxml.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToXml")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToXml")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; } <!--## } else { ##--> <!--## if (bExportSelectedOnly) { ##--> $item->Body = "<a href=\"javascript:void(0);\" onclick=\"var f=document.<!--##=sFormName##-->;ew_SubmitSelectedExport(f,'" . ew_CurrentPage() . "','xml');\">" . "<img src=\"phpimages/exportxml.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToXml")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToXml")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; <!--## } else { ##--> $item->Body = "<a href=\"" . $this->ExportXmlUrl . "\">" . "<img src=\"phpimages/exportxml.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToXml")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToXml")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; <!--## } ##--> <!--## } ##--> // End of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012
-
Still in that \Script\share-script.php file, find again this code:
$item->Body = <!--##=sExportCsvUrl##--> . <!--##=sExportToCsvCaption##--> . "</a>";
then replace it with the following code:
// Begin of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 <!--## if (TABLE.TblUseGlobal) { ##--> if (MS_EXPORT_RECORD_OPTIONS=="selectedrecords") { $item->Body = "<a href=\"javascript:void(0);\" onclick=\"var f=document.<!--##=sFormName##-->;ew_SubmitSelectedExport(f,'" . ew_CurrentPage() . "','csv');\">" . "<img src=\"phpimages/exportcsv.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToCsv")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToCsv")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; } else { $item->Body = "<a href=\"" . $this->ExportCsvUrl . "\">" . "<img src=\"phpimages/exportcsv.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToCsv")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToCsv")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; } <!--## } else { ##--> <!--## if (bExportSelectedOnly) { ##--> $item->Body = "<a href=\"javascript:void(0);\" onclick=\"var f=document.<!--##=sFormName##-->;ew_SubmitSelectedExport(f,'" . ew_CurrentPage() . "','csv');\">" . "<img src=\"phpimages/exportcsv.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToCsv")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToCsv")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; <!--## } else { ##--> $item->Body = "<a href=\"" . $this->ExportCsvUrl . "\">" . "<img src=\"phpimages/exportcsv.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToCsv")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToCsv")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; <!--## } ##--> <!--## } ##--> // End of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012
-
Still in that \Script\share-script.php file, find again this code:
$item->Body = <!--##=sExportPdfUrl##--> . <!--##=sExportToPdfCaption##--> . "</a>";
then replace it with the following code:
//$item->Body = <!--##=sExportPdfUrl##--> . <!--##=sExportToPdfCaption##--> . "</a>"; // Begin of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 <!--## if (TABLE.TblUseGlobal) { ##--> if (MS_EXPORT_RECORD_OPTIONS=="selectedrecords") { $item->Body = "<a href=\"javascript:void(0);\" onclick=\"var f=document.<!--##=sFormName##-->;ew_SubmitSelectedExport(f,'" . ew_CurrentPage() . "','pdf');\">" . "<img src=\"phpimages/exportpdf.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToPdf")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToPdf")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; } else { $item->Body = "<a href=\"" . $this->ExportPdfUrl . "\">" . "<img src=\"phpimages/exportpdf.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToPdf")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToPdf")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; } <!--## } else { ##--> <!--## if (bExportSelectedOnly) { ##--> $item->Body = "<a href=\"javascript:void(0);\" onclick=\"var f=document.<!--##=sFormName##-->;ew_SubmitSelectedExport(f,'" . ew_CurrentPage() . "','pdf');\">" . "<img src=\"phpimages/exportpdf.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToPdf")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToPdf")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; <!--## } else { ##--> $item->Body = "<a href=\"" . $this->ExportPdfUrl . "\">" . "<img src=\"phpimages/exportpdf.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToPdf")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToPdf")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; <!--## } ##--> <!--## } ##--> // End of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012
-
Still in that \Script\share-script.php file, find again this code:
$item->Body = "<a name=\"emf_<!--##=gsTblVar##-->\" id=\"emf_<!--##=gsTblVar##-->\" href=\"javascript:void(0);\" onclick=\"ew_EmailDialogShow({lnk:'emf_<!--##=gsTblVar##-->',hdr:ewLanguage.Phrase('ExportToEmail'),f:<!--##=sJsFormName##-->,sel:<!--##=ew_JsVal(bExportSelectedOnly)##-->});\">" . <!--##=sExportToEmailCaption##--> . "</a>";
then replace it with the following code:
// Begin of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 <!--## if (TABLE.TblUseGlobal) { ##--> if (MS_EXPORT_RECORD_OPTIONS=="selectedrecords") { $item->Body = "<a name=\"emf_<!--##=gsTblVar##-->\" id=\"emf_<!--##=gsTblVar##-->\" href=\"javascript:void(0);\" onclick=\"ew_EmailDialogShow({lnk:'emf_<!--##=gsTblVar##-->',hdr:ewLanguage.Phrase('ExportToEmail'),f:document.<!--##=sFormName##-->,sel:true});\">" . "<img src=\"phpimages/exportemail.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToEmail")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToEmail")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; } else { $item->Body = "<a name=\"emf_<!--##=gsTblVar##-->\" id=\"emf_<!--##=gsTblVar##-->\" href=\"javascript:void(0);\" onclick=\"ew_EmailDialogShow({lnk:'emf_<!--##=gsTblVar##-->',hdr:ewLanguage.Phrase('ExportToEmail'),f:document.<!--##=sFormName##-->,sel:false});\">" . "<img src=\"phpimages/exportemail.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToEmail")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToEmail")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; } <!--## } else { ##--> <!--## if (bExportSelectedOnly) { ##--> $item->Body = "<a name=\"emf_<!--##=gsTblVar##-->\" id=\"emf_<!--##=gsTblVar##-->\" href=\"javascript:void(0);\" onclick=\"ew_EmailDialogShow({lnk:'emf_<!--##=gsTblVar##-->',hdr:ewLanguage.Phrase('ExportToEmail'),f:document.<!--##=sFormName##-->,sel:true});\">" . "<img src=\"phpimages/exportemail.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToEmail")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToEmail")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; <!--## } else { ##--> $item->Body = "<a name=\"emf_<!--##=gsTblVar##-->\" id=\"emf_<!--##=gsTblVar##-->\" href=\"javascript:void(0);\" onclick=\"ew_EmailDialogShow({lnk:'emf_<!--##=gsTblVar##-->',hdr:ewLanguage.Phrase('ExportToEmail'),f:document.<!--##=sFormName##-->,sel:false});\">" . "<img src=\"phpimages/exportemail.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToEmail")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToEmail")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>"; <!--## } ##--> <!--## } ##--> // End of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012
-
Still in that \Script\share-script.php file, find again this code:
// Export all if ($this->ExportAll) {
then replace it with the following code:
// Export all // Begin of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012 if ($this->ExportAll=="allpages") { // End of mofidication Flexibility of Export Records Options, by Masino Sinaga, May 14, 2012
- Open your .pmp (PHPMaker project) file using PHPMaker application. Go to PHP tab, click on the List/View Page Options (Global) sub-tab, and then make sure from the Export groupbox -> Export Type selection, you have selected Selected records option. This is important in order to handle the minimum requirement/option; the selected records. Save the changes.
- Finally, re-generate all of the related script files as usual using PHPMaker as always.
[/hidepost]
Hi Masino,
I create my web site and have problems when exporting data to Excel. On local, i have no problems exporting my data, but on the remote server i get error.
I’ve got first an error with SAFE_MODE. I’ve turned it off and now I have this error :
“Warning: realpath() [function.realpath]: open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/var/www/xxxx…….xxxxx/phptmp/exec_dir/:/var/www/ccfcburkina.org/php-session/:/htdocs:/phptmp:/exec_dir:/php-session:/usr/share/php) in /htdocs/phpexcel177/Classes/PHPExcel/Shared/File.php on line 136”.
Can you help me to find solution to this problem ?
It seems that there is a problem with your system temporary directory. Check in your remote web server, and make sure your system temporary directory has been setup properly.
As you can see from the File.php that belongs to the phpexcel177 extension, this error came from the line 136 that located inside the sys_get_temp_dir function in that phpexcel extension.
Google for more information how to setup system temporary directory in your remote web server.
1 – i have an error encoding at arabic exported pdf file .
2 – i want to change direction of exported word pdf file from right to left to be in arabic language
any help mr masino
Ahmad,
1. Make sure you have already utf-8 for your PHPMaker project.
2. Unfortunately, my extensions have not supported, yet for RTL direction.