Exemplo n.º 1
0
 /**
  * Build and return admin interface
  * 
  * Any module providing an admin interface is required to have this function, which
  * returns a string containing the (x)html of it's admin interface.
  * @return string
  */
 function getAdminInterface()
 {
     $id = @$_REQUEST['siteconfig_id'];
     $option = new SiteConfig($id);
     switch (@$_REQUEST['action']) {
         case 'addedit':
             $form = $option->getAddEditForm();
             if ($form->validate() && $form->isSubmitted() && isset($_REQUEST['siteconfig_submit'])) {
                 // do nothing
             } else {
                 return $form->display();
             }
             break;
         case 'toggle':
             $option->setEditable(1 - $option->getEditable());
             $option->save();
             break;
         case 'delete':
             $option->delete();
             $option = NULL;
             break;
         default:
     }
     $siteconfigs = SiteConfig::getAllSiteConfigs();
     $norex = NOREX;
     $this->smarty->assign('norex', $norex);
     $this->smarty->assign('siteconfigs', $siteconfigs);
     return $this->smarty->fetch('admin/siteconfigs.tpl');
 }