BMLT Root Server
c_comdef_changes.class.php
Go to the documentation of this file.
1 <?php
2 /***********************************************************************/
3 /** \file c_comdef_changes.class.php
4  \brief The file for the c_comdef_changes class.
5 
6  This file is part of the Basic Meeting List Toolbox (BMLT).
7 
8  Find out more at: https://bmlt.app
9 
10  BMLT is free software: you can redistribute it and/or modify
11  it under the terms of the MIT License.
12 
13  BMLT is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  MIT License for more details.
17 
18  You should have received a copy of the MIT License along with this code.
19  If not, see <https://opensource.org/licenses/MIT>.
20 */
21 defined('BMLT_EXEC') or die('Cannot Execute Directly'); // Makes sure that this file is in the correct context.
22 
23 require_once(dirname(__FILE__)."/c_comdef_change.class.php");
24 
25 /***********************************************************************/
26 /** \class c_comdef_changes
27  \brief A class to hold a collection of c_comdef_change objects.
28 
29 ***********************************************************************/
30 // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
31 // phpcs:disable Squiz.Classes.ValidClassName.NotCamelCaps
33 // phpcs:enable PSR1.Classes.ClassDeclaration.MissingNamespace
34 // phpcs:enable Squiz.Classes.ValidClassName.NotCamelCaps
35 {
36  /// A reference to the "parent" object for this instance.
37  private $_local_id_parent_obj = null;
38  /// An array of new c_comdef_change objects that comprises the content.
39  private $_changes_objects = null;
40 
41  public function __construct(
42  $in_parent_object, ///< A reference to the object that "owns" this instance.
43  $in_change_data ///< An array of data for the changes to be instantiated.
44  ) {
45  $this->SetParentObj($in_parent_object);
46 
47  if (is_array($in_change_data) && count($in_change_data)) {
48  $count = 0;
49  foreach ($in_change_data as $row) {
50  $this->_changes_objects[$count] = null;
51  $date_ar = explode(" ", $row['change_date']);
52  $date_a = explode("-", $date_ar[0]);
53  $date_b = explode(":", $date_ar[1]);
54  $date = mktime($date_b[0], $date_b[1], $date_b[2], $date_a[1], $date_a[2], $date_a[0]);
55  $this->_changes_objects[$count++] = new c_comdef_change($this, $row['change_type_enum'], $row['user_id_bigint'], $row['service_body_id_bigint'], $row['before_object'], $row['after_object'], $row['object_class_string'], $row['before_id_bigint'], $row['after_id_bigint'], $row['before_lang_enum'], $row['after_lang_enum'], $row['id_bigint'], $row['change_name_string'], $row['change_description_text'], $row['lang_enum'], $date);
56  }
57  }
58  }
59 
60  /*******************************************************************/
61  /** \brief Accessor. Get references to the changes objects.
62 
63  \returns a reference to an array of c_comdef_changes objects.
64  */
65  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
66  public function &GetChangesObjects()
67  {
68  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
69  return $this->_changes_objects;
70  }
71 
72  /*******************************************************************/
73  /** \brief Set the parent object of this instance.
74  */
75  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
76  public function SetParentObj(
77  $in_parent_obj ///< A reference to the parent object.
78  ) {
79  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
80  $this->_local_id_parent_obj = null;
81  $this->_local_id_parent_obj = $in_parent_obj;
82  }
83 
84  /*******************************************************************/
85  /** \brief Return a reference to the parent object of this instance.
86 
87  \returns a reference to the parent instance of the object.
88  */
89  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
90  public function GetParentObj()
91  {
92  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
93  return $this->_local_id_parent_obj;
94  }
95 }
GetParentObj()
Return a reference to the parent object of this instance.
SetParentObj($in_parent_obj)
Set the parent object of this instance.
A Class for Change Record Objects.
Simply declares an interface for having a "container" object.
A class to hold a collection of c_comdef_change objects.
__construct($in_parent_object, $in_change_data)
defined('BMLT_EXEC') or define('BMLT_EXEC'
Definition: index.php:3
& GetChangesObjects()
Accessor. Get references to the changes objects.