/** * update objects custom data * @return boolean */ protected function updateCustomData() { parent::updateCustomData(); /* saving template data to templates and templates_structure tables */ $p =& $this->data; $data = $this->collectCustomModelData(); $data['template_id'] = $this->detectParentTemplate(); DM\TemplatesStructure::update($data); }
/** * update objects custom data * @return void */ protected function updateCustomData() { parent::updateCustomData(); $updated = DM\Files::update(array('id' => $this->id, 'content_id' => @$this->data['content_id'], 'date' => @$this->data['date'], 'name' => @$this->data['name'], 'cid' => @$this->data['cid'], 'uid' => User::getId())); //create record if doesnt exist yet if (!$updated) { DM\Files::create(array('id' => $this->id, 'content_id' => @$this->data['content_id'], 'date' => @$this->data['date'], 'name' => @$this->data['name'], 'cid' => @$this->data['cid'])); } }
/** * update objects custom data * @return boolean */ protected function updateCustomData() { parent::updateCustomData(); /* saving template data to templates and templates_structure tables */ $data = $this->collectCustomModelData(); unset($data['id']); if (!empty($data)) { $data['id'] = $this->id; DM\Templates::update($data); } }
/** * update objects custom data * @return void */ protected function updateCustomData() { parent::updateCustomData(); $od = $this->oldObject->getData(); $id = DM\Config::toId($od['data']['_title'], 'param'); $d =& $this->data; $dd =& $d['data']; $p = array('id' => $id, 'pid' => empty($d['pid']) ? null : $this->getDMPid($d['pid']), 'param' => $dd['_title'], 'value' => empty($dd['value']) ? '' : $dd['value']); if (isset($dd['order'])) { $p['order'] = $dd['order']; } DM\Config::update($p); }
/** * update objects custom data * @return boolean */ protected function updateCustomData() { parent::updateCustomData(); /* saving template data to templates and templates_structure tables */ $p =& $this->data; $data = $this->collectCustomModelData(); $data['id'] = $this->id; $data['template_id'] = $this->detectParentTemplate(); DM\TemplatesStructure::update($data); if ($this->isSolrConfigUpdated()) { $tpl = \CB\Objects::getCachedObject($data['template_id']); $tpl->setSysDataProperty('solrConfigUpdated', true); } }
/** * update objects custom data * @return void */ protected function updateCustomData() { parent::updateCustomData(); $d =& $this->data; $dd =& $d['data']; $p = array('id' => $d['id'], 'pid' => empty($d['pid']) ? null : $this->getDMPid($d['pid']), 'param' => $dd['_title'], 'value' => empty($dd['value']) ? '' : $dd['value']); if (isset($dd['order'])) { $p['order'] = $dd['order']; } if (DM\Config::exists($d['id'])) { DM\Config::update($p); } else { DM\Config::create($p); } }
/** * update objects custom data * @return boolean */ protected function updateCustomData() { parent::updateCustomData(); /* saving template data to templates and templates_structure tables */ $p =& $this->data; $saveFields = array('template_id'); $saveValues = array($this->id, $this->detectParentTemplate()); $params = array('template_id = $2'); $i = 3; $dataParams = $this->getParamsFromData(); foreach ($dataParams as $k => $v) { $saveFields[] = $k; $saveValues[] = $v; $params[] = "`{$k}` = \${$i}"; $i++; } if (!empty($saveFields)) { DB\dbQuery('UPDATE templates_structure SET ' . implode(',', $params) . ' WHERE id = $1', $saveValues) or die(DB\dbQueryError()); } }
/** * update objects custom data * @return boolean */ protected function updateCustomData() { parent::updateCustomData(); /* saving template data to templates and templates_structure tables */ $p =& $this->data; $saveFields = array(); $saveValues = array($this->id); $params = array(); $i = 2; foreach ($this->tableFields as $fieldName) { $field = null; if (!empty($this->template)) { $field = $this->template->getField($fieldName); } if (isset($p[$fieldName]) && $fieldName !== 'id') { $value = $p[$fieldName]; $value = is_scalar($value) || is_null($value) ? $value : Util\jsonEncode($value); $saveFields[] = $fieldName; $saveValues[] = $value; $params[] = "`{$fieldName}` = \${$i}"; $i++; } elseif (!empty($field)) { $value = @$this->getFieldValue($fieldName, 0)['value']; $value = is_scalar($value) || is_null($value) ? $value : Util\jsonEncode($value); $saveFields[] = $fieldName; $saveValues[] = $value; $params[] = "`{$fieldName}` = \${$i}"; $i++; } else { // this if should be removed after complete migration to language abreviation titles if (in_array($fieldName, array('l1', 'l2', 'l3', 'l4'))) { $lang = @\CB\Config::get('languages')[$fieldName[1] - 1]; if (!empty($lang)) { $value = @$this->getFieldValue($lang, 0)['value']; $saveFields[] = $fieldName; $saveValues[] = $value; $params[] = "`{$fieldName}` = \${$i}"; $i++; } } } } if (!empty($saveFields)) { DB\dbQuery('UPDATE templates SET ' . implode(',', $params) . ' WHERE id = $1', $saveValues) or die(DB\dbQueryError()); } $this->saveFields(); }
/** * update objects custom data * @return void */ protected function updateCustomData() { parent::updateCustomData(); $res = DB\dbQuery('INSERT INTO files (id ,content_id ,`date` ,`name` ,`cid` ) VALUES ( $1 ,$2 ,$3 ,$4 ,$5 ) ON DUPLICATE KEY UPDATE content_id = COALESCE($2, content_id) ,`date` = $3 ,name = $4 ,cid = $5 ,uid = $6', array($this->id, @$this->data['content_id'], @$this->data['date'], @$this->data['name'], @$this->data['cid'], $_SESSION['user']['id'])) or die(DB\dbQueryError()); }
/** * update objects custom data * @return boolean */ protected function updateCustomData() { $d =& $this->data; $sd =& $d['sys_data']; /** add newly assigned users to followers */ $oldAssigned = array(); if (!empty($this->oldObject)) { $oldAssigned = Util\toNumericArray(@$this->oldObject->getFieldValue('assigned', 0)['value']); } $newAssigned = Util\toNumericArray(@$this->getFieldValue('assigned', 0)['value']); $diff = array_diff($newAssigned, $oldAssigned); $fu = empty($sd['fu']) ? array() : $sd['fu']; $sd['fu'] = array_unique(array_merge($fu, $diff)); //call parent class to do the rest parent::updateCustomData(); }