本文整理汇总了PHP中Translate::getAdminTranslation方法的典型用法代码示例。如果您正苦于以下问题:PHP Translate::getAdminTranslation方法的具体用法?PHP Translate::getAdminTranslation怎么用?PHP Translate::getAdminTranslation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Translate
的用法示例。
在下文中一共展示了Translate::getAdminTranslation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRenderedShopList
/**
* Render shop list
*
* @return string
*/
public function getRenderedShopList()
{
if (!Shop::isFeatureActive() || Shop::getTotalShops(false, null) < 2) {
return '';
}
$shop_context = Shop::getContext();
$context = Context::getContext();
$tree = Shop::getTree();
if ($shop_context == Shop::CONTEXT_ALL || $context->controller->multishop_context_group == false && $shop_context == Shop::CONTEXT_GROUP) {
$current_shop_value = '';
$current_shop_name = Translate::getAdminTranslation('All shops');
} elseif ($shop_context == Shop::CONTEXT_GROUP) {
$current_shop_value = 'g-' . Shop::getContextShopGroupID();
$current_shop_name = sprintf(Translate::getAdminTranslation('%s group'), $tree[Shop::getContextShopGroupID()]['name']);
} else {
$current_shop_value = 's-' . Shop::getContextShopID();
foreach ($tree as $group_id => $group_data) {
foreach ($group_data['shops'] as $shop_id => $shop_data) {
if ($shop_id == Shop::getContextShopID()) {
$current_shop_name = $shop_data['name'];
break;
}
}
}
}
$tpl = $this->createTemplate('helpers/shops_list/list.tpl');
$tpl->assign(array('tree' => $tree, 'current_shop_name' => $current_shop_name, 'current_shop_value' => $current_shop_value, 'multishop_context' => $context->controller->multishop_context, 'multishop_context_group' => $context->controller->multishop_context_group, 'is_shop_context' => $context->controller->multishop_context & Shop::CONTEXT_SHOP, 'is_group_context' => $context->controller->multishop_context & Shop::CONTEXT_GROUP, 'shop_context' => $shop_context, 'url' => $_SERVER['REQUEST_URI'] . ($_SERVER['QUERY_STRING'] ? '&' : '?') . 'setShopContext='));
return $tpl->fetch();
}
示例2: renderParameter
private function renderParameter()
{
$field_days = array(array('short_day' => 'L', 'name' => Translate::getAdminTranslation('Monday')), array('short_day' => 'M', 'name' => Translate::getAdminTranslation('Tuesday')), array('short_day' => 'C', 'name' => Translate::getAdminTranslation('Wednesday')), array('short_day' => 'J', 'name' => Translate::getAdminTranslation('Thursday')), array('short_day' => 'V', 'name' => Translate::getAdminTranslation('Friday')), array('short_day' => 'S', 'name' => Translate::getAdminTranslation('Saturday')), array('short_day' => 'D', 'name' => Translate::getAdminTranslation('Sunday')));
$this->fields_form = array('legend' => array('title' => $this->module->l('Campaign configuration (step 1)', 'adminmarketingsstep1'), 'icon' => 'icon-cogs'), 'input' => array(array('type' => _PS_MODE_DEV_ ? 'text' : 'hidden', 'lang' => false, 'label' => 'Ref :', 'name' => 'campaign_id', 'col' => 1, 'readonly' => 'readonly'), array('type' => 'text', 'lang' => false, 'label' => $this->module->l('Give a name to this campaign :', 'adminmarketingsstep1'), 'name' => 'campaign_name', 'col' => 7, 'required' => true), array('type' => 'datetime', 'lang' => false, 'name' => 'campaign_date_send', 'label' => $this->module->l('Sending date :', 'adminmarketingsstep1'), 'col' => 5, 'required' => true), array('type' => 'checkbox', 'label' => $this->module->l('Limit by day of the week :', 'adminmarketingsstep1'), 'class' => 'checkbox-inline', 'name' => 'week_day_limit', 'values' => array('query' => $field_days, 'id' => 'short_day', 'name' => 'name', 'class' => 'checkbox-inline')), array('type' => 'free', 'name' => 'schedule_sending', 'label' => $this->module->l('Schedule sending :', 'adminmarketingsstep1'))), 'submit' => array('title' => $this->module->l('Next', 'adminmarketingsstep1'), 'name' => 'submitSmsStep1', 'icon' => 'process-icon-next'));
$output = parent::renderForm();
return $this->getFormWrapperElement($output);
}
示例3: smartyTranslate
function smartyTranslate($params, &$smarty)
{
$htmlentities = !isset($params['js']);
$pdf = isset($params['pdf']);
$addslashes = isset($params['slashes']);
$sprintf = isset($params['sprintf']) ? $params['sprintf'] : false;
if ($pdf) {
return Translate::getPdfTranslation($params['s']);
}
$filename = !isset($smarty->compiler_object) || !is_object($smarty->compiler_object->template) ? $smarty->template_resource : $smarty->compiler_object->template->getTemplateFilepath();
// If the template is part of a module
if (!empty($params['mod'])) {
return Translate::getModuleTranslation($params['mod'], $params['s'], basename($filename, '.tpl'), $sprintf);
}
// If the tpl is at the root of the template folder
if (dirname($filename) == '.') {
$class = 'index';
} elseif (strpos($filename, 'helpers') === 0) {
$class = 'Helper';
} else {
// Split by \ and / to get the folder tree for the file
$folder_tree = preg_split('#[/\\\\]#', $filename);
$key = array_search('controllers', $folder_tree);
// If there was a match, construct the class name using the child folder name
// Eg. xxx/controllers/customers/xxx => AdminCustomers
if ($key !== false) {
$class = 'Admin' . Tools::toCamelCase($folder_tree[$key + 1], true);
} else {
$class = null;
}
}
return Translate::getAdminTranslation($params['s'], $class, $addslashes, $htmlentities, $sprintf);
}
示例4: __construct
public function __construct()
{
$this->date_months = array(1 => Translate::getAdminTranslation('January'), 2 => Translate::getAdminTranslation('February'), 3 => Translate::getAdminTranslation('March'), 4 => Translate::getAdminTranslation('April'), 5 => Translate::getAdminTranslation('May'), 6 => Translate::getAdminTranslation('June'), 7 => Translate::getAdminTranslation('July'), 8 => Translate::getAdminTranslation('August'), 9 => Translate::getAdminTranslation('September'), 10 => Translate::getAdminTranslation('October'), 11 => Translate::getAdminTranslation('November'), 12 => Translate::getAdminTranslation('December'));
$this->date_suffix = array(1 => $this->l('st'), 2 => $this->l('nd'), 3 => $this->l('rd'), 4 => $this->l('th'));
/* FR/PL : |d| |m| |Y| */
/* EN : |M| |d||S|, |Y| */
$this->date_format = $this->l('|M| |d||S|, |Y|');
}
示例5: renderList
public function renderList()
{
$this->getFieldsValues();
$field_days = array(array('short_day' => 'L', 'name' => Translate::getAdminTranslation('Monday')), array('short_day' => 'M', 'name' => Translate::getAdminTranslation('Tuesday')), array('short_day' => 'C', 'name' => Translate::getAdminTranslation('Wednesday')), array('short_day' => 'J', 'name' => Translate::getAdminTranslation('Thursday')), array('short_day' => 'V', 'name' => Translate::getAdminTranslation('Friday')), array('short_day' => 'S', 'name' => Translate::getAdminTranslation('Saturday')), array('short_day' => 'D', 'name' => Translate::getAdminTranslation('Sunday')));
$this->fields_form = array('legend' => array('title' => $this->module->l('Campaign configuration (step 1)', 'adminmarketingfstep1'), 'icon' => 'icon-cogs'), 'input' => array(array('type' => _PS_MODE_DEV_ ? 'text' : 'hidden', 'lang' => false, 'label' => 'Ref :', 'name' => 'campaign_id', 'col' => 1, 'readonly' => 'readonly'), array('type' => 'text', 'lang' => false, 'label' => $this->module->l('Campaign name :', 'adminmarketingfstep1'), 'name' => 'campaign_name', 'col' => 5, 'required' => true), array('type' => 'datetime', 'lang' => false, 'name' => 'campaign_date_send', 'label' => $this->module->l('Sending date :', 'adminmarketingfstep1'), 'col' => 5, 'required' => true), array('type' => 'checkbox', 'label' => $this->module->l('Limit by day of the week :', 'adminmarketingfstep1'), 'class' => 'checkbox-inline', 'name' => 'week_day_limit', 'values' => array('query' => $field_days, 'id' => 'short_day', 'name' => 'name', 'class' => 'checkbox-inline')), array('type' => 'free', 'name' => 'start_end_hours', 'label' => $this->module->l('Schedule sending :', 'adminmarketingfstep1'), 'required' => true), array('type' => 'free', 'name' => 'campaign_day_limit', 'label' => $this->module->l('Daily sending limit :', 'adminmarketingfstep1'))), 'submit' => array('title' => $this->module->l('Next', 'adminmarketingfstep1'), 'name' => 'submitFaxStep1', 'icon' => 'process-icon-next'));
$output = parent::renderForm();
$footer = $this->getTemplatePath() . 'footer.tpl';
$output .= $this->context->smarty->fetch($footer);
return $output;
}
示例6: getCurrentShopName
public function getCurrentShopName()
{
$shop_context = Shop::getContext();
$tree = Shop::getTree();
if ($this->noShopSelection()) {
$current_shop_name = Translate::getAdminTranslation('All shops');
} elseif ($shop_context == Shop::CONTEXT_GROUP) {
$current_shop_name = sprintf(Translate::getAdminTranslation('%s group'), $tree[Shop::getContextShopGroupID()]['name']);
} else {
foreach ($tree as $group_id => $group_data) {
foreach ($group_data['shops'] as $shop_id => $shop_data) {
if ($shop_id == Shop::getContextShopID()) {
$current_shop_name = $shop_data['name'];
break;
}
}
}
}
return $current_shop_name;
}
示例7: l
/**
* Non-static method which uses AdminController::translate()
*
* @param string $string Term or expression in english
* @param string|null $class Name of the class
* @param bool $addslashes If set to true, the return value will pass through addslashes(). Otherwise, stripslashes().
* @param bool $htmlentities If set to true(default), the return value will pass through htmlentities($string, ENT_QUOTES, 'utf-8')
* @return string The translation if available, or the english default text.
*/
protected function l($string, $class = null, $addslashes = false, $htmlentities = true)
{
if ($class === null || $class == 'AdminTab') {
$class = substr(get_class($this), 0, -10);
} elseif (strtolower(substr($class, -10)) == 'controller') {
/* classname has changed, from AdminXXX to AdminXXXController, so we remove 10 characters and we keep same keys */
$class = substr($class, 0, -10);
}
return Translate::getAdminTranslation($string, $class, $addslashes, $htmlentities);
}
示例8: runAdminTab
/**
* for retrocompatibility with old AdminTab, old index.php
*
* @return void
*/
function runAdminTab($tab, $ajaxMode = false)
{
$ajaxMode = (bool) $ajaxMode;
require_once _PS_ADMIN_DIR_ . '/init.php';
$cookie = Context::getContext()->cookie;
if (empty($tab) && !sizeof($_POST)) {
$tab = 'AdminDashboard';
$_POST['tab'] = $tab;
$_POST['token'] = Tools::getAdminTokenLite($tab);
}
// $tab = $_REQUEST['tab'];
if ($adminObj = checkingTab($tab)) {
Context::getContext()->controller = $adminObj;
// init is different for new tabs (AdminController) and old tabs (AdminTab)
if ($adminObj instanceof AdminController) {
if ($ajaxMode) {
$adminObj->ajax = true;
}
$adminObj->path = dirname($_SERVER["PHP_SELF"]);
$adminObj->run();
} else {
if (!$ajaxMode) {
require_once _PS_ADMIN_DIR_ . '/header.inc.php';
}
$isoUser = Context::getContext()->language->id;
$tabs = array();
$tabs = Tab::recursiveTab($adminObj->id, $tabs);
$tabs = array_reverse($tabs);
$bread = '';
foreach ($tabs as $key => $item) {
$bread .= ' <img src="../img/admin/separator_breadcrumb.png" style="margin-right:5px" alt=">" />';
if (count($tabs) - 1 > $key) {
$bread .= '<a href="?tab=' . $item['class_name'] . '&token=' . Tools::getAdminToken($item['class_name'] . intval($item['id_tab']) . (int) Context::getContext()->employee->id) . '">';
}
$bread .= $item['name'];
if (count($tabs) - 1 > $key) {
$bread .= '</a>';
}
}
if (!$ajaxMode && Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL && Context::getContext()->controller->multishop_context != Shop::CONTEXT_ALL) {
echo '<div class="multishop_info">';
if (Shop::getContext() == Shop::CONTEXT_GROUP) {
$shop_group = new ShopGroup((int) Shop::getContextShopGroupID());
printf(Translate::getAdminTranslation('You are configuring your store for group shop %s'), '<b>' . $shop_group->name . '</b>');
} elseif (Shop::getContext() == Shop::CONTEXT_SHOP) {
printf(Translate::getAdminTranslation('You are configuring your store for shop %s'), '<b>' . Context::getContext()->shop->name . '</b>');
}
echo '</div>';
}
if (Validate::isLoadedObject($adminObj)) {
if ($adminObj->checkToken()) {
if ($ajaxMode) {
// the differences with index.php is here
$adminObj->ajaxPreProcess();
$action = Tools::getValue('action');
// no need to use displayConf() here
if (!empty($action) && method_exists($adminObj, 'ajaxProcess' . Tools::toCamelCase($action))) {
$adminObj->{'ajaxProcess' . Tools::toCamelCase($action)}();
} else {
$adminObj->ajaxProcess();
}
// @TODO We should use a displayAjaxError
$adminObj->displayErrors();
if (!empty($action) && method_exists($adminObj, 'displayAjax' . Tools::toCamelCase($action))) {
$adminObj->{'displayAjax' . $action}();
} else {
$adminObj->displayAjax();
}
} else {
/* Filter memorization */
if (isset($_POST) && !empty($_POST) && isset($adminObj->table)) {
foreach ($_POST as $key => $value) {
if (is_array($adminObj->table)) {
foreach ($adminObj->table as $table) {
if (strncmp($key, $table . 'Filter_', 7) === 0 || strncmp($key, 'submitFilter', 12) === 0) {
$cookie->{$key} = !is_array($value) ? $value : serialize($value);
}
}
} elseif (strncmp($key, $adminObj->table . 'Filter_', 7) === 0 || strncmp($key, 'submitFilter', 12) === 0) {
$cookie->{$key} = !is_array($value) ? $value : serialize($value);
}
}
}
if (isset($_GET) && !empty($_GET) && isset($adminObj->table)) {
foreach ($_GET as $key => $value) {
if (is_array($adminObj->table)) {
foreach ($adminObj->table as $table) {
if (strncmp($key, $table . 'OrderBy', 7) === 0 || strncmp($key, $table . 'Orderway', 8) === 0) {
$cookie->{$key} = $value;
}
}
} elseif (strncmp($key, $adminObj->table . 'OrderBy', 7) === 0 || strncmp($key, $adminObj->table . 'Orderway', 12) === 0) {
$cookie->{$key} = $value;
}
}
//.........这里部分代码省略.........
示例9: AdminController
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2014 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
$con = new AdminController();
$con->init();
$con->initToolbar();
$con->initPageHeaderToolbar();
$con->setMedia();
$con->initHeader();
$con->initFooter();
$title = array(Translate::getAdminTranslation('Advanced parameters'), Translate::getAdminTranslation('1-Click upgrade'));
Context::getContext()->smarty->assign(array('navigationPipe', Configuration::get('PS_NAVIGATION_PIPE'), 'meta_title' => implode(' ' . Configuration::get('PS_NAVIGATION_PIPE') . ' ', $title), 'display_header' => true, 'display_footer' => true));
$dir = Context::getContext()->smarty->getTemplateDir(0) . 'controllers' . DIRECTORY_SEPARATOR . trim($con->override_folder, '\\/') . DIRECTORY_SEPARATOR;
$header_tpl = file_exists($dir . 'header.tpl') ? $dir . 'header.tpl' : 'header.tpl';
$tool_tpl = file_exists($dir . 'page_header_toolbar.tpl') ? $dir . 'page_header_toolbar.tpl' : 'page_header_toolbar.tpl';
Context::getContext()->smarty->assign(array('show_page_header_toolbar' => true, 'title' => implode(' ' . Configuration::get('PS_NAVIGATION_PIPE') . ' ', $title), 'toolbar_btn' => array()));
echo Context::getContext()->smarty->fetch($header_tpl);
echo Context::getContext()->smarty->fetch($tool_tpl);
示例10: postProcess
public function postProcess()
{
// On construit un login pour le compte
// ------------------------------------
// Si PS_SHOP_EMAIL = info@axalone.com
// Alors login = ps-info-axalone
// 1/ On ajoute 'ps-' devant l'email
// 2/ On retire l'extention .com à la fin
// 3/ On remplace toutes les lettres accentuées par leurs équivalents sans accent
// 4/ On remplace tous les sigles par des tirets
// 5/ Enfin on remplace les doubles/triples tirets par des simples
// --------------------------------------------------------------------------------
$company_login = 'ps-' . Configuration::get('PS_SHOP_EMAIL');
$company_login = Tools::substr($company_login, 0, strrpos($company_login, '.'));
$company_login = EMTools::removeAccents($company_login);
$company_login = Tools::strtolower($company_login);
$company_login = preg_replace('/[^a-z0-9-]/', '-', $company_login);
$company_login = preg_replace('/-{2,}/', '-', $company_login);
$cart_product = (string) Tools::getValue('product', '');
// Initialisation de l'API
// -----------------------
if (Tools::isSubmit('submitInscription')) {
// On prépare l'ouverture du compte
// --------------------------------
$company_name = (string) Tools::getValue('company_name');
$company_email = (string) Tools::getValue('company_email');
$company_phone = (string) Tools::getValue('company_phone');
$company_address1 = (string) Tools::getValue('company_address1');
$company_address2 = (string) Tools::getValue('company_address2');
$company_zipcode = (string) Tools::getValue('company_zipcode');
$company_city = (string) Tools::getValue('company_city');
$country_id = (int) Tools::getValue('country_id');
$country = new Country($country_id);
if (!is_object($country) || empty($country->id)) {
$this->errors[] = Tools::displayError('Country is invalid');
} else {
$company_country = Country::getNameById($this->context->language->id, $country_id);
}
if (!Validate::isGenericName($company_name)) {
$this->errors[] = sprintf(Tools::displayError('The %s field is required.'), '« ' . Translate::getAdminTranslation('Shop name', 'AdminStores') . ' »');
}
if (!Validate::isEmail($company_email)) {
$this->errors[] = sprintf(Tools::displayError('The %s field is required.'), '« ' . Translate::getAdminTranslation('Shop email', 'AdminStores') . ' »');
}
if (!Validate::isPhoneNumber($company_phone)) {
$this->errors[] = sprintf(Tools::displayError('The %s field is required.'), '« ' . Translate::getAdminTranslation('Phone', 'AdminStores') . ' »');
}
if (!Validate::isAddress($company_address1)) {
$this->errors[] = sprintf(Tools::displayError('The %s field is required.'), '« ' . Translate::getAdminTranslation('Shop address line 1', 'AdminStores') . ' »');
}
if ($country->zip_code_format && !$country->checkZipCode($company_zipcode)) {
$this->errors[] = Tools::displayError('Your Zip/postal code is incorrect.') . '<br />' . Tools::displayError('It must be entered as follows:') . ' ' . str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format)));
} elseif (empty($company_zipcode) && $country->need_zip_code) {
$this->errors[] = Tools::displayError('A Zip/postal code is required.');
} elseif ($company_zipcode && !Validate::isPostCode($company_zipcode)) {
$this->errors[] = Tools::displayError('The Zip/postal code is invalid.');
}
if (!Validate::isGenericName($company_city)) {
$this->errors[] = sprintf(Tools::displayError('The %s field is required.'), '« ' . Translate::getAdminTranslation('City', 'AdminStores') . ' »');
}
// We save these informations in the database
// ------------------------------------------
Db::getInstance()->insert('expressmailing_order_address', array('id_address' => 1, 'company_name' => pSQL($company_name), 'company_email' => pSQL($company_email), 'company_address1' => pSQL($company_address1), 'company_address2' => pSQL($company_address2), 'company_zipcode' => pSQL($company_zipcode), 'company_city' => pSQL($company_city), 'country_id' => $country_id, 'company_country' => pSQL($company_country), 'company_phone' => pSQL($company_phone), 'product' => pSQL($cart_product)), false, false, Db::REPLACE);
// If form contains 1 or more errors, we stop the process
// ------------------------------------------------------
if (is_array($this->errors) && count($this->errors)) {
return false;
}
// Open a session on Express-Mailing API
// -------------------------------------
if ($this->session_api->openSession()) {
// We create the account
// ---------------------
$response_array = array();
$base_url = Configuration::get('PS_SSL_ENABLED') == 0 ? Tools::getShopDomain(true, true) : Tools::getShopDomainSsl(true, true);
$module_dir = Tools::str_replace_once(_PS_ROOT_DIR_, '', _PS_MODULE_DIR_);
$parameters = array('login' => $company_login, 'info_company' => $company_name, 'info_email' => $company_email, 'info_phone' => $company_phone, 'info_address' => $company_address1 . "\r\n" . $company_address2, 'info_country' => $company_country, 'info_zipcode' => $company_zipcode, 'info_city' => $company_city, 'info_phone' => $company_phone, 'info_contact_firstname' => $this->context->employee->firstname, 'info_contact_lastname' => $this->context->employee->lastname, 'email_report' => $this->context->employee->email, 'gift_code' => 'prestashop_' . Translate::getModuleTranslation('expressmailing', '3320', 'session_api'), 'INFO_WWW' => $base_url . $module_dir . $this->module->name . '/campaigns/index.php');
if ($this->session_api->createAccount($parameters, $response_array)) {
// If the form include the buying process (field 'product')
// We initiate a new cart with the product selected
// --------------------------------------------------------
if ($cart_product) {
Tools::redirectAdmin('index.php?controller=AdminMarketingBuy&submitCheckout&campaign_id=' . $this->campaign_id . '&media=' . $this->next_controller . '&product=' . $cart_product . '&token=' . Tools::getAdminTokenLite('AdminMarketingBuy'));
exit;
}
// Else we back to the mailing process
// -----------------------------------
Tools::redirectAdmin($this->next_action);
exit;
}
if ($this->session_api->error == 11) {
// Account already existe, we print the rescue form (with password input)
// ----------------------------------------------------------------------
$response_array = array();
$parameters = array('login' => $company_login);
$this->session_api->resendPassword($parameters, $response_array);
$this->generateRescueForm();
return;
} else {
// Other error
//.........这里部分代码省略.........
示例11: smartyTranslate
function smartyTranslate($params, &$smarty)
{
$htmlentities = !isset($params['js']);
$pdf = isset($params['pdf']);
$addslashes = isset($params['slashes']) || isset($params['js']);
$sprintf = isset($params['sprintf']) ? $params['sprintf'] : array();
if (!empty($params['d'])) {
if (isset($params['tags'])) {
$backTrace = debug_backtrace();
$errorMessage = sprintf('Unable to translate "%s" in %s. tags() is not supported anymore, please use sprintf().', $params['s'], $backTrace[0]['args'][1]->template_resource);
if (_PS_MODE_DEV_) {
throw new Exception($errorMessage);
} else {
PrestaShopLogger::addLog($errorMessage);
}
}
if (!is_array($sprintf)) {
$backTrace = debug_backtrace();
$errorMessage = sprintf('Unable to translate "%s" in %s. sprintf() parameter should be an array.', $params['s'], $backTrace[0]['args'][1]->template_resource);
if (_PS_MODE_DEV_) {
throw new Exception($errorMessage);
} else {
PrestaShopLogger::addLog($errorMessage);
return $params['s'];
}
}
return Context::getContext()->getTranslator()->trans($params['s'], $sprintf, $params['d']);
}
if ($pdf) {
return Translate::smartyPostProcessTranslation(Translate::getPdfTranslation($params['s'], $sprintf), $params);
}
$filename = !isset($smarty->compiler_object) || !is_object($smarty->compiler_object->template) ? $smarty->template_resource : $smarty->compiler_object->template->getTemplateFilepath();
// If the template is part of a module
if (!empty($params['mod'])) {
return Translate::smartyPostProcessTranslation(Translate::getModuleTranslation($params['mod'], $params['s'], basename($filename, '.tpl'), $sprintf, isset($params['js'])), $params);
}
// If the tpl is at the root of the template folder
if (dirname($filename) == '.') {
$class = 'index';
}
// If the tpl is used by a Helper
if (strpos($filename, 'helpers') === 0) {
$class = 'Helper';
} else {
// If the tpl is used by a Controller
if (!empty(Context::getContext()->override_controller_name_for_translations)) {
$class = Context::getContext()->override_controller_name_for_translations;
} elseif (isset(Context::getContext()->controller)) {
$class_name = get_class(Context::getContext()->controller);
$class = substr($class_name, 0, strpos(Tools::strtolower($class_name), 'controller'));
} else {
// Split by \ and / to get the folder tree for the file
$folder_tree = preg_split('#[/\\\\]#', $filename);
$key = array_search('controllers', $folder_tree);
// If there was a match, construct the class name using the child folder name
// Eg. xxx/controllers/customers/xxx => AdminCustomers
if ($key !== false) {
$class = 'Admin' . Tools::toCamelCase($folder_tree[$key + 1], true);
} elseif (isset($folder_tree[0])) {
$class = 'Admin' . Tools::toCamelCase($folder_tree[0], true);
}
}
}
return Translate::smartyPostProcessTranslation(Translate::getAdminTranslation($params['s'], $class, $addslashes, $htmlentities, $sprintf), $params);
}
示例12: _addCoupons
/**
* @param ShopgateCart $cart
* @return array
* @throws PrestaShopException
*/
protected function _addCoupons(ShopgateCart $cart)
{
$results = array();
$carrierId = null;
if ($cart->getShippingInfos()) {
$apiResponse = $cart->getShippingInfos()->getApiResponse();
if (!empty($apiResponse)) {
$apiResponse = unserialize($apiResponse);
if (!empty($apiResponse['carrierId'])) {
$carrierId = $apiResponse['carrierId'];
}
}
}
$package = null;
if (!empty($carrierId)) {
$package = array('products' => null, 'id_carrier' => $carrierId);
}
foreach ($cart->getExternalCoupons() as $coupon) {
$result = new ShopgateExternalCoupon();
$result->setCode($coupon->getCode());
$result->setCurrency($this->_getCurrency());
$result->setIsValid(false);
$result->setNotValidMessage(Tools::displayError('This voucher does not exists.'));
if (version_compare(_PS_VERSION_, '1.5.0.0', '>=')) {
/** @var CartRuleCore $cartRule */
$cartRule = new CartRule(CartRule::getIdByCode($coupon->getCode()));
if (Validate::isLoadedObject($cartRule)) {
$result->setName($cartRule->getFieldByLang('name'), $this->getPlugin()->getContext()->language->id);
$result->setDescription($cartRule->getFieldByLang('description', $this->getPlugin()->getContext()->language->id));
$result->setTaxType(Translate::getAdminTranslation('not_taxable'));
$result->setAmountGross($cartRule->getContextualValue(true, $this->getPlugin()->getContext(), null, $package));
/**
* validate coupon
*/
if ($validateException = $cartRule->checkValidity($this->getPlugin()->getContext(), false, true)) {
$result->setIsValid(false);
$result->setNotValidMessage($validateException);
} else {
$result->setIsValid(true);
$result->setNotValidMessage(null);
$this->getPlugin()->getContext()->cart->addCartRule($cartRule->id);
$this->getPlugin()->getContext()->cart->save();
}
}
}
$results[] = $result;
}
return $results;
}
示例13: installAdminTab
public function installAdminTab($tab_class, $tab_active, $tab_name, $tab_class_parent)
{
if (!Tab::getIdFromClassName((string) $tab_class)) {
// Get tab parent id
// -----------------
if (in_array((string) $tab_class_parent, $this->ids_tabs)) {
$id_tab_parent = $this->ids_tabs[(string) $tab_class_parent];
} else {
$id_tab_parent = Tab::getIdFromClassName((string) $tab_class_parent);
}
// Add the new tab
// ---------------
$tab = new Tab();
$tab->name = array();
foreach (Language::getLanguages() as $language) {
$tab->name[$language['id_lang']] = Translate::getAdminTranslation((string) $tab_name, 'expressmailing', false, false);
}
$tab->class_name = (string) $tab_class;
$tab->module = $this->name;
$tab->id_parent = (int) $id_tab_parent;
$tab->active = (bool) $tab_active ? 1 : 0;
if (!$tab->save()) {
return false;
}
$this->ids_tabs[(string) $tab_class] = $tab->id;
}
// Else, Tab already installed
// ---------------------------
return true;
}
示例14: renderList
public function renderList()
{
$field_days = array(array('short_day' => 'L', 'name' => Translate::getAdminTranslation('Monday')), array('short_day' => 'M', 'name' => Translate::getAdminTranslation('Tuesday')), array('short_day' => 'C', 'name' => Translate::getAdminTranslation('Wednesday')), array('short_day' => 'J', 'name' => Translate::getAdminTranslation('Thursday')), array('short_day' => 'V', 'name' => Translate::getAdminTranslation('Friday')), array('short_day' => 'S', 'name' => Translate::getAdminTranslation('Saturday')), array('short_day' => 'D', 'name' => Translate::getAdminTranslation('Sunday')));
$this->fields_form = array('legend' => array('title' => $this->module->l('Campaign configuration (step 1)', 'adminmarketingestep1'), 'icon' => 'icon-cogs'), 'input' => array(array('type' => _PS_MODE_DEV_ ? 'text' : 'hidden', 'lang' => false, 'label' => 'Ref :', 'name' => 'campaign_id', 'col' => 1, 'readonly' => 'readonly'), array('type' => 'text', 'lang' => false, 'label' => $this->module->l('Emailing subject / object :', 'adminmarketingestep1'), 'name' => 'campaign_name', 'col' => 5, 'required' => true), array('type' => 'datetime', 'lang' => false, 'name' => 'campaign_date_send', 'label' => $this->module->l('Sending date :', 'adminmarketingestep1'), 'col' => 5, 'required' => true), array('type' => 'switch', 'lang' => false, 'class' => 'chosen', 'label' => $this->module->l('Activate opening tracking :', 'adminmarketingestep1'), 'name' => 'campaign_tracking', 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->module->l('yes')), array('id' => 'active_off', 'value' => 0, 'label' => $this->module->l('no')))), array('type' => 'switch', 'lang' => false, 'label' => $this->module->l('Activate links tracking :', 'adminmarketingestep1'), 'name' => 'campaign_linking', 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->module->l('yes')), array('id' => 'active_off', 'value' => 0, 'label' => $this->module->l('no')))), array('type' => 'switch', 'lang' => false, 'label' => $this->module->l('In case of unsubscription, add the subscriber on red list :', 'adminmarketingestep1'), 'name' => 'campaign_redlist', 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->module->l('yes')), array('id' => 'active_off', 'value' => 0, 'label' => $this->module->l('no')))), array('type' => 'free', 'name' => 'limit_daily', 'label' => $this->module->l('Daily sending limit :', 'adminmarketingestep1')), array('type' => 'checkbox', 'label' => $this->module->l('Limit by day of the week :', 'adminmarketingestep1'), 'class' => 'checkbox-inline', 'name' => 'week_day_limit', 'values' => array('query' => $field_days, 'id' => 'short_day', 'name' => 'name', 'class' => 'checkbox-inline'))), 'submit' => array('title' => $this->module->l('Next', 'adminmarketingestep1'), 'name' => 'submitEmailingStep1', 'icon' => 'process-icon-next'));
$this->getFieldsValues();
$output = parent::renderForm();
$footer = $this->getTemplatePath() . 'footer.tpl';
$output .= $this->context->smarty->fetch($footer);
return $output;
}
示例15: foreach
if (checkTabRights($t2['id_tab']) === true and (bool) $t2['active']) {
echo '<li><a href="index.php?controller=' . $t2['class_name'] . '&token=' . Tools::getAdminTokenLite($t2['class_name']) . '">' . $t2['name'] . '</a></li>';
}
}
echo '</ul></li>';
$echoLi = '';
foreach ($subTabs as $t2) {
if (checkTabRights($t2['id_tab']) === true and (bool) $t2['active']) {
$echoLi .= '<li class="subitem"><a href="index.php?controller=' . $t2['class_name'] . '&token=' . Tools::getAdminTokenLite($t2['class_name']) . '">' . $t2['name'] . '</a></li>';
}
}
if ($current) {
$mainsubtablist = $echoLi;
}
$echoLis .= '<div id="tab' . (int) $t['id_tab'] . '_subtabs" style="display:none">' . $echoLi . '</div>';
}
}
echo ' </ul>' . $echoLis;
echo '
</div>
<div id="main">
<div id="content">' . (file_exists(_PS_ADMIN_DIR_ . '/../install') ? '<div style="background-color: #FFEBCC;border: 1px solid #F90;line-height: 20px;margin: 0px 0px 10px;padding: 10px 20px;">' . Translate::getAdminTranslation('For security reasons, you must also:') . ' ' . Translate::getAdminTranslation('delete the /install folder') . '</div>' : '') . '
';
if (defined('_PS_MODE_DEV_') && _PS_MODE_DEV_) {
echo '<div class="warn">This tab is an AdminTab</div>';
}
if (Shop::isFeatureActive() && Context::getContext()->controller->multishop_context != Shop::CONTEXT_ALL) {
echo '<div class="multishop_toolbar">
<span class="text_multishop">' . Translate::getAdminTranslation('Multistore configuration for') . '</span>' . Helper::renderShopList();
echo '</div>';
}