Exemplo n.º 1
0
 /**
  * Create user admin template
  * @param array $contentMain - template content data
  * @param bool $noMenusAndInfo - don't show user info
  * @return Template 
  */
 public function tpl($contentMain, $noMenusAndInfo = false)
 {
     // configure main template
     $this->ssp->pageTitleAdd("Member admin");
     if ($this->id != "" and !$noMenusAndInfo) {
         $name = $this->getName($this->id);
         $this->ssp->pageTitleAdd($name);
         $contentMain["displayName"] = $name;
     }
     if (isset($contentMain["title"])) {
         $this->ssp->pageTitleAdd($contentMain["title"]);
     }
     // generate menu
     if ($this->generateMenus and !$noMenusAndInfo) {
         $menu = new MenuGen();
         $path = $this->cfg->userAdminScript;
         $url = $_SERVER['REQUEST_URI'];
         $menu->add($path . "/chInfo", $this->session->t("Change Info"), strpos($url, "chInfo") !== false);
         $menu->sv("title={$this->session->t('Change user information')}");
         $menu->add($path . "/chPswd", $this->session->t("Change Password"), strpos($url, "chPswd") !== false);
         $menu->sv("title={$this->session->t('Change user password')}");
         $menu->add($path . "/chEmail", $this->session->t("Change Email"), strpos($url, "chEmail") !== false);
         $menu->sv("title={$this->session->t('Change user email')}");
         $menu->add($path . "/info/" . $this->id, $this->session->t("Basic Info"), strpos($url, "info") !== false);
         $menu->sv("title={$this->session->t('Show basic information')}");
         $menu->add("", "");
         if ($this->admin) {
             $menu->add($path . "/advInfo", $this->session->t("Advanced Info"), strpos($url, "advInfo") !== false);
             $menu->sv("title={$this->session->t('Show advanced information')}");
             $menu->add($path . "/chAdv", $this->session->t("Change Advanced"), strpos($url, "chAdv") !== false);
             $menu->sv("title={$this->session->t('Change advanced information')}");
             $menu->add($path . "/joinEmail", $this->session->t("Send Joining Email"), strpos($url, "joinEmail") !== false);
             $menu->sv("title={$this->session->t('Send a joinup email to the user')}");
             $menu->add($path . "/email", $this->session->t("Email Member"), strpos($url, "email") !== false);
             $menu->sv("title={$this->session->t('Email the member')}");
             $menu->add("", "");
         }
         $menu->add("useradminhelp.php", $this->session->t("Help"));
         $menu->sv("target=_blank");
         $contentMain["menu"] = $menu->cMenu();
     }
     $tpl = $this->ssp->tpl($contentMain, $this->templateFile, $this->generateMenus);
     return $tpl;
 }
Exemplo n.º 2
0
<?php

namespace w34u\ssp;

