oAttDef = $oAttDef; $this->sAttCode = $sAttCode; $this->sObjectClass = $sObjectClass; $this->oDbObject = $oDbObject; // Initialization $this->Init(); // UI Initialization $this->InitUI($oPage); } /** * Init. * * @return void * @throws \Exception */ private function Init() { $this->sTargetClass = $this->GetTargetClass(); } /** * Initialize UI. * * @return void * @throws \CoreException */ private function InitUI(\WebPage $oPage) { // header $this->InitHeader();; // Table $this->InitTable($oPage); } /** * InitHeader. * * @return void * @throws \CoreException */ private function InitHeader() { // MedallionIcon $oClassIcon = new MedallionIcon(MetaModel::GetClassIcon($this->sTargetClass, false)); $oClassIcon->SetDescription($this->oAttDef->GetDescription())->AddCSSClass('ibo-block-list--medallion'); $this->AddSubBlock($oClassIcon); } /** * InitTable. * * @param \WebPage $oPage * * @return void * @throws \ApplicationException * @throws \ArchivedObjectException * @throws \CoreException * @throws \CoreWarning * @throws \DictExceptionMissingString * @throws \MySQLException */ private function InitTable(\WebPage $oPage) { // retrieve db object set $oOrmLinkSet = $this->oDbObject->Get($this->sAttCode); $oLinkSet = $oOrmLinkSet->ToDBObjectSet(\utils::ShowObsoleteData()); // add list block $oBlock = new \DisplayBlock($oLinkSet->GetFilter(), 'list', false); $this->AddSubBlock($oBlock->GetRenderContent($oPage, $this->GetExtraParam(), 'rel_'.$this->sAttCode)); } /** * GetTableId. * * @return string table identifier */ protected function GetTableId(): string { return $this->sObjectClass.'_'.$this->sAttCode; } /** * GetDoNotShowAgainPreferenceKey. * * @return string do not show again preference key */ protected function GetDoNotShowAgainPreferenceKey(): string { return "{$this->GetTableId()}.remove_link.do_not_show_again"; } /** * GetExtraParam. * * Provide parameters for display block as list. * * @see \DisplayBlock::RenderList * * @return array * @throws \ArchivedObjectException * @throws \CoreException */ abstract function GetExtraParam(): array; /** * Return row actions. * * Register row actions for table. * * @see \Combodo\iTop\Application\UI\Base\Component\DataTable\tTableRowActions * * @return \string[][] */ abstract function GetRowActions(): array; /** * GetTargetClass. * * Return link set target class. * * @return string * @throws \Exception */ abstract function GetTargetClass(): string; }