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


PHP ilUtil::createDirectory方法代码示例

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


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

示例1: unzip

 /**
  * unzip file
  *
  * @param	string	$a_file		full path/filename
  * @param	boolean	$overwrite	pass true to overwrite existing files
  */
 function unzip($a_file, $overwrite = false)
 {
     //global $ilias;
     $pathinfo = pathinfo($a_file);
     $dir = $pathinfo["dirname"];
     $file = $pathinfo["basename"];
     // unzip
     $cdir = getcwd();
     chdir($dir);
     $unzip = $this->ini->readVariable("tools", "unzip");
     $unzipcmd = $unzip . " -Z -1 " . ilUtil::escapeShellArg($file);
     exec($unzipcmd, $arr);
     $zdirs = array();
     foreach ($arr as $line) {
         if (is_int(strpos($line, "/"))) {
             $zdir = substr($line, 0, strrpos($line, "/"));
             $nr = substr_count($zdir, "/");
             //echo $zdir." ".$nr."<br>";
             while ($zdir != "") {
                 $nr = substr_count($zdir, "/");
                 $zdirs[$zdir] = $nr;
                 // collect directories
                 //echo $dir." ".$nr."<br>";
                 $zdir = substr($zdir, 0, strrpos($zdir, "/"));
             }
         }
     }
     asort($zdirs);
     foreach ($zdirs as $zdir => $nr) {
         ilUtil::createDirectory($zdir);
     }
     // real unzip
     if ($overvwrite) {
         $unzipcmd = $unzip . " " . ilUtil::escapeShellArg($file);
     } else {
         $unzipcmd = $unzip . " -o " . ilUtil::escapeShellArg($file);
     }
     exec($unzipcmd);
     chdir($cdir);
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:46,代码来源:class.ilSetup.php

示例2: _createThumbnailDirectory

 /**
  * Create thumbnail directory
  */
 function _createThumbnailDirectory($a_obj_id)
 {
     ilUtil::createDirectory(ilUtil::getWebspaceDir() . "/thumbs");
     ilUtil::createDirectory(ilUtil::getWebspaceDir() . "/thumbs/mm_" . $a_obj_id);
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:8,代码来源:class.ilObjMediaObject.php

示例3: importSave

 function importSave()
 {
     global $_FILES, $rbacsystem;
     global $ilias, $lng;
     // check if file was uploaded
     $source = $_FILES["scormfile"]["tmp_name"];
     if ($source == 'none' || !$source) {
         $ilias->raiseError("No file selected!", $ilias->error_obj->MESSAGE);
     }
     // check create permission
     if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], "sahs")) {
         $ilias->raiseError($lng->txt("no_create_permission"), $ilias->error_obj->WARNING);
     }
     // get_cfg_var("upload_max_filesize"); // get the may filesize form t he php.ini
     switch ($__FILES["scormfile"]["error"]) {
         case UPLOAD_ERR_INI_SIZE:
             $ilias->raiseError($lng->txt("err_max_file_size_exceeds"), $ilias->error_obj->MESSAGE);
             break;
         case UPLOAD_ERR_FORM_SIZE:
             $ilias->raiseError($lng->txt("err_max_file_size_exceeds"), $ilias->error_obj->MESSAGE);
             break;
         case UPLOAD_ERR_PARTIAL:
             $ilias->raiseError($lng->txt("err_partial_file_upload"), $ilias->error_obj->MESSAGE);
             break;
         case UPLOAD_ERR_NO_FILE:
             $ilias->raiseError($lng->txt("err_no_file_uploaded"), $ilias->error_obj->MESSAGE);
             break;
     }
     $file = pathinfo($_FILES["scormfile"]["name"]);
     $name = substr($file["basename"], 0, strlen($file["basename"]) - strlen($file["extension"]) - 1);
     $file_path = $this->slm_object->getDataDirectory() . "/" . $this->node_object->getId() . "/" . $_FILES["scormfile"]["name"];
     ilUtil::createDirectory($this->slm_object->getDataDirectory() . "/" . $this->node_object->getId());
     ilUtil::moveUploadedFile($_FILES["scormfile"]["tmp_name"], $_FILES["scormfile"]["name"], $file_path);
     ilUtil::unzip($file_path);
     ilUtil::renameExecutables($this->slm_object->getDataDirectory() . "/" . $this->node_object->getId());
     include_once "./Modules/Scorm2004/classes/ilSCORM13Package.php";
     $newPack = new ilSCORM13Package();
     $newPack->il_importSco($this->slm_object->getId(), $this->node_object->getId(), $this->slm_object->getDataDirectory() . "/" . $this->node_object->getId());
     $this->ctrl->redirect($this, "showOrganization");
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:40,代码来源:class.ilSCORM2004ScoGUI.php

