From 32b5946116aff1129ce521b078ddd0126d3abfa0 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 31 Oct 2017 16:22:21 -0500 Subject: [PATCH] Progress: organize some files and some additional markup generation Move some of the user login code to the parent class. - I can see reason for moving it to the parent's parent class, but I decided to hold off for now until I implement more classes. Added additional markup generation classes. - Some other constants where expanded from their HTML names to be more verbose. --- common/base/classes/base_markup.php | 2 +- common/standard/classes/standard_path.php | 919 ++++++++++++++++++++----- common/standard/classes/standard_path_user.php | 184 +++++ common/standard/paths/u/ja/user_check.php | 3 + common/standard/paths/u/ja/user_login.php | 9 + common/standard/paths/u/user_check.php | 84 ++- common/standard/paths/u/user_create.php | 88 +-- common/standard/paths/u/user_dashboard.php | 58 +- common/standard/paths/u/user_delete.php | 86 +-- common/standard/paths/u/user_edit.php | 88 +-- common/standard/paths/u/user_lock.php | 81 ++- common/standard/paths/u/user_login.php | 27 +- common/standard/paths/u/user_logout.php | 4 + common/standard/paths/u/user_refresh.php | 81 ++- common/standard/paths/u/user_session.php | 81 ++- common/standard/paths/u/user_settings.php | 38 +- common/standard/paths/u/user_unlock.php | 81 ++- common/standard/paths/u/user_view.php | 33 +- common/theme/classes/theme_html.php | 4 +- 19 files changed, 1375 insertions(+), 576 deletions(-) diff --git a/common/base/classes/base_markup.php b/common/base/classes/base_markup.php index 25766f2..c5ae8d8 100644 --- a/common/base/classes/base_markup.php +++ b/common/base/classes/base_markup.php @@ -485,7 +485,7 @@ class c_base_markup_tag extends c_base_rfc_string { const TYPE_POLYLINE = 107; const TYPE_PREFORMATTED = 108; const TYPE_PROGRESS = 109; - const TYPE_Q = 110; + const TYPE_QUOTE = 110; const TYPE_RADIAL_GRADIENT = 111; const TYPE_RADIO = 112; const TYPE_RANGE = 113; diff --git a/common/standard/classes/standard_path.php b/common/standard/classes/standard_path.php index 57c71e1..42bf0d1 100644 --- a/common/standard/classes/standard_path.php +++ b/common/standard/classes/standard_path.php @@ -19,32 +19,39 @@ require_once('common/base/classes/base_mime.php'); class c_standard_path extends c_base_path { public const PATH_SELF = ''; - protected const CSS_AS_SECTION = 'as-section'; - protected const CSS_AS_SECTION_HEADERS = 'as-section-headers'; - protected const CSS_AS_WRAPPER = 'as-wrapper'; + protected const CSS_AS_BOLD = 'as-bold'; protected const CSS_AS_BREAK = 'as-break'; - protected const CSS_AS_TITLE = 'as-title'; - protected const CSS_AS_TEXT = 'as-text'; - protected const CSS_AS_TEXT_BLOCK = 'as-text-block'; - protected const CSS_AS_PARAGRAPH = 'as-paragraph'; - protected const CSS_AS_PARAGRAPH_BLOCK = 'as-paragraph-block'; - protected const CSS_AS_LINK_BLOCK = 'as-link_block'; - protected const CSS_AS_LINK_BLOCK_NAME = 'as-link_block-name'; - protected const CSS_AS_LINK_BLOCK_LINK = 'as-link_block-link'; - protected const CSS_AS_LINK_BLOCK_DESCRIPTION = 'as-link_block-description'; - protected const CSS_AS_HEADER = 'as-header'; - protected const CSS_AS_HEADER_TEXT = 'as-header-text'; - protected const CSS_AS_HEADERS = 'as-headers'; + protected const CSS_AS_CITATION = 'as-citation'; + protected const CSS_AS_CODE = 'as-code'; + protected const CSS_AS_DELETE = 'as-delete'; protected const CSS_AS_FIELD_SET = 'as-field_set'; protected const CSS_AS_FIELD_SET_LEGEND = 'as-field_set-legend'; protected const CSS_AS_FIELD_SET_CONTENT = 'as-field_set-content'; protected const CSS_AS_FIELD_ROW = 'as-field_row'; protected const CSS_AS_FIELD_ROW_NAME = 'as-field_row-name'; protected const CSS_AS_FIELD_ROW_VALUE = 'as-field_row-value'; + protected const CSS_AS_HEADER = 'as-header'; + protected const CSS_AS_HEADER_TEXT = 'as-header-text'; + protected const CSS_AS_HEADERS = 'as-headers'; + protected const CSS_AS_INSERT = 'as-insert'; + protected const CSS_AS_ITALICS = 'as-italics'; + protected const CSS_AS_LINK_BLOCK = 'as-link_block'; + protected const CSS_AS_LINK_BLOCK_NAME = 'as-link_block-name'; + protected const CSS_AS_LINK_BLOCK_LINK = 'as-link_block-link'; + protected const CSS_AS_LINK_BLOCK_DESCRIPTION = 'as-link_block-description'; + protected const CSS_AS_MARK = 'as-mark'; + protected const CSS_AS_PARAGRAPH = 'as-paragraph'; + protected const CSS_AS_PARAGRAPH_BLOCK = 'as-paragraph-block'; + protected const CSS_AS_PREFORMATTED = 'as-preformatted'; protected const CSS_AS_ROW = 'as-row'; protected const CSS_AS_ROW_EVEN = 'as-row-even'; protected const CSS_AS_ROW_ODD = 'as-row-odd'; protected const CSS_AS_ROW_VALUE = 'as-row-value'; + protected const CSS_AS_SAMPLE = 'as-sample'; + protected const CSS_AS_SCRIPT_SUB = 'as-script_sub'; + protected const CSS_AS_SCRIPT_SUPER = 'as-script_super'; + protected const CSS_AS_SECTION = 'as-section'; + protected const CSS_AS_SECTION_HEADERS = 'as-section-headers'; protected const CSS_AS_SPACER = 'as-spacer'; protected const CSS_AS_TABLE = 'as-table'; protected const CSS_AS_TABLE_CAPTION = 'as-table-caption'; @@ -56,9 +63,17 @@ class c_standard_path extends c_base_path { protected const CSS_AS_TABLE_ROW = 'as-table-row'; protected const CSS_AS_TABLE_CELL = 'as-table-cell'; protected const CSS_AS_TABLE_FOOTER = 'as-table-footer'; + protected const CSS_AS_TITLE = 'as-title'; + protected const CSS_AS_TEXT = 'as-text'; + protected const CSS_AS_TEXT_BLOCK = 'as-text-block'; + protected const CSS_AS_QUOTE_BLOCK = 'as-quote_block'; + protected const CSS_AS_QUOTE_INLINE = 'as-quote_inline'; + protected const CSS_AS_UNDERLINE = 'as-underline'; + protected const CSS_AS_WRAPPER = 'as-wrapper'; protected const CSS_IS_JAVASCRIPT_ENABLED = 'javascript-enabled'; protected const CSS_IS_JAVASCRIPT_DISABLED = 'javascript-disabled'; + protected const CSS_IS_CONTENT_TYPE = 'is-html_5'; protected const CSS_SYSTEM_PREFIX = 'system-'; @@ -183,175 +198,719 @@ class c_standard_path extends c_base_path { if (isset($this->settings['standards_issue-use_p_tags']) && $this->settings['standards_issue-use_p_tags']) { $this->text_type = c_base_markup_tag::TYPE_PARAGRAPH; } - - $this->languages = $this->http->get_response_content_language()->get_value_exact(); - if (!is_array($this->languages)) { - $this->languages = []; + + $this->languages = $this->http->get_response_content_language()->get_value_exact(); + if (!is_array($this->languages)) { + $this->languages = []; + } + + $this->pr_get_language_alias(); + + return new c_base_return_true(); + } + + /** + * Get the breadcrumb for this path. + * + * The breadcrumb will be built by this function if it is not already built. + * + * @return c_base_menu_item|c_base_return_null + * The breadcrumb menu is returned on success. + * If not defined, then NULL is returned. + * NULL with the error bit set is returned on error. + */ + public function get_breadcrumbs() { + if (!($this->breadcrumbs instanceof c_base_menu_item)) { + $this->pr_build_breadcrumbs(); + } + + if ($this->breadcrumbs instanceof c_base_menu_item) { + return clone($this->breadcrumbs); + } + + return new c_base_return_null(); + } + + /** + * Return the current path parts after the specified path. + * + * This is intended for handling the path parts as arguments. + * Processed path arguments are stored on the classes arguments variable. + * + * No sanitization is performed on these arguments. + * + * @param string $path_after + * The string to parse. + * + * @return bool + * TRUE on success, FALSE otherwise. + * On error, arguments is assigned to an empty array. + */ + protected function pr_process_path_arguments($path_after) { + $path = $this->http->get_request_uri_relative($this->settings['base_path'])->get_value_exact(); + $path = preg_replace('@^' . $path_after . '(/|$)@i', '', $path); + + if (mb_strlen($path) == 0) { + unset($path); + $this->arguments = []; + return FALSE; + } + + $this->arguments = explode('/', $path); + unset($path); + + return TRUE; + } + + /** + * Build the breadcrumb. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + * FALSE with error bit set is returned on error. + */ + protected function pr_build_breadcrumbs() { + if (!is_object($this->path_tree)) { + return new c_base_return_false(); + } + + $handler_settings = $this->path_tree->get_item_reset(); + if ($handler_settings instanceof c_base_return_false) { + unset($handler_settings); + return new c_base_return_false(); + } + + $this->breadcrumbs = new c_base_menu_item(); + + // render the breadcrumbs for all appropriate paths as the default behavior. + // this does not include the last path tree item because that item should be this class. + $count = 0; + $total = $this->path_tree->get_items_count() - 1; + for (; $count < $total; $count++) { + if ($handler_settings instanceof c_base_return_false) { + $handler_settings = $this->path_tree->get_item_next(); + continue; + } + + $handler_settings = $handler_settings->get_value(); + + if (!isset($handler_settings['include_name']) || !is_string($handler_settings['include_name'])) { + $handler_settings = $this->path_tree->get_item_next(); + continue; + } + + if (!isset($handler_settings['include_directory']) || !is_string($handler_settings['include_directory'])) { + $handler_settings = $this->path_tree->get_item_next(); + continue; + } + + if (!isset($handler_settings['handler']) || !is_string($handler_settings['handler'])) { + $handler_settings = $this->path_tree->get_item_next(); + continue; + } + + require_once($handler_settings['include_directory'] . $handler_settings['include_name'] . static::SCRIPT_EXTENSION); + + + $handler = NULL; + if (is_string($this->language_alias)) { + @include_once($handler_settings['include_directory'] . $this->language_alias . '/' . $handler_settings['include_name'] . static::SCRIPT_EXTENSION); + + $handler_class = $handler_settings['handler'] . '_' . $this->language_alias; + if (class_exists($handler_class)) { + $handler = new $handler_class(); + } + unset($handler_class); + } + + if (is_null($handler)) { + if (class_exists($handler_settings['handler'])) { + $handler = new $handler_settings['handler'](); + } + else { + unset($handler); + $handler_settings = $this->path_tree->get_item_next(); + continue; + } + } + + $handler->set_parameters($this->http, $this->database, $this->session, $this->settings); + $breadcrumbs = $handler->get_breadcrumbs(); + if ($breadcrumbs instanceof c_base_menu_item) { + $breadcrumbs = $breadcrumbs->get_items()->get_value_exact(); + foreach ($breadcrumbs as $breadcrumb) { + $this->breadcrumbs->set_item($breadcrumb); + } + unset($breadcrumb); + } + unset($breadcrumbs); + unset($handler); + unset($handler_settings); + + $handler_settings = $this->path_tree->get_item_next(); + } + unset($count); + unset($total); + + return new c_base_return_true(); + } + + /** + * Creates the standard section. + * + * @param array|null $headers + * An array of headers, whose keys are the header number and values are the header names. + * If NULL, then the headers are not assigned. + * @param array $arguments + * (optional) An array of arguments to convert into text. + * @param string|null $id + * (optional) An ID attribute to assign. + * If NULL, then this is not assigned. + * @param string|array||null $extra_class + * (optional) An additional css class to append to the wrapping block. + * May be an array of classes to append. + * If NULL, then this is not assigned. + * + * @return c_base_markup_tag + * The generated markup tag. + */ + protected function pr_create_tag_section($headers = NULL, $arguments = [], $id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_SECTION, static::CSS_AS_SECTION]; + if (is_string($extra_class)) { + $classes[] = $extra_class; + } + elseif (is_array($extra_class)) { + foreach ($extra_class as $class) { + $classes[] = $class; + } + unset($class); + } + + $tag = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_SECTION, $id, $classes); + unset($classes); + + if (is_array($headers)) { + $header = $this->pr_create_tag_headers($headers, $arguments, NULL, static::CSS_AS_SECTION_HEADERS); + $tag->set_tag($header); + unset($header); + } + + return $tag; + } + + /** + * Creates the standard wrapper. + * + * @param string|null $id + * (optional) An ID attribute to assign. + * If NULL, then this is not assigned. + * @param string|null $extra_class + * (optional) An additional css class to append to the wrapping block. + * May be an array of classes to append. + * If NULL, then this is not assigned. + * + * @return c_base_markup_tag + * The generated markup tag. + */ + protected function pr_create_tag_wrapper($id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_WRAPPER, static::CSS_AS_WRAPPER]; + if (is_string($extra_class)) { + $classes[] = $extra_class; + } + elseif (is_array($extra_class)) { + foreach ($extra_class as $class) { + $classes[] = $class; + } + unset($class); + } + + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, $id, $classes); + } + + /** + * Creates the standard break tag. + * + * @param string|null $id + * (optional) An ID attribute to assign. + * If NULL, then this is not assigned. + * @param string|null $extra_class + * (optional) An additional css class to append to the wrapping block. + * May be an array of classes to append. + * If NULL, then this is not assigned. + * + * @return c_base_markup_tag + * The generated markup tag. + */ + protected function pr_create_tag_break($id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_BREAK, static::CSS_AS_BREAK]; + if (is_string($extra_class)) { + $classes[] = $extra_class; + } + elseif (is_array($extra_class)) { + foreach ($extra_class as $class) { + $classes[] = $class; + } + unset($class); + } + + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_BREAK, $id, $classes); + } + + /** + * Creates the standard text. + * + * @param int|string $text + * The text or the text code to use. + * @param array $arguments + * (optional) An array of arguments to convert into text. + * @param string|null $id + * (optional) An ID attribute to assign. + * If NULL, then this is not assigned. + * @param string|null $extra_class + * (optional) An additional css class to append to the wrapping block. + * May be an array of classes to append. + * If NULL, then this is not assigned. + * + * @return c_base_markup_tag + * The generated markup tag. + */ + protected function pr_create_tag_text($text, $arguments = [], $id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_TEXT, static::CSS_AS_TEXT]; + if (is_string($extra_class)) { + $classes[] = $extra_class; + } + elseif (is_array($extra_class)) { + foreach ($extra_class as $class) { + $classes[] = $class; + } + unset($class); + } + + if (is_int($text)) { + return c_theme_html::s_create_tag($this->text_type, $id, $classes, $this->pr_get_text($text, $arguments)); + } + + return c_theme_html::s_create_tag($this->text_type, $id, $classes, $text); + } + + /** + * Creates the standard text, explicitly using span. + * + * @param int|string $text + * The text or the text code to use. + * @param array $arguments + * (optional) An array of arguments to convert into text. + * @param string|null $id + * (optional) An ID attribute to assign. + * If NULL, then this is not assigned. + * @param string|null $extra_class + * (optional) An additional css class to append to the wrapping block. + * May be an array of classes to append. + * If NULL, then this is not assigned. + * + * @return c_base_markup_tag + * The generated markup tag. + */ + protected function pr_create_tag_text_span($text, $arguments = [], $id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_TEXT, static::CSS_AS_TEXT]; + if (is_string($extra_class)) { + $classes[] = $extra_class; + } + elseif (is_array($extra_class)) { + foreach ($extra_class as $class) { + $classes[] = $class; + } + unset($class); + } + + if (is_int($text)) { + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_SPAN, $id, $classes, $this->pr_get_text($text, $arguments)); + } + + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_SPAN, $id, $classes, $text); + } + + /** + * Creates the standard bold. + * + * @param int|string $text + * The text or the text code to use. + * @param array $arguments + * (optional) An array of arguments to convert into text. + * @param string|null $id + * (optional) An ID attribute to assign. + * If NULL, then this is not assigned. + * @param string|null $extra_class + * (optional) An additional css class to append to the wrapping block. + * May be an array of classes to append. + * If NULL, then this is not assigned. + * + * @return c_base_markup_tag + * The generated markup tag. + */ + protected function pr_create_tag_bold($text, $arguments = [], $id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_BOLD, static::CSS_AS_BOLD]; + if (is_string($extra_class)) { + $classes[] = $extra_class; + } + elseif (is_array($extra_class)) { + foreach ($extra_class as $class) { + $classes[] = $class; + } + unset($class); + } + + if (is_int($text)) { + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_BOLD, $id, $classes, $this->pr_get_text($text, $arguments)); + } + + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_BOLD, $id, $classes, $text); + } + + /** + * Creates the standard italics. + * + * @param int|string $text + * The text or the text code to use. + * @param array $arguments + * (optional) An array of arguments to convert into text. + * @param string|null $id + * (optional) An ID attribute to assign. + * If NULL, then this is not assigned. + * @param string|null $extra_class + * (optional) An additional css class to append to the wrapping block. + * May be an array of classes to append. + * If NULL, then this is not assigned. + * + * @return c_base_markup_tag + * The generated markup tag. + */ + protected function pr_create_tag_italics($text, $arguments = [], $id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_ITALICS, static::CSS_AS_ITALICS]; + if (is_string($extra_class)) { + $classes[] = $extra_class; + } + elseif (is_array($extra_class)) { + foreach ($extra_class as $class) { + $classes[] = $class; + } + unset($class); + } + + if (is_int($text)) { + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_ITALICS, $id, $classes, $this->pr_get_text($text, $arguments)); + } + + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_ITALICS, $id, $classes, $text); + } + + /** + * Creates the standard subscript. + * + * @param int|string $text + * The text or the text code to use. + * @param array $arguments + * (optional) An array of arguments to convert into text. + * @param string|null $id + * (optional) An ID attribute to assign. + * If NULL, then this is not assigned. + * @param string|null $extra_class + * (optional) An additional css class to append to the wrapping block. + * May be an array of classes to append. + * If NULL, then this is not assigned. + * + * @return c_base_markup_tag + * The generated markup tag. + */ + protected function pr_create_tag_script_sub($text, $arguments = [], $id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_SCRIPT_SUB, static::CSS_AS_SCRIPT_SUB]; + if (is_string($extra_class)) { + $classes[] = $extra_class; + } + elseif (is_array($extra_class)) { + foreach ($extra_class as $class) { + $classes[] = $class; + } + unset($class); + } + + if (is_int($text)) { + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_SUB_SCRIPT, $id, $classes, $this->pr_get_text($text, $arguments)); + } + + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_SUB_SCRIPT, $id, $classes, $text); + } + + /** + * Creates the standard superscript. + * + * @param int|string $text + * The text or the text code to use. + * @param array $arguments + * (optional) An array of arguments to convert into text. + * @param string|null $id + * (optional) An ID attribute to assign. + * If NULL, then this is not assigned. + * @param string|null $extra_class + * (optional) An additional css class to append to the wrapping block. + * May be an array of classes to append. + * If NULL, then this is not assigned. + * + * @return c_base_markup_tag + * The generated markup tag. + */ + protected function pr_create_tag_text_script_super($text, $arguments = [], $id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_SCRIPT_SUPER, static::CSS_AS_SCRIPT_SUPER]; + if (is_string($extra_class)) { + $classes[] = $extra_class; + } + elseif (is_array($extra_class)) { + foreach ($extra_class as $class) { + $classes[] = $class; + } + unset($class); + } + + if (is_int($text)) { + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_SUPER_SCRIPT, $id, $classes, $this->pr_get_text($text, $arguments)); + } + + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_SUPER_SCRIPT, $id, $classes, $text); + } + + /** + * Creates the standard inline quote. + * + * @param int|string $text + * The text or the text code to use. + * @param array $arguments + * (optional) An array of arguments to convert into text. + * @param string|null $id + * (optional) An ID attribute to assign. + * If NULL, then this is not assigned. + * @param string|null $extra_class + * (optional) An additional css class to append to the wrapping block. + * May be an array of classes to append. + * If NULL, then this is not assigned. + * + * @return c_base_markup_tag + * The generated markup tag. + */ + protected function pr_create_tag_quote_inline($text, $arguments = [], $id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_QUOTE_INLINE, static::CSS_AS_QUOTE_INLINE]; + if (is_string($extra_class)) { + $classes[] = $extra_class; + } + elseif (is_array($extra_class)) { + foreach ($extra_class as $class) { + $classes[] = $class; + } + unset($class); + } + + if (is_int($text)) { + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_QUOTE, $id, $classes, $this->pr_get_text($text, $arguments)); + } + + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_QUOTE, $id, $classes, $text); + } + + /** + * Creates the standard underline. + * + * @param int|string $text + * The text or the text code to use. + * @param array $arguments + * (optional) An array of arguments to convert into text. + * @param string|null $id + * (optional) An ID attribute to assign. + * If NULL, then this is not assigned. + * @param string|null $extra_class + * (optional) An additional css class to append to the wrapping block. + * May be an array of classes to append. + * If NULL, then this is not assigned. + * + * @return c_base_markup_tag + * The generated markup tag. + */ + protected function pr_create_tag_underline($text, $arguments = [], $id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_UNDERLINE, static::CSS_AS_UNDERLINE]; + if (is_string($extra_class)) { + $classes[] = $extra_class; + } + elseif (is_array($extra_class)) { + foreach ($extra_class as $class) { + $classes[] = $class; + } + unset($class); + } + + if (is_int($text)) { + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_UNDERLINE, $id, $classes, $this->pr_get_text($text, $arguments)); + } + + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_UNDERLINE, $id, $classes, $text); + } + + /** + * Creates the standard sample. + * + * @param int|string $text + * The text or the text code to use. + * @param array $arguments + * (optional) An array of arguments to convert into text. + * @param string|null $id + * (optional) An ID attribute to assign. + * If NULL, then this is not assigned. + * @param string|null $extra_class + * (optional) An additional css class to append to the wrapping block. + * May be an array of classes to append. + * If NULL, then this is not assigned. + * + * @return c_base_markup_tag + * The generated markup tag. + */ + protected function pr_create_tag_sample($text, $arguments = [], $id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_SAMPLE, static::CSS_AS_SAMPLE]; + if (is_string($extra_class)) { + $classes[] = $extra_class; + } + elseif (is_array($extra_class)) { + foreach ($extra_class as $class) { + $classes[] = $class; + } + unset($class); } - $this->pr_get_language_alias(); + if (is_int($text)) { + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_SAMPLE, $id, $classes, $this->pr_get_text($text, $arguments)); + } - return new c_base_return_true(); + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_SAMPLE, $id, $classes, $text); } /** - * Get the breadcrumb for this path. + * Creates the standard block quote. * - * The breadcrumb will be built by this function if it is not already built. + * @param int|string $text + * The text or the text code to use. + * @param array $arguments + * (optional) An array of arguments to convert into text. + * @param string|null $id + * (optional) An ID attribute to assign. + * If NULL, then this is not assigned. + * @param string|null $extra_class + * (optional) An additional css class to append to the wrapping block. + * May be an array of classes to append. + * If NULL, then this is not assigned. * - * @return c_base_menu_item|c_base_return_null - * The breadcrumb menu is returned on success. - * If not defined, then NULL is returned. - * NULL with the error bit set is returned on error. + * @return c_base_markup_tag + * The generated markup tag. */ - public function get_breadcrumbs() { - if (!($this->breadcrumbs instanceof c_base_menu_item)) { - $this->pr_build_breadcrumbs(); + protected function pr_create_tag_quote_block($text, $arguments = [], $id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_QUOTE_BLOCK, static::CSS_AS_QUOTE_BLOCK]; + if (is_string($extra_class)) { + $classes[] = $extra_class; + } + elseif (is_array($extra_class)) { + foreach ($extra_class as $class) { + $classes[] = $class; + } + unset($class); } - if ($this->breadcrumbs instanceof c_base_menu_item) { - return clone($this->breadcrumbs); + if (is_int($text)) { + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_BLOCKQUOTE, $id, $classes, $this->pr_get_text($text, $arguments)); } - return new c_base_return_null(); + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_BLOCKQUOTE, $id, $classes, $text); } /** - * Return the current path parts after the specified path. - * - * This is intended for handling the path parts as arguments. - * Processed path arguments are stored on the classes arguments variable. + * Creates the standard citation. * - * No sanitization is performed on these arguments. - * - * @param string $path_after - * The string to parse. + * @param int|string $text + * The text or the text code to use. + * @param array $arguments + * (optional) An array of arguments to convert into text. + * @param string|null $id + * (optional) An ID attribute to assign. + * If NULL, then this is not assigned. + * @param string|null $extra_class + * (optional) An additional css class to append to the wrapping block. + * May be an array of classes to append. + * If NULL, then this is not assigned. * - * @return bool - * TRUE on success, FALSE otherwise. - * On error, arguments is assigned to an empty array. + * @return c_base_markup_tag + * The generated markup tag. */ - protected function pr_process_path_arguments($path_after) { - $path = $this->http->get_request_uri_relative($this->settings['base_path'])->get_value_exact(); - $path = preg_replace('@^' . $path_after . '(/|$)@i', '', $path); - - if (mb_strlen($path) == 0) { - unset($path); - $this->arguments = []; - return FALSE; + protected function pr_create_tag_citation($text, $arguments = [], $id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_CITATION, static::CSS_AS_CITATION]; + if (is_string($extra_class)) { + $classes[] = $extra_class; + } + elseif (is_array($extra_class)) { + foreach ($extra_class as $class) { + $classes[] = $class; + } + unset($class); } - $this->arguments = explode('/', $path); - unset($path); + if (is_int($text)) { + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_CITE, $id, $classes, $this->pr_get_text($text, $arguments)); + } - return TRUE; + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_CITE, $id, $classes, $text); } /** - * Build the breadcrumb. + * Creates the standard code. * - * @return c_base_return_status - * TRUE on success, FALSE otherwise. - * FALSE with error bit set is returned on error. + * @param int|string $text + * The text or the text code to use. + * @param array $arguments + * (optional) An array of arguments to convert into text. + * @param string|null $id + * (optional) An ID attribute to assign. + * If NULL, then this is not assigned. + * @param string|null $extra_class + * (optional) An additional css class to append to the wrapping block. + * May be an array of classes to append. + * If NULL, then this is not assigned. + * + * @return c_base_markup_tag + * The generated markup tag. */ - protected function pr_build_breadcrumbs() { - if (!is_object($this->path_tree)) { - return new c_base_return_false(); - } - - $handler_settings = $this->path_tree->get_item_reset(); - if ($handler_settings instanceof c_base_return_false) { - unset($handler_settings); - return new c_base_return_false(); + protected function pr_create_tag_code($text, $arguments = [], $id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_CODE, static::CSS_AS_CODE]; + if (is_string($extra_class)) { + $classes[] = $extra_class; } - - $this->breadcrumbs = new c_base_menu_item(); - - // render the breadcrumbs for all appropriate paths as the default behavior. - // this does not include the last path tree item because that item should be this class. - $count = 0; - $total = $this->path_tree->get_items_count() - 1; - for (; $count < $total; $count++) { - if ($handler_settings instanceof c_base_return_false) { - $handler_settings = $this->path_tree->get_item_next(); - continue; - } - - $handler_settings = $handler_settings->get_value(); - - if (!isset($handler_settings['include_name']) || !is_string($handler_settings['include_name'])) { - $handler_settings = $this->path_tree->get_item_next(); - continue; - } - - if (!isset($handler_settings['include_directory']) || !is_string($handler_settings['include_directory'])) { - $handler_settings = $this->path_tree->get_item_next(); - continue; - } - - if (!isset($handler_settings['handler']) || !is_string($handler_settings['handler'])) { - $handler_settings = $this->path_tree->get_item_next(); - continue; - } - - require_once($handler_settings['include_directory'] . $handler_settings['include_name'] . static::SCRIPT_EXTENSION); - - - $handler = NULL; - if (is_string($this->language_alias)) { - @include_once($handler_settings['include_directory'] . $this->language_alias . '/' . $handler_settings['include_name'] . static::SCRIPT_EXTENSION); - - $handler_class = $handler_settings['handler'] . '_' . $this->language_alias; - if (class_exists($handler_class)) { - $handler = new $handler_class(); - } - unset($handler_class); - } - - if (is_null($handler)) { - if (class_exists($handler_settings['handler'])) { - $handler = new $handler_settings['handler'](); - } - else { - unset($handler); - $handler_settings = $this->path_tree->get_item_next(); - continue; - } - } - - $handler->set_parameters($this->http, $this->database, $this->session, $this->settings); - $breadcrumbs = $handler->get_breadcrumbs(); - if ($breadcrumbs instanceof c_base_menu_item) { - $breadcrumbs = $breadcrumbs->get_items()->get_value_exact(); - foreach ($breadcrumbs as $breadcrumb) { - $this->breadcrumbs->set_item($breadcrumb); - } - unset($breadcrumb); + elseif (is_array($extra_class)) { + foreach ($extra_class as $class) { + $classes[] = $class; } - unset($breadcrumbs); - unset($handler); - unset($handler_settings); + unset($class); + } - $handler_settings = $this->path_tree->get_item_next(); + if (is_int($text)) { + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_CODE, $id, $classes, $this->pr_get_text($text, $arguments)); } - unset($count); - unset($total); - return new c_base_return_true(); + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_CODE, $id, $classes, $text); } /** - * Creates the standard section. + * Creates the standard delete. * - * @param array|null $headers - * An array of headers, whose keys are the header number and values are the header names. - * If NULL, then the headers are not assigned. + * @param int|string $text + * The text or the text code to use. * @param array $arguments * (optional) An array of arguments to convert into text. * @param string|null $id * (optional) An ID attribute to assign. * If NULL, then this is not assigned. - * @param string|array||null $extra_class + * @param string|null $extra_class * (optional) An additional css class to append to the wrapping block. * May be an array of classes to append. * If NULL, then this is not assigned. @@ -359,8 +918,8 @@ class c_standard_path extends c_base_path { * @return c_base_markup_tag * The generated markup tag. */ - protected function pr_create_tag_section($headers = NULL, $arguments = [], $id = NULL, $extra_class = NULL) { - $classes = [$this->settings['base_css'] . static::CSS_AS_SECTION, static::CSS_AS_SECTION]; + protected function pr_create_tag_delete($text, $arguments = [], $id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_DELETE, static::CSS_AS_DELETE]; if (is_string($extra_class)) { $classes[] = $extra_class; } @@ -371,21 +930,20 @@ class c_standard_path extends c_base_path { unset($class); } - $tag = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_SECTION, $id, $classes); - unset($classes); - - if (is_array($headers)) { - $header = $this->pr_create_tag_headers($headers, $arguments, NULL, static::CSS_AS_SECTION_HEADERS); - $tag->set_tag($header); - unset($header); + if (is_int($text)) { + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DEL, $id, $classes, $this->pr_get_text($text, $arguments)); } - return $tag; + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DEL, $id, $classes, $text); } /** - * Creates the standard wrapper. + * Creates the standard insert. * + * @param int|string $text + * The text or the text code to use. + * @param array $arguments + * (optional) An array of arguments to convert into text. * @param string|null $id * (optional) An ID attribute to assign. * If NULL, then this is not assigned. @@ -397,8 +955,8 @@ class c_standard_path extends c_base_path { * @return c_base_markup_tag * The generated markup tag. */ - protected function pr_create_tag_wrapper($id = NULL, $extra_class = NULL) { - $classes = [$this->settings['base_css'] . static::CSS_AS_WRAPPER, static::CSS_AS_WRAPPER]; + protected function pr_create_tag_insert($text, $arguments = [], $id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_INSERT, static::CSS_AS_INSERT]; if (is_string($extra_class)) { $classes[] = $extra_class; } @@ -409,12 +967,20 @@ class c_standard_path extends c_base_path { unset($class); } - return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, $id, $classes); + if (is_int($text)) { + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_INS, $id, $classes, $this->pr_get_text($text, $arguments)); + } + + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_INS, $id, $classes, $text); } /** - * Creates the standard break tag. + * Creates the standard mark. * + * @param int|string $text + * The text or the text code to use. + * @param array $arguments + * (optional) An array of arguments to convert into text. * @param string|null $id * (optional) An ID attribute to assign. * If NULL, then this is not assigned. @@ -426,8 +992,8 @@ class c_standard_path extends c_base_path { * @return c_base_markup_tag * The generated markup tag. */ - protected function pr_create_tag_break($id = NULL, $extra_class = NULL) { - $classes = [$this->settings['base_css'] . static::CSS_AS_BREAK, static::CSS_AS_BREAK]; + protected function pr_create_tag_mark($text, $arguments = [], $id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_MARK, static::CSS_AS_MARK]; if (is_string($extra_class)) { $classes[] = $extra_class; } @@ -438,11 +1004,15 @@ class c_standard_path extends c_base_path { unset($class); } - return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_BREAK, $id, $classes); + if (is_int($text)) { + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_MARK, $id, $classes, $this->pr_get_text($text, $arguments)); + } + + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_MARK, $id, $classes, $text); } /** - * Creates the standard text. + * Creates the standard preformatted. * * @param int|string $text * The text or the text code to use. @@ -459,8 +1029,8 @@ class c_standard_path extends c_base_path { * @return c_base_markup_tag * The generated markup tag. */ - protected function pr_create_tag_text($text, $arguments = [], $id = NULL, $extra_class = NULL) { - $classes = [$this->settings['base_css'] . static::CSS_AS_TEXT, static::CSS_AS_TEXT]; + protected function pr_create_tag_preformatted($text, $arguments = [], $id = NULL, $extra_class = NULL) { + $classes = [$this->settings['base_css'] . static::CSS_AS_PREFORMATTED, static::CSS_AS_PREFORMATTED]; if (is_string($extra_class)) { $classes[] = $extra_class; } @@ -472,10 +1042,10 @@ class c_standard_path extends c_base_path { } if (is_int($text)) { - return c_theme_html::s_create_tag($this->text_type, $id, $classes, $this->pr_get_text($text, $arguments)); + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_PREFORMATTED, $id, $classes, $this->pr_get_text($text, $arguments)); } - return c_theme_html::s_create_tag($this->text_type, $id, $classes, $text); + return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_PREFORMATTED, $id, $classes, $text); } /** @@ -2087,5 +2657,22 @@ class c_standard_path extends c_base_path { return TRUE; } + + /** + * Provides a standard access check handler function. + * + * This is generally intended to be called by do_execute(). + * + * @param c_base_path_executed &$executed + * The execution array for making changes to. + * Any detected errors are assigned to this. + * This often may have the output settings altered by this class implementation. + * + * @return bool + * FALSE on access granted, TRUE on access denied. + */ + protected function pr_process_access_denied(&$executed) { + return FALSE; + } } diff --git a/common/standard/classes/standard_path_user.php b/common/standard/classes/standard_path_user.php index 0823cd6..8beff41 100644 --- a/common/standard/classes/standard_path_user.php +++ b/common/standard/classes/standard_path_user.php @@ -50,6 +50,33 @@ class c_standard_path_user extends c_standard_path { } /** + * Implements do_execute(). + */ + public function do_execute(&$http, &$database, &$session, $settings = []) { + // the parent function performs validation on the parameters. + $executed = parent::do_execute($http, $database, $session, $settings); + if (c_base_return::s_has_error($executed)) { + return $executed; + } + + if (!$this->pr_process_arguments($executed)) { + return $executed; + } + + if ($this->pr_process_output_format_denied($executed)) { + return $executed; + } + + if ($this->pr_process_access_denied($executed)) { + return $executed; + } + + $this->pr_do_execute_build_content($executed); + + return $executed; + } + + /** * Implements pr_get_text_title(). */ protected function pr_get_text_title($arguments = []) { @@ -195,4 +222,161 @@ class c_standard_path_user extends c_standard_path { return TRUE; } + + /** + * Provides a standard access check handler function for manager or administer access only. + * + * This is generally intended to be called by do_execute(). + * + * @param c_base_path_executed &$executed + * The execution array for making changes to. + * Any detected errors are assigned to this. + * This often may have the output settings altered by this class implementation. + * + * @return bool + * FALSE on access granted, TRUE on access denied. + */ + protected function pr_process_access_denied_only_power(&$executed) { + $roles_current = $this->session->get_user_current()->get_roles()->get_value_exact(); + if (isset($roles_current[c_base_roles::MANAGER]) || isset($roles_current[c_base_roles::ADMINISTER])) { + unset($roles_current); + return FALSE; + } + unset($roles_current); + + $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); + $executed->set_error($error); + unset($error); + + return TRUE; + } + + /** + * Provides a standard access check handler function for administer access only. + * + * This is generally intended to be called by do_execute(). + * + * @param c_base_path_executed &$executed + * The execution array for making changes to. + * Any detected errors are assigned to this. + * This often may have the output settings altered by this class implementation. + * + * @return bool + * FALSE on access granted, TRUE on access denied. + */ + protected function pr_process_access_denied_only_administer(&$executed) { + $roles_current = $this->session->get_user_current()->get_roles()->get_value_exact(); + if (isset($roles_current[c_base_roles::ADMINISTER])) { + unset($roles_current); + return FALSE; + } + unset($roles_current); + + $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); + $executed->set_error($error); + unset($error); + + return TRUE; + } + + /** + * Provides a standard access check handler function for manager access only. + * + * This is generally intended to be called by do_execute(). + * + * @param c_base_path_executed &$executed + * The execution array for making changes to. + * Any detected errors are assigned to this. + * This often may have the output settings altered by this class implementation. + * + * @return bool + * FALSE on access granted, TRUE on access denied. + */ + protected function pr_process_access_denied_only_manager(&$executed) { + $roles_current = $this->session->get_user_current()->get_roles()->get_value_exact(); + if (isset($roles_current[c_base_roles::MANAGER])) { + unset($roles_current); + return FALSE; + } + unset($roles_current); + + $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); + $executed->set_error($error); + unset($error); + + return TRUE; + } + + /** + * Provides a standard access check handler function, specific for output format. + * + * This is generally intended to be called by do_execute(). + * + * @param c_base_path_executed &$executed + * The execution array for making changes to. + * Any detected errors are assigned to this. + * This often may have the output settings altered by this class implementation. + * + * @return bool + * FALSE on access granted, TRUE on access denied. + */ + protected function pr_process_output_format_denied(&$executed) { + + // only support HTML output unless otherwise needed. + // @todo: eventually all HTML output will be expected to support at least print and PDF formats (with print being the string 'print'). + if ($this->output_format !== c_base_mime::TYPE_TEXT_HTML) { + $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); + $executed->set_error($error); + unset($error); + + return TRUE; + } + + return FALSE; + } + + /** + * Execution of the view path. + * + * @param c_base_path_executed &$executed + * The execution results to be returned. + * + * @return null|array + * NULL is returned if no errors are found. + * An array of errors are returned if found. + */ + protected function pr_do_execute_build_content(&$executed) { + return NULL; + } + + /** + * Implementation of pr_process_access_denied(). + */ + protected function pr_process_access_denied(&$executed) { + $user = $this->session->get_user_current(); + $roles_current = $user->get_roles()->get_value_exact(); + + $deny_access = TRUE; + if ($this->path_user_id === $user->get_id()->get_value_exact()) { + $deny_access = FALSE; + } + elseif (isset($roles_current[c_base_roles::MANAGER]) || isset($roles_current[c_base_roles::ADMINISTER])) { + $deny_access = FALSE; + } + unset($user); + unset($roles_current); + + if ($deny_access) { + unset($deny_access); + + $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); + $executed->set_error($error); + unset($error); + + return TRUE; + } + unset($deny_access); + + return FALSE; + } } diff --git a/common/standard/paths/u/ja/user_check.php b/common/standard/paths/u/ja/user_check.php index d40b7b3..d601847 100644 --- a/common/standard/paths/u/ja/user_check.php +++ b/common/standard/paths/u/ja/user_check.php @@ -24,6 +24,9 @@ class c_standard_path_user_check_ja extends c_standard_path_user_check { $string = '照合'; } break; + case 1: + $string = 'チェックが行われました。'; + break; default: unset($string); return parent::pr_get_text($code, $arguments); diff --git a/common/standard/paths/u/ja/user_login.php b/common/standard/paths/u/ja/user_login.php index f1e2ae7..c024c80 100644 --- a/common/standard/paths/u/ja/user_login.php +++ b/common/standard/paths/u/ja/user_login.php @@ -55,6 +55,15 @@ class c_standard_path_user_login_ja extends c_standard_path_user_login { case 12: $string = 'ログイン'; break; + case 13: + $string = 'セッションの有効期限は'; + break; + case 14: + $string = 'アクティビティがない場合'; + break; + case 15: + $string = 'アクティビティに関係なく'; + break; } if (!empty($arguments)) { diff --git a/common/standard/paths/u/user_check.php b/common/standard/paths/u/user_check.php index 3abd620..1cc02ec 100644 --- a/common/standard/paths/u/user_check.php +++ b/common/standard/paths/u/user_check.php @@ -30,42 +30,6 @@ class c_standard_path_user_check extends c_standard_path_user { protected const HANDLER_MENU_CONTENT = '\n_koopa\c_standard_menu_content_user_view'; /** - * Implements do_execute(). - */ - public function do_execute(&$http, &$database, &$session, $settings = []) { - // the parent function performs validation on the parameters. - $executed = parent::do_execute($http, $database, $session, $settings); - if (c_base_return::s_has_error($executed)) { - return $executed; - } - - if (!$this->pr_process_arguments($executed)) { - return $executed; - } - - // only support HTML output unless otherwise needed. - // @todo: eventually all HTML output will be expected to support at least print and PDF formats (with print being the string 'print'). - if ($this->output_format !== c_base_mime::TYPE_TEXT_HTML) { - $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); - $executed->set_error($error); - unset($error); - - return $executed; - } - - // @todo: this function needs to check to see if the user has administer (or manager?) roles (c_base_roles::MANAGER, c_base_roles::ADMINISTER) and if they do, set administrative to TRUE when calling do_load(). - #$user = $this->session->get_user_current(); - #$roles_current = $user->get_roles()->get_value_exact(); - - // @todo: this function is currently disabled, so return a path not found. - $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); - $executed->set_error($error); - unset($error); - - return $executed; - } - - /** * Implementation of pr_build_breadcrumbs(). */ protected function pr_build_breadcrumbs() { @@ -121,6 +85,9 @@ class c_standard_path_user_check extends c_standard_path_user { $string = 'Check User'; } break; + case 1: + $string = 'Check has been performed.'; + break; } if (!empty($arguments)) { @@ -129,4 +96,49 @@ class c_standard_path_user_check extends c_standard_path_user { return $string; } + + /** + * Execution of the view path. + * + * @param c_base_path_executed &$executed + * The execution results to be returned. + * + * @return null|array + * NULL is returned if no errors are found. + * An array of errors are returned if found. + */ + protected function pr_do_execute_build_content(&$executed) { + $errors = NULL; + + + // initialize the content as HTML. + $this->pr_create_html(TRUE, $this->arguments); + + + // main content. + $content = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, static::CSS_AS_FIELD_SET_CONTENT, [static::CSS_AS_FIELD_SET_CONTENT]); + + $tag = c_theme_html::s_create_tag_text(c_base_markup_tag::TYPE_SPAN, 'Not Yet Implemented.'); + $content->set_tag($tag); + unset($tag); + + + // build main section. + $wrapper = $this->pr_create_tag_section(array(1 => 0)); + $wrapper->set_tag($content); + unset($content); + + $this->html->set_tag($wrapper); + unset($content); + + + // remaining additions + $this->pr_add_menus(); + + + $executed->set_output($this->html); + unset($this->html); + + return $errors; + } } diff --git a/common/standard/paths/u/user_create.php b/common/standard/paths/u/user_create.php index 910b7cf..72dd4f0 100644 --- a/common/standard/paths/u/user_create.php +++ b/common/standard/paths/u/user_create.php @@ -26,49 +26,6 @@ class c_standard_path_user_create extends c_standard_path_user { public const PATH_SELF = 'u/create'; /** - * Implements do_execute(). - */ - public function do_execute(&$http, &$database, &$session, $settings = []) { - // the parent function performs validation on the parameters. - $executed = parent::do_execute($http, $database, $session, $settings); - if (c_base_return::s_has_error($executed)) { - return $executed; - } - - if (!$this->pr_process_arguments($executed)) { - return $executed; - } - - // only support HTML output unless otherwise needed. - // @todo: eventually all HTML output will be expected to support at least print and PDF formats (with print being the string 'print'). - if ($this->output_format !== c_base_mime::TYPE_TEXT_HTML) { - $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); - $executed->set_error($error); - unset($error); - - return $executed; - } - - // @todo: this function needs to check to see if the user has administer (or manager?) roles (c_base_roles::MANAGER, c_base_roles::ADMINISTER) and if they do, set administrative to TRUE when calling do_load(). - #$user = $this->session->get_user_current(); - #$roles_current = $user->get_roles()->get_value_exact(); - - $wrapper = $this->pr_create_tag_section(array(1 => 0)); - - // initialize the content as HTML. - $this->pr_create_html(); - $this->html->set_tag($wrapper); - unset($wrapper); - - $this->pr_add_menus(); - - $executed->set_output($this->html); - unset($this->html); - - return $executed; - } - - /** * Implementation of pr_build_breadcrumbs(). */ protected function pr_build_breadcrumbs() { @@ -132,4 +89,49 @@ class c_standard_path_user_create extends c_standard_path_user { return $string; } + + /** + * Execution of the view path. + * + * @param c_base_path_executed &$executed + * The execution results to be returned. + * + * @return null|array + * NULL is returned if no errors are found. + * An array of errors are returned if found. + */ + protected function pr_do_execute_build_content(&$executed) { + $errors = NULL; + + + // initialize the content as HTML. + $this->pr_create_html(TRUE, $this->arguments); + + + // main content. + $content = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, static::CSS_AS_FIELD_SET_CONTENT, [static::CSS_AS_FIELD_SET_CONTENT]); + + $tag = c_theme_html::s_create_tag_text(c_base_markup_tag::TYPE_SPAN, 'Not Yet Implemented.'); + $content->set_tag($tag); + unset($tag); + + + // build main section. + $wrapper = $this->pr_create_tag_section(array(1 => 0)); + $wrapper->set_tag($content); + unset($content); + + $this->html->set_tag($wrapper); + unset($content); + + + // remaining additions + $this->pr_add_menus(); + + + $executed->set_output($this->html); + unset($this->html); + + return $errors; + } } diff --git a/common/standard/paths/u/user_dashboard.php b/common/standard/paths/u/user_dashboard.php index ccb4ab3..67141e9 100644 --- a/common/standard/paths/u/user_dashboard.php +++ b/common/standard/paths/u/user_dashboard.php @@ -23,28 +23,6 @@ class c_standard_path_user_dashboard extends c_standard_path_user { public const PATH_SELF = 'u/dashboard'; /** - * Implementation of pr_build_breadcrumbs(). - */ - protected function pr_build_breadcrumbs() { - $result = parent::pr_build_breadcrumbs(); - if ($result instanceof c_base_return_false) { - unset($result); - return new c_base_return_false(); - } - unset($result); - - if (!($this->breadcrumbs instanceof c_base_menu_item)) { - $this->breadcrumbs = new c_base_menu_item(); - } - - $item = $this->pr_create_breadcrumbs_item($this->pr_get_text(0), self::PATH_SELF); - $this->breadcrumbs->set_item($item); - unset($item); - - return new c_base_return_true(); - } - - /** * Implements do_execute(). */ public function do_execute(&$http, &$database, &$session, $settings = []) { @@ -58,19 +36,13 @@ class c_standard_path_user_dashboard extends c_standard_path_user { return $executed; } - // only support HTML output unless otherwise needed. - // @todo: eventually all HTML output will be expected to support at least print and PDF formats (with print being the string 'print'). - if ($this->output_format !== c_base_mime::TYPE_TEXT_HTML) { - $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); - $executed->set_error($error); - unset($error); - + if ($this->pr_process_output_format_denied($executed)) { return $executed; } - // @todo: this function needs to check to see if the user has administer (or manager?) roles (c_base_roles::MANAGER, c_base_roles::ADMINISTER) and if they do, set administrative to TRUE when calling do_load(). - #$user = $this->session->get_user_current(); - #$roles_current = $user->get_roles()->get_value_exact(); + if ($this->pr_process_access_denied($executed)) { + return $executed; + } $wrapper = $this->pr_create_tag_section(array(1 => 0)); $wrapper->set_tag($this->pr_create_tag_text_block(1)); @@ -156,6 +128,28 @@ class c_standard_path_user_dashboard extends c_standard_path_user { } /** + * Implementation of pr_build_breadcrumbs(). + */ + protected function pr_build_breadcrumbs() { + $result = parent::pr_build_breadcrumbs(); + if ($result instanceof c_base_return_false) { + unset($result); + return new c_base_return_false(); + } + unset($result); + + if (!($this->breadcrumbs instanceof c_base_menu_item)) { + $this->breadcrumbs = new c_base_menu_item(); + } + + $item = $this->pr_create_breadcrumbs_item($this->pr_get_text(0), self::PATH_SELF); + $this->breadcrumbs->set_item($item); + unset($item); + + return new c_base_return_true(); + } + + /** * Implementation of pr_create_html_add_header_link_canonical(). */ protected function pr_create_html_add_header_link_canonical() { diff --git a/common/standard/paths/u/user_delete.php b/common/standard/paths/u/user_delete.php index 2f01afc..f195d9f 100644 --- a/common/standard/paths/u/user_delete.php +++ b/common/standard/paths/u/user_delete.php @@ -27,47 +27,6 @@ class c_standard_path_user_delete extends c_standard_path_user { protected const HANDLER_MENU_CONTENT = '\n_koopa\c_standard_menu_content_user_view'; /** - * Implements do_execute(). - */ - public function do_execute(&$http, &$database, &$session, $settings = []) { - // the parent function performs validation on the parameters. - $executed = parent::do_execute($http, $database, $session, $settings); - if (c_base_return::s_has_error($executed)) { - return $executed; - } - - if (!$this->pr_process_arguments($executed)) { - return $executed; - } - - // only support HTML output unless otherwise needed. - // @todo: eventually all HTML output will be expected to support at least print and PDF formats (with print being the string 'print'). - if ($this->output_format !== c_base_mime::TYPE_TEXT_HTML) { - $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); - $executed->set_error($error); - unset($error); - - return $executed; - } - - // @todo: this function needs to check to see if the user has administer (or manager?) roles (c_base_roles::MANAGER, c_base_roles::ADMINISTER) and if they do, set administrative to TRUE when calling do_load(). - #$user = $this->session->get_user_current(); - #$roles_current = $user->get_roles()->get_value_exact(); - - // initialize the content as HTML. - $this->pr_create_html(); - $this->html->set_tag($wrapper); - unset($wrapper); - - $this->pr_add_menus(); - - $executed->set_output($this->html); - unset($this->html); - - return $executed; - } - - /** * Implementation of pr_build_breadcrumbs(). */ protected function pr_build_breadcrumbs() { @@ -131,4 +90,49 @@ class c_standard_path_user_delete extends c_standard_path_user { return $string; } + + /** + * Execution of the view path. + * + * @param c_base_path_executed &$executed + * The execution results to be returned. + * + * @return null|array + * NULL is returned if no errors are found. + * An array of errors are returned if found. + */ + protected function pr_do_execute_build_content(&$executed) { + $errors = NULL; + + + // initialize the content as HTML. + $this->pr_create_html(TRUE, $this->arguments); + + + // main content. + $content = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, static::CSS_AS_FIELD_SET_CONTENT, [static::CSS_AS_FIELD_SET_CONTENT]); + + $tag = c_theme_html::s_create_tag_text(c_base_markup_tag::TYPE_SPAN, 'Not Yet Implemented.'); + $content->set_tag($tag); + unset($tag); + + + // build main section. + $wrapper = $this->pr_create_tag_section(array(1 => 0)); + $wrapper->set_tag($content); + unset($content); + + $this->html->set_tag($wrapper); + unset($content); + + + // remaining additions + $this->pr_add_menus(); + + + $executed->set_output($this->html); + unset($this->html); + + return $errors; + } } diff --git a/common/standard/paths/u/user_edit.php b/common/standard/paths/u/user_edit.php index f44acf4..059e689 100644 --- a/common/standard/paths/u/user_edit.php +++ b/common/standard/paths/u/user_edit.php @@ -62,49 +62,6 @@ class c_standard_path_user_edit extends c_standard_path_user { } /** - * Implements do_execute(). - */ - public function do_execute(&$http, &$database, &$session, $settings = []) { - // the parent function performs validation on the parameters. - $executed = parent::do_execute($http, $database, $session, $settings); - if (c_base_return::s_has_error($executed)) { - return $executed; - } - - if (!$this->pr_process_arguments($executed)) { - return $executed; - } - - // only support HTML output unless otherwise needed. - // @todo: eventually all HTML output will be expected to support at least print and PDF formats (with print being the string 'print'). - if ($this->output_format !== c_base_mime::TYPE_TEXT_HTML) { - $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); - $executed->set_error($error); - unset($error); - - return $executed; - } - - // @todo: this function needs to check to see if the user has administer (or manager?) roles (c_base_roles::MANAGER, c_base_roles::ADMINISTER) and if they do, set administrative to TRUE when calling do_load(). - #$user = $this->session->get_user_current(); - #$roles_current = $user->get_roles()->get_value_exact(); - - $wrapper = $this->pr_create_tag_section(array(1 => 0)); - - // initialize the content as HTML. - $this->pr_create_html(); - $this->html->set_tag($wrapper); - unset($wrapper); - - $this->pr_add_menus(); - - $executed->set_output($this->html); - unset($this->html); - - return $executed; - } - - /** * Implementation of pr_create_html_add_header_link_canonical(). */ protected function pr_create_html_add_header_link_canonical() { @@ -138,4 +95,49 @@ class c_standard_path_user_edit extends c_standard_path_user { return $string; } + + /** + * Execution of the view path. + * + * @param c_base_path_executed &$executed + * The execution results to be returned. + * + * @return null|array + * NULL is returned if no errors are found. + * An array of errors are returned if found. + */ + protected function pr_do_execute_build_content(&$executed) { + $errors = NULL; + + + // initialize the content as HTML. + $this->pr_create_html(TRUE, $this->arguments); + + + // main content. + $content = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, static::CSS_AS_FIELD_SET_CONTENT, [static::CSS_AS_FIELD_SET_CONTENT]); + + $tag = c_theme_html::s_create_tag_text(c_base_markup_tag::TYPE_SPAN, 'Not Yet Implemented.'); + $content->set_tag($tag); + unset($tag); + + + // build main section. + $wrapper = $this->pr_create_tag_section(array(1 => 0)); + $wrapper->set_tag($content); + unset($content); + + $this->html->set_tag($wrapper); + unset($content); + + + // remaining additions + $this->pr_add_menus(); + + + $executed->set_output($this->html); + unset($this->html); + + return $errors; + } } diff --git a/common/standard/paths/u/user_lock.php b/common/standard/paths/u/user_lock.php index a41ee53..0694701 100644 --- a/common/standard/paths/u/user_lock.php +++ b/common/standard/paths/u/user_lock.php @@ -27,42 +27,6 @@ class c_standard_path_user_lock extends c_standard_path_user { protected const HANDLER_MENU_CONTENT = '\n_koopa\c_standard_menu_content_user_view'; /** - * Implements do_execute(). - */ - public function do_execute(&$http, &$database, &$session, $settings = []) { - // the parent function performs validation on the parameters. - $executed = parent::do_execute($http, $database, $session, $settings); - if (c_base_return::s_has_error($executed)) { - return $executed; - } - - if (!$this->pr_process_arguments($executed)) { - return $executed; - } - - // only support HTML output unless otherwise needed. - // @todo: eventually all HTML output will be expected to support at least print and PDF formats (with print being the string 'print'). - if ($this->output_format !== c_base_mime::TYPE_TEXT_HTML) { - $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); - $executed->set_error($error); - unset($error); - - return $executed; - } - - // @todo: this function needs to check to see if the user has administer (or manager?) roles (c_base_roles::MANAGER, c_base_roles::ADMINISTER) and if they do, set administrative to TRUE when calling do_load(). - #$user = $this->session->get_user_current(); - #$roles_current = $user->get_roles()->get_value_exact(); - - // @todo: this function is currently disabled, so return a path not found. - $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); - $executed->set_error($error); - unset($error); - - return $executed; - } - - /** * Implementation of pr_build_breadcrumbs(). */ protected function pr_build_breadcrumbs() { @@ -126,4 +90,49 @@ class c_standard_path_user_lock extends c_standard_path_user { return $string; } + + /** + * Execution of the view path. + * + * @param c_base_path_executed &$executed + * The execution results to be returned. + * + * @return null|array + * NULL is returned if no errors are found. + * An array of errors are returned if found. + */ + protected function pr_do_execute_build_content(&$executed) { + $errors = NULL; + + + // initialize the content as HTML. + $this->pr_create_html(TRUE, $this->arguments); + + + // main content. + $content = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, static::CSS_AS_FIELD_SET_CONTENT, [static::CSS_AS_FIELD_SET_CONTENT]); + + $tag = c_theme_html::s_create_tag_text(c_base_markup_tag::TYPE_SPAN, 'Not Yet Implemented.'); + $content->set_tag($tag); + unset($tag); + + + // build main section. + $wrapper = $this->pr_create_tag_section(array(1 => 0)); + $wrapper->set_tag($content); + unset($content); + + $this->html->set_tag($wrapper); + unset($content); + + + // remaining additions + $this->pr_add_menus(); + + + $executed->set_output($this->html); + unset($this->html); + + return $errors; + } } diff --git a/common/standard/paths/u/user_login.php b/common/standard/paths/u/user_login.php index a0ac96f..3124ff9 100644 --- a/common/standard/paths/u/user_login.php +++ b/common/standard/paths/u/user_login.php @@ -28,6 +28,7 @@ require_once('common/theme/classes/theme_html.php'); */ class c_standard_path_user_login extends c_standard_path { public const SESSION_DATE_FORMAT = 'D, d-M-Y H:i:s T'; + public const EXPIRE_DATE_FORMAT = 'D, F j, Y, h:i:sa T'; public const PATH_SELF = 'u/login'; protected const USER_PUBLIC = 'u_standard_public'; @@ -71,7 +72,22 @@ class c_standard_path_user_login extends c_standard_path { $wrapper->set_tag($this->pr_create_tag_break()); - $wrapper->set_tag($this->pr_create_tag_text_block(9)); + $text_block = $this->pr_create_tag_text_block(NULL); + + $text_block->set_tag($this->pr_create_tag_text(13)); + $text_block->set_tag($this->pr_create_tag_italics(date(self::EXPIRE_DATE_FORMAT, $session->get_timeout_expire()->get_value_exact()))); + $text_block->set_tag($this->pr_create_tag_text(14)); + + $text_block->set_tag($this->pr_create_tag_break()); + + $text_block->set_tag($this->pr_create_tag_text(13)); + $text_block->set_tag($this->pr_create_tag_italics(date(self::EXPIRE_DATE_FORMAT, $session->get_timeout_max()->get_value_exact()))); + $text_block->set_tag($this->pr_create_tag_text(15)); + + $wrapper->set_tag($text_block); + unset($text_block); + + $wrapper->set_tag($this->pr_create_tag_break()); $block = $this->pr_create_tag_text_block(NULL); $block->set_tag($this->pr_create_tag_text(5)); @@ -1004,6 +1020,15 @@ class c_standard_path_user_login extends c_standard_path { case 12: $string = 'Login'; break; + case 13: + $string = 'Your session will expire on '; + break; + case 14: + $string = ' if no activity.'; + break; + case 15: + $string = ' regardless of activity.'; + break; } if (!empty($arguments)) { diff --git a/common/standard/paths/u/user_logout.php b/common/standard/paths/u/user_logout.php index a2d2a90..8f3f250 100644 --- a/common/standard/paths/u/user_logout.php +++ b/common/standard/paths/u/user_logout.php @@ -34,6 +34,10 @@ class c_standard_path_user_logout extends c_standard_path { return $executed; } + if ($this->pr_process_output_format_denied($executed)) { + return $executed; + } + $this->pr_do_logout($http, $database, $session, $settings); $wrapper = $this->pr_create_tag_section(array(1 => 0)); diff --git a/common/standard/paths/u/user_refresh.php b/common/standard/paths/u/user_refresh.php index 0dd0a7b..780df91 100644 --- a/common/standard/paths/u/user_refresh.php +++ b/common/standard/paths/u/user_refresh.php @@ -30,42 +30,6 @@ class c_standard_path_user_refresh extends c_standard_path_user { protected const HANDLER_MENU_CONTENT = '\n_koopa\c_standard_menu_content_user_view'; /** - * Implements do_execute(). - */ - public function do_execute(&$http, &$database, &$session, $settings = []) { - // the parent function performs validation on the parameters. - $executed = parent::do_execute($http, $database, $session, $settings); - if (c_base_return::s_has_error($executed)) { - return $executed; - } - - if (!$this->pr_process_arguments($executed)) { - return $executed; - } - - // only support HTML output unless otherwise needed. - // @todo: eventually all HTML output will be expected to support at least print and PDF formats (with print being the string 'print'). - if ($this->output_format !== c_base_mime::TYPE_TEXT_HTML) { - $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); - $executed->set_error($error); - unset($error); - - return $executed; - } - - // @todo: this function needs to check to see if the user has administer (or manager?) roles (c_base_roles::MANAGER, c_base_roles::ADMINISTER) and if they do, set administrative to TRUE when calling do_load(). - #$user = $this->session->get_user_current(); - #$roles_current = $user->get_roles()->get_value_exact(); - - // @todo: this function is currently disabled, so return a path not found. - $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); - $executed->set_error($error); - unset($error); - - return $executed; - } - - /** * Implementation of pr_build_breadcrumbs(). */ protected function pr_build_breadcrumbs() { @@ -129,4 +93,49 @@ class c_standard_path_user_refresh extends c_standard_path_user { return $string; } + + /** + * Execution of the view path. + * + * @param c_base_path_executed &$executed + * The execution results to be returned. + * + * @return null|array + * NULL is returned if no errors are found. + * An array of errors are returned if found. + */ + protected function pr_do_execute_build_content(&$executed) { + $errors = NULL; + + + // initialize the content as HTML. + $this->pr_create_html(TRUE, $this->arguments); + + + // main content. + $content = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, static::CSS_AS_FIELD_SET_CONTENT, [static::CSS_AS_FIELD_SET_CONTENT]); + + $tag = c_theme_html::s_create_tag_text(c_base_markup_tag::TYPE_SPAN, 'Not Yet Implemented.'); + $content->set_tag($tag); + unset($tag); + + + // build main section. + $wrapper = $this->pr_create_tag_section(array(1 => 0)); + $wrapper->set_tag($content); + unset($content); + + $this->html->set_tag($wrapper); + unset($content); + + + // remaining additions + $this->pr_add_menus(); + + + $executed->set_output($this->html); + unset($this->html); + + return $errors; + } } diff --git a/common/standard/paths/u/user_session.php b/common/standard/paths/u/user_session.php index 8235764..ac09099 100644 --- a/common/standard/paths/u/user_session.php +++ b/common/standard/paths/u/user_session.php @@ -27,42 +27,6 @@ class c_standard_path_user_session extends c_standard_path_user { public const PATH_SELF = 'u/session'; /** - * Implements do_execute(). - */ - public function do_execute(&$http, &$database, &$session, $settings = []) { - // the parent function performs validation on the parameters. - $executed = parent::do_execute($http, $database, $session, $settings); - if (c_base_return::s_has_error($executed)) { - return $executed; - } - - if (!$this->pr_process_arguments($executed)) { - return $executed; - } - - // only support HTML output unless otherwise needed. - // @todo: eventually all HTML output will be expected to support at least print and PDF formats (with print being the string 'print'). - if ($this->output_format !== c_base_mime::TYPE_TEXT_HTML) { - $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); - $executed->set_error($error); - unset($error); - - return $executed; - } - - // @todo: this function needs to check to see if the user has administer (or manager?) roles (c_base_roles::MANAGER, c_base_roles::ADMINISTER) and if they do, set administrative to TRUE when calling do_load(). - #$user = $this->session->get_user_current(); - #$roles_current = $user->get_roles()->get_value_exact(); - - // @todo: this function is currently disabled, so return a path not found. - $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); - $executed->set_error($error); - unset($error); - - return $executed; - } - - /** * Implements pr_get_text_title(). */ protected function pr_get_text_title($arguments = []) { @@ -75,4 +39,49 @@ class c_standard_path_user_session extends c_standard_path_user { protected function pr_get_text($code, $arguments = []) { return ''; } + + /** + * Execution of the view path. + * + * @param c_base_path_executed &$executed + * The execution results to be returned. + * + * @return null|array + * NULL is returned if no errors are found. + * An array of errors are returned if found. + */ + protected function pr_do_execute_build_content(&$executed) { + $errors = NULL; + + + // initialize the content as HTML. + $this->pr_create_html(TRUE, $this->arguments); + + + // main content. + $content = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, static::CSS_AS_FIELD_SET_CONTENT, [static::CSS_AS_FIELD_SET_CONTENT]); + + $tag = c_theme_html::s_create_tag_text(c_base_markup_tag::TYPE_SPAN, 'Not Yet Implemented.'); + $content->set_tag($tag); + unset($tag); + + + // build main section. + $wrapper = $this->pr_create_tag_section(array(1 => 0)); + $wrapper->set_tag($content); + unset($content); + + $this->html->set_tag($wrapper); + unset($content); + + + // remaining additions + $this->pr_add_menus(); + + + $executed->set_output($this->html); + unset($this->html); + + return $errors; + } } diff --git a/common/standard/paths/u/user_settings.php b/common/standard/paths/u/user_settings.php index 432ef3c..ca10d99 100644 --- a/common/standard/paths/u/user_settings.php +++ b/common/standard/paths/u/user_settings.php @@ -33,40 +33,6 @@ class c_standard_path_user_settings extends c_standard_path_user { protected const CLASS_USER_SETTINGS_HISTORY = 'user_settings-history'; /** - * Implements do_execute(). - */ - public function do_execute(&$http, &$database, &$session, $settings = []) { - // the parent function performs validation on the parameters. - $executed = parent::do_execute($http, $database, $session, $settings); - if (c_base_return::s_has_error($executed)) { - return $executed; - } - - if (!$this->pr_process_arguments($executed)) { - return $executed; - } - - // only support HTML output unless otherwise needed. - // @todo: eventually all HTML output will be expected to support at least print and PDF formats (with print being the string 'print'). - if ($this->output_format !== c_base_mime::TYPE_TEXT_HTML) { - $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); - $executed->set_error($error); - unset($error); - - return $executed; - } - - // @todo: this function needs to check to see if the user has administer (or manager?) roles (c_base_roles::MANAGER, c_base_roles::ADMINISTER) and if they do, set administrative to TRUE when calling do_load(). - #$user = $this->session->get_user_current(); - #$roles_current = $user->get_roles()->get_value_exact(); - - $this->pr_do_execute_settings($executed); - unset($user); - - return $executed; - } - - /** * Implementation of pr_build_breadcrumbs(). */ protected function pr_build_breadcrumbs() { @@ -330,7 +296,7 @@ class c_standard_path_user_settings extends c_standard_path_user { * NULL is returned if no errors are found. * An array of errors are returned if found. */ - protected function pr_do_execute_settings(&$executed) { + protected function pr_do_execute_build_content(&$executed) { $errors = NULL; $arguments = []; @@ -361,7 +327,7 @@ class c_standard_path_user_settings extends c_standard_path_user { // initialize the content as HTML. - $this->pr_create_html(TRUE, $arguments); + $this->pr_create_html(TRUE, $this->arguments); $this->html->set_tag($wrapper); unset($wrapper); unset($arguments); diff --git a/common/standard/paths/u/user_unlock.php b/common/standard/paths/u/user_unlock.php index 760df6e..1c2dbb2 100644 --- a/common/standard/paths/u/user_unlock.php +++ b/common/standard/paths/u/user_unlock.php @@ -27,42 +27,6 @@ class c_standard_path_user_unlock extends c_standard_path_user { protected const HANDLER_MENU_CONTENT = '\n_koopa\c_standard_menu_content_user_view'; /** - * Implements do_execute(). - */ - public function do_execute(&$http, &$database, &$session, $settings = []) { - // the parent function performs validation on the parameters. - $executed = parent::do_execute($http, $database, $session, $settings); - if (c_base_return::s_has_error($executed)) { - return $executed; - } - - if (!$this->pr_process_arguments($executed)) { - return $executed; - } - - // only support HTML output unless otherwise needed. - // @todo: eventually all HTML output will be expected to support at least print and PDF formats (with print being the string 'print'). - if ($this->output_format !== c_base_mime::TYPE_TEXT_HTML) { - $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); - $executed->set_error($error); - unset($error); - - return $executed; - } - - // @todo: this function needs to check to see if the user has administer (or manager?) roles (c_base_roles::MANAGER, c_base_roles::ADMINISTER) and if they do, set administrative to TRUE when calling do_load(). - #$user = $this->session->get_user_current(); - #$roles_current = $user->get_roles()->get_value_exact(); - - // @todo: this function is currently disabled, so return a path not found. - $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); - $executed->set_error($error); - unset($error); - - return $executed; - } - - /** * Implementation of pr_build_breadcrumbs(). */ protected function pr_build_breadcrumbs() { @@ -126,4 +90,49 @@ class c_standard_path_user_unlock extends c_standard_path_user { return $string; } + + /** + * Execution of the view path. + * + * @param c_base_path_executed &$executed + * The execution results to be returned. + * + * @return null|array + * NULL is returned if no errors are found. + * An array of errors are returned if found. + */ + protected function pr_do_execute_build_content(&$executed) { + $errors = NULL; + + + // initialize the content as HTML. + $this->pr_create_html(TRUE, $this->arguments); + + + // main content. + $content = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, static::CSS_AS_FIELD_SET_CONTENT, [static::CSS_AS_FIELD_SET_CONTENT]); + + $tag = c_theme_html::s_create_tag_text(c_base_markup_tag::TYPE_SPAN, 'Not Yet Implemented.'); + $content->set_tag($tag); + unset($tag); + + + // build main section. + $wrapper = $this->pr_create_tag_section(array(1 => 0)); + $wrapper->set_tag($content); + unset($content); + + $this->html->set_tag($wrapper); + unset($content); + + + // remaining additions + $this->pr_add_menus(); + + + $executed->set_output($this->html); + unset($this->html); + + return $errors; + } } diff --git a/common/standard/paths/u/user_view.php b/common/standard/paths/u/user_view.php index d7e7143..f336c60 100644 --- a/common/standard/paths/u/user_view.php +++ b/common/standard/paths/u/user_view.php @@ -33,35 +33,6 @@ class c_standard_path_user_view extends c_standard_path_user { protected const IMAGE_CROPPED_WIDTH = '192'; /** - * Implements do_execute(). - */ - public function do_execute(&$http, &$database, &$session, $settings = []) { - // the parent function performs validation on the parameters. - $executed = parent::do_execute($http, $database, $session, $settings); - if (c_base_return::s_has_error($executed)) { - return $executed; - } - - if (!$this->pr_process_arguments($executed)) { - return $executed; - } - - // only support HTML output unless otherwise needed. - // @todo: eventually all HTML output will be expected to support at least print and PDF formats (with print being the string 'print'). - if ($this->output_format !== c_base_mime::TYPE_TEXT_HTML) { - $error = c_base_error::s_log(NULL, ['arguments' => [':{path_name}' => static::PATH_SELF . '/' . implode('/', $this->arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::NOT_FOUND_PATH); - $executed->set_error($error); - unset($error); - - return $executed; - } - - $this->pr_do_execute_view($executed); - - return $executed; - } - - /** * Implementation of pr_build_breadcrumbs(). */ protected function pr_build_breadcrumbs() { @@ -128,7 +99,7 @@ class c_standard_path_user_view extends c_standard_path_user { * NULL is returned if no errors are found. * An array of errors are returned if found. */ - protected function pr_do_execute_view(&$executed) { + protected function pr_do_execute_build_content(&$executed) { $errors = NULL; $arguments = []; @@ -164,7 +135,7 @@ class c_standard_path_user_view extends c_standard_path_user { // initialize the content as HTML. - $this->pr_create_html(TRUE, $arguments); + $this->pr_create_html(TRUE, $this->arguments); if (is_int($this->path_user_id)) { $text_id_user = $this->pr_create_tag_text('[id: ' . $this->path_user_id . ']', [], NULL, static::CLASS_ID_USER); diff --git a/common/theme/classes/theme_html.php b/common/theme/classes/theme_html.php index bc716e6..76e4ffe 100644 --- a/common/theme/classes/theme_html.php +++ b/common/theme/classes/theme_html.php @@ -677,7 +677,7 @@ class c_theme_html extends c_base_return { $class_1 = 'format'; $class_2 = 'format-preformatted'; } - elseif ($type === c_base_markup_tag::TYPE_Q) { + elseif ($type === c_base_markup_tag::TYPE_QUOTE) { $class_1 = 'text'; $class_2 = 'text-quote'; } @@ -2224,7 +2224,7 @@ class c_theme_html extends c_base_return { $markup .= $child_markup; $markup .= ''; } - elseif ($type === c_base_markup_tag::TYPE_Q) { + elseif ($type === c_base_markup_tag::TYPE_QUOTE) { $markup .= 'p_render_markup_attributes_global($tag) . $this->p_render_markup_attributes_q($tag) . $this->p_render_markup_attributes_event_handler($tag) . '>'; $markup .= $this->p_html_entities($tag->get_text()->get_value_exact()); $markup .= $child_markup; -- 1.8.3.1