Esempio n. 1
0
 /**
  * The UI for managing the CEDI children of a page.
  *
  * @return tempcode	The UI.
  */
 function edit_tree()
 {
     $title = get_page_title('CEDI_EDIT_TREE');
     list($id, $chain) = get_param_cedi_chain('id');
     check_specific_permission('seedy_manage_tree', array('seedy_page', $id));
     if (!has_category_access(get_member(), 'seedy_page', strval($id))) {
         access_denied('CATEGORY_ACCESS');
     }
     $children_entries = $GLOBALS['SITE_DB']->query_select('seedy_children', array('child_id', 'title'), array('parent_id' => $id), 'ORDER BY the_order');
     $children = '';
     foreach ($children_entries as $entry) {
         $child_id = $entry['child_id'];
         $child_title = $entry['title'];
         $children .= strval($child_id) . '!' . $child_title . "\n";
     }
     $redir_url = get_param('redirect', NULL);
     if (is_null($redir_url)) {
         $_redir_url = build_url(array('page' => 'cedi', 'type' => 'misc', 'id' => get_param('id', false, true) == strval(db_get_first_id()) ? NULL : get_param('id', false, true)), get_module_zone('cedi'));
         $redir_url = $_redir_url->evaluate();
     }
     $post_url = build_url(array('page' => '_SELF', 'id' => get_param('id', false, true), 'redirect' => $redir_url, 'type' => '_edit_tree'), '_SELF');
     $cedi_tree = cedi_show_tree($id, NULL, '', true, false, true);
     require_code('form_templates');
     list($warning_details, $ping_url) = handle_conflict_resolution();
     $tree = cedi_breadcrumbs($chain, NULL, true, true);
     breadcrumb_add_segment($tree, do_lang_tempcode('CEDI_EDIT_TREE'));
     $fields = new ocp_tempcode();
     require_code('form_templates');
     $fields->attach(form_input_text(do_lang_tempcode('CHILD_PAGES'), new ocp_tempcode(), 'children', $children, false, NULL, true));
     $form = do_template('FORM', array('_GUID' => 'b908438ccfc9be6166cf7c5c81d5de8b', 'FIELDS' => $fields, 'URL' => $post_url, 'HIDDEN' => '', 'TEXT' => '', 'SUBMIT_NAME' => do_lang_tempcode('SAVE')));
     return do_template('CEDI_MANAGE_TREE_SCREEN', array('_GUID' => '83da3f20799b66b8846eafa4251a5d01', 'PING_URL' => $ping_url, 'WARNING_DETAILS' => $warning_details, 'TREE' => $tree, 'TITLE' => $title, 'FORM' => $form, 'CEDI_TREE' => $cedi_tree));
 }
Esempio n. 2
0
 /**
  * Standard modular simple function for ajax-tree hooks. Returns a normal <select> style <option>-list, for fallback purposes
  *
  * @param  ?ID_TEXT		The ID to do under (NULL: root) - not always supported
  * @param  array			Options being passed through
  * @param  ?ID_TEXT		The ID to select by default (NULL: none)
  * @return tempcode		The nice list
  */
 function simple($id, $options, $it = NULL)
 {
     unset($id);
     unset($options);
     require_lang('cedi');
     require_code('cedi');
     return cedi_show_tree(is_null($it) ? NULL : intval($it));
 }