ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilIndividualAssessmentSettingsStorageDB Class Reference

A settings storage handler to write iass settings to db. More...

+ Inheritance diagram for ilIndividualAssessmentSettingsStorageDB:
+ Collaboration diagram for ilIndividualAssessmentSettingsStorageDB:

Public Member Functions

 __construct ($db)
 
 createSettings (ilIndividualAssessmentSettings $settings)
 Create a entry corresponding to $settings.
Parameters
ilIndividualAssessmentSettings$settings
More...
 
 loadSettings (ilObjIndividualAssessment $obj)
 Load settings corresponding to obj.
Parameters
ilObjIndividualAssessment$obj
Returns
ilIndividualAssessmentSettings $settings
More...
 
 updateSettings (ilIndividualAssessmentSettings $settings)
 Update settings entry.
Parameters
ilIndividualAssessmentSettings$settings
More...
 
 loadInfoSettings (ilObjIndividualAssessment $obj)
 Load info-screen settings corresponding to obj. More...
 
 updateInfoSettings (ilIndividualAssessmentInfoSettings $settings)
 Update info-screen settings entry. More...
 
 deleteSettings (ilObjIndividualAssessment $obj)
 Delete settings entry corresponding to obj.
Parameters
ilObjIndividualAssessment$obj
Returns
ilIndividualAssessmentSettings $settings
More...
 

Data Fields

const IASS_SETTINGS_TABLE = "iass_settings"
 
const IASS_SETTINGS_INFO_TABLE = "iass_info_settings"
 

Protected Attributes

 $db
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilIndividualAssessmentSettingsStorageDB::__construct (   $db)

Member Function Documentation

◆ createSettings()

ilIndividualAssessmentSettingsStorageDB::createSettings ( ilIndividualAssessmentSettings  $settings)

Create a entry corresponding to $settings.

Parameters
ilIndividualAssessmentSettings$settings

Implements ilIndividualAssessmentSettingsStorage.

Definition at line 27 of file class.ilIndividualAssessmentSettingsStorageDB.php.

References array, ilIndividualAssessmentSettings\content(), ilIndividualAssessmentSettings\eventTimePlaceRequired(), ilIndividualAssessmentSettings\fileRequired(), ilIndividualAssessmentSettings\getId(), and ilIndividualAssessmentSettings\recordTemplate().

28  {
29  $values = array( "obj_id" => array("integer", $settings->getId())
30  , "content" => array("text", $settings->content())
31  , "record_template" => array("text", $settings->recordTemplate())
32  , "event_time_place_required" => array("integer", $settings->eventTimePlaceRequired())
33  , "file_required" => array("integer", $settings->fileRequired())
34  );
35 
36  $this->db->insert(self::IASS_SETTINGS_TABLE, $values);
37 
38  $values = array("obj_id" => array("integer", $settings->getId()));
39  $this->db->insert(self::IASS_SETTINGS_INFO_TABLE, $values);
40  }
eventTimePlaceRequired()
Get the value of the checkbox event_time_place_require.
recordTemplate()
Get the record template to be used as default record with corresponding object.
content()
Get the content of this assessment, e.g.
getId()
Get the id of corrwsponding iass-object.
fileRequired()
Get the value of the checkbox file_required.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ deleteSettings()

ilIndividualAssessmentSettingsStorageDB::deleteSettings ( ilObjIndividualAssessment  $obj)

Delete settings entry corresponding to obj.

Parameters
ilObjIndividualAssessment$obj
Returns
ilIndividualAssessmentSettings $settings

Implements ilIndividualAssessmentSettingsStorage.

Definition at line 137 of file class.ilIndividualAssessmentSettingsStorageDB.php.

References array, and ilObject\getId().

138  {
139  $sql = "DELETE FROM " . self::IASS_SETTINGS_TABLE . " WHERE obj_id = %s";
140  $this->db->manipulateF($sql, array("integer"), array($obj->getId()));
141 
142  $sql = "DELETE FROM " . self::IASS_SETTINGS_INFO_TABLE . " WHERE obj_id = %s";
143  $this->db->manipulateF($sql, array("integer"), array($obj->getId()));
144  }
getId()
get object id public
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ loadInfoSettings()

ilIndividualAssessmentSettingsStorageDB::loadInfoSettings ( ilObjIndividualAssessment  $obj)

Load info-screen settings corresponding to obj.

Parameters
ilObjIndividualAssessment$obj
Returns
ilIndividualAssessmentSettings $settings

Implements ilIndividualAssessmentSettingsStorage.

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

References $res, ilObject\_exists(), and ilObject\getId().

92  {
93  if (ilObjIndividualAssessment::_exists($obj->getId(), false, 'iass')) {
94  $obj_id = $obj->getId();
95  assert('is_numeric($obj_id)');
96  $sql = "SELECT contact, responsibility, phone, mails, consultation_hours"
97  . " FROM " . self::IASS_SETTINGS_INFO_TABLE . " WHERE obj_id = " . $this->db->quote($obj_id, 'integer');
98 
99  if ($res = $this->db->fetchAssoc($this->db->query($sql))) {
101  $obj,
102  $res["contact"],
103  $res["responsibility"],
104  $res['phone'],
105  $res['mails'],
106  $res['consultation_hours']
107  );
108  }
109  throw new ilIndividualAssessmentException("$obj_id not in database");
110  } else {
111  return new ilIndividualAssessmentInfoSettings($obj);
112  }
113  }
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
foreach($_POST as $key=> $value) $res
getId()
get object id public
+ Here is the call graph for this function:

