예제 #1
0
 function form($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);
     // Register the sub themes dropdown.
     $form->register('subtheme', TR_NAVIGATIONMODULE_SUBTHEME, new dropdowncontrol($object->subtheme, pathos_theme_getSubThemes()));
     // Register the 'Active?' and 'Public?' checkboxes.
     $form->register('active', TR_NAVIGATIONMODULE_ISACTIVE, new checkboxcontrol($object->active));
     $form->register('public', TR_NAVIGATIONMODULE_ISPUBLIC, new checkboxcontrol($object->public));
     // Register the Page Meta Data controls.
     $form->register('page_title', TR_NAVIGATIONMODULE_PAGETITLE, new textcontrol($object->page_title));
     $form->register('keywords', TR_NAVIGATIONMODULE_KEYWORDS, new texteditorcontrol($object->keywords, 5, 25));
     $form->register('description', TR_NAVIGATIONMODULE_PAGEDESC, new texteditorcontrol($object->description, 5, 25));
     // 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;
 }
 function form($object = null)
 {
     pathos_lang_loadDictionary('standard', 'core');
     pathos_lang_loadDictionary('modules', 'navigationmodule');
     if (!defined('SYS_FORMS')) {
         require_once BASE . 'subsystems/forms.php';
     }
     pathos_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', TR_NAVIGATIONMODULE_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, 'pathos_sorting_byRankAscending');
             $dd = array(TR_NAVIGATIONMODULE_ATTOP);
             foreach ($sections as $s) {
                 $dd[] = sprintf(TR_NAVIGATIONMODULE_POSAFTER, $s->name);
             }
             $form->register('rank', TR_NAVIGATIONMODULE_POSITION, 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', TR_NAVIGATIONMODULE_SUBTHEME, new dropdowncontrol($object->subtheme, pathos_theme_getSubThemes()));
     }
     #if (!isset($object->id) && $object->parent != 0) {
     $form->register('active', TR_NAVIGATIONMODULE_ISACTIVE, new checkboxcontrol($object->active));
     $form->register('public', TR_NAVIGATIONMODULE_ISPUBLIC, new checkboxcontrol($object->public));
     // Register the Page Meta Data controls.
     $form->register('page_title', TR_NAVIGATIONMODULE_PAGETITLE, new textcontrol($object->page_title));
     $form->register('keywords', TR_NAVIGATIONMODULE_KEYWORDS, new texteditorcontrol($object->keywords, 5, 25));
     $form->register('description', TR_NAVIGATIONMODULE_PAGEDESC, new texteditorcontrol($object->keywords, 5, 25));
     #}
     $form->register('submit', '', new buttongroupcontrol(TR_CORE_SAVE, '', TR_CORE_CANCEL));
     return $form;
 }