error_reporting(E_ALL);
require 'sspadmin/includeheader.php';
$SSP_Config = Configuration::getConfiguration();
$session = new Protect();
$content["title"] = "SSP Demo site";
$content["pathAdmin"] = "sspadmin/";
$menu = new MenuGen();
$menu->add($SSP_Config->adminDir, "Administration");
$content["menu"] = $menu->cMenu();
$page = new Template($content, "sspgeneraltemplate.tpl");
$page->getFile("content", "index.tpl");
echo $page->output();
Exemplo n.º 3
0
 /**
  * creates a template for admin page displays
  * @param array $contentMain the pages content
  * @param string $tpl alternative template name
  * @param bool $createMenu create the main menu
  * @param bool $suppressLangSelect - suppress the language selection dropdown
  * @return Template main template
  */
 function tpl($contentMain, $tpl = "", $createMenu = true, $suppressLangSelect = false)
 {
     // default to the main template if not other template not supplied
     if ($tpl != "") {
         $template = $tpl;
     } else {
         $template = $this->template;
     }
     // if the content suppied is just a string use it as the page title
     if (is_string($contentMain)) {
         $temp = $contentMain;
         $contentMain = array();
         $contentMain["title"] = $temp;
     }
     // build the page title from the supplied segments
     if (count($this->pageTitleSegments)) {
         if ($this->session->isTranslate()) {
             foreach ($this->pageTitleSegments as $key => $titlePart) {
                 $this->pageTitleSegments[$key] = $this->session->t($titlePart);
             }
         }
         $contentMain["title"] = $this->session->t($this->cfg->siteName) . $this->pageTitleSeperator . implode($this->pageTitleSeperator, $this->pageTitleSegments);
     } else {
         $contentMain["title"] = $this->session->t($this->cfg->siteName);
     }
     // add paths to various useful areas
     $contentMain["pathSite"] = $this->cfg->pathSite;
     $contentMain["pathAdmin"] = $this->cfg->adminDir;
     // create the language selection
     if ($this->cfg->translate and !$suppressLangSelect) {
         $formTemplate = array('<form action="{formAction}" method="post" id="languageSelectionform">', '{languageDropdown}', '{formHidden}', '</form>');
         $form = new sfc\Form(SSP_Path(true), 'notable', 'languageSelect');
         $form->translateDisable = true;
         $form->checkToken = false;
         $form->errorAutoFormDisplay = false;
         $form->formSubmitVar = 'languageSelectionformToken';
         $form->tplf = new Template("", $formTemplate);
         $languages = $this->session->getLanguages();
         $dropdownInformation = array();
         foreach ($languages as $lang => $languageInfo) {
             $dropdownInformation[$lang] = array('text' => $languageInfo['description'], 'dir' => $languageInfo['dir'], 'class' => 'lang_' . $lang, 'style' => 'background-image: url(/sspadmin/images/flag_' . $lang . '.png);');
         }
         $form->fe('select', 'languageDropdown', '', $dropdownInformation);
         $form->fep('deflt = ' . Protect::$tranlator->getLanguage());
         $form->setParam('script', 'onChange="this.form.submit()"');
         if ($form->processForm($_POST)) {
             if (!$form->error) {
                 $this->session->lang = $form->getField('languageDropdown');
                 session_write_close();
                 //echo 'code '. $_SESSION['SSP_currentLanguageCode'];
                 SSP_Divert(SSP_Path(true));
             }
         }
         $contentMain['languageSelectForm'] = $form->create();
     }
     if ($createMenu) {
         // generate main menu
         // highlight a main menu item
         if (isset($contentMain["mainSection"])) {
             $section = $contentMain["mainSection"];
         } else {
             $section = "";
         }
         $url = $_SERVER['REQUEST_URI'];
         $menu = new MenuGen();
         $menu->add($this->cfg->adminDir . 'useradmin/info/' . $this->session->userId, $this->session->t("User Details"), strpos($url, "useradmin") !== false);
         $menu->add($this->cfg->adminDir . 'adminusercreation', $this->session->t("New User"), strpos($url, "adminusercreation") !== false);
         $menu->add($this->cfg->userLister, $this->session->t("List Users"), $url === "/sspadmin/" or $url === '/sspadmin/filterChange' or $url === '/sspadmin/filterNormal' or $url === '/sspadmin/filterAdminPending');
         $menu->add($this->cfg->siteRoot, $this->session->t("Home"));
         $menu->add($this->cfg->logoffScript, $this->session->t("Log off"));
         $contentMain["mainMenu"] = $menu->cMenu();
     } else {
         $contentMain["mainMenu"] = "";
     }
     if (!isset($contentMain["menu"])) {
         $contentMain["menu"] = "";
     }
     if ($this->cfg->enableSetup === true) {
         $contentMain['showDisableSetupText'] = true;
     }
     $tpl = new Template($contentMain, $template, false);
     return $tpl;
 }
Exemplo n.º 4
0
 /**
  * Configue the main template
  * @param array $contentMain - template content data
  * @return Template 
  */
 public function tpl($contentMain)
 {
     // configure main template
     $this->ssp->pageTitleAdd("User admin");
     if (isset($contentMain["title"])) {
         $this->ssp->pageTitleAdd($contentMain["title"]);
     }
     $url = $_SERVER['REQUEST_URI'];
     $menu = new MenuGen();
     $menu->add($this->cfg->userLister . '/filterChange', $this->session->t("Modify Search"), $url === '/sspadmin/filterChange');
     if ($this->cfg->adminCheck) {
         if (!($this->filter->userAdminPending == 1 and $this->filter->creationFinished == 1)) {
             $menu->add($this->cfg->userLister . '/filterAdminPending', $this->session->t("List Admin Pending"), $url === '/sspadmin/filterAdminPending');
         }
     }
     $menu->add($this->cfg->userLister . '/filterNormal', $this->session->t("Defualt Listing"), $url === '/sspadmin/filterNormal');
     $menu->add('userlisterhelp.php', $this->session->t("Help"));
     $menu->sv("target=help");
     $contentMain["menu"] = $menu->cMenu();
     $tpl = $this->ssp->tpl($contentMain);
     return $tpl;
 }