本文整理汇总了PHP中ilLanguage::_lookupEntry方法的典型用法代码示例。如果您正苦于以下问题:PHP ilLanguage::_lookupEntry方法的具体用法?PHP ilLanguage::_lookupEntry怎么用?PHP ilLanguage::_lookupEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilLanguage
的用法示例。
在下文中一共展示了ilLanguage::_lookupEntry方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayForm
public function displayForm()
{
global $lng;
$this->tpl->addBlockFile("CONTENT", "content", "tpl.startup_screen.html", "Services/Init");
$this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
$this->tpl->addBlockFile("STARTUP_CONTENT", "startup_content", "tpl.usr_registration.html", "Services/Registration");
$this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
$this->tpl->setVariable("TXT_PAGEHEADLINE", $lng->txt("registration"));
$lang_opts = array();
foreach ($lng->getInstalledLanguages() as $lang_key) {
$lang_opts[$lang_key] = ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_" . $lang_key);
}
// #11237
if (sizeof($lang_opts) > 1) {
// language selection
$this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
$this->tpl->setVariable("TXT_OK", $lng->txt("ok"));
$this->tpl->setVariable("TXT_CHOOSE_LANGUAGE", $lng->txt("choose_language"));
asort($lang_opts);
$this->tpl->setCurrentBlock("languages");
foreach ($lang_opts as $lang_key => $lang_caption) {
$this->tpl->setVariable("LANG_NAME", $lang_caption);
$this->tpl->setVariable("LANG_ICON", $lang_key);
if ($lang_key == $lng->getLangKey()) {
$this->tpl->setVariable("SELECTED_LANG", " selected=\"selected\"");
}
$this->tpl->parseCurrentBlock();
}
}
if (!$this->form) {
$this->__initForm();
}
$this->tpl->setVariable("FORM", $this->form->getHTML());
}
示例2: displayForm
/**
*
*/
public function displayForm()
{
/**
* @var $lng ilLanguage
*/
global $lng;
ilStartUpGUI::initStartUpTemplate(array('tpl.usr_registration.html', 'Services/Registration'), true);
$this->tpl->setVariable('TXT_PAGEHEADLINE', $this->lng->txt('registration'));
$lang_opts = array();
foreach ($lng->getInstalledLanguages() as $lang_key) {
$lang_opts[$lang_key] = ilLanguage::_lookupEntry($lang_key, 'meta', 'meta_l_' . $lang_key);
}
// #11237
if (sizeof($lang_opts) > 1) {
asort($lang_opts);
foreach ($lang_opts as $lang_key => $lang_caption) {
$this->tpl->setCurrentBlock('lang_headline_languages');
$this->tpl->setVariable('LANG_HEADLINE_LANGUAGES_LANG_NAME', $lang_caption);
$this->tpl->setVariable('LANG_HEADLINE_LANGUAGES_LANG_KEY', $lang_key);
if ($lang_key == $lng->getLangKey()) {
$this->tpl->setVariable('LANG_HEADLINE_LANGUAGES_SELECTED_LANG', ' selected="selected"');
}
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock('lang_headline');
$this->tpl->setVariable('LANG_CHANGE_CMD', 'displayForm');
$this->tpl->setVariable('LANG_CHANGE_FORMACTION', $this->ctrl->getFormAction($this, 'displayForm'));
$this->tpl->setVariable('LANG_CHANGE_TXT_OK', $lng->txt('ok'));
$this->tpl->setVariable('LANG_CHANGE_TXT_CHOOSE_LANGUAGE', $lng->txt('choose_language'));
$this->tpl->setCurrentBlock('lang_headline');
}
if (!$this->form) {
$this->__initForm();
}
$this->tpl->setVariable('FORM', $this->form->getHTML());
}
示例3: __txt
function __txt($language, $key, $module = 'common')
{
global $ilDB;
include_once './Services/Language/classes/class.ilLanguage.php';
return ilLanguage::_lookupEntry($language, $module, $key);
}
示例4: initGeneralSettingsForm
/**
* Init general settings form.
*
*/
public function initGeneralSettingsForm()
{
global $lng, $ilUser, $styleDefinition, $ilSetting;
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$this->form = new ilPropertyFormGUI();
// language
if ($this->userSettingVisible("language")) {
$languages = $this->lng->getInstalledLanguages();
$options = array();
foreach ($languages as $lang_key) {
$options[$lang_key] = ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_" . $lang_key);
}
$si = new ilSelectInputGUI($this->lng->txt("language"), "language");
$si->setOptions($options);
$si->setValue($ilUser->getLanguage());
$si->setDisabled($ilSetting->get("usr_settings_disable_language"));
$this->form->addItem($si);
}
// skin/style
include_once "./Services/Style/classes/class.ilObjStyleSettings.php";
if ($this->userSettingVisible("skin_style")) {
$templates = $styleDefinition->getAllTemplates();
if (is_array($templates)) {
$si = new ilSelectInputGUI($this->lng->txt("skin_style"), "skin_style");
$options = array();
foreach ($templates as $template) {
// get styles information of template
$styleDef = new ilStyleDefinition($template["id"]);
$styleDef->startParsing();
$styles = $styleDef->getStyles();
foreach ($styles as $style) {
if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"], $style["id"])) {
continue;
}
$options[$template["id"] . ":" . $style["id"]] = $styleDef->getTemplateName() . " / " . $style["name"];
}
}
$si->setOptions($options);
$si->setValue($ilUser->skin . ":" . $ilUser->prefs["style"]);
$si->setDisabled($ilSetting->get("usr_settings_disable_skin_style"));
$this->form->addItem($si);
}
}
// screen reader optimization
if ($this->userSettingVisible("screen_reader_optimization")) {
$cb = new ilCheckboxInputGUI($this->lng->txt("user_screen_reader_optimization"), "screen_reader_optimization");
$cb->setChecked($ilUser->prefs["screen_reader_optimization"]);
$cb->setDisabled($ilSetting->get("usr_settings_disable_screen_reader_optimization"));
$cb->setInfo($this->lng->txt("user_screen_reader_optimization_info"));
$this->form->addItem($cb);
}
// hits per page
if ($this->userSettingVisible("hits_per_page")) {
$si = new ilSelectInputGUI($this->lng->txt("hits_per_page"), "hits_per_page");
$hits_options = array(10, 15, 20, 30, 40, 50, 100, 9999);
$options = array();
foreach ($hits_options as $hits_option) {
$hstr = $hits_option == 9999 ? $this->lng->txt("no_limit") : $hits_option;
$options[$hits_option] = $hstr;
}
$si->setOptions($options);
$si->setValue($ilUser->prefs["hits_per_page"]);
$si->setDisabled($ilSetting->get("usr_settings_disable_hits_per_page"));
$this->form->addItem($si);
}
// Users Online
if ($this->userSettingVisible("show_users_online")) {
$si = new ilSelectInputGUI($this->lng->txt("show_users_online"), "show_users_online");
$options = array("y" => $this->lng->txt("users_online_show_y"), "associated" => $this->lng->txt("users_online_show_associated"), "n" => $this->lng->txt("users_online_show_n"));
$si->setOptions($options);
$si->setValue($ilUser->prefs["show_users_online"]);
$si->setDisabled($ilSetting->get("usr_settings_disable_show_users_online"));
$this->form->addItem($si);
}
// Store last visited
$lv = new ilSelectInputGUI($this->lng->txt("user_store_last_visited"), "store_last_visited");
$options = array(0 => $this->lng->txt("user_lv_keep_entries"), 1 => $this->lng->txt("user_lv_keep_only_for_session"), 2 => $this->lng->txt("user_lv_do_not_store"));
$lv->setOptions($options);
$lv->setValue((int) $ilUser->prefs["store_last_visited"]);
$this->form->addItem($lv);
// hide_own_online_status
if ($this->userSettingVisible("hide_own_online_status")) {
$cb = new ilCheckboxInputGUI($this->lng->txt("hide_own_online_status"), "hide_own_online_status");
$cb->setChecked($ilUser->prefs["hide_own_online_status"] == "y");
$cb->setDisabled($ilSetting->get("usr_settings_disable_hide_own_online_status"));
$this->form->addItem($cb);
}
include_once 'Services/Authentication/classes/class.ilSessionReminder.php';
if (ilSessionReminder::isGloballyActivated()) {
$cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled');
$cb->setInfo($this->lng->txt('session_reminder_info'));
$cb->setValue(1);
$cb->setChecked((int) $ilUser->getPref('session_reminder_enabled'));
$expires = ilSession::getSessionExpireValue();
$lead_time_gui = new ilNumberInputGUI($this->lng->txt('session_reminder_lead_time'), 'session_reminder_lead_time');
$lead_time_gui->setInfo(sprintf($this->lng->txt('session_reminder_lead_time_info'), ilFormat::_secondsToString($expires, true)));
//.........这里部分代码省略.........
示例5: txt
/**
* gets the text for a given topic
* if the topic is not in the list, the topic itself with "-" will be returned
*
* @access public
* @param string topic
* @return string text clear-text
*/
function txt($a_topic, $a_default_lang_fallback_mod = "")
{
if (empty($a_topic)) {
return "";
}
// remember the used topics
self::$used_topics[$a_topic] = $a_topic;
$translation = "";
if (isset($this->text[$a_topic])) {
$translation = $this->text[$a_topic];
}
if ($translation == "" && $a_default_lang_fallback_mod != "") {
// #13467 - try current language first (could be missing module)
if ($this->lang_key != $this->lang_default) {
$translation = ilLanguage::_lookupEntry($this->lang_key, $a_default_lang_fallback_mod, $a_topic);
}
// try default language last
if ($translation == "" || $translation == "-" . $a_topic . "-") {
$translation = ilLanguage::_lookupEntry($this->lang_default, $a_default_lang_fallback_mod, $a_topic);
}
}
if ($translation == "") {
if (ILIAS_LOG_ENABLED && is_object($this->log)) {
$this->log->writeLanguageLog($a_topic, $this->lang_key);
}
return "-" . $a_topic . "-";
} else {
return $translation;
}
}
示例6: txt
function txt($language, $key, $module = 'common')
{
include_once 'Services/Language/classes/class.ilLanguage.php';
return ilLanguage::_lookupEntry($language, $module, $key);
}
示例7: showUserAgreement
/**
* show user agreement
*/
function showUserAgreement()
{
global $lng, $tpl, $ilUser;
require_once "./Services/User/classes/class.ilUserAgreement.php";
$tpl->addBlockFile("CONTENT", "content", "tpl.startup_screen.html", "Services/Init");
$tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
$tpl->addBlockFile("STARTUP_CONTENT", "startup_content", "tpl.view_usr_agreement.html", "Services/Init");
$tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
// ilUtil::sendInfo();
// display infopanel if something happened
ilUtil::infoPanel();
// language selection
$languages = $lng->getInstalledLanguages();
// #11237
if (sizeof($languages) > 1) {
$tpl->setVariable("TXT_CHOOSE_LANGUAGE", $lng->txt("choose_language"));
$tpl->setVariable("TXT_OK", $lng->txt("ok"));
$count = (int) round(count($languages) / 2);
$num = 1;
foreach ($languages as $lang_key) {
$tpl->setCurrentBlock("languages");
$tpl->setVariable("LANG_VAL_CMD", $this->ctrl->getCmd());
$tpl->setVariable("AGR_LANG_ACTION", $this->ctrl->getFormAction($this));
$tpl->setVariable("LANG_NAME", ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_" . $lang_key));
$tpl->setVariable("LANG_ICON", $lang_key);
$tpl->setVariable("LANG_KEY", $lang_key);
$tpl->setVariable("BORDER", 0);
$tpl->setVariable("VSPACE", 0);
$tpl->parseCurrentBlock();
$num++;
}
}
$tpl->setCurrentBlock("content");
// display tabs
$tpl->setVariable("TXT_PAGEHEADLINE", $lng->txt("usr_agreement"));
$tpl->setVariable("TXT_PAGETITLE", "ILIAS3 - " . $lng->txt("usr_agreement"));
$tpl->setVariable("TXT_USR_AGREEMENT", ilUserAgreement::_getText());
if ($this->ctrl->getCmd() == "getAcceptance") {
if ($_POST["status"] == "accepted") {
$ilUser->writeAccepted();
ilUtil::redirect("index.php?target=" . $_GET["target"] . "&client_id=" . CLIENT_ID);
}
$tpl->setVariable("VAL_CMD", "getAcceptance");
$tpl->setVariable("AGR_LANG_ACTION", $this->ctrl->getFormAction($this));
$tpl->setCurrentBlock("get_acceptance");
$tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
$tpl->setVariable("ACCEPT_CHECKBOX", ilUtil::formCheckbox(0, "status", "accepted"));
$tpl->setVariable("ACCEPT_AGREEMENT", $lng->txt("accept_usr_agreement"));
$tpl->setVariable("TXT_SUBMIT", $lng->txt("submit"));
$tpl->parseCurrentBlock();
} else {
$tpl->setCurrentBlock("back");
$tpl->setVariable("BACK", $lng->txt("back"));
$tpl->setVariable("LINK_BACK", $this->ctrl->getLinkTargetByClass("ilstartupgui", "showLogin"));
$tpl->parseCurrentBlock();
}
$tpl->show();
}
示例8: replacePlaceholders
function replacePlaceholders($a_string, &$a_user, $a_amail, $a_lang)
{
global $ilSetting, $tree;
// determine salutation
switch ($a_user->getGender()) {
case "f":
$gender_salut = $a_amail["sal_f"];
break;
case "m":
$gender_salut = $a_amail["sal_m"];
break;
default:
$gender_salut = $a_amail["sal_g"];
}
$gender_salut = trim($gender_salut);
$a_string = str_replace("[MAIL_SALUTATION]", $gender_salut, $a_string);
$a_string = str_replace("[LOGIN]", $a_user->getLogin(), $a_string);
$a_string = str_replace("[FIRST_NAME]", $a_user->getFirstname(), $a_string);
$a_string = str_replace("[LAST_NAME]", $a_user->getLastname(), $a_string);
// BEGIN Mail Include E-Mail Address in account mail
$a_string = str_replace("[EMAIL]", $a_user->getEmail(), $a_string);
// END Mail Include E-Mail Address in account mail
$a_string = str_replace("[PASSWORD]", $this->getUserPassword(), $a_string);
$a_string = str_replace("[ILIAS_URL]", ILIAS_HTTP_PATH . "/login.php?client_id=" . CLIENT_ID, $a_string);
$a_string = str_replace("[CLIENT_NAME]", CLIENT_NAME, $a_string);
$a_string = str_replace("[ADMIN_MAIL]", $ilSetting->get("admin_email"), $a_string);
// (no) password sections
if ($this->getUserPassword() == "") {
// #12232
$a_string = preg_replace("/\\[IF_PASSWORD\\].*\\[\\/IF_PASSWORD\\]/imsU", "", $a_string);
$a_string = preg_replace("/\\[IF_NO_PASSWORD\\](.*)\\[\\/IF_NO_PASSWORD\\]/imsU", "\$1", $a_string);
} else {
$a_string = preg_replace("/\\[IF_NO_PASSWORD\\].*\\[\\/IF_NO_PASSWORD\\]/imsU", "", $a_string);
$a_string = preg_replace("/\\[IF_PASSWORD\\](.*)\\[\\/IF_PASSWORD\\]/imsU", "\$1", $a_string);
}
// #13346
if (!$a_user->getTimeLimitUnlimited()) {
// #6098
$a_string = preg_replace("/\\[IF_TIMELIMIT\\](.*)\\[\\/IF_TIMELIMIT\\]/imsU", "\$1", $a_string);
$timelimit_from = new ilDateTime($a_user->getTimeLimitFrom(), IL_CAL_UNIX);
$timelimit_until = new ilDateTime($a_user->getTimeLimitUntil(), IL_CAL_UNIX);
$timelimit = ilDatePresentation::formatPeriod($timelimit_from, $timelimit_until);
$a_string = str_replace("[TIMELIMIT]", $timelimit, $a_string);
} else {
$a_string = preg_replace("/\\[IF_TIMELIMIT\\](.*)\\[\\/IF_TIMELIMIT\\]/imsU", "", $a_string);
}
// target
$tar = false;
if ($_GET["target"] != "") {
$tarr = explode("_", $_GET["target"]);
if ($tree->isInTree($tarr[1])) {
$obj_id = ilObject::_lookupObjId($tarr[1]);
$type = ilObject::_lookupType($obj_id);
if ($type == $tarr[0]) {
$a_string = str_replace("[TARGET_TITLE]", ilObject::_lookupTitle($obj_id), $a_string);
$a_string = str_replace("[TARGET]", ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&target=" . $_GET["target"], $a_string);
// this looks complicated, but we may have no initilised $lng object here
// if mail is send during user creation in authentication
include_once "./Services/Language/classes/class.ilLanguage.php";
$a_string = str_replace("[TARGET_TYPE]", ilLanguage::_lookupEntry($a_lang, "common", "obj_" . $tarr[0]), $a_string);
$tar = true;
}
}
}
// (no) target section
if (!$tar) {
$a_string = preg_replace("/\\[IF_TARGET\\].*\\[\\/IF_TARGET\\]/imsU", "", $a_string);
} else {
$a_string = preg_replace("/\\[IF_TARGET\\](.*)\\[\\/IF_TARGET\\]/imsU", "\$1", $a_string);
}
return $a_string;
}
示例9: showTermsOfService
/**
* Show terms of service
*/
protected function showTermsOfService()
{
/**
* @var $lng ilLanguage
* @var $tpl ilTemplate
* @var $ilUser ilObjUser
* @var $ilSetting ilSetting
*/
global $lng, $tpl, $ilUser, $ilSetting;
$back_to_login = 'getAcceptance' != $this->ctrl->getCmd();
self::initStartUpTemplate('tpl.view_terms_of_service.html', $back_to_login, !$back_to_login);
$tpl->setVariable('TXT_PAGEHEADLINE', $lng->txt('usr_agreement'));
// #9728
$lang_opts = array();
foreach ($lng->getInstalledLanguages() as $lang_key) {
$lang_opts[$lang_key] = ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_" . $lang_key);
}
if (sizeof($lang_opts) > 1) {
asort($lang_opts);
foreach ($lang_opts as $lang_key => $lang_caption) {
$tpl->setCurrentBlock('lang_headline_languages');
$tpl->setVariable('LANG_HEADLINE_LANGUAGES_LANG_NAME', $lang_caption);
$tpl->setVariable('LANG_HEADLINE_LANGUAGES_LANG_KEY', $lang_key);
if ($lang_key == $lng->getLangKey()) {
$tpl->setVariable('LANG_HEADLINE_LANGUAGES_SELECTED_LANG', ' selected="selected"');
}
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock('lang_headline');
$tpl->setVariable('LANG_CHANGE_CMD', $this->ctrl->getCmd());
$tpl->setVariable('LANG_CHANGE_FORMACTION', $this->ctrl->getFormAction($this, $this->ctrl->getCmd()));
$tpl->setVariable('LANG_CHANGE_TXT_OK', $lng->txt('ok'));
$tpl->setVariable('LANG_CHANGE_TXT_CHOOSE_LANGUAGE', $lng->txt('choose_language'));
$tpl->setCurrentBlock('lang_headline');
}
try {
require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceSignableDocumentFactory.php';
$document = ilTermsOfServiceSignableDocumentFactory::getByLanguageObject($lng);
if ('getAcceptance' == $this->ctrl->getCmd()) {
if (isset($_POST['status']) && 'accepted' == $_POST['status']) {
require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
ilTermsOfServiceHelper::trackAcceptance($ilUser, $document);
if (ilSession::get('orig_request_target')) {
$target = ilSession::get('orig_request_target');
ilSession::set('orig_request_target', '');
ilUtil::redirect($target);
} else {
ilUtil::redirect('index.php?target=' . $_GET['target'] . '&client_id=' . CLIENT_ID);
}
}
$tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, $this->ctrl->getCmd()));
$tpl->setVariable('ACCEPT_CHECKBOX', ilUtil::formCheckbox(0, 'status', 'accepted'));
$tpl->setVariable('ACCEPT_TERMS_OF_SERVICE', $lng->txt('accept_usr_agreement'));
$tpl->setVariable('TXT_SUBMIT', $lng->txt('submit'));
}
$tpl->setVariable('TERMS_OF_SERVICE_CONTENT', $document->getContent());
} catch (ilTermsOfServiceNoSignableDocumentFoundException $e) {
$tpl->setVariable('TERMS_OF_SERVICE_CONTENT', sprintf($lng->txt('no_agreement_description'), 'mailto:' . $ilSetting->get('feedback_recipient')));
}
$tpl->show();
}
示例10: txt
/**
* gets the text for a given topic
* if the topic is not in the list, the topic itself with "-" will be returned
*
* @access public
* @param string topic
* @return string text clear-text
*/
function txt($a_topic, $a_default_lang_fallback_mod = "")
{
if (empty($a_topic)) {
return "";
}
// remember the used topics
$this->used_topics[$a_topic] = $a_topic;
$translation = "";
if (isset($this->text[$a_topic])) {
$translation = $this->text[$a_topic];
}
if ($translation == "" && $a_default_lang_fallback_mod != "") {
$translation = ilLanguage::_lookupEntry($this->lang_default, $a_default_lang_fallback_mod, $a_topic);
}
if ($translation == "") {
if (ILIAS_LOG_ENABLED && is_object($this->log)) {
$this->log->writeLanguageLog($a_topic, $this->lang_key);
}
return "-" . $a_topic . "-";
} else {
return $translation;
}
}