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


PHP ilUtil::makeDirParents方法代码示例

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


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

示例1: getXmlRepresentation

 public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
 {
     ilUtil::makeDirParents($this->getAbsoluteExportDirectory());
     $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
     $this->ds->exportLibraryFile($a_id);
     return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, '', true, true);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:7,代码来源:class.ilBibliographicExporter.php

示例2: create

 public function create()
 {
     if (!file_exists($this->getPath())) {
         ilUtil::makeDirParents($this->getPath());
     }
     return true;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:7,代码来源:class.ilAssQuestionProcessLockFileStorage.php

示例3: importXmlRepresentation

 function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
 {
     // see ilStyleExporter::getXmlRepresentation()
     if (preg_match("/<StyleSheetExport><ImagePath>(.+)<\\/ImagePath>/", $a_xml, $hits)) {
         $path = $hits[1];
         $a_xml = str_replace($hits[0], "", $a_xml);
         $a_xml = str_replace("</StyleSheetExport>", "", $a_xml);
     }
     // temp xml-file
     $tmp_file = $this->getImportDirectory() . "/sty_" . $a_id . ".xml";
     file_put_contents($tmp_file, $a_xml);
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $style = new ilObjStyleSheet();
     $style->createFromXMLFile($tmp_file);
     $new_id = $style->getId();
     unlink($tmp_file);
     // images
     if ($path) {
         $source = $this->getImportDirectory() . "/" . $path;
         if (is_dir($source)) {
             $target = $style->getImagesDirectory();
             if (!is_dir($target)) {
                 ilUtil::makeDirParents($target);
             }
             ilUtil::rCopy($source, $target);
         }
     }
     $a_mapping->addMapping("Services/Style", "sty", $a_id, $new_id);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:29,代码来源:class.ilStyleImporter.php

示例4: initDirectory

 private function initDirectory()
 {
     if (is_writable($this->getPath())) {
         if (ilUtil::makeDirParents($this->shop_path)) {
             return true;
         }
     }
     return false;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:9,代码来源:class.ilFileDataShop.php

示例5: getXmlRepresentation

 public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
 {
     include_once "Services/Style/classes/class.ilObjStyleSheet.php";
     $style = new ilObjStyleSheet($a_id, false);
     // images
     $target = $this->getAbsoluteExportDirectory();
     if ($target && !is_dir($target)) {
         ilUtil::makeDirParents($target);
     }
     ilUtil::rCopy($style->getImagesDirectory(), $target);
     return "<StyleSheetExport>" . "<ImagePath>" . $this->getRelativeExportDirectory() . "</ImagePath>" . $style->getXML() . "</StyleSheetExport>";
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:12,代码来源:class.ilStyleExporter.php

示例6: getXmlRepresentation

 /**
  * Get xml representation
  *
  * @param	string		entity
  * @param	string		target release
  * @param	string		id
  * @return	string		xml string
  */
 public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
 {
     $xml = '';
     include_once 'Modules/Forum/classes/class.ilForumXMLWriter.php';
     if (ilObject::_lookupType($a_id) == 'frm') {
         $writer = new ilForumXMLWriter();
         $writer->setForumId($a_id);
         ilUtil::makeDirParents($this->getAbsoluteExportDirectory());
         $writer->setFileTargetDirectories($this->getRelativeExportDirectory(), $this->getAbsoluteExportDirectory());
         $writer->start();
         $xml .= $writer->getXml();
     }
     return $xml;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:22,代码来源:class.ilForumExporter.php

示例7: saveImage

 public function saveImage($data, $filename)
 {
     $image =& base64_decode($data);
     $imagepath = $this->object->getImagePath();
     include_once "./Services/Utilities/classes/class.ilUtil.php";
     if (!file_exists($imagepath)) {
         ilUtil::makeDirParents($imagepath);
     }
     $imagepath .= $filename;
     $fh = fopen($imagepath, "wb");
     if ($fh == false) {
     } else {
         $imagefile = fwrite($fh, $image);
         fclose($fh);
     }
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:16,代码来源:class.assMatchingQuestionImport.php

示例8: getXmlRepresentation

 /**
  * Get xml representation
  *
  * @param	string		entity
  * @param	string		target release
  * @param	string		id
  * @return	string		xml string
  */
 public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
 {
     include_once "./Modules/File/classes/class.ilObjFile.php";
     include_once "./Modules/File/classes/class.ilFileXMLWriter.php";
     if (ilObject::_lookupType($a_id) == "file") {
         $file = new ilObjFile($a_id, false);
         $writer = new ilFileXMLWriter();
         $writer->setFile($file);
         $writer->setOmitHeader(true);
         $writer->setAttachFileContents(ilFileXMLWriter::$CONTENT_ATTACH_COPY);
         ilUtil::makeDirParents($this->getAbsoluteExportDirectory());
         $writer->setFileTargetDirectories($this->getRelativeExportDirectory(), $this->getAbsoluteExportDirectory());
         $writer->start();
         $xml .= $writer->getXml();
     }
     return $xml;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:25,代码来源:class.ilFileExporter.php

示例9: generate

 /**
  * Generate the report for given certificate
  *
  * @param srCertificate $cert
  * @throws ilException
  * @return bool
  */
 public function generate(srCertificate $cert)
 {
     if (!$this->isAvailable()) {
         throw new ilException("Generating certificates with TemplateTypeJasper is only available if the JasperReport service is installed");
     }
     require_once self::JASPER_CLASS;
     $template = $cert->getDefinition()->getType()->getCertificateTemplatesPath(true);
     // A template is required, so quit early if it does not exist for some reason
     if (!is_file($template)) {
         return false;
     }
     $placeholders = $cert->getPlaceholders();
     try {
         $defined_placeholders = $this->parseDefinedPlaceholders($template);
     } catch (Exception $e) {
         // XML is not valid
         return false;
     }
     // Only send defined placeholders to jasper, otherwise the template file is not considered as valid
     $placeholders = array_intersect_key($placeholders, $defined_placeholders);
     $placeholders = $this->nl2br($placeholders);
     $report = new JasperReport($template, $cert->getFilename(false));
     if ($locale = $this->pl->config('jasper_locale')) {
         $report->setLocale($this->pl->config('jasper_locale'));
     }
     if ($java = $this->pl->config('jasper_path_java')) {
         $report->setPathJava($java);
     }
     $report->setDataSource(JasperReport::DATASOURCE_EMPTY);
     $report->setParameters($placeholders);
     try {
         $report->generateOutput();
         $report_file = $report->getOutputFile();
         // Move pdf to correct certificate location
         $cert_path = $cert->getCertificatePath();
         if (!file_exists($cert_path)) {
             ilUtil::makeDirParents($cert_path);
         }
         $from = $report_file . '.pdf';
         $to = $cert->getFilePath();
         return ilUtil::moveUploadedFile($from, '', $to, false, 'rename');
     } catch (JasperReportException $e) {
         $this->log->write("srCertificateTemplyteTypeJasper::generate() Report file of certificate with ID {$cert->getId()} was not created by Jasper: " . implode(', ', $e->getErrors()));
         return false;
     }
 }
开发者ID:studer-raimann,项目名称:Certificate,代码行数:53,代码来源:class.srCertificateTemplateTypeJasper.php

示例10: buildExportFile

 /**
  *
  * @param ilTestExportFilename $filename        	
  */
 protected function buildExportFile(ilTestExportFilename $filename)
 {
     // Creating Files with Charts using PHPExcel
     require_once './Customizing/global/plugins/Modules/Test/Export/TestStatisticsExport/classes/PHPExcel-1.8/Classes/PHPExcel.php';
     $objPHPExcel = new PHPExcel();
     // Create the first sheet with general data about the test
     $objWorksheet = $objPHPExcel->getActiveSheet();
     $this->createFrameSheet1($objWorksheet);
     $this->fillInQuestionDataSheet1($objWorksheet);
     $this->calculateSummarySheet1($objWorksheet);
     // Create the second sheet, with questionspecific data
     //Durch neue Trennschärfeformel überflüssig
     //$this->createProductArray ( $objPHPExcel);
     //Durch neue Trennschärfeformel überflüssig
     //$this->createTrueFalseArrayAndProductArray($objPHPExcel);
     $this->calculateDiscrimationIndex($objPHPExcel);
     // Save XSLX file
     ilUtil::makeDirParents(dirname($filename->getPathname('xlsx', 'statistics')));
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
     $objWriter->setIncludeCharts(TRUE);
     $objWriter->save(str_replace(__FILE__, $filename->getPathname('xlsx', 'statistics'), __FILE__));
 }
开发者ID:kyro46,项目名称:TestStatisticsExport,代码行数:26,代码来源:class.ilTestStatisticsExportPlugin.php

示例11: _checkSetup

 /**
  * Checks if smiley folder is available; if not
  * it will try to create folder and performs
  * actions for an initial smiley set
  *
  * @global ilLanguage $lng
  * @return boolean
  */
 public static function _checkSetup()
 {
     global $lng;
     $path = self::_getSmileyDir();
     if (!is_dir($path)) {
         ilUtil::sendInfo($lng->txt('chatroom_smilies_dir_not_exists'));
         ilUtil::makeDirParents($path);
         if (!is_dir($path)) {
             ilUtil::sendFailure($lng->txt('chatroom_smilies_dir_not_available'));
             return false;
         } else {
             $smilies = array("icon_smile.gif", "icon_wink.gif", "icon_laugh.gif", "icon_sad.gif", "icon_shocked.gif", "icon_tongue.gif", "icon_cool.gif", "icon_eek.gif", "icon_angry.gif", "icon_flush.gif", "icon_idea.gif", "icon_thumbup.gif", "icon_thumbdown.gif");
             foreach ($smilies as $smiley) {
                 copy("templates/default/images/emoticons/{$smiley}", $path . "/{$smiley}");
             }
             self::_insertDefaultValues();
             ilUtil::sendSuccess($lng->txt('chatroom_smilies_initialized'));
         }
     }
     if (!is_writable($path)) {
         ilUtil::sendInfo($lng->txt('chatroom_smilies_dir_not_writable'));
     }
     return true;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:32,代码来源:class.ilChatroomSmilies.php

示例12: init

 /**
  * init function: create import directory, delete old files
  *
  * @access private
  * 
  */
 private function init()
 {
     if (!@is_dir($this->import_dir)) {
         ilUtil::makeDirParents($this->import_dir);
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:12,代码来源:class.ilAdvancedMDRecordImportFiles.php

示例13: getImportDir

 /**
  * get user import directory name
  */
 function getImportDir()
 {
     // For each user session a different directory must be used to prevent
     // that one user session overwrites the import data that another session
     // is currently importing.
     global $ilUser;
     $importDir = ilUtil::getDataDir() . '/user_import/usr_' . $ilUser->getId() . '_' . session_id();
     ilUtil::makeDirParents($importDir);
     return $importDir;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:13,代码来源:class.ilObjUserFolderGUI.php

示例14: suggestedsolution

 /**
  * Allows to add suggested solutions for questions
  *
  * @access public
  */
 public function suggestedsolution()
 {
     global $ilUser;
     global $ilAccess;
     if ($_POST["deleteSuggestedSolution"] == 1) {
         $this->object->deleteSuggestedSolutions();
         ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
         $this->ctrl->redirect($this, "suggestedsolution");
     }
     $save = is_array($_POST["cmd"]) && array_key_exists("suggestedsolution", $_POST["cmd"]) ? TRUE : FALSE;
     $output = "";
     $solution_array = $this->object->getSuggestedSolution(0);
     $options = array("lm" => $this->lng->txt("obj_lm"), "st" => $this->lng->txt("obj_st"), "pg" => $this->lng->txt("obj_pg"), "git" => $this->lng->txt("glossary_term"), "file" => $this->lng->txt("fileDownload"), "text" => $this->lng->txt("solutionText"));
     if (strcmp($_POST["solutiontype"], "file") == 0 && strcmp($solution_array["type"], "file") != 0) {
         $solution_array = array("type" => "file");
     } elseif (strcmp($_POST["solutiontype"], "text") == 0 && strcmp($solution_array["type"], "text") != 0) {
         $solution_array = array("type" => "text", "value" => $this->getSolutionOutput(0, NULL, FALSE, FALSE, TRUE, FALSE, TRUE));
     }
     if ($save && strlen($_POST["filename"])) {
         $solution_array["value"]["filename"] = $_POST["filename"];
     }
     if ($save && strlen($_POST["solutiontext"])) {
         $solution_array["value"] = $_POST["solutiontext"];
     }
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     if (count($solution_array)) {
         $form = new ilPropertyFormGUI();
         $form->setFormAction($this->ctrl->getFormAction($this));
         $form->setTitle($this->lng->txt("solution_hint"));
         $form->setMultipart(TRUE);
         $form->setTableWidth("100%");
         $form->setId("suggestedsolutiondisplay");
         // suggested solution output
         include_once "./Modules/TestQuestionPool/classes/class.ilSolutionTitleInputGUI.php";
         $title = new ilSolutionTitleInputGUI($this->lng->txt("showSuggestedSolution"), "solutiontype");
         $template = new ilTemplate("tpl.il_as_qpl_suggested_solution_input_presentation.html", TRUE, TRUE, "Modules/TestQuestionPool");
         if (strlen($solution_array["internal_link"])) {
             $href = assQuestion::_getInternalLinkHref($solution_array["internal_link"]);
             $template->setCurrentBlock("preview");
             $template->setVariable("TEXT_SOLUTION", $this->lng->txt("suggested_solution"));
             $template->setVariable("VALUE_SOLUTION", " <a href=\"{$href}\" target=\"content\">" . $this->lng->txt("view") . "</a> ");
             $template->parseCurrentBlock();
         } elseif (strcmp($solution_array["type"], "file") == 0 && is_array($solution_array["value"])) {
             $href = $this->object->getSuggestedSolutionPathWeb() . $solution_array["value"]["name"];
             $template->setCurrentBlock("preview");
             $template->setVariable("TEXT_SOLUTION", $this->lng->txt("suggested_solution"));
             $template->setVariable("VALUE_SOLUTION", " <a href=\"{$href}\" target=\"content\">" . ilUtil::prepareFormOutput(strlen($solution_array["value"]["filename"]) ? $solution_array["value"]["filename"] : $solution_array["value"]["name"]) . "</a> ");
             $template->parseCurrentBlock();
         }
         $template->setVariable("TEXT_TYPE", $this->lng->txt("type"));
         $template->setVariable("VALUE_TYPE", $options[$solution_array["type"]]);
         $title->setHtml($template->get());
         $deletesolution = new ilCheckboxInputGUI("", "deleteSuggestedSolution");
         $deletesolution->setOptionTitle($this->lng->txt("deleteSuggestedSolution"));
         $title->addSubItem($deletesolution);
         $form->addItem($title);
         if (strcmp($solution_array["type"], "file") == 0) {
             // file
             $file = new ilFileInputGUI($this->lng->txt("fileDownload"), "file");
             $file->setRequired(TRUE);
             $file->enableFileNameSelection("filename");
             //$file->setSuffixes(array("doc","xls","png","jpg","gif","pdf"));
             if ($_FILES["file"]["tmp_name"] && $file->checkInput()) {
                 if (!file_exists($this->object->getSuggestedSolutionPath())) {
                     ilUtil::makeDirParents($this->object->getSuggestedSolutionPath());
                 }
                 $res = ilUtil::moveUploadedFile($_FILES["file"]["tmp_name"], $_FILES["file"]["name"], $this->object->getSuggestedSolutionPath() . $_FILES["file"]["name"]);
                 if ($res) {
                     ilUtil::renameExecutables($this->object->getSuggestedSolutionPath());
                     // remove an old file download
                     if (is_array($solution_array["value"])) {
                         @unlink($this->object->getSuggestedSolutionPath() . $solution_array["value"]["name"]);
                     }
                     $file->setValue($_FILES["file"]["name"]);
                     $this->object->saveSuggestedSolution("file", "", 0, array("name" => $_FILES["file"]["name"], "type" => $_FILES["file"]["type"], "size" => $_FILES["file"]["size"], "filename" => $_POST["filename"]));
                     $originalexists = $this->object->_questionExistsInPool($this->object->original_id);
                     if (($_GET["calling_test"] || isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) {
                         return $this->originalSyncForm("suggestedsolution");
                     } else {
                         ilUtil::sendSuccess($this->lng->txt("suggested_solution_added_successfully"), TRUE);
                         $this->ctrl->redirect($this, "suggestedsolution");
                     }
                 } else {
                     // BH: $res as info string? wtf? it holds a bool or something else!!?
                     ilUtil::sendInfo($res);
                 }
             } else {
                 if (is_array($solution_array["value"])) {
                     $file->setValue($solution_array["value"]["name"]);
                     $file->setFilename(strlen($solution_array["value"]["filename"]) ? $solution_array["value"]["filename"] : $solution_array["value"]["name"]);
                 }
             }
             $form->addItem($file);
             $hidden = new ilHiddenInputGUI("solutiontype");
             $hidden->setValue("file");
//.........这里部分代码省略.........
开发者ID:bheyser,项目名称:qplskl,代码行数:101,代码来源:class.assQuestionGUI.php

示例15: cloneAnswerImages

 protected function cloneAnswerImages($sourceQuestionId, $sourceParentId, $targetQuestionId, $targetParentId)
 {
     global $ilLog;
     $sourcePath = $this->buildImagePath($sourceQuestionId, $sourceParentId);
     $targetPath = $this->buildImagePath($targetQuestionId, $targetParentId);
     foreach ($this->getAnswers() as $answer) {
         $filename = $answer->getImageFile();
         if (strlen($filename)) {
             if (!file_exists($targetPath)) {
                 ilUtil::makeDirParents($targetPath);
             }
             if (!@copy($sourcePath . $filename, $targetPath . $filename)) {
                 $ilLog->write("image could not be duplicated!!!!", $ilLog->ERROR);
                 $ilLog->write("object: " . print_r($this, TRUE), $ilLog->ERROR);
             }
             if (@file_exists($sourcePath . $this->getThumbPrefix() . $filename)) {
                 if (!@copy($sourcePath . $this->getThumbPrefix() . $filename, $targetPath . $this->getThumbPrefix() . $filename)) {
                     $ilLog->write("image thumbnail could not be duplicated!!!!", $ilLog->ERROR);
                     $ilLog->write("object: " . print_r($this, TRUE), $ilLog->ERROR);
                 }
             }
         }
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:24,代码来源:class.assKprimChoice.php


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