本文整理汇总了PHP中get_exdir函数的典型用法代码示例。如果您正苦于以下问题:PHP get_exdir函数的具体用法?PHP get_exdir怎么用?PHP get_exdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_exdir函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: donation_prepare_head
/**
* Prepare array with list of tabs
*
* @param Donation $object Donation
* @return array Array of tabs to show
*/
function donation_prepare_head($object)
{
global $db, $langs, $conf;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT . '/don/card.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation');
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$upload_dir = $conf->don->dir_output . '/' . get_exdir($filename, 2, 0, 1, $object, 'donation') . '/' . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\\.meta|_preview\\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT . '/don/document.php?id=' . $object->id;
$head[$h][1] = $langs->trans('Documents');
if ($nbFiles + $nbLinks > 0) {
$head[$h][1] .= ' <span class="badge">' . ($nbFiles + $nbLinks) . '</span>';
}
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT . '/don/info.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation', 'remove');
return $head;
}
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:39,代码来源:donation.lib.php
示例2: facturefourn_prepare_head
/**
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to show
*/
function facturefourn_prepare_head($object)
{
global $db, $langs, $conf;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT . '/fourn/facture/card.php?facid=' . $object->id;
$head[$h][1] = $langs->trans('CardBill');
$head[$h][2] = 'card';
$h++;
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
$head[$h][0] = DOL_URL_ROOT . '/fourn/facture/contact.php?facid=' . $object->id;
$head[$h][1] = $langs->trans('ContactsAddresses');
$head[$h][2] = 'contact';
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'supplier_invoice');
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
$nbNote = 0;
if (!empty($object->note_private)) {
$nbNote++;
}
if (!empty($object->note_public)) {
$nbNote++;
}
$head[$h][0] = DOL_URL_ROOT . '/fourn/facture/note.php?facid=' . $object->id;
$head[$h][1] = $langs->trans('Notes');
if ($nbNote > 0) {
$head[$h][1] .= ' <span class="badge">' . $nbNote . '</span>';
}
$head[$h][2] = 'note';
$h++;
}
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$upload_dir = $conf->fournisseur->facture->dir_output . '/' . get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier') . $object->ref;
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\\.meta|_preview\\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT . '/fourn/facture/document.php?facid=' . $object->id;
$head[$h][1] = $langs->trans('Documents');
if ($nbFiles + $nbLinks > 0) {
$head[$h][1] .= ' <span class="badge">' . ($nbFiles + $nbLinks) . '</span>';
}
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT . '/fourn/facture/info.php?facid=' . $object->id;
$head[$h][1] = $langs->trans('Info');
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'supplier_invoice', 'remove');
return $head;
}
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:61,代码来源:fourn.lib.php
示例3: write_file
/**
* Function to build pdf onto disk
*
* @param Object $object Object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
global $user, $langs, $conf, $mysoc, $db, $hookmanager;
if (!is_object($outputlangs)) {
$outputlangs = $langs;
}
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!empty($conf->global->MAIN_USE_FPDF)) {
$outputlangs->charset_output = 'ISO-8859-1';
}
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("products");
$nblignes = count($object->lines);
// Loop on each lines to detect if there is at least one image to show
$realpatharray = array();
if (!empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE)) {
for ($i = 0; $i < $nblignes; $i++) {
if (empty($object->lines[$i]->fk_product)) {
continue;
}
$objphoto = new Product($this->db);
$objphoto->fetch($object->lines[$i]->fk_product);
$pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product') . $object->lines[$i]->fk_product . "/photos/";
$dir = $conf->product->dir_output . '/' . $pdir;
$realpath = '';
foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
$filename = $obj['photo'];
//if ($obj['photo_vignette']) $filename='thumbs/'.$obj['photo_vignette'];
$realpath = $dir . $filename;
break;
}
if ($realpath) {
$realpatharray[$i] = $realpath;
}
}
}
if (count($realpatharray) == 0) {
$this->posxpicture = $this->posxtva;
}
if ($conf->facture->dir_output) {
$object->fetch_thirdparty();
$deja_regle = $object->getSommePaiement();
$amount_credit_notes_included = $object->getSumCreditNotesUsed();
$amount_deposits_included = $object->getSumDepositsUsed();
// Definition of $dir and $file
if ($object->specimen) {
$dir = $conf->facture->dir_output;
$file = $dir . "/SPECIMEN.pdf";
} else {
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->facture->dir_output . "/" . $objectref;
$file = $dir . "/" . $objectref . ".pdf";
}
if (!file_exists($dir)) {
if (dol_mkdir($dir) < 0) {
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return 0;
}
}
if (file_exists($dir)) {
// Add pdfgeneration hook
if (!is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action);
// Note that $action and $object may have been modified by some hooks
// Set nblignes with the new facture lines content after hook
$nblignes = count($object->lines);
// Create pdf instance
$pdf = pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs);
// Must be after pdf_getInstance
$heightforinfotot = 50;
// Height reserved to output the info and total part
$heightforfreetext = isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5;
// Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8;
// Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF')) {
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
//.........这里部分代码省略.........
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:101,代码来源:pdf_crabe.modules.php
示例4: getProductsForCategory
/**
* Get list of products for a category
*
* @param array $authentication Array of authentication information
* @param array $id Category id
* @param $lang $lang Force lang
* @return array Array result
*/
function getProductsForCategory($authentication, $id, $lang = '')
{
global $db, $conf, $langs;
$langcode = $lang ? $lang : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT);
$langs->setDefaultLang($langcode);
dol_syslog("Function: getProductsForCategory login=" . $authentication['login'] . " id=" . $id);
if ($authentication['entity']) {
$conf->entity = $authentication['entity'];
}
$objectresp = array();
$errorcode = '';
$errorlabel = '';
$error = 0;
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
if (!$error && !$id) {
$error++;
$errorcode = 'BAD_PARAMETERS';
$errorlabel = "Parameter id must be provided.";
}
if (!$error) {
$langcode = $lang ? $lang : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT);
$langs->setDefaultLang($langcode);
$fuser->getrights();
if ($fuser->rights->produit->lire) {
$categorie = new Categorie($db);
$result = $categorie->fetch($id);
if ($result > 0) {
$table = "product";
$field = "product";
$sql = "SELECT fk_" . $field . " FROM " . MAIN_DB_PREFIX . "categorie_" . $table;
$sql .= " WHERE fk_categorie = " . $id;
$sql .= " ORDER BY fk_" . $field . " ASC";
dol_syslog("getProductsForCategory get id of product into category", LOG_DEBUG);
$res = $db->query($sql);
if ($res) {
while ($rec = $db->fetch_array($res)) {
$obj = new Product($db);
$obj->fetch($rec['fk_' . $field]);
$iProduct = 0;
if ($obj->status > 0) {
$dir = !empty($conf->product->dir_output) ? $conf->product->dir_output : $conf->service->dir_output;
$pdir = get_exdir($obj->id, 2) . $obj->id . "/photos/";
$dir = $dir . '/' . $pdir;
$products[] = array('id' => $obj->id, 'ref' => $obj->ref, 'ref_ext' => $obj->ref_ext, 'label' => !empty($obj->multilangs[$langs->defaultlang]["label"]) ? $obj->multilangs[$langs->defaultlang]["label"] : $obj->label, 'description' => !empty($obj->multilangs[$langs->defaultlang]["description"]) ? $obj->multilangs[$langs->defaultlang]["description"] : $obj->description, 'date_creation' => dol_print_date($obj->date_creation, 'dayhourrfc'), 'date_modification' => dol_print_date($obj->date_modification, 'dayhourrfc'), 'note' => !empty($obj->multilangs[$langs->defaultlang]["note"]) ? $obj->multilangs[$langs->defaultlang]["note"] : $obj->note, 'status_tosell' => $obj->status, 'status_tobuy' => $obj->status_buy, 'type' => $obj->type, 'barcode' => $obj->barcode, 'barcode_type' => $obj->barcode_type, 'country_id' => $obj->country_id > 0 ? $obj->country_id : '', 'country_code' => $obj->country_code, 'custom_code' => $obj->customcode, 'price_net' => $obj->price, 'price' => $obj->price_ttc, 'vat_rate' => $obj->tva_tx, 'price_base_type' => $obj->price_base_type, 'stock_real' => $obj->stock_reel, 'stock_alert' => $obj->seuil_stock_alerte, 'pmp' => $obj->pmp, 'import_key' => $obj->import_key, 'dir' => $pdir, 'images' => $obj->liste_photos($dir, $nbmax = 10));
//Retreive all extrafield for thirdsparty
// fetch optionals attributes and labels
$extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label('product', true);
//Get extrafield values
$product->fetch_optionals($obj->id, $extralabels);
foreach ($extrafields->attribute_label as $key => $label) {
$products[$iProduct] = array_merge($products[$iProduct], array('options_' . $key => $product->array_options['options_' . $key]));
}
$iProduct++;
}
}
// Retour
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'products' => $products);
} else {
$errorcode = 'NORECORDS_FOR_ASSOCIATION';
$errorlabel = 'No products associated' . $sql;
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
dol_syslog("getProductsForCategory:: " . $c->error, LOG_DEBUG);
}
} else {
$error++;
$errorcode = 'NOT_FOUND';
$errorlabel = 'Object not found for id=' . $id;
}
} else {
$error++;
$errorcode = 'PERMISSION_DENIED';
$errorlabel = 'User does not have permission for this request';
}
}
if ($error) {
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
}
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:88,代码来源:server_productorservice.php
示例5: write_file
/**
* Write the object to document file to disk
*
* @param Don $don Donation object
* @param Translate $outputlangs Lang object for output language
* @return int >0 if OK, <0 if KO
*/
function write_file($don, $outputlangs)
{
global $user, $conf, $langs, $mysoc;
$now = dol_now();
$id = !is_object($don) ? $don : '';
if (!is_object($outputlangs)) {
$outputlangs = $langs;
}
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("products");
$outputlangs->load("donations");
if (!empty($conf->don->dir_output)) {
// Definition de l'objet $don (pour compatibilite ascendante)
if (!is_object($don)) {
$don = new Don($this->db);
$ret = $don->fetch($id);
$id = $don->id;
}
// Definition de $dir et $file
if (!empty($don->specimen)) {
$dir = $conf->don->dir_output;
$file = $dir . "/SPECIMEN.html";
} else {
$donref = dol_sanitizeFileName($don->ref);
$dir = $conf->don->dir_output . "/" . get_exdir($donref, 2);
$file = $dir . "/" . $donref . ".html";
}
if (!file_exists($dir)) {
if (dol_mkdir($dir) < 0) {
$this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
return -1;
}
}
if (file_exists($dir)) {
$formclass = new Form($this->db);
//This is not the proper way to do it but $formclass->form_modes_reglement
//prints the translation instead of returning it
if ($don->modepaiementid) {
$formclass->load_cache_types_paiements();
$paymentmode = $formclass->cache_types_paiements[$don->modepaiementid]['label'];
} else {
$paymentmode = '';
}
// Defini contenu
$donmodel = DOL_DOCUMENT_ROOT . "/core/modules/dons/html_cerfafr.html";
$form = implode('', file($donmodel));
$form = str_replace('__REF__', $don->id, $form);
$form = str_replace('__DATE__', dol_print_date($don->date, 'day', false, $outputlangs), $form);
//$form = str_replace('__IP__',$user->ip,$form); // TODO $user->ip not exist
$form = str_replace('__AMOUNT__', $don->amount, $form);
$form = str_replace('__CURRENCY__', $outputlangs->transnoentitiesnoconv("Currency" . $conf->currency), $form);
$form = str_replace('__CURRENCYCODE__', $conf->currency, $form);
$form = str_replace('__MAIN_INFO_SOCIETE_NOM__', $mysoc->name, $form);
$form = str_replace('__MAIN_INFO_SOCIETE_ADDRESS__', $mysoc->address, $form);
$form = str_replace('__MAIN_INFO_SOCIETE_ZIP__', $mysoc->zip, $form);
$form = str_replace('__MAIN_INFO_SOCIETE_TOWN__', $mysoc->town, $form);
$form = str_replace('__DONATOR_FIRSTNAME__', $don->firstname, $form);
$form = str_replace('__DONATOR_LASTNAME__', $don->lastname, $form);
$form = str_replace('__DONATOR_ADDRESS__', $don->address, $form);
$form = str_replace('__DONATOR_ZIP__', $don->zip, $form);
$form = str_replace('__DONATOR_TOWN__', $don->town, $form);
$form = str_replace('__PAYMENTMODE_LIB__ ', $paymentmode, $form);
$form = str_replace('__NOW__', dol_print_date($now, '', false, $outputlangs), $form);
$form = str_replace('__DonationRef__', $outputlangs->trans("DonationRef"), $form);
$form = str_replace('__DonationReceipt__', $outputlangs->trans("DonationReceipt"), $form);
$form = str_replace('__DonationRecipient__', $outputlangs->trans("DonationRecipient"), $form);
$form = str_replace('__DatePayment__', $outputlangs->trans("DatePayment"), $form);
$form = str_replace('__PaymentMode__', $outputlangs->trans("PaymentMode"), $form);
$form = str_replace('__Name__', $outputlangs->trans("Name"), $form);
$form = str_replace('__Address__', $outputlangs->trans("Address"), $form);
$form = str_replace('__Zip__', $outputlangs->trans("Zip"), $form);
$form = str_replace('__Town__', $outputlangs->trans("Town"), $form);
$form = str_replace('__Donor__', $outputlangs->trans("Donor"), $form);
$form = str_replace('__Date__', $outputlangs->trans("Date"), $form);
$form = str_replace('__Signature__', $outputlangs->trans("Signature"), $form);
$form = str_replace('__ThankYou__', $outputlangs->trans("ThankYou"), $form);
$form = str_replace('__IConfirmDonationReception__', $outputlangs->trans("IConfirmDonationReception"), $form);
$frencharticle = '';
if (preg_match('/fr/i', $outputlangs->defaultlang)) {
$frencharticle = '<font size="+1"><b>(Article 200-5 du Code Général des Impôts)</b></font><br>+ article 238 bis';
}
$form = str_replace('__FrenchArticle__', $frencharticle, $form);
// Sauve fichier sur disque
dol_syslog("html_cerfafr::write_file {$file}");
$handle = fopen($file, "w");
fwrite($handle, $form);
fclose($handle);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
//.........这里部分代码省略.........
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:101,代码来源:html_cerfafr.modules.php
示例6: list_of_documents
/**
* Show list of documents in a directory
*
* @param array $filearray Array of files loaded by dol_dir_list('files') function before calling this
* @param Object $object Object on which document is linked to
* @param string $modulepart Value for modulepart used by download or viewimage wrapper
* @param string $param Parameters on sort links (param must start with &, example &aaa=bbb&ccc=ddd)
* @param int $forcedownload Force to open dialog box "Save As" when clicking on file
* @param string $relativepath Relative path of docs (autodefined if not provided)
* @param int $permtodelete Permission to delete
* @param int $useinecm Change output for use in ecm module
* @param string $textifempty Text to show if filearray is empty ('NoFileFound' if not defined)
* @param int $maxlength Maximum length of file name shown
* @param string $title Title before list
* @param string $url Full url to use for click links ('' = autodetect)
* @param int $showrelpart 0=Show only filename (default), 1=Show first level 1 dir
* @return int <0 if KO, nb of files shown if OK
*/
function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permtodelete = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0)
{
global $user, $conf, $langs, $hookmanager;
global $bc;
global $sortfield, $sortorder, $maxheightmini;
$hookmanager->initHooks(array('formfile'));
$parameters = array('filearray' => $filearray, 'modulepart' => $modulepart, 'param' => $param, 'forcedownload' => $forcedownload, 'relativepath' => $relativepath, 'permtodelete' => $permtodelete, 'useinecm' => $useinecm, 'textifempty' => $textifempty, 'maxlength' => $maxlength, 'title' => $title, 'url' => $url);
$reshook = $hookmanager->executeHooks('showFilesList', $parameters, $object);
if (isset($reshook) && $reshook != '') {
return $reshook;
} else {
$param = (isset($object->id) ? '&id=' . $object->id : '') . $param;
// Show list of existing files
if (empty($useinecm)) {
print load_fiche_titre($title ? $title : $langs->trans("AttachedFiles"));
}
if (empty($url)) {
$url = $_SERVER["PHP_SELF"];
}
print '<table width="100%" class="' . ($useinecm ? 'nobordernopadding' : 'liste') . '">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Documents2"), $url, "name", "", $param, 'align="left"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Size"), $url, "size", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Date"), $url, "date", "", $param, 'align="center"', $sortfield, $sortorder);
if (empty($useinecm)) {
print_liste_field_titre('', $url, "", "", $param, 'align="center"');
}
print_liste_field_titre('');
print "</tr>\n";
$nboffiles = count($filearray);
if ($nboffiles > 0) {
include_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php';
}
$var = true;
foreach ($filearray as $key => $file) {
if ($file['name'] != '.' && $file['name'] != '..' && !preg_match('/\\.meta$/i', $file['name'])) {
// Define relative path used to store the file
if (empty($relativepath)) {
$relativepath = (!empty($object->ref) ? dol_sanitizeFileName($object->ref) : '') . '/';
if ($object->element == 'invoice_supplier') {
$relativepath = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier') . $relativepath;
}
// TODO Call using a defined value for $relativepath
if ($object->element == 'member') {
$relativepath = get_exdir($object->id, 2, 0, 0, $object, 'member') . $relativepath;
}
// TODO Call using a defined value for $relativepath
if ($object->element == 'project_task') {
$relativepath = 'Call_not_supported_._Call_function_using_a_defined_relative_path_.';
}
}
// For backward compatiblity, we detect file is stored into an old path
if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO) && $file['level1name'] == 'photos') {
$relativepath = preg_replace('/^.*\\/produit\\//', '', $file['path']) . '/';
}
$var = !$var;
print '<tr ' . $bc[$var] . '>';
print '<td>';
//print "XX".$file['name']; //$file['name'] must be utf8
print '<a data-ajax="false" href="' . DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart;
if ($forcedownload) {
print '&attachment=1';
}
if (!empty($object->entity)) {
print '&entity=' . $object->entity;
}
$filepath = $relativepath . $file['name'];
/* Restore old code: When file is at level 2+, full relative path (and not only level1) must be into url
if ($file['level1name'] <> $object->id)
$filepath=$object->id.'/'.$file['level1name'].'/'.$file['name'];
else
$filepath=$object->id.'/'.$file['name'];
*/
print '&file=' . urlencode($filepath);
print '">';
print img_mime($file['name'], $file['name'] . ' (' . dol_print_size($file['size'], 0, 0) . ')') . ' ';
if ($showrelpart == 1) {
print $relativepath;
}
print dol_trunc($file['name'], $maxlength, 'middle');
print '</a>';
print "</td>\n";
//.........这里部分代码省略.........
开发者ID:Samara94,项目名称:dolibarr,代码行数:101,代码来源:html.formfile.class.php
示例7: migrate_product_photospath
/**
* Migrate file from old path to new one for product $product
*
* @param Product $product Object product
* @return void
*/
function migrate_product_photospath($product)
{
global $conf;
$dir = $conf->product->multidir_output[$product->entity];
$origin = $dir . '/' . get_exdir($product->id, 2) . $product->id . "/photos";
$destin = $dir . '/' . dol_sanitizeFileName($product->ref);
$error = 0;
$origin_osencoded = dol_osencode($origin);
$destin_osencoded = dol_osencode($destin);
dol_mkdir($destin);
if (dol_is_dir($origin)) {
$handle = opendir($origin_osencoded);
if (is_resource($handle)) {
while (($file = readdir($handle)) != false) {
if ($file != '.' && $file != '..' && is_dir($origin_osencoded . '/' . $file)) {
$thumbs = opendir($origin_osencoded . '/' . $file);
if (is_resource($thumbs)) {
dol_mkdir($destin . '/' . $file);
while (($thumb = readdir($thumbs)) != false) {
dol_move($origin . '/' . $file . '/' . $thumb, $destin . '/' . $file . '/' . $thumb);
}
// dol_delete_dir($origin.'/'.$file);
}
} else {
if (dol_is_file($origin . '/' . $file)) {
dol_move($origin . '/' . $file, $destin . '/' . $file);
}
}
}
}
}
}
开发者ID:Albertopf,项目名称:prueba,代码行数:38,代码来源:migrate_picture_path.php
示例8: Add_PDF_card
function Add_PDF_card(&$pdf,$textleft,$header='',$footer='',$outputlangs,$textright='',$idmember,$photomember)
{
global $mysoc,$conf,$langs;
// We are in a new page, then we must add a page
if (($this->_COUNTX ==0) and ($this->_COUNTY==0) and (!$this->_First==1)) {
$pdf->AddPage();
}
$this->_First=0;
$_PosX = $this->_Margin_Left+($this->_COUNTX*($this->_Width+$this->_X_Space));
$_PosY = $this->_Margin_Top+($this->_COUNTY*($this->_Height+$this->_Y_Space));
// Define logo
$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
if (! is_readable($logo))
{
$logo='';
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
{
$logo=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
}
elseif (! empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
{
$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
}
}
// Define photo
$dir=$conf->adherent->dir_output;
$file=get_exdir($idmember,2).'photos/'.$photomember;
$photo=$dir.'/'.$file;
if (empty($photomember) || ! is_readable($photo)) $photo='';
// Define background image
$backgroundimage='';
if(! empty($conf->global->ADHERENT_CARD_BACKGROUND) && file_exists($conf->adherent->dir_output.'/'.$conf->global->ADHERENT_CARD_BACKGROUND))
{
$backgroundimage=$conf->adherent->dir_output.'/'.$conf->global->ADHERENT_CARD_BACKGROUND;
}
// Print lines
if ($this->code == "CARD")
{
$this->Tformat=$this->_Avery_Labels["CARD"];
//$this->_Pointille($pdf,$_PosX,$_PosY,$_PosX+$this->_Width,$_PosY+$this->_Height,0.3,25);
$this->_Croix($pdf,$_PosX,$_PosY,$_PosX+$this->_Width,$_PosY+$this->_Height,0.1,10);
}
// Background
if ($backgroundimage)
{
$pdf->image($backgroundimage,$_PosX,$_PosY,$this->_Width,$this->_Height);
}
// Top
if ($header!='')
{
if ($this->code == "CARD")
{
$pdf->SetDrawColor(128,128,128);
$pdf->Line($_PosX, $_PosY+$this->_Line_Height+1, $_PosX+$this->_Width, $_PosY+$this->_Line_Height+1);
$pdf->SetDrawColor(0,0,0);
}
$pdf->SetXY($_PosX, $_PosY+1);
$pdf->Cell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($header),0,1,'C');
}
// Center
if ($textright=='') // Only a left part
{
if ($textleft == '%LOGO%' && $logo) $this->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20);
else if ($textleft == '%PHOTO%' && $photo) $this->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20);
else
{
$pdf->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height);
$pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
}
}
else if ($textleft!='' && $textright!='') //
{
if ($textleft == '%LOGO%' || $textleft == '%PHOTO%')
{
if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20);
else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20);
$pdf->SetXY($_PosX+21, $_PosY+3+$this->_Line_Height);
$pdf->MultiCell($this->_Width-22, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R');
}
else if ($textright == '%LOGO%' || $textright == '%PHOTO%')
{
if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-21,$_PosY+3+$this->_Line_Height,20);
else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-21,$_PosY+3+$this->_Line_Height,20);
$pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height);
$pdf->MultiCell($this->_Width-22, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
}
else
{
$pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height);
$pdf->MultiCell(round($this->_Width/2), $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
$pdf->SetXY($_PosX+round($this->_Width/2), $_PosY+3+$this->_Line_Height);
$pdf->MultiCell(round($this->_Width/2)-2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R');
//.........这里部分代码省略.........
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:pdf_standard.class.php
示例9: setEventMessages
if (!$resql) {
$error ++;
setEventMessages($db->lasterror(), null, 'errors');
}
}
if (!$error && !count($object->errors)) {
if (GETPOST('deletephoto') && $object->photo) {
$fileimg = $conf->user->dir_output.'/'.get_exdir($object->id, 2, 0, 1, $object, 'user').'/logos/'.$object->photo;
$dirthumbs = $conf->user->dir_output.'/'.get_exdir($object->id, 2, 0, 1, $object, 'user').'/logos/thumbs';
dol_delete_file($fileimg);
dol_delete_dir_recursive($dirthumbs);
}
if (isset($_FILES['photo']['tmp_name']) && trim($_FILES['photo']['tmp_name'])) {
$dir = $conf->user->dir_output.'/'.get_exdir($object->id, 2, 0, 1, $object, 'user');
dol_mkdir($dir);
if (@is_dir($dir)) {
$newfile = $dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']);
$result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']);
if (!$result > 0) {
setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
} else {
// Create small thumbs for company (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality);
// Create mini thumbs for company (Ratio is near 16/9)
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:31,代码来源:card.php
示例10: __construct
/**
* Constructor
*
* @param array $options Options array
* @param int $fk_element fk_element
* @param string $element element
*/
function __construct($options = null, $fk_element = null, $element = null)
{
global $db, $conf;
global $object;
$this->fk_element = $fk_element;
$this->element = $element;
$pathname = $filename = $element;
if (preg_match('/^([^_]+)_([^_]+)/i', $element, $regs)) {
$pathname = $regs[1];
$filename = $regs[2];
}
$parentForeignKey = '';
// For compatibility
if ($element == 'propal') {
$pathname = 'comm/propal';
$dir_output = $conf->{$element}->dir_output;
} elseif ($element == 'facture') {
$pathname = 'compta/facture';
$dir_output = $conf->{$element}->dir_output;
} elseif ($element == 'project') {
$element = $pathname = 'projet';
$dir_output = $conf->{$element}->dir_output;
} elseif ($element == 'project_task') {
$pathname = 'projet';
$filename = 'task';
$dir_output = $conf->projet->dir_output;
$parentForeignKey = 'fk_project';
$parentClass = 'Project';
$parentElement = 'projet';
$parentObject = 'project';
} elseif ($element == 'fichinter') {
$element = 'ficheinter';
$dir_output = $conf->{$element}->dir_output;
} elseif ($element == 'order_supplier') {
$pathname = 'fourn';
$filename = 'fournisseur.commande';
$dir_output = $conf->fournisseur->commande->dir_output;
} elseif ($element == 'invoice_supplier') {
$pathname = 'fourn';
$filename = 'fournisseur.facture';
$dir_output = $conf->fournisseur->facture->dir_output;
} elseif ($element == 'product') {
$dir_output = $conf->product->multidir_output[$conf->entity];
} elseif ($element == 'action') {
$pathname = 'comm/action';
$filename = 'actioncomm';
$dir_output = $conf->agenda->dir_output;
} elseif ($element == 'chargesociales') {
$pathname = 'compta/sociales';
$filename = 'chargesociales';
$dir_output = $conf->tax->dir_output;
} else {
$dir_output = $conf->{$element}->dir_output;
}
dol_include_once('/' . $pathname . '/class/' . $filename . '.class.php');
$classname = ucfirst($filename);
if ($element == 'order_supplier') {
$classname = 'CommandeFournisseur';
} elseif ($element == 'invoice_supplier') {
$classname = 'FactureFournisseur';
}
$object = new $classname($db);
$object->fetch($fk_element);
if (!empty($parentForeignKey)) {
dol_include_once('/' . $parentElement . '/class/' . $parentObject . '.class.php');
$parent = new $parentClass($db);
$parent->fetch($object->{$parentForeignKey});
if (!empty($parent->socid)) {
$parent->fetch_thirdparty();
}
$object->{$parentObject} = dol_clone($parent);
} else {
$object->fetch_thirdparty();
}
$object_ref = dol_sanitizeFileName($object->ref);
if ($element == 'invoice_supplier') {
$object_ref = get_exdir($object->id, 2) . $object_ref;
} else {
if ($element == 'project_task') {
$object_ref = $object->project->ref . '/' . $object_ref;
}
}
$this->options = array('script_url' => $_SERVER['PHP_SELF'], 'upload_dir' => $dir_output . '/' . $object_ref . '/', 'upload_url' => DOL_URL_ROOT . '/document.php?modulepart=' . $element . '&attachment=1&file=/' . $object_ref . '/', 'param_name' => 'files', 'delete_type' => 'DELETE', 'max_file_size' => null, 'min_file_size' => 1, 'accept_file_types' => '/.+$/i', 'max_number_of_files' => null, 'max_width' => null, 'max_height' => null, 'min_width' => 1, 'min_height' => 1, 'discard_aborted_uploads' => true, 'image_versions' => array('thumbnail' => array('upload_dir' => $dir_output . '/' . $object_ref . '/thumbs/', 'upload_url' => DOL_URL_ROOT . '/document.php?modulepart=' . $element . '&attachment=1&file=/' . $object_ref . '/thumbs/', 'max_width' => 80, 'max_height' => 80)));
if ($options) {
$this->options = array_replace_recursive($this->options, $options);
}
}
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:94,代码来源:fileupload.class.php
示例11: if
if ($user->rights->don->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
$original_file=$conf->don->dir_output.'/'.$original_file;
}
// Wrapping pour les remises de cheques
else if ($modulepart == 'remisecheque')
{
if ($user->rights->banque->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
$original_file=$conf->banque->dir_output.'/bordereau/'.get_exdir(basename($original_file,".pdf"),2,1).$original_file;
}
// Wrapping for export module
else if ($modulepart == 'export')
{
// Aucun test necessaire car on force le rep de download sur
// le rep export qui est propre a l'utilisateur
$accessallowed=1;
$original_file=$conf->export->dir_temp.'/'.$user->id.'/'.$original_file;
}
// Wrapping for import module
else if ($modulepart == 'import')
{
// Aucun test necessaire car on force le rep de download sur
开发者ID:remyyounes,项目名称:dolibarr,代码行数:31,代码来源:document.php
示例12: write_file
/**
* Build document onto disk
*
* @param Object $object Object invoice to build (or id if old method)
* @param Translate $outputlangs Lang object for output language
* @return int 1=OK, 0=KO
*/
function write_file($object, $outputlangs = '')
{
global $user, $langs, $conf, $mysoc;
if (!is_object($outputlangs)) {
$outputlangs = $langs;
}
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!empty($conf->global->MAIN_USE_FPDF)) {
$outputlangs->charset_output = 'ISO-8859-1';
}
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("products");
$default_font_size = pdf_getPDFFontSize($outputlangs);
if ($conf->fournisseur->dir_output . '/facture') {
$object->fetch_thirdparty();
$deja_regle = $object->getSommePaiement();
//$amount_credit_notes_included = $object->getSumCreditNotesUsed();
//$amount_deposits_included = $object->getSumDepositsUsed();
// Definition de $dir et $file
if ($object->specimen) {
$dir = $conf->fournisseur->facture->dir_output;
$file = $dir . "/SPECIMEN.pdf";
} else {
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->fournisseur->facture->dir_output . '/' . get_exdir($object->id, 2) . $objectref;
$file = $dir . "/" . $objectref . ".pdf";
}
if (!file_exists($dir)) {
if (dol_mkdir($dir) < 0) {
$this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
return 0;
}
}
if (file_exists($dir)) {
$nblignes = count($object->lines);
$pdf = pdf_getInstance($this->format);
if (class_exists('TCPDF')) {
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output . '/' . $conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}
$pdf->Open();
$pagenb = 0;
$pdf->SetDrawColor(128, 128, 128);
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Invoice"));
$pdf->SetCreator("Dolibarr " . DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref) . " " . $outputlangs->transnoentities("Order"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) {
$pdf->SetCompression(false);
}
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
// Left, Top, Right
$pdf->SetAutoPageBreak(1, 0);
// Positionne $this->atleastonediscount si on a au moins une remise
for ($i = 0; $i < $nblignes; $i++) {
if ($object->lines[$i]->remise_percent) {
$this->atleastonediscount++;
}
}
// New page
$pdf->AddPage();
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->MultiCell(0, 3, '');
// Set interline to 3
$pdf->SetTextColor(0, 0, 0);
$tab_top = 90;
$tab_top_newpage = 50;
$tab_height = 110;
$tab_height_newpage = 150;
// Affiche notes
if (!empty($object->note_public)) {
$tab_top = 88;
$pdf->SetFont('', '', $default_font_size - 1);
// Dans boucle pour gerer multi-page
$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
$nexY = $pdf->GetY();
$height_note = $nexY - $tab_top;
// Rect prend une longueur en 3eme param
//.........这里部分代码省略.........
开发者ID:nrjacker4,项目名称:crm-php,代码行数:101,代码来源:pdf_canelle.modules.php
示例13: write_file
|
请发表评论