ILIAS  release_7 Revision v7.30-3-g800a261c036
ilLinkResourceList Class Reference

Class ilLinkResourceList. More...

+ Collaboration diagram for ilLinkResourceList:

Public Member Functions

 __construct (int $webr_id)
 ilLinkResourceList constructor. More...
 
 setListResourceId (int $a_id)
 
 getListResourceId ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setDescription (string $a_description)
 
 getDescription ()
 
 getCreateDate ()
 
 getLastUpdateDate ()
 
 read ()
 
 delete (bool $a_update_history=true)
 
 update ($a_update_history=true)
 
 add ($a_update_history=true)
 

Static Public Member Functions

static lookupList (int $a_webr_id)
 
static lookupAllLists ()
 
static checkListStatus (int $a_webr_id)
 Check if a weblink list was already created or transformed from a single weblink. More...
 

Protected Member Functions

 setCreateDate (int $a_date)
 
 setLastUpdateDate (int $a_date)
 

Protected Attributes

 $webr_id
 
 $title
 
 $description
 
 $c_date
 
 $m_date
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLinkResourceList::__construct ( int  $webr_id)

ilLinkResourceList constructor.

Parameters
int$webr_id

Definition at line 41 of file class.ilLinkResourceList.php.

42 {
43 global $DIC;
44
45 $this->db = $DIC->database();
46 $this->webr_id = $webr_id;
47
48 $this->read();
49 }
global $DIC
Definition: goto.php:24

References $DIC, $webr_id, and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilLinkResourceList::add (   $a_update_history = true)
Parameters
bool$a_update_history
Returns
bool

Definition at line 213 of file class.ilLinkResourceList.php.

214 {
215 $ilDB = $this->db;
216
217 $now = time();
218 $this->setCreateDate($now);
219 $this->setLastUpdateDate($now);
220
221 $query = "INSERT INTO webr_lists (title,description,last_update,create_date,webr_id) " .
222 "VALUES( " .
223 $ilDB->quote($this->getTitle(), 'text') . ", " .
224 $ilDB->quote($this->getDescription(), 'text') . ", " .
225 $ilDB->quote($this->getLastUpdateDate(), 'integer') . ", " .
226 $ilDB->quote($this->getCreateDate(), 'integer') . ", " .
227 $ilDB->quote($this->getListResourceId(), 'integer') . " " .
228 ")";
229 $res = $ilDB->manipulate($query);
230
231 if ($a_update_history) {
233 $this->getListResourceId(),
234 "add",
235 $this->getTitle()
236 );
237 }
238
239 return true;
240 }
static _createEntry( $a_obj_id, $a_action, $a_info_params="", $a_obj_type="", $a_user_comment="", $a_update_last=false)
Creates a new history entry for an object.
$query
foreach($_POST as $key=> $value) $res
global $ilDB

References $ilDB, $query, $res, ilHistory\_createEntry(), getCreateDate(), getDescription(), getLastUpdateDate(), getListResourceId(), getTitle(), setCreateDate(), and setLastUpdateDate().

+ Here is the call graph for this function:

◆ checkListStatus()

static ilLinkResourceList::checkListStatus ( int  $a_webr_id)
static

Check if a weblink list was already created or transformed from a single weblink.

Returns
bool

Definition at line 292 of file class.ilLinkResourceList.php.

293 {
294 global $DIC;
295
296 $ilDB = $DIC->database();
297
298 $query = "SELECT * FROM webr_lists " .
299 "WHERE webr_id = " . $ilDB->quote($a_webr_id, 'integer');
300
301 $res = $ilDB->query($query);
302 if ($ilDB->numRows($res)) {
303 return true;
304 }
305 return false;
306 }

References $DIC, $ilDB, $query, and $res.

Referenced by ilObjLinkResourceListGUI\getCommandFrame(), ilObjLinkResourceListGUI\getCommandLink(), ilObjLinkResourceListGUI\getDescription(), ilObjLinkResourceListGUI\getTitle(), ilObjLinkResourceGUI\initFormSettings(), ilObjLinkResourceGUI\showToolbar(), ilObjLinkResourceGUI\updateLink(), and ilObjLinkResourceGUI\updateLinks().

