本文整理汇总了PHP中LanguageManager::getLanguages方法的典型用法代码示例。如果您正苦于以下问题:PHP LanguageManager::getLanguages方法的具体用法?PHP LanguageManager::getLanguages怎么用?PHP LanguageManager::getLanguages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LanguageManager
的用法示例。
在下文中一共展示了LanguageManager::getLanguages方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: languages
/**
* Affiche une liste de tous les languages de la base de donnée.
* Selectionne par défaut une langue utilisée si elle est passée en paramètre
* @param LanguageManager $lang_manager
* @param int $spoken_language_id
*
*/
public static function languages(LanguageManager $lang_manager, $spoken_language_id = null)
{
$languages = $lang_manager->getLanguages();
echo '<option value="">' . _('Choose a Language') . '</option>';
foreach ($languages as $language) {
if ($language->id() == $spoken_language_id) {
$selected = 'selected';
} else {
$selected = '';
}
echo '<option value="' . $language->id() . '" ' . $selected . '>' . $language->name() . '</option>';
}
}
示例2:
<div id="search" >
<div align="center">
<div style="width:980px;">
<div><input type="text" name="txtString" id="txtString" class="keyboardInput"></div><!--1-->
<?php
//echo $translator->response->languageSelectBox;
?>
<!-- 3 -->
<p style="font-size:20px; text-align: left">
<select name="tgt_lang" id="tgtlang">
<option value="">Search in ...</option><?php
//$langs = $lm->getListOfLang();
$langs = $lm->getLanguages();
foreach ($langs as $lang) {
echo '<option value="';
echo $lang->getLangId();
echo '">';
echo $lang->getLangName();
echo '</option>';
}
?>
</select>
<b>Authen:</b>
<select name="auth" id="authst">
<option value="">Select one:</option>
<option value="1">Original</option>
<option value="2">Translation</option>
<option value="3">Unknown</option>
示例3: form_to_create_entry
function form_to_create_entry($err_messages)
{
//$errmsg_for_ = "Hi!";
$lm = new LanguageManager();
$am = new AuthenManager();
?>
<!-- 1 -->
<div align="center">
<div style="width: 850px">
<form action="" method="post" style="text-align: right; display: block;">
<?php
// date_default_timezone_set('America/Toronto');
// echo "<br>Today: " . date("Y-m-d H:i:s");
?>
<!-- <br>views/entry/form_to_<mark>create</mark>_entry.php-->
<div id="entry_create_form">
<div class="entry_create_row">
<div id="entry_create_form_title">Create an entry
<div class="note">
Note: fields marked with the red asterisk (<span class="Painted_red">*</span>) are mandatory.
</div>
</div>
</div>
<!-- language -->
<div class="entry_create_row">
<div class="entry_create_record_title">
Language <span class="Painted_red">*</span>
<span class="question" id="entrycreatelang" >?</span>
</div>
<div class="entry_create_record_value">
<select name="langid">
<option value="">This will be in ...</option><?php
//$langs = $lm->getListOfLang();
$langs = $lm->getLanguages();
if (isset($_POST['langid'])) {
$this_langid = $_POST['langid'];
foreach ($langs as $lang) {
echo '<option value="';
echo $lang->getLangId();
echo '"';
echo $this_langid == $lang->getLangId() ? ' selected="selected"' : '';
echo '">';
echo $lang->getLangName();
echo '</option>';
}
} else {
foreach ($langs as $lang) {
echo '<option value="';
echo $lang->getLangId();
echo '">';
echo $lang->getLangName();
echo '</option>';
}
}
?>
</select>
<strong style=" color: #FF365D;"><?php
echo $err_messages['langid'];
?>
</strong>
</div>
</div>
<!-- entry_authen_status_id -->
<div class="entry_create_row">
<div class="entry_create_record_title">Authenticity
<span class="Painted_red">*</span>
<span class="question" id="entrycreateauthen" >?</span>
</div>
<div class="entry_create_record_value">
<select name="authen" id="inputAuthen">
<option value="">This phrase is ...</option><?php
$authens = $am->getAuthens();
if (isset($_POST['authen'])) {
$this_authen_id = $_POST['authen'];
foreach ($authens as $authen) {
echo '<option value="';
echo $authen->getAuthenId();
echo '"';
echo $this_authen_id == $authen->getAuthenId() ? ' selected="selected"' : '';
echo '">';
echo $authen->getAuthenName();
echo '</option>';
}
} else {
foreach ($authens as $authen) {
echo '<option value="';
echo $authen->getAuthenId();
echo '">';
echo $authen->getAuthenName();
echo '</option>';
}
}
?>
//.........这里部分代码省略.........
示例4: form_to_edit_entry
function form_to_edit_entry($entry, $err_messages)
{
$x = "Hi!";
$lm = new LanguageManager();
$auth = $entry->getEntryAuthenStatusId();
$status = $auth == 1 ? '1' : "not 1";
// echo "<br>ftee:: status = " . $status;
?>
<!-- 1 -->
<div align="center">
<div style="width: 850px">
<form action="" method="post" style="text-align: right; display: block;">
<!--<form action="entryview.php" method="post">-->
<?php
//if($_GET['id']){ // 2
//$em = new EntryManager(); // 3
//$entry = $em->getEntryById($_GET['id']);
//}// 2
?>
<!--Entry/form_to_<mark>edit</mark>_entry.php-->
<div id="entry_create_form">
<div class="entry_create_row">
<div id="entry_create_form_title">Editing <?php
if ($entry->getEntryAuthenStatusId() == 1) {
echo 'the Original';
echo ' ("' . substr($entry->getEntryText(), 0, 30) . '...")';
}
if ($entry->getEntryAuthenStatusId() == 2) {
echo "the Translation";
echo ' ("' . substr($entry->getEntryText(), 0, 30) . '...")';
}
?>
<div class="note">
Note: fields marked with the red asterisk (<span class="Painted_red">*</span>) are mandatory.
</div>
</div>
</div>
<!-- ent_entry_id -->
<div class="entry_create_row" style="display: none;">
<div class="entry_create_record_title">Id</div>
<div class="entry_create_record_value">
<!--<?php
//echo $entry->getEntryId();
?>
-->
<input name="id"
type="text"
value="<?php
echo $entry->getEntryId();
?>
" readonly /><!--Lily 141029-->
</div>
</div>
<!-- lan_lang_name -->
<div class="entry_create_row">
<div class="entry_create_record_title">
Language
<span class="question" id="entrycreatelang" >?</span>
</div>
<div class="entry_create_record_value">
<select name="langid">
<option value="">This is in ...</option><?php
//$langs = $lm->getListOfLang();
$langs = $lm->getLanguages();
$lang_of_this_entry = $entry->getEntryLanguage();
foreach ($langs as $lang) {
echo '<option value="';
echo $lang->getLangId();
echo '"';
echo $lang->getLangName() == $lang_of_this_entry ? ' selected="selected"' : '';
echo '>';
echo $lang->getLangName();
echo '</option>';
}
?>
</select>
<strong style=" color: #FF365D;"><?php
echo $err_messages['langid'];
?>
</strong>
</div>
</div>
<!-- Not sure if we need this
<div class="entry_create_row">
<div class="entry_create_record_title">Target language <span class="Painted_red">*</span> </div>
<div class="entry_create_record_value">
<select name="entry_target_lang">
<option selected="selected">Choose one...</option>
<option>English</option>
<option>Russian</option>
<option>Chinese</option>
</select>
</div>
</div>
-->
<!-- ent_entry_text -->
//.........这里部分代码省略.........
示例5: LanguageManager
<?php
require_once './config.php';
require_once BUSINESS_DIR_LANG . 'LanguageManager.php';
//For getting the languages in the select
$Language = new LanguageManager();
$LanguageList = $Language->getLanguages();
?>
<!DOCTYPE html>
<html>
<head>
<title> Registration Form</title>
<!--<link rel="stylesheet" href="./style.css">-->
<script src="plug-in/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="views/registration/style.css">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<!-- for date picking purpose-->
<script>
$(document).ready(function(){
var works=true;
//Coding for the captcha, to see if the user has typed the correct text
$('#mycaptcha').on('keyup',function(){
if($('#mycaptcha').val().length>=5){
$.post("user_test/captcha_check.php",