I Love PHPMaker

... because it gets even more powerful and flexible!!

  • About
  • Terms and Conditions
  • Membership Options
  • Sitemap
  • Downloads
    • PHPMaker Extensions Download
    • PHPMaker Projects Download
    • PHP Report Maker Extensions Download
I Love PHPMaker » Customize Template » How to Make the Flexibility Options for Export Records in Websites that Generated with PHPMaker 9.0.1
How to Disable/Enable the Registration Page in Websites that Created with PHPMaker 9.0.1
How to Make Menu Item Can be Opened in New Window/Tab in Websites that Created with PHPMaker 9.0.1

May 22, 2012

How to Make the Flexibility Options for Export Records in Websites that Generated with PHPMaker 9.0.1

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]

  1. 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.

  2. 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		
    
  3. 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
    
  4. 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 ?>
    
  5. 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
    
  6. 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
    
  7. 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
    
  8. 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
    &#91;/code&#93;
    
    then replace it with the following code:
    &#91;code lang="php"&#93;
    // 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
    &#91;/code&#93;
    </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
    
  9. 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
    
  10. 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
    
  11. 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
    
  12. 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
    
  13. 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
    
  14. 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
    
  15. 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
    
  16. 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
    
  17. 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.
  18. Finally, re-generate all of the related script files as usual using PHPMaker as always.

[/hidepost]

Article by Masino Sinaga / Customize Template / export options, Export to CSV, Export to Excel, Export to HTML, Export to PDF, Export to Word, Export to XML, PHPMaker 9.0.1, PHPMaker 9.0.2, PHPMaker 9.0.3, PHPMaker 9.0.4, PHPMaker 9.1.0, PHPMaker 9.2.0 4 Comments

How to Disable/Enable the Registration Page in Websites that Created with PHPMaker 9.0.1
How to Make Menu Item Can be Opened in New Window/Tab in Websites that Created with PHPMaker 9.0.1

Comments

  1. Thierry SEDGO says

    June 17, 2013 at 6:15 pm

    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 ?

    Log in to Reply
    • Masino Sinaga says

      June 17, 2013 at 7:47 pm

      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.

      Log in to Reply
  2. Ahmad Ibrahim says

    August 25, 2014 at 6:41 pm

    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

    Log in to Reply
    • Masino Sinaga says

      August 26, 2014 at 1:54 pm

      Ahmad,
      1. Make sure you have already utf-8 for your PHPMaker project.
      2. Unfortunately, my extensions have not supported, yet for RTL direction.

      Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • A New PHPMaker 2021 Project File Is Released
  • PHPMaker 2021 Demo Project File Is Released
  • Masino Extensions for PHPMaker 2021 Is Released!
  • A New PHPMaker 2020 Project File Is Released
  • PHPMaker 2020 Demo Project File Is Released
  • Masino Extensions for PHPMaker 2020 Is Released!
  • Inventory Stock Management Project, Why Should You Have It?
  • A New PHPMaker 2019 Project File Is Released!
  • PHPMaker 2019 Demo Project File Is Released!
  • Masino Extensions for PHPMaker 2019 Is Released!

Search

Recent Comments

  • saleh alayafi on A Case Study: Hiding Certain Fields Based on the Selected Value in ComboBox in Add Pages of the Websites that Generated by PHPMaker 9.2.0
  • Masino Sinaga on A Case Study: Hiding Certain Fields Based on the Selected Value in ComboBox in Add Pages of the Websites that Generated by PHPMaker 9.2.0
  • saleh alayafi on A Case Study: Hiding Certain Fields Based on the Selected Value in ComboBox in Add Pages of the Websites that Generated by PHPMaker 9.2.0
  • Masino Sinaga on A Case Study: Hiding Certain Fields Based on the Selected Value in ComboBox in Add Pages of the Websites that Generated by PHPMaker 9.2.0
  • Masino Sinaga on A Case Study: Hiding Certain Fields Based on the Selected Value in ComboBox in Add Pages of the Websites that Generated by PHPMaker 9.2.0

Demo Website

  • Demo of I Love PHPMaker 2021 (MasinoExtensions).
  • Indonesia Post Offices.
  • Stock Inventory Management.
  • Demo of PHPMaker + PHP Report Maker

Another Demo

The following template are not available in this site (must be purchased separately)

  • PHPMaker v2018 Horizontal Vertical Template.
  • PHPMaker v2017 Horizontal Vertical Template.

Demo Explanation

Stock Inventory Management is the good project for your reference, since it uses the real example in the real world. Many useful features you can use from this project, such as how to add the Thousand and Decimal separator character, and also how to calculate multiple row in Grid-Add when End-Users are entering data into the Grid-Add mode.

Categories

  • Customize Template (103)
  • General (3)
  • PHP Report Maker (17)
  • PHP Report Maker Extensions (2)
  • PHPMaker Extensions (79)
  • Tips and Trick (72)

Articles based on version

  • PHPMaker 2021
  • PHPMaker 2020
  • PHPMaker 2019
  • PHPMaker 2018
  • PHPMaker 2017.0.7
  • PHPMaker 12.0.7
  • PHPMaker 11.0.6
  • PHPMaker 10.0.5
  • PHPMaker 9.2.0
  • PHPMaker 8.0.3
  • PHP Report Maker 12

(c) I Love PHPMaker 2010 - 2019 by Masino Sinaga | WordPress | Log in | Back to top