Show
Ignore:
Timestamp:
06/06/10 02:16:31 (2 years ago)
Author:
ort
Message:

доработка плагина Page - появилась сортировка и вывод на главную

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/plugins/page/classes/modules/page/mapper/Page.mapper.class.php

    r894 r933  
    2828                        page_seo_keywords, 
    2929                        page_seo_description, 
    30                         page_active                      
     30                        page_active,                     
     31                        page_main,                       
     32                        page_sort                        
    3133                        ) 
    32                         VALUES(?, ?,    ?,      ?,  ?,  ?,  ?,  ?,  ?d) 
     34                        VALUES(?, ?,    ?,      ?,  ?,  ?,  ?,  ?,  ?d,  ?d,  ?d) 
    3335                ";                       
    34                 if ($iId=$this->oDb->query($sql,$oPage->getPid(),$oPage->getUrl(),$oPage->getUrlFull(),$oPage->getTitle(),$oPage->getText(),$oPage->getDateAdd(),$oPage->getSeoKeywords(),$oPage->getSeoDescription(),$oPage->getActive()))  
     36                if ($iId=$this->oDb->query($sql,$oPage->getPid(),$oPage->getUrl(),$oPage->getUrlFull(),$oPage->getTitle(),$oPage->getText(),$oPage->getDateAdd(),$oPage->getSeoKeywords(),$oPage->getSeoDescription(),$oPage->getActive(),$oPage->getMain(),$oPage->getSort()))  
    3537                { 
    3638                        return $iId; 
     
    4951                        page_seo_keywords = ? , 
    5052                        page_seo_description = ? , 
    51                         page_active      = ?             
     53                        page_active      = ?,            
     54                        page_main        = ?,            
     55                        page_sort        = ?             
    5256                        WHERE page_id = ?d 
    5357                ";                       
    54                 if ($this->oDb->query($sql,$oPage->getPid(),$oPage->getUrl(),$oPage->getUrlFull(),$oPage->getTitle(),$oPage->getText(),$oPage->getDateEdit(),$oPage->getSeoKeywords(),$oPage->getSeoDescription(),$oPage->getActive(),$oPage->getId()))  
     58                if ($this->oDb->query($sql,$oPage->getPid(),$oPage->getUrl(),$oPage->getUrlFull(),$oPage->getTitle(),$oPage->getText(),$oPage->getDateEdit(),$oPage->getSeoKeywords(),$oPage->getSeoDescription(),$oPage->getActive(),$oPage->getMain(),$oPage->getSort(),$oPage->getId()))  
    5559                { 
    5660                        return true; 
     
    103107                                FROM  
    104108                                        ".Config::Get('plugin.page.table.page')."                                
    105                                 ORDER by page_title asc;         
     109                                ORDER by page_sort desc;         
    106110                                        "; 
    107111                if ($aRows=$this->oDb->select($sql)) { 
     
    134138                return $aResult; 
    135139        } 
     140         
     141        public function GetNextPageBySort($iSort,$sPid,$sWay) { 
     142                if ($sWay=='up') { 
     143                        $sWay='>'; 
     144                        $sOrder='asc'; 
     145                } else { 
     146                        $sWay='<'; 
     147                        $sOrder='desc'; 
     148                } 
     149                $sPidNULL=''; 
     150                if (is_null($sPid)) { 
     151                        $sPidNULL='page_pid IS NULL and'; 
     152                } 
     153                $sql = "SELECT * FROM ".Config::Get('plugin.page.table.page')." WHERE { page_pid = ? and } {$sPidNULL} page_sort {$sWay} ? order by page_sort {$sOrder} limit 0,1"; 
     154                if ($aRow=$this->oDb->selectRow($sql,is_null($sPid) ? DBSIMPLE_SKIP : $sPid, $iSort)) { 
     155                        return Engine::GetEntity('PluginPage_Page',$aRow); 
     156                } 
     157                return null; 
     158        } 
     159         
     160        public function GetMaxSortByPid($sPid) { 
     161                $sPidNULL=''; 
     162                if (is_null($sPid)) { 
     163                        $sPidNULL='and page_pid IS NULL'; 
     164                } 
     165                $sql = "SELECT max(page_sort) as max_sort FROM ".Config::Get('plugin.page.table.page')." WHERE 1=1 { and page_pid = ? } {$sPidNULL} "; 
     166                if ($aRow=$this->oDb->selectRow($sql,is_null($sPid) ? DBSIMPLE_SKIP : $sPid)) { 
     167                        return $aRow['max_sort']; 
     168                } 
     169                return null; 
     170        } 
    136171} 
    137172?>