/** * Renders a text from the database. * * If the user is logged in as an admin user, * then a link to the appropriate page in the admin section is provided. * * If the user is not logged in and the section required is 'content', * then the exception is propagated. * * Otherwise, the function does nothing. */ public static function render_page_section($page_name, $section_name) { if (DEBUG) { echo DEBUG_DELIM_OPEN; echo __FILE__ . PHP_EOL; echo 'Line: ' . __LINE__ . PHP_EOL; echo 'Method: ' . __METHOD__ . PHP_EOL; echo DEBUG_DELIM_CLOSE; } try { $filtered_page_section = DBPages_SPoE::get_filtered_page_section($page_name, $section_name); if (Admin_LogInHelper::is_logged_id()) { DBPages_AdminHelper::render_link_p_to_edit_section_admin_page($page_name, $section_name); } echo $filtered_page_section; } catch (DBPages_PageSectionNotFoundException $e) { #print_r($e); if (Admin_LogInHelper::is_logged_id()) { DBPages_AdminHelper::render_link_p_to_add_new_section_admin_page($page_name, $section_name); } else { if ($section_name == 'content') { throw $e; } else { #echo '<p class="error">Text not found.</p>' . "\n"; } } } }
private function get_home_page_welcome_text_div() { $welcome_div = new HTMLTags_Div(); $welcome_div->set_attribute_str('class', 'welcome'); $db_page = DBPages_SPoE::get_filtered_page_section('home', 'welcome'); $welcome_div->append_str_to_content($db_page); return $welcome_div; }
private function get_drama_page_frame_instructions_div() { $instructions_div = new HTMLTags_Div(); $instructions_div->set_attribute_str('class', 'instructions'); $instructions_div->set_attribute_str('id', 'drama-page-frame'); $db_page = DBPages_SPoE::get_filtered_page_section('drama', 'frame-instructions'); $instructions_div->append_str_to_content($db_page); return $instructions_div; }
/** * Renders a text from the database. * * If the user is logged in as an admin user, * then a link to the appropriate page in the admin section is provided. * * if the user is not logged in and the section required is 'content', then the exception * is propagated. * * Otherwise, the function does nothing. */ public static function render_page_section($page_name, $section_name) { try { $filtered_page_section = DBPages_SPoE::get_filtered_page_section($page_name, $section_name); if (Admin_LogInHelper::is_logged_id()) { DBPages_AdminHelper::render_link_p_to_edit_section_admin_page($page_name, $section_name); } echo $filtered_page_section; } catch (DBPages_PageSectionNotFoundException $e) { #print_r($e); if (Admin_LogInHelper::is_logged_id()) { DBPages_AdminHelper::render_link_p_to_add_new_section_admin_page($page_name, $section_name); } else { if ($section_name == 'content') { throw $e; } else { #echo '<p class="error">Text not found.</p>' . "\n"; } } } }
public static function get_filtered_page_section($page_name, $section_name) { return DBPages_SPoE::get_filtered_page_section($page_name, $section_name); }