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


PHP complete_substitutions_array函数代码示例

本文整理汇总了PHP中complete_substitutions_array函数的典型用法代码示例。如果您正苦于以下问题:PHP complete_substitutions_array函数的具体用法?PHP complete_substitutions_array怎么用?PHP complete_substitutions_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: makeSubstitution

 /**
  * Make substitution
  *
  * @param	$object				Adherent Object
  * @return  string      		Value of input text string with substitutions done
  */
 function makeSubstitution($object)
 {
     global $conf, $langs;
     $text = $this->body;
     $birthday = dol_print_date($object->naiss, 'day');
     $msgishtml = 0;
     if (dol_textishtml($text, 1)) {
         $msgishtml = 1;
     }
     $infos = '';
     // Specific for Photo
     $photoName = $object->photo;
     $photoType = $object->_attachments->{$photoName}->content_type;
     $photoBase64 = $object->getFileBase64($object->photo);
     $photo = '<img src="data:' . $PhotoType . ';base64,' . $photoBase64 . '"/>';
     // Substitutions
     $substitutionarray = array('__DOL_MAIN_URL_ROOT__' => DOL_MAIN_URL_ROOT, '__ID__' => $msgishtml ? dol_htmlentitiesbr($object->login) : $object->login, '__CIVILITE__' => $object->getCivilityLabel($msgishtml ? 0 : 1), '__FIRSTNAME__' => $msgishtml ? dol_htmlentitiesbr($object->Firstname) : $object->Firstname, '__LASTNAME__' => $msgishtml ? dol_htmlentitiesbr($object->Lastname) : $object->Lastname, '__FULLNAME__' => $msgishtml ? dol_htmlentitiesbr($object->getFullName($langs)) : $object->getFullName($langs), '__COMPANY__' => $msgishtml ? dol_htmlentitiesbr($object->societe) : $object->societe, '__ADDRESS__' => $msgishtml ? dol_htmlentitiesbr($object->address) : $object->address, '__ZIP__' => $msgishtml ? dol_htmlentitiesbr($object->zip) : $object->zip, '__TOWN__' => $msgishtml ? dol_htmlentitiesbr($object->town) : $object->town, '__COUNTRY__' => $msgishtml ? dol_htmlentitiesbr($object->country) : $object->country, '__EMAIL__' => $msgishtml ? dol_htmlentitiesbr($object->email) : $object->email, '__NAISS__' => $msgishtml ? dol_htmlentitiesbr($birthday) : $birthday, '__PHOTO__' => $photo, '__LOGIN__' => $msgishtml ? dol_htmlentitiesbr($object->login) : $object->login, '__PASSWORD__' => $msgishtml ? dol_htmlentitiesbr($object->pass) : $object->pass, '__STATUS__' => $object->getLibStatus(), '__INFOS__' => $msgishtml ? dol_htmlentitiesbr($infos) : $infos, '__PRENOM__' => $msgishtml ? dol_htmlentitiesbr($object->Firstname) : $object->Firstname, '__NOM__' => $msgishtml ? dol_htmlentitiesbr($object->Lastname) : $object->Lastname, '__SOCIETE__' => $msgishtml ? dol_htmlentitiesbr($object->societe) : $object->societe, '__ADRESSE__' => $msgishtml ? dol_htmlentitiesbr($object->address) : $object->address, '__CP__' => $msgishtml ? dol_htmlentitiesbr($object->zip) : $object->zip, '__VILLE__' => $msgishtml ? dol_htmlentitiesbr($object->town) : $object->town, '__PAYS__' => $msgishtml ? dol_htmlentitiesbr($object->country) : $object->country);
     complete_substitutions_array($substitutionarray, $langs);
     $this->body = make_substitutions($text, $substitutionarray);
     return 1;
 }
开发者ID:nrjacker4,项目名称:crm-php,代码行数:27,代码来源:adherent_card.class.php

