本文整理汇总了PHP中jLocale::get方法的典型用法代码示例。如果您正苦于以下问题:PHP jLocale::get方法的具体用法?PHP jLocale::get怎么用?PHP jLocale::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jLocale
的用法示例。
在下文中一共展示了jLocale::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
*
*/
function index()
{
$rep = $this->getResponse('html');
$tpl = new jTpl();
$gid = array(0);
$o = new StdClass();
$o->id_aclgrp = '0';
$o->name = jLocale::get('jacl2_admin~acl2.anonymous.group.name');
$o->grouptype = 0;
$groups = array($o);
$grouprights = array(0 => false);
foreach (jAcl2DbUserGroup::getGroupList() as $grp) {
$gid[] = $grp->id_aclgrp;
$groups[] = $grp;
$grouprights[$grp->id_aclgrp] = false;
}
$rights = array();
$p = jAcl2Db::getProfil();
$rs = jDao::get('jelix~jacl2subject', $p)->findAllSubject();
foreach ($rs as $rec) {
$rights[$rec->id_aclsbj] = $grouprights;
}
$rs = jDao::get('jelix~jacl2rights', $p)->getRightsByGroups($gid);
foreach ($rs as $rec) {
$rights[$rec->id_aclsbj][$rec->id_aclgrp] = true;
}
$tpl->assign(compact('groups', 'rights'));
if (jAcl2::check('acl.group.modify')) {
$rep->body->assign('MAIN', $tpl->fetch('groups_right'));
} else {
$rep->body->assign('MAIN', $tpl->fetch('groups_right_view'));
}
return $rep;
}
示例2: initExpectedValue
function initExpectedValue()
{
$numbers = jLocale::get('jelix~captcha.number');
$id = rand(1, intval($numbers));
$this->question = jLocale::get('jelix~captcha.question.' . $id);
$this->container->privateData[$this->ref] = jLocale::get('jelix~captcha.response.' . $id);
}
示例3: _prepareTpl
protected function _prepareTpl()
{
jClasses::inc('masterAdminMenuItem');
$menu = array();
$menu['toplinks'] = new masterAdminMenuItem('toplinks', '', '');
$dashboard = new masterAdminMenuItem('dashboard', jLocale::get('gui.menu.item.dashboard'), jUrl::get('default:index'));
$dashboard->icon = $GLOBALS['gJConfig']->urlengine['jelixWWWPath'] . 'design/images/dashboard.png';
$menu['toplinks']->childItems[] = $dashboard;
$menu['system'] = new masterAdminMenuItem('system', jLocale::get('gui.menu.item.system'), '', 100);
$items = jEvent::notify('masteradminGetMenuContent')->getResponse();
foreach ($items as $item) {
if ($item->parentId) {
if (!isset($menu[$item->parentId])) {
$menu[$item->parentId] = new masterAdminMenuItem($item->parentId, '', '');
}
$menu[$item->parentId]->childItems[] = $item;
} else {
if (isset($menu[$item->id])) {
$menu[$item->id]->copyFrom($item);
} else {
$menu[$item->id] = $item;
}
}
}
usort($menu, "masterAdminItemSort");
foreach ($menu as $topitem) {
usort($topitem->childItems, "masterAdminItemSort");
}
$this->_tpl->assign('menuitems', $menu);
$this->_tpl->assign('selectedMenuItem', $this->param('selectedMenuItem', ''));
}
示例4: onmasteradminGetMenuContent
function onmasteradminGetMenuContent($event)
{
if (jAcl2::check('activeusers.configuration')) {
$item = new masterAdminMenuItem('activeusers', jLocale::get('activeusers_admin~main.masteradmin.menu.item'), jUrl::get('activeusers_admin~default:index'), 120, 'system');
$event->add($item);
}
}
示例5: update
/**
*
*/
function update()
{
$id = $this->param('id');
$pwd = $this->param('pwd');
$pwdconf = $this->param('pwd_confirm');
$rep = $this->getResponse('redirect');
if (trim($pwd) == '' || $pwd != $pwdconf) {
jMessage::add(jLocale::get('crud.message.bad.password'), 'error');
$rep->action = 'password:index';
$rep->params['id'] = $id;
return $rep;
}
if (jAuth::changePassword($id, $pwd)) {
jMessage::add(jLocale::get('crud.message.change.password.ok', $id), 'notice');
if ($this->personalView) {
$rep->action = 'user:index';
} else {
$rep->action = 'default:view';
}
$rep->params['id'] = $id;
return $rep;
} else {
jMessage::add(jLocale::get('crud.message.change.password.notok'), 'error');
$rep->action = 'password:index';
$rep->params['id'] = $id;
}
return $rep;
}
示例6: onhfnuGetMenuContent
/**
* Main Menu of the navbar
* @pararm event $event Object of a listener
*/
function onhfnuGetMenuContent($event)
{
$gJConfig = jApp::config();
$event->add(new hfnuMenuItem('home', jLocale::get('havefnubb~main.home'), jUrl::get('havefnubb~default:index'), 1, 'main'));
$event->add(new hfnuMenuItem('members', jLocale::get('havefnubb~main.member.list'), jUrl::get('havefnubb~members:index'), 2, 'main'));
$event->add(new hfnuMenuItem('search', jLocale::get('havefnubb~main.search'), jUrl::get('hfnusearch~default:index'), 3, 'main'));
if ($gJConfig->havefnubb['rules'] != '') {
$event->add(new hfnuMenuItem('rules', jLocale::get('havefnubb~main.rules'), jUrl::get('havefnubb~default:rules'), 4, 'main'));
}
// dynamic menu
$menus = jClasses::getService('havefnubb~hfnumenusbar')->getMenus();
if (!empty($menus)) {
foreach ($menus as $indx => $menu) {
$event->add(new hfnuMenuItem($menu['itemName'], $menu['name'], $menu['url'], 50 + $menu['order'], 'main'));
}
}
if ($event->getParam('admin') === true) {
$url = '';
try {
// let's try to retrieve the url of the admin, if the admin is in
// the same app
$url = jUrl::get('hfnuadmin~default:index');
} catch (Exception $e) {
if (isset($gJConfig->havefnubb["admin_url"])) {
$url = $gJConfig->havefnubb["admin_url"];
}
}
if ($url) {
$event->add(new hfnuMenuItem('admin', jLocale::get('havefnubb~main.admin.panel'), $url, 100, 'main'));
}
}
}
示例7: onmasteradminGetMenuContent
/**
*
*/
function onmasteradminGetMenuContent($event)
{
$plugin = $GLOBALS['gJCoord']->getPlugin('auth', false);
if ($plugin && $plugin->config['driver'] == 'Db' && jAcl2::check('auth.users.list')) {
$event->add(new masterAdminMenuItem('users', jLocale::get('jauthdb_admin~auth.adminmenu.item.list'), jUrl::get('jauthdb_admin~default:index'), 10, 'system'));
}
}
示例8: getDictionary
/**
* Get JSON containing all translation for a given jelix property file.
* @param string $property Name of the property file. Ex: map if searched file is map.UTF-8.properties
* @param string $lang Language. Ex: fr_FR (optional)
* @return binary object The image for this project.
*/
function getDictionary()
{
$rep = $this->getResponse('json');
// Get the property file
$property = $this->param('property');
$lang = $this->param('lang');
if (!$lang) {
$lang = jLocale::getCurrentLang() . '_' . jLocale::getCurrentCountry();
}
$data = array();
$path = jApp::appPath() . 'modules/view/locales/' . $lang . '/' . $property . '.UTF-8.properties';
if (file_exists($path)) {
$lines = file($path);
foreach ($lines as $lineNumber => $lineContent) {
if (!empty($lineContent) and $lineContent != '\\n') {
$exp = explode('=', trim($lineContent));
if (!empty($exp[0])) {
$data[$exp[0]] = jLocale::get('view~dictionnary.' . $exp[0], null, $lang);
}
}
}
}
$rep->data = $data;
return $rep;
}
示例9: index
/**
* Main page
*/
public function index()
{
$submit = $this->param('validate');
if ($submit == jLocale::get('hfnucontact~contact.form.saveBt')) {
$form = jForms::fill('hfnucontact~admincontact');
$rep = $this->getResponse('redirect');
if (!$form->check()) {
$rep->action = 'hfnucontact~admin:index';
return $rep;
}
$HfnucontactConfig = new jIniFileModifier(jApp::configPath('defaultconfig.ini.php'));
$HfnucontactConfig->setValue('email_contact', $this->param('contact'), 'hfnucontact');
$HfnucontactConfig->save();
jMessage::add(jLocale::get('hfnucontact~contact.admin.form.email.saved'), 'ok');
jForms::destroy('hfnucontact~admincontact');
$rep->action = 'hfnucontact~admin:index';
return $rep;
} else {
$form = jForms::create('hfnucontact~admincontact');
}
$form->setData('contact', jApp::config()->hfnucontact['email_contact']);
$rep = $this->getResponse('html');
$tpl = new jTpl();
$tpl->assign('form', $form);
$rep->body->assign('MAIN', $tpl->fetch('hfnucontact~admincontact'));
$rep->body->assign('selectedMenuItem', 'contact');
return $rep;
}
示例10: index
/**
* Displays a list of project for a given repository.
*
* @param string $repository. Name of the repository.
* @return Html page with a list of projects.
*/
function index()
{
if ($this->param('theme')) {
jApp::config()->theme = $this->param('theme');
}
$rep = $this->getResponse('html');
// Get lizmap services
$services = lizmap::getServices();
// only maps
if ($services->onlyMaps) {
$repository = lizmap::getRepository($services->defaultRepository);
if ($repository && jAcl2::check('lizmap.repositories.view', $repository->getKey())) {
$project = lizmap::getProject($repository->getKey() . '~' . $services->defaultProject);
if ($project) {
// test redirection to an other controller
$items = jEvent::notify('mainviewGetMaps')->getResponse();
foreach ($items as $item) {
if ($item->parentId == $repository->getKey() && $item->id == $services->defaultProject) {
$rep = $this->getResponse('redirectUrl');
$rep->url = $item->url;
return $rep;
}
}
// redirection to default controller
$rep = $this->getResponse('redirect');
$rep->action = 'view~map:index';
return $rep;
}
}
}
// Get repository data
$repository = $this->param('repository');
$repositoryList = array();
if ($repository) {
if (!jAcl2::check('lizmap.repositories.view', $repository)) {
$rep = $this->getResponse('redirect');
$rep->action = 'view~default:index';
jMessage::add(jLocale::get('view~default.repository.access.denied'), 'error');
return $rep;
}
}
$title = jLocale::get("view~default.repository.list.title");
$rep->body->assign('repositoryLabel', $title);
$rep->body->assign('isConnected', jAuth::isConnected());
$rep->body->assign('user', jAuth::getUserSession());
if ($services->allowUserAccountRequests) {
$rep->body->assign('allowUserAccountRequests', True);
}
if ($repository) {
$lrep = lizmap::getRepository($repository);
$title .= ' - ' . $lrep->getData('label');
}
$rep->title = $title;
$rep->body->assignZone('MAIN', 'main_view', array('repository' => $repository));
$rep->addJSCode("\n \$(window).load(function() {\n \$('.liz-project-img').parent().mouseenter(function(){\n var self = \$(this);\n self.find('.liz-project-desc').slideDown();\n self.css('cursor','pointer');\n }).mouseleave(function(){\n var self = \$(this);\n self.find('.liz-project-desc').hide();\n }).click(function(){\n var self = \$(this);\n window.location = self.parent().find('a.liz-project-view').attr('href');\n return false;\n });\n });\n ");
// Js hack to normalize the height of the project thumbnails to avoid line breaks with long project titles
$bp = jApp::config()->urlengine['basePath'];
$rep->addJSLink($bp . 'js/view.js');
return $rep;
}
示例11: in
/**
*
*/
function in()
{
$rep = $this->getResponse('redirectUrl');
$conf = jApp::coord()->getPlugin('auth')->config;
$url_return = '/';
if ($conf['after_login'] == '') {
throw new jException('jcommunity~login.error.no.auth_login');
}
if ($conf['after_logout'] == '') {
throw new jException('jcommunity~login.error.no.auth_logout');
}
$form = jForms::fill('jcommunity~login');
if (!$form) {
$rep->url = jUrl::get($conf['after_logout']);
return $rep;
}
if (!jAuth::login($form->getData('auth_login'), $form->getData('auth_password'), $form->getData('auth_remember_me'))) {
sleep(intval($conf['on_error_sleep']));
$form->setErrorOn('auth_login', jLocale::get('jcommunity~login.error'));
//jMessage::add(jLocale::get('jcommunity~login.error'), 'error');
if ($auth_url_return = $this->param('auth_url_return')) {
$url_return = jUrl::get('login:index', array('auth_url_return' => $auth_url_return));
} else {
$url_return = jUrl::get('login:index');
}
} else {
jForms::destroy('jcommunity~login');
if (!($conf['enable_after_login_override'] && ($url_return = $this->param('auth_url_return')))) {
$url_return = jUrl::get($conf['after_login']);
}
}
$rep->url = $url_return;
return $rep;
}
示例12: update
/**
*
*/
function update()
{
$id = $this->param('j_user_login');
$pwd = $this->param('pwd');
$pwdconf = $this->param('pwd_confirm');
$rep = $this->getResponse('redirect');
if ($this->personalView && $id != jAuth::getUserSession()->login) {
jMessage::add(jLocale::get('jelix~errors.acl.action.right.needed'), 'error');
$rep->action = 'master_admin~default:index';
return $rep;
}
if (trim($pwd) == '' || $pwd != $pwdconf) {
jMessage::add(jLocale::get('crud.message.bad.password'), 'error');
$rep->action = 'password:index';
$rep->params['j_user_login'] = $id;
return $rep;
}
if (jAuth::changePassword($id, $pwd)) {
jMessage::add(jLocale::get('crud.message.change.password.ok', $id), 'notice');
if ($this->personalView) {
$rep->action = 'user:index';
} else {
$rep->action = 'default:view';
}
$rep->params['j_user_login'] = $id;
return $rep;
} else {
jMessage::add(jLocale::get('crud.message.change.password.notok'), 'error');
$rep->action = 'password:index';
$rep->params['j_user_login'] = $id;
}
return $rep;
}
示例13: onmasteradminGetMenuContent
/**
*
*/
function onmasteradminGetMenuContent($event)
{
if (jAcl2::check('auth.users.list')) {
$item = new masterAdminMenuItem('pref', jLocale::get('jpref_admin~admin.item.title'), jUrl::get('jpref_admin~prefs:index'), 50, 'system');
$item->icon = jApp::config()->urlengine['jelixWWWPath'] . 'design/images/cog.png';
$event->add($item);
}
}
示例14: _prepareTpl
protected function _prepareTpl()
{
$id = jAuth::getUserSession()->id;
$title = jLocale::get("jmessenger~message.msg.inbox");
$dao = jDao::get($this->dao);
$msg = $dao->getRecus($id);
$this->_tpl->assign(compact('msg', 'id', 'title'));
}
示例15: index
/**
*
*/
function index()
{
$rep = $this->getResponse('html');
$groups = array();
$o = new StdClass();
$o->id_aclgrp = '-2';
$o->name = jLocale::get('jacl2_admin~acl2.all.users.option');
$o->grouptype = 0;
$groups[] = $o;
$o = new StdClass();
$o->id_aclgrp = '-1';
$o->name = jLocale::get('jacl2_admin~acl2.without.groups.option');
$o->grouptype = 0;
$groups[] = $o;
foreach (jAcl2DbUserGroup::getGroupList() as $grp) {
$groups[] = $grp;
}
$listPageSize = 15;
$offset = $this->intParam('idx', 0, true);
$grpid = $this->intParam('grpid', -2, true);
$p = jAcl2Db::getProfil();
if ($grpid == -2) {
//all users
$dao = jDao::get('jelix~jacl2groupsofuser', $p);
$cond = jDao::createConditions();
$cond->addCondition('grouptype', '=', 2);
$rs = $dao->findBy($cond, $offset, $listPageSize);
$usersCount = $dao->countBy($cond);
} elseif ($grpid == -1) {
//only those who have no groups
$sql = 'SELECT login, count(id_aclgrp) as nbgrp FROM jacl2_user_group
GROUP BY login HAVING nbgrp < 2 ORDER BY login';
$cnx = jDb::getConnection($p);
$rs = $cnx->query($sql);
$usersCount = -1;
} else {
//in a specific group
$dao = jDao::get('jelix~jacl2usergroup', $p);
$rs = $dao->getUsersGroupLimit($grpid, $offset, $listPageSize);
$usersCount = $dao->getUsersGroupCount($grpid);
}
$users = array();
$dao2 = jDao::get('jelix~jacl2groupsofuser', $p);
foreach ($rs as $u) {
$u->groups = array();
$gl = $dao2->getGroupsUser($u->login);
foreach ($gl as $g) {
if ($g->grouptype != 2) {
$u->groups[] = $g;
}
}
$users[] = $u;
}
$tpl = new jTpl();
$tpl->assign(compact('offset', 'grpid', 'listPageSize', 'groups', 'users', 'usersCount'));
$rep->body->assign('MAIN', $tpl->fetch('users_list'));
return $rep;
}