ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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, $fields)
 
 updateDatabase (ActiveRecord $ar)
 
 resetDatabase (ActiveRecord $ar)
 
 truncateDatabase (ActiveRecord $ar)
 
 checkTableExists (ActiveRecord $ar)
 
 checkFieldExists (ActiveRecord $ar, $field_name)
 
 removeField (ActiveRecord $ar, $field_name)
 
 renameField (ActiveRecord $ar, $old_name, $new_name)
 
 create (ActiveRecord $ar)
 
 read (ActiveRecord $ar)
 
 update (ActiveRecord $ar)
 
 delete (ActiveRecord $ar)
 
 readSet (ActiveRecordList $arl)
 
 affectedRows (ActiveRecordList $arl)
 
 quote ($value, $type)
 
 updateIndices (ActiveRecord $ar)
 
 nextID (ActiveRecord $ar)
 
 checkConnection (ActiveRecord $ar)
 
 installDatabase (ActiveRecord $ar, $fields)
 
 updateDatabase (ActiveRecord $ar)
 
 resetDatabase (ActiveRecord $ar)
 
 truncateDatabase (ActiveRecord $ar)
 
 checkTableExists (ActiveRecord $ar)
 
 checkFieldExists (ActiveRecord $ar, $field_name)
 
 removeField (ActiveRecord $ar, $field_name)
 
 renameField (ActiveRecord $ar, $old_name, $new_name)
 
 create (ActiveRecord $ar)
 
 read (ActiveRecord $ar)
 
 update (ActiveRecord $ar)
 
 delete (ActiveRecord $ar)
 
 readSet (ActiveRecordList $arl)
 
 affectedRows (ActiveRecordList $arl)
 
 quote ($value, $type)
 
 updateIndices (ActiveRecord $ar)
 

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 11 of file class.arConnectorSession.php.

Member Function Documentation

◆ affectedRows()

arConnectorSession::affectedRows ( ActiveRecordList  $arl)
Parameters
ActiveRecordList$arl
Returns
int

Reimplemented from arConnector.

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

234 {
235 return count($this->readSet($arl));
236 }
readSet(ActiveRecordList $arl)

References readSet().

+ Here is the call graph for this function:

◆ checkConnection()

arConnectorSession::checkConnection ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar
Returns
bool

Reimplemented from arConnector.

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

54 {
55 return is_array(self::getSession());
56 }

◆ checkFieldExists()

arConnectorSession::checkFieldExists ( ActiveRecord  $ar,
  $field_name 
)
Parameters
ActiveRecord$ar
$field_name
Returns
mixed

Reimplemented from arConnector.

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

128 {
129 $session = self::getSessionForActiveRecord($ar);
130
131 return array_key_exists($field_name, $session[0]);
132 }
static getSessionForActiveRecord(ActiveRecord $ar)

References getSessionForActiveRecord().

+ Here is the call graph for this function:

◆ checkTableExists()

arConnectorSession::checkTableExists ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar
Returns
mixed

Reimplemented from arConnector.

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

117 {
118 return is_array(self::getSessionForActiveRecord($ar));
119 }

◆ create()

arConnectorSession::create ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar

Reimplemented from arConnector.

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

163 {
164 $_SESSION[self::AR_CONNECTOR_SESSION][$ar::returnDbTableName()][$ar->getPrimaryFieldValue()] = $ar->__asStdClass();
165 }
$_SESSION["AccountId"]

References $_SESSION, ActiveRecord\__asStdClass(), AR_CONNECTOR_SESSION, and ActiveRecord\getPrimaryFieldValue().

Referenced by update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

arConnectorSession::delete ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar

Reimplemented from arConnector.

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

191 {
192 unset($_SESSION[self::AR_CONNECTOR_SESSION][$ar::returnDbTableName()][$ar->getPrimaryFieldValue()]);
193 }

References $_SESSION.

◆ getSession()

static arConnectorSession::getSession ( )
static
Returns
array

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

24 {
25 if (!$_SESSION[self::AR_CONNECTOR_SESSION]) {
27 }
28
30 }

References $_SESSION, AR_CONNECTOR_SESSION, and resetSession().

Referenced by getSessionForActiveRecord().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSessionForActiveRecord()

static arConnectorSession::getSessionForActiveRecord ( ActiveRecord  $ar)
static
Parameters
ActiveRecord$ar
Returns
array

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

