本文整理汇总了PHP中dol_sanitizeFileName函数的典型用法代码示例。如果您正苦于以下问题:PHP dol_sanitizeFileName函数的具体用法?PHP dol_sanitizeFileName怎么用?PHP dol_sanitizeFileName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dol_sanitizeFileName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fichinter_prepare_head
/**
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to show
*/
function fichinter_prepare_head($object)
{
global $langs, $conf, $user;
$langs->load("fichinter");
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT . '/fichinter/card.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
$head[$h][0] = DOL_URL_ROOT . '/fichinter/contact.php?id=' . $object->id;
$head[$h][1] = $langs->trans('InterventionContact');
$head[$h][2] = 'contact';
$h++;
}
if (!empty($conf->global->MAIN_USE_PREVIEW_TABS)) {
$head[$h][0] = DOL_URL_ROOT . '/fichinter/apercu.php?id=' . $object->id;
$head[$h][1] = $langs->trans('Preview');
$head[$h][2] = 'preview';
$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, 'intervention');
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 . '/fichinter/note.php?id=' . $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';
$upload_dir = $conf->ficheinter->dir_output . "/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\\.meta|_preview\\.png)$'));
$head[$h][0] = DOL_URL_ROOT . '/fichinter/document.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Documents");
if ($nbFiles > 0) {
$head[$h][1] .= ' <span class="badge">' . $nbFiles . '</span>';
}
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT . '/fichinter/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, 'intervention', 'remove');
return $head;
}
示例2: holiday_prepare_head
/**
* Return array head with list of tabs to view object informations
*
* @param Object $object Holiday
* @return array head
*/
function holiday_prepare_head($object)
{
global $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT . '/holiday/card.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
// Attachments
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$upload_dir = $conf->holiday->multidir_output[$object->entity] . '/' . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\\.meta|_preview\\.png)$'));
$head[$h][0] = DOL_URL_ROOT . '/holiday/document.php?id=' . $object->id;
$head[$h][1] = $langs->trans('Documents');
if ($nbFiles > 0) {
$head[$h][1] .= ' <span class="badge">' . $nbFiles . '</span>';
}
$head[$h][2] = 'documents';
$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, 'holiday');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday', 'remove');
return $head;
}
示例3: 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;
}
示例4: tax_prepare_head
/**
* Prepare array with list of tabs
*
* @param ChargeSociales $object Object related to tabs
* @return array Array of tabs to show
*/
function tax_prepare_head(ChargeSociales $object)
{
global $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT . '/compta/sociales/charges.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, 'tax');
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$upload_dir = $conf->tax->dir_output . "/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\\.meta|_preview\\.png)$'));
$head[$h][0] = DOL_URL_ROOT . '/compta/sociales/document.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Documents");
if ($nbFiles > 0) {
$head[$h][1] .= ' <span class="badge">' . $nbFiles . '</span>';
}
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT . '/compta/sociales/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, 'tax', 'remove');
return $head;
}
示例5: contact_prepare_head
/**
* Prepare array with list of tabs
*
* @param Contact $object Object related to tabs
* @return array Array of tabs to show
*/
function contact_prepare_head(Contact $object)
{
global $db, $langs, $conf, $user;
$tab = 0;
$head = array();
$head[$tab][0] = DOL_URL_ROOT . '/contact/card.php?id=' . $object->id;
$head[$tab][1] = $langs->trans("Card");
$head[$tab][2] = 'card';
$tab++;
if (!empty($conf->ldap->enabled) && !empty($conf->global->LDAP_CONTACT_ACTIVE)) {
$langs->load("ldap");
$head[$tab][0] = DOL_URL_ROOT . '/contact/ldap.php?id=' . $object->id;
$head[$tab][1] = $langs->trans("LDAPCard");
$head[$tab][2] = 'ldap';
$tab++;
}
$head[$tab][0] = DOL_URL_ROOT . '/contact/perso.php?id=' . $object->id;
$head[$tab][1] = $langs->trans("PersonalInformations");
$head[$tab][2] = 'perso';
$tab++;
// 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, $tab, 'contact');
// Notes
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
$nbNote = (empty($object->note_private) ? 0 : 1) + (empty($object->note_public) ? 0 : 1);
$head[$tab][0] = DOL_URL_ROOT . '/contact/note.php?id=' . $object->id;
$head[$tab][1] = $langs->trans("Note");
if ($nbNote > 0) {
$head[$tab][1] .= ' <span class="badge">' . $nbNote . '</span>';
}
$head[$tab][2] = 'note';
$tab++;
}
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$upload_dir = $conf->societe->dir_output . "/contact/" . 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[$tab][0] = DOL_URL_ROOT . '/contact/document.php?id=' . $object->id;
$head[$tab][1] = $langs->trans("Documents");
if ($nbFiles + $nbLinks > 0) {
$head[$tab][1] .= ' <span class="badge">' . ($nbFiles + $nbLinks) . '</span>';
}
$head[$tab][2] = 'documents';
$tab++;
// Info
$head[$tab][0] = DOL_URL_ROOT . '/contact/info.php?id=' . $object->id;
$head[$tab][1] = $langs->trans("Info");
$head[$tab][2] = 'info';
$tab++;
complete_head_from_modules($conf, $langs, $object, $head, $tab, 'contact', 'remove');
return $head;
}
示例6: bank_prepare_head
/**
* Prepare array with list of tabs
*
* @param Account $object Object related to tabs
* @return array Array of tabs to show
*/
function bank_prepare_head(Account $object)
{
global $db, $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT . '/compta/bank/card.php?id=' . $object->id;
$head[$h][1] = $langs->trans("AccountCard");
$head[$h][2] = 'bankname';
$h++;
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/account.php?id=" . $object->id;
$head[$h][1] = $langs->trans("Transactions");
$head[$h][2] = 'journal';
$h++;
// if ($conf->global->MAIN_FEATURES_LEVEL >= 1)
// {
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/treso.php?account=" . $object->id;
$head[$h][1] = $langs->trans("PlannedTransactions");
$head[$h][2] = 'cash';
$h++;
// }
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/annuel.php?account=" . $object->id;
$head[$h][1] = $langs->trans("IOMonthlyReporting");
$head[$h][2] = 'annual';
$h++;
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/graph.php?account=" . $object->id;
$head[$h][1] = $langs->trans("Graph");
$head[$h][2] = 'graph';
$h++;
if ($object->courant != 2) {
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/releve.php?account=" . $object->id;
$head[$h][1] = $langs->trans("AccountStatements");
$head[$h][2] = 'statement';
$h++;
}
// Attached files
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$upload_dir = $conf->bank->dir_output . "/" . 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 . "/compta/bank/document.php?account=" . $object->id;
$head[$h][1] = $langs->trans("Documents");
if ($nbFiles + $nbLinks > 0) {
$head[$h][1] .= ' <span class="badge">' . ($nbFiles + $nbLinks) . '</span>';
}
$head[$h][2] = 'document';
$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, 'bank');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank', 'remove');
return $head;
}
示例7: contract_prepare_head
/**
* Prepare array with list of tabs
*
* @param Contrat $object Object related to tabs
* @return array Array of tabs to show
*/
function contract_prepare_head(Contrat $object)
{
global $db, $langs, $conf;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT . '/contrat/card.php?id=' . $object->id;
$head[$h][1] = $langs->trans("ContractCard");
$head[$h][2] = 'card';
$h++;
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
$head[$h][0] = DOL_URL_ROOT . '/contrat/contact.php?id=' . $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, 'contract');
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 . '/contrat/note.php?id=' . $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->contrat->dir_output . "/" . 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 . '/contrat/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 . '/contrat/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, 'contract', 'remove');
return $head;
}
示例8: loan_prepare_head
/**
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to show
*/
function loan_prepare_head($object)
{
global $langs, $conf;
$tab = 0;
$head = array();
$head[$tab][0] = DOL_URL_ROOT . '/loan/card.php?id=' . $object->id;
$head[$tab][1] = $langs->trans('Card');
$head[$tab][2] = 'card';
$tab++;
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
$nbNote = (empty($object->note_private) ? 0 : 1) + (empty($object->note_public) ? 0 : 1);
$head[$tab][0] = DOL_URL_ROOT . "/loan/note.php?id=" . $object->id;
$head[$tab][1] = $langs->trans("Notes");
if ($nbNote > 0) {
$head[$tab][1] .= ' <span class="badge">' . $nbNote . '</span>';
}
$head[$tab][2] = 'note';
$tab++;
}
// 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, $tab, 'loan');
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$upload_dir = $conf->loan->dir_output . "/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\\.meta|_preview\\.png)$'));
$head[$tab][0] = DOL_URL_ROOT . '/loan/document.php?id=' . $object->id;
$head[$tab][1] = $langs->trans("Documents");
if ($nbFiles > 0) {
$head[$tab][1] .= ' <span class="badge">' . $nbFiles . '</span>';
}
$head[$tab][2] = 'documents';
$tab++;
$head[$tab][0] = DOL_URL_ROOT . '/loan/info.php?id=' . $object->id;
$head[$tab][1] = $langs->trans("Info");
$head[$tab][2] = 'info';
$tab++;
complete_head_from_modules($conf, $langs, $object, $head, $tab, 'loan', 'remove');
return $head;
}
示例9: createFromClone
//.........这里部分代码省略.........
if ($result < 0) {
$this->error = $clone_task->error;
$error++;
}
// End
if (!$error) {
$clone_task_id = $clone_task->id;
$clone_task_ref = $clone_task->ref;
//Note Update
if (!$clone_note) {
$clone_task->note_private = '';
$clone_task->note_public = '';
} else {
$this->db->begin();
$res = $clone_task->update_note(dol_html_entity_decode($clone_task->note_public, ENT_QUOTES), '_public');
if ($res < 0) {
$this->error .= $clone_task->error;
$error++;
$this->db->rollback();
} else {
$this->db->commit();
}
$this->db->begin();
$res = $clone_task->update_note(dol_html_entity_decode($clone_task->note_private, ENT_QUOTES), '_private');
if ($res < 0) {
$this->error .= $clone_task->error;
$error++;
$this->db->rollback();
} else {
$this->db->commit();
}
}
//Duplicate file
if ($clone_file) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
//retreive project origin ref to know folder to copy
$projectstatic = new Project($this->db);
$projectstatic->fetch($ori_project_id);
$ori_project_ref = $projectstatic->ref;
if ($ori_project_id != $project_id) {
$projectstatic->fetch($project_id);
$clone_project_ref = $projectstatic->ref;
} else {
$clone_project_ref = $ori_project_ref;
}
$clone_task_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($clone_project_ref) . "/" . dol_sanitizeFileName($clone_task_ref);
$ori_task_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($ori_project_ref) . "/" . dol_sanitizeFileName($fromid);
$filearray = dol_dir_list($ori_task_dir, "files", 0, '', '(\\.meta|_preview\\.png)$', '', SORT_ASC, 1);
foreach ($filearray as $key => $file) {
if (!file_exists($clone_task_dir)) {
if (dol_mkdir($clone_task_dir) < 0) {
$this->error .= $langs->trans('ErrorInternalErrorDetected') . ':dol_mkdir';
$error++;
}
}
$rescopy = dol_copy($ori_task_dir . '/' . $file['name'], $clone_task_dir . '/' . $file['name'], 0, 1);
if (is_numeric($rescopy) && $rescopy < 0) {
$this->error .= $langs->trans("ErrorFailToCopyFile", $ori_task_dir . '/' . $file['name'], $clone_task_dir . '/' . $file['name']);
$error++;
}
}
}
// clone affectation
if ($clone_affectation) {
$origin_task = new Task($this->db);
$origin_task->fetch($fromid);
foreach (array('internal', 'external') as $source) {
$tab = $origin_task->liste_contact(-1, $source);
$num = count($tab);
$i = 0;
while ($i < $num) {
$clone_task->add_contact($tab[$i]['id'], $tab[$i]['code'], $tab[$i]['source']);
if ($clone_task->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors");
$this->error .= $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType");
$error++;
} else {
if ($clone_task->error != '') {
$this->error .= $clone_task->error;
$error++;
}
}
$i++;
}
}
}
if ($clone_time) {
//TODO clone time of affectation
}
}
unset($clone_task->context['createfromclone']);
if (!$error) {
$this->db->commit();
return $clone_task_id;
} else {
$this->db->rollback();
dol_syslog(get_class($this) . "::createFromClone nbError: " . $error . " error : " . $this->error, LOG_ERR);
return -1;
}
}
示例10: dol_sanitizeFileName
$object->default_lang = $_POST["default_lang"];
$object->logo = dol_sanitizeFileName($_FILES['photo']['name']);
// Gestion du logo de la société
$dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos";
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
if ($file_OK)
{
if (image_format_supported($_FILES['photo']['name']))
{
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);
if (! $result > 0)
{
$errors[] = "ErrorFailedToSaveFile";
}
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)
// Used on menu or for setup page for example
$imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality);
示例11: 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("trips");
$outputlangs->load("project");
$nblignes = count($object->lines);
if ($conf->expensereport->dir_output) {
// Definition of $dir and $file
if ($object->specimen) {
$dir = $conf->expensereport->dir_output;
$file = $dir . "/SPECIMEN.pdf";
} else {
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->expensereport->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 (isset($object->lignes) && !isset($object->lines)) {
$object->lines = $object->lignes;
}
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
// 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);
}
$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_number));
$pdf->SetSubject($outputlangs->transnoentities("Trips"));
$pdf->SetCreator("Dolibarr " . DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref) . " " . $outputlangs->transnoentities("Trips"));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) {
$pdf->SetCompression(false);
}
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
// Left, Top, Right
// 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);
//.........这里部分代码省略.........
示例12: dol_sanitizeFileName
</legend>
<label for="filename_template"> <?php
echo $langs->trans("FileNameToGenerate");
?>
</label>:
<input type="text" name="filename_template" size="60"
id="filename_template"
value="<?php
$prefix = 'dump';
if ($label == 'MySQL') {
$prefix = 'mysqldump';
}
if ($label == 'PostgreSQL') {
$prefix = 'pg_dump';
}
$file = $prefix . '_' . $dolibarr_main_db_name . '_' . dol_sanitizeFileName(DOL_VERSION) . '_' . strftime("%Y%m%d%H%M") . '.sql';
echo $file;
?>
" /> <br>
<br>
<?php
// Define compressions array
$compression = array('none' => array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("None")), 'gz' => array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")));
if ($label == 'MySQL') {
// $compression['zip']= array('function' => 'dol_compress', 'id' => 'radio_compression_zip', 'label' => $langs->trans("FormatZip")); // Not open source format. Must implement dol_compress function
$compression['bz'] = array('function' => 'bzopen', 'id' => 'radio_compression_bzip', 'label' => $langs->trans("Bzip2"));
}
// Show compression choices
print '<div class="formelementrow">';
print "\n";
示例13: Project
$projectstatic = new Project($db);
while ($i < min($num, $conf->liste_limit)) {
$obj = $db->fetch_object($resql);
$var = !$var;
$objectstatic->id = $obj->rowid;
$objectstatic->ref = $obj->ref;
$objectstatic->ref_supplier = $obj->ref_supplier;
$objectstatic->total_ht = $obj->total_ht;
$objectstatic->total_tva = $obj->total_tva;
$objectstatic->total_ttc = $obj->total_ttc;
print "<tr " . $bc[$var] . ">";
// Ref
print '<td class="nobordernopadding nowrap">';
print $objectstatic->getNomUrl(1);
$filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->fournisseur->dir_output . '/commande' . '/' . dol_sanitizeFileName($obj->ref);
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
print '</td>' . "\n";
// Ref Supplier
if (empty($conf->global->SUPPLIER_ORDER_HIDE_REF_SUPPLIER)) {
print '<td>' . $obj->ref_supplier . '</td>' . "\n";
}
// Thirdparty
print '<td>';
$thirdpartytmp->id = $obj->socid;
$thirdpartytmp->name = $obj->name;
print $thirdpartytmp->getNomUrl(1, 'supplier');
print '</td>' . "\n";
// Project
if (!empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS)) {
$projectstatic->id = $obj->project_id;
示例14: dol_print_error
} else {
dol_print_error($db);
}
dol_fiche_end();
}
/*
* Boutons Actions
*/
print '<div class="tabsAction">';
/*if ($user->societe_id == 0 && count($accounts) == 1 && $action == 'new' && $user->rights->banque->cheque)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=create&accountid='.$account_id.'">'.$langs->trans('NewCheckReceipt').'</a>';
}*/
if ($user->societe_id == 0 && !empty($object->id) && $object->statut == 0 && $user->rights->banque->cheque) {
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=valide&sortfield=' . $sortfield . '&sortorder=' . $sortorder . '">' . $langs->trans('Valid') . '</a>';
}
if ($user->societe_id == 0 && !empty($object->id) && $user->rights->banque->cheque) {
print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete&sortfield=' . $sortfield . '&sortorder=' . $sortorder . '">' . $langs->trans('Delete') . '</a>';
}
print '</div>';
if ($action != 'new') {
if ($object->statut == 1) {
$filename = dol_sanitizeFileName($object->ref);
$filedir = $dir . get_exdir($object->number, 2, 1) . dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
$formfile->show_documents('remisecheque', $filename, $filedir, $urlsource, 1, 1);
print '<br>';
}
}
$db->close();
llxFooter();
示例15: img_warning
print $objectstatic->getNomUrl(1);
print '</td>';
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
if ($objp->fk_statut == 1 && $db->jdate($objp->dfv) < $now - $conf->propal->cloture->warning_delay) {
print img_warning($langs->trans("Late"));
}
if (!empty($objp->note_private)) {
print ' <span class="note">';
print '<a href="' . DOL_URL_ROOT . '/comm/propal/note.php?id=' . $objp->propalid . '">' . img_picto($langs->trans("ViewPrivateNote"), 'object_generic') . '</a>';
print '</span>';
}
print '</td>';
// Ref
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
$filename = dol_sanitizeFileName($objp->ref);
$filedir = $conf->propal->dir_output . '/' . dol_sanitizeFileName($objp->ref);
$urlsource = $_SERVER['PHP_SELF'] . '?id=' . $objp->propalid;
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
print '</td></tr></table>';
print "</td>\n";
// Customer ref
print '<td class="nocellnopadd nowrap">';
print $objp->ref_client;
print '</td>';
$url = DOL_URL_ROOT . '/comm/card.php?socid=' . $objp->rowid;
// Company
$companystatic->id = $objp->rowid;
$companystatic->name = $objp->name;
$companystatic->client = $objp->client;
$companystatic->code_client = $objp->code_client;
print '<td>';