ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilIndividualAssessmentSettingsStorageDB.php
Go to the documentation of this file.
1 <?php
6 require_once 'Modules/IndividualAssessment/interfaces/Settings/interface.ilIndividualAssessmentSettingsStorage.php';
7 require_once 'Modules/IndividualAssessment/classes/Settings/class.ilIndividualAssessmentSettings.php';
8 require_once 'Modules/IndividualAssessment/classes/Settings/class.ilIndividualAssessmentInfoSettings.php';
9 require_once 'Modules/IndividualAssessment/classes/class.ilObjIndividualAssessment.php';
11 
12  protected $db;
13  public function __construct($db) {
14  $this->db = $db;
15  }
16 
20  public function createSettings(ilIndividualAssessmentSettings $settings) {
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 
30  public function loadSettings(ilObjIndividualAssessment $obj) {
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 
47  public function updateSettings(ilIndividualAssessmentSettings $settings) {
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))) {
66  return new ilIndividualAssessmentInfoSettings($obj,
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 {
75  return new ilIndividualAssessmentInfoSettings($obj);
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 }
loadInfoSettings(ilObjIndividualAssessment $obj)
Load info-screen settings corresponding to obj.
For the purpose of streamlining the grading and learning-process status definition outside of tests...
A settings storage handler to write iass settings to db.
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.
A general storage interface for Individual assessment settings.
recordTemplate()
Get the record template to be used as default record with corresponding object.
getId()
get object id public
updateSettings(ilIndividualAssessmentSettings $settings)
Update settings entry.
content()
Get the content of this assessment, e.g.
loadSettings(ilObjIndividualAssessment $obj)
Load settings corresponding to obj.ilIndividualAssessmentSettings $settings
getId()
Get the id of corrwsponding iass-object.
Create styles array
The data for the language used.
deleteSettings(ilObjIndividualAssessment $obj)
Delete settings entry corresponding to obj.ilIndividualAssessmentSettings $settings ...
createSettings(ilIndividualAssessmentSettings $settings)
Create a entry corresponding to $settings.
updateInfoSettings(ilIndividualAssessmentInfoSettings $settings)
Update info-screen settings entry.