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


PHP CFile::forceDir方法代码示例

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


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

示例1: CFile

    $file->load($_data["file_id"]);
    $file->getDataURI();
    $_data["file_uri"] = $file->_data_uri;
}
//user
$user = CMediusers::get($user_id);
// file
$file = new CFile();
$file->setObject($context);
$file->file_name = CAppUI::tr("CFile-create-mozaic") . " de " . CAppUI::tr($context->_class) . " du " . CMbDT::dateToLocale(CMbDT::date()) . ".pdf";
$file->file_type = "application/pdf";
$file->file_category_id = $cat_id;
$file->author_id = CMediusers::get()->_id;
$file->fillFields();
$file->updateFormFields();
$file->forceDir();
$file->store();
$cr = new CCompteRendu();
$cr->_page_format = "A4";
$cr->_orientation = "portrait";
// use template for header and footer
$template_header = new CTemplateManager();
$context->fillTemplate($template_header);
$header = CCompteRendu::getSpecialModel($user, "CPatient", "[ENTETE MOZAIC]");
if ($header->_id) {
    $header->loadContent();
    $template_header->renderDocument($header->_source);
} else {
    $template_header->document = "<p style=\"text-align:center;\">" . $context->_view . "</p>";
}
$template_footer = new CTemplateManager();
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:do_mozaic_doc.php

