X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fxorgpage.php;h=0baad1ef9f4f6a304ef3c8d99136435269e5b78b;hb=57fc676c5dfbf964c21a6b1a1f6e5abcb08e0b42;hp=d2bb501a4a979258b0155da09b83a9ad34c62bad;hpb=55546c0db778c2d8f9d7debd30117931dc39ff16;p=platal.git diff --git a/classes/xorgpage.php b/classes/xorgpage.php index d2bb501..0baad1e 100644 --- a/classes/xorgpage.php +++ b/classes/xorgpage.php @@ -1,6 +1,6 @@ changeTpl('platal/index.tpl'); + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) { + $this->addJsLink('json2.js'); + } + $this->addJsLink('jquery.xorg.js'); + $this->addJsLink('overlib.js'); + $this->addJsLink('core.js'); $this->addJsLink('xorg.js'); + $this->setTitle('le site des élèves et anciens élèves de l\'École polytechnique'); + if (S::logged() && S::user()->checkPerms('admin')) { + $types = array(S::user()->type); + $perms = DirEnum::getOptions(DirEnum::ACCOUNTTYPES); + ksort($perms); + foreach ($perms as $type => $perm) { + if (!empty($perm) && $type != $types[0]) { + $types[] = $type; + } + } + $this->assign('account_types_list', $types); + + $skins = DirEnum::getOptions(DirEnum::SKINS); + asort($skins); + $this->assign('skin_list', $skins); + } + } + + /** Force the skin to use, bypassing user choice. + * Typically used for the 'register' page. + * @param $skin The skin to use. + */ + public function forceSkin($skin) + { + $this->forced_skin = $skin; + } + + /** Choose another 'default' skin. + * Typically used for the 'Auth Groupe X' login page. + * @param $skin The default skin to use. + */ + public function setDefaultSkin($skin) + { + $this->default_skin = $skin; } public function run() { global $globals, $platal; - if (isset($platal) && $platal->path == 'register') { - $skin = $globals->register_skin . ".tpl"; + if ($this->forced_skin !== null) { + $skin = $this->forced_skin . '.tpl'; } else { - $skin = S::v('skin', $globals->skin . ".tpl"); + if ($this->default_skin === null) { + $default_skin = $globals->skin; + } else { + $default_skin = $this->default_skin; + } + $skin = S::v('skin', $default_skin . '.tpl'); } $this->_run('skin/' . $skin); }