/** * Update the plain fields from the form fields * * @return void */ function updatePlainFields() { if ($this->last_update === "") { $this->last_update = CMbDT::dateTime(); } parent::updatePlainFields(); }
/** * @see parent::updatePlainFields() */ function updatePlainFields() { parent::updatePlainFields(); if ($this->_type) { list($this->object_class, $this->object_id) = explode("-", $this->_type); $this->_type = null; } if ($this->_before && $this->_before != $this->_id) { $next_object = new self(); $next_object->load($this->_before); if ($next_object->_id) { $query = ''; $table = $this->_spec->table; if ($this->position) { $query = "AND `{$table}`.`position` BETWEEN {$next_object->position} AND {$this->position}"; } else { if ($next_object->position) { $query = "AND `{$table}`.`position` >= {$next_object->position}"; } } $where = array("`{$table}`.`position` IS NOT NULL {$query}", "`{$table}`.`object_class` = '{$this->object_class}'", "`{$table}`.`object_id` = '{$this->object_id}'"); $this->position = $next_object->position; /** @var self[] $next_objects */ $next_objects = $this->loadList($where); foreach ($next_objects as &$object) { $object->position++; $object->store(); } if (count($next_objects) == 0) { $next_object->position = 2; $next_object->store(); $this->position = 1; } } $this->_before = null; } else { if (!$this->_id && !$this->position) { $existing = $this->loadList(null, "position"); if ($location = end($existing)) { $this->position = $location->position + 1; } else { $this->position = 1; } } } }
/** * @see parent::updatePlainFields() */ function updatePlainFields() { parent::updatePlainFields(); if ($this->_fields) { $this->fields = implode(" ", $this->_fields); } }