Location: PHPKode > projects > MembersGear > membersgear/admin/admin_theme_pages_v.php
<?php
    require_once "../config/config.php";   
    require_once INCLUDE_DIR."/themepages_class.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)
   {
        Redirect('admin_nopermission.php',true);  
      
   }
  // $_GET['id'] = $_GET['id']+0;
  //  echo $_GET['id'].(is_numeric($_GET['id']));die;
   if(!isset($_GET['id']) or $_GET['id'] == '' or !(is_numeric($_GET['id'])))
   {
       Redirect('admin_theme_v.php'); 
   }
   
   $loManageThemePages = new themespages_class();
   
    echo($smarty->fetch('admin_header.php'));
          
            echo "<div id=\"content\" class=\"setdiv\"> ";
            if($message->IsMessageExists())
           {    
               $lsmsg=$message->GetMessage();
                if(isset($_SESSION[SESSION_PREFIX.'is_err']))
                 {
                   if($_SESSION[SESSION_PREFIX.'is_err']==true)
                        echo "<div class=\"errormsg\" style=\"width:331px\">$lsmsg</div>";
                   else
                        echo "<div class=\"succmsg\" style=\"width:331px\">$lsmsg</div>";  
                        
                    unset($_SESSION[SESSION_PREFIX.'is_err']);         
                 }
                else
                   echo "<div class=\"succmsg\" style=\"width:331px\">$lsmsg</div>";         
           }
           
           $themenameQuery = 'SELECT name FROM '.TABLE_PREFIX.'theme WHERE id='.$_GET['id'];
           $themeName = $loManageThemePages->View($themenameQuery,null,null);
           
            echo "<div id=\"full-contentdiv\">";
            echo "<div class=\"righttop\">";
            echo "<h2 align=\"center\">";
            echo "Manage Theme Pages Of ".$themeName[0]['name'];
            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'];
              }
              else
              {
                    $lsSearchLetter = '';   
              }
            
              /*
                 $sql = 'SELECT *,
                 case when isvisible = 1 then \'Yes\' else \'No\' end as \'IsVisible\',
                 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_pages WHERE themeid='.$_GET['id'];
              */
              
              $sql = 'SELECT pt.`id`, pt.`themeid`,
              
                 CASE WHEN TRIM(pt.`name`)=\'USER_PAGE_MAIN\' THEN CONCAT(\'<b>\',TRIM(pt.`name`),\'</b>\') ELSE  TRIM(pt.`name`) END as `name` , 
                 pt.`content`, pt.`isvisible`, pt.`createdon`, pt.`createdby`, pt.`createdipaddress`, pt.`modifiedon`, pt.`modifiedby`, pt.`modifiedipaddress`,
                 case when pt.isvisible = 1 then \'Yes\' else \'No\' end as \'IsVisible\',
                 date_format(from_unixtime(pt.createdon),"%d %b, %Y") as `createon`,
                 case when pt.modifiedon > 0 then date_format(from_unixtime(pt.modifiedon),"%d %b, %Y") else \'-\' end as `modified`, 
                 case when pt.content = \'\' then \'<font style="color:red">Not Created!</font>\' else \'<font style="color:green">Created</font>\' end as `Status`,
                 puc.username as `CreatedBy`,
                 pum.username as `ModifiedBy`
                 FROM '.TABLE_PREFIX.'theme_pages 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.themeid='.$_GET['id'].' and name like \''.$lsSearchLetter.'%\'
                 and pt.name!="USER_HEADER"
                 and pt.name!="USER_LEFTPANE"
                 and pt.name!="USER_RIGHTPANE"
                 and pt.name!="USER_FOOTER"
                 and pt.name!="USER_UNSUBSCRIBE"
                 and pt.name!="USER_SUBSCRIBE"  
                 AND upper(trim(pt.`name`)) != \'WEBSITE_LOGO\'
                 AND upper(trim(pt.`name`)) != \'WEBSITE_LOGINFORM\'   
                 AND upper(trim(pt.`name`)) != \'WEBSITE_FORGOTPASSWORD\'   
                 ';
                 
                //echo $sql;
                //die;
                # 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");
                
                $col_1 = new phpSortColumn("Status", "Status");
                
                # creates a new phpSortColumn object for Tile
                $col_2 = new phpSortColumn("IsVisible", "Is Visible");

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

                # creates a new phpSortColumn object for Desplay Type   
                $col_4 = new phpSortColumn("CreatedBy", "Created By");
                     
                # creates a new phpSortColumn object for validation function   
                $col_5 = new phpSortColumn("modified", "Modified On");
                
                
                $col_6 = new phpSortColumn("ModifiedBy","Modified By");
                
                //$col_5 = new phpSortColumn("MakeDefault", "Default","",'link','admin_theme_m.php?action=make_default','','','_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,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 = true;
                
                # define the link for edit of entries
                $sortable->editLink = "admin_theme_pages_m.php?action=edit";

                if($users->IsAdminhavePermission($_SESSION[SESSION_PREFIX.'Admin_UserID'],'Can manage template manager')==false)
                {  
                    $sortable->showeditLink=false;  
                }
                
                # 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_theme_m.php?action=delete";

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

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

                # 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 Page 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 "<br/>";
            echo "<div style=\"text-align: right; margin-right: 3px;\"><input type=\"button\" class=\"btncss\" name=\"btnBack\" value=\"Back\" onclick=\"javascript:location.href='admin_theme_v.php';\"></div>";                       
            echo "</div>";
            echo "</div>";
            echo "</div>";

            //For display footer.php
            echo($smarty->fetch('admin_footer.php'));

?>
Return current item: MembersGear