/**
  * translate to english
  *
  * @throws NotFoundException
  * @param string text
  * @return the text were translated
  * @author quyhoa
  * @create day: 11/05/2015
  */
 public function translate($fromLanguage, $toLanguage, $text)
 {
     $translate = new Translate();
     $rs = '';
     $rs = $translate->tranlated($fromLanguage, $toLanguage, $text);
     return $rs;
 }
 /**
  *	Constructor
  *
  *  @param		DoliDB		$db			Database handler
  *	@param		Conf		$conf		Handler de conf
  *	@param		Translate	$langs		Handler de langue
  *	@param		User		$user		Handler du user connecte
  */
 function __construct($db, $conf, $langs, $user)
 {
     $this->id = "Perso";
     $this->length = $langs->trans("SetupPerso");
     $this->db = $db;
     $this->conf = $conf;
     $this->langs = $langs;
     $this->user = $user;
     if (empty($conf->global->USER_PASSWORD_PATTERN)) {
         // default value (8carac, 1maj, 1digit, 1spe,  3 repeat, no ambi at auto generation.
         dolibarr_set_const($db, "USER_PASSWORD_PATTERN", '8;1;1;1;3;1', 'chaine', 0, '', $conf->entity);
     }
     $this->Maj = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
     $this->Min = strtolower($this->Maj);
     $this->Nb = "0123456789";
     $this->Spe = "!@#\$%&*()_-+={}[]\\|:;'/";
     $this->Ambi = array("1", "I", "l", "|", "O", "0");
     $tabConf = explode(";", $conf->global->USER_PASSWORD_PATTERN);
     $this->length2 = $tabConf[0];
     $this->NbMaj = $tabConf[1];
     $this->NbNum = $tabConf[2];
     $this->NbSpe = $tabConf[3];
     $this->NbRepeat = $tabConf[4];
     $this->WithoutAmbi = $tabConf[5];
     if ($this->WithoutAmbi) {
         $this->Maj = str_replace($this->Ambi, "", $this->Maj);
         $this->Min = str_replace($this->Ambi, "", $this->Min);
         $this->Nb = str_replace($this->Ambi, "", $this->Nb);
         $this->Spe = str_replace($this->Ambi, "", $this->Spe);
     }
     $this->All = str_shuffle($this->Maj . $this->Min . $this->Nb . $this->Spe);
     //$this->All = $this->Maj. $this->Min. $this->Nb. $this->Spe;
     //$this->All =  $this->Spe;
 }
 public function testConstruct()
 {
     try {
         $dataObject = new Translate(array('invalid' => 'foo'));
         $this->fail('Expected \\UnexpectedValueException exception not thrown.');
     } catch (\UnexpectedValueException $e) {
     }
     $dataObject = new Translate(array('translations' => 'foo'));
     $this->assertEquals($dataObject->getTranslations(), 'foo');
 }
