ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
arConnectorSession Class Reference

Class arConnectorSession. More...

+ Inheritance diagram for arConnectorSession:
+ Collaboration diagram for arConnectorSession:

Public Member Functions

 checkConnection (ActiveRecord $ar)
 
 nextID (ActiveRecord $ar)
 
 installDatabase (ActiveRecord $ar, array $fields)
 
 updateDatabase (ActiveRecord $ar)
 
 resetDatabase (ActiveRecord $ar)
 
 truncateDatabase (ActiveRecord $ar)
 
 checkTableExists (ActiveRecord $ar)
 
 checkFieldExists (ActiveRecord $ar, string $field_name)
 
 removeField (ActiveRecord $ar, string $field_name)
 
 renameField (ActiveRecord $ar, string $old_name, string $new_name)
 
 create (ActiveRecord $ar)
 
 read (ActiveRecord $ar)
 
 update (ActiveRecord $ar)
 
 delete (ActiveRecord $ar)
 
 readSet (ActiveRecordList $arl)
 
 affectedRows (ActiveRecordList $arl)
 
 quote ($value, string $type)
 
 updateIndices (ActiveRecord $ar)
 
- Public Member Functions inherited from arConnector
 nextID (ActiveRecord $ar)
 
 checkConnection (ActiveRecord $ar)
 
 installDatabase (ActiveRecord $ar, array $fields)
 
 updateDatabase (ActiveRecord $ar)
 
 resetDatabase (ActiveRecord $ar)
 
 truncateDatabase (ActiveRecord $ar)
 
 checkTableExists (ActiveRecord $ar)
 
 checkFieldExists (ActiveRecord $ar, string $field_name)
 
 removeField (ActiveRecord $ar, string $field_name)
 
 renameField (ActiveRecord $ar, string $old_name, string $new_name)
 
 create (ActiveRecord $ar)
 
 read (ActiveRecord $ar)
 
 update (ActiveRecord $ar)
 
 delete (ActiveRecord $ar)
 
 readSet (ActiveRecordList $arl)
 
 affectedRows (ActiveRecordList $arl)
 
 quote ($value, string $type)
 
 updateIndices (ActiveRecord $ar)
 
 fixDate (string $value)
 

Static Public Member Functions

static resetSession ()
 
static getSession ()
 
static getSessionForActiveRecord (ActiveRecord $ar)
 

Data Fields

const AR_CONNECTOR_SESSION = 'arConnectorSession'
 

Detailed Description

Class arConnectorSession.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
2.0.7

Definition at line 21 of file class.arConnectorSession.php.

Member Function Documentation

◆ affectedRows()

arConnectorSession::affectedRows ( ActiveRecordList  $arl)

Definition at line 170 of file class.arConnectorSession.php.

References readSet().

170  : int
171  {
172  return count($this->readSet($arl));
173  }
readSet(ActiveRecordList $arl)
+ Here is the call graph for this function:

◆ checkConnection()

arConnectorSession::checkConnection ( ActiveRecord  $ar)

Definition at line 56 of file class.arConnectorSession.php.

56  : bool
57  {
58  return is_array(self::getSession());
59  }

◆ checkFieldExists()

arConnectorSession::checkFieldExists ( ActiveRecord  $ar,
string  $field_name 
)

Definition at line 96 of file class.arConnectorSession.php.

References $session.

96  : bool
97  {
98  $session = self::getSessionForActiveRecord($ar);
99 
100  return array_key_exists($field_name, $session[0]);
101  }
$session

◆ checkTableExists()

arConnectorSession::checkTableExists ( ActiveRecord  $ar)

Definition at line 91 of file class.arConnectorSession.php.

91  : bool
92  {
93  return is_array(self::getSessionForActiveRecord($ar));
94  }

◆ create()

arConnectorSession::create ( ActiveRecord  $ar)

Definition at line 119 of file class.arConnectorSession.php.

References ActiveRecord\asStdClass(), and ActiveRecord\getPrimaryFieldValue().

Referenced by update().

