Skip to content

Commit

Permalink
fixed import of rating fields
Browse files Browse the repository at this point in the history
  • Loading branch information
chfsx committed Jun 24, 2015
1 parent ad3ee0c commit c383d66
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ public function doUpdate() {
}

$this->db->insert("il_dcl_stloc" . $datatype->getStorageLocation() . "_value", array(
"value" => array( $datatype->getDbType(), $this->value ),
"record_field_id " => array( "integer", $this->id ),
"id" => array( "integer", $next_id )
));
"value" => array( $datatype->getDbType(), $this->value ),
"record_field_id " => array( "integer", $this->id ),
"id" => array( "integer", $next_id )
));
}


Expand Down Expand Up @@ -152,7 +152,7 @@ public function getValue() {
*/
public function setValue($value, $omit_parsing = false) {
$this->loadValue();
if (!$omit_parsing) {
if (! $omit_parsing) {
$tmp = $this->field->getDatatype()->parseValue($value, $this);
$old = $this->value;
//if parse value fails keep the old value
Expand Down Expand Up @@ -223,8 +223,13 @@ public function getSingleHTML() {
protected function loadValue() {
if ($this->value === NULL) {
$datatype = $this->field->getDatatype();
switch ($datatype->getId()) {
case ilDataCollectionDatatype::INPUTFORMAT_RATING:
return true;
}
$query = "SELECT * FROM il_dcl_stloc" . $datatype->getStorageLocation() . "_value WHERE record_field_id = "
. $this->db->quote($this->id, "integer");

$set = $this->db->query($query);
$rec = $this->db->fetchAssoc($set);
$this->value = $rec['value'];
Expand Down

0 comments on commit c383d66

Please sign in to comment.