38     protected \ILIAS\Notes\Service 
$notes;
    39     protected \ILIAS\MediaCast\InternalDomainService 
$domain;
    58         bool $a_call_by_reference = 
true    62         $this->db = $DIC->database();
    63         $this->
user = $DIC->user();
    67         $this->
setOrder(self::ORDER_CREATION_DATE_DESC);
    68         $this->mob_tracking = $DIC->mediaObjects()->internal()
    71         $this->notes = $DIC->notes();
    72         $this->domain = $DIC->mediaCast()->internal()->domain();
    78         $this->online = $a_online;
    98         $this->publicfiles = $a_publicfiles;
   108         $this->view_mode = $a_val;
   118         $this->itemsarray = $a_itemsarray;
   128         $this->autoplay_mode = $a_val;
   138         $this->nr_initial_videos = $a_val;
   151         $this->new_items_in_lp = $a_val;
   179                 foreach (array_keys($med_items) as $idx) {
   180                     if (array_key_exists($idx, $order)) {
   181                         $med_items[$idx][
"order"] = ($order[$idx] + 1) * 10;
   185                         $med_items[$idx][
"order"] = (++$pos) * 10;
   197         $this->downloadable = $a_downloadable;
   212         $this->defaultAccess = ($value === 0) ? 0 : 1;
   217         $this->order = $a_value;
   230         $id = parent::create();
   234         $query = 
"INSERT INTO il_media_cast_data (" .
   243             ", nr_initial_videos" .
   244             ", new_items_in_lp" .
   257         $ilDB->manipulate($query);
   265         if (!parent::update()) {
   272         $query = 
"UPDATE il_media_cast_data SET " .
   273             " is_online = " . 
$ilDB->quote((
int) $this->
getOnline(), 
"integer") .
   277             ", sortmode = " . 
$ilDB->quote($this->
getOrder(), 
"integer") .
   282             " WHERE id = " . 
$ilDB->quote($this->
getId(), 
"integer");
   284         $ilDB->manipulate($query);
   286         $this->notes->domain()->activateComments($this->
getId(), $this->
getComments());
   298         $query = 
"SELECT * FROM il_media_cast_data WHERE id = " .
   300         $set = 
$ilDB->query($query);
   301         $rec = 
$ilDB->fetchAssoc($set);
   303         $this->
setOnline((
bool) $rec[
"is_online"]);
   307         $this->
setOrder((
int) $rec[
"sortmode"]);
   317     public function delete(): 
bool   322         if (!parent::delete()) {
   330         foreach ($med_items as $item) {
   332             $news_item->delete();
   338         $query = 
"DELETE FROM il_media_cast_data" .
   339             " WHERE id = " . 
$ilDB->quote($this->
getId(), 
"integer");
   340         $ilDB->manipulate($query);
   345     public function readItems(
bool $a_oldest_first = 
false): array
   349         $it->setContextObjId($this->
getId());
   350         $it->setContextObjType($this->
getType());
   351         $this->itemsarray = $it->queryNewsForContext(
false, 0, 
"", 
false, $a_oldest_first);
   360         if (!$this->
getId()) {
   364         $sql = 
"DELETE FROM il_media_cast_data_ord" .
   365             " WHERE obj_id = " . 
$ilDB->quote($this->
getId(), 
"integer");
   366         $ilDB->manipulate($sql);
   373         if (!$this->
getId()) {
   378         $sql = 
"SELECT item_id FROM il_media_cast_data_ord" .
   379             " WHERE obj_id = " . 
$ilDB->quote($this->
getId(), 
"integer") .
   383             $all[] = $row[
"item_id"];
   392         if (!$this->
getId()) {
   398         foreach ($a_items as $item_id) {
   401             $sql = 
"INSERT INTO il_media_cast_data_ord (obj_id,item_id,pos)" .
   402                 " VALUES (" . 
$ilDB->quote($this->
getId(), 
"integer") . 
"," .
   403                 $ilDB->quote($item_id, 
"integer") . 
"," .
   404                 $ilDB->quote($pos, 
"integer") . 
")";
   405             $ilDB->manipulate($sql);
   415             if (!array_key_exists($i, $mapping)) {
   418             $items[] = $mapping[$i];
   423     public function cloneObject(
int $a_target_id, 
int $a_copy_id = 0, 
bool $a_omit_tree = 
false): ?
ilObject   426         $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
   431         if (!$cp_options->isRootNode($this->getRefId())) {
   438         $new_obj->setOrder($this->
getOrder());
   457         $obj_settings->cloneSettings($new_obj->getId());
   458         unset($obj_settings);
   463         $collection = $olp->getCollectionInstance();
   465             $collection->cloneCollection($new_obj->getRefId(), $cp_options->getCopyId());
   478         foreach ($this->
readItems(
true) as $item) {
   480             $mob_id = $item[
"mob_id"];
   482             $new_mob = $mob->duplicate();
   487             $mc_item->setMobId($new_mob->getId());
   489             $mc_item->setContextObjId($a_new_obj->
getId());
   490             $mc_item->setContextObjType($a_new_obj->
getType());
   491             $mc_item->setUserId($ilUser->getId());
   492             $mc_item->setPlaytime($item[
"playtime"] ?? 
"");
   493             $mc_item->setTitle($item[
"title"] ?? 
"");
   494             $mc_item->setContent($item[
"content"] ?? 
"");
   495             $mc_item->setVisibility($item[
"visibility"] ?? 
"users");
   497             $this->mob_mapping[$mob_id] = $new_mob->getId();
   498             $item_mapping[$item[
"id"]] = $mc_item->getId();
   500         return $item_mapping;
   507         $this->mob_tracking->saveCompletion(
   521         bool $extract = 
false   526                 $mob->getExternalMetadata();
   531         $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
   535         $mc_item->setMobId($mob->getId());
   537         $mc_item->setContextObjId($this->
getId());
   538         $mc_item->setContextObjType($this->
getType());
   539         $mc_item->setUserId($user_id);
   540         $med_item = $mob->getMediaItem(
"Standard");
   542         $mc_item->setTitle($mob->getTitle());
   543         $mc_item->setContent($mob->getLongDescription());
   547         $mc_item->setLimitation(
false);
   548         $mc_item->setVisibility($this->
getDefaultAccess() == 0 ? 
"users" : 
"public");
   551         $lp = $this->domain->learningProgress($this);
   552         $lp->addItemToLP($mob_id);
   554         return $mc_item->getId();
   562         $hours = floor($seconds / 3600);
   563         $minutes = floor(($seconds % 3600) / 60);
   564         $seconds = $seconds % 60;
   565         $duration = str_pad($hours, 2, 
"0", STR_PAD_LEFT) . 
":" .
   566             str_pad($minutes, 2, 
"0", STR_PAD_LEFT) . 
":" .
   567             str_pad($seconds, 2, 
"0", STR_PAD_LEFT);
 
cloneMetaData(ilObject $target_obj)
Copy meta data. 
 
static _lookup(string $a_type, string $a_setting, int $a_user=0, int $a_block_id=0)
Lookup setting from database. 
 
static _write(string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
Write setting to database. 
 
A news item can be created by different sources. 
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
__construct(Container $dic, ilPlugin $plugin)
 
static _getInstance(int $a_copy_id)
 
static getInstance(int $obj_id)
 
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)