当前位置: 首页>>代码示例>>PHP>>正文


PHP ilObjFile::getUsages方法代码示例

本文整理汇总了PHP中ilObjFile::getUsages方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjFile::getUsages方法的具体用法?PHP ilObjFile::getUsages怎么用?PHP ilObjFile::getUsages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ilObjFile的用法示例。


在下文中一共展示了ilObjFile::getUsages方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:101,代码来源:class.ilPageObject.php

示例2: afterPageUpdate

 /**
  * After page has been updated (or created)
  *
  * @param object $a_page page object
  * @param DOMDocument $a_domdoc dom document
  * @param string $a_xml xml
  * @param bool $a_creation true on creation, otherwise false
  */
 static function afterPageUpdate($a_page, DOMDocument $a_domdoc, $a_xml, $a_creation)
 {
     // pc filelist
     include_once "./Modules/File/classes/class.ilObjFile.php";
     $file_ids = ilObjFile::_getFilesOfObject($a_page->getParentType() . ":pg", $a_page->getId(), 0, $a_page->getLanguage());
     self::saveFileUsage($a_page, $a_domdoc);
     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();
                 }
             }
         }
     }
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:26,代码来源:class.ilPCFileList.php

示例3: 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);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:15,代码来源:class.ilObjFile.php


注:本文中的ilObjFile::getUsages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。