protected function loadData() { $data = parent::loadData(); if ($this->getState() == 'getRawData' && $this->getParam('siteID') && is_array($data)) { $props = array(); foreach ($data as $key => $value) { $props[$value['prop_name']][$key] = intval($value['site_id']); } /** * При формировании массива $props, site_id = null * превращается в site_id = 0. */ array_walk($props, function ($row) use(&$data) { if (in_array(0, $row) && in_array($this->getParam('siteID'), $row)) { $keyToUnset = array_search(0, $row); if (false !== $keyToUnset) { unset($data[$keyToUnset]); } } }); /** * Вычисляем значение prop_is_default. */ $data = array_map(function ($row) { $row['prop_is_default'] = is_null($row['site_id']); return $row; }, $data); } return $data; }
/** * @copydoc Grid::loadData */ public function loadData() { $result = parent::loadData(); if ($this->getState() == 'save' && isset($result[0]['lang_default']) && $result[0]['lang_default'] !== '0') { $this->dbh->modify(QAL::UPDATE, $this->getTableName(), ['lang_default' => null]); } return $result; }
protected function loadData() { $result = parent::loadData(); if ($result && $this->getDataDescription()->getFieldDescriptionByName('domain_url')) { $result = array_map(function ($row) { $result['domain_id'] = $row['domain_id']; $result['domain_url'] = $row['domain_protocol'] . '://' . $row['domain_host'] . ($row['domain_port'] != 80 ? ':' . $row['domain_port'] : '') . $row['domain_root']; return $result; }, $result); } return $result; }
/** * @copydoc Grid::loadData */ protected function loadData() { $result = parent::loadData(); if ($this->getState() == 'save') { foreach ($this->uniqueFields as $fieldName) { if (isset($result[0][$fieldName]) && $result[0][$fieldName]) { $this->dbh->modify(QAL::UPDATE, $this->getTableName(), [$fieldName => null]); } } } return $result; }
protected function loadData() { $result = parent::loadData(); if (in_array($this->getType(), [self::COMPONENT_TYPE_LIST]) && is_array($result)) { $result = array_map(function ($row) { $row['u_real_name'] = $row['u_name']; $row['u_name'] = $row['u_real_name'] . ' ' . $row['u_fullname']; return $row; }, $result); } return $result; }
protected function loadData() { $data = parent::loadData(); if ($this->getState() == 'getRawData' && $data) { $inverted = transpose($data); $upl_ids = $inverted['upl_id']; $res = $this->dbh->select('share_uploads', ['upl_id', 'upl_path', 'upl_title as upl_name', 'upl_duration'], ['upl_id' => $upl_ids]); foreach ($data as $i => $row) { if ($res) { $new_row = false; foreach ($res as $row2) { if ($row2['upl_id'] == $row['upl_id']) { $new_row = $row2; } } if ($new_row) { $data[$i]['upl_path'] = $new_row['upl_path']; $data[$i]['upl_name'] = $new_row['upl_name']; } } } } return $data; }
protected function loadData() { if ($this->getState() == 'showNewTemplateForm') { return false; } return parent::loadData(); }
/** * @copydoc Grid::loadData */ protected function loadData() { $result = parent::loadData(); if ($this->getState() == 'getRawData') { $sp = $this->getStateParams(true); $uplPID = !empty($sp['pid']) ? (int) $sp['pid'] : null; if (!$uplPID) { return $result; } // инстанс IFileRepository для текущего $uplPID $repo = $this->repoinfo->getRepositoryInstanceById($uplPID); $repo->prepare($result); if ($result) { foreach ($result as $i => $row) { $result[$i]['upl_allows_create_dir'] = $repo->allowsCreateDir(); $result[$i]['upl_allows_upload_file'] = $repo->allowsUploadFile(); $result[$i]['upl_allows_edit_dir'] = $repo->allowsEditDir(); $result[$i]['upl_allows_edit_file'] = $repo->allowsEditFile(); $result[$i]['upl_allows_delete_dir'] = $repo->allowsDeleteDir(); $result[$i]['upl_allows_delete_file'] = $repo->allowsDeleteFile(); } } } return $result; }
protected function loadData() { $result = parent::loadData(); /*if ($this->getState() == 'save') { $result[0]['u_password'] = sha1($result[0]['u_password']); } else*/ if ($this->getState() == 'getRawData' && $result) { $result = array_map(array($this, 'printUserGroups'), $result); } elseif ($this->getState() == 'edit') { $result[0]['u_password'] = ''; } elseif ($this->getState() == 'view') { $result[0]['u_password'] = ''; } return $result; }
protected function loadData() { $result = parent::loadData(); if ($result && $this->getState() == 'getRawData') { $params = $this->getStateParams(true); $result = array_map(function ($val) use($params) { $val["smap_segment"] = E()->getMap($params['site_id'])->getURLByID($val["smap_id"]); if ($this->getDataDescription()->getFieldDescriptionByName('site')) { $val["site"] = E()->getSiteManager()->getSiteByID($params['site_id'])->base; } return $val; }, $result); } return $result; }