+ Here is the caller graph for this function:

◆ delete()

ilLinkResourceList::delete ( bool  $a_update_history = true)
Parameters
bool$a_update_history
Returns
bool

Definition at line 159 of file class.ilLinkResourceList.php.

160 {
161 $ilDB = $this->db;
162
163 $query = "DELETE FROM webr_lists " .
164 "WHERE webr_id = " . $ilDB->quote($this->getListResourceId(), 'integer');
165 $res = $ilDB->manipulate($query);
166
167 if ($a_update_history) {
169 $this->getListResourceId(),
170 "delete",
171 $this->getTitle()
172 );
173 }
174
175 return true;
176 }

References $ilDB, $query, $res, ilHistory\_createEntry(), getListResourceId(), and getTitle().

+ Here is the call graph for this function:

◆ getCreateDate()

ilLinkResourceList::getCreateDate ( )
Returns
int

Definition at line 110 of file class.ilLinkResourceList.php.

References $c_date.

Referenced by add().

+ Here is the caller graph for this function:

◆ getDescription()

ilLinkResourceList::getDescription ( )
Returns
string

Definition at line 94 of file class.ilLinkResourceList.php.

References $description.

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getLastUpdateDate()

ilLinkResourceList::getLastUpdateDate ( )
Returns
int

Definition at line 126 of file class.ilLinkResourceList.php.

References $m_date.

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getListResourceId()

ilLinkResourceList::getListResourceId ( )
Returns
int

Definition at line 62 of file class.ilLinkResourceList.php.

63 {
64 return $this->webr_id;
65 }

References $webr_id.

Referenced by add(), delete(), read(), and update().

+ Here is the caller graph for this function:

◆ getTitle()

ilLinkResourceList::getTitle ( )
Returns
string

Definition at line 78 of file class.ilLinkResourceList.php.

References $title.

Referenced by add(), delete(), and update().

+ Here is the caller graph for this function:

◆ lookupAllLists()

static ilLinkResourceList::lookupAllLists ( )
static
Returns
array

Definition at line 269 of file class.ilLinkResourceList.php.

270 {
271 global $DIC;
272
273 $ilDB = $DIC->database();
274
275 $query = "SELECT * FROM webr_lists";
276
277 $res = $ilDB->query($query);
278 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
279 $lists[$row->webr_id]['title'] = $row->title;
280 $lists[$row->webr_id]['description'] = $row->description;
281 $lists[$row->webr_id]['create_date'] = $row->create_date;
282 $lists[$row->webr_id]['last_update'] = $row->last_update;
283 $lists[$row->webr_id]['webr_id'] = $row->webr_id;
284 }
285 return $lists ? $lists : array();
286 }

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

◆ lookupList()

static ilLinkResourceList::lookupList ( int  $a_webr_id)
static
Parameters
int$a_webr_id
Returns
array

Definition at line 246 of file class.ilLinkResourceList.php.

247 {
248 global $DIC;
249
250 $ilDB = $DIC->database();
251
252 $query = "SELECT * FROM webr_lists " .
253 "WHERE webr_id = " . $ilDB->quote($a_webr_id, 'integer');
254
255 $res = $ilDB->query($query);
256 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
257 $list['title'] = $row->title;
258 $list['description'] = $row->description;
259 $list['create_date'] = $row->create_date;
260 $list['last_update'] = $row->last_update;
261 $list['webr_id'] = $row->webr_id;
262 }
263 return $list ? $list : array();
264 }

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

◆ read()

ilLinkResourceList::read ( )
Returns
bool

Definition at line 135 of file class.ilLinkResourceList.php.