示例4: updateSocialBookmarkObject

 function updateSocialBookmarkObject()
 {
     global $ilAccess, $rbacreview, $lng, $ilCtrl;
     if (!$ilAccess->checkAccess("write", "", $this->object->getRefId())) {
         $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
     }
     include_once './Services/Administration/classes/class.ilSocialBookmarks.php';
     $form = ilSocialBookmarks::_initForm($this, 'update');
     if ($form->checkInput()) {
         $title = $form->getInput('title');
         $link = $form->getInput('link');
         $file = $form->getInput('image_file');
         $active = $form->getInput('activate');
         $id = $form->getInput('sbm_id');
         if (!$file['name']) {
             ilSocialBookmarks::_updateSocialBookmark($id, $title, $link, $active);
         } else {
             $extension = pathinfo($file['name'], PATHINFO_EXTENSION);
             $icon_path = ilUtil::getWebspaceDir() . DIRECTORY_SEPARATOR . 'social_bm_icons' . DIRECTORY_SEPARATOR . time() . '.' . $extension;
             $path = ilUtil::getWebspaceDir() . DIRECTORY_SEPARATOR . 'social_bm_icons';
             if (!is_dir($path)) {
                 ilUtil::createDirectory($path);
             }
             ilSocialBookmarks::_deleteImage($id);
             ilSocialBookmarks::_updateSocialBookmark($id, $title, $link, $active, $icon_path);
             ilUtil::moveUploadedFile($file['tmp_name'], $file['name'], $icon_path);
         }
         $this->editSocialBookmarksObject();
     } else {
         $this->__initSubTabs("editSocialBookmarks");
         $form->setValuesByPost();
         $this->tpl->setVariable('ADM_CONTENT', $form->getHTML());
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:34,代码来源:class.ilObjExternalToolsSettingsGUI.php

示例5: createWorkDirectory

 /**
  * create work directory for image map editing
  */
 function createWorkDirectory()
 {
     if (!@is_dir(ilUtil::getDataDir() . "/map_workfiles")) {
         ilUtil::createDirectory(ilUtil::getDataDir() . "/map_workfiles");
     }
     $work_dir = $this->getWorkDirectory();
     if (!@is_dir($work_dir)) {
         ilUtil::createDirectory($work_dir);
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:13,代码来源:class.ilMediaItem.php

示例6: ilTempnam

 /**
  * Create a temporary file in an ILIAS writable directory
  *
  * @return	string File name of the temporary file
  * @static
  * 
  */
 public static function ilTempnam()
 {
     $temp_path = ilUtil::getDataDir() . "/temp";
     if (!is_dir($temp_path)) {
         ilUtil::createDirectory($temp_path);
     }
     $temp_name = tempnam($temp_path, "tmp");
     // --->
     // added the following line because tempnam creates a backslash on some
     // Windows systems which leads to problems, because the "...\tmp..." can be
     // interpreted as "...{TAB-CHARACTER}...". The normal slash works fine
     // even under windows (Helmut Schottmüller, 2005-08-31)
     $temp_name = str_replace("\\", "/", $temp_name);
     // --->
     unlink($temp_name);
     return $temp_name;
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:24,代码来源:class.ilUtil.php

示例7: _importCategories

 /**
  * import categories (static, also called by RootFolderGUI)
  */
 function _importCategories($a_ref_id, $withrol_tmp)
 {
     global $lng;
     require_once "./Modules/Category/classes/class.ilCategoryImportParser.php";
     $import_dir = ilObjCategoryGUI::_getImportDir();
     // create user import directory if necessary
     if (!@is_dir($import_dir)) {
         ilUtil::createDirectory($import_dir);
     }
     // move uploaded file to user import directory
     $file_name = $_FILES["importFile"]["name"];
     // added to prevent empty file names
     if (!strcmp($file_name, "")) {
         ilUtil::sendFailure($lng->txt("no_import_file_found"), true);
         $this->ctrl->redirect($this);
     }
     $parts = pathinfo($file_name);
     $full_path = $import_dir . "/" . $file_name;
     //move_uploaded_file($_FILES["importFile"]["tmp_name"], $full_path);
     ilUtil::moveUploadedFile($_FILES["importFile"]["tmp_name"], $file_name, $full_path);
     // unzip file
     ilUtil::unzip($full_path);
     $subdir = basename($parts["basename"], "." . $parts["extension"]);
     $xml_file = $import_dir . "/" . $subdir . "/" . $subdir . ".xml";
     // CategoryImportParser
     //var_dump($_POST);
     $importParser = new ilCategoryImportParser($xml_file, $a_ref_id, $withrol_tmp);
     $importParser->startParsing();
     ilUtil::sendSuccess($lng->txt("categories_imported"), true);
     $this->ctrl->redirect($this);
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:34,代码来源:class.ilObjCategoryGUI.php

示例8: keepFileUpload

 /**
  * Import upload into temp directory
  * 
  * @param string $a_hash unique form hash
  * @param string $a_field form field
  * @param string $a_tmp_name temp file name
  * @param string $a_name original file name
  * @param string $a_type file mime type
  * @param mixed $a_index form field index (if array)
  * @param mixed $a_sub_index form field subindex (if array)
  * @return bool 
  */
 protected function keepFileUpload($a_hash, $a_field, $a_tmp_name, $a_name, $a_type, $a_index = null, $a_sub_index = null)
 {
     global $ilUser;
     $user_id = $ilUser->getId();
     if (!$user_id || $user_id == ANONYMOUS_USER_ID) {
         return;
     }
     $a_name = ilUtil::getAsciiFileName($a_name);
     $tmp_file_name = implode("~~", array($user_id, $a_hash, $a_field, $a_index, $a_sub_index, str_replace("/", "~~", $a_type), str_replace("~~", "_", $a_name)));
     // make sure temp directory exists
     $temp_path = ilUtil::getDataDir() . "/temp";
     if (!is_dir($temp_path)) {
         ilUtil::createDirectory($temp_path);
     }
     move_uploaded_file($a_tmp_name, $temp_path . "/" . $tmp_file_name);
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:28,代码来源:class.ilPropertyFormGUI.php

示例9: moveUploadedMediaFile

 /**
  * Move an uploaded media file to an public accessible temp dir to present it
  * 
  * @param string $file File path
  * @param string $name Name of the file
  * @access public
  */
 function moveUploadedMediaFile($file, $name)
 {
     $mediatempdir = CLIENT_WEB_DIR . "/assessment/temp";
     if (!@is_dir($mediatempdir)) {
         ilUtil::createDirectory($mediatempdir);
     }
     $temp_name = tempnam($mediatempdir, $name . "_____");
     $temp_name = str_replace("\\", "/", $temp_name);
     @unlink($temp_name);
     if (!ilUtil::moveUploadedFile($file, $name, $temp_name)) {
         return FALSE;
     } else {
         return $temp_name;
     }
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:22,代码来源:class.assQuestion.php


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