]> Kevux Git Server - koopa/commitdiff
Progress: add table markup, populate user history information, fix time-related issue...
authorKevin Day <thekevinday@gmail.com>
Wed, 26 Jul 2017 02:17:47 +0000 (21:17 -0500)
committerKevin Day <thekevinday@gmail.com>
Wed, 26 Jul 2017 02:25:07 +0000 (21:25 -0500)
Add basic support for generating table markup.
- This might be extra unnecessary code, but then again it allows for the functions to be extended so that <table> could potentially be replaced with <div>.
- Some of the markup tags are being renamed to improve readability.

Build a basic history information using the table markup.
- This is initially created as an example/concept and I intend to come back and finish it in the future.

Functions like s_get_date() should render localtime from a UTC timestamp, instead of UTC time from a UTC timestamp.

common/base/classes/base_database.php
common/base/classes/base_defaults_global.php
common/base/classes/base_markup.php
common/standard/classes/standard_path.php
common/standard/paths/u/user_view.php
common/theme/classes/theme_html.php
program/reservation/reservation_defaults_global.php

index dce9604adc994d51b5c72c6e31aabc275cdbce3f..45a65d53cb8cd48e8442d2f80485f9fbf3745d04 100644 (file)
@@ -579,7 +579,7 @@ class c_base_database_connection_string extends c_base_return_string {
  * @require class c_base_session
  */
 class c_base_database extends c_base_return {
-  const STANDARD_TIMESTAMP_FORMAT = 'Y-m-d h:i:s.uP';
+  const STANDARD_TIMESTAMP_FORMAT = 'Y-m-d H:i:s.uP';
 
   private $session;
   private $persistent;
index adb6271e349f5b195588b8c024180a2daf0b9afe..54b75ef3cbf8375cd1d7f046c84e4b82d98d7e07 100644 (file)
@@ -195,6 +195,7 @@ class c_base_defaults_global {
 
     if (!is_null(self::$s_timezone)) {
       date_default_timezone_set(self::$s_timezone);
+      $date->setTimeZone(new DateTimeZone(self::$s_timezone));
     }
 
     $formatted = $date->format($string);
index bf2c3abec691cf1e8de35689a69666a925cfaacd..4470eea46889494a4d7af479d850a9a2eb0f8c82 100644 (file)
@@ -395,145 +395,146 @@ class c_base_markup_tag extends c_base_rfc_string {
   const TYPE_BREAK                      = 19;
   const TYPE_BUTTON                     = 20;
   const TYPE_CANVAS                     = 21;
-  const TYPE_CHECKBOX                   = 22;
-  const TYPE_CIRCLE                     = 23;
-  const TYPE_CITE                       = 24;
-  const TYPE_CLIP_PATH                  = 25;
-  const TYPE_CODE                       = 26;
-  const TYPE_COL                        = 27;
-  const TYPE_COL_GROUP                  = 28;
-  const TYPE_COLOR                      = 29;
-  const TYPE_COLOR_PROFILE              = 30;
-  const TYPE_CURSOR                     = 31;
-  const TYPE_DATA                       = 32;
-  const TYPE_DATA_LIST                  = 33;
-  const TYPE_DATE                       = 34;
-  const TYPE_DATE_TIME_LOCAL            = 35;
-  const TYPE_DEFS                       = 36;
-  const TYPE_DEL                        = 37;
-  const TYPE_DESCRIPTION                = 38;
-  const TYPE_DETAILS                    = 39;
-  const TYPE_DFN                        = 40;
-  const TYPE_DIALOG                     = 41;
-  const TYPE_DIVIDER                    = 42;
-  const TYPE_DEFINITION_LIST            = 43;
-  const TYPE_ELLIPSE                    = 44;
-  const TYPE_EM                         = 45;
-  const TYPE_EMAIL                      = 46;
-  const TYPE_EMBED                      = 47;
-  const TYPE_FE_BLEND                   = 48;
-  const TYPE_FIELD_SET                  = 49;
-  const TYPE_FIGURE                     = 50;
-  const TYPE_FIGURE_CAPTION             = 51;
-  const TYPE_FILE                       = 52;
-  const TYPE_FOOTER                     = 53;
-  const TYPE_FORM                       = 54;
-  const TYPE_GROUP                      = 55;
-  const TYPE_H1                         = 56;
-  const TYPE_H2                         = 57;
-  const TYPE_H3                         = 58;
-  const TYPE_H4                         = 59;
-  const TYPE_H5                         = 60;
-  const TYPE_H6                         = 61;
-  const TYPE_HX                         = 62;
-  const TYPE_HEADER                     = 63;
-  const TYPE_HIDDEN                     = 64;
-  const TYPE_HORIZONTAL_RULER           = 65;
-  const TYPE_ITALICS                    = 66;
-  const TYPE_INLINE_FRAME               = 67;
-  const TYPE_IMAGE                      = 68;
-  const TYPE_IMAGE_SVG                  = 69;
-  const TYPE_INPUT                      = 70;
-  const TYPE_INS                        = 71;
-  const TYPE_KEYBOARD                   = 72;
-  const TYPE_KEY_GEN                    = 73;
-  const TYPE_LABEL                      = 74;
-  const TYPE_LEGEND                     = 75;
-  const TYPE_LIST_ITEM                  = 76;
-  const TYPE_LINE                       = 77;
-  const TYPE_LINEAR_GRADIENT            = 78;
-  const TYPE_LINK                       = 79;
-  const TYPE_MAIN                       = 80;
-  const TYPE_MAP                        = 81;
-  const TYPE_MARK                       = 82;
-  const TYPE_MARKER                     = 83;
-  const TYPE_MASK                       = 84;
-  const TYPE_MENU                       = 85;
-  const TYPE_MENU_ITEM                  = 86;
-  const TYPE_MATH                       = 87;
-  const TYPE_META                       = 88;
-  const TYPE_METER                      = 89;
-  const TYPE_MONTH                      = 90;
-  const TYPE_NAVIGATION                 = 91;
-  const TYPE_NO_SCRIPT                  = 92;
-  const TYPE_NUMBER                     = 93;
-  const TYPE_OBJECT                     = 94;
-  const TYPE_ORDERED_LIST               = 95;
-  const TYPE_OPTIONS_GROUP              = 96;
-  const TYPE_OPTION                     = 97;
-  const TYPE_OUTPUT                     = 98;
-  const TYPE_PARAGRAPH                  = 99;
-  const TYPE_PARAM                      = 100;
-  const TYPE_PASSWORD                   = 101;
-  const TYPE_PATH                       = 102;
-  const TYPE_PATTERN                    = 103;
-  const TYPE_PICTURE                    = 104;
-  const TYPE_POLYGON                    = 105;
-  const TYPE_POLYLINE                   = 106;
-  const TYPE_PREFORMATTED               = 107;
-  const TYPE_PROGRESS                   = 108;
-  const TYPE_Q                          = 109;
-  const TYPE_RADIAL_GRADIENT            = 110;
-  const TYPE_RADIO                      = 111;
-  const TYPE_RANGE                      = 112;
-  const TYPE_RECTANGLE                  = 113;
-  const TYPE_RESET                      = 114;
-  const TYPE_RUBY                       = 115;
-  const TYPE_RUBY_PARENTHESIS           = 116;
-  const TYPE_RUBY_PRONUNCIATION         = 117;
-  const TYPE_STRIKE_THROUGH             = 118;
-  const TYPE_SAMPLE                     = 119;
-  const TYPE_SCRIPT                     = 120;
-  const TYPE_SEARCH                     = 121;
-  const TYPE_SECTION                    = 122;
-  const TYPE_SELECT                     = 123;
-  const TYPE_SMALL                      = 124;
-  const TYPE_SOURCE                     = 125;
-  const TYPE_SPAN                       = 126;
-  const TYPE_STOP                       = 127;
-  const TYPE_STRONG                     = 128;
-  const TYPE_STYLE                      = 129;
-  const TYPE_SUB_SCRIPT                 = 130;
-  const TYPE_SUBMIT                     = 131;
-  const TYPE_SUPER_SCRIPT               = 132;
-  const TYPE_SVG                        = 133;
-  const TYPE_TABLE                      = 134;
-  const TYPE_TABLE_BODY                 = 135;
-  const TYPE_TABLE_CELL                 = 136;
-  const TYPE_TABLE_FOOTER               = 137;
-  const TYPE_TABLE_HEADER               = 138;
-  const TYPE_TABLE_HEADER_CELL          = 139;
-  const TYPE_TABLE_ROW                  = 140;
-  const TYPE_TELEPHONE                  = 141;
-  const TYPE_TEMPLATE                   = 142;
-  const TYPE_TERM_DESCRIPTION           = 143;
-  const TYPE_TERM_NAME                  = 144;
-  const TYPE_TEXT                       = 145;
-  const TYPE_TEXT_AREA                  = 146;
-  const TYPE_TEXT_REFERENCE             = 147;
-  const TYPE_TEXT_SPAN                  = 148;
-  const TYPE_TEXT_SVG                   = 149;
-  const TYPE_TIME                       = 150;
-  const TYPE_TITLE                      = 151;
-  const TYPE_TRACK                      = 152;
-  const TYPE_UNDERLINE                  = 153;
-  const TYPE_UNORDERED_LIST             = 154;
-  const TYPE_URL                        = 155;
-  const TYPE_USE                        = 156;
-  const TYPE_VARIABLE                   = 157;
-  const TYPE_VIDEO                      = 158;
-  const TYPE_WEEK                       = 159;
-  const TYPE_WIDE_BREAK                 = 160;
+  const TYPE_CAPTION                    = 22;
+  const TYPE_CHECKBOX                   = 23;
+  const TYPE_CIRCLE                     = 24;
+  const TYPE_CITE                       = 25;
+  const TYPE_CLIP_PATH                  = 26;
+  const TYPE_CODE                       = 27;
+  const TYPE_COLUMN                     = 28;
+  const TYPE_COLUMN_GROUP               = 29;
+  const TYPE_COLOR                      = 30;
+  const TYPE_COLOR_PROFILE              = 31;
+  const TYPE_CURSOR                     = 32;
+  const TYPE_DATA                       = 33;
+  const TYPE_DATA_LIST                  = 34;
+  const TYPE_DATE                       = 35;
+  const TYPE_DATE_TIME_LOCAL            = 36;
+  const TYPE_DEFS                       = 37;
+  const TYPE_DEL                        = 38;
+  const TYPE_DESCRIPTION                = 39;
+  const TYPE_DETAILS                    = 40;
+  const TYPE_DFN                        = 41;
+  const TYPE_DIALOG                     = 42;
+  const TYPE_DIVIDER                    = 43;
+  const TYPE_DEFINITION_LIST            = 44;
+  const TYPE_ELLIPSE                    = 45;
+  const TYPE_EM                         = 46;
+  const TYPE_EMAIL                      = 47;
+  const TYPE_EMBED                      = 48;
+  const TYPE_FE_BLEND                   = 49;
+  const TYPE_FIELD_SET                  = 50;
+  const TYPE_FIGURE                     = 51;
+  const TYPE_FIGURE_CAPTION             = 52;
+  const TYPE_FILE                       = 53;
+  const TYPE_FOOTER                     = 54;
+  const TYPE_FORM                       = 55;
+  const TYPE_GROUP                      = 56;
+  const TYPE_H1                         = 57;
+  const TYPE_H2                         = 58;
+  const TYPE_H3                         = 59;
+  const TYPE_H4                         = 60;
+  const TYPE_H5                         = 61;
+  const TYPE_H6                         = 62;
+  const TYPE_HX                         = 63;
+  const TYPE_HEADER                     = 64;
+  const TYPE_HIDDEN                     = 65;
+  const TYPE_HORIZONTAL_RULER           = 66;
+  const TYPE_ITALICS                    = 67;
+  const TYPE_INLINE_FRAME               = 68;
+  const TYPE_IMAGE                      = 69;
+  const TYPE_IMAGE_SVG                  = 70;
+  const TYPE_INPUT                      = 71;
+  const TYPE_INS                        = 72;
+  const TYPE_KEYBOARD                   = 73;
+  const TYPE_KEY_GEN                    = 74;
+  const TYPE_LABEL                      = 75;
+  const TYPE_LEGEND                     = 76;
+  const TYPE_LIST_ITEM                  = 77;
+  const TYPE_LINE                       = 78;
+  const TYPE_LINEAR_GRADIENT            = 79;
+  const TYPE_LINK                       = 80;
+  const TYPE_MAIN                       = 81;
+  const TYPE_MAP                        = 82;
+  const TYPE_MARK                       = 83;
+  const TYPE_MARKER                     = 84;
+  const TYPE_MASK                       = 85;
+  const TYPE_MENU                       = 86;
+  const TYPE_MENU_ITEM                  = 87;
+  const TYPE_MATH                       = 88;
+  const TYPE_META                       = 89;
+  const TYPE_METER                      = 90;
+  const TYPE_MONTH                      = 91;
+  const TYPE_NAVIGATION                 = 92;
+  const TYPE_NO_SCRIPT                  = 93;
+  const TYPE_NUMBER                     = 94;
+  const TYPE_OBJECT                     = 95;
+  const TYPE_ORDERED_LIST               = 96;
+  const TYPE_OPTIONS_GROUP              = 97;
+  const TYPE_OPTION                     = 98;
+  const TYPE_OUTPUT                     = 99;
+  const TYPE_PARAGRAPH                  = 100;
+  const TYPE_PARAM                      = 101;
+  const TYPE_PASSWORD                   = 102;
+  const TYPE_PATH                       = 103;
+  const TYPE_PATTERN                    = 104;
+  const TYPE_PICTURE                    = 105;
+  const TYPE_POLYGON                    = 106;
+  const TYPE_POLYLINE                   = 107;
+  const TYPE_PREFORMATTED               = 108;
+  const TYPE_PROGRESS                   = 109;
+  const TYPE_Q                          = 110;
+  const TYPE_RADIAL_GRADIENT            = 111;
+  const TYPE_RADIO                      = 112;
+  const TYPE_RANGE                      = 113;
+  const TYPE_RECTANGLE                  = 114;
+  const TYPE_RESET                      = 115;
+  const TYPE_RUBY                       = 116;
+  const TYPE_RUBY_PARENTHESIS           = 117;
+  const TYPE_RUBY_PRONUNCIATION         = 118;
+  const TYPE_STRIKE_THROUGH             = 119;
+  const TYPE_SAMPLE                     = 120;
+  const TYPE_SCRIPT                     = 121;
+  const TYPE_SEARCH                     = 122;
+  const TYPE_SECTION                    = 123;
+  const TYPE_SELECT                     = 124;
+  const TYPE_SMALL                      = 125;
+  const TYPE_SOURCE                     = 126;
+  const TYPE_SPAN                       = 127;
+  const TYPE_STOP                       = 128;
+  const TYPE_STRONG                     = 129;
+  const TYPE_STYLE                      = 130;
+  const TYPE_SUB_SCRIPT                 = 131;
+  const TYPE_SUBMIT                     = 132;
+  const TYPE_SUPER_SCRIPT               = 133;
+  const TYPE_SVG                        = 134;
+  const TYPE_TABLE                      = 135;
+  const TYPE_TABLE_BODY                 = 136;
+  const TYPE_TABLE_CELL                 = 137;
+  const TYPE_TABLE_FOOTER               = 138;
+  const TYPE_TABLE_HEADER               = 139;
+  const TYPE_TABLE_HEADER_CELL          = 140;
+  const TYPE_TABLE_ROW                  = 141;
+  const TYPE_TELEPHONE                  = 142;
+  const TYPE_TEMPLATE                   = 143;
+  const TYPE_TERM_DESCRIPTION           = 144;
+  const TYPE_TERM_NAME                  = 145;
+  const TYPE_TEXT                       = 146;
+  const TYPE_TEXT_AREA                  = 147;
+  const TYPE_TEXT_REFERENCE             = 148;
+  const TYPE_TEXT_SPAN                  = 149;
+  const TYPE_TEXT_SVG                   = 150;
+  const TYPE_TIME                       = 151;
+  const TYPE_TITLE                      = 152;
+  const TYPE_TRACK                      = 153;
+  const TYPE_UNDERLINE                  = 154;
+  const TYPE_UNORDERED_LIST             = 155;
+  const TYPE_URL                        = 156;
+  const TYPE_USE                        = 157;
+  const TYPE_VARIABLE                   = 158;
+  const TYPE_VIDEO                      = 159;
+  const TYPE_WEEK                       = 160;
+  const TYPE_WIDE_BREAK                 = 161;
 
   protected $attributes;
   protected $tags;
index 96168b2fee7daf4e3678a6713cfd8ec2a5978e54..478a4a7d7cd9f508ac38a3540e513ccf3971d6ae 100644 (file)
@@ -41,6 +41,16 @@ class c_standard_path extends c_base_path {
   protected const CSS_AS_ROW_ODD                = 'as-row-odd';
   protected const CSS_AS_ROW_VALUE              = 'as-row-value';
   protected const CSS_AS_SPACER                 = 'as-spacer';
+  protected const CSS_AS_TABLE                  = 'as-table';
+  protected const CSS_AS_TABLE_CAPTION          = 'as-table-caption';
+  protected const CSS_AS_TABLE_COLUMN           = 'as-table-column';
+  protected const CSS_AS_TABLE_COLUMN_GROUP     = 'as-table-column_group';
+  protected const CSS_AS_TABLE_HEADER           = 'as-table-header';
+  protected const CSS_AS_TABLE_HEADER_CELL      = 'as-table-header-cell';
+  protected const CSS_AS_TABLE_BODY             = 'as-table-body';
+  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_IS_JAVASCRIPT_ENABLED  = 'javascript-enabled';
   protected const CSS_IS_JAVASCRIPT_DISABLED = 'javascript-disabled';
@@ -1098,6 +1108,356 @@ class c_standard_path extends c_base_path {
   }
 
   /**
+   * Creates the standard "table".
+   *
+   * This does not create/add the colgroup, thead, tbody, tr, or tfoot tags.
+   *
+   * @param int|string|null $text
+   *   The text or the text code to use as the table caption.
+   *   If NULL, then no caption is generated..
+   *   If adding additional markup, caption should be added manually.
+   * @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_table($text, $arguments = array(), $id = NULL, $extra_class = NULL) {
+    $classes = array($this->settings['base_css'] . self::CSS_AS_TABLE,  self::CSS_AS_TABLE);
+    if (is_string($extra_class)) {
+      $classes[] = $extra_class;
+    }
+    elseif (is_array($extra_class)) {
+      foreach ($extra_class as $class) {
+        $classes[] = $class;
+      }
+      unset($class);
+    }
+
+    $table_tag = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_TABLE, $id, $classes);
+
+    if (!is_null($text)) {
+      if (is_int($text)) {
+        $tag = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_CAPTION, $id, $classes, $this->pr_get_text($text, $arguments));
+      }
+      else {
+        $tag = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_CAPTION, $id, $classes, $text);
+      }
+
+      $table_tag->set_tag($tag);
+      unset($tag);
+    }
+
+    return $table_tag;
+  }
+
+  /**
+   * Creates the standard "table caption".
+   *
+   * @param int|string|null $text
+   *   The text or the text code to use as the table caption.
+   *   If NULL, then no text is added..
+   *   If adding additional markup, caption should be added manually.
+   * @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_table_caption($text, $arguments = array(), $id = NULL, $extra_class = NULL) {
+    $classes = array($this->settings['base_css'] . self::CSS_AS_TABLE_CAPTION,  self::CSS_AS_TABLE_CAPTION);
+    if (is_string($extra_class)) {
+      $classes[] = $extra_class;
+    }
+    elseif (is_array($extra_class)) {
+      foreach ($extra_class as $class) {
+        $classes[] = $class;
+      }
+      unset($class);
+    }
+
+    if (!is_null($text)) {
+      if (is_int($text)) {
+        return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_CAPTION, $id, $classes, $this->pr_get_text($text, $arguments));
+      }
+
+      return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_CAPTION, $id, $classes, $text);
+    }
+
+    return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_CAPTION, $id, $classes);
+  }
+
+  /**
+   * Creates the standard "table column".
+   *
+   * @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_table_column($id = NULL, $extra_class = NULL) {
+    $classes = array($this->settings['base_css'] . self::CSS_AS_TABLE_COLUMN,  self::CSS_AS_TABLE_COLUMN);
+    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_COLUMN, $id, $classes);
+  }
+
+  /**
+   * Creates the standard "table column group".
+   *
+   * @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_table_column_group($id = NULL, $extra_class = NULL) {
+    $classes = array($this->settings['base_css'] . self::CSS_AS_TABLE_COLUMN_GROUP,  self::CSS_AS_TABLE_COLUMN_GROUP);
+    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_COLUMN_GROUP, $id, $classes);
+  }
+
+  /**
+   * Creates the standard "table header".
+   *
+   * @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_table_header($id = NULL, $extra_class = NULL) {
+    $classes = array($this->settings['base_css'] . self::CSS_AS_TABLE_HEADER,  self::CSS_AS_TABLE_HEADER);
+    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_TABLE_HEADER, $id, $classes);
+  }
+
+  /**
+   * Creates the standard "table header cell".
+   *
+   * @param int|string|null $text
+   *   The text or the text code to use as the table caption.
+   *   If NULL, then no text is added..
+   *   If adding additional markup, text should be added manually.
+   * @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_table_header_cell($text, $id = NULL, $extra_class = NULL) {
+    $classes = array($this->settings['base_css'] . self::CSS_AS_TABLE_HEADER_CELL,  self::CSS_AS_TABLE_HEADER_CELL);
+    if (is_string($extra_class)) {
+      $classes[] = $extra_class;
+    }
+    elseif (is_array($extra_class)) {
+      foreach ($extra_class as $class) {
+        $classes[] = $class;
+      }
+      unset($class);
+    }
+
+    if (!is_null($text)) {
+      if (is_int($text)) {
+        return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_TABLE_HEADER_CELL, $id, $classes, $this->pr_get_text($text, $arguments));
+      }
+
+      return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_TABLE_HEADER_CELL, $id, $classes, $text);
+    }
+
+    return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_TABLE_HEADER_CELL, $id, $classes);
+  }
+
+  /**
+   * Creates the standard "table body".
+   *
+   * @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_table_body($id = NULL, $extra_class = NULL) {
+    $classes = array($this->settings['base_css'] . self::CSS_AS_TABLE_BODY,  self::CSS_AS_TABLE_BODY);
+    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_TABLE_BODY, $id, $classes);
+  }
+
+  /**
+   * Creates the standard "table row".
+   *
+   * @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_table_row($id = NULL, $extra_class = NULL) {
+    $classes = array($this->settings['base_css'] . self::CSS_AS_TABLE_ROW,  self::CSS_AS_TABLE_ROW);
+    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_TABLE_ROW, $id, $classes);
+  }
+
+  /**
+   * Creates the standard "table body".
+   *
+   * @param int|string|null $text
+   *   The text or the text code to use as the table caption.
+   *   If NULL, then no text is added..
+   *   If adding additional markup, text should be added manually.
+   * @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_table_cell($text, $id = NULL, $extra_class = NULL) {
+    $classes = array($this->settings['base_css'] . self::CSS_AS_TABLE_CELL,  self::CSS_AS_TABLE_CELL);
+    if (is_string($extra_class)) {
+      $classes[] = $extra_class;
+    }
+    elseif (is_array($extra_class)) {
+      foreach ($extra_class as $class) {
+        $classes[] = $class;
+      }
+      unset($class);
+    }
+
+    if (!is_null($text)) {
+      if (is_int($text)) {
+        return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_TABLE_CELL, $id, $classes, $this->pr_get_text($text, $arguments));
+      }
+
+      return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_TABLE_CELL, $id, $classes, $text);
+    }
+
+    return c_theme_html::s_create_tag(c_base_markup_tag::TYPE_TABLE_CELL, $id, $classes);
+  }
+
+  /**
+   * Creates the standard "table body".
+   *
+   * @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_table_footer($id = NULL, $extra_class = NULL) {
+    $classes = array($this->settings['base_css'] . self::CSS_AS_TABLE_FOOTER,  self::CSS_AS_TABLE_FOOTER);
+    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_TABLE_FOOTER, $id, $classes);
+  }
+
+  /**
    * Create a new HTML markup class with default settings populated.
    *
    * @param bool $real_page
index d5f7b189dd88ee392145d0ddf7a8432db6b1ec26..8cdb60593e94931070057bd795e8f7b7a2330216 100644 (file)
@@ -605,24 +605,59 @@ class c_standard_path_user_view extends c_standard_path {
         unset($last_error);
       }
       else {
+        $tag_table = $this->pr_create_tag_table(17);
+
+        // @fixme: replace all text here with numeric ids for translation.
+        $tag_table_header = $this->pr_create_tag_table_header();
+        $tag_table_header->set_tag($this->pr_create_tag_table_header_cell('ID'));
+        $tag_table_header->set_tag($this->pr_create_tag_table_header_cell('User ID'));
+        $tag_table_header->set_tag($this->pr_create_tag_table_header_cell('Title'));
+        $tag_table_header->set_tag($this->pr_create_tag_table_header_cell('Type'));
+        $tag_table_header->set_tag($this->pr_create_tag_table_header_cell('Sub-Type'));
+        $tag_table_header->set_tag($this->pr_create_tag_table_header_cell('Severity'));
+        $tag_table_header->set_tag($this->pr_create_tag_table_header_cell('Facility'));
+        $tag_table_header->set_tag($this->pr_create_tag_table_header_cell('Details'));
+        $tag_table_header->set_tag($this->pr_create_tag_table_header_cell('Date'));
+        $tag_table_header->set_tag($this->pr_create_tag_table_header_cell('Client'));
+        $tag_table_header->set_tag($this->pr_create_tag_table_header_cell('Response Code'));
+        $tag_table->set_tag($tag_table_header);
+        unset($tag_table_header);
+
+        $tag_table_body = $this->pr_create_tag_table_body();
+
+        // @fixme: below is just an example/test. Rewrite this, cleaning up the code and adding more appropriate sanitizers and structure.
         $columns = $query_result->fetch_row()->get_value();
         while (is_array($columns) && !empty($columns)) {
-          $this->id = (int) $columns[0];
-          $this->id_user = (int) $columns[1];
-
-          $this->log_title = (string) $columns[2];
-          $this->log_type = (int) $columns[3];
-          $this->log_type_sub = (int) $columns[4];
-          $this->log_severity = (int) $columns[5];
-          $this->log_facility = (int) $columns[6];
-          $this->log_details = json_decode($columns[7], TRUE);
-          $this->log_date = c_base_defaults_global::s_get_timestamp($columns[8], c_base_database::STANDARD_TIMESTAMP_FORMAT)->get_value_exact();
-          $this->request_client = (string) $columns[9];
-          $this->response_code = (int) $columns[10];
+          $row_timestamp = c_base_defaults_global::s_get_timestamp($columns[8], c_base_database::STANDARD_TIMESTAMP_FORMAT)->get_value_exact();
+          $row_date = c_base_defaults_global::s_get_date(c_base_defaults_global::FORMAT_DATE_TIME_SECONDS_HUMAN, $row_timestamp)->get_value_exact();
+          unset($row_timestamp);
+
+          $tag_table_row = $this->pr_create_tag_table_row();
+          $tag_table_row->set_tag($this->pr_create_tag_table_cell('' . ((int) $columns[0])));
+          $tag_table_row->set_tag($this->pr_create_tag_table_cell('' . ((int) $columns[1])));
+          $tag_table_row->set_tag($this->pr_create_tag_table_cell($columns[2]));
+          $tag_table_row->set_tag($this->pr_create_tag_table_cell('' . ((int) $columns[3])));
+          $tag_table_row->set_tag($this->pr_create_tag_table_cell('' . ((int) $columns[4])));
+          $tag_table_row->set_tag($this->pr_create_tag_table_cell('' . ((int) $columns[5])));
+          $tag_table_row->set_tag($this->pr_create_tag_table_cell('' . ((int) $columns[6])));
+          $tag_table_row->set_tag($this->pr_create_tag_table_cell($columns[7])); // @todo: json_decode($columns[7], TRUE)
+          $tag_table_row->set_tag($this->pr_create_tag_table_cell($row_date));
+          $tag_table_row->set_tag($this->pr_create_tag_table_cell($columns[9]));
+          $tag_table_row->set_tag($this->pr_create_tag_table_cell('' . ((int) $columns[10])));
+          unset($row_date);
+
+          $tag_table_body->set_tag($tag_table_row);
+          unset($tag_table_row);
 
           $columns = $query_result->fetch_row()->get_value();
         }
         unset($columns);
+
+        $tag_table->set_tag($tag_table_body);
+        unset($tag_table_body);
+
+        $content->set_tag($tag_table);
+        unset($tag_table);
       }
 
       $fieldset->set_tag($content);
index 9652c3f71e37fc6dfa327dc1da36cc292a71a57f..5bef696d495629ee5ae6b4bf367ff81da5a359f8 100644 (file)
@@ -380,6 +380,10 @@ class c_theme_html extends c_base_return {
       $class_1 = 'structure';
       $class_2 = 'structure-canvas';
     }
+    elseif ($type === c_base_markup_tag::TYPE_CAPTION) {
+      $class_1 = 'text';
+      $class_2 = 'text-caption';
+    }
     elseif ($type === c_base_markup_tag::TYPE_CHECKBOX) {
       $class_1 = 'field';
       $class_2 = 'field-checkbox';
@@ -392,7 +396,7 @@ class c_theme_html extends c_base_return {
       $class_1 = 'text';
       $class_2 = 'text-code';
     }
-    elseif ($type === c_base_markup_tag::TYPE_COL) {
+    elseif ($type === c_base_markup_tag::TYPE_COLUMN) {
       $class_1 = 'structure';
       $class_2 = 'structure-column';
     }
@@ -400,7 +404,7 @@ class c_theme_html extends c_base_return {
       $class_1 = 'field';
       $class_2 = 'field-color';
     }
-    elseif ($type === c_base_markup_tag::TYPE_COL_GROUP) {
+    elseif ($type === c_base_markup_tag::TYPE_COLUMN_GROUP) {
       $class_1 = 'structure';
       $class_2 = 'structure-column_group';
     }
@@ -1736,13 +1740,13 @@ class c_theme_html extends c_base_return {
       $markup .= $child_markup;
       $markup .= '</code>';
     }
-    elseif ($type === c_base_markup_tag::TYPE_COL) {
+    elseif ($type === c_base_markup_tag::TYPE_COLUMN) {
       $markup .= '<col' . $this->p_render_markup_attributes_global($tag) . $this->p_render_markup_attributes_col($tag) . $this->p_render_markup_attributes_event_handler($tag) . '>';
       $markup .= $tag->get_text()->get_value_exact();
       $markup .= $child_markup;
       $markup .= '</col>';
     }
-    elseif ($type === c_base_markup_tag::TYPE_COL_GROUP) {
+    elseif ($type === c_base_markup_tag::TYPE_COLUMN_GROUP) {
       $markup .= '<colgroup' . $this->p_render_markup_attributes_global($tag) . $this->p_render_markup_attributes_colgroup($tag) . $this->p_render_markup_attributes_event_handler($tag) . '>';
       $markup .= $tag->get_text()->get_value_exact();
       $markup .= $child_markup;
index c7b2c1072bd04c6f7a65a1465336c3c5680b1ff0..1d04db11e59c2489ce0b598f8805b745843e8898 100644 (file)
@@ -195,6 +195,7 @@ class c_base_defaults_global {
 
     if (!is_null(self::$s_timezone)) {
       date_default_timezone_set(self::$s_timezone);
+      $date->setTimeZone(new DateTimeZone(self::$s_timezone));
     }
 
     $formatted = $date->format($string);