Location: PHPKode > projects > MembersGear > membersgear/admin/admin_drip_v.php
<?php
  require_once "../config/config.php";
 //for display the header.php
  require_once INCLUDE_DIR."/users_class.php"; 
  
  if(isset($_SESSION[SESSION_PREFIX.'page_referrer']))
     unset($_SESSION[SESSION_PREFIX.'page_referrer']);
  
          echo($smarty->fetch('admin_header.php'));
          $users=new users_class(); 
            if($users->IsAdminhavePermission($_SESSION[SESSION_PREFIX.'Admin_UserID'],'Can view protect folders')==false)
            {
                Redirect('admin_nopermission.php',true);  
            }  
           
            echo "<div id=\"content\" class=\"setdiv\"> ";
            if($message->IsMessageExists())
           {    
                $lsmsg=$message->GetMessage();
                if(isset($_GET['err']))
                {
                    if($_GET['err']=="true")
                     $errorHeader= "<div class=\"errormsg\" style=\"width:400px\">$lsmsg</div>";
                    else
                       $errorHeader= "<div class=\"succmsg\" style=\"width:400px\">$lsmsg</div>";
                }
               else
                 $errorHeader= "<div class=\"succmsg\" style=\"width:400px\">$lsmsg</div>"; 
                   
                   
               echo  $errorHeader;   
           }

            echo "<div id=\"full-contentdiv\">";
            echo "<div class=\"righttop\">";
            echo "<h2 align=\"center\">";
            echo "Protect Files / Drip System";
            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 = '';   
              }
                                                                                                                                               
                  $lsweburl=WEB_URL;
                  $sql="SELECT id,  
                        concat('<a href=\"$lsweburl',p.`fileurl`,'\" target=\"_blanks\">',p.`filename`,'</a>') as filename ,
                        concat('<a href=\"$lsweburl',p.`fileurl`,'\" target=\"_blanks\">',p.`fileurl`,'</a>') as fileurl,
                         (
                            SELECT CAST( GROUP_CONCAT( pr.`name`
                            ORDER BY pr.`name` ASC
                            SEPARATOR ', ' ) AS CHAR ) AS products
                            FROM ".TABLE_PREFIX."drips pi
                            JOIN ".TABLE_PREFIX."products pr ON pr.id = pi.product_id
                            WHERE UPPER( trim( fileurl ) ) = (
                            SELECT UPPER( trim( fileurl ) )
                            FROM ".TABLE_PREFIX."drips ppi
                            WHERE ppi.`id` = p.`id` ) 
                            AND pr.isapproved =1
                            AND pr.isdeleted !=1
                            ) AS `allowed_products`,
                           (SELECT case when p.trackingtype='1' then 'By Day' 
                            when p.trackingtype='2' then 'By Clicks'  
                            when p.trackingtype='3' then 'By Date' end )
                           as `trakingType`,
                            (SELECT case when p.trackingtype='1' then 
                             concat(p.fromdays,'-',p.uptodays,' Days')
                            when p.trackingtype='2' then 
                              concat(p.clicks,' Clicks') 
                            when p.trackingtype='3' then 
                               concat(date_format(from_unixtime(p.fromfixeddate),'%m/%d/%Y '),'-',date_format(from_unixtime(p.uptofixeddate),'%m/%d/%Y ')) 
                             end )
                           as `trakingTypeVal`,
                           (Select case when p.status='1' then 'Active'
                            when p.status='0' then 'Inactive'
                           end) as `status`,sortorder
                          FROM ".TABLE_PREFIX."drips p 
                           WHERE p.fileurl like '/$lsSearchLetter%' group by p.filename";
                        
        
                        
                # 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("filename", "Drip name");
                
                # creates a new phpSortColumn object for Tile
                $col_1 = new phpSortColumn("fileurl", "File Url");

                # creates a new phpSortColumn object for Field Type
                $col_2 = new phpSortColumn("allowed_products", "Allowed Products");
                
                $col_3 = new phpSortColumn("trakingType", "Tracking Type");
                
                $col_4 = new phpSortColumn("trakingTypeVal", "Tracking By");
                $col_5 = new phpSortColumn("status", "Status"); 
                $col_6 = new phpSortColumn("sortorder", "Sort");                               
                                                                                        
                # 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 = false;
                
                # define the link for edit of entries
                $sortable->editLink = "admin_drip_system_m.php?action=edit";
                
                //$sortable->sortby = 'sortorder';
                
                //$sortable->sortdir = 'ASC';

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

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

               $quest="&";
                if(isset($_GET) && !empty($_GET))
                 {
                     foreach($_GET as $keyname => $value) {
                          $quest.=$keyname."=".$value."&";
                        }     
                 
                 }
                # define the link for delete of entries
                $sortable->deleteLink = "admin_drip_system_m.php?action=delete$quest";

                # define the link for add new entries
                $sortable->addLink = "admin_drip_system_m.php";
                
                # set visibility of add,edit,delete link of the grid
                if($users->IsAdminhavePermission($_SESSION[SESSION_PREFIX.'Admin_UserID'],'Can manage protect folders')==false)
                {
                     $sortable->showaddLink=false; 
                     $sortable->showeditLink=false;
                     $sortable->showdeleteLink=false;
                }

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

                # 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 remove this Protected File?";

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