ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilNotificationUserIterator.php
Go to the documentation of this file.
1<?php
2
3require_once 'Services/Notifications/classes/class.ilNotificationSetupHelper.php';
4
9
10 private $userids;
11 private $rset;
12 private $data;
13 private $module;
14
15 public function __construct($module, array $userids = array()) {
16 global $ilDB;
17
18 $this->db = $ilDB;
19 $this->userids = $userids;
20
21 $this->module = $module;
22
23 $this->rewind();
24 }
25
26 public function __destruct() {
27 $this->db->free($this->rset);
28 }
29
30 public function current() {
31 return $this->data;
32 }
33
34 public function key() {
35 return (int)$this->data['usr_id'];
36 }
37
38 public function next() {
39 //$this->data = $this->db->fetchAssoc($this->rset);
40 }
41
42 public function rewind() {
43 $query = 'SELECT usr_id, module, channel FROM ' . ilNotificationSetupHelper::$tbl_userconfig . ' WHERE module=%s AND ' . $this->db->in('usr_id', $this->userids, false, 'integer');
44 $types = array('text');
45 $values = array($this->module);
46 $this->rset = $this->db->queryF($query, $types, $values);
47 }
48
49 public function valid() {
50 $this->data = $this->db->fetchAssoc($this->rset);
51 return is_array($this->data);
52 }
53}
54?>
An exception for terminatinating execution or to throw for unit testing.
wrapper for iterating a list of user settings by providing the user ids
__construct($module, array $userids=array())
global $ilDB