本文整理汇总了PHP中Translate::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Translate::load方法的具体用法?PHP Translate::load怎么用?PHP Translate::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Translate
的用法示例。
在下文中一共展示了Translate::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkLogin
public static function checkLogin(\PDO $pdo_db, string $lang, Reg $tkireg, Smarty $template) : bool
{
// Database driven language entries
$langvars = Translate::load($pdo_db, $lang, array('login', 'global_funcs', 'common', 'footer', 'self_destruct'));
// Check if game is closed - Ignore the false return if it is open
Game::isGameClosed($pdo_db, $tkireg, $lang, $template, $langvars);
// Handle authentication check - Will die if fails, or return correct playerinfo
$playerinfo = Player::handleAuth($pdo_db, $lang, $langvars, $tkireg, $template);
// Establish timestamp for interval in checking bans
$stamp = date('Y-m-d H:i:s');
$timestamp = array();
$timestamp['now'] = (int) strtotime($stamp);
$timestamp['last'] = (int) strtotime($playerinfo['last_login']);
// Check for ban - Ignore the false return if not
Player::handleBan($pdo_db, $lang, $timestamp, $template, $playerinfo, $langvars, $tkireg);
// Check for destroyed ship - Ignore the false return if not
Ship::isDestroyed($pdo_db, $lang, $tkireg, $langvars, $template, $playerinfo);
return true;
}
示例2: info
/**
* Return description of module
*
* @param Translate $langs Object langs
* @return string Description of module
*/
function info($langs)
{
global $conf;
global $form;
$langs->load("companies");
$tooltip = '';
$texte = '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
$texte .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
$texte .= '<input type="hidden" name="param1" value="COMPANY_AQUARIUM_MASK_SUPPLIER">';
$texte .= '<input type="hidden" name="param2" value="COMPANY_AQUARIUM_MASK_CUSTOMER">';
$texte .= '<table class="nobordernopadding" width="100%">';
$s1 = $form->textwithpicto('<input type="text" class="flat" size="4" name="value1" value="' . $conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER . '">', $tooltip, 1, 1);
$s2 = $form->textwithpicto('<input type="text" class="flat" size="4" name="value2" value="' . $conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER . '">', $tooltip, 1, 1);
$texte .= '<tr><td>' . $langs->trans("ModuleCompanyCode" . $this->nom, $s1, $s2) . "<br>\n";
$texte .= '</td>';
$texte .= '<td align="left"> <input type="submit" class="button" value="' . $langs->trans("Modify") . '" name="Button"></td>';
$texte .= '</tr></table>';
$texte .= '</form>';
return $texte;
}
示例3: display
public static function display(\PDO $pdo_db, string $lang, Smarty $template, string $title = null, string $body_class = 'tki', bool $include_ckeditor = null)
{
$langvars = Translate::load($pdo_db, $lang, array('common'));
$variables = null;
$variables['lang'] = $lang;
// Body class defines a css file for a specific page, if one isn't defined, it defaults to tki, which is
// nulled by the template.
$variables['body_class'] = $body_class;
if ($title !== null) {
$variables['title'] = $title;
}
// Some pages (like mailto) include ckeditor js, check if this is one of those.
if (isset($include_ckeditor)) {
$variables['include_ckeditor'] = $include_ckeditor;
} else {
unset($variables['include_ckeditor']);
// Otherwise, we make sure it is NOT set
}
$template->addVariables('langvars', $langvars);
$template->addVariables('variables', $variables);
$template->display('header.tpl');
// Perhaps this should return the template instead of kicking off display. I'm not sure.
}
示例4: getExample
/**
* Return an example of result returned by getNextValue
*
* @param Translate $langs Object langs
* @param Product $objproduct Object product
* @return string Return string example
*/
function getExample($langs, $objproduct = 0)
{
$examplebarcode = $this->getNextValue($objproduct, 0);
if (!$examplebarcode) {
$examplebarcode = $langs->trans('NotConfigured');
}
if ($examplebarcode == "ErrorBadMask") {
$langs->load("errors");
$examplebarcode = $langs->trans($examplebarcode);
}
return $examplebarcode;
}
示例5: Translate
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/') . '[^\\-]+');
$file = $fileparams['fullname'];
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) {
$newlang = $_REQUEST['lang_id'];
}
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
}
if (!empty($newlang)) {
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang($newlang);
$outputlangs->load('bills');
}
// Build document if it not exists
if (!$file || !is_readable($file)) {
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) {
dol_print_error($db, $object->error, $object->errors);
exit;
}
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/') . '[^\\-]+');
$file = $fileparams['fullname'];
}
print '<div class="clearboth"></div>';
print '<br>';
print load_fiche_titre($langs->trans($titreform));
// Cree l'objet formulaire mail
示例6: testDolPrintDateTzFrance
/**
* testDolPrintDateTzFrance
* Same than official testDolPrintDate but with parameter tzoutput that is false='tzserver'.
* This test works only onto a server using TZ+1 Europe/Paris.
*
* You can use http://www.epochconverter.com/ to generate more tests.
*
* @return void
*/
public function testDolPrintDateTzFrance()
{
global $conf, $user, $langs, $db;
$conf = $this->savconf;
$user = $this->savuser;
$langs = $this->savlangs;
$db = $this->savdb;
// Check %Y-%m-%d %H:%M:%S format
$result = dol_print_date(0, '%Y-%m-%d %H:%M:%S', false);
print __METHOD__ . " result=" . $result . "\n";
$this->assertEquals('1970-01-01 01:00:00', $result);
// Check %Y-%m-%d %H:%M:%S format
$result = dol_print_date(16725225600, '%Y-%m-%d %H:%M:%S', false);
print __METHOD__ . " result=" . $result . "\n";
$this->assertEquals('2500-01-01 01:00:00', $result);
// Check %Y-%m-%d %H:%M:%S format
$result = dol_print_date(-1830384000, '%Y-%m-%d %H:%M:%S', false);
// http://www.epochconverter.com/
print __METHOD__ . " result=" . $result . "\n";
$this->assertEquals('1912-01-01 01:00:00', $result);
// dol_print_date use a timezone, not epoch converter as it did not exists this year
// Specific cas during war
// 1940, no timezone
$result = dol_print_date(-946771200, '%Y-%m-%d %H:%M:%S', false);
// http://www.epochconverter.com/
print __METHOD__ . " result=" . $result . "\n";
$this->assertEquals('1940-01-01 01:00:00', $result);
// dol_print_date use a modern timezone, not epoch converter as it did not exists this year
// 1941, timezone is added by germany to +2 (same for 1942)
$result = dol_print_date(-915148800, '%Y-%m-%d %H:%M:%S', false);
// http://www.epochconverter.com/
print __METHOD__ . " result=" . $result . "\n";
$this->assertEquals('1941-01-01 01:00:00', $result);
// dol_print_date use a modern timezone, epoch converter use historic timezone
// 1943, timezone is +1
$result = dol_print_date(-852076800, '%Y-%m-%d %H:%M:%S', false);
// http://www.epochconverter.com/
print __METHOD__ . " result=" . $result . "\n";
$this->assertEquals('1943-01-01 01:00:00', $result);
// test with negative timezone
$result = dol_print_date(-1, '%Y-%m-%d %H:%M:%S', false);
// http://www.epochconverter.com/
print __METHOD__ . " result=" . $result . "\n";
$this->assertEquals('1970-01-01 00:59:59', $result);
// Check dayhour format for fr_FR
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang('fr_FR');
$outputlangs->load("main");
$result = dol_print_date(0 + 24 * 3600, 'dayhour', false, $outputlangs);
print __METHOD__ . " result=" . $result . "\n";
$this->assertEquals('02/01/1970 01:00', $result);
// Check day format for en_US
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang('en_US');
$outputlangs->load("main");
$result = dol_print_date(0 + 24 * 3600, 'day', false, $outputlangs);
print __METHOD__ . " result=" . $result . "\n";
$this->assertEquals('01/02/1970', $result);
// Check %a and %b format for en_US
$result = dol_print_date(0, '%a %b', false, $outputlangs);
print __METHOD__ . " result=" . $result . "\n";
$this->assertEquals('Thu Jan', $result);
return $result;
}
示例7: explode
// Define options
if (preg_match('/^lang=/i', $value)) {
$found = true;
$valarray = explode('=', $value);
$newlangid = $valarray[1];
print 'Use language ' . $newlangid . ".\n";
}
}
$outputlangs = $langs;
if (!empty($newlangid)) {
if ($outputlangs->defaultlang != $newlangid) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlangid);
}
}
$outputlangs->load("main");
$outputlangs->load("bills");
$outputlangs->load("companies");
$outputlangs->load("banks");
$outputlangs->load("members");
$outputlangs->load("compta");
$acct = new Account($db);
$result = $acct->fetch('', $bankref);
if ($result <= 0) {
print "Failed to find bank account with ref " . $bankref . ".\n";
exit(-1);
} else {
print "Export for bank account " . $acct->ref . " (" . $acct->label . ").\n";
}
// Creation de la classe d'export du model ExportXXX
$dir = DOL_DOCUMENT_ROOT . "/core/modules/export/";
示例8: Translate
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref, '/') . '[^\\-]+');
$file = $fileparams['fullname'];
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) {
$newlang = $_REQUEST['lang_id'];
}
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
$newlang = $object->client->default_lang;
}
if (!empty($newlang)) {
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang($newlang);
$outputlangs->load('sendings');
}
// Build document if it not exists
if (!$file || !is_readable($file)) {
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) {
dol_print_error($db, $object->error, $object->errors);
exit;
}
$fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref, '/') . '[^\\-]+');
$file = $fileparams['fullname'];
}
print '<div class="clearboth"></div>';
print '<br>';
print load_fiche_titre($langs->trans('SendShippingByEMail'));
dol_fiche_head('');
示例9:
/**
* Show top header of page.
*
* @param PDF $pdf Object PDF
* @param Object $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf, $langs, $hookmanager, $user;
$outputlangs->load("main");
$outputlangs->load("bills");
$outputlangs->load("propal");
$outputlangs->load("companies");
$outputlangs->load("orders");
$default_font_size = pdf_getPDFFontSize($outputlangs);
pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
// Show Draft Watermark
if ($object->statut == 0 && !empty($conf->global->COMMANDE_DRAFT_WATERMARK)) {
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->COMMANDE_DRAFT_WATERMARK);
}
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size + 3);
$posy = $this->marge_haute;
$posx = $this->page_largeur - $this->marge_droite - 100;
$pdf->SetXY($this->marge_gauche, $posy);
// Logo
$logo = $conf->mycompany->dir_output . '/logos/' . $this->emetteur->logo;
if ($this->emetteur->logo) {
if (is_readable($logo)) {
$height = pdf_getHeightForLogo($logo);
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
// width=0 (auto)
} else {
$pdf->SetTextColor(200, 0, 0);
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
}
} else {
$text = $this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
}
$pdf->SetFont('', 'B', $default_font_size + 3);
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$title = $outputlangs->transnoentities("Order");
$pdf->MultiCell(100, 3, $title, '', 'R');
$pdf->SetFont('', 'B', $default_font_size);
$posy += 5;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref") . " : " . $outputlangs->convToOutputCharset($object->ref), '', 'R');
$posy += 1;
$pdf->SetFont('', '', $default_font_size - 1);
if ($object->ref_client) {
$posy += 5;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer") . " : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R');
}
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate") . " : " . dol_print_date($object->date, "%d %b %Y", false, $outputlangs, true), '', 'R');
$posy += 2;
// Show list of linked objects
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
if ($showaddress) {
// Sender properties
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender
$posy = 42;
$posx = $this->marge_gauche;
if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
$posx = $this->page_largeur - $this->marge_droite - 80;
}
$hautcadre = 40;
// Show sender frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom") . ":", 0, 'L');
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0, 0, 60);
// Show sender name
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$posy = $pdf->getY();
// Show sender information
$pdf->SetXY($posx + 2, $posy);
$pdf->SetFont('', '', $default_font_size - 1);
//$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
//$pdf->MultiCell(80, 4, $user->id, 0, 'L');
// if($object->fk_cash == '1' || $object->fk_cash == '2')
//.........这里部分代码省略.........
示例10:
/**
* Show top header of page.
*
* @param PDF &$pdf Object PDF
* @param Object $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param object $hookmanager Hookmanager object
* @return void
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $hookmanager)
{
global $conf, $langs;
$outputlangs->load("main");
$outputlangs->load("bills");
$outputlangs->load("propal");
$outputlangs->load("companies");
$default_font_size = pdf_getPDFFontSize($outputlangs);
pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
// Show Draft Watermark
if ($object->statut == 0 && !empty($conf->global->PROPALE_DRAFT_WATERMARK)) {
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->PROPALE_DRAFT_WATERMARK);
}
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size + 3);
$posy = $this->marge_haute + 3;
$posx = $this->page_largeur - $this->marge_droite - 100;
$pdf->SetXY($this->marge_gauche, $posy);
// Logo
$logo = $conf->mycompany->dir_output . '/logos/' . $this->emetteur->logo;
if ($this->emetteur->logo) {
if (is_readable($logo)) {
$height = pdf_getHeightForLogo($logo) * 0.8;
$pdf->Image($logo, $this->marge_gauche + 5, $posy, 0, $height);
// width=0 (auto)
} else {
$pdf->SetTextColor(200, 0, 0);
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
}
} else {
$text = $this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
}
$pdf->SetFont('', 'B', $default_font_size + 3);
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$title = $outputlangs->transnoentities("CommercialProposal");
$pdf->MultiCell(100, 4, $title, '', 'R');
$pdf->SetFont('', 'B', $default_font_size);
$posy += 5;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref") . " : " . $outputlangs->convToOutputCharset($object->ref), '', 'R');
$posy += 1;
$pdf->SetFont('', '', $default_font_size - 1);
if ($object->ref_client) {
$posy += 5;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer") . " : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R');
}
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date") . " : " . dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEndPropal") . " : " . dol_print_date($object->fin_validite, "day", false, $outputlangs, true), '', 'R');
if ($object->client->code_client) {
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode") . " : " . $outputlangs->transnoentities($object->client->code_client), '', 'R');
}
$posy += 2;
// Show list of linked objects
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size, $hookmanager);
if ($showaddress) {
// Sender properties
$carac_emetteur = '';
// Add internal contact of proposal if defined
$arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
if (count($arrayidcontact) > 0) {
$object->fetch_user($arrayidcontact[0]);
$carac_emetteur .= ($carac_emetteur ? "\n" : '') . $outputlangs->transnoentities("Name") . ": " . $outputlangs->convToOutputCharset($object->user->getFullName($outputlangs)) . "\n";
}
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur);
// Show sender
$posy = 42;
$posx = $this->marge_gauche;
if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
$posx = $this->page_largeur - $this->marge_droite - 80;
}
$hautcadre = 40;
// Show sender frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
//.........这里部分代码省略.........
开发者ID:sergioeugenio,项目名称:Dolibarr37_berrypro_Modulo,代码行数:101,代码来源:pdf_berrypro_trans_mont_noinc.modules.php
示例11: Translate
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/') . '[^\\-]+');
$file = $fileparams['fullname'];
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) {
$newlang = $_REQUEST['lang_id'];
}
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
}
if (!empty($newlang)) {
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang($newlang);
$outputlangs->load('commercial');
}
// Build document if it not exists
if (!$file || !is_readable($file)) {
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) {
dol_print_error($db, $object->error, $object->errors);
exit;
}
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/') . '[^\\-]+');
$file = $fileparams['fullname'];
}
print '<div class="clearboth"></div>';
print '<br>';
print load_fiche_titre($langs->trans('SendPropalByMail'));
dol_fiche_head('');
示例12: runTrigger
/**
* Function called when a Dolibarrr business event is done.
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
if (!empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) {
return 0;
}
// Log events is disabled (hidden features)
$key = 'MAIN_LOGEVENTS_' . $action;
//dol_syslog("xxxxxxxxxxx".$key);
if (empty($conf->global->{$key})) {
return 0;
}
// Log events not enabled for this action
if (empty($conf->entity)) {
$conf->entity = $entity;
}
// forcing of the entity if it's not defined (ex: in login form)
$date = dol_now();
// Actions
if ($action == 'USER_LOGIN') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
// Initialisation donnees (date,duree,texte,desc)
$text = "(UserLogged," . $object->login . ")";
$text .= empty($object->trigger_mesg) ? '' : ' - ' . $object->trigger_mesg;
$desc = "(UserLogged," . $object->login . ")";
$desc .= empty($object->trigger_mesg) ? '' : ' - ' . $object->trigger_mesg;
}
if ($action == 'USER_LOGIN_FAILED') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
// Initialisation donnees (date,duree,texte,desc)
$text = $object->trigger_mesg;
// Message direct
$desc = $object->trigger_mesg;
// Message direct
}
if ($action == 'USER_LOGOUT') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
// Initialisation donnees (date,duree,texte,desc)
$text = "(UserLogoff," . $object->login . ")";
$desc = "(UserLogoff," . $object->login . ")";
}
if ($action == 'USER_CREATE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$text = $langs->transnoentities("NewUserCreated", $object->login);
$desc = $langs->transnoentities("NewUserCreated", $object->login);
} elseif ($action == 'USER_MODIFY') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$text = $langs->transnoentities("EventUserModified", $object->login);
$desc = $langs->transnoentities("EventUserModified", $object->login);
} elseif ($action == 'USER_NEW_PASSWORD') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$text = $langs->transnoentities("NewUserPassword", $object->login);
$desc = $langs->transnoentities("NewUserPassword", $object->login);
} elseif ($action == 'USER_ENABLEDISABLE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
if ($object->statut == 0) {
$text = $langs->transnoentities("UserEnabled", $object->login);
$desc = $langs->transnoentities("UserEnabled", $object->login);
}
if ($object->statut == 1) {
$text = $langs->transnoentities("UserDisabled", $object->login);
$desc = $langs->transnoentities("UserDisabled", $object->login);
}
} elseif ($action == 'USER_DELETE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$text = $langs->transnoentities("UserDeleted", $object->login);
$desc = $langs->transnoentities("UserDeleted", $object->login);
} elseif ($action == 'GROUP_CREATE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$text = $langs->transnoentities("NewGroupCreated", $object->name);
$desc = $langs->transnoentities("NewGroupCreated", $object->name);
} elseif ($action == 'GROUP_MODIFY') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$text = $langs->transnoentities("GroupModified", $object->name);
$desc = $langs->transnoentities("GroupModified", $object->name);
} elseif ($action == 'GROUP_DELETE') {
//.........这里部分代码省略.........
示例13: strtolower
/**
* Show top header of page.
*
* @param PDF &$pdf Object PDF
* @param Object $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs, $conf, $mysoc;
$outputlangs->load("main");
$outputlangs->load("bills");
$outputlangs->load("orders");
$outputlangs->load("companies");
$default_font_size = pdf_getPDFFontSize($outputlangs);
// Do not add the BACKGROUND as this is for suppliers
//pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size + 3);
$posx = $this->page_largeur - $this->marge_droite - 100;
$posy = $this->marge_haute;
$pdf->SetXY($this->marge_gauche, $posy);
// Logo
/*
$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
if ($mysoc->logo)
{
if (is_readable($logo))
{
$height=pdf_getHeightForLogo($logo);
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
}
else
{
$pdf->SetTextColor(200,0,0);
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
}
}
else
{*/
$text = $this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
//}
$pdf->SetFont('', 'B', $default_font_size + 3);
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("SupplierInvoice") . " " . $outputlangs->convToOutputCharset($object->ref), '', 'R');
$pdf->SetFont('', '', $default_font_size + 2);
if ($object->ref_supplier) {
$posy += 5;
$pdf->SetXY($posx, $posy);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefSupplier") . " : " . $object->ref_supplier, '', 'R');
}
$posy += 6;
$pdf->SetXY($posx, $posy);
if ($object->date) {
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date") . " : " . dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
} else {
$pdf->SetTextColor(255, 0, 0);
$pdf->MultiCell(100, 4, strtolower($outputlangs->transnoentities("OrderToProcess")), '', 'R');
}
if ($showaddress) {
// Sender properties
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur);
// Show sender
$posy = 42;
$posx = $this->marge_gauche;
if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
$posx = $this->page_largeur - $this->marge_droite - 80;
}
$hautcadre = 40;
// Show sender frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom") . ":", 0, 'L');
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0, 0, 60);
// Show sender name
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
// Show sender information
$pdf->SetXY($posx + 2, $posy + 4 + dol_nboflines_bis($this->emetteur->name, 44) * 4);
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
// If BILLING contact defined on invoice, we use it
$usecontact = false;
$arrayidcontact = $object->getIdContact('internal', 'BILLING');
if (count($arrayidcontact) > 0) {
$usecontact = true;
$result = $object->fetch_contact($arrayidcontact[0]);
}
//.........这里部分代码省略.........
示例14: getExample
/**
* Return an example of result returned by getNextValue
*
* @param Translate $langs Object langs
* @param product $objproduct Object product
* @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
* @return string Return string example
*/
function getExample($langs, $objproduct = 0, $type = -1)
{
if ($type == 0 || $type == -1) {
$exampleproduct = $this->getNextValue($objproduct, 0);
if (!$exampleproduct) {
$exampleproduct = $langs->trans('NotConfigured');
}
if ($exampleproduct == "ErrorBadMask") {
$langs->load("errors");
$exampleproduct = $langs->trans($exampleproduct);
}
}
if ($type == 1 || $type == -1) {
$exampleservice = $this->getNextValue($objproduct, 1);
if (!$exampleservice) {
$exampleservice = $langs->trans('NotConfigured');
}
if ($exampleservice == "ErrorBadMask") {
$langs->load("errors");
$exampleservice = $langs->trans($exampleservice);
}
}
if ($type == 0) {
return $exampleproduct;
}
if ($type == 1) {
return $exampleservice;
}
return $exampleproduct . '<br>' . $exampleservice;
}
示例15: GETPOST
$dol_tz_string = preg_replace('/\\s/', '_', $dol_tz_string);
$dol_dst = 0;
if (isset($_POST["dst_first"]) && isset($_POST["dst_second"])) {
include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
$datenow = dol_now();
$datefirst = dol_stringtotime($_POST["dst_first"]);
$datesecond = dol_stringtotime($_POST["dst_second"]);
if ($datenow >= $datefirst && $datenow < $datesecond) {
$dol_dst = 1;
}
}
//print $datefirst.'-'.$datesecond.'-'.$datenow.'-'.$dol_tz.'-'.$dol_tzstring.'-'.$dol_dst; exit;
}
if (!$login) {
dol_syslog('Bad password, connexion refused', LOG_DEBUG);
$langs->load('main');
$langs->load('errors');
// Bad password. No authmode has found a good password.
$user->trigger_mesg = $langs->trans("ErrorBadLoginPassword") . ' - login=' . GETPOST("username", "alpha", 2);
// We set a generic message if not defined inside function checkLoginPassEntity or subfunctions
if (empty($_SESSION["dol_loginmesg"])) {
$_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword");
}
// TODO We should use a hook afterLoginFailed here, not a trigger.
// Call of triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface = new Interfaces($db);
$result = $interface->run_triggers('USER_LOGIN_FAILED', $user, $user, $langs, $conf, GETPOST("username", "alpha", 2));
if ($result < 0) {
$error++;
}