Location: PHPKode > projects > MembersGear > membersgear/admin/admin_theme_v.php
   require_once "../config/config.php";   
   require_once INCLUDE_DIR."/users_class.php"; 
   $users=new users_class();
   if($users->IsAdminhavePermission($_SESSION[SESSION_PREFIX.'Admin_UserID'],'Can view template manager')==false)
            echo "<div id=\"content\" class=\"setdiv\"> ";
                        echo "<div class=\"errormsg\" style=\"width:331px\">$lsmsg</div>";
                        echo "<div class=\"succmsg\" style=\"width:331px\">$lsmsg</div>";  
                   echo "<div class=\"succmsg\" style=\"width:331px\">$lsmsg</div>";            
            echo "<div id=\"full-contentdiv\">";
            echo "<div class=\"righttop\">";
            echo "<h2 align=\"center\">";
            echo "Manage Templates";
            echo "</h2>";
            echo "</div>";
            echo "<div class=\"whole-page clear\">";
            * Updated By Jayesh : for display character based paging
            echo "<div class='controlDiv'>";
            echo PrintABCDPaging();
            echo "</div>";
             if(isset($_GET['letter']) and $_GET['letter'] != 'all')
                    $lsSearchLetter = $_GET['letter'];
                    $lsSearchLetter = '';   
          //echo $res;
                 $sql = 'SELECT *,case when `isdefault` = 1 then \'Active\' else \'Inactive\' end as `status`,
                 case when `isdefault` = 1 then \'Default\' else \'Make Default\' end as `MakeDefault`,
                 \'Manage\' as `Manage`, 
                 date_format(from_unixtime(createdon),"%d %b, %Y") as `createon`,
                 case when modifiedon > 0 then date_format(from_unixtime(modifiedon),"%d %b, %Y") else \'-\' end as `modified` FROM '.TABLE_PREFIX.'theme WHERE name like \''.$lsSearchLetter.'%\'';
                 $sql = "SELECT pt.*,case when pt.isdefault = 1 then 'Active' else 'Inactive' end as `status`,
                 case when ucase(pt.name) = 'DEFAULT' then concat('<span style=\"color:red;font-weight:bold\">',pt.name,'</span>')
                      else pt.name end as `name`,
                 case when pt.isdefault = 1 then '<b>Default</b>'
                      else concat('<a href=\"admin_theme_m.php?action=make_default&id=',pt.id,'\">Make Default</a>') end as `MakeDefault`,
                 'Manage' as `Manage`,
                 concat('<span style=\"display:none;\">',from_unixtime(pt.createdon),'</span>',date_format(from_unixtime(pt.createdon),\"%d %b, %Y\")) as `createon`,
                 case when pt.modifiedon > 0 then concat('<span style=\"display:none;\">',from_unixtime(pt.modifiedon),'</span>',date_format(from_unixtime(pt.modifiedon),\"%d %b, %Y\")) else '-' end as `modified`,
                 puc.username as `CreatedBy`,
                 pum.username as `ModifiedBy`
                 FROM ".TABLE_PREFIX."theme pt 
                       left join ".TABLE_PREFIX."users puc on puc.id = pt.createdby
                       left join ".TABLE_PREFIX."users pum on pum.id = pt.modifiedby
                 WHERE pt.name like '$lsSearchLetter%'";
                 //echo $sql;
                # execute the sql query

                # 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("status", "Status");

                # creates a new phpSortColumn object for Field Type
                $col_1 = new phpSortColumn("createon", "Created On");

                # creates a new phpSortColumn object for Desplay Type   
                $col_2 = new phpSortColumn("CreatedBy", "Created By");
                # creates a new phpSortColumn object for validation function   
                $col_3 = new phpSortColumn("modified", "Modified On");
                $col_4 = new phpSortColumn("ModifiedBy","Modified By");
                $col_5 = new phpSortColumn("MakeDefault","");
                //$col_5 = new phpSortColumn("MakeDefault", "Default","",'link','admin_theme_m.php?action=make_default','','','_self');  
                $col_6 = new phpSortColumn("Manage", "","",'link','admin_theme_pages_v.php?','','','_self');  

                # add the columns to an array 
               if($users->IsAdminhavePermission($_SESSION[SESSION_PREFIX.'Admin_UserID'],'Can manage template manager')==false)
                    $columns = array(0=>$col_0, 1=>$col_1, 2=>$col_2, 3=>$col_3, 4=>$col_4);
                    $columns = array(0=>$col_0, 1=>$col_1, 2=>$col_2, 3=>$col_3, 4=>$col_4,5=>$col_5,6=>$col_6);  
                # 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 = false;
                # define the link for edit of entries
                $sortable->editLink = "admin_theme_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
                if(isset($_GET) && !empty($_GET))
                     foreach($_GET as $keyname => $value) {
                $sortable->deleteLink = "admin_theme_m.php?action=delete$quest";

                # define the link for add new entries
                $sortable->addLink = "admin_theme_m.php";
                # set visibility of add,edit,delete link of the grid
                # define the hint to be displyed over the add button
                $sortable->addText = "Add New Template";

                # 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 theme?";

                # define the message to be diplayed if there are no results found
                $sortable->emptyMsg = "No Theme 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            

              echo "</div>";
              echo "<table>";
              echo "<tr style='display:none'>";
              echo "<td>";
              echo "<a href='uploads/MembersiteThemeHelp.htm' target='_new'>Membersite Theme Help</a>";
              echo "</td>";
              echo "</tr>";
              echo "</table>";
              echo "</div>";
              echo "</div>";

              //For display footer.php

Return current item: MembersGear