示例2: write_file

 /**
  *	Function to build a document on disk using the generic odt module.
  *
  *	@param	Societe		$object				Object source to build document
  *	@param	Translate	$outputlangs		Lang output object
  * 	@param	string		$srctemplatepath	Full path of source filename for generator using a template file
  *	@return	int         					1 if OK, <=0 if KO
  */
 function write_file($object, $outputlangs, $srctemplatepath)
 {
     global $user, $langs, $conf, $mysoc;
     if (empty($srctemplatepath)) {
         dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
         return -1;
     }
     if (!is_object($outputlangs)) {
         $outputlangs = $langs;
     }
     $sav_charset_output = $outputlangs->charset_output;
     $outputlangs->charset_output = 'UTF-8';
     $outputlangs->load("main");
     $outputlangs->load("dict");
     $outputlangs->load("companies");
     $outputlangs->load("projects");
     if ($conf->contrat->dir_output) {
         $soc = new Societe($this->db);
         $soc->fetch($object->socid);
         $dir = $conf->contrat->dir_output;
         $objectref = dol_sanitizeFileName($object->ref);
         if (!preg_match('/specimen/i', $objectref)) {
             $dir .= "/" . $objectref;
         }
         if (!file_exists($dir)) {
             if (create_exdir($dir) < 0) {
                 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
                 return -1;
             }
         }
         if (file_exists($dir)) {
             //print "srctemplatepath=".$srctemplatepath;	// Src filename
             $newfile = basename($srctemplatepath);
             $newfiletmp = preg_replace('/\\.odt/i', '', $newfile);
             $newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
             $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
             $file = $dir . '/' . $newfiletmp . '.' . dol_print_date(dol_now(), '%Y%m%d%H%M%S') . '.odt';
             //print "newdir=".$dir;
             //print "newfile=".$newfile;
             //print "file=".$file;
             //print "conf->societe->dir_temp=".$conf->societe->dir_temp;
             create_exdir($conf->contrat->dir_temp);
             // If BILLING contact defined on invoice, we use it
             $usecontact = false;
             $arrayidcontact = $object->getIdContact('external', 'SALESREPSIGN');
             if (count($arrayidcontact) > 0) {
                 $usecontact = true;
                 $result = $soc->fetch_contact($arrayidcontact[0]);
             }
             // Recipient name
             if (!empty($usecontact)) {
                 // On peut utiliser le nom de la societe du contact
                 if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) {
                     $socobject = $object->contact;
                 } else {
                     $socobject = $soc->client;
                 }
             } else {
                 $socobject = $soc->client;
             }
             // Make substitution
             $substitutionarray = array('__FROM_NAME__' => $this->emetteur->nom, '__FROM_EMAIL__' => $this->emetteur->email, '__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_HT__' => $object->total_ht, '__TOTAL_VAT__' => $object->total_vat, 'date' => dol_print_date($object->date_contrat, "%d %b %Y"));
             complete_substitutions_array($substitutionarray, $langs, $object);
             // Open and load template
             require_once ODTPHP_PATH . 'odf.php';
             $odfHandler = new odf($srctemplatepath, array('PATH_TO_TMP' => $conf->contrat->dir_temp, 'ZIP_PROXY' => 'PclZipProxy', 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}'));
             //print $odfHandler->__toString()."\n";
             //
             foreach ($substitutionarray as $key => $value) {
                 try {
                     if (preg_match('/logo$/', $key)) {
                         //var_dump($value);exit;
                         if (file_exists($value)) {
                             $odfHandler->setImage($key, $value);
                         } else {
                             $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
                         }
                     } else {
                         //print $key.' '.$value;exit;
                         $odfHandler->setVars($key, $value, true, 'UTF-8');
                     }
                 } catch (OdfException $e) {
                 }
             }
             // Make substitutions into odt of user info
             $tmparray = $this->get_substitutionarray_user($user, $outputlangs);
             //var_dump($tmparray); exit;
             foreach ($tmparray as $key => $value) {
                 try {
                     if (preg_match('/logo$/', $key)) {
                         //var_dump($value);exit;
                         if (file_exists($value)) {
//.........这里部分代码省略.........
开发者ID:nrjacker4,项目名称:crm-php,代码行数:101,代码来源:doc_generic_contract_odt.modules.php

示例3: pdf_pagefoot

/**
 *  Show footer of page for PDF generation
 *
 *	@param	PDF			$pdf     		The PDF factory
 *  @param  Translate	$outputlangs	Object lang for output
 * 	@param	string		$paramfreetext	Constant name of free text
 * 	@param	Societe		$fromcompany	Object company
 * 	@param	int			$marge_basse	Margin bottom we use for the autobreak
 * 	@param	int			$marge_gauche	Margin left (no more used)
 * 	@param	int			$page_hauteur	Page height (no more used)
 * 	@param	Object		$object			Object shown in PDF
 * 	@param	int			$showdetails	Show company details into footer. This param seems to not be used by standard version. (1=Show address, 2=Show managers, 3=Both)
 *  @param	int			$hidefreetext	1=Hide free text, 0=Show free text
 * 	@return	int							Return height of bottom margin including footer text
 */
function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails = 0, $hidefreetext = 0)
{
    global $conf, $user;
    $outputlangs->load("dict");
    $line = '';
    $dims = $pdf->getPageDimensions();
    // Line of free text
    if (empty($hidefreetext) && !empty($conf->global->{$paramfreetext})) {
        // Make substitution
        $substitutionarray = array('__FROM_NAME__' => $fromcompany->name, '__FROM_EMAIL__' => $fromcompany->email, '__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_HT__' => $object->total_ht, '__TOTAL_VAT__' => $object->total_vat);
        complete_substitutions_array($substitutionarray, $outputlangs, $object);
        $newfreetext = make_substitutions($conf->global->{$paramfreetext}, $substitutionarray);
        $line .= $outputlangs->convToOutputCharset($newfreetext);
    }
    // First line of company infos
    $line1 = "";
    $line2 = "";
    $line3 = "";
    $line4 = "";
    if ($showdetails) {
        // Company name
        if ($fromcompany->name) {
            $line1 .= ($line1 ? " - " : "") . $outputlangs->transnoentities("RegisteredOffice") . ": " . $fromcompany->name;
        }
        // Address
        if ($fromcompany->address) {
            $line1 .= ($line1 ? " - " : "") . $fromcompany->address;
        }
        // Zip code
        if ($fromcompany->zip) {
            $line1 .= ($line1 ? " - " : "") . $fromcompany->zip;
        }
        // Town
        if ($fromcompany->town) {
            $line1 .= ($line1 ? " " : "") . $fromcompany->town;
        }
        // Phone
        if ($fromcompany->phone) {
            $line1 .= ($line1 ? " - " : "") . $outputlangs->transnoentities("Phone") . ": " . $fromcompany->phone;
        }
        // Fax
        if ($fromcompany->fax) {
            $line1 .= ($line1 ? " - " : "") . $outputlangs->transnoentities("Fax") . ": " . $fromcompany->fax;
        }
        // URL
        if ($fromcompany->url) {
            $line2 .= ($line2 ? " - " : "") . $fromcompany->url;
        }
        // Email
        if ($fromcompany->email) {
            $line2 .= ($line2 ? " - " : "") . $fromcompany->email;
        }
    }
    if ($showdetails || $fromcompany->country_code == 'DE') {
        // Managers
        if ($fromcompany->managers) {
            $line2 .= ($line2 ? " - " : "") . $fromcompany->managers;
        }
    }
    // Line 3 of company infos
    // Juridical status
    if ($fromcompany->forme_juridique_code) {
        $line3 .= ($line3 ? " - " : "") . $outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
    }
    // Capital
    if ($fromcompany->capital) {
        $tmpamounttoshow = price2num($fromcompany->capital);
        // This field is a free string
        if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) {
            $line3 .= ($line3 ? " - " : "") . $outputlangs->transnoentities("CapitalOf", price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency));
        } else {
            $line3 .= ($line3 ? " - " : "") . $outputlangs->transnoentities("CapitalOf", $tmpamounttoshow, $outputlangs);
        }
    }
    // Prof Id 1
    if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) {
        $field = $outputlangs->transcountrynoentities("ProfId1", $fromcompany->country_code);
        if (preg_match('/\\((.*)\\)/i', $field, $reg)) {
            $field = $reg[1];
        }
        $line3 .= ($line3 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof1);
    }
    // Prof Id 2
    if ($fromcompany->idprof2) {
        $field = $outputlangs->transcountrynoentities("ProfId2", $fromcompany->country_code);
//.........这里部分代码省略.........
开发者ID:Samara94,项目名称:dolibarr,代码行数:101,代码来源:pdf.lib.php

示例4: makeSubstitution

 /**
  * Make substitution
  * @param       text        Text to make substitution to
  * @return      string      Value of input text string with substitutions done
  */
 function makeSubstitution($text)
 {
     global $langs;
     $birthday = dol_print_date($this->naiss, 'day');
     $msgishtml = 0;
     if (dol_textishtml($text, 1)) {
         $msgishtml = 1;
     }
     $infos = '';
     if ($this->civilite_id) {
         $infos .= $langs->transnoentities("UserTitle") . ": " . $this->getCivilityLabel(1) . "\n";
     }
     $infos .= $langs->transnoentities("id") . ": " . $this->id . "\n";
     $infos .= $langs->transnoentities("Lastname") . ": " . $this->nom . "\n";
     $infos .= $langs->transnoentities("Firstname") . ": " . $this->prenom . "\n";
     $infos .= $langs->transnoentities("Company") . ": " . $this->societe . "\n";
     $infos .= $langs->transnoentities("Address") . ": " . $this->adresse . "\n";
     $infos .= $langs->transnoentities("Zip") . ": " . $this->cp . "\n";
     $infos .= $langs->transnoentities("Town") . ": " . $this->ville . "\n";
     $infos .= $langs->transnoentities("Country") . ": " . $this->pays . "\n";
     $infos .= $langs->transnoentities("EMail") . ": " . $this->email . "\n";
     $infos .= $langs->transnoentities("Login") . ": " . $this->login . "\n";
     $infos .= $langs->transnoentities("Password") . ": " . $this->pass . "\n";
     $infos .= $langs->transnoentities("Birthday") . ": " . $birthday . "\n";
     $infos .= $langs->transnoentities("Photo") . ": " . $this->photo . "\n";
     $infos .= $langs->transnoentities("Public") . ": " . yn($this->public);
     // Substitutions
     $substitutionarray = array('%DOL_MAIN_URL_ROOT%' => DOL_MAIN_URL_ROOT, '%ID%' => $msgishtml ? dol_htmlentitiesbr($this->id) : $this->id, '%INFOS%' => $msgishtml ? dol_htmlentitiesbr($infos) : $infos, '%CIVILITE%' => $this->getCivilityLabel($msgishtml ? 0 : 1), '%PRENOM%' => $msgishtml ? dol_htmlentitiesbr($this->prenom) : $this->prenom, '%NOM%' => $msgishtml ? dol_htmlentitiesbr($this->nom) : $this->nom, '%SOCIETE%' => $msgishtml ? dol_htmlentitiesbr($this->societe) : $this->societe, '%ADRESSE%' => $msgishtml ? dol_htmlentitiesbr($this->adresse) : $this->adresse, '%CP%' => $msgishtml ? dol_htmlentitiesbr($this->cp) : $this->cp, '%VILLE%' => $msgishtml ? dol_htmlentitiesbr($this->ville) : $this->ville, '%PAYS%' => $msgishtml ? dol_htmlentitiesbr($this->pays) : $this->pays, '%EMAIL%' => $msgishtml ? dol_htmlentitiesbr($this->email) : $this->email, '%NAISS%' => $msgishtml ? dol_htmlentitiesbr($birthday) : $birthday, '%PHOTO%' => $msgishtml ? dol_htmlentitiesbr($this->photo) : $this->photo, '%LOGIN%' => $msgishtml ? dol_htmlentitiesbr($this->login) : $this->login, '%PASSWORD%' => $msgishtml ? dol_htmlentitiesbr($this->pass) : $this->pass);
     complete_substitutions_array($substitutionarray, $langs);
     return make_substitutions($text, $substitutionarray);
 }
开发者ID:ripasch,项目名称:dolibarr,代码行数:36,代码来源:adherent.class.php

示例5: complete_substitutions_array

        $action = 'test';
        $error++;
    }
    if (empty($smsfrom) || !str_replace('+', '', $smsfrom)) {
        $message = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("SmsFrom")) . '</div>';
        $action = 'test';
        $error++;
    }
    if (empty($sendto) || !str_replace('+', '', $sendto)) {
        $message = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("SmsTo")) . '</div>';
        $action = 'test';
        $error++;
    }
    if (!$error) {
        // Make substitutions into message
        complete_substitutions_array($substitutionarrayfortest, $langs);
        $body = make_substitutions($body, $substitutionarrayfortest);
        require_once DOL_DOCUMENT_ROOT . "/core/class/CSMSFile.class.php";
        $smsfile = new CSMSFile($sendto, $smsfrom, $body, $deliveryreceipt, $deferred, $priority, $class);
        // This define OvhSms->login, pass, session and account
        $result = $smsfile->sendfile();
        // This send SMS
        if ($result) {
            $message = '<div class="ok">' . $langs->trans("SmsSuccessfulySent", $smsfrom, $sendto) . '</div>';
        } else {
            $message = '<div class="error">' . $langs->trans("ResultKo") . '<br>' . $smsfile->error . ' ' . $result . '</div>';
        }
        $action = '';
    }
}
/*
开发者ID:nrjacker4,项目名称:crm-php,代码行数:31,代码来源:sms.php

示例6: write_file

 /**
  *	Function to build a document on disk using the generic odt module.
  *
  *	@param	Project		$object					Object source to build document
  *	@param	Translate	$outputlangs			Lang output object
  * 	@param	string		$srctemplatepath	    Full path of source filename for generator using a template file
  *	@return	int         						1 if OK, <=0 if KO
  */
 function write_file($object, $outputlangs, $srctemplatepath)
 {
     global $user, $langs, $conf, $mysoc, $hookmanager;
     if (empty($srctemplatepath)) {
         dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
         return -1;
     }
     // Add odtgeneration hook
     if (!is_object($hookmanager)) {
         include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
         $hookmanager = new HookManager($this->db);
     }
     $hookmanager->initHooks(array('odtgeneration'));
     global $action;
     if (!is_object($outputlangs)) {
         $outputlangs = $langs;
     }
     $sav_charset_output = $outputlangs->charset_output;
     $outputlangs->charset_output = 'UTF-8';
     $outputlangs->load("main");
     $outputlangs->load("dict");
     $outputlangs->load("companies");
     $outputlangs->load("projects");
     if ($conf->projet->dir_output) {
         // If $object is id instead of object
         if (!is_object($object)) {
             $id = $object;
             $object = new Project($this->db);
             $result = $object->fetch($id);
             if ($result < 0) {
                 dol_print_error($this->db, $object->error);
                 return -1;
             }
         }
         $dir = $conf->projet->dir_output;
         $objectref = dol_sanitizeFileName($object->ref);
         if (!preg_match('/specimen/i', $objectref)) {
             $dir .= "/" . $objectref;
         }
         $file = $dir . "/" . $objectref . ".odt";
         if (!file_exists($dir)) {
             if (dol_mkdir($dir) < 0) {
                 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
                 return -1;
             }
         }
         if (file_exists($dir)) {
             //print "srctemplatepath=".$srctemplatepath;	// Src filename
             $newfile = basename($srctemplatepath);
             $newfiletmp = preg_replace('/\\.od(t|s)/i', '', $newfile);
             $newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
             $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
             $newfiletmp = $objectref . '_' . $newfiletmp;
             //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
             // Get extension (ods or odt)
             $newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
             if (!empty($conf->global->MAIN_DOC_USE_TIMING)) {
                 $filename = $newfiletmp . '.' . dol_print_date(dol_now(), '%Y%m%d%H%M%S') . '.' . $newfileformat;
             } else {
                 $filename = $newfiletmp . '.' . $newfileformat;
             }
             $file = $dir . '/' . $filename;
             //print "newdir=".$dir;
             //print "newfile=".$newfile;
             //print "file=".$file;
             //print "conf->societe->dir_temp=".$conf->societe->dir_temp;
             dol_mkdir($conf->projet->dir_temp);
             $socobject = $object->thirdparty;
             // Make substitution
             $substitutionarray = array('__FROM_NAME__' => $this->emetteur->nom, '__FROM_EMAIL__' => $this->emetteur->email);
             complete_substitutions_array($substitutionarray, $langs, $object);
             // Open and load template
             require_once ODTPHP_PATH . 'odf.php';
             try {
                 $odfHandler = new odf($srctemplatepath, array('PATH_TO_TMP' => $conf->projet->dir_temp, 'ZIP_PROXY' => 'PclZipProxy', 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}'));
             } catch (Exception $e) {
                 $this->error = $e->getMessage();
                 return -1;
             }
             // After construction $odfHandler->contentXml contains content and
             // [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
             // [!-- BEGIN lines --]*[!-- END lines --]
             //print html_entity_decode($odfHandler->__toString());
             //print exit;
             // Make substitutions into odt of user info
             $tmparray = $this->get_substitutionarray_user($user, $outputlangs);
             foreach ($tmparray as $key => $value) {
                 try {
                     if (preg_match('/logo$/', $key)) {
                         //var_dump($value);exit;
                         if (file_exists($value)) {
                             $odfHandler->setImage($key, $value);
//.........这里部分代码省略.........
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:101,代码来源:doc_generic_project_odt.modules.php

示例7: makeSubstitution

 /**
  * Make substitution of tags into text with value of current object.
  *
  * @param	string	$text       Text to make substitution to
  * @return  string      		Value of input text string with substitutions done
  */
 function makeSubstitution($text)
 {
     global $conf, $langs;
     $birthday = dol_print_date($this->birth, 'day');
     $msgishtml = 0;
     if (dol_textishtml($text, 1)) {
         $msgishtml = 1;
     }
     $infos = '';
     if ($this->civility_id) {
         $infos .= $langs->transnoentities("UserTitle") . ": " . $this->getCivilityLabel() . "\n";
     }
     $infos .= $langs->transnoentities("id") . ": " . $this->id . "\n";
     $infos .= $langs->transnoentities("Lastname") . ": " . $this->lastname . "\n";
     $infos .= $langs->transnoentities("Firstname") . ": " . $this->firstname . "\n";
     $infos .= $langs->transnoentities("Company") . ": " . $this->societe . "\n";
     $infos .= $langs->transnoentities("Address") . ": " . $this->address . "\n";
     $infos .= $langs->transnoentities("Zip") . ": " . $this->zip . "\n";
     $infos .= $langs->transnoentities("Town") . ": " . $this->town . "\n";
     $infos .= $langs->transnoentities("Country") . ": " . $this->country . "\n";
     $infos .= $langs->transnoentities("EMail") . ": " . $this->email . "\n";
     if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
         $infos .= $langs->transnoentities("Login") . ": " . $this->login . "\n";
         $infos .= $langs->transnoentities("Password") . ": " . $this->pass . "\n";
     }
     $infos .= $langs->transnoentities("Birthday") . ": " . $birthday . "\n";
     $infos .= $langs->transnoentities("Photo") . ": " . $this->photo . "\n";
     $infos .= $langs->transnoentities("Public") . ": " . yn($this->public);
     // Substitutions
     $substitutionarray = array('%DOL_MAIN_URL_ROOT%' => DOL_MAIN_URL_ROOT, '%ID%' => $msgishtml ? dol_htmlentitiesbr($this->id) : $this->id, '%CIVILITY%' => $this->getCivilityLabel(), '%FIRSTNAME%' => $msgishtml ? dol_htmlentitiesbr($this->firstname) : $this->firstname, '%LASTNAME%' => $msgishtml ? dol_htmlentitiesbr($this->lastname) : $this->lastname, '%FULLNAME%' => $msgishtml ? dol_htmlentitiesbr($this->getFullName($langs)) : $this->getFullName($langs), '%COMPANY%' => $msgishtml ? dol_htmlentitiesbr($this->societe) : $this->societe, '%ADDRESS%' => $msgishtml ? dol_htmlentitiesbr($this->address) : $this->address, '%ZIP%' => $msgishtml ? dol_htmlentitiesbr($this->zip) : $this->zip, '%TOWN%' => $msgishtml ? dol_htmlentitiesbr($this->town) : $this->town, '%COUNTRY%' => $msgishtml ? dol_htmlentitiesbr($this->country) : $this->country, '%EMAIL%' => $msgishtml ? dol_htmlentitiesbr($this->email) : $this->email, '%BIRTH%' => $msgishtml ? dol_htmlentitiesbr($birthday) : $birthday, '%PHOTO%' => $msgishtml ? dol_htmlentitiesbr($this->photo) : $this->photo, '%LOGIN%' => $msgishtml ? dol_htmlentitiesbr($this->login) : $this->login, '%PASSWORD%' => $msgishtml ? dol_htmlentitiesbr($this->pass) : $this->pass, '%INFOS%' => $msgishtml ? dol_htmlentitiesbr($infos) : $infos, '%SOCIETE%' => $msgishtml ? dol_htmlentitiesbr($this->societe) : $this->societe, '%PRENOM%' => $msgishtml ? dol_htmlentitiesbr($this->firstname) : $this->firstname, '%NOM%' => $msgishtml ? dol_htmlentitiesbr($this->lastname) : $this->lastname, '%CP%' => $msgishtml ? dol_htmlentitiesbr($this->zip) : $this->zip, '%VILLE%' => $msgishtml ? dol_htmlentitiesbr($this->town) : $this->town, '%PAYS%' => $msgishtml ? dol_htmlentitiesbr($this->country) : $this->country);
     // Add extrafields as substitution key %EXTRA_XXX%
     foreach ($this->array_options as $key => $val) {
         $keyshort = preg_replace('/^(options|extra)_/', '', $key);
         $substitutionarray['%EXTRA_' . $keyshort . '%'] = $val;
     }
     complete_substitutions_array($substitutionarray, $langs);
     return make_substitutions($text, $substitutionarray);
 }
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:44,代码来源:adherent.class.php

示例8: complete_head_from_modules

/**
 *  Complete or removed entries into a head array (used to build tabs) with value added by external modules.
 *  Such values are declared into $conf->modules_parts['tab'].
 *
 *  @param	Conf			$conf           Object conf
 *  @param  Translate		$langs          Object langs
 *  @param  object|null		$object         Object object
 *  @param  array			$head          	Object head
 *  @param  int				$h				New position to fill
 *  @param  string			$type           Value for object where objectvalue can be
 *                              			'thirdparty'       to add a tab in third party view
 *		                        	      	'intervention'     to add a tab in intervention view
 *     		                    	     	'supplier_order'   to add a tab in supplier order view
 *          		            	        'supplier_invoice' to add a tab in supplier invoice view
 *                  		    	        'invoice'          to add a tab in customer invoice view
 *                          			    'order'            to add a tab in customer order view
 *                      			        'product'          to add a tab in product view
 *                              			'propal'           to add a tab in propal view
 *                              			'user'             to add a tab in user view
 *                              			'group'            to add a tab in group view
 * 		        	               	     	'member'           to add a tab in fundation member view
 *      		                        	'categories_x'	   to add a tab in category view ('x': type of category (0=product, 1=supplier, 2=customer, 3=member)
 *      									'ecm'			   to add a tab for another ecm view
 *  @param  string		$mode  	        	'add' to complete head, 'remove' to remove entries
 *	@return	void
 */
function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode = 'add')
{
    if (isset($conf->modules_parts['tabs'][$type]) && is_array($conf->modules_parts['tabs'][$type])) {
        foreach ($conf->modules_parts['tabs'][$type] as $value) {
            $values = explode(':', $value);
            if ($mode == 'add' && !preg_match('/^\\-/', $values[1])) {
                if (count($values) == 6) {
                    if ($values[0] != $type) {
                        continue;
                    }
                    if (verifCond($values[4])) {
                        if ($values[3]) {
                            $langs->load($values[3]);
                        }
                        if (preg_match('/SUBSTITUTION_([^_]+)/i', $values[2], $reg)) {
                            $substitutionarray = array();
                            complete_substitutions_array($substitutionarray, $langs, $object);
                            $label = make_substitutions($reg[1], $substitutionarray);
                        } else {
                            $label = $langs->trans($values[2]);
                        }
                        $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', is_object($object) && !empty($object->id) ? $object->id : '', $values[5]), 1);
                        $head[$h][1] = $label;
                        $head[$h][2] = str_replace('+', '', $values[1]);
                        $h++;
                    }
                } else {
                    if (count($values) == 5) {
                        if ($values[0] != $type) {
                            continue;
                        }
                        if ($values[3]) {
                            $langs->load($values[3]);
                        }
                        if (preg_match('/SUBSTITUTION_([^_]+)/i', $values[2], $reg)) {
                            $substitutionarray = array();
                            complete_substitutions_array($substitutionarray, $langs, $object);
                            $label = make_substitutions($reg[1], $substitutionarray);
                        } else {
                            $label = $langs->trans($values[2]);
                        }
                        $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', is_object($object) && !empty($object->id) ? $object->id : '', $values[4]), 1);
                        $head[$h][1] = $label;
                        $head[$h][2] = str_replace('+', '', $values[1]);
                        $h++;
                    }
                }
            } else {
                if ($mode == 'remove' && preg_match('/^\\-/', $values[1])) {
                    if ($values[0] != $type) {
                        continue;
                    }
                    $tabname = str_replace('-', '', $values[1]);
                    foreach ($head as $key => $val) {
                        $condition = !empty($values[3]) ? verifCond($values[3]) : 1;
                        if ($head[$key][2] == $tabname && $condition) {
                            unset($head[$key]);
                            break;
                        }
                    }
                }
            }
        }
    }
}
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:91,代码来源:functions.lib.php

示例9: write_file


//.........这里部分代码省略.........
             if ($num) {
                 $i = 0;
                 $contactstatic = new Contact($this->db);
                 while ($i < $num) {
                     $obj = $this->db->fetch_object($result);
                     $contact_arrray[$i] = $obj->rowid;
                     $i++;
                 }
             }
             if (is_array($contact_arrray) && count($contact_arrray) > 0) {
                 try {
                     $listlines = $odfHandler->setSegment('companycontacts');
                     foreach ($contact_arrray as $array_key => $contact_id) {
                         $res_contact = $contactstatic->fetch($contact_id);
                         $tmparray = $this->get_substitutionarray_contact($contactstatic, $outputlangs, 'contact');
                         foreach ($tmparray as $key => $val) {
                             try {
                                 $listlines->setVars($key, $val, true, 'UTF-8');
                             } catch (OdfException $e) {
                             } catch (SegmentException $e) {
                             }
                         }
                         $listlines->merge();
                     }
                     $odfHandler->mergeSegment($listlines);
                 } catch (OdfException $e) {
                     $this->error = $e->getMessage();
                     dol_syslog($this->error, LOG_WARNING);
                     //return -1;
                 }
             }
             // Make substitutions into odt of thirdparty + external modules
             $tmparray = $this->get_substitutionarray_thirdparty($object, $outputlangs);
             complete_substitutions_array($tmparray, $outputlangs, $object);
             // Call the ODTSubstitution hook
             $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
             $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action);
             // Note that $action and $object may have been modified by some hooks
             // Replace variables into document
             foreach ($tmparray as $key => $value) {
                 try {
                     if (preg_match('/logo$/', $key)) {
                         if (file_exists($value)) {
                             $odfHandler->setImage($key, $value);
                         } else {
                             $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
                         }
                     } else {
                         $odfHandler->setVars($key, $value, true, 'UTF-8');
                     }
                 } catch (OdfException $e) {
                     // setVars failed, probably because key not found
                 }
             }
             // Replace labels translated
             $tmparray = $outputlangs->get_translations_for_substitutions();
             foreach ($tmparray as $key => $value) {
                 try {
                     $odfHandler->setVars($key, $value, true, 'UTF-8');
                 } catch (OdfException $e) {
                 }
             }
             // Call the beforeODTSave hook
             $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
             $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action);
             // Note that $action and $object may have been modified by some hooks
开发者ID:Samara94,项目名称:dolibarr,代码行数:67,代码来源:doc_generic_odt.modules.php

示例10: pdf_pagefoot

/**
 *  Show footer of page for PDF generation
 *
 *	@param	PDF			&$pdf     		The PDF factory
 *  @param  Translate	$outputlangs	Object lang for output
 * 	@param	string		$paramfreetext	Constant name of free text
 * 	@param	Societe		$fromcompany	Object company
 * 	@param	int			$marge_basse	Margin bottom
 * 	@param	int			$marge_gauche	Margin left
 * 	@param	int			$page_hauteur	Page height
 * 	@param	Object		$object			Object shown in PDF
 * 	@param	int			$showdetails	Show company details
 * 	@return	void
 */
function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails = 0)
{
    global $conf, $user;
    $outputlangs->load("dict");
    $line = '';
    // Line of free text
    if (!empty($conf->global->{$paramfreetext})) {
        // Make substitution
        $substitutionarray = array('__FROM_NAME__' => $fromcompany->nom, '__FROM_EMAIL__' => $fromcompany->email, '__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_HT__' => $object->total_ht, '__TOTAL_VAT__' => $object->total_vat);
        complete_substitutions_array($substitutionarray, $outputlangs, $object);
        $newfreetext = make_substitutions($conf->global->{$paramfreetext}, $substitutionarray);
        $line .= $outputlangs->convToOutputCharset($newfreetext);
    }
    // First line of company infos
    if ($showdetails) {
        $line1 = "";
        // Company name
        if ($fromcompany->name) {
            $line1 .= ($line1 ? " - " : "") . $outputlangs->transnoentities("RegisteredOffice") . ": " . $fromcompany->name;
        }
        // Address
        if ($fromcompany->address) {
            $line1 .= ($line1 ? " - " : "") . $fromcompany->address;
        }
        // Zip code
        if ($fromcompany->zip) {
            $line1 .= ($line1 ? " - " : "") . $fromcompany->zip;
        }
        // Town
        if ($fromcompany->town) {
            $line1 .= ($line1 ? " " : "") . $fromcompany->town;
        }
        // Phone
        if ($fromcompany->phone) {
            $line1 .= ($line1 ? " - " : "") . $outputlangs->transnoentities("Phone") . ": " . $fromcompany->phone;
        }
        // Fax
        if ($fromcompany->fax) {
            $line1 .= ($line1 ? " - " : "") . $outputlangs->transnoentities("Fax") . ": " . $fromcompany->fax;
        }
        $line2 = "";
        // URL
        if ($fromcompany->url) {
            $line2 .= ($line2 ? " - " : "") . $fromcompany->url;
        }
        // Email
        if ($fromcompany->email) {
            $line2 .= ($line2 ? " - " : "") . $fromcompany->email;
        }
    }
    // Line 3 of company infos
    $line3 = "";
    // Juridical status
    if ($fromcompany->forme_juridique_code) {
        $line3 .= ($line3 ? " - " : "") . $outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
    }
    // Capital
    if ($fromcompany->capital) {
        $line3 .= ($line3 ? " - " : "") . $outputlangs->transnoentities("CapitalOf", $fromcompany->capital) . " " . $outputlangs->transnoentities("Currency" . $conf->currency);
    }
    // Prof Id 1
    if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) {
        $field = $outputlangs->transcountrynoentities("ProfId1", $fromcompany->country_code);
        if (preg_match('/\\((.*)\\)/i', $field, $reg)) {
            $field = $reg[1];
        }
        $line3 .= ($line3 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof1);
    }
    // Prof Id 2
    if ($fromcompany->idprof2) {
        $field = $outputlangs->transcountrynoentities("ProfId2", $fromcompany->country_code);
        if (preg_match('/\\((.*)\\)/i', $field, $reg)) {
            $field = $reg[1];
        }
        $line3 .= ($line3 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof2);
    }
    // Line 4 of company infos
    $line4 = "";
    // Prof Id 3
    if ($fromcompany->idprof3) {
        $field = $outputlangs->transcountrynoentities("ProfId3", $fromcompany->country_code);
        if (preg_match('/\\((.*)\\)/i', $field, $reg)) {
            $field = $reg[1];
        }
        $line4 .= ($line4 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof3);
    }
//.........这里部分代码省略.........
开发者ID:nrjacker4,项目名称:crm-php,代码行数:101,代码来源:pdf.lib.php

示例11: write_file


//.........这里部分代码省略.........
				//print "conf->societe->dir_temp=".$conf->societe->dir_temp;

				create_exdir($conf->societe->dir_temp);

				// Open and load template
				require_once(DOL_DOCUMENT_ROOT.'/includes/odtphp/odf.php');
				$odfHandler = new odf($srctemplatepath, array(
						'PATH_TO_TMP'	  => $conf->societe->dir_temp,
						'ZIP_PROXY'		  => 'PclZipProxy',	// PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
						'DELIMITER_LEFT'  => '{',
						'DELIMITER_RIGHT' => '}')
				);

				//print $odfHandler->__toString()."\n";

				// Make substitutions into odt of user info
			    $tmparray=$this->get_substitutionarray_user($user,$outputlangs);
                //var_dump($tmparray); exit;
                foreach($tmparray as $key=>$value)
                {
                    try {
                        if (preg_match('/logo$/',$key)) // Image
                        {
                            //var_dump($value);exit;
                            if (file_exists($value)) $odfHandler->setImage($key, $value);
                            else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
                        }
                        else    // Text
                        {
                            //print $key.' '.$value;exit;
                            $odfHandler->setVars($key, $value, true, 'UTF-8');
                        }
                    }
                    catch(OdfException $e)
                    {
                    }
                }
                // Make substitutions into odt of mysoc info
                $tmparray=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
				//var_dump($tmparray); exit;
				foreach($tmparray as $key=>$value)
				{
					try {
						if (preg_match('/logo$/',$key))	// Image
						{
							//var_dump($value);exit;
							if (file_exists($value)) $odfHandler->setImage($key, $value);
							else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
						}
						else	// Text
						{
							$odfHandler->setVars($key, $value, true, 'UTF-8');
						}
					}
					catch(OdfException $e)
					{
					}
				}
                // Make substitutions into odt of thirdparty + external modules
				$tmparray=$this->get_substitutionarray_thirdparty($object,$outputlangs);
                complete_substitutions_array($tmparray, $langs, $object);
                //var_dump($object->id); exit;
				foreach($tmparray as $key=>$value)
				{
					try {
						if (preg_match('/logo$/',$key))	// Image
						{
							if (file_exists($value)) $odfHandler->setImage($key, $value);
							else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
						}
						else	// Text
						{
							$odfHandler->setVars($key, $value, true, 'UTF-8');
						}
					}
					catch(OdfException $e)
					{
					}
				}

				// Write new file
				//$result=$odfHandler->exportAsAttachedFile('toto');
				$odfHandler->saveToDisk($file);

				if (! empty($conf->global->MAIN_UMASK))
				@chmod($file, octdec($conf->global->MAIN_UMASK));

				$odfHandler=null;	// Destroy object

				return 1;   // Success
			}
			else
			{
				$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
				return -1;
			}
		}

		return -1;
	}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:doc_generic_odt.modules.php

示例12: write_file

 /**
  *	Function to build a document on disk using the generic odt module.
  *
  *	@param	Facture		$object					Object source to build document
  *	@param	Translate	$outputlangs			Lang output object
  * 	@param	string		$srctemplatepath	    Full path of source filename for generator using a template file
  *	@return	int         						1 if OK, <=0 if KO
  */
 function write_file($object, $outputlangs, $srctemplatepath)
 {
     global $user, $langs, $conf, $mysoc;
     if (empty($srctemplatepath)) {
         dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
         return -1;
     }
     if (!is_object($outputlangs)) {
         $outputlangs = $langs;
     }
     $sav_charset_output = $outputlangs->charset_output;
     $outputlangs->charset_output = 'UTF-8';
     $outputlangs->load("main");
     $outputlangs->load("dict");
     $outputlangs->load("companies");
     $outputlangs->load("bills");
     if ($conf->facture->dir_output) {
         // If $object is id instead of object
         if (!is_object($object)) {
             $id = $object;
             $object = new Facture($this->db);
             $result = $object->fetch($id);
             if ($result < 0) {
                 dol_print_error($this->db, $object->error);
                 return -1;
             }
         }
         $dir = $conf->facture->dir_output;
         $objectref = dol_sanitizeFileName($object->ref);
         if (!preg_match('/specimen/i', $objectref)) {
             $dir .= "/" . $objectref;
         }
         $file = $dir . "/" . $objectref . ".odt";
         if (!file_exists($dir)) {
             if (dol_mkdir($dir) < 0) {
                 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
                 return -1;
             }
         }
         if (file_exists($dir)) {
             //print "srctemplatepath=".$srctemplatepath;exit;	// Src filename
             $newfile = basename($srctemplatepath);
             $newfiletmp = preg_replace('/\\.odt/i', '', $newfile);
             $newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
             $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
             $newfiletmp = $objectref . '_' . $newfiletmp;
             //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
             $file = $dir . '/' . $newfiletmp . '.odt';
             //print "newdir=".$dir;
             //print "newfile=".$newfile;
             //print "file=".$file;
             //print "conf->societe->dir_temp=".$conf->societe->dir_temp;
             dol_mkdir($conf->facture->dir_temp);
             // If BILLING contact defined on invoice, we use it
             $usecontact = false;
             $arrayidcontact = $object->getIdContact('external', 'BILLING');
             if (count($arrayidcontact) > 0) {
                 $usecontact = true;
                 $result = $object->fetch_contact($arrayidcontact[0]);
             }
             // Recipient name
             if (!empty($usecontact)) {
                 // On peut utiliser le nom de la societe du contact
                 if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) {
                     $socobject = $object->contact;
                 } else {
                     $socobject = $object->client;
                 }
             } else {
                 $socobject = $object->client;
             }
             // Make substitution
             $substitutionarray = array('__FROM_NAME__' => $this->emetteur->nom, '__FROM_EMAIL__' => $this->emetteur->email, '__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_HT__' => $object->total_ht, '__TOTAL_VAT__' => $object->total_vat);
             complete_substitutions_array($substitutionarray, $langs, $object);
             // Line of free text
             $newfreetext = '';
             $paramfreetext = 'FACTURE_FREE_TEXT';
             if (!empty($conf->global->{$paramfreetext})) {
                 $newfreetext = make_substitutions($conf->global->{$paramfreetext}, $substitutionarray);
             }
             // Open and load template
             require_once ODTPHP_PATH . 'odf.php';
             $odfHandler = new odf($srctemplatepath, array('PATH_TO_TMP' => $conf->facture->dir_temp, 'ZIP_PROXY' => 'PclZipProxy', 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}'));
             // After construction $odfHandler->contentXml contains content and
             // [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
             // [!-- BEGIN lines --]*[!-- END lines --]
             //print html_entity_decode($odfHandler->__toString());
             //print exit;
             // Make substitutions into odt of freetext
             try {
                 $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
             } catch (OdfException $e) {
//.........这里部分代码省略.........
开发者ID:nrjacker4,项目名称:crm-php,代码行数:101,代码来源:doc_generic_invoice_odt.modules.php

示例13: write_file

 /**
  *	Function to build a document on disk using the generic odt module.
  *
  *	@param	Societe		$object				Object source to build document
  *	@param	Translate	$outputlangs		Lang output object
  * 	@param	string		$srctemplatepath	Full path of source filename for generator using a template file
  *	@return	int         					1 if OK, <=0 if KO
  */
 function write_file($object, $outputlangs, $srctemplatepath)
 {
     global $user, $langs, $conf, $mysoc;
     if (empty($srctemplatepath)) {
         dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
         return -1;
     }
     if (!is_object($outputlangs)) {
         $outputlangs = $langs;
     }
     $sav_charset_output = $outputlangs->charset_output;
     $outputlangs->charset_output = 'UTF-8';
     $outputlangs->load("main");
     $outputlangs->load("dict");
     $outputlangs->load("companies");
     $outputlangs->load("projects");
     if ($conf->societe->multidir_output[$object->entity]) {
         $dir = $conf->societe->multidir_output[$object->entity];
         $objectref = dol_sanitizeFileName($object->id);
         if (!preg_match('/specimen/i', $objectref)) {
             $dir .= "/" . $objectref;
         }
         if (!file_exists($dir)) {
             if (dol_mkdir($dir) < 0) {
                 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
                 return -1;
             }
         }
         if (file_exists($dir)) {
             //print "srctemplatepath=".$srctemplatepath;	// Src filename
             $newfile = basename($srctemplatepath);
             $newfiletmp = preg_replace('/\\.odt/i', '', $newfile);
             $newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
             $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
             $filename = $newfiletmp . '.' . dol_print_date(dol_now(), '%Y%m%d%H%M%S') . '.odt';
             $file = $dir . '/' . $filename;
             $object->builddoc_filename = $filename;
             // For triggers
             //print "newdir=".$dir;
             //print "newfile=".$newfile;
             //print "file=".$file;
             //print "conf->societe->dir_temp=".$conf->societe->dir_temp;
             dol_mkdir($conf->societe->multidir_temp[$object->entity]);
             // Open and load template
             require_once ODTPHP_PATH . 'odf.php';
             $odfHandler = new odf($srctemplatepath, array('PATH_TO_TMP' => $conf->societe->multidir_temp[$object->entity], 'ZIP_PROXY' => 'PclZipProxy', 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}'));
             //print $odfHandler->__toString()."\n";
             // Make substitutions into odt of user info
             $tmparray = $this->get_substitutionarray_user($user, $outputlangs);
             //var_dump($tmparray); exit;
             foreach ($tmparray as $key => $value) {
                 try {
                     if (preg_match('/logo$/', $key)) {
                         //var_dump($value);exit;
                         if (file_exists($value)) {
                             $odfHandler->setImage($key, $value);
                         } else {
                             $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
                         }
                     } else {
                         //print $key.' '.$value;exit;
                         $odfHandler->setVars($key, $value, true, 'UTF-8');
                     }
                 } catch (OdfException $e) {
                     // setVars failed, probably because key not found
                 }
             }
             // Make substitutions into odt of mysoc info
             $tmparray = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
             //var_dump($tmparray); exit;
             foreach ($tmparray as $key => $value) {
                 try {
                     if (preg_match('/logo$/', $key)) {
                         //var_dump($value);exit;
                         if (file_exists($value)) {
                             $odfHandler->setImage($key, $value);
                         } else {
                             $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
                         }
                     } else {
                         $odfHandler->setVars($key, $value, true, 'UTF-8');
                     }
                 } catch (OdfException $e) {
                     // setVars failed, probably because key not found
                 }
             }
             // Make substitutions into odt of thirdparty + external modules
             $tmparray = $this->get_substitutionarray_thirdparty($object, $outputlangs);
             complete_substitutions_array($tmparray, $outputlangs, $object);
             //var_dump($object->id); exit;
             foreach ($tmparray as $key => $value) {
                 try {
//.........这里部分代码省略.........
开发者ID:nrjacker4,项目名称:crm-php,代码行数:101,代码来源:doc_generic_odt.modules.php

示例14: dol_syslog

 $sql .= " ORDER BY d.rowid ASC";
 dol_syslog("Search members", LOG_DEBUG);
 $result = $db->query($sql);
 if ($result) {
     $num = $db->num_rows($result);
     $i = 0;
     while ($i < $num) {
         $objp = $db->fetch_object($result);
         if ($objp->country == '-') {
             $objp->country = '';
         }
         $adherentstatic->lastname = $objp->lastname;
         $adherentstatic->firstname = $objp->firstname;
         // List of values to scan for a replacement
         $substitutionarray = array('%ID%' => $objp->rowid, '%LOGIN%' => $objp->login, '%FIRSTNAME%' => $objp->firstname, '%LASTNAME%' => $objp->lastname, '%FULLNAME%' => $adherentstatic->getFullName($langs), '%COMPANY%' => $objp->company, '%ADDRESS%' => $objp->address, '%ZIP%' => $objp->zip, '%TOWN%' => $objp->town, '%COUNTRY%' => $objp->country, '%COUNTRY_CODE%' => $objp->country_code, '%EMAIL%' => $objp->email, '%BIRTH%' => dol_print_date($objp->birth, 'day'), '%TYPE%' => $objp->type, '%YEAR%' => $year, '%MONTH%' => $month, '%DAY%' => $day, '%DOL_MAIN_URL_ROOT%' => DOL_MAIN_URL_ROOT, '%SERVER%' => "http://" . $_SERVER["SERVER_NAME"] . "/");
         complete_substitutions_array($substitutionarray, $langs);
         // For business cards
         if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') {
             $textleft = make_substitutions($conf->global->ADHERENT_CARD_TEXT, $substitutionarray);
             $textheader = make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray);
             $textfooter = make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray);
             $textright = make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray);
             if (is_numeric($foruserid) || $foruserlogin) {
                 for ($j = 0; $j < 100; $j++) {
                     $arrayofmembers[] = array('textleft' => $textleft, 'textheader' => $textheader, 'textfooter' => $textfooter, 'textright' => $textright, 'id' => $objp->rowid, 'photo' => $objp->photo);
                 }
             } else {
                 $arrayofmembers[] = array('textleft' => $textleft, 'textheader' => $textheader, 'textfooter' => $textfooter, 'textright' => $textright, 'id' => $objp->rowid, 'photo' => $objp->photo);
             }
         }
         // For labels
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:carte.php

示例15: write_file

 /**
  *	Function to build a document on disk using the generic odt module.
  *
  *	@param	Commande	$object					Object source to build document
  *	@param	Translate	$outputlangs			Lang output object
  * 	@param	string		$srctemplatepath	    Full path of source filename for generator using a template file
  *	@return	int         						1 if OK, <=0 if KO
  */
 function write_file($object, $outputlangs, $srctemplatepath)
 {
     global $user, $langs, $conf, $mysoc, $hookmanager;
     if (empty($srctemplatepath)) {
         dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
         return -1;
     }
     if (!is_object($outputlangs)) {
         $outputlangs = $langs;
     }
     $sav_charset_output = $outputlangs->charset_output;
     $outputlangs->charset_output = 'UTF-8';
     $outputlangs->load("main");
     $outputlangs->load("dict");
     $outputlangs->load("companies");
     $outputlangs->load("projects");
     if ($conf->projet->dir_output) {
         // If $object is id instead of object
         if (!is_object($object)) {
             $id = $object;
             $object = new Task($this->db);
             $result = $object->fetch($id);
             if ($result < 0) {
                 dol_print_error($this->db, $object->error);
                 return -1;
             }
         }
         $project = new Project($this->db);
         $project->fetch($object->fk_project);
         $dir = $conf->projet->dir_output . "/" . $project->ref . "/";
         $objectref = dol_sanitizeFileName($object->ref);
         if (!preg_match('/specimen/i', $objectref)) {
             $dir .= "/" . $objectref;
         }
         $file = $dir . "/" . $objectref . ".odt";
         if (!file_exists($dir)) {
             print '$dir' . $dir;
             if (dol_mkdir($dir) < 0) {
                 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
                 return -1;
             }
         }
         if (file_exists($dir)) {
             //print "srctemplatepath=".$srctemplatepath;	// Src filename
             $newfile = basename($srctemplatepath);
             $newfiletmp = preg_replace('/\\.(ods|odt)/i', '', $newfile);
             $newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
             $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
             $newfiletmp = $objectref . '_' . $newfiletmp;
             //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
             $file = $dir . '/' . $newfiletmp . '.odt';
             //print "newdir=".$dir;
             //print "newfile=".$newfile;
             //print "file=".$file;
             //print "conf->societe->dir_temp=".$conf->societe->dir_temp;
             dol_mkdir($conf->projet->dir_temp);
             $socobject = $object->thirdparty;
             // Make substitution
             $substitutionarray = array('__FROM_NAME__' => $this->emetteur->name, '__FROM_EMAIL__' => $this->emetteur->email);
             complete_substitutions_array($substitutionarray, $langs, $object);
             // Open and load template
             require_once ODTPHP_PATH . 'odf.php';
             try {
                 $odfHandler = new odf($srctemplatepath, array('PATH_TO_TMP' => $conf->projet->dir_temp, 'ZIP_PROXY' => 'PclZipProxy', 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}'));
             } catch (Exception $e) {
                 $this->error = $e->getMessage();
                 return -1;
             }
             // After construction $odfHandler->contentXml contains content and
             // [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
             // [!-- BEGIN lines --]*[!-- END lines --]
             //print html_entity_decode($odfHandler->__toString());
             //print exit;
             // Make substitutions into odt of user info
             $array_user = $this->get_substitutionarray_user($user, $outputlangs);
             $array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
             $array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
             $array_objet = $this->get_substitutionarray_object($project, $outputlangs);
             $array_other = $this->get_substitutionarray_other($outputlangs);
             $tmparray = array_merge($array_user, $array_soc, $array_thirdparty, $array_objet, $array_other);
             complete_substitutions_array($tmparray, $outputlangs, $object);
             foreach ($tmparray as $key => $value) {
                 try {
                     if (preg_match('/logo$/', $key)) {
                         if (file_exists($value)) {
                             $odfHandler->setImage($key, $value);
                         } else {
                             $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
                         }
                     } else {
                         $odfHandler->setVars($key, $value, true, 'UTF-8');
                     }
//.........这里部分代码省略.........
开发者ID:Samara94,项目名称:dolibarr,代码行数:101,代码来源:doc_generic_task_odt.modules.php


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