Ferreteria/v0.6/clade/Sys/Data/Engine/aux/ActionRq/Admin

From Woozle Writes Code
Jump to navigation Jump to search
clade: Sys\Data\Engine\aux\ActionRq\Admin
Clade Family

[c,i] ActionRq
[t] Schema

Admin
Clade Aliases
Alias Clade
Base* [c,i] Sys\Data\Engine\aux\ActionRq
DbConnAdmin Sys\Data\Engine\Conn
Subpages

History

  • 2024-11-22 started
  • 2025-02-02 added Engine and Schema traits
  • 2025-09-23 re-parented to new ActionRq clade; renamed AdminRq ⇒ Admin
  • 2025-10-11 moved ListHosts() here from Admin/ToDbOper so it's also available to ToSchema classes
  • 2026-03-08
    • Swapped tAdmin's code back into caAdmin, because nothing uses tAdmin anymore and I might want to add a thing here (not sure yet).
    • Removed GoSetupUI() (which was a bit of a kluge anyway).
      • Was: CableAdmin::OPanel(AppAdmin::Me()->OPanel()); // set the Panel object to use for comm ops

Code

interface iAdmin extends BaseIface {
    function Go();
}
abstract class caAdmin extends BaseClass implements iAdmin {

    // ++ OUTPUT: actual ++ //

    public function ListHosts() : string {
        #echo $this->ReflectThis()->Report();

        $oScrn = self::Screen();

        $oaDBs = CableAdmin::ObjectRoster();

        $nDBs = $oaDBs->Count();
        if ($nDBs > 0) {
            $oTable = $oScrn->NewTable();
            $sS = ($nDBs == 1) ? '' : 's';
            $sOut = $oScrn->InfoIt($nDBs)." available DB connection$sS:".CRLF;
            $oHdr = $oTable->RowFromData(['name','specs']);
            $oHdr->IsHeader(TRUE);
            $oaDBs->RewindMe();
            foreach ($oaDBs->GetVals() as $sKey => $oConn) {
                $sVal = (is_null($oConn) ? '(BUG: missing!)' : $oConn->DescribeInline());
                $arRow = [$sKey,$sVal];
                $oTable->RowFromData($arRow);
            }
            $sOut .= $oTable->Render();
        } else {
            $sOut = 'No database connections are defined yet.'.CRLF;
        }
        return $sOut;
    }

    // -- OUTPUT -- //
}