ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilObjMediaCast Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilObjMediaCast:
+ Collaboration diagram for ilObjMediaCast:

Public Member Functions

 __construct (int $a_id=0, bool $a_call_by_reference=true)
 
 setOnline (bool $a_online)
 
 getOnline ()
 
 setComments (bool $comments)
 
 getComments ()
 
 setPublicFiles (bool $a_publicfiles)
 
 getPublicFiles ()
 
 setViewMode (string $a_val)
 
 getViewMode ()
 
 setItemsArray (array $a_itemsarray)
 
 getItemsArray ()
 
 setAutoplayMode (int $a_val)
 
 getAutoplayMode ()
 
 setNumberInitialVideos (int $a_val)
 
 getNumberInitialVideos ()
 
 setNewItemsInLearningProgress (bool $a_val)
 Set new items automatically in lp. More...
 
 getNewItemsInLearningProgress ()
 
 getSortedItemsArray ()
 
 setDownloadable (bool $a_downloadable)
 
 getDownloadable ()
 
 getDefaultAccess ()
 
 setDefaultAccess (int $value)
 
 setOrder (int $a_value)
 
 getOrder ()
 
 create ()
 
 update ()
 
 read ()
 
 delete ()
 
 readItems (bool $a_oldest_first=false)
 
 deleteOrder ()
 
 readOrder ()
 
 saveOrder (array $a_items)
 
 copyItems (ilObjMediaCast $a_new_obj)
 
 handleLPUpdate (int $a_user_id, int $a_mob_id)
 
 addMobToCast (int $mob_id, int $user_id, string $long_desc="", bool $extract=false)
 Add media object to media cast. More...
 
 getPlaytimeForSeconds (int $seconds)
 Get playtime for seconds. More...
 
- Public Member Functions inherited from ilObject
 getObjectProperties ()
 
 flushObjectProperties ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $description)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Data Fields

const ORDER_TITLE = 1
 
const ORDER_CREATION_DATE_ASC = 2
 
const ORDER_CREATION_DATE_DESC = 3
 
const ORDER_MANUAL = 4
 
const VIEW_LIST = ""
 
const VIEW_GALLERY = "gallery"
 
const VIEW_IMG_GALLERY = "img_gallery"
 
const VIEW_PODCAST = "podcast"
 
const VIEW_VCAST = "video"
 
const AUTOPLAY_NO = 0
 
const AUTOPLAY_ACT = 1
 
const AUTOPLAY_INACT = 2
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 

Static Public Attributes

static array $purposes = array("Standard")
 

Protected Member Functions

 copyOrder (ilObjMediaCast $newObj, array $mapping)
 
- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

Protected Attributes

bool $comments = false
 
ILIAS Notes Service $notes
 
ILIAS MediaCast InternalDomainService $domain
 
ILIAS MediaObjects Tracking TrackingManager $mob_tracking
 
array $itemsarray
 
ilObjUser $user
 
bool $online = false
 
bool $publicfiles = false
 
bool $downloadable = true
 
int $order = 0
 
string $view_mode = self::VIEW_VCAST
 
int $defaultAccess = 0
 
array $mob_mapping = []
 
int $nr_initial_videos = 5
 
bool $new_items_in_lp = true
 
int $autoplay_mode = self::AUTOPLAY_ACT
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, \ilDBInterface $ilDB=null)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilObjMediaCast

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 23 of file class.ilObjMediaCast.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjMediaCast::__construct ( int  $a_id = 0,
bool  $a_call_by_reference = true 
)

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

References $DIC, ILIAS\MetaData\Repository\Validation\Data\__construct(), setDefaultAccess(), setOrder(), and ILIAS\Repository\user().

