本文整理汇总了PHP中ilObjFile::getMode方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjFile::getMode方法的具体用法?PHP ilObjFile::getMode怎么用?PHP ilObjFile::getMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjFile
的用法示例。
在下文中一共展示了ilObjFile::getMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
}
}
}
示例2: 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;
}
}