ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilIndividualAssessmentSettingsStorageDB.php
Go to the documentation of this file.
1<?php
2
9{
10 const IASS_SETTINGS_TABLE = "iass_settings";
11 const IASS_SETTINGS_INFO_TABLE = "iass_info_settings";
12
13 protected $db;
14 public function __construct($db)
15 {
16 $this->db = $db;
17 }
18
23 {
24 $values = array( "obj_id" => array("integer", $settings->getObjId())
25 , "content" => array("text", $settings->getContent())
26 , "record_template" => array("text", $settings->getRecordTemplate())
27 , "event_time_place_required" => array("integer", $settings->isEventTimePlaceRequired())
28 , "file_required" => array("integer", $settings->isFileRequired())
29 );
30
31 $this->db->insert(self::IASS_SETTINGS_TABLE, $values);
32
33 $values = array("obj_id" => array("integer", $settings->getObjId()));
34 $this->db->insert(self::IASS_SETTINGS_INFO_TABLE, $values);
35 }
36
41 {
42 if (ilObjIndividualAssessment::_exists($obj->getId(), false, 'iass')) {
43 $obj_id = $obj->getId();
44 assert(is_numeric($obj_id));
45 $sql = "SELECT content, record_template, event_time_place_required, file_required\n"
46 . " FROM " . self::IASS_SETTINGS_TABLE . "\n"
47 . " WHERE obj_id = " . $this->db->quote($obj_id, 'integer');
48
49 if ($res = $this->db->fetchAssoc($this->db->query($sql))) {
51 $obj->getId(),
52 $obj->getTitle(),
53 $obj->getDescription(),
54 $res["content"],
55 $res["record_template"],
56 (bool) $res["event_time_place_required"],
57 (bool) $res['file_required']
58 );
59 }
60 throw new ilIndividualAssessmentException("$obj_id not in database");
61 } else {
63 (int) $obj->getId(),
64 '',
65 '',
66 '',
67 '',
68 false,
69 false
70 );
71 }
72 }
73
78 {
79 $where = array( "obj_id" => array("integer", $settings->getObjId()));
80
81 $values = array( "content" => array("text", $settings->getContent())
82 , "record_template" => array("text", $settings->getRecordTemplate())
83 , "event_time_place_required" => array("integer", $settings->isEventTimePlaceRequired())
84 , "file_required" => array("integer", $settings->isFileRequired())
85 );
86
87 $this->db->update(self::IASS_SETTINGS_TABLE, $values, $where);
88 }
89
94 {
95 if (ilObjIndividualAssessment::_exists($obj->getId(), false, 'iass')) {
96 $obj_id = $obj->getId();
97 assert(is_numeric($obj_id));
98 $sql = "SELECT contact, responsibility, phone, mails, consultation_hours"
99 . " FROM " . self::IASS_SETTINGS_INFO_TABLE . " WHERE obj_id = " . $this->db->quote($obj_id, 'integer');
100
101 if ($res = $this->db->fetchAssoc($this->db->query($sql))) {
103 (int) $obj->getId(),
104 $res["contact"],
105 $res["responsibility"],
106 $res['phone'],
107 $res['mails'],
108 $res['consultation_hours']
109 );
110 }
111 throw new ilIndividualAssessmentException("$obj_id not in database");
112 } else {
113 return new ilIndividualAssessmentInfoSettings((int) $obj->getId());
114 }
115 }
116
123 {
124 $where = array("obj_id" => array("integer", $settings->getObjId()));
125
126 $values = array( "contact" => array("text", $settings->getContact())
127 , "responsibility" => array("text", $settings->getResponsibility())
128 , "phone" => array("text", $settings->getPhone())
129 , "mails" => array("text", $settings->getMails())
130 , "consultation_hours" => array("text", $settings->getConsultationHours())
131 );
132
133 $this->db->update(self::IASS_SETTINGS_INFO_TABLE, $values, $where);
134 }
135
140 {
141 $sql = "DELETE FROM " . self::IASS_SETTINGS_TABLE . " WHERE obj_id = %s";
142 $this->db->manipulateF($sql, array("integer"), array($obj->getId()));
143
144 $sql = "DELETE FROM " . self::IASS_SETTINGS_INFO_TABLE . " WHERE obj_id = %s";
145 $this->db->manipulateF($sql, array("integer"), array($obj->getId()));
146 }
147}
An exception for terminatinating execution or to throw for unit testing.
A settings storage handler to write iass settings to db.
updateSettings(ilIndividualAssessmentSettings $settings)
Update settings entry.
loadSettings(ilObjIndividualAssessment $obj)
Load settings corresponding to obj.
deleteSettings(ilObjIndividualAssessment $obj)
Delete settings entry corresponding to obj.
updateInfoSettings(ilIndividualAssessmentInfoSettings $settings)
Update info-screen settings entry.
loadInfoSettings(ilObjIndividualAssessment $obj)
Load info-screen settings corresponding to obj.
createSettings(ilIndividualAssessmentSettings $settings)
Create a entry corresponding to $settings.
An object carrying settings of an Individual Assessment obj beyond the standart information.
isEventTimePlaceRequired()
Get the value of the checkbox event_time_place_require.
isFileRequired()
Get the value of the checkbox file_required.
getObjId()
Get the id of corresponding iass-object.
getRecordTemplate()
Get the record template to be used as default record with corresponding object.
getContent()
Get the content of this assessment, e.g.
For the purpose of streamlining the grading and learning-process status definition outside of tests,...
getDescription()
get object description
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
getId()
get object id @access public
getTitle()
get object title @access public
A general storage interface for Individual assessment settings.
foreach($_POST as $key=> $value) $res