◆ loadSettings()

ilIndividualAssessmentSettingsStorageDB::loadSettings ( ilObjIndividualAssessment  $obj)

Load settings corresponding to obj.

Parameters
ilObjIndividualAssessment$obj
Returns
ilIndividualAssessmentSettings $settings

Implements ilIndividualAssessmentSettingsStorage.

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

References $res, ilObject\_exists(), and ilObject\getId().

46  {
47  if (ilObjIndividualAssessment::_exists($obj->getId(), false, 'iass')) {
48  $obj_id = $obj->getId();
49  assert('is_numeric($obj_id)');
50  $sql = "SELECT content, record_template, event_time_place_required, file_required\n"
51  . " FROM " . self::IASS_SETTINGS_TABLE . "\n"
52  . " WHERE obj_id = " . $this->db->quote($obj_id, 'integer');
53 
54  if ($res = $this->db->fetchAssoc($this->db->query($sql))) {
56  $obj,
57  $res["content"],
58  $res["record_template"],
59  (bool) $res["event_time_place_required"],
60  (bool) $res['file_required']
61  );
62  }
63  throw new ilIndividualAssessmentException("$obj_id not in database");
64  } else {
65  return new ilIndividualAssessmentSettings($obj);
66  }
67  }
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
An object carrying settings of an Individual Assessment obj beyond the standart information.
foreach($_POST as $key=> $value) $res
getId()
get object id public
+ Here is the call graph for this function:

◆ updateInfoSettings()

ilIndividualAssessmentSettingsStorageDB::updateInfoSettings ( ilIndividualAssessmentInfoSettings  $settings)

Update info-screen settings entry.

Parameters
ilIndividualAssessmentSettings$settings

Implements ilIndividualAssessmentSettingsStorage.

Definition at line 120 of file class.ilIndividualAssessmentSettingsStorageDB.php.

References array, ilIndividualAssessmentInfoSettings\consultationHours(), ilIndividualAssessmentInfoSettings\contact(), ilIndividualAssessmentInfoSettings\id(), ilIndividualAssessmentInfoSettings\mails(), ilIndividualAssessmentInfoSettings\phone(), and ilIndividualAssessmentInfoSettings\responsibility().

121  {
122  $where = array("obj_id" => array("integer", $settings->id()));
123 
124  $values = array( "contact" => array("text", $settings->contact())
125  , "responsibility" => array("text", $settings->responsibility())
126  , "phone" => array("text", $settings->phone())
127  , "mails" => array("text", $settings->mails())
128  , "consultation_hours" => array("text", $settings->consultationHours())
129  );
130 
131  $this->db->update(self::IASS_SETTINGS_INFO_TABLE, $values, $where);
132  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ updateSettings()

ilIndividualAssessmentSettingsStorageDB::updateSettings ( ilIndividualAssessmentSettings  $settings)

Update settings entry.

Parameters
ilIndividualAssessmentSettings$settings

Implements ilIndividualAssessmentSettingsStorage.

Definition at line 72 of file class.ilIndividualAssessmentSettingsStorageDB.php.

References array, ilIndividualAssessmentSettings\content(), ilIndividualAssessmentSettings\eventTimePlaceRequired(), ilIndividualAssessmentSettings\fileRequired(), ilIndividualAssessmentSettings\getId(), and ilIndividualAssessmentSettings\recordTemplate().

73  {
74  $where = array( "obj_id" => array("integer", $settings->getId()));
75 
76  $values = array( "content" => array("text", $settings->content())
77  , "record_template" => array("text", $settings->recordTemplate())
78  , "event_time_place_required" => array("integer", $settings->eventTimePlaceRequired())
79  , "file_required" => array("integer", $settings->fileRequired())
80  );
81 
82  $this->db->update(self::IASS_SETTINGS_TABLE, $values, $where);
83  }
eventTimePlaceRequired()
Get the value of the checkbox event_time_place_require.
recordTemplate()
Get the record template to be used as default record with corresponding object.
content()
Get the content of this assessment, e.g.
getId()
Get the id of corrwsponding iass-object.
fileRequired()
Get the value of the checkbox file_required.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilIndividualAssessmentSettingsStorageDB::$db
protected

Definition at line 18 of file class.ilIndividualAssessmentSettingsStorageDB.php.

Referenced by __construct().

◆ IASS_SETTINGS_INFO_TABLE

const ilIndividualAssessmentSettingsStorageDB::IASS_SETTINGS_INFO_TABLE = "iass_info_settings"

◆ IASS_SETTINGS_TABLE

const ilIndividualAssessmentSettingsStorageDB::IASS_SETTINGS_TABLE = "iass_settings"

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