示例2: convertToPDF

 /**
  * PDF conversion of a file
  *
  * @param string $file_path path to the file
  * @param string $pdf_path  path the pdf file
  *
  * @return bool
  */
 function convertToPDF($file_path = null, $pdf_path = null)
 {
     global $rootName;
     // Vérifier si openoffice est lancé
     if (!CFile::openofficeLaunched()) {
         return 0;
     }
     // Vérifier sa charge en mémoire
     CFile::openofficeOverload();
     if (!$file_path && !$pdf_path) {
         $file = new CFile();
         $file->setObject($this);
         $file->private = $this->private;
         $file->file_name = $this->file_name . ".pdf";
         $file->file_type = "application/pdf";
         $file->author_id = CAppUI::$user->_id;
         $file->fillFields();
         $file->updateFormFields();
         $file->forceDir();
         $save_name = $this->_file_path;
         if ($msg = $file->store()) {
             CAppUI::setMsg($msg, UI_MSG_ERROR);
             return 0;
         }
         $file_path = $this->_file_path;
         $pdf_path = $file->_file_path;
     }
     // Requête post pour la conversion.
     // Cela permet de mettre un time limit afin de garder le contrôle de la conversion.
     ini_set("default_socket_timeout", 10);
     $fileContents = base64_encode(file_get_contents($file_path));
     $url = CAppUI::conf("base_url") . "/index.php?m=dPfiles&a=ajax_ooo_convert&suppressHeaders=1";
     $data = array("file_data" => $fileContents, "pdf_path" => $pdf_path);
     // Fermeture de la session afin d'écrire dans le fichier de session
     CSessionHandler::writeClose();
     // Le header Connection: close permet de forcer a couper la connexion lorsque la requête est effectuée
     $ctx = stream_context_create(array('http' => array('method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded charset=UTF-8\r\n" . "Connection: close\r\n" . "Cookie: mediboard=" . session_id() . "\r\n", 'content' => http_build_query($data))));
     // La requête post réouvre la session
     $res = file_get_contents($url, false, $ctx);
     if (isset($file) && $res == 1) {
         $file->doc_size = filesize($pdf_path);
         if ($msg = $file->store()) {
             CAppUI::setMsg($msg, UI_MSG_ERROR);
             return 0;
         }
     }
     // Si la conversion a échoué
     // on relance le service s'il ne répond plus.
     if ($res != 1) {
         CFile::openofficeOverload(1);
     }
     return $res;
 }
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:61,代码来源:CFile.class.php

示例3: traitementDossier

 /**
  * Traitement des retours en erreur d'xml d'un praticien
  *
  * @param int $chir_id praticien de la consultation
  *
  * @return void|string
  */
 static function traitementDossier($chir_id)
 {
     $files = array();
     $fs_source_reception = CExchangeSource::get("reception-tarmed-CMediusers-{$chir_id}", "file_system", true, null, false);
     if (!$fs_source_reception->_id || !$fs_source_reception->active) {
         return null;
     }
     $count_files = CMbPath::countFiles($fs_source_reception->host);
     if ($count_files < 100) {
         try {
             $files = $fs_source_reception->receive();
         } catch (CMbException $e) {
             return CAppUI::tr($e->getMessage());
         }
     }
     $delfile_read_reject = CAppUI::conf("dPfacturation Other delfile_read_reject", CGroups::loadCurrent());
     foreach ($files as $_file) {
         $fs = new CSourceFileSystem();
         $rejet = new self();
         $rejet->praticien_id = $chir_id;
         $rejet->file_name = basename($_file);
         if ($msg = $rejet->store()) {
             return $msg;
         }
         $rejet->readXML($fs->getData($_file));
         //Sauvegarde du XML en CFile
         $new_file = new CFile();
         $new_file->setObject($rejet);
         $new_file->file_name = basename($_file);
         $new_file->file_type = "application/xml";
         $new_file->author_id = CAppUI::$user->_id;
         $new_file->fillFields();
         $new_file->updateFormFields();
         $new_file->forceDir();
         $new_file->putContent(trim($fs->getData($_file)));
         if ($msg = $new_file->store()) {
             mbTrace($msg);
         }
         //Suppression du fichier selon configuration
         if ($delfile_read_reject) {
             $fs->delFile($_file);
         }
     }
     return null;
 }
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:52,代码来源:CFactureRejet.class.php

示例4: makePDFarchive

 /**
  * Make a PDF document archive of the sejour (based on soins/print_dossier_soins)
  *
  * @param string $title   File title
  * @param bool   $replace Replace existing file
  *
  * @return bool
  * @throws CMbException
  */
 function makePDFarchive($title = "Dossier complet", $replace = false)
 {
     if (!CModule::getActive("soins")) {
         return false;
     }
     $query = array("m" => "soins", "a" => "print_dossier_soins", "sejour_id" => $this->_id, "dialog" => 1, "offline" => 1, "limit" => 10000, "_aio" => 1, "_aio_ignore_scripts" => 1);
     $base = $_SERVER["SCRIPT_NAME"] . "?" . http_build_query($query, "", "&");
     $result = CApp::serverCall("http://127.0.0.1{$base}");
     $content = $result["body"];
     $file = new CFile();
     $file->setObject($this);
     $file->file_name = "{$title}.pdf";
     $file->file_type = "application/pdf";
     /*if ($file->loadMatchingObject()) {
           if ($replace) {
             $file->delete();
     
             // New file
             $file = new CFile();
             $file->setObject($this);
             $file->file_name = "$title.pdf";
             $file->file_type = "application/pdf";
           }
         }*/
     $file->fillFields();
     $file->updateFormFields();
     $file->forceDir();
     $file->author_id = CAppUI::$user->_id;
     $compte_rendu = new CCompteRendu();
     $compte_rendu->_orientation = "portrait";
     $format = CCompteRendu::$_page_formats["a4"];
     $page_width = round(72 / 2.54 * $format[0], 2);
     $page_height = round(72 / 2.54 * $format[1], 2);
     $compte_rendu->_page_format = array(0, 0, $page_width, $page_height);
     $content = str_replace("<!DOCTYPE html>", "", $content);
     CHtmlToPDFConverter::init("CWkHtmlToPDFConverter");
     //CHtmlToPDFConverter::init("CPrinceXMLConverter");
     $pdf = CHtmlToPDFConverter::convert($content, $compte_rendu->_page_format, $compte_rendu->_orientation);
     $file->putContent($pdf);
     if ($msg = $file->store()) {
         throw new CMbException($msg);
     }
     return true;
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:53,代码来源:CSejour.class.php


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