59  {
60  global $DIC;
61 
62  $this->db = $DIC->database();
63  $this->user = $DIC->user();
64  $this->type = "mcst";
65  $mcst_set = new ilSetting("mcst");
66  $this->setDefaultAccess($mcst_set->get("defaultaccess") == "users" ? 0 : 1);
67  $this->setOrder(self::ORDER_CREATION_DATE_DESC);
68  $this->mob_tracking = $DIC->mediaObjects()->internal()
69  ->domain()
70  ->tracking();
71  $this->notes = $DIC->notes();
72  $this->domain = $DIC->mediaCast()->internal()->domain();
73  parent::__construct($a_id, $a_call_by_reference);
74  }
setDefaultAccess(int $value)
global $DIC
Definition: feed.php:28
setOrder(int $a_value)
__construct(VocabulariesInterface $vocabularies)
+ Here is the call graph for this function:

Member Function Documentation

◆ addMobToCast()

ilObjMediaCast::addMobToCast ( int  $mob_id,
int  $user_id,
string  $long_desc = "",
bool  $extract = false 
)

Add media object to media cast.

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

References Vendor\Package\$e, ilObject\$long_desc, getDefaultAccess(), ilObject\getId(), getPlaytimeForSeconds(), ilObject\getType(), and NEWS_AUDIO.

514  : int {
515  $mob = new ilObjMediaObject($mob_id);
516  if ($extract) {
517  try {
518  $mob->getExternalMetadata();
519  } catch (Exception $e) {
520  }
521  }
522  $news_set = new ilSetting("news");
523  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
524 
525  // create new media cast item
526  $mc_item = new ilNewsItem();
527  $mc_item->setMobId($mob->getId());
528  $mc_item->setContentType(NEWS_AUDIO);
529  $mc_item->setContextObjId($this->getId());
530  $mc_item->setContextObjType($this->getType());
531  $mc_item->setUserId($user_id);
532  $med_item = $mob->getMediaItem("Standard");
533  $mc_item->setPlaytime($this->getPlaytimeForSeconds($med_item->getDuration()));
534  $mc_item->setTitle($mob->getTitle());
535  $mc_item->setContent($mob->getLongDescription());
536  if ($long_desc != "") {
537  $mc_item->setContent($long_desc);
538  }
539  $mc_item->setLimitation(false);
540  $mc_item->setVisibility($this->getDefaultAccess() == 0 ? "users" : "public");
541  $mc_item->create();
542 
543  $lp = $this->domain->learningProgress($this);
544  $lp->addItemToLP($mob_id);
545 
546  return $mc_item->getId();
547  }
getPlaytimeForSeconds(int $seconds)
Get playtime for seconds.
string $long_desc
A news item can be created by different sources.
const NEWS_AUDIO
+ Here is the call graph for this function:

◆ copyItems()

ilObjMediaCast::copyItems ( ilObjMediaCast  $a_new_obj)

Definition at line 465 of file class.ilObjMediaCast.php.

References $user, ilObject\getId(), ilObject\getType(), NEWS_AUDIO, and readItems().

Referenced by copyOrder().

