ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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
 
LOMServices $lom_services
 
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 getIconForType (string $type)
 
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\GlobalScreen\Provider\__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)
setOrder(int $a_value)
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ 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 517 of file class.ilObjMediaCast.php.

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

522  : int {
523  $mob = new ilObjMediaObject($mob_id);
524  if ($extract) {
525  try {
526  $mob->getExternalMetadata();
527  } catch (Exception $e) {
528  }
529  }
530  $news_set = new ilSetting("news");
531  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
532 
533  // create new media cast item
534  $mc_item = new ilNewsItem();
535  $mc_item->setMobId($mob->getId());
536  $mc_item->setContentType(NEWS_AUDIO);
537  $mc_item->setContextObjId($this->getId());
538  $mc_item->setContextObjType($this->getType());
539  $mc_item->setUserId($user_id);
540  $med_item = $mob->getMediaItem("Standard");
541  $mc_item->setPlaytime($this->getPlaytimeForSeconds($med_item->getDuration()));
542  $mc_item->setTitle($mob->getTitle());
543  $mc_item->setContent($mob->getLongDescription());
544  if ($long_desc != "") {
545  $mc_item->setContent($long_desc);
546  }
547  $mc_item->setLimitation(false);
548  $mc_item->setVisibility($this->getDefaultAccess() == 0 ? "users" : "public");
549  $mc_item->create();
550 
551  $lp = $this->domain->learningProgress($this);
552  $lp->addItemToLP($mob_id);
553 
554  return $mc_item->getId();
555  }
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 473 of file class.ilObjMediaCast.php.

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

Referenced by copyOrder().

473  : array
474  {
475  $ilUser = $this->user;
476 
477  $item_mapping = [];
478  foreach ($this->readItems(true) as $item) {
479  // copy media object
480  $mob_id = $item["mob_id"];
481  $mob = new ilObjMediaObject($mob_id);
482  $new_mob = $mob->duplicate();
483 
484  // copy news item
485  // create new media cast item
486  $mc_item = new ilNewsItem();
487  $mc_item->setMobId($new_mob->getId());
488  $mc_item->setContentType(NEWS_AUDIO);
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");
496  $mc_item->create();
497  $this->mob_mapping[$mob_id] = $new_mob->getId();
498  $item_mapping[$item["id"]] = $mc_item->getId();
499  }
500  return $item_mapping;
501  }
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 409 of file class.ilObjMediaCast.php.

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

412  : void {
413  $items = [];
414  foreach ($this->readOrder() as $i) {
415  if (!array_key_exists($i, $mapping)) {
416  continue;
417  }
418  $items[] = $mapping[$i];
419  }
420  $newObj->saveOrder($items);
421  }
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, ilObject\createMetaData(), 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  $this->createMetaData();
233 
234  $query = "INSERT INTO il_media_cast_data (" .
235  " id" .
236  ", is_online" .
237  ", public_files" .
238  ", downloadable" .
239  ", def_access" .
240  ", sortmode" .
241  ", viewmode" .
242  ", autoplaymode" .
243  ", nr_initial_videos" .
244  ", new_items_in_lp" .
245  " ) VALUES (" .
246  $ilDB->quote($this->getId(), "integer")
247  . "," . $ilDB->quote((int) $this->getOnline(), "integer")
248  . "," . $ilDB->quote((int) $this->getPublicFiles(), "integer")
249  . "," . $ilDB->quote((int) $this->getDownloadable(), "integer")
250  . "," . $ilDB->quote((int) $this->getDefaultAccess(), "integer")
251  . "," . $ilDB->quote((int) $this->getOrder(), "integer")
252  . "," . $ilDB->quote($this->getViewMode(), "text")
253  . "," . $ilDB->quote((int) $this->getAutoplayMode(), "integer")
254  . "," . $ilDB->quote((int) $this->getNumberInitialVideos(), "integer")
255  . "," . $ilDB->quote((int) $this->getNewItemsInLearningProgress(), "integer")
256  . ")";
257  $ilDB->manipulate($query);
258  return $id;
259  }
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 317 of file class.ilObjMediaCast.php.

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

317  : bool
318  {
319  $ilDB = $this->db;
320 
321  // always call parent delete function first!!
322  if (!parent::delete()) {
323  return false;
324  }
325 
326  $this->deleteMetaData();
327 
328  // delete all items
329  $med_items = $this->getItemsArray();
330  foreach ($med_items as $item) {
331  $news_item = new ilNewsItem($item["id"]);
332  $news_item->delete();
333  }
334 
335  $this->deleteOrder();
336 
337  // delete record of table il_media_cast_data
338  $query = "DELETE FROM il_media_cast_data" .
339  " WHERE id = " . $ilDB->quote($this->getId(), "integer");
340  $ilDB->manipulate($query);
341 
342  return true;
343  }
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 356 of file class.ilObjMediaCast.php.

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

Referenced by delete(), and saveOrder().

