- $sql .= $comma.'('.implode(',',array_map(array($this,'quote'), $row)).')';
+ $row_quoted = array_map(array($this,'quote'), $row); //Check
+ if($history) {
+ foreach($row as $column => $value) {
+ switch($column) {
+ case $table.'_valid_from':
+ $row_quoted[$column] = 'NOW()';
+ break;
+ case $table.'_valid_till':
+ $row_quoted[$column] = '0';
+ break;
+ case $table.'_author':
+ $row_quoted[$column] = $this->lms->get_authorized_user_id();
+ //die($this->lms->get_authorized_user_id().'=USER');
+ break;
+ }
+ }
+ }
+ $sql .= $comma.'('.implode(',',$row_quoted).')';