ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilNewsItemGen Class Reference

A news item can be created by different sources. More...

+ Inheritance diagram for ilNewsItemGen:
+ Collaboration diagram for ilNewsItemGen:

Public Member Functions

 __construct ($a_id=0)
 Constructor.
 setId ($a_id)
 Set Id.
 getId ()
 Get Id.
 setTitle ($a_title)
 Set Title.
 getTitle ()
 Get Title.
 setContent ($a_content)
 Set Content.
 getContent ()
 Get Content.
 setContextObjId ($a_context_obj_id)
 Set ContextObjId.
 getContextObjId ()
 Get ContextObjId.
 setContextObjType ($a_context_obj_type)
 Set ContextObjType.
 getContextObjType ()
 Get ContextObjType.
 setContextSubObjId ($a_context_sub_obj_id)
 Set ContextSubObjId.
 getContextSubObjId ()
 Get ContextSubObjId.
 setContextSubObjType ($a_context_sub_obj_type)
 Set ContextSubObjType.
 getContextSubObjType ()
 Get ContextSubObjType.
 setContentType ($a_content_type="text")
 Set ContentType.
 getContentType ()
 Get ContentType.
 setCreationDate ($a_creation_date)
 Set CreationDate.
 getCreationDate ()
 Get CreationDate.
 setUpdateDate ($a_update_date)
 Set UpdateDate.
 getUpdateDate ()
 Get UpdateDate.
 setUserId ($a_user_id)
 Set UserId.
 getUserId ()
 Get UserId.
 setVisibility ($a_visibility="users")
 Set Visibility.
 getVisibility ()
 Get Visibility.
 setContentLong ($a_content_long)
 Set ContentLong.
 getContentLong ()
 Get ContentLong.
 setPriority ($a_priority=1)
 Set Priority.
 getPriority ()
 Get Priority.
 setContentIsLangVar ($a_content_is_lang_var=0)
 Set ContentIsLangVar.
 getContentIsLangVar ()
 Get ContentIsLangVar.
 setMobId ($a_mob_id)
 Set MobId.
 getMobId ()
 Get MobId.
 setPlaytime ($a_playtime)
 Set Playtime.
 getPlaytime ()
 Get Playtime.
 create ()
 Create new item.
 read ()
 Read item from database.
 update ()
 Update item in database.
 delete ()
 Delete item from database.
 queryNewsForContext ()
 Query NewsForContext.
 queryNewsForVisibility ()
 Query NewsForVisibility.

Protected Attributes

 $id
 $title
 $content
 $context_obj_id
 $context_obj_type
 $context_sub_obj_id
 $context_sub_obj_type
 $content_type = "text"
 $creation_date
 $update_date
 $user_id
 $visibility = "users"
 $content_long
 $priority = 1
 $content_is_lang_var = 0
 $mob_id
 $playtime

Detailed Description

A news item can be created by different sources.

E.g. when a change in a learning module is announced.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 37 of file class.ilNewsItemGen.php.

Constructor & Destructor Documentation

ilNewsItemGen::__construct (   $a_id = 0)

Constructor.

Parameters
int$a_id

Reimplemented in ilNewsItem.

Definition at line 63 of file class.ilNewsItemGen.php.

References read(), and setId().