356  : void
357  {
358  $ilDB = $this->db;
359 
360  if (!$this->getId()) {
361  return;
362  }
363 
364  $sql = "DELETE FROM il_media_cast_data_ord" .
365  " WHERE obj_id = " . $ilDB->quote($this->getId(), "integer");
366  $ilDB->manipulate($sql);
367  }
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 560 of file class.ilObjMediaCast.php.

References $duration.

Referenced by addMobToCast().

560  : string
561  {
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);
568  return $duration;
569  }
$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 503 of file class.ilObjMediaCast.php.

References ilObject\getRefId().

506  : void {
507  $this->mob_tracking->saveCompletion(
508  $a_mob_id,
509  $this->getRefId(),
510  $a_user_id
511  );
512  }
+ Here is the call graph for this function:

◆ read()

ilObjMediaCast::read ( )

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

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

291  : void
292  {
293  $ilDB = $this->db;
294 
295  parent::read();
296  $this->readItems();
297 
298  $query = "SELECT * FROM il_media_cast_data WHERE id = " .
299  $ilDB->quote($this->getId(), "integer");
300  $set = $ilDB->query($query);
301  $rec = $ilDB->fetchAssoc($set);
302 
303  $this->setOnline((bool) $rec["is_online"]);
304  $this->setPublicFiles((bool) $rec["public_files"]);
305  $this->setDownloadable((bool) $rec["downloadable"]);
306  $this->setDefaultAccess((int) $rec["def_access"]);
307  $this->setOrder((int) $rec["sortmode"]);
308  $this->setViewMode((string) $rec["viewmode"]);
309  $this->setAutoplayMode((int) $rec["autoplaymode"]);
310  $this->setNumberInitialVideos((int) $rec["nr_initial_videos"]);
311  $this->setNewItemsInLearningProgress((bool) $rec["new_items_in_lp"]);
312 
313  $this->setComments($this->notes->domain()->commentsActive($this->getId()));
314  }
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 345 of file class.ilObjMediaCast.php.

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

Referenced by copyItems(), and read().

345  : array
346  {
347  //
348  $it = new ilNewsItem();
349  $it->setContextObjId($this->getId());
350  $it->setContextObjType($this->getType());
351  $this->itemsarray = $it->queryNewsForContext(false, 0, "", false, $a_oldest_first);
352 
353  return $this->itemsarray;
354  }
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 369 of file class.ilObjMediaCast.php.

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

Referenced by copyOrder(), and getSortedItemsArray().

369  : ?array
370  {
371  $ilDB = $this->db;
372 
373  if (!$this->getId()) {
374  return null;
375  }
376 
377  $all = array();
378  $sql = "SELECT item_id FROM il_media_cast_data_ord" .
379  " WHERE obj_id = " . $ilDB->quote($this->getId(), "integer") .
380  " ORDER BY pos";
381  $res = $ilDB->query($sql);
382  while ($row = $ilDB->fetchAssoc($res)) {
383  $all[] = $row["item_id"];
384  }
385  return $all;
386  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 388 of file class.ilObjMediaCast.php.

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

Referenced by copyOrder().

388  : void
389  {
390  $ilDB = $this->db;
391 
392  if (!$this->getId()) {
393  return;
394  }
395  $this->deleteOrder();
396 
397  $pos = 0;
398  foreach ($a_items as $item_id) {
399  $pos++;
400 
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);
406  }
407  }
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 261 of file class.ilObjMediaCast.php.

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

261  : bool
262  {
263  $ilDB = $this->db;
264 
265  if (!parent::update()) {
266  return false;
267  }
268 
269  $this->updateMetaData();
270 
271  // update media cast data
272  $query = "UPDATE il_media_cast_data SET " .
273  " is_online = " . $ilDB->quote((int) $this->getOnline(), "integer") .
274  ", public_files = " . $ilDB->quote((int) $this->getPublicFiles(), "integer") .
275  ", downloadable = " . $ilDB->quote((int) $this->getDownloadable(), "integer") .
276  ", def_access = " . $ilDB->quote($this->getDefaultAccess(), "integer") .
277  ", sortmode = " . $ilDB->quote($this->getOrder(), "integer") .
278  ", viewmode = " . $ilDB->quote($this->getViewMode(), "text") .
279  ", autoplaymode = " . $ilDB->quote($this->getAutoplayMode(), "integer") .
280  ", nr_initial_videos = " . $ilDB->quote($this->getNumberInitialVideos(), "integer") .
281  ", new_items_in_lp = " . $ilDB->quote($this->getNewItemsInLearningProgress(), "integer") .
282  " WHERE id = " . $ilDB->quote($this->getId(), "integer");
283 
284  $ilDB->manipulate($query);
285 
286  $this->notes->domain()->activateComments($this->getId(), $this->getComments());
287 
288  return true;
289  }
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

◆ AUTOPLAY_INACT

const ilObjMediaCast::AUTOPLAY_INACT = 2

◆ 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

◆ 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: