ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilIndividualAssessmentSettingsStorageDB.php
Go to the documentation of this file.
1<?php
6require_once 'Modules/IndividualAssessment/interfaces/Settings/interface.ilIndividualAssessmentSettingsStorage.php';
7require_once 'Modules/IndividualAssessment/classes/Settings/class.ilIndividualAssessmentSettings.php';
8require_once 'Modules/IndividualAssessment/classes/Settings/class.ilIndividualAssessmentInfoSettings.php';
9require_once 'Modules/IndividualAssessment/classes/class.ilObjIndividualAssessment.php';
11
12 protected $db;
13 public function __construct($db) {
14 $this->db = $db;
15 }
16
21 $sql = "INSERT INTO iass_settings (content,record_template,obj_id) VALUES (%s,%s,%s)";
22 $this->db->manipulateF($sql,array("text","text","integer"),array($settings->content(),$settings->recordTemplate(),$settings->getId()));
23 $sql = "INSERT INTO iass_info_settings (obj_id) VALUES (%s)";
24 $this->db->manipulateF($sql,array("integer"),array($settings->getId()));
25 }
26
31 if(ilObjIndividualAssessment::_exists($obj->getId(), false, 'iass')) {
32 $obj_id = $obj->getId();
33 assert('is_numeric($obj_id)');
34 $sql = 'SELECT content, record_template FROM iass_settings WHERE obj_id = '.$this->db->quote($obj_id,'integer');
35 if($res = $this->db->fetchAssoc($this->db->query($sql))) {
36 return new ilIndividualAssessmentSettings($obj, $res["content"],$res["record_template"]);
37 }
38 throw new ilIndividualAssessmentException("$obj_id not in database");
39 } else {
41 }
42 }
43
48 $sql = 'UPDATE iass_settings SET content = %s,record_template = %s WHERE obj_id = %s';
49 $this->db->manipulateF($sql,array("text","text","integer"),array($settings->content(),$settings->recordTemplate(),$settings->getId()));
50 }
51
52
60 if(ilObjIndividualAssessment::_exists($obj->getId(), false, 'iass')) {
61 $obj_id = $obj->getId();
62 assert('is_numeric($obj_id)');
63 $sql = 'SELECT contact, responsibility, phone, mails, consultation_hours'
64 .' FROM iass_info_settings WHERE obj_id = '.$this->db->quote($obj_id,'integer');
65 if($res = $this->db->fetchAssoc($this->db->query($sql))) {
67 $res["contact"]
68 ,$res["responsibility"]
69 ,$res['phone']
70 ,$res['mails']
71 ,$res['consultation_hours']);
72 }
73 throw new ilIndividualAssessmentException("$obj_id not in database");
74 } else {
76 }
77 }
78
85 $sql = 'UPDATE iass_info_settings SET '
86 .' contact = %s'
87 .' ,responsibility = %s'
88 .' ,phone = %s'
89 .' ,mails = %s'
90 .' ,consultation_hours = %s'
91 .' WHERE obj_id = %s';
92 $this->db->manipulateF($sql,array('text','text','text','text','text','integer'),
93 array( $settings->contact()
94 ,$settings->responsibility()
95 ,$settings->phone()
96 ,$settings->mails()
97 ,$settings->consultationHours()
98 ,$settings->id()));
99 }
100
105 $sql = 'DELETE FROM iass_settings WHERE obj_id = %s';
106 $this->db->manipulateF($sql,array("integer"),array($obj->getId()));
107 $sql = 'DELETE FROM iass_info_settings WHERE obj_id = %s';
108 $this->db->manipulateF($sql,array("integer"),array($obj->getId()));
109 }
110}
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.ilIndividualAssessmentSettings $settings
deleteSettings(ilObjIndividualAssessment $obj)
Delete settings entry corresponding to obj.ilIndividualAssessmentSettings $settings
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.
getId()
Get the id of corrwsponding iass-object.
content()
Get the content of this assessment, e.g.
recordTemplate()
Get the record template to be used as default record with corresponding object.
For the purpose of streamlining the grading and learning-process status definition outside of tests,...
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
A general storage interface for Individual assessment settings.