8 require_once(
'base/Ego_Store.php');
43 public function __construct($params = array(), $query = array()) {
44 parent::__construct($params, $query);
46 $this->name = str_replace(
49 (
string) $_REQUEST[
'name']
51 $this->value = (string) $_REQUEST[
'value'];
52 $this->data = $_REQUEST[
'data'];
61 switch ($this->data) {
64 $db = new_db_connection();
70 if ($this->params[
'rights']) {
71 $join[] =
'egotec_user_group ON egotec_user.user_id = egotec_user_group.user_id';
73 foreach (explode(
';', $this->params[
'rights']) as $n => $right) {
74 list($group, $role) = explode(
',', $right);
75 $rights_or[] =
'(egotec_user_group.group_id = :group_id'.$n.
' AND egotec_user_group.role_id = :role_id'.$n.
')';
76 $bind[
'group_id'.$n] = $group;
77 $bind[
'role_id'.$n] = $role;
79 $where =
'('.implode(
' OR ', $rights_or).
') AND ';
82 if (empty($this->value)) {
83 if (!$this->isValidSearch($this->name)) {
87 'table' =>
'egotec_user',
88 'where' => $where.
'egotec_user.deleted = 0 AND LOWER(egotec_user.username) LIKE :username',
90 'order' =>
'egotec_user.username ASC',
91 'bind' => array_merge($bind, array(
92 'username' => mb_strtolower($this->name)
95 if ($this->limit > 0) {
96 $query[
'limit'] =
"{$this->start},{$this->limit}";
98 $db->select($this->buildQuery($query));
100 $db->select($this->buildQuery(array(
101 'table' =>
'egotec_user',
102 'where' => $where.
'egotec_user.user_id = :user_id',
104 'bind' => array_merge($bind, array(
105 'user_id' => $this->value
109 while ($db->nextRecord()) {
110 $user =
new User_SQL($db->Record[
'user_id']);
115 && !$this->params[
'all_users']
116 && !$GLOBALS[
'auth']->hasSuperuserPermission()
119 foreach ($user->getGroupRoleRelations() as $group => $roles) {
120 foreach (explode(
',', $roles) as $role) {
121 if ($GLOBALS[
'auth']->hasPermission($group, $role)) {
132 $icon = $GLOBALS[
'egotec_conf'][
'url_dir'].
'bin/admin_skin/egotec/sitemap_img/';
133 if ($user->isInactive()) {
137 if ($this->params[
'no_admin'] && $user->field[
'no_admin']) {
142 if ($this->params[
'liveserver'] && $GLOBALS[
'egotec_conf'][
'liveserver'] && !$user->extra[
'liveserver']) {
146 if ($user->extra[
'gender'] ==
'female') {
147 $icon .=
'user_female.png';
149 $icon .=
'user_male.png';
152 $this->addItem(array(
153 self::IDENTIFIER => $db->Record[
'user_id'],
154 'name' => $user->getFullname(),
162 $db = new_db_connection();
163 if (empty($this->value)) {
164 if (trim($this->name,
'%') !=
'') {
166 if (!$this->isValidSearch($this->name)) {
171 if (!$GLOBALS[
'auth']->hasSuperuserPermission()) {
173 $groups = $GLOBALS[
'auth']->user->getAllGroups();
174 $group_ids = array();
175 foreach ($groups as $group) {
176 $group_ids[] = $group->field[
'group_id'];
178 $where =
"group_id IN ('" . implode(
"','", $group_ids) .
"') AND ";
182 'table' =>
'egotec_group',
183 'where' => $where .
'LOWER(group_name) LIKE :group_name',
184 'order' =>
'links ASC',
186 'group_name' => mb_strtolower($this->name)
189 if ($this->limit > 0) {
190 $query[
'limit'] =
"{$this->start},{$this->limit}";
192 $db->select($this->buildQuery($query));
195 require_once(
'rights/Group_SQL.php');
196 $parent =
new Group_SQL($GLOBALS[
'egotec_conf'][
'superuser'][
'group']);
198 $group_ids = array();
199 if (!$GLOBALS[
'auth']->hasSuperuserPermission()) {
201 $groups = $GLOBALS[
'auth']->user->getAllGroups();
202 foreach ($groups as $group) {
203 $group_ids[] = $group->field[
'group_id'];
208 if ($this->params[
'all_group']) {
209 $this->addItem(array(
210 self::IDENTIFIER =>
'*',
211 'name' =>
'(' . $GLOBALS[
'auth']->translate(
'Alle') .
')',
212 'icon' => $GLOBALS[
'egotec_conf'][
'url_dir'].
'bin/admin_skin/egotec/img/16x16/user-unknown2.png',
217 $this->getNS($parent, $group_ids,
'group_id',
'group_name',
'groups.png');
221 $db->select($this->buildQuery(array(
222 'table' =>
'egotec_group',
223 'where' =>
'group_id = :group_id',
225 'group_id' => $this->value
229 while ($db->nextRecord()) {
230 $group =
new Group_SQL($db->Record[
'group_id'], $db->Record);
231 $name = $db->Record[
'group_name'];
232 $this->addItem(array(
233 self::IDENTIFIER => $db->Record[
'group_id'],
235 'icon' => $GLOBALS[
'egotec_conf'][
'url_dir'].
'bin/admin_skin/egotec/img/16x16/groups.png',
236 'indent' => $db->Record[
'tiefe'],
237 'hover' => ltrim($group->getPath(
true).
'/'.
$name,
'/')
244 $db = new_db_connection();
245 if (empty($this->value)) {
246 if (trim($this->name,
'%') !=
'') {
248 if (!$this->isValidSearch($this->name)) {
253 if (!$GLOBALS[
'auth']->hasSuperuserPermission()) {
255 $roles = $GLOBALS[
'auth']->user->getAllRoles();
257 foreach ($roles as $role) {
258 $role_ids[] = $role->field[
'role_id'];
260 $where =
"role_id IN ('".implode(
"','", $role_ids).
"') AND ";
264 'table' =>
'egotec_role',
265 'where' => $where.
'LOWER(role_name) LIKE :role_name',
266 'order' =>
'links ASC',
268 'role_name' => mb_strtolower($this->name)
271 if ($this->limit > 0) {
272 $query[
'limit'] =
"{$this->start},{$this->limit}";
274 $db->select($this->buildQuery($query));
277 require_once(
'rights/Role_SQL.php');
278 $parent =
new Role_SQL($GLOBALS[
'egotec_conf'][
'superuser'][
'role']);
281 if (!$GLOBALS[
'auth']->hasSuperuserPermission()) {
283 $roles = $GLOBALS[
'auth']->user->getAllRoles();
285 foreach ($roles as $role) {
286 $role_ids[] = $role->field[
'role_id'];
290 $this->getNS($parent, $role_ids,
'role_id',
'role_name',
'roles.png');
294 $db->select($this->buildQuery(array(
295 'table' =>
'egotec_role',
296 'where' =>
'role_id = :role_id',
298 'role_id' => $this->value
302 while ($db->nextRecord()) {
303 $role =
new Role_SQL($db->Record[
'role_id'], $db->Record);
304 $name = $db->Record[
'role_name'];
305 $this->addItem(array(
306 self::IDENTIFIER => $db->Record[
'role_id'],
308 'icon' => $GLOBALS[
'egotec_conf'][
'url_dir'].
'bin/admin_skin/egotec/img/16x16/roles.png',
309 'indent' => $db->Record[
'tiefe'],
310 'hover' => ltrim($role->getPath(
true).
'/'.
$name,
'/')
317 if (empty($this->value)) {
318 if (!$this->isValidSearch($this->name)) {
322 if (!isset($this->params[
'query'])) {
323 $this->params[
'query'] = array();
325 if (!isset($this->params[
'query'][
'bind'])) {
326 $this->params[
'query'][
'bind'] = array();
328 if (!isset($this->params[
'param'])) {
329 $this->params[
'param'] = array();
331 if ($this->limit > 0) {
332 $this->params[
'query'][
'limit'] =
"{$this->start},{$this->limit}";
334 $this->params[
'query'][
'where'] = ($this->params[
'query'][
'where']
335 ? $this->params[
'query'][
'where'] .
' AND ' 336 :
'').
"LOWER(name) LIKE :name";
337 $this->params[
'query'][
'bind'][
'name'] = mb_strtolower($this->name);
338 $this->site->setRights(array(
'edit',
'view'));
339 if ($parent = $this->site->getPage($this->params[
'id'])) {
340 $pages = $parent->getChildren(
341 $this->buildQuery($this->params[
'query']),
342 $this->params[
'param']
350 foreach ($pages as $page) {
352 $this->addItem(array(
353 self::IDENTIFIER => ltrim($page->getUrl(array(
'nonactive' =>
false)), $GLOBALS[
'egotec_conf'][
'url_dir']),
354 'name' => $page->field[
'name'],
355 'icon' => $page->getIconUrl()
363 $search = str_replace(array(
'*',
'%'),
'', $this->name);
364 $site = $this->params[
'from'] ?
new Site($this->params[
'from']) : ($this->site ? $this->site :
new Site());
365 $types = $this->params[
'type_list'] ? $this->params[
'type_list'] : $site->getTypes();
366 foreach ($types as $type) {
368 $site->admin[
'enabled_types'][$type[
'type']]
372 if (empty($this->value)) {
375 && (empty($type[
'active'])
376 || mb_stripos($type[
'fullname'], $search) ===
false)
380 } elseif ($type[
'type'] != $this->value) {
384 $this->addItem(array(
385 self::IDENTIFIER => $type[
'type'],
388 'icon' => $this->page && $this->page->field[
'type'] == $type[
'type']
389 ? $this->page->getIconUrl()
392 : $GLOBALS[
'egotec_conf'][
'url_dir'].
'bin/admin_skin/egotec/img/16x16/' 393 .($type[
'type'] ==
'multimedia/category' 397 'disabled' => empty($type[
'active']) && $this->page->canChangeType(),
398 'indent' => empty($search) ? $type[
'depth'] : 0
400 if (!empty($this->value)) {
418 private function getNS($parent, $ids, $id_key, $name_key, $icon) {
419 if (empty($ids) || in_array($parent->field[$id_key], $ids)) {
420 $this->addItem(array(
421 self::IDENTIFIER => $parent->field[$id_key],
422 'name' => $parent->field[$name_key],
423 'icon' => $GLOBALS[
'egotec_conf'][
'url_dir'].
'bin/admin_skin/egotec/img/16x16/'.$icon,
424 'indent' => $parent->field[
'tiefe'],
425 'hover' => ltrim($parent->getPath(
true).
'/'.$parent->field[$name_key],
'/')
429 foreach ($parent->getChildren() as $child) {
430 $this->getNS($child, $ids, $id_key, $name_key, $icon);
static urltopage($url, $params=array(), $only_site=false, $error_page=false, $commit_params=false)
static filterNonUtf8($s, $substitute="", $strict=false)