Location: PHPKode > projects > MembersGear > membersgear/admin/admin_email_uploader.php
<?php
  require_once "../config/config.php";
  
  //echo($smarty->fetch('admin_header.php'));
          
           
            if($message->IsMessageExists())
           {    
                $lsmsg=$message->GetMessage();
                echo "<br/><div class=\"succmsg\" style=\"width:400px\">$lsmsg</div>";
           }
            echo "<link href=\"css/adminpanel.css\" rel=\"stylesheet\" type=\"text/css\" />";
            echo "<script src=\"".ADMIN_JS_DIR."/show_email_content.js\"></script>";
            
            echo "<script language=\"JavaScript\">";
            
            echo "function EditMail(id,subject){";
            echo "if(confirm('Are you sure you want to edit canned message \"'+subject+'\" and navigate to edit page? Choosing Ok option will close this popup.')){";
            echo "window.opener.location.replace(\"admin_canned_email.php?action=edit&id=\"+id);";
            echo "window.close();";
            echo "}";
            echo "}";
            
            echo "function SelectEmail(id,subject,hdnField,txtField){";
            echo "if(hdnField == '' && txtField == ''){";
            echo "var hdnField = document.getElementById('hdnTemplateId').value;";
            echo "var txtField = document.getElementById('hdnTextBoxId').value;";
            echo "}";
            echo "top.window.opener.setEmailFieldValue(id, subject, hdnField, txtField);";
            echo "top.window.close();";
            echo "}";
            
            echo "</script>";

            
            
            echo "<div id=\"content\" class=\"setdiv\" style=\"*width:auto !important\"> ";
            echo "<div id=\"full-contentdiv\" style=\"*width:100% !important\">";
            echo "<div class=\"righttop\">";
            echo "<h2 align=\"center\">";
            echo "Canned Email List";
            echo "</h2>";
            echo "</div>";
            echo "<div class=\"whole-page clear\" style=\"*width:100% !important\">";
            
            /****************************************************************************
            * 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,email_subject,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`,
                        concat(\'<a href="#" onclick="SelectEmail(\',id,\',\',name,\');">select</a>\') as `Select`,
                        concat(\'<a href="#" onclick="showEmailContent(\',id,\');">more</a>\') as `More`,
                        concat(\'<a href="#" onclick="EditMail(\',id,\');">edit</a>\') as `Edit` 
                        FROM '.TABLE_PREFIX.'email_templates WHERE status=1';
                 */
                 $hdnIdControl = $_GET['hdn'];
                 $emailTextBox = $_GET['box'];
                 
                 //print_r($_GET);
                 
                 //$i = encrypt('hdn=hdn-subscription-expires&box=txt-sub-expire-email');
                 //echo $i.'<br/>';
                 //echo decrypt($i);
                 
                 //print_r($_GET);
                 
                /* 
                 echo $hdnIdControl.'<br/>';
                 echo $emailTextBox.'<br/>';
                 die;*/        
                        
                $sql = "SELECT id,name,email_subject,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`,
                        concat('<a href=\"#\" onclick=\"SelectEmail(',`id`,',\'',`name`,'\',\'{$hdnIdControl}\',\'{$emailTextBox}\');\">select</a>') as `Select`,
                        concat('<a href=\"#\" onclick=\"showEmailContent(',`id`,',\'{$hdnIdControl}\',\'{$emailTextBox}\');return false;\">more</a>') as `More`,
                        concat('<a href=\"#\" onclick=\"EditMail(',`id`,',\'',`name`,'\');\">edit</a>') as `Edit` 
                        FROM ".TABLE_PREFIX."email_templates WHERE status=1 and name like '$lsSearchLetter%' and productid = 0";
                //echo 
                # 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("name", "Name");
                
                # creates a new phpSortColumn object for Tile
                $col_1 = new phpSortColumn("SendMsgTo", "Send Message To");

                # creates a new phpSortColumn object for Field Type
                $col_2 = new phpSortColumn("email_subject", "Subject");

                $col_3 = new phpSortColumn("More", "Detail","",'link','','','','_self');  
                
                $col_4 = new phpSortColumn("Select", "","",'link','alert(\'h\');','','','_self');  

                $col_5 = new phpSortColumn("Edit", "","",'link','admin_canned_email.php?action=edit','','','_self');  
                
                # add the columns to an array 
                $columns = array(0=>$col_0, 1=>$col_1, 2=>$col_2,3=>$col_3,4=>$col_4,5=>$col_5);

                # 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 = "";

                # define the link for edit of entries
                //$sortable->editLink = "";

                # 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_canned_email.php?action=delete";

                # define the link for add new entries
                //$sortable->addLink = "admin_canned_email.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 Canned Email?";

                # define the message to be diplayed if there are no results found
                $sortable->emptyMsg = "No Field 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 "<input type=\"hidden\" id=\"hdnTemplateId\" name=\"hdnTemplateId\" value=\"$hdnIdControl\">";
              echo "<input type=\"hidden\" id=\"hdnTextBoxId\" name=\"hdnTextBoxId\" value=\"$emailTextBox\">";
              echo "</div>";
              echo "</div>";
              echo "</div>";
              
              echo "<div id=\"message-detail\" class=\"whole-page clear\" style=\"border:none; height: auto ! important; *width: 98% ! important;*margin-left:20px !important;margin-left:30px !important;\">";
              //echo "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
              echo "</div>";
              //For display footer.php
              //echo($smarty->fetch('admin_footer.php')); 
?>
Return current item: MembersGear