Example #4
0
 public function index()
 {
     //$profiler = new Profiler;
     if (isset($_GET['emailtest'])) {
         $this->emailtest();
         die;
     }
     if (isset($_GET['database'])) {
         $this->alterDatabase();
     }
     if (isset($_GET['cronjob'])) {
         $this->cronjob();
         die;
     }
     @session_start();
     //     $lan = (@$_GET['l']<>'en') ? "es" : 'en';
     if (@$_GET['l'] != '') {
         $_SESSION['lan'] = @$_GET['l'] != 'en' ? array("es_ES", 'España') : array("en_US", 'USA');
     }
     if (@$_SESSION['lan'] != "") {
         Kohana::config_set("locale.language", $_SESSION['lan']);
     }
     $lang = new Translate();
     $lang->currency();
     $defaultobj = "category";
     $defaultact = "index";
     $module = $this->uri->segment("index") != '' ? $this->uri->segment("index") : $defaultobj;
     $action = $this->uri->segment($module) != '' ? $this->uri->segment($module) : $defaultact;
     $module = ucfirst($lang->word->{$module});
     $lib = new $module();
     $action = @$lang->word->{$action};
     $this->template->widget = $lib->GetWidgets();
     if (method_exists($lib, $action) === FALSE) {
         $lib = new $module();
         $lib->{$defaultact}();
     } else {
         $lib->{$action}();
     }
     $table_page = new fpp_page_Model();
     $header = $table_page->db2cls(46);
     $footer = $table_page->db2cls(47);
     $meta_description = $table_page->db2cls(48);
     $tr_content_page = Basic::TransVar("content_page");
     $this->template->header = strip_tags($header->{$tr_content_page});
     $this->template->footer = $footer->{$tr_content_page};
     $this->template->meta_description = strip_tags($meta_description->{$tr_content_page});
     //Executes Action's
     $this->template->title = $this->uri->segment() == '' ? 'floreria Rosabel | florerias peru | floreria | enviar flores peru' : Kohana::config("core.title_page") . $lib->GetTitle();
     $this->template->content = $lib->GetContent();
     $this->template->keywords = $lib->GetKeywords() != '' ? $lib->GetKeywords() : 'enviar flores peru, florerías en lima, florerias en lima, envio de flores a peru,florerías,florerias lima, florerias en Lima,floreria lima, Florerias de Lima, Flores domicilio Lima, Florerias en San Isidro, envio de flores a lima, envio de flores en peru,floreria amor y amistad,flores dia de las madres,arreglos florales, floreria san borja peru, florerias en trujillo, florerias en arequipa, floreria los olivos, florerias unidas,envio de flores lima, delivery flores lima, envio flores, floreria san isidro, arreglos flores, rosas, orquideas, giraloes, tulipanes, delivery flowers, send flowers lima, roses, flower shop lima';
     if (request::is_ajax()) {
         $this->auto_render = FALSE;
         echo $lib->GetContent();
     }
 }
 /**
  * Define array with couple subtitution key => subtitution value
  *
  * @param	Object		$object			Object
  * @param   Translate	$outputlangs    Language object for output
  * @return	array						Array of substitution key->code
  */
 function get_substitutionarray_thirdparty($object, $outputlangs)
 {
     global $conf;
     if (empty($object->country) && !empty($object->country_code)) {
         $object->country = $outputlangs->transnoentitiesnoconv("Country" . $object->country_code);
     }
     if (empty($mysoc->state) && !empty($mysoc->state_code)) {
         $object->state = getState($object->state_code, 0);
     }
     return array('company_name' => $object->name, 'company_email' => $object->email, 'company_phone' => $object->phone, 'company_fax' => $object->fax, 'company_address' => $object->address, 'company_zip' => $object->zip, 'company_town' => $object->town, 'company_country' => $object->country, 'company_country_code' => $object->country_code, 'company_state' => $object->state, 'company_state_code' => $object->state_code, 'company_web' => $object->url, 'company_barcode' => $object->barcode, 'company_vatnumber' => $object->tva_intra, 'company_customercode' => $object->code_client, 'company_suppliercode' => $object->code_fournisseur, 'company_customeraccountancycode' => $object->code_compta, 'company_supplieraccountancycode' => $object->code_compta_fournisseur, 'company_juridicalstatus' => $object->forme_juridique, 'company_capital' => $object->capital, 'company_idprof1' => $object->idprof1, 'company_idprof2' => $object->idprof2, 'company_idprof3' => $object->idprof3, 'company_idprof4' => $object->idprof4, 'company_idprof5' => $object->idprof5, 'company_idprof6' => $object->idprof6, 'company_note' => $object->note);
 }