{
if ($a_id > 0)
{
$this->setId($a_id);
$this->read();
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilNewsItemGen::create ( )

Create new item.

Reimplemented in ilNewsItem.

Definition at line 417 of file class.ilNewsItemGen.php.

References $ilDB, getContent(), getContentIsLangVar(), getContentLong(), getContentType(), getContextObjId(), getContextObjType(), getContextSubObjId(), getContextSubObjType(), getId(), getMobId(), getPlaytime(), getPriority(), getTitle(), getUserId(), getVisibility(), ilUtil\now(), and setId().

{
global $ilDB;
$this->setId($ilDB->nextId("il_news_item"));
$ilDB->insert("il_news_item", array(
"id" => array("integer", $this->getId()),
"title" => array("text", $this->getTitle()),
"content" => array("clob", $this->getContent()),
"context_obj_id" => array("integer", (int) $this->getContextObjId()),
"context_obj_type" => array("text", $this->getContextObjType()),
"context_sub_obj_id" => array("integer", (int) $this->getContextSubObjId()),
"context_sub_obj_type" => array("text", $this->getContextSubObjType()),
"content_type" => array("text", $this->getContentType()),
"creation_date" => array("timestamp", ilUtil::now()),
"update_date" => array("timestamp", ilUtil::now()),
"user_id" => array("integer", $this->getUserId()),
"visibility" => array("text", $this->getVisibility()),
"content_long" => array("clob", $this->getContentLong()),
"priority" => array("integer", $this->getPriority()),
"content_is_lang_var" => array("integer", $this->getContentIsLangVar()),
"mob_id" => array("integer", $this->getMobId()),
"playtime" => array("text", $this->getPlaytime())
));
}

+ Here is the call graph for this function:

ilNewsItemGen::delete ( )

Delete item from database.

Reimplemented in ilNewsItem.

Definition at line 509 of file class.ilNewsItemGen.php.

References $ilDB, $query, and getId().

{
global $ilDB;
$query = "DELETE FROM il_news_item".
" WHERE id = ".$ilDB->quote($this->getId(), "integer");
$ilDB->manipulate($query);
}

+ Here is the call graph for this function:

ilNewsItemGen::getContent ( )

Get Content.

Returns
string Content of news.

Definition at line 128 of file class.ilNewsItemGen.php.

References $content.

Referenced by create(), and update().

{
}

+ Here is the caller graph for this function:

ilNewsItemGen::getContentIsLangVar ( )

Get ContentIsLangVar.

Returns
boolean

Definition at line 368 of file class.ilNewsItemGen.php.

References $content_is_lang_var.

Referenced by create(), and update().

+ Here is the caller graph for this function:

ilNewsItemGen::getContentLong ( )

Get ContentLong.

Returns
string Long content of news

Definition at line 328 of file class.ilNewsItemGen.php.

References $content_long.

Referenced by create(), and update().

{
}

+ Here is the caller graph for this function:

ilNewsItemGen::getContentType ( )

Get ContentType.

Returns
string Content type.

Definition at line 228 of file class.ilNewsItemGen.php.

References $content_type.

Referenced by create(), and update().

{
}

+ Here is the caller graph for this function:

ilNewsItemGen::getContextObjId ( )

Get ContextObjId.

Returns
int

Definition at line 148 of file class.ilNewsItemGen.php.

References $context_obj_id.

Referenced by ilNewsItem\create(), create(), ilNewsItem\queryNewsForContext(), queryNewsForContext(), queryNewsForVisibility(), and update().

{
}

+ Here is the caller graph for this function:

ilNewsItemGen::getContextObjType ( )

Get ContextObjType.

Returns
int

Definition at line 168 of file class.ilNewsItemGen.php.

References $context_obj_type.

Referenced by ilNewsItem\create(), create(), ilNewsItem\queryNewsForContext(), queryNewsForContext(), queryNewsForVisibility(), and update().

+ Here is the caller graph for this function:

ilNewsItemGen::getContextSubObjId ( )

Get ContextSubObjId.

Returns
int

Definition at line 188 of file class.ilNewsItemGen.php.

References $context_sub_obj_id.

Referenced by ilNewsItem\create(), create(), ilNewsItem\queryNewsForContext(), queryNewsForContext(), queryNewsForVisibility(), and update().

+ Here is the caller graph for this function:

ilNewsItemGen::getContextSubObjType ( )

Get ContextSubObjType.

Returns
int

Definition at line 208 of file class.ilNewsItemGen.php.

References $context_sub_obj_type.

Referenced by ilNewsItem\create(), create(), ilNewsItem\queryNewsForContext(), queryNewsForContext(), queryNewsForVisibility(), and update().

+ Here is the caller graph for this function:

ilNewsItemGen::getCreationDate ( )

Get CreationDate.

Returns
string Date of creation.

Definition at line 248 of file class.ilNewsItemGen.php.

References $creation_date.

{
}
ilNewsItemGen::getId ( )

Get Id.

Returns
int

Definition at line 88 of file class.ilNewsItemGen.php.

References $id.

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

{
return $this->id;
}

+ Here is the caller graph for this function:

ilNewsItemGen::getMobId ( )

Get MobId.

Returns
int Media Object ID (if news includes attachement)

Definition at line 388 of file class.ilNewsItemGen.php.

References $mob_id.

Referenced by create(), ilNewsItem\delete(), and update().

{
return $this->mob_id;
}

+ Here is the caller graph for this function:

ilNewsItemGen::getPlaytime ( )

Get Playtime.

Returns
string Play Time, hh:mm:ss (of attached media file)

Definition at line 408 of file class.ilNewsItemGen.php.

References $playtime.

Referenced by create(), and update().

{
}

+ Here is the caller graph for this function:

ilNewsItemGen::getPriority ( )

Get Priority.

Returns
int News Priority

Definition at line 348 of file class.ilNewsItemGen.php.

References $priority.

Referenced by create(), and update().

{
}

+ Here is the caller graph for this function:

ilNewsItemGen::getTitle ( )

Get Title.

Returns
string Title of news item.

Definition at line 108 of file class.ilNewsItemGen.php.

References $title.

Referenced by create(), and update().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilNewsItemGen::getUpdateDate ( )

Get UpdateDate.

Returns
string Date of last update.

Definition at line 268 of file class.ilNewsItemGen.php.

References $update_date.

{
}
ilNewsItemGen::getUserId ( )

Get UserId.

Returns
int User Id of last update.

Definition at line 288 of file class.ilNewsItemGen.php.

References $user_id.

Referenced by create(), and update().

{
}

+ Here is the caller graph for this function:

ilNewsItemGen::getVisibility ( )

Get Visibility.

Returns
string Access level of news.

Definition at line 308 of file class.ilNewsItemGen.php.

References $visibility.

Referenced by create(), queryNewsForVisibility(), and update().

{
}

+ Here is the caller graph for this function:

ilNewsItemGen::queryNewsForContext ( )

Query NewsForContext.

Definition at line 524 of file class.ilNewsItemGen.php.

References $ilDB, $query, getContextObjId(), getContextObjType(), getContextSubObjId(), and getContextSubObjType().

{
global $ilDB;
$query = "SELECT id, title, content, context_obj_id, context_obj_type, context_sub_obj_id, context_sub_obj_type, content_type, creation_date, update_date, user_id, visibility, content_long, priority, content_is_lang_var, mob_id, playtime ".
"FROM il_news_item ".
"WHERE ".
"context_obj_id = ".$ilDB->quote($this->getContextObjId(), "integer").
" AND context_obj_type = ".$ilDB->quote($this->getContextObjType(), "text").
" AND context_sub_obj_id = ".$ilDB->quote($this->getContextSubObjId(), "integer").
" AND ".$ilDB->equals("context_sub_obj_type", $this->getContextSubObjType(), "text", true).
" ORDER BY creation_date DESC ".
"";
$set = $ilDB->query($query);
$result = array();
while($rec = $ilDB->fetchAssoc($set))
{
$result[] = $rec;
}
return $result;
}

+ Here is the call graph for this function:

ilNewsItemGen::queryNewsForVisibility ( )

Query NewsForVisibility.

Definition at line 552 of file class.ilNewsItemGen.php.

References $ilDB, $query, getContextObjId(), getContextObjType(), getContextSubObjId(), getContextSubObjType(), and getVisibility().

{
global $ilDB;
$query = "SELECT id, title, content, context_obj_id, context_obj_type, context_sub_obj_id, context_sub_obj_type, content_type, creation_date, update_date, user_id, visibility, content_long, priority, content_is_lang_var, mob_id, playtime ".
"FROM il_news_item ".
"WHERE ".
"context_obj_id = ".$ilDB->quote($this->getContextObjId(), "integer").
" AND context_obj_type = ".$ilDB->quote($this->getContextObjType(), "text").
" AND context_sub_obj_id = ".$ilDB->quote($this->getContextSubObjId(), "integer").
" AND ".$ilDB->equals("context_sub_obj_type", $this->getContextSubObjType(), "text", true).
" AND visibility = ".$ilDB->quote($this->getVisibility(), "text").
" ORDER BY creation_date DESC ".
"";
$set = $ilDB->query($query);
$result = array();
while($rec = $ilDB->fetchAssoc($set))
{
$result[] = $rec;
}
return $result;
}

+ Here is the call graph for this function:

ilNewsItemGen::read ( )

Read item from database.

Definition at line 447 of file class.ilNewsItemGen.php.

References $ilDB, $query, getId(), setContent(), setContentIsLangVar(), setContentLong(), setContentType(), setContextObjId(), setContextObjType(), setContextSubObjId(), setContextSubObjType(), setCreationDate(), setMobId(), setPlaytime(), setPriority(), setTitle(), setUpdateDate(), setUserId(), and setVisibility().

Referenced by __construct().

{
global $ilDB;
$query = "SELECT * FROM il_news_item WHERE id = ".
$ilDB->quote($this->getId(), "integer");
$set = $ilDB->query($query);
$rec = $ilDB->fetchAssoc($set);
$this->setTitle($rec["title"]);
$this->setContent($rec["content"]);
$this->setContextObjId((int) $rec["context_obj_id"]);
$this->setContextObjType($rec["context_obj_type"]);
$this->setContextSubObjId((int) $rec["context_sub_obj_id"]);
$this->setContextSubObjType($rec["context_sub_obj_type"]);
$this->setContentType($rec["content_type"]);
$this->setCreationDate($rec["creation_date"]);
$this->setUpdateDate($rec["update_date"]);
$this->setUserId($rec["user_id"]);
$this->setVisibility($rec["visibility"]);
$this->setContentLong($rec["content_long"]);
$this->setPriority($rec["priority"]);
$this->setContentIsLangVar($rec["content_is_lang_var"]);
$this->setMobId($rec["mob_id"]);
$this->setPlaytime($rec["playtime"]);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNewsItemGen::setContent (   $a_content)

Set Content.

Parameters
string$a_contentContent of news.

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

Referenced by read().

{
$this->content = $a_content;
}

+ Here is the caller graph for this function:

ilNewsItemGen::setContentIsLangVar (   $a_content_is_lang_var = 0)

Set ContentIsLangVar.

Parameters
boolean$a_content_is_lang_var

Definition at line 358 of file class.ilNewsItemGen.php.

Referenced by read().

{
$this->content_is_lang_var = $a_content_is_lang_var;
}

+ Here is the caller graph for this function:

ilNewsItemGen::setContentLong (   $a_content_long)

Set ContentLong.

Parameters
string$a_content_longLong content of news

Definition at line 318 of file class.ilNewsItemGen.php.

Referenced by read().

{
$this->content_long = $a_content_long;
}

+ Here is the caller graph for this function:

ilNewsItemGen::setContentType (   $a_content_type = "text")

Set ContentType.

Parameters
string$a_content_typeContent type.

Definition at line 218 of file class.ilNewsItemGen.php.

Referenced by read().

{
$this->content_type = $a_content_type;
}

+ Here is the caller graph for this function:

ilNewsItemGen::setContextObjId (   $a_context_obj_id)

Set ContextObjId.

Parameters
int$a_context_obj_id

Definition at line 138 of file class.ilNewsItemGen.php.

Referenced by read(), and ilNewsItem\setContext().

{
$this->context_obj_id = $a_context_obj_id;
}

+ Here is the caller graph for this function:

ilNewsItemGen::setContextObjType (   $a_context_obj_type)

Set ContextObjType.

Parameters
int$a_context_obj_type

Definition at line 158 of file class.ilNewsItemGen.php.

Referenced by read(), and ilNewsItem\setContext().

{
$this->context_obj_type = $a_context_obj_type;
}

+ Here is the caller graph for this function:

ilNewsItemGen::setContextSubObjId (   $a_context_sub_obj_id)

Set ContextSubObjId.

Parameters
int$a_context_sub_obj_id

Definition at line 178 of file class.ilNewsItemGen.php.

Referenced by read(), and ilNewsItem\setContext().

{
$this->context_sub_obj_id = $a_context_sub_obj_id;
}

+ Here is the caller graph for this function:

ilNewsItemGen::setContextSubObjType (   $a_context_sub_obj_type)

Set ContextSubObjType.

Parameters
int$a_context_sub_obj_type

Definition at line 198 of file class.ilNewsItemGen.php.

Referenced by read(), and ilNewsItem\setContext().

{
$this->context_sub_obj_type = $a_context_sub_obj_type;
}

+ Here is the caller graph for this function:

ilNewsItemGen::setCreationDate (   $a_creation_date)

Set CreationDate.

Parameters
string$a_creation_dateDate of creation.

Definition at line 238 of file class.ilNewsItemGen.php.

Referenced by read().

{
$this->creation_date = $a_creation_date;
}

+ Here is the caller graph for this function:

ilNewsItemGen::setId (   $a_id)

Set Id.

Parameters
int$a_id

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

Referenced by __construct(), and create().

{
$this->id = $a_id;
}

+ Here is the caller graph for this function:

ilNewsItemGen::setMobId (   $a_mob_id)

Set MobId.

Parameters
int$a_mob_idMedia Object ID (if news includes attachement)

Definition at line 378 of file class.ilNewsItemGen.php.

Referenced by read().

{
$this->mob_id = $a_mob_id;
}

+ Here is the caller graph for this function:

ilNewsItemGen::setPlaytime (   $a_playtime)

Set Playtime.

Parameters
string$a_playtimePlay Time, hh:mm:ss (of attached media file)

Definition at line 398 of file class.ilNewsItemGen.php.

Referenced by read().

{
$this->playtime = $a_playtime;
}

+ Here is the caller graph for this function:

ilNewsItemGen::setPriority (   $a_priority = 1)

Set Priority.

Parameters
int$a_priorityNews Priority

Definition at line 338 of file class.ilNewsItemGen.php.

Referenced by read().

{
$this->priority = $a_priority;
}

+ Here is the caller graph for this function:

ilNewsItemGen::setTitle (   $a_title)

Set Title.

Parameters
string$a_titleTitle of news item.

Definition at line 98 of file class.ilNewsItemGen.php.

Referenced by read().

{
$this->title = $a_title;
}

+ Here is the caller graph for this function:

ilNewsItemGen::setUpdateDate (   $a_update_date)

Set UpdateDate.

Parameters
string$a_update_dateDate of last update.

Definition at line 258 of file class.ilNewsItemGen.php.

Referenced by read().

{
$this->update_date = $a_update_date;
}

+ Here is the caller graph for this function:

ilNewsItemGen::setUserId (   $a_user_id)

Set UserId.

Parameters
int$a_user_idUser Id of last update.

Definition at line 278 of file class.ilNewsItemGen.php.

Referenced by read().

{
$this->user_id = $a_user_id;
}

+ Here is the caller graph for this function:

ilNewsItemGen::setVisibility (   $a_visibility = "users")

Set Visibility.

Parameters
string$a_visibilityAccess level of news.

Definition at line 298 of file class.ilNewsItemGen.php.

Referenced by read().

{
$this->visibility = $a_visibility;
}

+ Here is the caller graph for this function:

ilNewsItemGen::update ( )

Update item in database.

Definition at line 479 of file class.ilNewsItemGen.php.

References $ilDB, getContent(), getContentIsLangVar(), getContentLong(), getContentType(), getContextObjId(), getContextObjType(), getContextSubObjId(), getContextSubObjType(), getId(), getMobId(), getPlaytime(), getPriority(), getTitle(), getUserId(), getVisibility(), and ilUtil\now().

{
global $ilDB;
$ilDB->update("il_news_item", array(
"title" => array("text", $this->getTitle()),
"content" => array("clob", $this->getContent()),
"context_obj_id" => array("integer", $this->getContextObjId()),
"context_obj_type" => array("text", $this->getContextObjType()),
"context_sub_obj_id" => array("integer", $this->getContextSubObjId()),
"context_sub_obj_type" => array("text", $this->getContextSubObjType()),
"content_type" => array("text", $this->getContentType()),
"update_date" => array("timestamp", ilUtil::now()),
"user_id" => array("integer", $this->getUserId()),
"visibility" => array("text", $this->getVisibility()),
"content_long" => array("clob", $this->getContentLong()),
"priority" => array("integer", $this->getPriority()),
"content_is_lang_var" => array("integer", $this->getContentIsLangVar()),
"mob_id" => array("integer", $this->getMobId()),
"playtime" => array("text", $this->getPlaytime())
), array(
"id" => array("integer", $this->getId())
));
}

+ Here is the call graph for this function:

Field Documentation

ilNewsItemGen::$content
protected

Definition at line 42 of file class.ilNewsItemGen.php.

Referenced by getContent().

ilNewsItemGen::$content_is_lang_var = 0
protected

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

Referenced by getContentIsLangVar().

ilNewsItemGen::$content_long
protected

Definition at line 52 of file class.ilNewsItemGen.php.

Referenced by getContentLong().

ilNewsItemGen::$content_type = "text"
protected

Definition at line 47 of file class.ilNewsItemGen.php.

Referenced by getContentType().

ilNewsItemGen::$context_obj_id
protected

Definition at line 43 of file class.ilNewsItemGen.php.

Referenced by getContextObjId().

ilNewsItemGen::$context_obj_type
protected

Definition at line 44 of file class.ilNewsItemGen.php.

Referenced by getContextObjType().

ilNewsItemGen::$context_sub_obj_id
protected

Definition at line 45 of file class.ilNewsItemGen.php.

Referenced by getContextSubObjId().

ilNewsItemGen::$context_sub_obj_type
protected

Definition at line 46 of file class.ilNewsItemGen.php.

Referenced by getContextSubObjType().

ilNewsItemGen::$creation_date
protected

Definition at line 48 of file class.ilNewsItemGen.php.

Referenced by getCreationDate().

ilNewsItemGen::$id
protected

Definition at line 40 of file class.ilNewsItemGen.php.

Referenced by getId(), and ilNewsItem\mergeNews().

ilNewsItemGen::$mob_id
protected

Definition at line 55 of file class.ilNewsItemGen.php.

Referenced by getMobId().

ilNewsItemGen::$playtime
protected

Definition at line 56 of file class.ilNewsItemGen.php.

Referenced by getPlaytime().

ilNewsItemGen::$priority = 1
protected

Definition at line 53 of file class.ilNewsItemGen.php.

Referenced by getPriority().

ilNewsItemGen::$title
protected

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

Referenced by getTitle().

ilNewsItemGen::$update_date
protected

Definition at line 49 of file class.ilNewsItemGen.php.

Referenced by getUpdateDate().

ilNewsItemGen::$user_id
protected

Definition at line 50 of file class.ilNewsItemGen.php.

Referenced by getUserId().

ilNewsItemGen::$visibility = "users"
protected

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