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


PHP TAdiantiCoreTranslator::setLanguage方法代码示例

本文整理汇总了PHP中TAdiantiCoreTranslator::setLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP TAdiantiCoreTranslator::setLanguage方法的具体用法?PHP TAdiantiCoreTranslator::setLanguage怎么用?PHP TAdiantiCoreTranslator::setLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TAdiantiCoreTranslator的用法示例。


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

示例1: onLogin

 /**
  * Validate the login
  */
 function onLogin()
 {
     try {
         TTransaction::open('library');
         $data = $this->form->getData('StdClass');
         // validate form data
         $this->form->validate();
         $language = $data->language ? $data->language : 'en';
         TAdiantiCoreTranslator::setLanguage($language);
         TApplicationTranslator::setLanguage($language);
         $auth = User::autenticate($data->{'user'}, $data->{'password'});
         if ($auth) {
             TSession::setValue('logged', TRUE);
             TSession::setValue('login', $data->{'user'});
             TSession::setValue('language', $data->language);
             // reload page
             TApplication::executeMethod('SetupPage', 'onSetup');
         }
         TTransaction::close();
         // finaliza a transação
     } catch (Exception $e) {
         TSession::setValue('logged', FALSE);
         // exibe a mensagem gerada pela exceção
         new TMessage('error', '<b>Erro</b> ' . $e->getMessage());
         // desfaz todas alterações no banco de dados
         TTransaction::rollback();
     }
 }
开发者ID:jhonleandres,项目名称:crmbf,代码行数:31,代码来源:LoginForm.class.php

示例2: __construct

 /**
  * Constructor Method
  */
 function __construct()
 {
     parent::__construct();
     parent::set_size_request(840, 640);
     parent::set_position(GTK::WIN_POS_CENTER);
     parent::connect_simple('delete-event', array($this, 'onClose'));
     parent::connect_simple('destroy', array('Gtk', 'main_quit'));
     parent::set_title(self::APP_TITLE);
     parent::set_icon(GdkPixbuf::new_from_file('favicon.png'));
     $gtk = GtkSettings::get_default();
     $gtk->set_long_property("gtk-button-images", TRUE, 0);
     $gtk->set_long_property("gtk-menu-images", TRUE, 0);
     self::$inst = $this;
     $ini = parse_ini_file('application.ini');
     $lang = $ini['language'];
     TAdiantiCoreTranslator::setLanguage($lang);
     TApplicationTranslator::setLanguage($lang);
     date_default_timezone_set($ini['timezone']);
     $this->content = new GtkFixed();
     $vbox = new GtkVBox();
     parent::add($vbox);
     $vbox->pack_start(GtkImage::new_from_file('app/images/pageheader-gtk.png'), false, false);
     $MenuBar = TMenuBar::newFromXML('menu.xml');
     $vbox->pack_start($MenuBar, false, false);
     $vbox->pack_start($this->content, true, true);
     parent::show_all();
 }
开发者ID:enieber,项目名称:adianti,代码行数:30,代码来源:index.gtk.php

示例3: run

 public static function run($debug = FALSE)
 {
     new TSession();
     $lang = TSession::getValue('language') ? TSession::getValue('language') : 'en';
     TAdiantiCoreTranslator::setLanguage($lang);
     TApplicationTranslator::setLanguage($lang);
     if ($_REQUEST) {
         $class = isset($_REQUEST['class']) ? $_REQUEST['class'] : '';
         if (!TSession::getValue('logged') and $class !== 'LoginForm') {
             echo TPage::getLoadedCSS();
             echo TPage::getLoadedJS();
             new TMessage('error', 'Not logged');
             return;
         }
         parent::run($debug);
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:17,代码来源:engine.php

示例4: spl_autoload_register

<?php

// define the autoloader
include_once 'lib/adianti/util/TAdiantiLoader.class.php';
spl_autoload_register(array('TAdiantiLoader', 'autoload_web'));
// read configurations
$ini = parse_ini_file('application.ini');
date_default_timezone_set($ini['timezone']);
TAdiantiCoreTranslator::setLanguage($ini['language']);
TApplicationTranslator::setLanguage($ini['language']);
// define constants
define('APPLICATION_NAME', $ini['application']);
define('OS', strtoupper(substr(PHP_OS, 0, 3)));
define('PATH', dirname(__FILE__));
class TApplication extends TCoreApplication
{
    public static function run($debug = FALSE)
    {
        new TSession();
        if ($_REQUEST) {
            parent::run($debug);
        }
    }
}
TApplication::run(TRUE);
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:25,代码来源:engine.php

示例5: TSession

<?php

require_once 'init.php';
$uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
new TSession();
$template = 'theme1';
$lang = TSession::getValue('language') ? TSession::getValue('language') : 'en';
TAdiantiCoreTranslator::setLanguage($lang);
TApplicationTranslator::setLanguage($lang);
if (TSession::getValue('logged')) {
    TTransaction::open('library');
    $member = User::newFromLogin(TSession::getValue('login'));
    if ($member->role->mnemonic == 'LIBRARIAN') {
        $content = file_get_contents("app/templates/{$template}/librarian.html");
    } else {
        if ($member->role->mnemonic == 'OPERATOR') {
            $content = file_get_contents("app/templates/{$template}/operator.html");
        } else {
            if ($member->role->mnemonic == 'ADMINISTRATOR') {
                $content = file_get_contents("app/templates/{$template}/admin.html");
            }
        }
    }
    TTransaction::close();
} else {
    $content = file_get_contents("app/templates/{$template}/login.html");
}
$content = TApplicationTranslator::translateTemplate($content);
$content = str_replace('{LIBRARIES}', file_get_contents("app/templates/{$template}/libraries.html"), $content);
$content = str_replace('{URI}', $uri, $content);
$content = str_replace('{class}', isset($_REQUEST['class']) ? $_REQUEST['class'] : '', $content);
开发者ID:jfrank1500,项目名称:curso_php,代码行数:31,代码来源:index.php


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