function pagesetForm($object = null) { pathos_lang_loadDictionary('standard', 'core'); pathos_lang_loadDictionary('modules', 'navigationmodule'); // Initialize the forms subsystem for use. if (!defined('SYS_FORMS')) { require_once BASE . 'subsystems/forms.php'; } pathos_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); // Add a dropdown to allow the user to choose which pageset they want. // Pull the database object in from the global scope. global $db; // A holding array, which will become the source of the dropdown $pagesets = array(); foreach ($db->selectObjects('section_template', 'parent=0') as $pageset) { // Grab each pageset and store its name and id. The id will be used when updating. $pagesets[$pageset->id] = $pageset->name; } $form->register('pageset', TR_NAVIGATIONMODULE_PAGESET, new dropdowncontrol(0, $pagesets)); // Add the'Public?' checkbox. The 'Active?' checkbox is omitted, because it makes no sense. $form->register('public', TR_NAVIGATIONMODULE_ISPUBLIC, new checkboxcontrol($object->public)); // Add a Submit / Cancel button. $form->register('submit', '', new buttongroupcontrol(TR_CORE_SAVE, '', TR_CORE_CANCEL)); // Return the form to the calling scope (usually an action in the navigation module). return $form; }
/** * Pageset Form method * * This method returns a form object to be used when allowing the user * to create a new section using a user-defined Pageset. * * @param Object $object The section object to build the form from. * * @return Form A form object that can be used to create a new section, or * edit an existing one. */ static function pagesetForm($object = null) { // Initialize the forms subsystem for use. // 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); // Add a dropdown to allow the user to choose which pageset they want. // Pull the database object in from the global scope. global $db; // A holding array, which will become the source of the dropdown $pagesets = array(); foreach ($db->selectObjects('section_template', 'parent=0') as $pageset) { // Grab each pageset and store its name and id. The id will be used when updating. $pagesets[$pageset->id] = $pageset->name; } $form->register('pageset', gt('Pageset'), new dropdowncontrol(0, $pagesets)); // Add the'Public?' checkbox. The 'Active?' checkbox is omitted, because it makes no sense. $form->register('public', gt('Public'), new checkboxcontrol($object->public)); // Add a Submit / Cancel button. $form->register('submit', '', new buttongroupcontrol(gt('Save'), '', gt('Cancel'))); // Return the form to the calling scope (usually an action in the navigation module). return $form; }