38 {
39 $session = self::getSession();
40 $ar_session = $session[$ar::returnDbTableName()];
41 if (!is_array($ar_session)) {
42 $ar_session = array();
43 }
44
45 return $ar_session;
46 }

References getSession().

Referenced by checkFieldExists(), read(), and readSet().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ installDatabase()

arConnectorSession::installDatabase ( ActiveRecord  $ar,
  $fields 
)
Parameters
ActiveRecord$ar
$fields
Returns
bool

Reimplemented from arConnector.

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

75 {
76 return self::resetDatabase($ar);
77 }
resetDatabase(ActiveRecord $ar)

References resetDatabase().

+ Here is the call graph for this function:

◆ nextID()

arConnectorSession::nextID ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar
Returns
mixed

Reimplemented from arConnector.

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

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

◆ quote()

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

Reimplemented from arConnector.

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

245 {
246 return $value;
247 }

◆ read()

arConnectorSession::read ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar
Returns
array

Reimplemented from arConnector.

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

173 {
174 $session = self::getSessionForActiveRecord($ar);
175
176 return array( $session[$ar->getPrimaryFieldValue()] );
177 }

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

+ Here is the call graph for this function:

◆ readSet()

arConnectorSession::readSet ( ActiveRecordList  $arl)
Parameters
ActiveRecordList$arl

Reimplemented from arConnector.

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

203 {
204 $session = self::getSessionForActiveRecord($arl->getAR());
205 foreach ($session as $i => $s) {
206 $session[$i] = (array)$s;
207 }
208 foreach ($arl->getArWhereCollection()->getWheres() as $w) {
209 $fieldname = $w->getFieldname();
210 $v = $w->getValue();
211 $operator = $w->getOperator();
212
213 foreach ($session as $i => $s) {
214 $session[$i] = (array)$s;
215 switch ($operator) {
216 case '=':
217 if ($s[$fieldname] != $v) {
218 unset($session[$i]);
219 }
220 break;
221 }
222 }
223 }
224
225 return $session;
226 }
$w

References $w, ActiveRecordList\getAR(), ActiveRecordList\getArWhereCollection(), and getSessionForActiveRecord().

Referenced by affectedRows().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeField()

arConnectorSession::removeField ( ActiveRecord  $ar,
  $field_name 
)
Parameters
ActiveRecord$ar
$field_name
Returns
bool
Exceptions
arException

Reimplemented from arConnector.

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

142 {
143 return true;
144 }

◆ renameField()

arConnectorSession::renameField ( ActiveRecord  $ar,
  $old_name,
  $new_name 
)
Parameters
ActiveRecord$ar
$old_name
$new_name
Returns
bool
Exceptions
arException

Reimplemented from arConnector.

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

155 {
156 return true;
157 }

◆ resetDatabase()

arConnectorSession::resetDatabase ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar
Returns
bool

Reimplemented from arConnector.

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

95 {
96 $_SESSION[self::AR_CONNECTOR_SESSION][$ar::returnDbTableName()] = array();
97
98 return true;
99 }

References $_SESSION, and AR_CONNECTOR_SESSION.

Referenced by installDatabase(), and truncateDatabase().

+ Here is the caller graph for this function:

◆ resetSession()

static arConnectorSession::resetSession ( )
static

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

16 {
18 }

References $_SESSION, and AR_CONNECTOR_SESSION.

Referenced by getSession().

+ Here is the caller graph for this function:

◆ truncateDatabase()

arConnectorSession::truncateDatabase ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar
Returns
bool

Reimplemented from arConnector.

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

107 {
108 return self::resetDatabase($ar);
109 }

References resetDatabase().

+ Here is the call graph for this function:

◆ update()

arConnectorSession::update ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar

Reimplemented from arConnector.

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

183 {
184 self::create($ar);
185 }

References create().

+ Here is the call graph for this function:

◆ updateDatabase()

arConnectorSession::updateDatabase ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar
Returns
bool

Reimplemented from arConnector.

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

85 {
86 return true;
87 }

◆ updateIndices()

arConnectorSession::updateIndices ( ActiveRecord  $ar)
Parameters
ActiveRecord$ar

Reimplemented from arConnector.

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

253 {
254 // TODO: Implement updateIndices() method.
255 }

Field Documentation

◆ AR_CONNECTOR_SESSION

const arConnectorSession::AR_CONNECTOR_SESSION = 'arConnectorSession'

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

Referenced by create(), getSession(), resetDatabase(), and resetSession().


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