Example #6
0
 public function actionIndex()
 {
     $taxModel = LbTax::model()->getTaxes();
     $list = UserList::model()->getList();
     $translate = Translate::model()->search();
     $translate = new Translate('search');
     $translate->unsetAttributes();
     // clear any default values
     if (isset($_GET['Translate'])) {
         $translate->attributes = $_GET['Translate'];
     }
     LBApplication::render($this, 'index', array('taxModel' => $taxModel, 'list' => $list, 'translate' => $translate));
     //		$this->render('index');
 }
 /**
  * Action для страницы "Добавить категорию"
  */
 public function actionCreate()
 {
     // Проверка доступа
     self::checkAdmin();
     // Обработка формы
     if (isset($_POST['submit'])) {
         // Если форма отправлена
         // Получаем данные из формы
         $name = $_POST['name'];
         $sortOrder = $_POST['sort_order'];
         $status = $_POST['status'];
         //Транслетелируем для ЧПУ
         $translate = $name;
         $url = Translate::GetInTranslate($translate);
         // Флаг ошибок в форме
         $errors = false;
         // При необходимости можно валидировать значения нужным образом
         if (!isset($name) || empty($name)) {
             $errors[] = 'Заполните поля';
         }
         if ($errors == false) {
             // Если ошибок нет
             // Добавляем новую категорию
             Category::createCategory($name, $sortOrder, $status, $url);
             // Перенаправляем пользователя на страницу управлениями категориями
             header("Location: /admin/category");
         }
     }
     require_once ROOT . '/views/admin_category/create.php';
     return true;
 }
 public function testExecuteRequest()
 {
     try {
         $response = $this->clientStub->executeRequest();
         $this->fail('Excepted \\RuntimeException to be thrown.');
     } catch (\RuntimeException $e) {
     }
     $this->clientStub->setApiKey('key');
     try {
         $response = $this->clientStub->executeRequest();
         $this->fail('Excepted \\RuntimeException to be thrown.');
     } catch (\RuntimeException $e) {
     }
     $this->clientStub->addSourceText('The quick brown fox jumps over the lazy dog.');
     try {
         $response = $this->clientStub->executeRequest();
         $this->fail('Excepted \\RuntimeException to be thrown.');
     } catch (\RuntimeException $e) {
     }
     $this->clientStub->setTargetLanguage('fr');
     $response = $this->clientStub->executeRequest();
     $this->assertInstanceOf('\\Google\\Api\\Response', $response);
     $this->assertTrue($response->isSuccess());
     $this->assertInstanceOf('\\Google\\Api\\Response\\Data\\Translate', $response->getData());
 }
Example #9
0
 /**
  * @todo Implement testIsValidLanguage().
  */
 public function testIsValidLanguage()
 {
     // Testing for german (de_DE) translation
     $this->assertTrue($this->object->isValidLanguage('de_DE'));
     // Checking result for invalid language
     $this->assertFalse($this->object->isValidLanguage('xx_XX'));
 }
Example #10
0
 public function defaultAction()
 {
     if (Translate::getId() != '') {
         $config = Config::getArray();
         $languages = $config['backendLanguages']['list'];
         $language_id = Translate::getId();
         $strings = array();
         if (is_array($languages[$language_id]['translationClientside'])) {
             if (count($languages[$language_id]['translationClientside']) > 0) {
                 foreach ($languages[$language_id]['translationClientside'] as $translation_file) {
                     $temp = (include $translation_file);
                     $strings = array_merge($strings, $temp);
                 }
             }
         } else {
             if ($languages[$language_id]['translationClientside'] != '') {
                 $strings = (include $languages[$language_id]['translationClientside']);
             }
         }
         $this->view->assign('backendTranslation', $strings);
     } else {
         $this->view->assign('backendTranslation', array());
     }
     $useGlobalElementsPage = false;
     $pages = new Pages();
     if ($pages->isGlobalElementsPageTemplateAvailable()) {
         if ($pages->isGlobalElementsPageAvailable()) {
             $useGlobalElementsPage = true;
         }
     }
     $this->view->assign('useGlobalElementsPage', $useGlobalElementsPage);
     $this->view->assign('globalElementsPageId', $pages->getGlobalElementsPageId());
 }
Example #11
0
    public function getHtml()
    {
        $users = $this->users->getAll();
        $userGroups = new UserGroups();
        $html = '';
        foreach ($users as $user) {
            $user_groups = $this->users->getUserGroups($user['id']);
            $user_groups_html = '';
            if ($user_groups !== false) {
                if (count($user_groups) > 0) {
                    foreach ($user_groups as $user_group_id) {
                        $user_group_data = $this->user_groups->getById($user_group_id);
                        if ($user_groups_html != '') {
                            $user_groups_html .= ', ';
                        }
                        $user_groups_html .= $user_group_data['name'];
                    }
                }
            }
            $html .= '
					<tr data-id="' . $user['id'] . '">
						<td><input type="checkbox" name="users[' . $user['id'] . ']" value="1" id="user_' . $user['id'] . '"></td>
						<td>' . $user['screenname'] . '</td>
						<td>' . ($user['privileges'] == Auth::PRIVILEGES_ADMIN ? Translate::get('Administrator') : Translate::get('User')) . '</td>
						<td>' . $user['login'] . '</td>
						<td>' . $user_groups_html . '</td>
					</tr>
				';
        }
        return $html;
    }
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);
}
 public static function l($string, $specific = false, $name = '')
 {
     if (empty($name)) {
         $name = self::MODULE_NAME;
     }
     return Translate::getModuleTranslation($name, $string, $specific ? $specific : $name);
 }
