本文整理汇总了PHP中ilObjMediaObject::getParentObjectIdForUsage方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjMediaObject::getParentObjectIdForUsage方法的具体用法?PHP ilObjMediaObject::getParentObjectIdForUsage怎么用?PHP ilObjMediaObject::getParentObjectIdForUsage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjMediaObject
的用法示例。
在下文中一共展示了ilObjMediaObject::getParentObjectIdForUsage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例3: checkAccessMob
/**
* Check access to media object
*
* @param
* @return
*/
function checkAccessMob($obj_id)
{
$usages = ilObjMediaObject::lookupUsages($obj_id);
foreach ($usages as $usage) {
$oid = ilObjMediaObject::getParentObjectIdForUsage($usage, true);
// for content snippets we must get their usages and check them
if ($usage["type"] == "mep:pg") {
include_once "./Modules/MediaPool/classes/class.ilMediaPoolPage.php";
$usages2 = ilMediaPoolPage::lookupUsages($usage["id"]);
foreach ($usages2 as $usage2) {
$oid2 = ilObjMediaObject::getParentObjectIdForUsage($usage2, true);
if ($this->checkAccessMobUsage($usage2, $oid2)) {
return true;
}
}
} else {
if ($this->checkAccessMobUsage($usage, $oid)) {
return true;
}
}
}
return false;
}
示例4: fillRow
/**
* Standard Version of Fill Row. Most likely to
* be overwritten by derived class.
*/
protected function fillRow($a_set)
{
global $lng, $ilCtrl, $ilAccess;
$usage = $a_set;
//var_dump($usage);
if (is_int(strpos($usage["type"], ":"))) {
$us_arr = explode(":", $usage["type"]);
$usage["type"] = $us_arr[1];
$cont_type = $us_arr[0];
}
include_once './Services/Link/classes/class.ilLink.php';
switch ($usage["type"]) {
case "pg":
include_once "./Services/COPage/classes/class.ilPageObjectFactory.php";
$page_obj = ilPageObjectFactory::getInstance($cont_type, $usage["id"]);
$item = array();
//$this->tpl->setVariable("TXT_OBJECT", $usage["type"].":".$usage["id"]);
switch ($cont_type) {
case "lm":
require_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
require_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php";
require_once "./Modules/LearningModule/classes/class.ilLMObject.php";
if (ilObject::_lookupType($page_obj->getParentId()) == "lm") {
$lm_obj =& new ilObjLearningModule($page_obj->getParentId(), false);
$item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
$item["obj_title"] = $lm_obj->getTitle();
$item["sub_txt"] = $this->lng->txt("pg");
$item["sub_title"] = ilLMObject::_lookupTitle($page_obj->getId());
$ref_id = $this->getFirstWritableRefId($lm_obj->getId());
if ($ref_id > 0) {
$item["obj_link"] = ilLink::_getStaticLink($page_obj->getId() . "_" . $ref_id, "pg");
}
}
break;
case "dbk":
require_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
require_once "./Modules/LearningModule/classes/class.ilLMObject.php";
require_once "./Modules/LearningModule/classes/class.ilObjDlBook.php";
if (ilObject::_lookupType($page_obj->getParentId()) == "dbk") {
$lm_obj =& new ilObjDlBook($page_obj->getParentId(), false);
$item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
$item["obj_title"] = $lm_obj->getTitle();
$item["sub_txt"] = $this->lng->txt("pg");
$item["sub_title"] = ilLMObject::_lookupTitle($page_obj->getId());
$ref_id = $this->getFirstWritableRefId($lm_obj->getId());
if ($ref_id > 0) {
$item["obj_link"] = ilLink::_getStaticLink($page_obj->getId() . "_" . $ref_id, "pg");
}
}
break;
case "wpg":
require_once "./Modules/Wiki/classes/class.ilWikiPage.php";
$item["obj_type_txt"] = $this->lng->txt("obj_wiki");
$item["obj_title"] = ilObject::_lookupTitle($page_obj->getParentId());
$item["sub_txt"] = $this->lng->txt("pg");
$item["sub_title"] = ilWikiPage::lookupTitle($page_obj->getId());
$ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
if ($ref_id > 0) {
$item["obj_link"] = ilLink::_getStaticLink($ref_id, "wiki");
}
break;
case "gdf":
require_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
require_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
$term_id = ilGlossaryDefinition::_lookupTermId($page_obj->getId());
$glo_id = ilGlossaryTerm::_lookGlossaryId($term_id);
$item["obj_type_txt"] = $this->lng->txt("obj_glo");
$item["obj_title"] = ilObject::_lookupTitle($glo_id);
$item["sub_txt"] = $this->lng->txt("cont_term");
$item["sub_title"] = ilGlossaryTerm::_lookGlossaryTerm($term_id);
$ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
if ($ref_id > 0) {
$item["obj_link"] = ilLink::_getStaticLink($ref_id, "glo");
}
break;
case "cont":
$item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
$item["obj_title"] = ilObject::_lookupTitle($page_obj->getId());
$ref_id = $this->getFirstWritableRefId($page_obj->getId());
if ($ref_id > 0) {
$item["obj_link"] = ilLink::_getStaticLink($ref_id, $cont_type);
}
break;
default:
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
$oid = ilObjMediaObject::getParentObjectIdForUsage($a_set);
if ($oid > 0) {
$type = ilObject::_lookupType($oid);
$item["obj_type_txt"] = $this->lng->txt("obj_" . $type);
$item["obj_title"] = ilObject::_lookupTitle($oid);
$ref_id = $this->getFirstWritableRefId($oid);
if ($ref_id > 0) {
$item["obj_link"] = ilLink::_getStaticLink($ref_id, $type);
}
}
break;
//.........这里部分代码省略.........
示例5: handleQuotaUpdate
protected static function handleQuotaUpdate(ilObjFile $a_file)
{
include_once "Services/MediaObjects/classes/class.ilObjMediaObject.php";
$mob = new ilObjMediaObject();
// file itself could be workspace item
$parent_obj_ids = array($a_file->getId());
foreach ($a_file->getUsages() as $item) {
$parent_obj_id = $mob->getParentObjectIdForUsage($item);
if ($parent_obj_id && !in_array($parent_obj_id, $parent_obj_ids)) {
$parent_obj_ids[] = $parent_obj_id;
}
}
include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
ilDiskQuotaHandler::handleUpdatedSourceObject($a_file->getType(), $a_file->getId(), $a_file->getDiskUsage(), $parent_obj_ids);
}