Location: PHPKode > projects > MembersGear > membersgear/admin/admin_product_canned_email_v.php
<?php
  require_once "../config/config.php";
 //for display the header.php
          echo($smarty->fetch('admin_header.php'));
          
           
            if($message->IsMessageExists())
           {    
                $lsmsg=$message->GetMessage();
                echo "<br/><div class=\"succmsg\" style=\"width:400px\">$lsmsg</div>";
           }
          
            echo "<div id=\"content\" class=\"setdiv\"> ";
            echo "<div id=\"full-contentdiv\">";
            echo "<div class=\"righttop\">";
            echo "<h2 align=\"center\">";
            echo "Product Specific Canned Emails List";
            echo "</h2>";
            echo "</div>";
            echo "<div class=\"whole-page clear\">";
            
            /****************************************************************************
            * Updated By Jayesh : for display character based paging
            *****************************************************************************/
            echo "<div style=\"width:100%;text-align:center;margin:2px;padding-left:60px;*padding-left:0px\">";
            echo PrintABCDPaging();
            echo "</div>";
            
             if(isset($_GET['letter']) and $_GET['letter'] != 'all')
              {
                    $lsSearchLetter = $_GET['letter'];
              }
              else
              {
                    $lsSearchLetter = '';   
              }
            
            
          //echo $res;
                /*$sql = 'SELECT id,name,CASE WHEN sendmessageto = \'Both\' THEN \'Administrator/User\' ELSE sendmessageto END AS `SendMsgTo`,CASE WHEN `status` = 1 THEN \'Active\' WHEN `status` = 0 THEN \'InActive\' END AS `Status` FROM '.TABLE_PREFIX.'email_templates';*/
               /* $sql = 'SELECT id,name,CASE WHEN sendmessageto = \'Both\' THEN \'Administrator/User\' ELSE sendmessageto END AS `SendMsgTo`,CASE WHEN `status` = 1 THEN \'Active\' WHEN `status` = 0 THEN \'InActive\' END AS `Status` FROM '.TABLE_PREFIX.'email_templates WHERE name like \''.$lsSearchLetter.'%\' and productid > 0';  */
               
               $sql = 'SELECT pet.id,pet.name as `EmailName`,pp.name as `ProductName`,
                        CASE WHEN pet.sendmessageto = \'Both\' THEN \'Administrator/User\'
                            ELSE pet.sendmessageto END AS `SendMsgTo`,
                        CASE WHEN pet.status = 1 THEN \'Active\'
                             WHEN pet.status = 0 THEN \'InActive\' END AS `Status`
                        FROM '.TABLE_PREFIX.'email_templates pet
                                join '.TABLE_PREFIX.'products pp on pp.id = pet.productid
                        WHERE pet.name like \''.$lsSearchLetter.'%\' and pet.productid > 0;';

                # execute the sql query
                $db->execute($sql);


                # creates a new phpSortColumn object for ID´s 
                //$col_0 = new phpSortColumn("id", "ID");
                
                #creates a new phpSortcolunm objects for name
                $col_0 = new phpSortColumn("EmailName", "Canned Email Name");
                
                $col_1 = new phpSortColumn("ProductName", "Product Name");
                
                # creates a new phpSortColumn object for Tile
                $col_2 = new phpSortColumn("SendMsgTo", "Send Message To");

                # creates a new phpSortColumn object for Field Type
                $col_3 = new phpSortColumn("Status", "Status");

                # add the columns to an array 
                $columns = array(0=>$col_0, 1=>$col_1, 2=>$col_2,3=>$col_3);

                # create a new phpSortable object with the abstracted db object
                # and the array of column object
                $sortable = new phpSortable($db, $columns);

                # define the table format: cellpadding, cellspacing, border
                $sortable->setTableFormat ("2", "2", "0");

                # define the table title
                $sortable->tableTitle = "";

                # Encrypt Edit and Delete Link
                $sortable->encryptlink = true;
                
                # define the link for edit of entries
                $sortable->editLink = "admin_product_canned_email_m.php?action=edit";

                # open the edit page in a new window
                //$sortable->editTarget = "_blank";

                # window format for the edit page
               // $sortable->editWindowFormat = "'width=300,height=400'";

                # define the link for delete of entries
                $sortable->deleteLink = "admin_product_canned_email_m.php?action=delete";

                # define the link for add new entries
                //$sortable->addLink = "admin_product_canned_email_m.php";

                # define the hint to be displyed over the add button
                //$sortable->addText = "Add New Canned Email";

                # define the key name to be attached to links
                $sortable->urlKeyName = "id";

                # define the column name of to be attached to links as key value
                $sortable->tableKeyName = "id";

                # define the prompt message to be diplayed on clicking the edit button            
                //$sortable->editPromptMsg = "Are you sure you want to edit this affiliate?";

                # define the prompt message to be diplayed on clicking the delete button
                $sortable->deletePromptMsg = "Are you sure you want to delete this Product Canned Email?";

                # define the message to be diplayed if there are no results found
                $sortable->emptyMsg = "No product canned Email found.";

                #define the deafult row number to be displayed
                $sortable->defaultRowsNum = "10";

                #define the path for the css file
                $sortable->cssFilePath = ADMIN_CSS_DIR."/phpSortable.css";

                #define the path for of the images directory
                $sortable->imgFilePath = ADMIN_IMAGE_DIR."/phpgrid/";

                # print the table            
                $sortable->printTable();

              echo "</div>";
              echo "</div>";
              echo "</div>";
                
              //For display footer.php
              echo($smarty->fetch('admin_footer.php'));   
 
?>
Return current item: MembersGear