user_list.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class User_List extends oxAdminList
00009 {
00010 
00016     protected $_sListClass = 'oxuser';
00017 
00023     protected $_sDefSortField = "oxusername";
00024 
00030     protected $_sListType = 'oxuserlist';
00031 
00037     protected $_sThisTemplate = 'user_list.tpl';
00038 
00044     public function render()
00045     {
00046         foreach ($this->getItemList() as $sId => $oUser) {
00047             if ($oUser->inGroup("oxidblacklist") || $oUser->inGroup("oxidblocked")) {
00048                 $oUser->blacklist = "1";
00049             }
00050             $oUser->blPreventDelete = false;
00051             if (!$this->_allowAdminEdit($sId)) {
00052                 $oUser->blPreventDelete = true;
00053             }
00054         }
00055 
00056         return parent::render();
00057     }
00058 
00064     public function deleteEntry()
00065     {
00066         if ($this->_allowAdminEdit($this->getEditObjectId())) {
00067             $this->_oList = null;
00068             return parent::deleteEntry();
00069         }
00070     }
00071 
00082     public function _prepareWhereQuery($aWhere, $sQueryFull)
00083     {
00084         $aNameWhere = null;
00085         if (isset($aWhere['oxuser.oxlname']) && ($sName = $aWhere['oxuser.oxlname'])) {
00086             // check if this is search string (contains % sign at begining and end of string)
00087             $blIsSearchValue = $this->_isSearchValue($sName);
00088             $sName = $this->_processFilter($sName);
00089             $aNameWhere['oxuser.oxfname'] = $aNameWhere['oxuser.oxlname'] = $sName;
00090 
00091             // unsetting..
00092             unset($aWhere['oxuser.oxlname']);
00093         }
00094         $sQ = parent::_prepareWhereQuery($aWhere, $sQueryFull);
00095 
00096         if ($aNameWhere) {
00097 
00098             $aVal = explode(' ', $sName);
00099             $sQ .= ' and (';
00100             $sSqlBoolAction = '';
00101             $myUtilsString = oxRegistry::get("oxUtilsString");
00102 
00103             foreach ($aNameWhere as $sFieldName => $sValue) {
00104 
00105                 //for each search field using AND anction
00106                 foreach ($aVal as $sVal) {
00107 
00108                     $sQ .= " {$sSqlBoolAction} {$sFieldName} ";
00109 
00110                     //for search in same field for different values using AND
00111                     $sSqlBoolAction = ' or ';
00112 
00113                     $sQ .= $this->_buildFilter($sVal, $blIsSearchValue);
00114 
00115                     // trying to search spec chars in search value
00116                     // if found, add cleaned search value to search sql
00117                     $sUml = $myUtilsString->prepareStrForSearch($sVal);
00118                     if ($sUml) {
00119                         $sQ .= " or {$sFieldName} ";
00120                         $sQ .= $this->_buildFilter($sUml, $blIsSearchValue);
00121                     }
00122                 }
00123             }
00124 
00125             // end for AND action
00126             $sQ .= ' ) ';
00127         }
00128 
00129 
00130         return $sQ;
00131     }
00132 
00133 }