示例#1
0
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new LocaleManager();
     }
     return self::$_instance;
 }
示例#2
0
文件: Language.php 项目: hung5s/yap
 /**
  * Get all language option, listing all language friendly
  * @static
  * @return array
  */
 public static function getLanguageOption()
 {
     $languageList = LocaleManager::getStandardLocales();
     $models = self::model()->findAll('status=true');
     $option = array();
     if (count($models)) {
         foreach ($models as $model) {
             $option[$model->locale_id] = $languageList[$model->locale_id];
         }
         return $option;
     }
     return array();
 }
示例#3
0
 static function buildLanguageSelector()
 {
     $localeManager = LocaleManager::getInstance();
     $html = '<div id="langHolder"><form id="langSelectorForm" method="get" action="' . $_SERVER['PHP_SELF'] . '"><p>';
     $html .= '<select id="lang" name="lang">' . PHP_EOL;
     foreach ($localeManager->getLocales() as $langId => $lang) {
         $html .= '<option value="' . $langId . '"';
         if ($langId == $localeManager->getSelectedLanaguageId()) {
             $html .= ' selected="selected"';
         }
         $html .= '>' . _($lang['Name']) . '</option>';
     }
     $html .= '</select><input type="submit" class="hidden" /></p></form></div>';
     return $html;
 }
示例#4
0
} else {
    $availableCities = $db->getAvailableCities('Dest', $currentRegion);
}
$availableDestCities =& $availableCities;
$availableSrcCities =& $availableCities;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/reset-fonts.css">
<link rel="stylesheet" type="text/css" href="lib/bootstrap/css/bootstrap_custom.min.css">
<link rel="stylesheet" type="text/css" href="css/common.css">
<link rel="stylesheet" type="text/css" href="css/index.css">
<?php 
if (LocaleManager::getInstance()->isRtl()) {
    ?>
<link rel="stylesheet" type="text/css" href="css/common_rtl.css">
<?php 
}
?>
<title>Carpool</title>
</head>
<body>
<div id="bd">
<?php 
echo View_Navbar::buildNavbar();
echo View_Header::render(_('Welcome To The Carpool'), _('The colleagues, listed below, may be able to provide a ride both to and from the listed locations'));
?>
<div id="content">
	<div id="searchFormHolder">
示例#5
0
 function getQuestionsAnswersByLang($lang)
 {
     debug(__METHOD__ . "({$lang})");
     assert(array_key_exists($lang, LocaleManager::getInstance()->getLocales()));
     try {
         $stmt = $this->_db->prepare('SELECT Id, Question, Answer FROM QuestionsAnswers WHERE Lang = :lang');
         $stmt->bindParam(':lang', $lang);
         $stmt->execute();
         return $stmt->fetchAll(PDO::FETCH_ASSOC);
     } catch (PDOException $e) {
         logException($e);
         return false;
     }
 }
示例#6
0
{
    global $logger;
    $logger->doLog(Logger::LOG_WARN, $str);
}
function err($str)
{
    global $logger;
    $logger->doLog(Logger::LOG_ERR, $str);
}
function logException(Exception $e)
{
    global $logger;
    $logger->logException($e);
}
// Initialize locale and region objects
LocaleManager::init();
RegionManager::init();
// Start session
AuthHandler::init();
// Initialize the ACL
$acl = new SimpleAcl();
$acl->addRole(ROLE_GUEST);
$acl->addRole(ROLE_AUTHORIZED_ACCESS, ROLE_GUEST);
$acl->addRole(ROLE_IDENTIFIED, ROLE_GUEST);
$acl->addRole(ROLE_IDENTIFIED_REGISTERED, ROLE_IDENTIFIED);
$acl->addRole(ROLE_ADMINISTRATOR, ROLE_IDENTIFIED_REGISTERED);
if (ENV === ENV_DEVELOPMENT) {
    $acl->addResource(ROLE_GUEST, array('webres.php', 'test.php'));
}
$acl->addResource(ROLE_GUEST, array('auth.php', 'optout.php'));
if (getConfiguration('auth.mode') == AuthHandler::AUTH_MODE_PASS) {
示例#7
0
">
		<tr>
			<th>
    			<span><?php 
    echo _('Language');
    ?>
</span>
    		</th>
			<th></th>		
    		<th></th>
		</tr>
<?php 
    $locales = LocaleManager::getInstance()->getLocales();
    $currentQuestions = DatabaseHelper::getInstance()->getQuestionsAnswers();
    foreach ($currentQuestions as $questionAnswerAllLangs) {
        $id = $questionAnswerAllLangs[LocaleManager::getDefaultLocale()]['Id'];
        $first = true;
        foreach ($locales as $lang => $locale) {
            $questionAnswer = isset($questionAnswerAllLangs[$lang]) ? $questionAnswerAllLangs[$lang] : null;
            ?>
    	<tr>
    		<td>
    			<span><?php 
            echo $locales[$lang]['Name'];
            ?>
</span>
    		</td>
        	<td>
        		<input style="width: 100%;" type="text" id="question_<?php 
            echo $id;
            ?>