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', '')); }
/** * */ 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')); } }
protected function _prepareTpl() { // Get the project and repository params $project = $this->param('project'); $repository = $this->param('repository'); $auth_url_return = $this->param('auth_url_return'); if (!$auth_url_return) { $auth_url_return = jUrl::get('view~map:index', array("repository" => $repository, "project" => $project)); } // Get lizmapProject class $assign = array('isConnected' => jAuth::isConnected(), 'user' => jAuth::getUserSession(), 'auth_url_return' => $auth_url_return, "externalSearch" => "", "edition" => false, "measure" => false, "locate" => false, "geolocation" => false, "timemanager" => false, "print" => false, "attributeLayers" => false); try { $lproj = lizmap::getProject($repository . '~' . $project); $configOptions = $lproj->getOptions(); if (property_exists($configOptions, 'externalSearch')) { $assign['externalSearch'] = $configOptions->externalSearch; } } catch (UnknownLizmapProjectException $e) { jLog::logEx($e, 'error'); } $this->_tpl->assign($assign); // Get lizmap services $services = lizmap::getServices(); if ($services->allowUserAccountRequests) { $this->_tpl->assign('allowUserAccountRequests', True); } }
/** * function plugin : Ajax request * * it creates a javascript ajax function * example : * <pre> * {link_to_remote * 'Link', <!-- link label --> * 'result', <!-- id dom for ajax result --> * 'test~default:ajax', array('id'=>'34'), <!-- jurl request --> * array( * 'position'=>'html', <!-- html or append or prepend (default html) --> * 'method'=>'GET', <!-- GET or POST (default POST) --> * 'beforeSend'=>'alert("beforeSend")', <!-- JS script before send (default null) --> * 'complete'=>'alert("complete")', <!-- JS script after send (default null)--> * 'error'=>'alert("error")', <!-- JS if error (default null) --> * )} * <div id="result"></div> * </pre> */ function jtpl_function_html_link_to_remote($tpl, $label, $element_id, $action_selector, $action_parameters, $option) { global $gJCoord, $gJConfig; static $id_link_to_remote = 0; if ($gJCoord->response->getFormatType() == 'html') { // Add js link $gJCoord->response->addJSLink($gJConfig->urlengine['basePath'] . 'jelix/jquery/jquery.js'); } $id_link_to_remote++; $url = jUrl::get($action_selector, $action_parameters); $position = array_key_exists("position", $option) ? $option['position'] : 'html'; $method = array_key_exists("method", $option) ? $option['method'] : 'GET'; $beforeSend = array_key_exists("beforeSend", $option) ? $option['beforeSend'] : ''; $complete = array_key_exists("complete", $option) ? $option['complete'] : ''; $error = array_key_exists("error", $option) ? $option['error'] : ''; // Link echo '<a href="#" onclick="link_to_remote_' . $id_link_to_remote . '();">' . $label . "</a>\n"; // Script echo ' <script> function link_to_remote_' . $id_link_to_remote . '() { $.ajax({ type: \'' . $method . "',\n url: '" . $url . "',\n beforeSend: function(){" . $beforeSend . ";},\n complete: function(){" . $complete . ";},\n error: function(){" . $error . ';}, success: function(msg){ $(\'#' . $element_id . "')." . $position . "(msg);\n }\n });\n };\n </script>"; }
/** * function plugin : write the url corresponding to the given jelix action * * @param jTpl $tpl template engine * @param string $selector selector action * @param array $params parameters for the url */ function jtpl_function_html_formurl($tpl, $selector, $params = array()) { $url = jUrl::get($selector, $params, 2); // retourne le jurl correspondant echo $url->getPath(); $tpl->_privateVars['_formurl'] = $url; }
/** * @package jelix * @subpackage jtpl_plugin * @author Laurent Jouanneau * @copyright 2011-2012 Laurent Jouanneau * @link http://www.jelix.org * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html */ function jtpl_function_html_resurl($tpl, $module, $file, $intheme = false, $escape = true) { if ($intheme) { $file = 'themes/' . jApp::config()->theme . '/' . $file; } echo jUrl::get("jelix~www:getfile", array('targetmodule' => $module, 'file' => $file), $escape ? 1 : 0); }
/** * Main page */ function index() { $title = stripslashes(jApp::config()->havefnubb['title']); $rep = $this->getResponse('html'); $historyPlugin = jApp::coord()->getPlugin('history'); $historyPlugin->change('label', ucfirst(htmlentities($title, ENT_COMPAT, 'UTF-8'))); $historyPlugin->change('title', jLocale::get('havefnubb~main.goto_homepage')); $forums = jClasses::getService('hfnuforum'); $forumsList = $forums->getFullList(); // generate rss links list foreach ($forumsList->getLinearIterator() as $f) { // get the list of forum to build the RSS link $url = jUrl::get('havefnubb~posts:rss', array('ftitle' => $f->record->forum_name, 'id_forum' => $f->record->id_forum)); $rep->addHeadContent('<link rel="alternate" type="application/rss+xml" title="' . $f->record->forum_name . ' - RSS" href="' . htmlentities($url) . '" />'); $url = jUrl::get('havefnubb~posts:atom', array('ftitle' => $f->record->forum_name, 'id_forum' => $f->record->id_forum)); $rep->addHeadContent('<link rel="alternate" type="application/atom+xml" title="' . $f->record->forum_name . ' - ATOM " href="' . htmlentities($url) . '" />'); } $tpl = new jTpl(); $tpl->assign('selectedMenuItem', 'community'); $tpl->assign('currentIdForum', 0); $tpl->assign('action', 'index'); $tpl->assign('forumsList', $forumsList); $rep->body->assign('MAIN', $tpl->fetch('havefnubb~index')); return $rep; }
/** * @package jelix * @subpackage jtpl_plugin * @author Lepeltier kévin * @contributor Dominique Papin * @copyright 2008 Lepeltier kévin, 2008 Dominique Papin * @link http://www.jelix.org * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html */ function jtpl_function_html_breadcrumb($tpl, $nb = null, $separator = '') { $plugin = jApp::coord()->getPlugin('history', true); if ($plugin === null) { return; } $config =& $plugin->config; if (!isset($config['session_name']) || $config['session_name'] == '') { $config['session_name'] = 'HISTORY'; } if (!isset($_SESSION[$config['session_name']])) { return; } echo '<ol class="history">'; $leng = count($_SESSION[$config['session_name']]); $nb = $nb !== null ? count($_SESSION[$config['session_name']]) - $nb : 0; $nb = $nb < 0 ? 0 : $nb; for ($i = $nb; $i < $leng; $i++) { $page = $_SESSION[$config['session_name']][$i]; echo '<li' . ($i == $nb ? ' class="first"' : ($i == $leng - 1 ? ' class="end"' : '')) . '>'; if ($i != $leng - 1) { echo '<a href="' . jUrl::get($page['action'], $page['params'], jUrl::XMLSTRING) . '" ' . ($page['title'] != '' ? 'title="' . $page['title'] . '"' : '') . '>'; } echo $_SESSION[$config['session_name']][$i]['label']; if ($i != $leng - 1) { echo '</a>'; } echo ($i == $leng - 1 ? '' : $separator) . '</li>'; } echo '</ol>'; }
/** * 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')); } } }
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); } }
/** * function plugin : write the url corresponding to the given jelix action * * @param jTpl $tpl template engine * @param string $selector selector action * @param array $params parameters for the url */ function jtpl_function_html_formurlparam($tpl, $selector, $params = array()) { $url = jUrl::get($selector, $params, 2); // retourne un jUrl foreach ($url->params as $p_name => $p_value) { echo '<input type="hidden" name="' . $p_name . '" value="' . htmlspecialchars($p_value) . '"/>', "\n"; } }
/** * */ 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); } }
/** * @package jelix * @subpackage jtpl_plugin * @author Laurent Jouanneau * @contributor Yann (description and keywords), Dominique Papin (ie7 support), Mickaël Fradin (style), Loic Mathaud (title), Olivier Demah (auhor,generator), Julien Issler * @copyright 2005-2012 Laurent Jouanneau, 2007 Dominique Papin, 2008 Mickaël Fradin, 2009 Loic Mathaud, 2010 Olivier Demah * @copyright 2010 Julien Issler * @link http://www.jelix.org * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html */ function jtpl_meta_html_htmlmodule($tpl, $method, $module, $path, $params = array()) { $resp = jApp::coord()->response; if ($resp->getType() != 'html') { return; } if (strpos($method, 'csstheme') === 0) { $url = jUrl::get('jelix~www:getfile', array('targetmodule' => $module, 'file' => 'themes/' . jApp::config()->theme . '/' . $path)); switch ($method) { case 'csstheme': $resp->addCSSLink($url, $params); break; case 'cssthemeie': $resp->addCSSLink($url, $params, true); break; case 'cssthemeie7': case 'cssthemeie8': case 'cssthemeie9': $resp->addCSSLink($url, $params, 'IE ' . substr($method, -1, 1)); break; case 'cssthemeltie7': case 'cssthemeltie8': case 'cssthemeltie9': $resp->addCSSLink($url, $params, 'lt IE ' . substr($method, -1, 1)); break; default: trigger_error("Unknown resource type in meta_htmlmodule", E_USER_WARNING); } } else { $url = jUrl::get('jelix~www:getfile', array('targetmodule' => $module, 'file' => $path)); switch ($method) { case 'js': $resp->addJSLink($url, $params); break; case 'css': $resp->addCSSLink($url, $params); break; case 'jsie': $resp->addJSLink($url, $params, true); break; case 'cssie': $resp->addCSSLink($url, $params, true); break; case 'cssie7': case 'cssie8': case 'cssie9': $resp->addCSSLink($url, $params, 'IE ' . substr($method, -1, 1)); break; case 'cssltie7': case 'cssltie8': case 'cssltie9': $resp->addCSSLink($url, $params, 'lt IE ' . substr($method, -1, 1)); break; default: trigger_error("Unknown resource type in meta_htmlmodule", E_USER_WARNING); } } }
public function output() { if ($this->hasErrors()) { return false; } $this->sendHttpHeaders(); header('location: ' . jUrl::get($this->action, $this->params) . ($this->anchor != '' ? '#' . $this->anchor : '')); return true; }
function onmasteradminGetMenuContent($event) { $chemin = jApp::config()->urlengine['basePath'] . 'hfnu/admin/'; if (jAcl2::check('modulesinfo.access')) { $item = new masterAdminMenuItem('modulesinfo', jLocale::get('modulesinfo~modulesinfo.masteradmin.menu.item'), jUrl::get('modulesinfo~default:index'), 202, 'system'); $item->icon = $chemin . 'images/modules_list.png'; $event->add($item); } }
/** * */ function onmasteradminGetMenuContent($event) { $plugin = $GLOBALS['gJCoord']->getPlugin('auth', false); if ($plugin && $plugin->config['driver'] == 'Db' && jAcl2::check('auth.users.list')) { $item = new masterAdminMenuItem('users', jLocale::get('jauthdb_admin~auth.adminmenu.item.list'), jUrl::get('jauthdb_admin~default:index'), 10, 'system'); $item->icon = $GLOBALS['gJConfig']->urlengine['jelixWWWPath'] . 'design/images/user.png'; $event->add($item); } }
function onmasteradminGetMenuContent($event) { $chemin = jApp::config()->urlengine['basePath'] . 'hfnu/admin/'; if (jAcl2::check('jelixcache.access')) { $item = new masterAdminMenuItem('jelixcache', jLocale::get('jelixcache~jelixcache.masteradmin.menu.item'), jUrl::get('jelixcache~default:index'), 100, 'system'); $item->icon = $chemin . 'images/clear_cache.png'; $event->add($item); } }
function index() { $rep = parent::index(); if ($rep->getType() != 'html') { return $rep; } $rep->body->assign('auth_url_return', jUrl::get('view~map:index', array("repository" => $repository, "project" => $project))); return $rep; }
/** * */ function onmasteradminGetMenuContent($event) { if (jAcl2::check('acl.user.view')) { $event->add(new masterAdminMenuItem('usersrights', jLocale::get('jacl2db_admin~acl2.menu.item.rights'), jUrl::get('jacl2db_admin~users:index'), 30, 'system')); } if (jAcl2::check('acl.group.view')) { $event->add(new masterAdminMenuItem('usersgroups', jLocale::get('jacl2db_admin~acl2.menu.item.groups'), jUrl::get('jacl2db_admin~groups:index'), 20, 'system')); } }
/** * the menu item * @param object $event * @return void */ function onmasteradminGetMenuContent($event) { $chemin = jApp::config()->urlengine['basePath'] . 'hfnu/admin/'; if (jAcl2::check('hfnu.admin.contact')) { $event->add(new masterAdminMenuItem('hfnucontact', 'Contact', '', 40)); $item = new masterAdminMenuItem('contact', jLocale::get('hfnucontact~contact.contact'), jUrl::get('hfnucontact~admin:index'), 100, 'hfnucontact'); $item->icon = $chemin . 'images/contact.png'; $event->add($item); } }
/** * the menu item * @param object $event * @return void */ function onmasteradminGetMenuContent($event) { $chemin = jApp::config()->urlengine['basePath'] . 'hfnu/admin/'; $event->add(new masterAdminMenuItem('hfnusearch', jLocale::get('hfnusearch~search.admin.search.engine'), '', 50)); if (jAcl2::check('hfnu.admin.search')) { $item = new masterAdminMenuItem('hfnusearch', jLocale::get('hfnusearch~search.admin.search.engine'), jUrl::get('hfnusearch~admin:index'), 100, 'hfnusearch'); $item->icon = $chemin . 'images/search_engine.png'; $event->add($item); } }
/** * the menu item * @param object $event * @return void */ function onmasteradminGetMenuContent($event) { $chemin = jApp::config()->urlengine['basePath'] . 'hfnu/admin/'; if (jAcl2::check('hfnu.admin.index')) { $event->add(new masterAdminMenuItem('hfnuthemes', jLocale::get('hfnuthemes~theme.themes'), '', 30)); $item = new masterAdminMenuItem('theme', jLocale::get('hfnuthemes~theme.themes'), jUrl::get('hfnuthemes~default:index'), 10, 'hfnuthemes'); $item->icon = $chemin . 'images/theme.png'; $event->add($item); } }
public function output() { if ($this->temporary) { $this->setHttpStatus(303, 'See Other'); } else { $this->setHttpStatus(301, 'Moved Permanently'); } $this->sendHttpHeaders(); header('Location: ' . jUrl::get($this->action, $this->params) . ($this->anchor != '' ? '#' . $this->anchor : '')); return true; }
/** * */ function onmasteradminGetMenuContent($event) { $plugin = jApp::coord()->getPlugin('auth', false); $driver = $plugin->config['driver']; $hasDao = isset($plugin->config[$driver]['dao']) && isset($plugin->config[$driver]['compatiblewithdb']) && $plugin->config[$driver]['compatiblewithdb']; if ($plugin && ($driver == 'Db' || $hasDao) && jAcl2::check('auth.users.list')) { $item = new masterAdminMenuItem('users', jLocale::get('jauthdb_admin~auth.adminmenu.item.list'), jUrl::get('jauthdb_admin~default:index'), 10, 'system'); $item->icon = jApp::config()->urlengine['jelixWWWPath'] . 'design/images/user.png'; $event->add($item); } }
/** * function plugin : write the url corresponding to the given jelix action for javascript * * it creates a javascript string, that contains the url, with dynamic javasript parameters<br/> * example : {urljsstring 'jxacl~admin_rightslist',array(),array('grpid'=>'idgroup','__rnd'=>'Math.random()')};<br/> * it will produce: "index.php?module=acl&action=admin_rightslist&grpid="+idgroup+"&__rnd="+ Math.random(); * @param jTpl $tpl template engine * @param string $selector selector action * @param array $params parameters for the url * @param array $jsparam array : key=name of a url parameter, value=piece of javascript code ( variable name for example) */ function jtpl_function_xul_urljsstring($tpl, $selector, $params = array(), $jsparams = array()) { $search = array(); $repl = array(); foreach ($jsparams as $par => $var) { $params[$par] = '__@@' . $var . '@@__'; $search[] = urlencode($params[$par]); $repl[] = '"+encodeURIComponent(' . $var . ')+"'; } $url = jUrl::get($selector, $params, 0); echo '"' . str_replace($search, $repl, $url) . '"'; }
/** * @package jelix * @subpackage jtpl_plugin * @version $Id$ * @author Loic Mathaud * @contributor Laurent Jouanneau * @copyright 2005-2006 Loic Mathaud, 2010 Laurent Jouanneau * @link http://www.jelix.org * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html */ function jtpl_function_html_formurlparam($tpl, $selector = null, $params = array()) { if ($selector === null && isset($tpl->_privateVars['_formurl'])) { $url = $tpl->_privateVars['_formurl']; unset($tpl->_privateVars['_formurl']); } else { $url = jUrl::get($selector, $params, 2); } foreach ($url->params as $p_name => $p_value) { echo '<input type="hidden" name="' . $p_name . '" value="' . htmlspecialchars($p_value) . '"/>', "\n"; } }
protected function outputHeaderScript() { $conf = jApp::config()->urlengine; echo '<script type="text/javascript"> //<![CDATA[ jFormsJQ.selectFillUrl=\'' . jUrl::get('jelix~jforms:getListData') . '\'; jFormsJQ.config = {locale:' . $this->escJsStr(jApp::config()->locale) . ',basePath:' . $this->escJsStr($conf['basePath']) . ',jqueryPath:' . $this->escJsStr($conf['jqueryPath']) . ',jelixWWWPath:' . $this->escJsStr($conf['jelixWWWPath']) . '}; jFormsJQ.tForm = new jFormsJQForm(\'' . $this->_name . '\',\'' . $this->_form->getSelector() . '\',\'' . $this->_form->getContainer()->formId . '\'); jFormsJQ.tForm.setErrorDecorator(new ' . $this->options['errorDecorator'] . '()); jFormsJQ.declareForm(jFormsJQ.tForm); //]]> </script>'; }
/** * */ function onmasteradminGetMenuContent($event) { if (jAcl2::check('acl.user.view')) { $item = new masterAdminMenuItem('usersrights', jLocale::get('jacl2db_admin~acl2.menu.item.rights'), jUrl::get('jacl2db_admin~users:index'), 30, 'system'); $item->icon = jApp::config()->urlengine['jelixWWWPath'] . 'design/images/rights.png'; $event->add($item); } if (jAcl2::check('acl.group.view')) { $item = new masterAdminMenuItem('usersgroups', jLocale::get('jacl2db_admin~acl2.menu.item.groups'), jUrl::get('jacl2db_admin~groups:index'), 20, 'system'); $item->icon = jApp::config()->urlengine['jelixWWWPath'] . 'design/images/group.png'; $event->add($item); } }
function index() { $rep = parent::index(); if ($rep->getType() != 'html') { return $rep; } // Get repository key $repository = $this->repositoryKey; // Get the project key $project = $this->projectKey; $rep->body->assign('auth_url_return', jUrl::get('view~map:index', array("repository" => $repository, "project" => $project))); return $rep; }
public function outputHeader($builder) { $conf = jApp::config()->urlengine; // no scope into an anonymous js function, because jFormsJQ.tForm is used by other generated source code echo '<script type="text/javascript"> //<![CDATA[ jFormsJQ.selectFillUrl=\'' . jUrl::get('jelix~jforms:getListData') . '\'; jFormsJQ.config = {locale:' . $builder->escJsStr(jApp::config()->locale) . ',basePath:' . $builder->escJsStr(jApp::urlBasePath()) . ',jqueryPath:' . $builder->escJsStr($conf['jqueryPath']) . ',jelixWWWPath:' . $builder->escJsStr($conf['jelixWWWPath']) . '}; jFormsJQ.tForm = new jFormsJQForm(\'' . $builder->getName() . '\',\'' . $builder->getForm()->getSelector() . '\',\'' . $builder->getForm()->getContainer()->formId . '\'); jFormsJQ.tForm.setErrorDecorator(new ' . $builder->getOption('errorDecorator') . '()); jFormsJQ.declareForm(jFormsJQ.tForm); //]]> </script>'; }