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


PHP ilObjMediaObject::_deleteAllUsages方法代码示例

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


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

示例1: saveMobUsage

 /**
  * Save all usages of media objects (media aliases, media objects, internal links)
  *
  * @param	string		$a_xml		xml data of page
  */
 static function saveMobUsage($a_page, $a_domdoc, $a_old_nr = 0)
 {
     $usages = array();
     // media aliases
     $xpath = new DOMXPath($a_domdoc);
     $nodes = $xpath->query('//MediaAlias');
     foreach ($nodes as $node) {
         $id_arr = explode("_", $node->getAttribute("OriginId"));
         $mob_id = $id_arr[count($id_arr) - 1];
         if ($mob_id > 0 && $id_arr[1] == "") {
             $usages[$mob_id] = true;
         }
     }
     // media objects
     $xpath = new DOMXPath($a_domdoc);
     $nodes = $xpath->query('//MediaObject/MetaData/General/Identifier');
     foreach ($nodes as $node) {
         $mob_entry = $node->getAttribute("Entry");
         $mob_arr = explode("_", $mob_entry);
         $mob_id = $mob_arr[count($mob_arr) - 1];
         if ($mob_id > 0 && $mob_arr[1] == "") {
             $usages[$mob_id] = true;
         }
     }
     // internal links
     $xpath = new DOMXPath($a_domdoc);
     $nodes = $xpath->query("//IntLink[@Type='MediaObject']");
     foreach ($nodes as $node) {
         $mob_target = $node->getAttribute("Target");
         $mob_arr = explode("_", $mob_target);
         //echo "<br>3<br>";
         //echo $mob_target."<br>";
         //var_dump($mob_arr);
         $mob_id = $mob_arr[count($mob_arr) - 1];
         if ($mob_id > 0 && $mob_arr[1] == "") {
             $usages[$mob_id] = true;
         }
     }
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     ilObjMediaObject::_deleteAllUsages($a_page->getParentType() . ":pg", $a_page->getId(), $a_old_nr, $a_page->getLanguage());
     foreach ($usages as $mob_id => $val) {
         ilObjMediaObject::_saveUsage($mob_id, $a_page->getParentType() . ":pg", $a_page->getId(), $a_old_nr, $a_page->getLanguage());
     }
     return $usages;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:50,代码来源:class.ilPCMediaObject.php

示例2: delete

 /**
  * delete page object
  */
 function delete()
 {
     global $ilDB;
     $mobs = array();
     $files = array();
     if (!$this->page_not_found) {
         $this->buildDom();
         $mobs = $this->collectMediaObjects(false);
     }
     $this->__beforeDelete();
     // delete style usages
     $this->deleteStyleUsages(false);
     // delete internal links
     $this->deleteInternalLinks();
     // delete all mob usages
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     ilObjMediaObject::_deleteAllUsages($this->getParentType() . ":pg", $this->getId());
     // delete news
     include_once "./Services/News/classes/class.ilNewsItem.php";
     ilNewsItem::deleteNewsOfContext($this->getParentId(), $this->getParentType(), $this->getId(), "pg");
     // delete page_object entry
     $ilDB->manipulate("DELETE FROM page_object " . "WHERE page_id = " . $ilDB->quote($this->getId(), "integer") . " AND parent_type= " . $ilDB->quote($this->getParentType(), "text"));
     //$this->ilias->db->query($query);
     // delete media objects
     foreach ($mobs as $mob_id) {
         if (ilObject::_lookupType($mob_id) != 'mob') {
             $GLOBALS['ilLog']->write(__METHOD__ . ': Type mismatch. Ignoring mob with id: ' . $mob_id);
             continue;
         }
         if (ilObject::_exists($mob_id)) {
             $mob_obj =& new ilObjMediaObject($mob_id);
             $mob_obj->delete();
         }
     }
     /* delete public and private notes (see PageObjectGUI->getNotesHTML())
     		  as they can be seen as personal data we are keeping them for now
     		include_once("Services/Notes/classes/class.ilNote.php");
     		foreach(array(IL_NOTE_PRIVATE, IL_NOTE_PUBLIC) as $note_type)
     		{
     			foreach(ilNote::_getNotesOfObject($this->getParentId(), $this->getId(),
     				$this->getParentType(), $note_type) as $note)
     			{
     				$note->delete();
     			}
     		}
     		*/
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:50,代码来源:class.ilPageObject.php

示例3: saveMobUsage

 /**
  * save all usages of media objects (media aliases, media objects, internal links)
  *
  * @param	string		$a_xml		xml data of page
  */
 function saveMobUsage($a_xml, $a_old_nr = 0)
 {
     $doc = domxml_open_mem($a_xml);
     // media aliases
     $xpc = xpath_new_context($doc);
     $path = "//MediaAlias";
     $res =& xpath_eval($xpc, $path);
     $usages = array();
     for ($i = 0; $i < count($res->nodeset); $i++) {
         $id_arr = explode("_", $res->nodeset[$i]->get_attribute("OriginId"));
         $mob_id = $id_arr[count($id_arr) - 1];
         if ($mob_id > 0) {
             $usages[$mob_id] = true;
         }
     }
     // media objects
     $xpc = xpath_new_context($doc);
     $path = "//MediaObject/MetaData/General/Identifier";
     $res =& xpath_eval($xpc, $path);
     for ($i = 0; $i < count($res->nodeset); $i++) {
         $mob_entry = $res->nodeset[$i]->get_attribute("Entry");
         $mob_arr = explode("_", $mob_entry);
         $mob_id = $mob_arr[count($mob_arr) - 1];
         if ($mob_id > 0) {
             $usages[$mob_id] = true;
         }
     }
     // internal links
     $xpc = xpath_new_context($doc);
     $path = "//IntLink[@Type='MediaObject']";
     $res =& xpath_eval($xpc, $path);
     for ($i = 0; $i < count($res->nodeset); $i++) {
         $mob_target = $res->nodeset[$i]->get_attribute("Target");
         $mob_arr = explode("_", $mob_target);
         $mob_id = $mob_arr[count($mob_arr) - 1];
         if ($mob_id > 0) {
             $usages[$mob_id] = true;
         }
     }
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     ilObjMediaObject::_deleteAllUsages($this->getParentType() . ":pg", $this->getId(), $a_old_nr);
     foreach ($usages as $mob_id => $val) {
         ilObjMediaObject::_saveUsage($mob_id, $this->getParentType() . ":pg", $this->getId(), $a_old_nr);
     }
     return $usages;
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:51,代码来源:class.ilPageObject.php


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