本文整理汇总了PHP中ilObjMediaObject::getUsages方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjMediaObject::getUsages方法的具体用法?PHP ilObjMediaObject::getUsages怎么用?PHP ilObjMediaObject::getUsages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjMediaObject
的用法示例。
在下文中一共展示了ilObjMediaObject::getUsages方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleQuotaUpdate
protected static function handleQuotaUpdate(ilObjMediaObject $a_mob)
{
$parent_obj_ids = array();
foreach ($a_mob->getUsages() as $item) {
$parent_obj_id = $a_mob->getParentObjectIdForUsage($item);
if ($parent_obj_id && !in_array($parent_obj_id, $parent_obj_ids)) {
$parent_obj_ids[] = $parent_obj_id;
}
}
// we could suppress this if object is present in a (repository) media pool
// but this would lead to "quota-breaches" when the pool item is deleted
// and "suddenly" all workspace owners get filesize added to their
// respective quotas, regardless of current status
include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
ilDiskQuotaHandler::handleUpdatedSourceObject($a_mob->getType(), $a_mob->getId(), ilUtil::dirSize($a_mob->getDataDirectory()), $parent_obj_ids);
}
示例2: beforePageDelete
/**
* Before page is being deleted
*
* @param object $a_page page object
*/
static function beforePageDelete($a_page)
{
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
$mob_ids = ilObjMediaObject::_getMobsOfObject($a_page->getParentType() . ":pg", $a_page->getId(), 0, $a_page->getLanguage());
ilObjMediaObject::_deleteAllUsages($a_page->getParentType() . ":pg", $a_page->getId(), false, $a_page->getLanguage());
foreach ($mob_ids as $mob) {
if (ilObject::_exists($mob) && ilObject::_lookupType($mob) == "mob") {
$mob_obj = new ilObjMediaObject($mob);
$usages = $mob_obj->getUsages(false);
if (count($usages) == 0) {
$mob_obj->delete();
}
}
}
}
示例3: handleQuotaUpdate
protected static function handleQuotaUpdate(ilObjMediaObject $a_mob)
{
global $ilSetting;
// if neither workspace nor portfolios are activated, we skip
// the quota update here. this due to performance reasons on installations
// that do not use workspace/portfolios, but heavily copy content.
// in extreme cases (media object in pool and personal blog, deactivate workspace, change media object,
// this may lead to incorrect data in the quota calculation)
if ($ilSetting->get("disable_personal_workspace") && !$ilSetting->get('user_portfolios')) {
return;
}
$parent_obj_ids = array();
foreach ($a_mob->getUsages() as $item) {
$parent_obj_id = $a_mob->getParentObjectIdForUsage($item);
if ($parent_obj_id && !in_array($parent_obj_id, $parent_obj_ids)) {
$parent_obj_ids[] = $parent_obj_id;
}
}
// we could suppress this if object is present in a (repository) media pool
// but this would lead to "quota-breaches" when the pool item is deleted
// and "suddenly" all workspace owners get filesize added to their
// respective quotas, regardless of current status
include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
ilDiskQuotaHandler::handleUpdatedSourceObject($a_mob->getType(), $a_mob->getId(), ilUtil::dirSize($a_mob->getDataDirectory()), $parent_obj_ids);
}
示例4: update
//.........这里部分代码省略.........
if ($last_c == "") {
$last_c = ilUtil::now();
}
$ilDB->insert("page_history", array("page_id" => array("integer", $old_rec["page_id"]), "parent_type" => array("text", $old_rec["parent_type"]), "hdate" => array("timestamp", $last_c), "parent_id" => array("integer", $old_rec["parent_id"]), "content" => array("clob", $old_rec["content"]), "user_id" => array("integer", $old_rec["last_change_user"]), "ilias_version" => array("text", ILIAS_VERSION_NUMERIC), "nr" => array("integer", (int) $last_nr["mnr"] + 1)));
/*$h_query = "REPLACE INTO page_history ".
"(page_id, parent_type, hdate, parent_id, content, user_id, ilias_version, nr) VALUES (".
$ilDB->quote($old_rec["page_id"]).",".
$ilDB->quote($old_rec["parent_type"]).",".
$ilDB->quote($old_rec["last_change"]).",".
$ilDB->quote($old_rec["parent_id"]).",".
$ilDB->quote($old_rec["content"]).",".
$ilDB->quote($old_rec["last_change_user"]).",".
$ilDB->quote(ILIAS_VERSION_NUMERIC).",".
$ilDB->quote($last_nr["mnr"] + 1).")";
//echo "<br><br>+$a_no_history+$h_query";
$ilDB->query($h_query);*/
$this->saveMobUsage($old_rec["content"], $last_nr["mnr"] + 1);
$this->saveStyleUsage($old_rec["content"], $last_nr["mnr"] + 1);
$this->saveFileUsage($old_rec["content"], $last_nr["mnr"] + 1);
$this->saveContentIncludeUsage($old_rec["content"], $last_nr["mnr"] + 1);
$this->saveSkillUsage($old_rec["content"], $last_nr["mnr"] + 1);
$this->history_saved = true;
// only save one time
} else {
$this->history_saved = true;
// do not save on first change
}
}
}
//echo htmlentities($content);
$em = trim($content) == "<PageObject/>" ? 1 : 0;
$iel = $this->containsDeactivatedElements($content);
$inl = $this->containsIntLinks($content);
/*$query = "UPDATE page_object ".
"SET content = ".$ilDB->quote($content)." ".
", parent_id= ".$ilDB->quote($this->getParentId())." ".
", last_change_user= ".$ilDB->quote($ilUser->getId())." ".
", last_change = now() ".
", is_empty = ".$ilDB->quote($em, "integer")." ".
", active = ".$ilDB->quote($this->getActive())." ".
", activation_start = ".$ilDB->quote($this->getActivationStart())." ".
", activation_end = ".$ilDB->quote($this->getActivationEnd())." ".
", inactive_elements = ".$ilDB->quote($iel, "integer")." ".
", int_links = ".$ilDB->quote($inl, "integer")." ".
" WHERE page_id = ".$ilDB->quote($this->getId()).
" AND parent_type= ".$ilDB->quote($this->getParentType());*/
$ilDB->update("page_object", array("content" => array("clob", $content), "parent_id" => array("integer", $this->getParentId()), "last_change_user" => array("integer", $ilUser->getId()), "last_change" => array("timestamp", ilUtil::now()), "is_empty" => array("integer", $em), "active" => array("integer", $this->getActive()), "activation_start" => array("timestamp", $this->getActivationStart()), "activation_end" => array("timestamp", $this->getActivationEnd()), "show_activation_info" => array("integer", $this->getShowActivationInfo()), "inactive_elements" => array("integer", $iel), "int_links" => array("integer", $inl)), array("page_id" => array("integer", $this->getId()), "parent_type" => array("text", $this->getParentType())));
// todo put this into update function
/* if(!$this->ilias->db->checkQuerySize($query))
{
$this->ilias->raiseError($lng->txt("check_max_allowed_packet_size"),$this->ilias->error_obj->MESSAGE);
return false;
}*/
// $this->ilias->db->query($query);
if (!$skip_handle_usages) {
// handle media object usage
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
$mob_ids = ilObjMediaObject::_getMobsOfObject($this->getParentType() . ":pg", $this->getId());
$this->saveMobUsage($this->getXMLFromDom());
$this->saveMetaKeywords($this->getXMLFromDom());
foreach ($mob_ids as $mob) {
if (ilObject::_exists($mob) && ilObject::_lookupType($mob) == "mob") {
$mob_obj = new ilObjMediaObject($mob);
$usages = $mob_obj->getUsages(false);
if (count($usages) == 0) {
$mob_obj->delete();
}
}
}
// handle file usages
include_once "./Modules/File/classes/class.ilObjFile.php";
$file_ids = ilObjFile::_getFilesOfObject($this->getParentType() . ":pg", $this->getId());
$this->saveFileUsage();
foreach ($file_ids as $file) {
if (ilObject::_exists($file)) {
$file_obj = new ilObjFile($file, false);
$usages = $file_obj->getUsages();
if (count($usages) == 0) {
if ($file_obj->getMode() == "filelist") {
$file_obj->delete();
}
}
}
}
// save style usage
$this->saveStyleUsage($this->getXMLFromDom());
// save content include usage
$this->saveContentIncludeUsage($this->getXMLFromDom());
$this->saveSkillUsage($this->getXMLFromDom());
}
// save internal link information
$this->saveInternalLinks($this->getXMLFromDom());
$this->saveAnchors($this->getXMLFromDom());
$this->callUpdateListeners();
//echo "<br>PageObject::update:".htmlentities($this->getXMLContent()).":";
return true;
} else {
return $errors;
}
}