예제 #1
0
 /**
  * Generate an options page based on the contentions of the URL request.
  * 
  * @global Smarty $smarty
  * @global Page $page
  *
  * @return string html for an options page.
  */
 public static function genOptionsPage()
 {
     $field = urldecode(edkURI::getArg('field', 1));
     $sub = urldecode(edkURI::getArg('sub', 2));
     if (!$field || !$sub) {
         $field = "Advanced";
         $sub = "Configuration";
     }
     global $smarty, $page;
     if (is_object($page)) {
         $page->setTitle('Administration - ' . $sub);
     }
     // create the option field
     $smarty->assign('field', urlencode($field));
     $smarty->assign('sub', urlencode($sub));
     $smarty->assign('actionURL', edkURI::build(array(array('a', 'admin', true), array('field', urlencode($field), true), array('sub', urlencode($sub), true))));
     $html = $smarty->fetch(get_tpl('admin_options_field_head'));
     // create all option sets
     foreach (self::$data[$field][$sub] as $set => $options) {
         $smarty->assign('set', $set);
         $html .= $smarty->fetch(get_tpl('admin_options_set_head'));
         // create all options in the set
         foreach ($options as $option) {
             $html .= options::assembleElement($option);
         }
         $html .= $smarty->fetch(get_tpl('admin_options_set_foot'));
     }
     $html .= $smarty->fetch(get_tpl('admin_options_field_foot'));
     return $html;
 }