本文整理汇总了PHP中get_lang函数的典型用法代码示例。如果您正苦于以下问题:PHP get_lang函数的具体用法?PHP get_lang怎么用?PHP get_lang使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_lang函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate_data
/**
* Validates imported data.
*/
function validate_data($users)
{
global $defined_auth_sources;
$errors = array();
$usernames = array();
if (is_array($users)) {
foreach ($users as $index => $user) {
// 1. Check whether mandatory fields have been set.
$mandatory_fields = array('LastName', 'FirstName');
if (api_get_setting('registration', 'email') == 'true') {
$mandatory_fields[] = 'Email';
}
foreach ($mandatory_fields as $key => $field) {
if (!isset($user[$field]) || strlen($user[$field]) == 0) {
$user['error'] = get_lang($field . 'Mandatory');
$errors[] = $user;
}
}
// 2. Check username.
if (!UserManager::is_username_empty($user['UserName'])) {
// 2.1. Check whether username was used twice in the import file.
if (isset($usernames[$user['UserName']])) {
$user['error'] = get_lang('UserNameUsedTwice');
$errors[] = $user;
}
$usernames[$user['UserName']] = 1;
// 2.2. Check whether username is allready in use in database.
if (!UserManager::is_username_available($user['UserName'])) {
$user['error'] = get_lang('UserNameNotAvailable');
$errors[] = $user;
}
// 2.3. Check whether username is too long.
if (UserManager::is_username_too_long($user['UserName'])) {
$user['error'] = get_lang('UserNameTooLong');
$errors[] = $user;
}
}
// 3. Check status.
if (isset($user['Status']) && !api_status_exists($user['Status'])) {
$user['error'] = get_lang('WrongStatus');
$errors[] = $user;
}
// 4. Check classname.
if (isset($user['ClassName']) && strlen($user['ClassName']) != 0) {
if (!ClassManager::class_name_exists($user['ClassName'])) {
$user['error'] = get_lang('ClassNameNotAvailable');
$errors[] = $user;
}
}
// 5. Check authentication source.
if (isset($user['AuthSource']) && strlen($user['AuthSource']) != 0) {
if (!in_array($user['AuthSource'], $defined_auth_sources)) {
$user['error'] = get_lang('AuthSourceNotAvailable');
$errors[] = $user;
}
}
}
}
return $errors;
}
示例2: reports_template_exercicesMultiCourses_getSQL
function reports_template_exercicesMultiCourses_getSQL()
{
// foreach quiz
$result = array();
$columns = Database::query('select r.id as kid, c.title as course, ' . 'r.child_name as test from ' . Database::get_main_table(TABLE_MAIN_REPORTS_KEYS) . ' r, ' . Database::get_main_table(TABLE_MAIN_COURSE) . ' c ' . 'where r.course_id=c.id and r.tool_id=' . reports_getToolId(TOOL_QUIZ) . ' order by r.course_id, r.child_name');
if (Database::num_rows($columns) == 0) {
die('<b>' . get_lang('no data found') . '</b>');
}
$query = 'select u.lastname Name, u.firstname Firstname';
$columns = Database::store_result($columns);
if ($_REQUEST['tattempt'] == 'min' || $_REQUEST['tattempt'] == 'max') {
$function = $_REQUEST['tattempt'];
} else {
$function = 'avg';
}
foreach ($columns as $key => $column) {
$query .= ', ' . $function . '(k' . $key . '.score) as `' . $column['course'] . ' - ' . $column['test'] . '` ';
}
$query .= ' from ' . Database::get_main_table(TABLE_MAIN_USER) . ' u ';
foreach ($columns as $key => $column) {
// fixme sessions
$query .= 'left outer join ' . Database::get_main_table(TABLE_MAIN_REPORTS_VALUES) . ' k' . $key . ' on k' . $key . '.key_id = ' . $column['kid'] . ' and k' . $key . '.user_id = u.user_id ';
}
$query .= ' group by ';
foreach ($columns as $key => $column) {
// grouping attempt
$query .= 'k' . $key . '.attempt, ';
}
$query = substr($query, 0, -2);
// removing last ', ';
return $query;
}
示例3: MultipleAnswerCombinationTrueFalse
/**
* Constructor
*/
function MultipleAnswerCombinationTrueFalse()
{
parent::question();
$this->type = MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE;
$this->isContent = $this->getIsContent();
$this->options = array('1' => get_lang('True'), '0' => get_lang('False'), '2' => get_lang('DontKnow'));
}
示例4: exec_ogp_module
function exec_ogp_module()
{
global $db;
global $view;
$group_id = $_REQUEST['group_id'];
if (!$db->isAdmin($_SESSION['user_id'])) {
$result = $db->getUserGroupList($_SESSION['user_id']);
foreach ($result as $row) {
if ($row['group_id'] == $group_id) {
$own_group = TRUE;
}
}
}
if (!$db->isAdmin($_SESSION['user_id']) && !isset($own_group)) {
echo "<p class='note'>" . get_lang('not_available') . "</p>";
return;
}
if (isset($_POST['add_user_to_group'])) {
$group_id = trim($_POST['group_id']);
$user_id = trim($_POST['user_to_add']);
$username = $db->getUserById($user_id);
$group_name = $db->getGroupById($group_id);
if (!$db->addUsertoGroup($user_id, $group_id)) {
print_failure(get_lang_f('could_not_add_user_to_group', $username['users_login'], $group_name['group_name']));
$view->refresh("?m=user_admin&p=show_groups");
return;
}
echo "<p class='success'>" . get_lang_f('successfully_added_to_group', $username['users_login'], $group_name['group_name']) . "</p>";
$db->logger(get_lang_f('successfully_added_to_group', $username['users_login'], $group_name['group_name']));
$view->refresh("?m=user_admin&p=show_groups");
}
}
示例5: export
/**
* Export a whole Wiki to a single HTML String
* @return string Wiki content in HTML
*/
public function export()
{
$pageList = $this->wiki->allPagesByCreationDate();
$result = $this->_htmlHeader();
$result .= '<h1>' . $this->wiki->getTitle() . '</h1>' . "\n";
foreach ($pageList as $page) {
$wikiPage = new WikiPage($this->wiki->getDatabaseConnection(), $this->wiki->getConfig(), $this->wiki->getWikiId());
$wikiPage->loadPage($page['title']);
$this->setOpt('note_prefix', $page['title']);
if ($wikiPage->hasError()) {
$result .= '<h2><a name="' . $this->_makePageTitleAnchor($page['title']) . '">' . $page['title'] . '</a></h2>' . "\n";
$result .= get_lang("Could not load page %page", array('%page' => $page['title'])) . "\n";
$wikiPage = null;
} else {
$pgTitle = $wikiPage->getTitle();
if ('__MainPage__' === $pgTitle) {
$pgTitle = get_lang('Main page');
}
$result .= '<h2><a name="' . $this->_makePageTitleAnchor($page['title']) . '">' . $pgTitle . '</a></h2>' . "\n";
$content = $wikiPage->getContent();
$result .= $this->render($content) . "\n";
$wikiPage = null;
}
}
$result .= $this->_htmlFooter();
return $result;
}
示例6: prepare_skill_box
function prepare_skill_box($skill, $position, $class)
{
$block_id = $skill['id'];
$extra_class = 'third_window';
if ($skill['parent_id'] == 0) {
$extra_class = 'second_window';
}
$this->html .= '<div id="block_' . $block_id . '" class = "open_block window ' . $extra_class . ' ' . $class . '" style = "top:' . $position['y'] . 'px; left:' . $position['x'] . 'px;">';
/*$gradebook_string = '';
if (!empty($skill['gradebooks'])) {
foreach ($skill['gradebooks'] as $gradebook) {
//uncomment this to show the gradebook tags
$gradebook_string .= Display::span($gradebook['name'], array('class'=>'label_tag gradebook','style'=>'width:50px')).'<br />';
}
} */
$content = $skill['name'];
$content .= '<div class="btn-group">';
$content .= Display::url(get_lang('Edit'), '#', array('id' => 'edit_block_' . $block_id, 'class' => 'edit_block btn'));
$content .= Display::url('+', '#', array('id' => 'edit_block_' . $block_id, 'class' => 'edit_block btn'));
$content .= '</div>';
$this->html .= $content . ' ' . $gradebook_string;
if ($this->type == 'edit' && $skill['parent_id'] != 0) {
//$this->html .= Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), '#', array('id'=>'edit_block_'.$block_id,'class'=>'edit_block'));
//$this->html .= Display::url(Display::return_icon('add.png', get_lang('Add'), array(), ICON_SIZE_SMALL), '#', array('id'=>'edit_block_'.$block_id,'class'=>'edit_block'));
//$this->html .= Display::url(Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL), '#', array('id=>"edit_block_'.$block_id,'class'=>'edit_block'));
//$this->html .= Display::url(Display::return_icon('up.png', get_lang('Close'), array(), ICON_SIZE_SMALL), '#', array('id'=>'close_block_'.$block_id,'class'=>'close_block'));
//$this->html .= Display::url(Display::return_icon('down.png', get_lang('Open'), array(), ICON_SIZE_SMALL), '#', array('id'=>'open_block_'.$block_id,'class'=>'open_block'));
}
$this->html .= '</div>';
}
示例7: build_create
/**
* Builds the form
*/
protected function build_create()
{
$this->addElement('header', get_lang('MakeLink'));
$select = $this->addElement('select', 'select_link', get_lang('ChooseLink'), null, array('onchange' => 'document.create_link.submit()'));
$linkTypes = LinkFactory::get_all_types();
$select->addoption('[' . get_lang('ChooseLink') . ']', 0);
$courseCode = $this->category_object->get_course_code();
foreach ($linkTypes as $linkType) {
// The hot potatoe link will be added "inside" the exercise option.
if ($linkType == LINK_HOTPOTATOES) {
continue;
}
$link = $this->createLink($linkType, $courseCode);
// disable this element if the link works with a dropdownlist
// and if there are no links left
if (!$link->needs_name_and_description() && count($link->get_all_links()) == '0') {
$select->addoption($link->get_type_name(), $linkType, 'disabled');
} else {
if ($link->get_type() == LINK_EXERCISE) {
// Adding exercise
$select->addoption($link->get_type_name(), $linkType);
// Adding hot potatoes
$linkHot = $this->createLink(LINK_HOTPOTATOES, $courseCode);
$select->addoption(' ' . $linkHot->get_type_name(), LINK_HOTPOTATOES);
} else {
$select->addoption($link->get_type_name(), $linkType);
}
}
}
if (isset($this->extra)) {
$this->setDefaults(array('select_link' => $this->extra));
}
}
示例8: getElementJS
/**
* Get the necessary javascript for this datepicker
* @return string
*/
private function getElementJS()
{
$js = null;
$id = $this->getAttribute('id');
$js .= "<script>\n \$(function() {\n /*\$('#{$id}').hide().datepicker({\n defaultDate: '" . $this->getValue() . "',\n dateFormat: 'yy-mm-dd',\n altField: '#{$id}_alt',\n altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\",\n showOn: 'both',\n buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "',\n buttonImageOnly: true,\n buttonText: '" . get_lang('SelectDate') . "',\n changeMonth: true,\n changeYear: true,\n yearRange: 'c-60y:c+5y'\n });*/\n\n \$('#{$id}').datetimepicker({\n defaultDate: '" . $this->getValue() . "',\n format: 'YYYY-MM-DD'\n });\n\n });\n </script>";
return $js;
}
示例9: modify_filter
/**
* Filter to display the modify-buttons
*
* @param - int $id The reservation-id
*/
function modify_filter($id)
{
$out = ' <a href="m_reservation.php?action=accept&rid=' . $id . '" alt="' . get_lang('AutoAccept') . '"><img title="' . get_lang('AutoAccept') . '" alt="' . get_lang('AutoAccept') . '" src="../img/students.gif" /></a>';
$out .= '<a href="m_reservation.php?action=edit&id=' . $id . '" alt="' . get_lang('EditBookingPeriod') . '"><img title="' . get_lang('EditBookingPeriod') . '" alt="' . get_lang('EditBookingPeriod') . '" src="../img/edit.gif" /></a>';
$out .= ' <a href="m_reservation.php?action=delete&id=' . $id . '" alt="' . get_lang('DeleteBookingPeriod') . '" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang("ConfirmDeleteBookingPeriod"))) . "'" . ')) return false;"><img title="' . get_lang('DeleteBookingPeriod') . '" alt="' . get_lang('DeleteBookingPeriod') . '" src="../img/delete.gif" /></a>';
return $out;
}
示例10: getToolbar
/**
* Get area wiki syntax toolbar
* @return string toolbar javascript code
*/
public function getToolbar()
{
$toolbar = '';
$toolbar .= '<script type="text/javascript" src="' . document_web_path() . '/js/toolbar.js"></script>' . "\n";
$toolbar .= "<script type=\"text/javascript\">if (document.getElementById) {\n var tb = new dcToolBar(document.getElementById('" . $this->attributeList['id'] . "'),\n 'wiki','" . get_module_url('CLWIKI') . "/img/toolbar/');\n\n tb.btStrong('" . get_lang('Bold') . "');\n tb.btEm('" . get_lang('Italic') . "');\n tb.btIns('" . get_lang('Underline') . "');\n tb.btDel('" . get_lang('Strike') . "');\n tb.btQ('" . get_lang('Inline quote') . "');\n tb.btCode('" . get_lang('Code') . "');\n tb.addSpace(10);\n tb.btBr('" . get_lang('Line break') . "');\n tb.addSpace(10);\n tb.btBquote('" . get_lang('Blockquote') . "');\n tb.btPre('" . get_lang('Preformated text') . "');\n tb.btList('" . get_lang('Unordered list') . "','ul');\n tb.btList('" . get_lang('Ordered list') . "','ol');\n tb.addSpace(10);\n tb.btLink('" . get_lang('External link') . "','" . get_lang('URL?') . "','" . get_lang('Language') . "','" . $GLOBALS['iso639_1_code'] . "');\n tb.btImgLink('" . get_lang('External image') . "','" . get_lang('URL') . "');\n tb.draw('');\n}\n</script>\n";
return $toolbar;
}
示例11: __construct
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->type = MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE;
$this->isContent = $this->getIsContent();
$this->options = array('1' => get_lang('True'), '0' => get_lang('False'), '2' => get_lang('DontKnow'));
}
示例12: get_file_upload_errstring_from_errno
function get_file_upload_errstring_from_errno($errorLevel)
{
if (!defined('UPLOAD_ERR_CANT_WRITE')) {
// Introduced in PHP 5.1.0
define('UPLOAD_ERR_CANT_WRITE', 5);
}
switch ($errorLevel) {
case UPLOAD_ERR_OK:
$details = get_lang('No error');
case UPLOAD_ERR_INI_SIZE:
$details = get_lang('File too large. Notice : Max file size %size', array('%size' => get_cfg_var('upload_max_filesize')));
break;
case UPLOAD_ERR_FORM_SIZE:
$details = get_lang('File size exceeds');
break;
case UPLOAD_ERR_PARTIAL:
$details = get_lang('File upload incomplete');
break;
case UPLOAD_ERR_NO_FILE:
$details = get_lang('No file uploaded');
break;
case UPLOAD_ERR_NO_TMP_DIR:
$details = get_lang('Temporary folder missing');
break;
case UPLOAD_ERR_CANT_WRITE:
$details = get_lang('Failed to write file to disk');
break;
default:
$details = get_lang('Unknown error code %errCode%', array('%errCode%' => $errorLevel));
break;
}
return $details;
}
示例13: __construct
/**
* constructor
* @path the path to a folder
* @calculateSubdir force to get the subdirectories information
*/
function __construct($path = null, $calculateSubdir = true)
{
$this->calculateSubdir = $calculateSubdir;
if (defined('CONFIG_SYS_FOLDER_SHOWN_ON_TOP')) {
$this->forceFolderOnTop = CONFIG_SYS_FOLDER_SHOWN_ON_TOP;
}
if (!is_null($path)) {
$this->currentFolderPath = $path;
} elseif (isset($_GET[$this->folderPathIndex]) && file_exists(base64_decode($_GET[$this->folderPathIndex])) && !is_file(base64_decode($_GET[$this->folderPathIndex]))) {
$this->currentFolderPath = api_htmlentities(Security::remove_XSS($_GET[$this->folderPathIndex]));
} elseif (isset($_SESSION[$this->lastVisitedFolderPathIndex]) && file_exists($_SESSION[$this->lastVisitedFolderPathIndex]) && !is_file($_SESSION[$this->lastVisitedFolderPathIndex])) {
$this->currentFolderPath = $_SESSION[$this->lastVisitedFolderPathIndex];
} else {
$this->currentFolderPath = CONFIG_SYS_DEFAULT_PATH;
}
$this->currentFolderPath = isUnderRoot($this->getCurrentFolderPath()) ? backslashToSlash(addTrailingSlash($this->getCurrentFolderPath())) : $this->currentFolderPath;
$this->currentFolderPath = base64_encode($this->currentFolderPath);
if ($this->calculateSubdir) {
// keep track of this folder path in session
$_SESSION[$this->lastVisitedFolderPathIndex] = $this->currentFolderPath;
}
if (is_dir($this->getCurrentFolderPath())) {
$file = new file($this->getCurrentFolderPath());
$folderInfo = $file->getFileInfo();
if (sizeof($folderInfo)) {
//for Chamilo in a name folder, replace num user by user names
if (preg_match('/sf_user_/', basename($this->getCurrentFolderPath()))) {
$userinfo = api_get_user_info(substr(basename($this->getCurrentFolderPath()), 8));
$this->currentFolderInfo['name'] = $userinfo['complete_name'];
} else {
$this->currentFolderInfo['name'] = str_replace('_', ' ', basename($this->getCurrentFolderPath()));
//for Chamilo. Prevent long directory name
}
if (preg_match('/shared_folder/', basename($this->getCurrentFolderPath()))) {
$this->currentFolderInfo['name'] = get_lang('UserFolders');
}
if (preg_match('/shared_folder_session_/', basename($this->getCurrentFolderPath()))) {
$session = explode('_', basename($this->getCurrentFolderPath()));
$session = strtolower($session[sizeof($session) - 1]);
$this->currentFolderInfo['name'] = get_lang('UserFolders') . ' (' . api_get_session_name($session) . ')*';
}
//end Chamilo
$this->currentFolderInfo['subdir'] = 0;
$this->currentFolderInfo['file'] = 0;
$this->currentFolderInfo['ctime'] = $folderInfo['ctime'];
$this->currentFolderInfo['mtime'] = $folderInfo['mtime'];
$this->currentFolderInfo['is_readable'] = $folderInfo['is_readable'];
$this->currentFolderInfo['is_writable'] = $folderInfo['is_writable'];
$this->currentFolderInfo['path'] = $this->getCurrentFolderPath();
$this->currentFolderInfo['path_base64'] = base64_encode($this->getCurrentFolderPath());
$this->currentFolderInfo['friendly_path'] = transformFilePath($this->getCurrentFolderPath());
$this->currentFolderInfo['type'] = 'folder';
$this->currentFolderInfo['cssClass'] = 'folder';
//$this->currentFolderInfo['flag'] = $folderInfo['flag'];
}
}
if ($calculateSubdir && !file_exists($this->getCurrentFolderPath())) {
die(ERR_FOLDER_NOT_FOUND . $this->getCurrentFolderPath());
}
}
示例14: exec_ogp_module
function exec_ogp_module()
{
global $db;
echo "<h2>" . get_lang('game_servers') . "</h2>";
echo "<p><a href='?m=user_games&p=add'>" . get_lang('add_new_game_home') . "</a></p>";
$game_homes = $db->getGameHomes();
if (empty($game_homes)) {
echo "<p>" . get_lang('no_game_homes_found') . "</p>";
return;
}
echo "<h2>" . get_lang('available_game_homes') . "</h2>";
echo '<table class="center">';
echo "<tr><th>" . get_lang('home_id') . "</th><th>" . get_lang('game_server') . "</th>\n <th>" . get_lang('game_type') . "</th>\n <th align='center'>" . get_lang('game_home') . "</th>\n <th>" . get_lang('game_home_name') . "</th><th>" . get_lang('actions') . "</th></tr>";
$i = 0;
sort($game_homes);
foreach ($game_homes as $row) {
echo "<tr class='tr" . $i++ % 2 . "'><td class='tdh'>{$row['home_id']}</td><td>" . $row['agent_ip'] . "</td>" . "<td class='tdh'>{$row['game_name']}</td><td>{$row['home_path']}<br><div class='size' id='" . $row["home_id"] . "' style='cursor:pointer;' >[" . get_lang('get_size') . "]</div></td><td class='tdh'>";
echo empty($row['home_name']) ? get_lang('not_available') : $row['home_name'];
echo "</td><td>\n <a href='?m=user_games&p=del&home_id={$row['home_id']}'>[" . get_lang('delete') . "]</a>\n <a href='?m=user_games&p=edit&home_id={$row['home_id']}'>[" . get_lang('edit') . "]</a>\n <a href='?m=user_games&p=clone&home_id={$row['home_id']}'>[" . get_lang('clone') . "]</a>\n </td></tr>";
}
echo "<tr><td colspan='3' style='border:none;' ></td><td style='border:none;' ><div style='float:left;margin-left:5px;' >" . get_lang('total_size') . ":</div><div class='size' id='total' " . "style='cursor:pointer;float:left;margin-left:5px;' >[" . get_lang('get_size') . "]</div></td><td colspan='2' style='border:none;' ></td></tr>";
echo "</table>";
?>
<script type="text/javascript">
$('.size').click(function(){
var $id = $(this).attr('id');
$.get( "home.php?m=user_games&type=cleared&p=get_size&home_id="+$id, function( data ) {
$('#'+$id+".size").text( data );
});
});
</script>
<?php
}
示例15: get_announcement_data
public function get_announcement_data($username, $password, $course_code, $announcement_id, $field)
{
if ($this->verifyUserPass($username, $password) == "valid") {
$htmlcode = false;
$user_id = UserManager::get_user_id_from_username($username);
$result = self::get_announcements($username, $course_code, $announcement_id);
while ($announcement = Database::fetch_array($result)) {
$announcements[] = $announcement;
}
switch ($field) {
case 'sender':
$field_table = "insert_user_id";
$sender = api_get_user_info($announcements[0][$field_table]);
$announcements[0][$field_table] = $sender['firstname'] . " " . $sender['lastname'];
break;
case 'title':
$htmlcode = true;
$field_table = "title";
break;
case 'date':
$field_table = "end_date";
break;
case 'content':
$htmlcode = true;
$field_table = "content";
$announcements[0][$field_table] = nl2br_revert($announcements[0][$field_table]);
break;
default:
$field_table = "title";
}
return htmlcode ? html_entity_decode($announcements[0][$field_table]) : $announcements[0][$field_table];
} else {
return get_lang('InvalidId');
}
}