465  : array
466  {
467  $ilUser = $this->user;
468 
469  $item_mapping = [];
470  foreach ($this->readItems(true) as $item) {
471  // copy media object
472  $mob_id = $item["mob_id"];
473  $mob = new ilObjMediaObject($mob_id);
474  $new_mob = $mob->duplicate();
475 
476  // copy news item
477  // create new media cast item
478  $mc_item = new ilNewsItem();
479  $mc_item->setMobId($new_mob->getId());
480  $mc_item->setContentType(NEWS_AUDIO);
481  $mc_item->setContextObjId($a_new_obj->getId());
482  $mc_item->setContextObjType($a_new_obj->getType());
483  $mc_item->setUserId($ilUser->getId());
484  $mc_item->setPlaytime($item["playtime"] ?? "");
485  $mc_item->setTitle($item["title"] ?? "");
486  $mc_item->setContent($item["content"] ?? "");
487  $mc_item->setVisibility($item["visibility"] ?? "users");
488  $mc_item->create();
489  $this->mob_mapping[$mob_id] = $new_mob->getId();
490  $item_mapping[$item["id"]] = $mc_item->getId();
491  }
492  return $item_mapping;
493  }
A news item can be created by different sources.
const NEWS_AUDIO
readItems(bool $a_oldest_first=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyOrder()

ilObjMediaCast::copyOrder ( ilObjMediaCast  $newObj,
array  $mapping 
)
protected

Definition at line 403 of file class.ilObjMediaCast.php.

References ilCopyWizardOptions\_getInstance(), ilBlockSetting\_lookup(), ilBlockSetting\_write(), copyItems(), getAutoplayMode(), getDefaultAccess(), getDownloadable(), ilObject\getId(), ilObjectLP\getInstance(), getNewItemsInLearningProgress(), getNumberInitialVideos(), getOnline(), getOrder(), getPublicFiles(), getViewMode(), ILIAS\Repository\int(), readOrder(), and saveOrder().

406  : void {
407  $items = [];
408  foreach ($this->readOrder() as $i) {
409  if (!array_key_exists($i, $mapping)) {
410  continue;
411  }
412  $items[] = $mapping[$i];
413  }
414  $newObj->saveOrder($items);
415  }
saveOrder(array $a_items)
+ Here is the call graph for this function:

◆ create()

ilObjMediaCast::create ( )

Definition at line 226 of file class.ilObjMediaCast.php.

References ilObject\$db, $id, $ilDB, getAutoplayMode(), getDefaultAccess(), getDownloadable(), ilObject\getId(), getNewItemsInLearningProgress(), getNumberInitialVideos(), getOnline(), getOrder(), getPublicFiles(), and getViewMode().

226  : int
227  {
228  $ilDB = $this->db;
229 
230  $id = parent::create();
231 
232  $query = "INSERT INTO il_media_cast_data (" .
233  " id" .
234  ", is_online" .
235  ", public_files" .
236  ", downloadable" .
237  ", def_access" .
238  ", sortmode" .
239  ", viewmode" .
240  ", autoplaymode" .
241  ", nr_initial_videos" .
242  ", new_items_in_lp" .
243  " ) VALUES (" .
244  $ilDB->quote($this->getId(), "integer")
245  . "," . $ilDB->quote((int) $this->getOnline(), "integer")
246  . "," . $ilDB->quote((int) $this->getPublicFiles(), "integer")
247  . "," . $ilDB->quote((int) $this->getDownloadable(), "integer")
248  . "," . $ilDB->quote((int) $this->getDefaultAccess(), "integer")
249  . "," . $ilDB->quote((int) $this->getOrder(), "integer")
250  . "," . $ilDB->quote($this->getViewMode(), "text")
251  . "," . $ilDB->quote((int) $this->getAutoplayMode(), "integer")
252  . "," . $ilDB->quote((int) $this->getNumberInitialVideos(), "integer")
253  . "," . $ilDB->quote((int) $this->getNewItemsInLearningProgress(), "integer")
254  . ")";
255  $ilDB->manipulate($query);
256  return $id;
257  }
ilDBInterface $db
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ delete()

ilObjMediaCast::delete ( )

Definition at line 313 of file class.ilObjMediaCast.php.

References ilObject\$db, $ilDB, deleteOrder(), ilObject\getId(), and getItemsArray().

313  : bool
314  {
315  $ilDB = $this->db;
316 
317  // always call parent delete function first!!
318  if (!parent::delete()) {
319  return false;
320  }
321 
322  // delete all items
323  $med_items = $this->getItemsArray();
324  foreach ($med_items as $item) {
325  $news_item = new ilNewsItem($item["id"]);
326  $news_item->delete();
327  }
328 
329  $this->deleteOrder();
330 
331  // delete record of table il_media_cast_data
332  $query = "DELETE FROM il_media_cast_data" .
333  " WHERE id = " . $ilDB->quote($this->getId(), "integer");
334  $ilDB->manipulate($query);
335 
336  return true;
337  }
ilDBInterface $db
A news item can be created by different sources.
+ Here is the call graph for this function:

◆ deleteOrder()

ilObjMediaCast::deleteOrder ( )

Definition at line 350 of file class.ilObjMediaCast.php.

References ilObject\$db, $ilDB, and ilObject\getId().

Referenced by delete(), and saveOrder().

350  : void
351  {
352  $ilDB = $this->db;
353 
354  if (!$this->getId()) {
355  return;
356  }
357 
358  $sql = "DELETE FROM il_media_cast_data_ord" .
359  " WHERE obj_id = " . $ilDB->quote($this->getId(), "integer");
360  $ilDB->manipulate($sql);
361  }
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAutoplayMode()

ilObjMediaCast::getAutoplayMode ( )

Definition at line 131 of file class.ilObjMediaCast.php.

References $autoplay_mode.

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

131  : int
132  {
133  return $this->autoplay_mode;
134  }
+ Here is the caller graph for this function:

◆ getComments()

ilObjMediaCast::getComments ( )

Definition at line 91 of file class.ilObjMediaCast.php.

References $comments.

Referenced by update().

91  : bool
92  {
93  return $this->comments;
94  }
+ Here is the caller graph for this function:

◆ getDefaultAccess()

ilObjMediaCast::getDefaultAccess ( )

Definition at line 205 of file class.ilObjMediaCast.php.

References $defaultAccess.

Referenced by addMobToCast(), copyOrder(), create(), and update().

205  : int
206  {
207  return $this->defaultAccess;
208  }
+ Here is the caller graph for this function:

◆ getDownloadable()

ilObjMediaCast::getDownloadable ( )

Definition at line 200 of file class.ilObjMediaCast.php.

References $downloadable.

Referenced by ilMediaCastTableGUI\__construct(), copyOrder(), create(), and update().

200  : bool
201  {
202  return $this->downloadable;
203  }
+ Here is the caller graph for this function:

◆ getItemsArray()

ilObjMediaCast::getItemsArray ( )

Definition at line 121 of file class.ilObjMediaCast.php.

References $itemsarray.

Referenced by delete(), and getSortedItemsArray().

121  : array
122  {
123  return $this->itemsarray;
124  }
+ Here is the caller graph for this function:

◆ getNewItemsInLearningProgress()

ilObjMediaCast::getNewItemsInLearningProgress ( )

Definition at line 154 of file class.ilObjMediaCast.php.

References $new_items_in_lp.

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

154  : bool
155  {
156  return $this->new_items_in_lp;
157  }
+ Here is the caller graph for this function:

◆ getNumberInitialVideos()

ilObjMediaCast::getNumberInitialVideos ( )

Definition at line 141 of file class.ilObjMediaCast.php.

References $nr_initial_videos.

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

141  : int
142  {
144  }
+ Here is the caller graph for this function:

◆ getOnline()

ilObjMediaCast::getOnline ( )

Definition at line 81 of file class.ilObjMediaCast.php.

References $online.

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

81  : bool
82  {
83  return $this->online;
84  }
+ Here is the caller graph for this function:

◆ getOrder()

ilObjMediaCast::getOrder ( )

Definition at line 220 of file class.ilObjMediaCast.php.

References $order.

Referenced by copyOrder(), create(), getSortedItemsArray(), and update().

220  : int
221  {
222  return $this->order;
223  }
+ Here is the caller graph for this function:

◆ getPlaytimeForSeconds()

ilObjMediaCast::getPlaytimeForSeconds ( int  $seconds)

Get playtime for seconds.

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

References $duration.

Referenced by addMobToCast().

552  : string
553  {
554  $hours = floor($seconds / 3600);
555  $minutes = floor(($seconds % 3600) / 60);
556  $seconds = $seconds % 60;
557  $duration = str_pad($hours, 2, "0", STR_PAD_LEFT) . ":" .
558  str_pad($minutes, 2, "0", STR_PAD_LEFT) . ":" .
559  str_pad($seconds, 2, "0", STR_PAD_LEFT);
560  return $duration;
561  }
$duration
+ Here is the caller graph for this function:

◆ getPublicFiles()

ilObjMediaCast::getPublicFiles ( )

Definition at line 101 of file class.ilObjMediaCast.php.

References $publicfiles.

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

101  : bool
102  {
103  return $this->publicfiles;
104  }
+ Here is the caller graph for this function:

◆ getSortedItemsArray()

ilObjMediaCast::getSortedItemsArray ( )

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

References $order, getItemsArray(), getOrder(), ORDER_CREATION_DATE_ASC, ORDER_CREATION_DATE_DESC, ORDER_MANUAL, ORDER_TITLE, readOrder(), and ilArrayUtil\sortArray().

159  : array
160  {
161  $med_items = $this->getItemsArray();
162  // sort by order setting
163  switch ($this->getOrder()) {
165  $med_items = ilArrayUtil::sortArray($med_items, "title", "asc", false, true);
166  break;
167 
169  $med_items = ilArrayUtil::sortArray($med_items, "creation_date", "asc", false, true);
170  break;
171 
173  $med_items = ilArrayUtil::sortArray($med_items, "creation_date", "desc", false, true);
174  break;
175 
177  $order = array_flip($this->readOrder());
178  $pos = sizeof($order);
179  foreach (array_keys($med_items) as $idx) {
180  if (array_key_exists($idx, $order)) {
181  $med_items[$idx]["order"] = ($order[$idx] + 1) * 10;
182  }
183  // item has no order yet
184  else {
185  $med_items[$idx]["order"] = (++$pos) * 10;
186  }
187  }
188 
189  $med_items = ilArrayUtil::sortArray($med_items, "order", "asc", true, true);
190  break;
191  }
192  return $med_items;
193  }
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
+ Here is the call graph for this function:

◆ getViewMode()

ilObjMediaCast::getViewMode ( )

Definition at line 111 of file class.ilObjMediaCast.php.

References $view_mode.

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

111  : string
112  {
113  return $this->view_mode;
114  }
+ Here is the caller graph for this function:

◆ handleLPUpdate()

ilObjMediaCast::handleLPUpdate ( int  $a_user_id,
int  $a_mob_id 
)

Definition at line 495 of file class.ilObjMediaCast.php.

References ilObject\getRefId().

498  : void {
499  $this->mob_tracking->saveCompletion(
500  $a_mob_id,
501  $this->getRefId(),
502  $a_user_id
503  );
504  }
+ Here is the call graph for this function:

◆ read()

ilObjMediaCast::read ( )

Definition at line 287 of file class.ilObjMediaCast.php.

References ilObject\$db, $ilDB, ilObject\getId(), readItems(), setAutoplayMode(), setComments(), setDefaultAccess(), setDownloadable(), setNewItemsInLearningProgress(), setNumberInitialVideos(), setOnline(), setOrder(), setPublicFiles(), and setViewMode().

287  : void
288  {
289  $ilDB = $this->db;
290 
291  parent::read();
292  $this->readItems();
293 
294  $query = "SELECT * FROM il_media_cast_data WHERE id = " .
295  $ilDB->quote($this->getId(), "integer");
296  $set = $ilDB->query($query);
297  $rec = $ilDB->fetchAssoc($set);
298 
299  $this->setOnline((bool) $rec["is_online"]);
300  $this->setPublicFiles((bool) $rec["public_files"]);
301  $this->setDownloadable((bool) $rec["downloadable"]);
302  $this->setDefaultAccess((int) $rec["def_access"]);
303  $this->setOrder((int) $rec["sortmode"]);
304  $this->setViewMode((string) $rec["viewmode"]);
305  $this->setAutoplayMode((int) $rec["autoplaymode"]);
306  $this->setNumberInitialVideos((int) $rec["nr_initial_videos"]);
307  $this->setNewItemsInLearningProgress((bool) $rec["new_items_in_lp"]);
308 
309  $this->setComments($this->notes->domain()->commentsActive($this->getId()));
310  }
setAutoplayMode(int $a_val)
setNewItemsInLearningProgress(bool $a_val)
Set new items automatically in lp.
setPublicFiles(bool $a_publicfiles)
setDefaultAccess(int $value)
setOnline(bool $a_online)
setComments(bool $comments)
setDownloadable(bool $a_downloadable)
setOrder(int $a_value)
ilDBInterface $db
setNumberInitialVideos(int $a_val)
setViewMode(string $a_val)
readItems(bool $a_oldest_first=false)
+ Here is the call graph for this function:

◆ readItems()

ilObjMediaCast::readItems ( bool  $a_oldest_first = false)

Definition at line 339 of file class.ilObjMediaCast.php.

References $itemsarray, ilObject\getId(), and ilObject\getType().

Referenced by copyItems(), and read().

339  : array
340  {
341  //
342  $it = new ilNewsItem();
343  $it->setContextObjId($this->getId());
344  $it->setContextObjType($this->getType());
345  $this->itemsarray = $it->queryNewsForContext(false, 0, "", false, $a_oldest_first);
346 
347  return $this->itemsarray;
348  }
A news item can be created by different sources.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readOrder()

ilObjMediaCast::readOrder ( )

Definition at line 363 of file class.ilObjMediaCast.php.

References ilObject\$db, $ilDB, $res, and ilObject\getId().

Referenced by copyOrder(), and getSortedItemsArray().

363  : ?array
364  {
365  $ilDB = $this->db;
366 
367  if (!$this->getId()) {
368  return null;
369  }
370 
371  $all = array();
372  $sql = "SELECT item_id FROM il_media_cast_data_ord" .
373  " WHERE obj_id = " . $ilDB->quote($this->getId(), "integer") .
374  " ORDER BY pos";
375  $res = $ilDB->query($sql);
376  while ($row = $ilDB->fetchAssoc($res)) {
377  $all[] = $row["item_id"];
378  }
379  return $all;
380  }
$res
Definition: ltiservices.php:69
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveOrder()

ilObjMediaCast::saveOrder ( array  $a_items)

Definition at line 382 of file class.ilObjMediaCast.php.

References ilObject\$db, $ilDB, deleteOrder(), and ilObject\getId().

Referenced by copyOrder().

382  : void
383  {
384  $ilDB = $this->db;
385 
386  if (!$this->getId()) {
387  return;
388  }
389  $this->deleteOrder();
390 
391  $pos = 0;
392  foreach ($a_items as $item_id) {
393  $pos++;
394 
395  $sql = "INSERT INTO il_media_cast_data_ord (obj_id,item_id,pos)" .
396  " VALUES (" . $ilDB->quote($this->getId(), "integer") . "," .
397  $ilDB->quote($item_id, "integer") . "," .
398  $ilDB->quote($pos, "integer") . ")";
399  $ilDB->manipulate($sql);
400  }
401  }
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAutoplayMode()

ilObjMediaCast::setAutoplayMode ( int  $a_val)

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

Referenced by read().

126  : void
127  {
128  $this->autoplay_mode = $a_val;
129  }
+ Here is the caller graph for this function:

◆ setComments()

ilObjMediaCast::setComments ( bool  $comments)

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

References $comments.

Referenced by read().

86  : void
87  {
88  $this->comments = $comments;
89  }
+ Here is the caller graph for this function:

◆ setDefaultAccess()

ilObjMediaCast::setDefaultAccess ( int  $value)

Definition at line 210 of file class.ilObjMediaCast.php.

Referenced by __construct(), and read().

210  : void
211  {
212  $this->defaultAccess = ($value === 0) ? 0 : 1;
213  }
+ Here is the caller graph for this function:

◆ setDownloadable()

ilObjMediaCast::setDownloadable ( bool  $a_downloadable)

Definition at line 195 of file class.ilObjMediaCast.php.

Referenced by read().

195  : void
196  {
197  $this->downloadable = $a_downloadable;
198  }
+ Here is the caller graph for this function:

◆ setItemsArray()

ilObjMediaCast::setItemsArray ( array  $a_itemsarray)

Definition at line 116 of file class.ilObjMediaCast.php.

116  : void
117  {
118  $this->itemsarray = $a_itemsarray;
119  }

◆ setNewItemsInLearningProgress()

ilObjMediaCast::setNewItemsInLearningProgress ( bool  $a_val)

Set new items automatically in lp.

Definition at line 149 of file class.ilObjMediaCast.php.

Referenced by read().

149  : void
150  {
151  $this->new_items_in_lp = $a_val;
152  }
+ Here is the caller graph for this function:

◆ setNumberInitialVideos()

ilObjMediaCast::setNumberInitialVideos ( int  $a_val)

Definition at line 136 of file class.ilObjMediaCast.php.

Referenced by read().

136  : void
137  {
138  $this->nr_initial_videos = $a_val;
139  }
+ Here is the caller graph for this function:

◆ setOnline()

ilObjMediaCast::setOnline ( bool  $a_online)

Definition at line 76 of file class.ilObjMediaCast.php.

Referenced by read().

76  : void
77  {
78  $this->online = $a_online;
79  }
+ Here is the caller graph for this function:

◆ setOrder()

ilObjMediaCast::setOrder ( int  $a_value)

Definition at line 215 of file class.ilObjMediaCast.php.

Referenced by __construct(), and read().

215  : void
216  {
217  $this->order = $a_value;
218  }
+ Here is the caller graph for this function:

◆ setPublicFiles()

ilObjMediaCast::setPublicFiles ( bool  $a_publicfiles)

Definition at line 96 of file class.ilObjMediaCast.php.

Referenced by read().

96  : void
97  {
98  $this->publicfiles = $a_publicfiles;
99  }
+ Here is the caller graph for this function:

◆ setViewMode()

ilObjMediaCast::setViewMode ( string  $a_val)

Definition at line 106 of file class.ilObjMediaCast.php.

Referenced by read().

106  : void
107  {
108  $this->view_mode = $a_val;
109  }
+ Here is the caller graph for this function:

◆ update()

ilObjMediaCast::update ( )

Definition at line 259 of file class.ilObjMediaCast.php.

References ilObject\$db, $ilDB, getAutoplayMode(), getComments(), getDefaultAccess(), getDownloadable(), ilObject\getId(), getNewItemsInLearningProgress(), getNumberInitialVideos(), getOnline(), getOrder(), getPublicFiles(), and getViewMode().

259  : bool
260  {
261  $ilDB = $this->db;
262 
263  if (!parent::update()) {
264  return false;
265  }
266 
267  // update media cast data
268  $query = "UPDATE il_media_cast_data SET " .
269  " is_online = " . $ilDB->quote((int) $this->getOnline(), "integer") .
270  ", public_files = " . $ilDB->quote((int) $this->getPublicFiles(), "integer") .
271  ", downloadable = " . $ilDB->quote((int) $this->getDownloadable(), "integer") .
272  ", def_access = " . $ilDB->quote($this->getDefaultAccess(), "integer") .
273  ", sortmode = " . $ilDB->quote($this->getOrder(), "integer") .
274  ", viewmode = " . $ilDB->quote($this->getViewMode(), "text") .
275  ", autoplaymode = " . $ilDB->quote($this->getAutoplayMode(), "integer") .
276  ", nr_initial_videos = " . $ilDB->quote($this->getNumberInitialVideos(), "integer") .
277  ", new_items_in_lp = " . $ilDB->quote($this->getNewItemsInLearningProgress(), "integer") .
278  " WHERE id = " . $ilDB->quote($this->getId(), "integer");
279 
280  $ilDB->manipulate($query);
281 
282  $this->notes->domain()->activateComments($this->getId(), $this->getComments());
283 
284  return true;
285  }
ilDBInterface $db
+ Here is the call graph for this function:

Field Documentation

◆ $autoplay_mode

int ilObjMediaCast::$autoplay_mode = self::AUTOPLAY_ACT
protected

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

Referenced by getAutoplayMode().

◆ $comments

bool ilObjMediaCast::$comments = false
protected

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

Referenced by getComments(), and setComments().

◆ $defaultAccess

int ilObjMediaCast::$defaultAccess = 0
protected

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

Referenced by getDefaultAccess().

◆ $domain

ILIAS MediaCast InternalDomainService ilObjMediaCast::$domain
protected

Definition at line 39 of file class.ilObjMediaCast.php.

◆ $downloadable

bool ilObjMediaCast::$downloadable = true
protected

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

Referenced by getDownloadable().

◆ $itemsarray

array ilObjMediaCast::$itemsarray
protected

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

Referenced by getItemsArray(), and readItems().

◆ $mob_mapping

array ilObjMediaCast::$mob_mapping = []
protected

Definition at line 51 of file class.ilObjMediaCast.php.

◆ $mob_tracking

ILIAS MediaObjects Tracking TrackingManager ilObjMediaCast::$mob_tracking
protected

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

◆ $new_items_in_lp

bool ilObjMediaCast::$new_items_in_lp = true
protected

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

Referenced by getNewItemsInLearningProgress().

◆ $notes

ILIAS Notes Service ilObjMediaCast::$notes
protected

Definition at line 38 of file class.ilObjMediaCast.php.

◆ $nr_initial_videos

int ilObjMediaCast::$nr_initial_videos = 5
protected

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

Referenced by getNumberInitialVideos().

◆ $online

bool ilObjMediaCast::$online = false
protected

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

Referenced by getOnline().

◆ $order

int ilObjMediaCast::$order = 0
protected

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

Referenced by getOrder(), and getSortedItemsArray().

◆ $publicfiles

bool ilObjMediaCast::$publicfiles = false
protected

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

Referenced by getPublicFiles().

◆ $purposes

◆ $user

ilObjUser ilObjMediaCast::$user
protected

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

Referenced by copyItems().

◆ $view_mode

string ilObjMediaCast::$view_mode = self::VIEW_VCAST
protected

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

Referenced by getViewMode().

◆ AUTOPLAY_ACT

const ilObjMediaCast::AUTOPLAY_ACT = 1

◆ AUTOPLAY_INACT

const ilObjMediaCast::AUTOPLAY_INACT = 2

Definition at line 36 of file class.ilObjMediaCast.php.

Referenced by ilObjMediaCastGUI\initSettingsForm().

◆ AUTOPLAY_NO

◆ ORDER_CREATION_DATE_ASC

const ilObjMediaCast::ORDER_CREATION_DATE_ASC = 2

◆ ORDER_CREATION_DATE_DESC

const ilObjMediaCast::ORDER_CREATION_DATE_DESC = 3

◆ ORDER_MANUAL

◆ ORDER_TITLE

const ilObjMediaCast::ORDER_TITLE = 1

◆ VIEW_GALLERY

const ilObjMediaCast::VIEW_GALLERY = "gallery"

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

Referenced by ilObjMediaCastGUI\showContentObject().

◆ VIEW_IMG_GALLERY

◆ VIEW_LIST

const ilObjMediaCast::VIEW_LIST = ""

Definition at line 29 of file class.ilObjMediaCast.php.

◆ VIEW_PODCAST

◆ VIEW_VCAST


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