119  : void
120  {
121  $_SESSION[self::AR_CONNECTOR_SESSION][$ar::returnDbTableName()][$ar->getPrimaryFieldValue()] = $ar->asStdClass();
122  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

arConnectorSession::delete ( ActiveRecord  $ar)

Definition at line 139 of file class.arConnectorSession.php.

139  : void
140  {
141  unset($_SESSION[self::AR_CONNECTOR_SESSION][$ar::returnDbTableName()][$ar->getPrimaryFieldValue()]);
142  }

◆ getSession()

static arConnectorSession::getSession ( )
static
Returns
mixed[]

Definition at line 33 of file class.arConnectorSession.php.

33  : array
34  {
35  if (!$_SESSION[self::AR_CONNECTOR_SESSION]) {
36  self::resetSession();
37  }
38 
39  return $_SESSION[self::AR_CONNECTOR_SESSION];
40  }

◆ getSessionForActiveRecord()

static arConnectorSession::getSessionForActiveRecord ( ActiveRecord  $ar)
static
Returns
mixed[]

Definition at line 45 of file class.arConnectorSession.php.

References $session.

45  : array
46  {
47  $session = self::getSession();
48  $ar_session = $session[$ar::returnDbTableName()];
49  if (!is_array($ar_session)) {
50  $ar_session = array();
51  }
52 
53  return $ar_session;
54  }
$session

◆ installDatabase()

arConnectorSession::installDatabase ( ActiveRecord  $ar,
array  $fields 
)

Definition at line 69 of file class.arConnectorSession.php.

References resetDatabase().

69  : bool
70  {
71  return $this->resetDatabase($ar);
72  }
resetDatabase(ActiveRecord $ar)
+ Here is the call graph for this function:

◆ nextID()

arConnectorSession::nextID ( ActiveRecord  $ar)
Returns
mixed

Definition at line 64 of file class.arConnectorSession.php.

64  : int
65  {
66  return count(self::getSessionForActiveRecord($ar)) + 1;
67  }

◆ quote()

arConnectorSession::quote (   $value,
string  $type 
)
Parameters
$value

Definition at line 178 of file class.arConnectorSession.php.

178  : string
179  {
180  return $value;
181  }

◆ read()

arConnectorSession::read ( ActiveRecord  $ar)
Returns
mixed[]

Definition at line 127 of file class.arConnectorSession.php.

References $session, and ActiveRecord\getPrimaryFieldValue().

127  : array
128  {
129  $session = self::getSessionForActiveRecord($ar);
130 
131  return array($session[$ar->getPrimaryFieldValue()]);
132  }
$session
+ Here is the call graph for this function:

◆ readSet()

arConnectorSession::readSet ( ActiveRecordList  $arl)
Returns
mixed[]

Definition at line 148 of file class.arConnectorSession.php.

References $i, $session, ActiveRecordList\getAR(), and ActiveRecordList\getArWhereCollection().

Referenced by affectedRows().

148  : array
149  {
150  $session = self::getSessionForActiveRecord($arl->getAR());
151  foreach ($session as $i => $s) {
152  $session[$i] = (array) $s;
153  }
154  foreach ($arl->getArWhereCollection()->getWheres() as $w) {
155  $fieldname = $w->getFieldname();
156  $v = $w->getValue();
157  $operator = $w->getOperator();
158 
159  foreach ($session as $i => $s) {
160  $session[$i] = (array) $s;
161  if (($operator === '=') && $s[$fieldname] !== $v) {
162  unset($session[$i]);
163  }
164  }
165  }
166 
167  return $session;
168  }
$session
$i
Definition: metadata.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeField()

arConnectorSession::removeField ( ActiveRecord  $ar,
string  $field_name 
)
Exceptions
arException

Definition at line 106 of file class.arConnectorSession.php.

106  : bool
107  {
108  return true;
109  }

◆ renameField()

arConnectorSession::renameField ( ActiveRecord  $ar,
string  $old_name,
string  $new_name 
)
Exceptions
arException

Definition at line 114 of file class.arConnectorSession.php.

114  : bool
115  {
116  return true;
117  }

◆ resetDatabase()

arConnectorSession::resetDatabase ( ActiveRecord  $ar)

Definition at line 79 of file class.arConnectorSession.php.

Referenced by installDatabase(), and truncateDatabase().

79  : bool
80  {
81  $_SESSION[self::AR_CONNECTOR_SESSION][$ar::returnDbTableName()] = array();
82 
83  return true;
84  }
+ Here is the caller graph for this function:

◆ resetSession()

static arConnectorSession::resetSession ( )
static

Definition at line 25 of file class.arConnectorSession.php.

25  : void
26  {
27  $_SESSION[self::AR_CONNECTOR_SESSION] = array();
28  }

◆ truncateDatabase()

arConnectorSession::truncateDatabase ( ActiveRecord  $ar)

Definition at line 86 of file class.arConnectorSession.php.

References resetDatabase().

86  : bool
87  {
88  return $this->resetDatabase($ar);
89  }
resetDatabase(ActiveRecord $ar)
+ Here is the call graph for this function:

◆ update()

arConnectorSession::update ( ActiveRecord  $ar)

Definition at line 134 of file class.arConnectorSession.php.

References create().

134  : void
135  {
136  $this->create($ar);
137  }
+ Here is the call graph for this function:

◆ updateDatabase()

arConnectorSession::updateDatabase ( ActiveRecord  $ar)

Definition at line 74 of file class.arConnectorSession.php.

74  : bool
75  {
76  return true;
77  }

◆ updateIndices()

arConnectorSession::updateIndices ( ActiveRecord  $ar)

Definition at line 183 of file class.arConnectorSession.php.

183  : void
184  {
185  // TODO: Implement updateIndices() method.
186  }

Field Documentation

◆ AR_CONNECTOR_SESSION

const arConnectorSession::AR_CONNECTOR_SESSION = 'arConnectorSession'

Definition at line 23 of file class.arConnectorSession.php.


The documentation for this class was generated from the following file: