user_list.php

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