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