Example #14
0
 public function init($inmueble, $pagina)
 {
     if (!Session::getInstance()->usuario) {
         return '/admin/ingresar';
     }
     $this->inmuebleCodigo = $inmueble;
     $this->inmueble = new Inmuebles();
     $this->inmueble->codigo = $inmueble;
     $this->inmueble->queryAll();
     if (!$this->inmueble->found()) {
         return true;
     }
     $this->paginaCodigo = $pagina;
     $this->pagina = new Inmuebles_Paginas();
     $this->pagina->inmueble_id = $this->inmueble->id;
     $this->pagina->codigo = $pagina;
     $this->pagina->queryAll();
     if (!$this->pagina->found()) {
         return true;
     }
     $this->idiomas = Translate::all();
     $inmuebleContenidos = Inmuebles_Contenidos::all(array('inmueble_id' => $this->inmueble->id));
     foreach ($inmuebleContenidos as $inmuebleContenido) {
         $this->inmuebleContenidos[$inmuebleContenido->idioma] = $inmuebleContenido;
     }
     $paginaContenidos = Inmuebles_Paginas_Contenidos::all(array('inmueble_pagina_id' => $this->pagina->id));
     foreach ($paginaContenidos as $paginaContenido) {
         $this->paginaContenidos[$paginaContenido->idioma] = $paginaContenido;
     }
     return true;
 }
 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);
 }
Example #16
0
 /**
  * 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();
 }
function smarty_function_translate($params, Smarty_Internal_Template $template)
{
    $output = '';
    if (isset($params['text'])) {
        $output = Translate::get($params['text']);
    }
    return $output;
}
Example #18
0
 /**
  *
  * Add new panel to customizer
  *
  * @throws \SilverWp\Customizer\Panel\Exception
  * @access private
  */
 private function addPanel()
 {
     if (!isset($this->panel_id)) {
         throw new Exception(Translate::translate('If You want add panel to your section first define panel_id class property.'));
     }
     $params = $this->createPanelParams();
     \Kirki::add_panel($this->panel_id, $params);
 }
Example #19
0
 public function get()
 {
     $return = array('idiomas' => Translate::all(), 'inmuebleCodigo' => $this->inmuebleCodigo, 'inmueble' => $this->inmueble, 'paginaCodigo' => $this->paginaCodigo, 'pagina' => $this->pagina);
     foreach ($this->datosNombres as $nombre) {
         $return[$nombre] = Request::getPost($nombre, isset($this->datos[$nombre]) ? $this->datos[$nombre]->contenido : '');
     }
     return $return;
 }
Example #20
0
 public function getTranslateWorld($word_key, $language_key)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'word_key=:word_key and language=:language';
     $criteria->params = array(':word_key' => $word_key, ':language' => $language_key);
     $result = Translate::model()->find($criteria);
     return $result['word_value'];
 }
Example #21
0
 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|');
 }
Example #22
0
 public function init()
 {
     Registry::set('config', new Config());
     // Initializing the language
     $translation = Translate::getInstance();
     // If requested with ?lang=<lang> we load the language.
     $lang = $translation->getLanguageToLoad();
     $translation->loadLanguage($lang);
 }
Example #23
0
 public function getArrayTranslate()
 {
     $model = Translate::model()->findAll();
     $arr = array();
     foreach ($model as $item) {
         $arr[$item->lb_tranlate_en] = $item->lb_translate_vn;
     }
     return $arr;
 }
Example #24
0
 public static function locale($locale = null)
 {
     if (!(null === $locale)) {
         self::$locale = null;
         if (file_exists('translations/' . $locale . '.mo')) {
             self::$locale = $locale;
         }
     }
     return self::$locale;
 }
Example #25
0
 /**
  *
  * @return Currency_Data
  */
 public function getData()
 {
     if (!$this->data) {
         if ($this->getProvider() == null) {
             throw new Exception(Translate::_('No currency provider added'));
         }
         $this->data = $this->getProvider()->getData($this->getBaseCurrency());
     }
     return $this->data;
 }
