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


PHP ilObjFile::createDirectory方法代码示例

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


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

示例1: newFileItem

 /**
  * insert new file item
  */
 function newFileItem()
 {
     global $lng;
     if ($_FILES["file"]["name"] == "") {
         $_GET["subCmd"] = "-";
         ilUtil::sendFailure($lng->txt("upload_error_file_not_found"));
         return false;
     }
     include_once "./Modules/File/classes/class.ilObjFile.php";
     $fileObj = new ilObjFile();
     $fileObj->setType("file");
     $fileObj->setTitle($_FILES["file"]["name"]);
     $fileObj->setDescription("");
     $fileObj->setFileName($_FILES["file"]["name"]);
     $fileObj->setFileType($_FILES["file"]["type"]);
     $fileObj->setFileSize($_FILES["file"]["size"]);
     $fileObj->setMode("filelist");
     $fileObj->create();
     $fileObj->raiseUploadError(false);
     // upload file to filesystem
     $fileObj->createDirectory();
     $fileObj->getUploadFile($_FILES["file"]["tmp_name"], $_FILES["file"]["name"]);
     $this->file_object =& $fileObj;
     return true;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:28,代码来源:class.ilPCFileItemGUI.php

示例2: setFileContents

 /**
  * update file according to filename and version, does not update history
  * has to be called after (!) file save for new objects, since file storage will be initialised with obj id.
  *
  */
 public function setFileContents()
 {
     global $ilLog;
     #$ilLog->write(__METHOD__.' '.filesize($this->tmpFilename));
     if (filesize($this->tmpFilename) == 0) {
         return;
     }
     $filedir = $this->file->getDirectory($this->file->getVersion());
     #$ilLog->write(__METHOD__.' '.$filedir);
     if (!is_dir($filedir)) {
         $this->file->createDirectory();
         ilUtil::makeDir($filedir);
     }
     $filename = $filedir . "/" . $this->file->getFileName();
     if (file_exists($filename)) {
         unlink($filename);
     }
     //echo "-".$this->tmpFilename."-".$filename."-"; exit;
     return rename($this->tmpFilename, $filename);
     // @file_put_contents($filename, $this->content);
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:26,代码来源:class.ilFileXMLParser.php

示例3: saveFileLink

 /**
  * Save file link
  */
 function saveFileLink()
 {
     $mtpl =& new ilTemplate("tpl.link_help.html", true, true, "Modules/LearningModule");
     $mtpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
     if ($_FILES["link_file"]["name"] != "") {
         include_once "./Modules/File/classes/class.ilObjFile.php";
         $fileObj = new ilObjFile();
         $fileObj->setType("file");
         $fileObj->setTitle($_FILES["link_file"]["name"]);
         $fileObj->setDescription("");
         $fileObj->setFileName($_FILES["link_file"]["name"]);
         $fileObj->setFileType($_FILES["link_file"]["type"]);
         $fileObj->setFileSize($_FILES["link_file"]["size"]);
         $fileObj->setMode("filelist");
         $fileObj->create();
         // upload file to filesystem
         $fileObj->createDirectory();
         $fileObj->raiseUploadError(false);
         $fileObj->getUploadFile($_FILES["link_file"]["tmp_name"], $_FILES["link_file"]["name"]);
         $this->uploaded_file = $fileObj;
     }
     $this->showLinkHelp();
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:26,代码来源:class.ilInternalLinkGUI.php

示例4: generateFiles

 /**
  * Generate files
  *
  * @param
  * @return
  */
 function generateFiles($a_test_file, $a_files_per_course = 10, $a_title_base = "File")
 {
     global $tree;
     include_once "./Modules/File/classes/class.ilObjFile.php";
     $this->log("Creating Files");
     $a_current = $a_start;
     // get all categories and sort them by depth
     $crs_ref_ids = ilUtil::_getObjectsByOperations("crs", "read", 0, $limit = 1000000);
     $cnt = 1;
     foreach ($crs_ref_ids as $rid) {
         for ($i = 1; $i <= $a_files_per_course; $i++) {
             $this->log($a_title_base . " " . $cnt);
             $fileObj = new ilObjFile();
             $fileObj->setTitle($a_title_base . " " . $cnt);
             $fileObj->setFileName("file_" . $cnt . ".txt");
             $fileObj->create();
             $fileObj->createReference();
             $fileObj->putInTree($rid);
             $fileObj->setPermissions($rid);
             $fileObj->createDirectory();
             $fileObj->getUploadFile($a_test_file, "file_" . $cnt . ".txt");
             $cnt++;
         }
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:31,代码来源:class.ilDataLoader.php

示例5: handleFileUpload

 public function handleFileUpload()
 {
     global $tree;
     include_once './Modules/Session/classes/class.ilEventItems.php';
     $ev = new ilEventItems($this->object->getId());
     $items = $ev->getItems();
     $counter = 0;
     while (true) {
         if (!isset($_FILES['files']['name'][$counter])) {
             break;
         }
         if (!strlen($_FILES['files']['name'][$counter])) {
             $counter++;
             continue;
         }
         include_once './Modules/File/classes/class.ilObjFile.php';
         $file = new ilObjFile();
         $file->setTitle(ilUtil::stripSlashes($_FILES['files']['name'][$counter]));
         $file->setDescription('');
         $file->setFileName(ilUtil::stripSlashes($_FILES['files']['name'][$counter]));
         $file->setFileType($_FILES['files']['type'][$counter]);
         $file->setFileSize($_FILES['files']['size'][$counter]);
         $file->create();
         $new_ref_id = $file->createReference();
         $file->putInTree($tree->getParentId($this->object->getRefId()));
         $file->setPermissions($tree->getParentId($this->object->getRefId()));
         $file->createDirectory();
         $file->getUploadFile($_FILES['files']['tmp_name'][$counter], $_FILES['files']['name'][$counter]);
         $items[] = $new_ref_id;
         $counter++;
     }
     $ev->setItems($items);
     $ev->update();
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:34,代码来源:class.ilObjSessionGUI.php

示例6: dbImportSco

 public function dbImportSco($slm, $sco, $asset = false)
 {
     $qtis = array();
     $d = ilUtil::getDir($this->packageFolder);
     foreach ($d as $f) {
         //continue;
         if ($f[type] == 'file' && substr($f[entry], 0, 4) == 'qti_') {
             include_once "./Services/QTI/classes/class.ilQTIParser.php";
             include_once "./Modules/Test/classes/class.ilObjTest.php";
             $qtiParser = new ilQTIParser($this->packageFolder . "/" . $f[entry], IL_MO_VERIFY_QTI, 0, "");
             $result = $qtiParser->startParsing();
             $founditems =& $qtiParser->getFoundItems();
             //					die(print_r($founditems));
             foreach ($founditems as $qp) {
                 $newObj = new ilObjTest(0, true);
                 // This creates a lot of invalid repository objects for each question
                 // question are not repository objects (see e.g. table object_data), alex 29 Sep 2009
                 //					$newObj->setType ( $qp ['type'] );
                 //					$newObj->setTitle ( $qp ['title'] );
                 //					$newObj->create ( true );
                 //					$newObj->createReference ();
                 //					$newObj->putInTree ($_GET ["ref_id"]);
                 //					$newObj->setPermissions ( $sco->getId ());
                 //					$newObj->notify ("new", $_GET["ref_id"], $sco->getId (), $_GET["ref_id"], $newObj->getRefId () );
                 //					$newObj->mark_schema->flush ();
                 $qtiParser = new ilQTIParser($this->packageFolder . "/" . $f[entry], IL_MO_PARSE_QTI, 0, "");
                 $qtiParser->setTestObject($newObj);
                 $result = $qtiParser->startParsing();
                 //					$newObj->saveToDb ();
                 $qtis = array_merge($qtis, $qtiParser->getImportMapping());
             }
         }
     }
     //exit;
     include_once 'Modules/Scorm2004/classes/class.ilSCORM2004Page.php';
     $doc = new SimpleXMLElement($this->imsmanifest->saveXml());
     $l = $doc->xpath("/ContentObject/MetaData");
     if ($l[0]) {
         include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
         $mdxml =& new ilMDXMLCopier($l[0]->asXML(), $slm->getId(), $sco->getId(), $sco->getType());
         $mdxml->startParsing();
         $mdxml->getMDObject()->update();
     }
     $l = $doc->xpath("/ContentObject/PageObject");
     foreach ($l as $page_xml) {
         $tnode = $page_xml->xpath('MetaData/General/Title');
         $page = new ilSCORM2004PageNode($slm);
         $page->setTitle($tnode[0]);
         $page->setSLMId($slm->getId());
         $page->create(true);
         ilSCORM2004Node::putInTree($page, $sco->getId(), $target);
         $pmd = $page_xml->xpath("MetaData");
         if ($pmd[0]) {
             include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
             $mdxml =& new ilMDXMLCopier($pmd[0]->asXML(), $slm->getId(), $page->getId(), $page->getType());
             $mdxml->startParsing();
             $mdxml->getMDObject()->update();
         }
         $tnode = $page_xml->xpath("//MediaObject/MediaAlias | //InteractiveImage/MediaAlias");
         foreach ($tnode as $ttnode) {
             include_once './Services/MediaObjects/classes/class.ilObjMediaObject.php';
             $OriginId = $ttnode[OriginId];
             $medianodes = $doc->xpath("//MediaObject[MetaData/General/Identifier/@Entry='" . $OriginId . "']");
             $medianode = $medianodes[0];
             if ($medianode) {
                 $media_object = new ilObjMediaObject();
                 $media_object->setTitle($medianode->MetaData->General->Title);
                 $media_object->setDescription($medianode->MetaData->General->Description);
                 $media_object->create(false);
                 $mmd = $medianode->xpath("MetaData");
                 if ($mmd[0]) {
                     include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
                     $mdxml =& new ilMDXMLCopier($mmd[0]->asXML(), 0, $media_object->getId(), $media_object->getType());
                     $mdxml->startParsing();
                     $mdxml->getMDObject()->update();
                 }
                 // determine and create mob directory, move uploaded file to directory
                 $media_object->createDirectory();
                 $mob_dir = ilObjMediaObject::_getDirectory($media_object->getId());
                 foreach ($medianode->MediaItem as $xMediaItem) {
                     $media_item =& new ilMediaItem();
                     $media_object->addMediaItem($media_item);
                     $media_item->setPurpose($xMediaItem[Purpose]);
                     $media_item->setFormat($xMediaItem->Format);
                     $media_item->setLocation($xMediaItem->Location);
                     $media_item->setLocationType($xMediaItem->Location[Type]);
                     $media_item->setWidth($xMediaItem->Layout[Width]);
                     $media_item->setHeight($xMediaItem->Layout[Height]);
                     $media_item->setHAlign($xMediaItem->Layout[HorizontalAlign]);
                     $media_item->setCaption($xMediaItem->Caption);
                     $media_item->setTextRepresentation($xMediaItem->TextRepresentation);
                     $nr = 0;
                     // add map areas (external links only)
                     foreach ($xMediaItem->MapArea as $n => $v) {
                         if ($v->ExtLink[Href] != "") {
                             include_once "./Services/MediaObjects/classes/class.ilMapArea.php";
                             $ma = new ilMapArea();
                             $map_area = new ilMapArea();
                             $map_area->setShape($v[Shape]);
                             $map_area->setCoords($v[Coords]);
//.........这里部分代码省略.........
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:101,代码来源:ilSCORM13Package.php

示例7: createFile

 /**
  * Creates and inserts file object into tree
  *
  * @author Jan Hippchen
  * @version 1.6.9.07	
  * @param string $filename Name of the object
  * @param string $path Path to file 
  * @param integer $ref_id ref_id of parent
  */
 function createFile($filename, $path, $ref_id, $tree = null, $access_handler = null)
 {
     global $rbacsystem;
     if (!$access_handler) {
         $permission = $rbacsystem->checkAccess("create", $ref_id, "file");
     } else {
         $permission = $access_handler->checkAccess("create", "", $ref_id, "file");
     }
     if ($permission) {
         // create and insert file in grp_tree
         include_once "./Modules/File/classes/class.ilObjFile.php";
         $fileObj = new ilObjFile();
         $fileObj->setType($this->type);
         $fileObj->setTitle(ilFileUtils::utf8_encode(ilUtil::stripSlashes($filename)));
         $fileObj->setFileName(ilFileUtils::utf8_encode(ilUtil::stripSlashes($filename)));
         // better use this, mime_content_type is deprecated
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         $fileObj->setFileType(ilObjMediaObject::getMimeType($path . "/" . $filename));
         $fileObj->setFileSize(filesize($path . "/" . $filename));
         $fileObj->create();
         // repository
         if (!$access_handler) {
             $fileObj->createReference();
             $fileObj->putInTree($ref_id);
             $fileObj->setPermissions($ref_id);
             self::$new_files[$ref_id][] = $fileObj;
         } else {
             $node_id = $tree->insertObject($ref_id, $fileObj->getId());
             $access_handler->setPermissions($ref_id, $node_id);
         }
         // upload file to filesystem
         $fileObj->createDirectory();
         $fileObj->storeUnzipedFile($path . "/" . $filename, ilFileUtils::utf8_encode(ilUtil::stripSlashes($filename)));
     } else {
         $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:46,代码来源:class.ilFileUtils.php


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