OXID eShop CE  4.8.11
 All Classes Files Functions Variables Pages
user_list.php
Go to the documentation of this file.
1 <?php
2 
8 class User_List extends oxAdminList
9 {
15  protected $_sListClass = 'oxuser';
16 
22  protected $_sDefSortField = "oxusername";
23 
29  protected $_sListType = 'oxuserlist';
30 
35  protected $_sThisTemplate = 'user_list.tpl';
36 
43  public function init()
44  {
45  parent::init();
46 
47  // set mark for blacklists
48  foreach ( $this->getItemList() as $sId => $oUser ) {
49  if ( $oUser->inGroup( "oxidblacklist" ) || $oUser->inGroup( "oxidblocked" ) ) {
50  $oUser->blacklist = "1";
51  }
52  $oUser->blPreventDelete = false;
53  if ( !$this->_allowAdminEdit( $sId ) ) {
54  $oUser->blPreventDelete = true;
55  }
56  }
57  }
58 
64  public function deleteEntry()
65  {
66  if ( $this->_allowAdminEdit( $this->getEditObjectId() ) ) {
67  return parent::deleteEntry();
68  }
69  }
70 
81  public function _prepareWhereQuery( $aWhere, $sQueryFull )
82  {
83  $aNameWhere = null;
84  if ( isset( $aWhere['oxuser.oxlname'] ) && ( $sName = $aWhere['oxuser.oxlname'] ) ) {
85  // check if this is search string (contains % sign at begining and end of string)
86  $blIsSearchValue = $this->_isSearchValue( $sName );
87  $sName = $this->_processFilter( $sName );
88  $aNameWhere['oxuser.oxfname'] = $aNameWhere['oxuser.oxlname'] = $sName;
89 
90  // unsetting..
91  unset( $aWhere['oxuser.oxlname'] );
92  }
93  $sQ = parent::_prepareWhereQuery( $aWhere, $sQueryFull );
94 
95  if ( $aNameWhere ) {
96 
97  $aVal = explode( ' ', $sName );
98  $sQ .= ' and (';
99  $sSqlBoolAction = '';
100  $myUtilsString = oxRegistry::get("oxUtilsString");
101 
102  foreach ( $aNameWhere as $sFieldName => $sValue ) {
103 
104  //for each search field using AND anction
105  foreach ( $aVal as $sVal ) {
106 
107  $sQ .= " {$sSqlBoolAction} {$sFieldName} ";
108 
109  //for search in same field for different values using AND
110  $sSqlBoolAction = ' or ';
111 
112  $sQ .= $this->_buildFilter( $sVal, $blIsSearchValue );
113 
114  // trying to search spec chars in search value
115  // if found, add cleaned search value to search sql
116  $sUml = $myUtilsString->prepareStrForSearch( $sVal );
117  if ( $sUml ) {
118  $sQ .= " or {$sFieldName} ";
119  $sQ .= $this->_buildFilter( $sUml, $blIsSearchValue );
120  }
121  }
122  }
123 
124  // end for AND action
125  $sQ .= ' ) ';
126  }
127 
128 
129  return $sQ;
130  }
131 
132 }