Example #26
0
 /**
  * Display a single value
  *
  * @param string $value
  * @return string
  */
 public function displayValue($value)
 {
     if (isset($this->values[$value])) {
         $value = $this->values[$value];
     }
     if ($this->translationEnabled) {
         $value = parent::displayValue($value);
     }
     return $value;
 }
 public function testLoadDataNoTheme()
 {
     $forceReload = true;
     $this->expectsSetConfig(null, null);
     $this->moduleList->expects($this->once())->method('getNames')->will($this->returnValue([]));
     $this->appState->expects($this->once())->method('getAreaCode')->will($this->returnValue('frontend'));
     $this->packDictionary->expects($this->once())->method('getDictionary')->will($this->returnValue([]));
     $this->resource->expects($this->any())->method('getTranslationArray')->will($this->returnValue([]));
     $this->assertEquals($this->translate, $this->translate->loadData(null, $forceReload));
 }
Example #28
0
 public static function dispatchHostname()
 {
     $default = Configuration::getInstance()->idioma;
     $server = explode('.', $_SERVER['SERVER_NAME']);
     $idioma = array_shift($server);
     if (!Translate::locale($idioma)) {
         return $default;
     }
     return true;
 }
 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;
 }
 public function initContent()
 {
     if (!Tools::usingSecureMode() && Configuration::get('PS_SSL_ENABLED')) {
         // You can uncomment these lines if you want to force https even from localhost and automatically redirect
         // header('HTTP/1.1 301 Moved Permanently');
         // header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']);
         // exit();
         $clientIsMaintenanceOrLocal = in_array(Tools::getRemoteAddr(), array_merge(array('127.0.0.1'), explode(',', Configuration::get('PS_MAINTENANCE_IP'))));
         // If ssl is enabled, https protocol is required. Exception for maintenance and local (127.0.0.1) IP
         if ($clientIsMaintenanceOrLocal) {
             $warningSslMessage = Tools::displayError('SSL is activated. However, your IP is allowed to enter unsecure mode for maintenance or local IP issues.');
         } else {
             $url = 'https://' . Tools::safeOutput(Tools::getServerName()) . Tools::safeOutput($_SERVER['REQUEST_URI']);
             $warningSslMessage = sprintf(Translate::ppTags(Tools::displayError('SSL is activated. Please connect using the following link to [1]log into secure mode (https://)[/1]', false), array('<a href="%s">')), $url);
         }
         $this->context->smarty->assign('warningSslMessage', $warningSslMessage);
     }
     if (file_exists(_PS_ADMIN_DIR_ . '/../install')) {
         $this->context->smarty->assign('wrong_install_name', true);
     }
     if (basename(_PS_ADMIN_DIR_) == 'admin' && file_exists(_PS_ADMIN_DIR_ . '/../admin/')) {
         $rand = 'admin' . sprintf('%03d', rand(0, 999)) . Tools::strtolower(Tools::passwdGen(6)) . '/';
         if (@rename(_PS_ADMIN_DIR_ . '/../admin/', _PS_ADMIN_DIR_ . '/../' . $rand)) {
             Tools::redirectAdmin('../' . $rand);
         } else {
             $this->context->smarty->assign(array('wrong_folder_name' => true));
         }
     } else {
         $rand = basename(_PS_ADMIN_DIR_) . '/';
     }
     $this->context->smarty->assign(array('randomNb' => $rand, 'adminUrl' => Tools::getCurrentUrlProtocolPrefix() . Tools::getShopDomain() . __PS_BASE_URI__ . $rand));
     // Redirect to admin panel
     if (Tools::isSubmit('redirect') && Validate::isControllerName(Tools::getValue('redirect'))) {
         $this->context->smarty->assign('redirect', Tools::getValue('redirect'));
     } else {
         $tab = new Tab((int) $this->context->employee->default_tab);
         $this->context->smarty->assign('redirect', $this->context->link->getAdminLink($tab->class_name));
     }
     if ($nb_errors = count($this->errors)) {
         $this->context->smarty->assign(array('errors' => $this->errors, 'nbErrors' => $nb_errors, 'shop_name' => Tools::safeOutput(Configuration::get('PS_SHOP_NAME')), 'disableDefaultErrorOutPut' => true));
     }
     if ($email = Tools::getValue('email')) {
         $this->context->smarty->assign('email', $email);
     }
     if ($password = Tools::getValue('password')) {
         $this->context->smarty->assign('password', $password);
     }
     $this->setMedia();
     $this->initHeader();
     parent::initContent();
     $this->initFooter();
     //force to disable modals
     $this->context->smarty->assign('modals', null);
 }