function s_new_item($s_oncology) { # create a new item $s_new_id = uniqid($s_oncology); $odOD = new OncologyData(); $s_oncology_name = $odOD->s_oncology_name_from_id($s_oncology); $s_item_template = '{"id":"' . $s_new_id . '", "keywords":"", "description":"", "parent":"", "title":"new ' . $s_oncology_name . '", "url":"/new-' . $s_oncology_name . '/","url_auto":"true", "template":"template.html","oncology":"' . $s_oncology . '", "author":"' . $this->s_get_current_user()->user . '", "published": "false", "date_modified": ""}'; $s_full_item_template = '{"content_html":""}'; array_push($this->items, json_decode($s_item_template)); $this->oa_individual_items[$s_new_id] = json_decode($s_full_item_template); # save it to datastore $this->b_save_datastore("items"); $this->b_save_item($s_new_id); # return its id return $s_new_id; }
if ($s_page_id) { # get the item $o_item = $flot->datastore->get_item_data($s_page_id); $o_full_item = $flot->datastore->o_get_full_item($s_page_id); # get the oncology # render a form $Item = new Item($o_item); $Item->_set_full_item($o_full_item); $html_main_admin_content .= $Item->html_edit_form(); // make left menu smaller, to give more focus to editing $s_body_class = "smaller_left"; } break; case 'list': # list all pages that can be edited (pagination ?) $odOD = new OncologyData(); $s_oncology_filter = $ufUf->s_get_var('oncology', false); $oa_pages = $flot->oa_pages(); if ($s_oncology_filter !== false) { // filter pages retrieved to be of the right page type $oa_filtered_pages = array(); foreach ($oa_pages as $page) { $s_oncology_id = urldecode($page->oncology); if ($s_oncology_id === $s_oncology_filter) { array_push($oa_filtered_pages, $page); } } $oa_pages = $oa_filtered_pages; } $hmtl_pages_ui = ""; $hmtl_pages_ui .= '' . $admin_ui->html_make_page_add_button() . '<div class="btn-group"><a class="btn btn-default btn-sm" href="' . S_BASE_EXTENSION . 'flot-admin/admin/index.php?section=flot&action=regenerate"><i class="glyphicon glyphicon-refresh"></i> regenerate all pages</a></div><hr/>';
function html_make_page_add_button() { $s_oncologies = '<li><a href="#" class="btn disabled">no page types :(</a></li>'; $odOD = new OncologyData(); $oa_oncologies_available = $odOD->oa_oncologies_available(); if (count($oa_oncologies_available) > 0) { $s_oncologies = ''; foreach ($oa_oncologies_available as $key => $value) { $s_oncologies .= '<li><a href="' . S_BASE_EXTENSION . 'flot-admin/admin/index.php?section=items&oncology=' . $key . '&action=new">' . $value . '</a></li>'; } } $html_add_content_button = '<div class="btn-group edit_item_general_toolbar"> <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><i class="glyphicon glyphicon-plus"></i> Add <span class="hidden-xs"> a page</span> <span class="caret"></span> </button> <ul class="dropdown-menu" role="menu">' . $s_oncologies . '</ul> </div>'; return $html_add_content_button; }