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


PHP CFile::setObject方法代码示例

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


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

示例1: doStore

 /**
  * @see parent::doStore()
  */
 function doStore()
 {
     if (isset($_FILES['attachment'])) {
         $mail_id = CValue::post('mail_id');
         $mail = new CUserMail();
         $mail->load($mail_id);
         $files = array();
         foreach ($_FILES['attachment']['error'] as $key => $file_error) {
             if (isset($_FILES['attachment']['name'][$key])) {
                 $files[] = array('name' => $_FILES['attachment']['name'][$key], 'tmp_name' => $_FILES['attachment']['tmp_name'][$key], 'error' => $_FILES['attachment']['error'][$key], 'size' => $_FILES['attachment']['size'][$key]);
             }
         }
         foreach ($files as $_key => $_file) {
             if ($_file['error'] == UPLOAD_ERR_NO_FILE) {
                 continue;
             }
             if ($_file['error'] != 0) {
                 CAppUI::setMsg(CAppUI::tr("CFile-msg-upload-error-" . $_file["error"]), UI_MSG_ERROR);
                 continue;
             }
             $attachment = new CMailAttachments();
             $attachment->name = $_file['name'];
             $content_type = mime_content_type($_file['tmp_name']);
             $attachment->type = $attachment->getTypeInt($content_type);
             $attachment->bytes = $_file['size'];
             $attachment->mail_id = $mail_id;
             $content_type = explode('/', $content_type);
             $attachment->subtype = strtoupper($content_type[1]);
             $attachment->disposition = 'ATTACHMENT';
             $attachment->extension = substr(strrchr($attachment->name, '.'), 1);
             $attachment->part = $mail->countBackRefs('mail_attachments') + 1;
             $attachment->store();
             $file = new CFile();
             $file->setObject($attachment);
             $file->author_id = CAppUI::$user->_id;
             $file->file_name = $attachment->name;
             $file->file_date = CMbDT::dateTime();
             $file->fillFields();
             $file->updateFormFields();
             $file->doc_size = $attachment->bytes;
             $file->file_type = mime_content_type($_file['tmp_name']);
             $file->moveFile($_file, true);
             if ($msg = $file->store()) {
                 CAppUI::setMsg(CAppUI::tr('CMailAttachments-error-upload-file') . ':' . CAppUI::tr($msg), UI_MSG_ERROR);
                 CApp::rip();
             }
             $attachment->file_id = $file->_id;
             if ($msg = $attachment->store()) {
                 CAppUI::setMsg($msg, UI_MSG_ERROR);
                 CApp::rip();
             }
         }
         CAppUI::setMsg('CMailAttachments-msg-added', UI_MSG_OK);
     } else {
         parent::doStore();
     }
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:60,代码来源:CMailAttachmentController.class.php

示例2: attachFiles

 /**
  * create the CFiles attached to the mail
  *
  * @param CMailAttachments[] $attachList The list of CMailAttachment
  * @param CPop               $popClient  the CPop client
  *
  * @return void
  */
 function attachFiles($attachList, $popClient)
 {
     //size limit
     $size_required = CAppUI::pref("getAttachmentOnUpdate");
     if ($size_required == "") {
         $size_required = 0;
     }
     foreach ($attachList as $_attch) {
         $_attch->mail_id = $this->_id;
         $_attch->loadMatchingObject();
         if (!$_attch->_id) {
             $_attch->store();
         }
         //si preference taille ok OU que la piece jointe est incluse au texte => CFile
         if ($_attch->bytes <= $size_required || $_attch->disposition == "INLINE") {
             $file = new CFile();
             $file->setObject($_attch);
             $file->author_id = CAppUI::$user->_id;
             if (!$file->loadMatchingObject()) {
                 $file_pop = $popClient->decodeMail($_attch->encoding, $popClient->openPart($this->uid, $_attch->getpartDL()));
                 $file->file_name = $_attch->name;
                 //apicrypt attachment
                 if (strpos($_attch->name, ".apz") !== false) {
                     $file_pop = CApicrypt::uncryptAttachment($popClient->source->object_id, $file_pop);
                 }
                 //file type detection
                 $first = is_array($file_pop) ? reset($file_pop) : $file_pop;
                 $mime = $this->extensionDetection($first);
                 //file name
                 $infos = pathinfo($_attch->name);
                 $extension = $infos['extension'];
                 $mime_extension = strtolower(end(explode("/", $mime)));
                 if (strtolower($extension) != $mime_extension) {
                     $file->file_name = $infos['filename'] . "." . $mime_extension;
                 }
                 $file->file_type = $mime ? $mime : $_attch->getType($_attch->type, $_attch->subtype);
                 $file->fillFields();
                 $file->updateFormFields();
                 $file->putContent($file_pop);
                 $file->store();
             }
         }
     }
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:52,代码来源:CUserMail.class.php

示例3: editJournal

 /**
  * Edition des journaux selon le type
  *
  * @param bool $read           lecture
  * @param bool $create_journal Création du journal
  *
  * @return void
  */
 function editJournal($read = true, $create_journal = true)
 {
     if ($create_journal) {
         $journal = new CJournalBill();
         $journal->type = $this->type_pdf;
         $journal->nom = "Journal_" . $this->type_pdf . "_" . CMbDT::date();
         $journal->_factures = $this->factures;
         if ($msg = $journal->store()) {
             mbTrace($msg);
         } else {
             $this->journal_id = $journal->_id;
         }
     }
     // Creation du PDF
     $this->pdf = new CMbPdf('l', 'mm');
     $this->pdf->setPrintHeader(false);
     $this->pdf->setPrintFooter(false);
     $this->font = "vera";
     $this->fontb = $this->font . "b";
     $this->pdf->setFont($this->font, '', 8);
     $this->page = 0;
     $this->editEntete();
     switch ($this->type_pdf) {
         case "paiement":
             $this->editPaiements();
             break;
         case "debiteur":
             $this->editDebiteur();
             break;
         case "rappel":
             $this->editRappel();
             break;
         case "checklist":
             $this->editCheckList();
             break;
     }
     if ($create_journal) {
         $file = new CFile();
         $file->file_name = $journal->nom . ".pdf";
         $file->file_type = "application/pdf";
         $file->author_id = CMediusers::get()->_id;
         $file->file_category_id = 1;
         $file->setObject($journal);
         $file->fillFields();
         $file->putContent($this->pdf->Output('Factures.pdf', "S"));
         if ($msg = $file->store()) {
             echo $msg;
         }
         if ($this->type_pdf == "checklist") {
             $user = CMediusers::get();
             $printer = new CPrinter();
             $printer->function_id = $user->function_id;
             $printer->label = "justif";
             $printer->loadMatchingObject();
             if (!$printer->_id) {
                 CAppUI::setMsg("Les imprimantes ne sont pas paramétrées", UI_MSG_ERROR);
                 echo CAppUI::getMsg();
                 return false;
             }
             $file = new CFile();
             $pdf = $this->pdf->Output('Factures.pdf', "S");
             $file_path = tempnam("tmp", "facture");
             $file->_file_path = $file_path;
             file_put_contents($file_path, $pdf);
             $printer->loadRefSource()->sendDocument($file);
             unlink($file_path);
         }
     }
     if ($read) {
         //Affichage du fichier pdf
         $this->pdf->Output('Factures.pdf', "I");
     }
 }
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:81,代码来源:CEditJournal.class.php

示例4: addFile

 /**
  * Store a CFile linked to $this
  *
  * @param string $filename File name
  * @param string $filedata File contents
  *
  * @return bool
  */
 function addFile($filename, $filedata)
 {
     $file = new CFile();
     $file->setObject($this);
     $file->file_name = $filename;
     $file->file_type = "text/plain";
     $file->doc_size = strlen($filedata);
     $file->author_id = CAppUI::$instance->user_id;
     $file->fillFields();
     if (!$file->putContent($filedata)) {
         return false;
     }
     $file->store();
     return true;
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:23,代码来源:CExtractPassages.class.php

示例5: strtolower

while ($zipFile = zip_read($zip)) {
    $doc_name = zip_entry_name($zipFile);
    $extension = strtolower(pathinfo($doc_name, PATHINFO_EXTENSION));
    $file_name = pathinfo($doc_name, PATHINFO_BASENAME);
    $doc_size = zip_entry_filesize($zipFile);
    $dir_name = end(explode("/", dirname($doc_name)));
    if ((!$dir_name || $dir_name == ".") && $category || $category != "divers") {
        $dir_name = $category;
    }
    $cat = new CDrawingCategory();
    $cat->name = $dir_name;
    $cat->loadMatchingObjectEsc();
    if ($msg = $cat->store()) {
        CAppUI::stepAjax($msg, UI_MSG_WARNING);
    }
    $content_file = zip_entry_read($zipFile, $doc_size);
    if ($content_file) {
        $file = new CFile();
        $file->file_name = $file_name;
        $file->author_id = CAppUI::$user->_id;
        $file->file_type = CMbPath::guessMimeType($doc_name);
        $file->fillFields();
        $file->setObject($cat);
        $file->updateFormFields();
        $file->putContent($content_file);
        if ($msg = $file->store()) {
            CAppUI::setMsg($msg, UI_MSG_WARNING);
        }
    }
}
zip_close($zip);
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:do_import_image_pack.php

示例6: CFile

$data = $file_array[$dispo];
// context
$object_guid = CValue::post("context_guid");
$context = CMbObject::loadFromGuid($object_guid);
// get data uri
foreach ($data as $_key => &$_data) {
    $file = new 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]");
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:do_mozaic_doc.php

示例7: CSupervisionTimedPicture

/**
 * $Id: do_select_supervision_picture.php 26555 2014-12-23 12:48:14Z flaviencrochard $
 *  
 * @category Patients
 * @package  Mediboard
 * @author   SARL OpenXtrem <dev@openxtrem.com>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision: 26555 $
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$path = str_replace("..", "", CValue::post("path"));
$timed_picture_id = CValue::post("timed_picture_id");
if (is_file($path) && strpos(CSupervisionTimedPicture::PICTURES_ROOT, $path) !== 0) {
    $timed_picture = new CSupervisionTimedPicture();
    $timed_picture->load($timed_picture_id);
    $file = new CFile();
    $file->setObject($timed_picture);
    $file->fillFields();
    $file->file_name = basename($path);
    $file->doc_size = filesize($path);
    $file->file_type = CMbPath::guessMimeType($path);
    $file->moveFile($path, false, true);
    if ($msg = $file->store()) {
        CAppUI::setMsg($msg, UI_MSG_WARNING);
    } else {
        CAppUI::setMsg("Image enregistrée");
    }
}
echo CAppUI::getMsg();
CApp::rip();
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:do_select_supervision_picture.php

示例8: CContentHTML

        }
    }
}
//text link
if ($text_html || $text_plain) {
    $content_type = "text/plain";
    if ($text_html) {
        $text = new CContentHTML();
        $text->load($text_html);
        $content_type = "text/html";
    } else {
        $text = new CContentAny();
        $text->load($text_plain);
    }
    $file = new CFile();
    $file->setObject($object);
    $file->author_id = CAppUI::$user->_id;
    $file->file_name = "sans_titre";
    $file->file_category_id = $category_id;
    if ($mail->subject) {
        $file->file_name = $mail->subject;
    }
    if ($rename_text) {
        $file->file_name = $rename_text;
    }
    $file->file_type = $content_type;
    $file->fillFields();
    $file->putContent($text->content);
    if ($str = $file->store()) {
        CAppUI::stepAjax($str, UI_MSG_ERROR);
    } else {
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:ajax_do_link_attachments.php

示例9: 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

示例10: CExtractPassages

CCanDo::checkAdmin();
$extract_passages_id = CValue::get("extract_passages_id");
if (isset($extractPassages) && $extractPassages->_id) {
    $extract_passages_id = $extractPassages->_id;
}
$attente = 1;
$extractPassages = new CExtractPassages();
// Appel de la fonction d'extraction du RPUSender
$rpuSender = $extractPassages->getRPUSender();
if ($extract_passages_id) {
    $extractPassages->load($extract_passages_id);
    if (!$extractPassages->_id) {
        CAppUI::stepAjax("Impossible de charger le document XML.", UI_MSG_ERROR);
    }
    $file = new CFile();
    $file->setObject($extractPassages);
    $file->loadMatchingObject();
    if (!$file->_id) {
        CAppUI::stepAjax("Impossible de récupérer le document.", UI_MSG_ERROR);
    }
    $tentative = 5;
    if ($extractPassages->type == "activite") {
        while ($tentative-- && $rpuSender->transmitActivite($extractPassages)) {
            sleep($attente);
        }
    } else {
        while ($tentative-- && $rpuSender->transmit($extractPassages)) {
            sleep($attente);
        }
    }
} else {
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:ajax_transmit_passages.php

示例11: round

             }
             $content = $compte_rendu->loadHTMLcontent($content, $mode, $margins, CCompteRendu::$fonts[$compte_rendu->font], $compte_rendu->size, true, $type, $header, $sizeheader, $footer, $sizefooter, $preface, $ending);
     }
 } else {
     $content = $compte_rendu->loadHTMLcontent($content, $mode, $margins, CCompteRendu::$fonts[$compte_rendu->font], $compte_rendu->size);
 }
 // Traitement du format de la page
 if ($page_format == "") {
     $page_width = round(72 / 2.54 * $page_width, 2);
     $page_height = round(72 / 2.54 * $page_height, 2);
     $page_format = array(0, 0, $page_width, $page_height);
 }
 // Création du CFile si inexistant
 if (!$file->_id) {
     $file = new CFile();
     $file->setObject($compte_rendu);
     $file->file_type = "application/pdf";
     $file->author_id = $user_id;
     $file->fillFields();
     $file->updateFormFields();
     $file->forceDir();
 }
 if ($file->_id && !file_exists($file->_file_path)) {
     $file->forceDir();
 }
 $file->file_name = $compte_rendu->nom . ".pdf";
 $c1 = preg_replace("!\\s!", '', $save_content);
 $c2 = preg_replace("!\\s!", '', $compte_rendu->_source);
 // Si la source envoyée et celle présente en base sont différentes, on regénère le PDF
 // Suppression des espaces, tabulations, retours chariots et sauts de lignes pour effectuer le md5
 if ($compte_rendu->valide || md5($c1) != md5($c2) || !$file->_id || !file_exists($file->_file_path) || file_get_contents($file->_file_path) == "") {
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:ajax_pdf.php

示例12: CFile

if ($del) {
    if ($msg = $file->delete()) {
        CAppUI::stepAjax($msg, UI_MSG_ERROR);
    } else {
        CAppUI::stepAjax("CFile-msg-delete", UI_MSG_OK);
    }
} else {
    $file->file_type = "image/fabricjs";
    if ($export) {
        $svg = new CFile();
        $svg->file_name = $file->file_name;
        $svg->file_type = "image/svg+xml";
        $svg->author_id = $file->author_id;
        $svg->loadMatchingObject();
        $svg->fillFields();
        $svg->setObject($file->_ref_object);
        $svg->updateFormFields();
        if (strpos($svg->file_name, ".") === false) {
            $svg->file_name = $svg->file_name . ".svg";
        }
        if (strpos($svg->file_name, ".fjs") !== false) {
            $svg->file_name = str_replace(".fjs", ".svg", $svg->file_name);
        }
        // @TODO : replace url by datauri
        $content = str_replace(array("&a=fileviewer", "&file_id", "&suppressHeaders"), array("&amp;a=fileviewer", "&amp;file_id", "&amp;suppressHeaders"), $content);
        if ($result = $svg->putContent(stripslashes($content))) {
            if ($msg = $svg->store()) {
                CAppUI::stepAjax($msg, UI_MSG_ERROR);
            } else {
                CAppUI::stepAjax("Dessin exporté avec succès", UI_MSG_OK);
            }
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:do_drawfile_aed.php

示例13: 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

示例14: foreach

        $file->file_type = $attachment->getType($attachment->type, $attachment->subtype);
        $file->fillFields();
        $file->putContent($file_pop);
        if ($str = $file->store()) {
            CAppUI::setMsg($str, UI_MSG_ERROR);
        } else {
            CAppUI::setMsg("CMailAttachments-msg-attachmentsaved", UI_MSG_OK);
        }
        $pop->close();
    }
} else {
    //je récupère TOUTES les pièces jointes
    $mail->loadRefsFwd();
    foreach ($mail->_attachments as $_att) {
        $file = new CFile();
        $file->setObject($_att);
        $file->author_id = $user->_id;
        $file->loadMatchingObject();
        if (!$file->_id) {
            $pop = new CPop($log_pop);
            $pop->open();
            $file_pop = $pop->decodeMail($_att->encoding, $pop->openPart($mail->uid, $_att->getpartDL()));
            $file->file_name = $_att->name;
            $file->file_type = $_att->getType($_att->type, $_att->subtype);
            $file->fillFields();
            $file->putContent($file_pop);
            if ($str = $file->store()) {
                CAppUI::setMsg($str, UI_MSG_ERROR);
            } else {
                CAppUI::setMsg("CMailAttachments-msg-attachmentsaved", UI_MSG_OK);
            }
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:pop_attachment_to_cfile.php

示例15: CSmartyDP

    $footer->loadContent();
    $facture->fillTemplate($template_footer);
    $template_footer->renderDocument($footer->_source);
    if ($footer->height) {
        $footer_height = $footer->height;
    }
}
$style = file_get_contents("style/mediboard/tables.css");
$smarty = new CSmartyDP();
$smarty->assign("style", $style);
$smarty->assign("facture", $facture);
$smarty->assign("header_height", $header_height);
$smarty->assign("footer_height", $footer_height);
$smarty->assign("header", $template_header->document);
$smarty->assign("footer", $template_footer->document);
$smarty->assign("body_height", 550 - $template_footer->document - $template_header->document);
$content = $smarty->fetch("print_facture.tpl");
$file = new CFile();
$file->file_name = "Impression de la facture.pdf";
$file->setObject($facture);
$file->file_type = "application/pdf";
$file->author_id = CMediusers::get()->_id;
$file->fillFields();
$file->updateFormFields();
$file->forceDir();
$file->store();
$htmltopdf = new CHtmlToPDF("CDomPDFConverter");
$cr = new CCompteRendu();
$cr->_page_format = "a4";
$cr->_orientation = "portrait";
$htmltopdf->generatePDF($content, 1, $cr, $file);
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:31,代码来源:print_facture.php


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