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


PHP ilObjFile::setRating方法代码示例

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


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

示例1: handlerEndTag

 /**
  * handler for end of element
  *
  * @param	resource	$a_xml_parser		xml parser
  * @param	string		$a_name				element name
  */
 function handlerEndTag($a_xml_parser, $a_name)
 {
     $this->cdata = trim($this->cdata);
     $GLOBALS['ilLog']->write(__METHOD__ . ': ' . $this->cdata);
     switch ($a_name) {
         case 'File':
             $this->result = true;
             break;
         case 'Filename':
             if (strlen($this->cdata) == 0) {
                 throw new ilFileException("Filename ist missing!");
             }
             $this->file->setFilename($this->cdata);
             $this->file->setTitle($this->cdata);
             break;
         case 'Title':
             $this->file->setTitle(trim($this->cdata));
             break;
         case 'Description':
             $this->file->setDescription(trim($this->cdata));
             break;
         case 'Rating':
             $this->file->setRating((bool) $this->cdata);
             break;
         case 'Content':
             $GLOBALS['ilLog']->write($this->mode);
             $this->isReadingFile = false;
             $baseDecodedFilename = ilUtil::ilTempnam();
             if ($this->mode == ilFileXMLParser::$CONTENT_COPY) {
                 $this->tmpFilename = $this->getImportDirectory() . "/" . $this->cdata;
             } elseif ($this->mode == ilFileXMLParser::$CONTENT_REST) {
                 include_once './Services/WebServices/Rest/classes/class.ilRestFileStorage.php';
                 $storage = new ilRestFileStorage();
                 $this->tmpFilename = $storage->getStoredFilePath($this->cdata);
                 if (!ilFileUtils::fastBase64Decode($this->tmpFilename, $baseDecodedFilename)) {
                     throw new ilFileException("Base64-Decoding failed", ilFileException::$DECOMPRESSION_FAILED);
                 }
                 $this->tmpFilename = $baseDecodedFilename;
             } else {
                 if (!ilFileUtils::fastBase64Decode($this->tmpFilename, $baseDecodedFilename)) {
                     throw new ilFileException("Base64-Decoding failed", ilFileException::$DECOMPRESSION_FAILED);
                 }
                 if ($this->mode == ilFileXMLParser::$CONTENT_GZ_COMPRESSED) {
                     if (!ilFileUtils::fastGunzip($baseDecodedFilename, $this->tmpFilename)) {
                         throw new ilFileException("Deflating with fastzunzip failed", ilFileException::$DECOMPRESSION_FAILED);
                     }
                     unlink($baseDecodedFilename);
                 } elseif ($this->mode == ilFileXMLParser::$CONTENT_ZLIB_COMPRESSED) {
                     if (!ilFileUtils::fastGunzip($baseDecodedFilename, $this->tmpFilename)) {
                         throw new ilFileException("Deflating with fastDecompress failed", ilFileException::$DECOMPRESSION_FAILED);
                     }
                     unlink($baseDecodedFilename);
                 } else {
                     $this->tmpFilename = $baseDecodedFilename;
                 }
             }
             //$this->content = $content;
             $this->file->setFileSize(filesize($this->tmpFilename));
             // strlen($this->content));
             // if no file type is given => lookup mime type
             if (!$this->file->getFileType()) {
                 global $ilLog;
                 #$ilLog->write(__METHOD__.': Trying to detect mime type...');
                 include_once './Services/Utilities/classes/class.ilFileUtils.php';
                 $this->file->setFileType(ilFileUtils::_lookupMimeType($this->tmpFilename));
             }
             break;
     }
     $this->cdata = '';
     return;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:77,代码来源:class.ilFileXMLParser.php


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