本文整理汇总了PHP中ilObjFile::_lookupAbsolutePath方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjFile::_lookupAbsolutePath方法的具体用法?PHP ilObjFile::_lookupAbsolutePath怎么用?PHP ilObjFile::_lookupAbsolutePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjFile
的用法示例。
在下文中一共展示了ilObjFile::_lookupAbsolutePath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recurseFolder
/**
* private functions which iterates through all folders and files
* and create an according file structure in a temporary directory. This function works recursive.
*
* @param integer $refid reference it
* @param tmpdictory $tmpdir
* @return returns first created directory
*/
private static function recurseFolder($refid, $title, $tmpdir)
{
global $rbacsystem, $tree, $ilAccess;
$tmpdir = $tmpdir . DIRECTORY_SEPARATOR . ilUtil::getASCIIFilename($title);
ilUtil::makeDir($tmpdir);
$subtree = $tree->getChildsByTypeFilter($refid, array("fold", "file"));
foreach ($subtree as $child) {
if (!$ilAccess->checkAccess("read", "", $child["ref_id"])) {
continue;
}
if (ilObject::_isInTrash($child["ref_id"])) {
continue;
}
if ($child["type"] == "fold") {
ilObjFolder::recurseFolder($child["ref_id"], $child["title"], $tmpdir);
} else {
$newFilename = $tmpdir . DIRECTORY_SEPARATOR . ilUtil::getASCIIFilename($child["title"]);
// copy to temporal directory
$oldFilename = ilObjFile::_lookupAbsolutePath($child["obj_id"]);
if (!copy($oldFilename, $newFilename)) {
throw new ilFileException("Could not copy " . $oldFilename . " to " . $newFilename);
}
touch($newFilename, filectime($oldFilename));
}
}
}
示例2: copyFile
private static function copyFile($obj_id, $title, $tmpdir)
{
$newFilename = $tmpdir . DIRECTORY_SEPARATOR . ilUtil::getASCIIFilename($title);
// copy to temporary directory
$oldFilename = ilObjFile::_lookupAbsolutePath($obj_id);
if (!copy($oldFilename, $newFilename)) {
throw new ilFileException("Could not copy " . $oldFilename . " to " . $newFilename);
}
touch($newFilename, filectime($oldFilename));
}