Esempio n. 1
0
/**
 * Get tempcode for a CEDI post 'feature box' for the given row
 *
 * @param  array			The database field row of it
 * @param  ID_TEXT		The zone to use
 * @param  boolean		Whether to put it in a box
 * @return tempcode		A box for it, linking to the full page
 */
function get_cedi_page_html($row, $zone = '_SEARCH', $put_in_box = true)
{
    $content = paragraph(get_translated_tempcode($row['description']), 'tyrtfjhggfdf');
    $url = build_url(array('page' => 'cedi', 'type' => 'misc', 'id' => $row['id'] == db_get_first_id() ? NULL : $row['id']), $zone);
    if ($put_in_box) {
        $chain = cedi_derive_chain($row['id']);
        $chain = preg_replace('#/[^/]+#', '', $chain);
        if ($chain != '') {
            $tree = cedi_breadcrumbs($chain, NULL, true);
            if (!$tree->is_empty()) {
                $content->attach(paragraph(do_lang_tempcode('LOCATED_IN', $tree)));
            }
        }
    }
    $preview = do_template('SIMPLE_PREVIEW_BOX', array('SUMMARY' => $content, 'URL' => $url));
    if (!$put_in_box) {
        return $preview;
    }
    return put_in_standard_box($preview, do_lang_tempcode('CEDI_PAGE', escape_html(get_translated_text($row['title']))));
}
Esempio n. 2
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));
 }