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


PHP ilObjFile::getType方法代码示例

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


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

示例1: start

 function start()
 {
     $this->__buildHeader();
     $attribs = array("obj_id" => "il_" . IL_INST_ID . "_file_" . $this->file->getId(), "version" => $this->file->getVersion(), "size" => $this->file->getFileSize(), "type" => $this->file->getFileType());
     $this->xmlStartTag("File", $attribs);
     $this->xmlElement("Filename", null, $this->file->getFileName());
     $this->xmlElement("Title", null, $this->file->getTitle());
     $this->xmlElement("Description", null, $this->file->getDescription());
     $this->xmlElement("Rating", null, (int) $this->file->hasRating());
     if ($this->attachFileContents) {
         $filename = $this->file->getDirectory($this->file->getVersion()) . "/" . $this->file->getFileName();
         if (@is_file($filename)) {
             if ($this->attachFileContents == ilFileXMLWriter::$CONTENT_ATTACH_COPY) {
                 $attribs = array("mode" => "COPY");
                 copy($filename, $this->target_dir_absolute . "/" . $this->file->getFileName());
                 $content = $this->target_dir_relative . "/" . $this->file->getFileName();
                 $this->xmlElement("Content", $attribs, $content);
             } elseif ($this->attachFileContents == ilFileXMLWriter::$CONTENT_ATTACH_REST) {
                 $attribs = array('mode' => "REST");
                 include_once './Services/WebServices/Rest/classes/class.ilRestFileStorage.php';
                 $fs = new ilRestFileStorage();
                 $tmpname = $fs->storeFileForRest(base64_encode(@file_get_contents($filename)));
                 $this->xmlElement("Content", $attribs, $tmpname);
             } else {
                 $content = @file_get_contents($filename);
                 $attribs = array("mode" => "PLAIN");
                 if ($this->attachFileContents == ilFileXMLWriter::$CONTENT_ATTACH_ZLIB_ENCODED) {
                     $attribs["mode"] = "ZLIB";
                     $content = @gzcompress($content, 9);
                 } elseif ($this->attachFileContents == ilFileXMLWriter::$CONTENT_ATTACH_GZIP_ENCODED) {
                     $attribs["mode"] = "GZIP";
                     $content = @gzencode($content, 9);
                 }
                 $content = base64_encode($content);
                 $this->xmlElement("Content", $attribs, $content);
             }
         }
     }
     include_once "./Services/History/classes/class.ilHistory.php";
     $versions = ilHistory::_getEntriesForObject($this->file->getId(), $this->file->getType());
     if (count($versions)) {
         $this->xmlStartTag("Versions");
         foreach ($versions as $version) {
             $info_params = $version["info_params"];
             list($filename, $history_id) = split(",", $info_params);
             $attribs = array("id" => $history_id, "date" => ilUtil::date_mysql2time($version["date"]), "usr_id" => "il_" . IL_INST_ID . "_usr_" . $version["user_id"]);
             $this->xmlElement("Version", $attribs);
         }
         $this->xmlEndTag("Versions");
     }
     $this->xmlEndTag("File");
     $this->__buildFooter();
     return true;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:54,代码来源:class.ilFileXMLWriter.php

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