function form($object = null) { $i18n = exponent_lang_loadFile('datatypes/section_template.php'); if (!defined('SYS_FORMS')) { require_once BASE . 'subsystems/forms.php'; } exponent_forms_initialize(); $form = new form(); if (!isset($object->id)) { $object->name = ''; $object->active = 1; $object->public = 1; $object->subtheme = ''; $object->page_title = SITE_TITLE; $object->keywords = SITE_KEYWORDS; $object->description = SITE_DESCRIPTION; if (!isset($object->parent)) { $object->parent = 0; } // NOT IMPLEMENTED YET //$object->subtheme=''; } else { $form->meta('id', $object->id); } $form->meta('parent', $object->parent); $form->register('name', $i18n['name'], new textcontrol($object->name)); if (!isset($object->id) && $object->parent != 0) { // Add the 'Add' drop down if not a top level global $db; $sections = $db->selectObjects('section_template', 'parent=' . $object->parent); if (count($sections)) { if (!defined('SYS_SORTING')) { require_once BASE . 'subsystems/sorting.php'; } usort($sections, 'exponent_sorting_byRankAscending'); $dd = array($i18n['position_top']); foreach ($sections as $s) { $dd[] = sprintf($i18n['position_after'], $s->name); } $form->register('rank', $i18n['rank'], new dropdowncontrol(count($dd) - 1, $dd)); } else { $form->meta('rank', 0); } } else { $form->meta('rank', 0); } if (is_readable(THEME_ABSOLUTE . 'subthemes')) { // grab sub themes $form->register('subtheme', $i18n['subtheme'], new dropdowncontrol($object->subtheme, exponent_theme_getSubThemes())); } $form->register('active', $i18n['active'], new checkboxcontrol($object->active)); $form->register('public', $i18n['public'], new checkboxcontrol($object->public)); // Register the Page Meta Data controls. $form->register('page_title', $i18n['page_title'], new textcontrol($object->page_title)); $form->register('keywords', $i18n['keywords'], new texteditorcontrol($object->keywords, 5, 25)); $form->register('description', $i18n['description'], new texteditorcontrol($object->keywords, 5, 25)); $form->register('submit', '', new buttongroupcontrol($i18n['save'], '', $i18n['save'])); return $form; }
function form($object = null) { $i18n = exponent_lang_loadFile('datatypes/section.php'); // Initialize the forms subsystem for use. if (!defined('SYS_FORMS')) { require_once BASE . 'subsystems/forms.php'; } exponent_forms_initialize(); // Grab the basic form that all page types share // This has the name and positional dropdowns registered. // This call also initializes the section object, if it is not an existing section. $form = section::_commonForm($object); // Register the sub themes dropdown. $form->register('subtheme', $i18n['subtheme'], new dropdowncontrol($object->subtheme, exponent_theme_getSubThemes())); // Register the 'Active?' and 'Public?' checkboxes. $form->register('active', $i18n['active'], new checkboxcontrol($object->active)); $form->register('public', $i18n['public'], new checkboxcontrol($object->public)); // Register the Page Meta Data controls. $form->register('page_title', $i18n['page_title'], new textcontrol($object->page_title)); $form->register('keywords', $i18n['keywords'], new texteditorcontrol($object->keywords, 5, 25)); $form->register('description', $i18n['description'], new texteditorcontrol($object->description, 5, 25)); // Add a Submit / Cancel button. $form->register('submit', '', new buttongroupcontrol($i18n['save'], '', $i18n['cancel'])); // Return the form to the calling scope (usually an action in the navigation module). return $form; }