本文整理汇总了PHP中ilObjFile::_lookupFileSize方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjFile::_lookupFileSize方法的具体用法?PHP ilObjFile::_lookupFileSize怎么用?PHP ilObjFile::_lookupFileSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjFile
的用法示例。
在下文中一共展示了ilObjFile::_lookupFileSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addFileSizes
function addFileSizes()
{
$xpc = xpath_new_context($this->dom);
$path = "//FileItem";
$res =& xpath_eval($xpc, $path);
for ($i = 0; $i < count($res->nodeset); $i++) {
$cnode =& $res->nodeset[$i];
$size_node =& $this->dom->create_element("Size");
$size_node =& $cnode->append_child($size_node);
$childs =& $cnode->child_nodes();
$size = "";
for ($j = 0; $j < count($childs); $j++) {
if ($childs[$j]->node_name() == "Identifier") {
if ($childs[$j]->has_attribute("Entry")) {
$entry = $childs[$j]->get_attribute("Entry");
$entry_arr = explode("_", $entry);
$id = $entry_arr[count($entry_arr) - 1];
require_once "./Modules/File/classes/class.ilObjFile.php";
$size = ilObjFile::_lookupFileSize($id);
}
}
}
$size_node->set_content($size);
}
unset($xpc);
}
示例2: infoScreenForward
/**
* show information screen
*/
function infoScreenForward()
{
global $ilTabs, $ilErr;
$ilTabs->activateTab("id_info");
if (!$this->checkPermissionBool("visible")) {
$ilErr->raiseError($this->lng->txt("msg_no_perm_read"));
}
include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
$info = new ilInfoScreenGUI($this);
if ($this->checkPermissionBool("read", "sendfile")) {
// 9876
$this->lng->loadLanguageModule("file");
$info->addButton($this->lng->txt("file_download"), $this->ctrl->getLinkTarget($this, "sendfile"));
}
$info->enablePrivateNotes();
if ($this->checkPermissionBool("read")) {
$info->enableNews();
}
// no news editing for files, just notifications
$info->enableNewsEditing(false);
if ($this->checkPermissionBool("write")) {
$news_set = new ilSetting("news");
$enable_internal_rss = $news_set->get("enable_rss_for_internal");
if ($enable_internal_rss) {
$info->setBlockProperty("news", "settings", true);
$info->setBlockProperty("news", "public_notifications_option", true);
}
}
// standard meta data
$info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
$info->addSection($this->lng->txt("file_info"));
$info->addProperty($this->lng->txt("filename"), $this->object->getFileName());
// BEGIN WebDAV Guess file type.
$info->addProperty($this->lng->txt("type"), $this->object->guessFileType());
// END WebDAV Guess file type.
$info->addProperty($this->lng->txt("size"), ilFormat::formatSize(ilObjFile::_lookupFileSize($this->object->getId()), 'long'));
$info->addProperty($this->lng->txt("version"), $this->object->getVersion());
include_once "./Services/History/classes/class.ilHistory.php";
$uploader = ilHistory::_getEntriesForObject($this->object->getId(), $this->object->getType());
$uploader = array_shift($uploader);
$uploader = $uploader["user_id"];
$this->lng->loadLanguageModule("file");
include_once "Services/User/classes/class.ilUserUtil.php";
$info->addProperty($this->lng->txt("file_uploaded_by"), ilUserUtil::getNamePresentation($uploader));
if ($this->id_type == self::WORKSPACE_NODE_ID) {
$info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
}
// forward the command
// $this->ctrl->setCmd("showSummary");
// $this->ctrl->setCmdClass("ilinfoscreengui");
$this->ctrl->forwardCommand($info);
}
示例3: infoScreenForward
/**
* show information screen
*/
function infoScreenForward()
{
global $ilTabs, $ilErr, $ilToolbar;
$ilTabs->activateTab("id_info");
if (!$this->checkPermissionBool("visible")) {
$ilErr->raiseError($this->lng->txt("msg_no_perm_read"));
}
include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
$info = new ilInfoScreenGUI($this);
if ($this->checkPermissionBool("read", "sendfile")) {
// #9876
$this->lng->loadLanguageModule("file");
// #14378
include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
$button = ilLinkButton::getInstance();
$button->setCaption("file_download");
$button->setPrimary(true);
// get permanent download link for repository
if ($this->id_type == self::REPOSITORY_NODE_ID) {
$button->setUrl(ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
} else {
$button->setUrl($this->ctrl->getLinkTarget($this, "sendfile"));
}
$ilToolbar->addButtonInstance($button);
}
$info->enablePrivateNotes();
if ($this->checkPermissionBool("read")) {
$info->enableNews();
}
// no news editing for files, just notifications
$info->enableNewsEditing(false);
if ($this->checkPermissionBool("write")) {
$news_set = new ilSetting("news");
$enable_internal_rss = $news_set->get("enable_rss_for_internal");
if ($enable_internal_rss) {
$info->setBlockProperty("news", "settings", true);
$info->setBlockProperty("news", "public_notifications_option", true);
}
}
// standard meta data
$info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
$info->addSection($this->lng->txt("file_info"));
$info->addProperty($this->lng->txt("filename"), $this->object->getFileName());
// BEGIN WebDAV Guess file type.
$info->addProperty($this->lng->txt("type"), $this->object->guessFileType());
// END WebDAV Guess file type.
$info->addProperty($this->lng->txt("size"), ilFormat::formatSize(ilObjFile::_lookupFileSize($this->object->getId()), 'long'));
$info->addProperty($this->lng->txt("version"), $this->object->getVersion());
// using getVersions function instead of ilHistory direct
$uploader = $this->object->getVersions();
$uploader = array_shift($uploader);
$uploader = $uploader["user_id"];
$this->lng->loadLanguageModule("file");
include_once "Services/User/classes/class.ilUserUtil.php";
$info->addProperty($this->lng->txt("file_uploaded_by"), ilUserUtil::getNamePresentation($uploader));
// download link added in repository
if ($this->id_type == self::REPOSITORY_NODE_ID && $this->checkPermissionBool("read", "sendfile")) {
$tpl = new ilTemplate("tpl.download_link.html", true, true, "Modules/File");
$tpl->setVariable("LINK", ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
$info->addProperty($this->lng->txt("download_link"), $tpl->get());
}
if ($this->id_type == self::WORKSPACE_NODE_ID) {
$info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
}
// display previews
include_once "./Services/Preview/classes/class.ilPreview.php";
if (!$this->ctrl->isAsynch() && ilPreview::hasPreview($this->object->getId(), $this->object->getType()) && $this->checkPermissionBool("read")) {
include_once "./Services/Preview/classes/class.ilPreviewGUI.php";
// get context for access checks later on
$context;
switch ($this->id_type) {
case self::WORKSPACE_NODE_ID:
case self::WORKSPACE_OBJECT_ID:
$context = ilPreviewGUI::CONTEXT_WORKSPACE;
break;
default:
$context = ilPreviewGUI::CONTEXT_REPOSITORY;
break;
}
$preview = new ilPreviewGUI($this->node_id, $context, $this->object->getId(), $this->access_handler);
$info->addProperty($this->lng->txt("preview"), $preview->getInlineHTML());
}
// forward the command
// $this->ctrl->setCmd("showSummary");
// $this->ctrl->setCmdClass("ilinfoscreengui");
$this->ctrl->forwardCommand($info);
}
示例4: getContentLength
/**
* Returns the number of bytes of the content.
* @return int.
*/
function getContentLength()
{
return ilObjFile::_lookupFileSize($this->obj->getId());
}