136 {
137 $ilDB = $this->db;
138
139 $query = "SELECT * FROM webr_lists " .
140 "WHERE webr_id = " . $ilDB->quote($this->getListResourceId(), 'integer');
141
142 $res = $ilDB->query($query);
143 if ($ilDB->numRows($res)) {
144 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
145 $this->setTitle((string) $row->title);
146 $this->setDescription((string) $row->description);
147 $this->setCreateDate((int) $row->create_date);
148 $this->setLastUpdateDate((int) $row->last_update);
149 }
150 return true;
151 }
152 return false;
153 }
setDescription(string $a_description)

References $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, getListResourceId(), setCreateDate(), setDescription(), setLastUpdateDate(), and setTitle().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCreateDate()

ilLinkResourceList::setCreateDate ( int  $a_date)
protected
Parameters
int$a_date

Definition at line 102 of file class.ilLinkResourceList.php.

103 {
104 $this->c_date = $a_date;
105 }

Referenced by add(), and read().

+ Here is the caller graph for this function:

◆ setDescription()

ilLinkResourceList::setDescription ( string  $a_description)
Parameters
string$a_description

Definition at line 86 of file class.ilLinkResourceList.php.

87 {
88 $this->description = $a_description;
89 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setLastUpdateDate()

ilLinkResourceList::setLastUpdateDate ( int  $a_date)
protected
Parameters
int$a_date

Definition at line 118 of file class.ilLinkResourceList.php.

119 {
120 $this->m_date = $a_date;
121 }

Referenced by add(), read(), and update().

+ Here is the caller graph for this function:

◆ setListResourceId()

ilLinkResourceList::setListResourceId ( int  $a_id)
Parameters
int$a_id

Definition at line 54 of file class.ilLinkResourceList.php.

55 {
56 $this->webr_id = $a_id;
57 }

◆ setTitle()

ilLinkResourceList::setTitle ( string  $a_title)
Parameters
string$a_title

Definition at line 70 of file class.ilLinkResourceList.php.

71 {
72 $this->title = $a_title;
73 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilLinkResourceList::update (   $a_update_history = true)
Parameters
bool$a_update_history
Returns
bool

Definition at line 182 of file class.ilLinkResourceList.php.

183 {
184 $ilDB = $this->db;
185
186 if (!$this->getListResourceId()) {
187 return false;
188 }
189
190 $this->setLastUpdateDate(time());
191 $query = "UPDATE webr_lists " .
192 "SET title = " . $ilDB->quote($this->getTitle(), 'text') . ", " .
193 "description = " . $ilDB->quote($this->getDescription(), 'text') . ", " .
194 "last_update = " . $ilDB->quote($this->getLastUpdateDate(), 'integer') . " " .
195 "WHERE webr_id = " . $ilDB->quote($this->getListResourceId(), 'integer');
196 $res = $ilDB->manipulate($query);
197
198 if ($a_update_history) {
200 $this->getListResourceId(),
201 "update",
202 $this->getTitle()
203 );
204 }
205
206 return true;
207 }

References $ilDB, $query, $res, ilHistory\_createEntry(), getDescription(), getLastUpdateDate(), getListResourceId(), getTitle(), and setLastUpdateDate().

+ Here is the call graph for this function:

Field Documentation

◆ $c_date

ilLinkResourceList::$c_date
protected

Definition at line 30 of file class.ilLinkResourceList.php.

Referenced by getCreateDate().

◆ $description

ilLinkResourceList::$description
protected

Definition at line 25 of file class.ilLinkResourceList.php.

Referenced by getDescription().

◆ $m_date

ilLinkResourceList::$m_date
protected

Definition at line 35 of file class.ilLinkResourceList.php.

Referenced by getLastUpdateDate().

◆ $title

ilLinkResourceList::$title
protected

Definition at line 20 of file class.ilLinkResourceList.php.

Referenced by getTitle().

◆ $webr_id

ilLinkResourceList::$webr_id
protected

Definition at line 15 of file class.ilLinkResourceList.php.

Referenced by __construct(), and getListResourceId().


The documentation for this class was generated from the following file: