Ignore:
Timestamp:
Jan 14, 2021, 7:38:26 PM (3 years ago)
Author:
chronos
Message:
  • Fixed: Correct typecasting of System class.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/System/System.php

    r895 r896  
    202202    $this->Manager->OnUninstallModel = array($this, 'UninstallModel');
    203203
    204     $this->System->RegisterPage(['module'], 'PageModules');
     204    Core::Cast($this->System)->RegisterPage(['module'], 'PageModules');
    205205    $this->System->FormManager->RegisterClass('Action', array(
    206206      'Title' => 'Akce',
     
    624624    throw new Exception('Expected ModuleSystem type but got '.gettype($AppModule));
    625625  }
     626
     627  function ShowAction(string $Id): string
     628  {
     629    $Output = '';
     630    $DbResult = $this->Database->query('SELECT *, `ActionIcon`.`Name` AS `Icon` FROM `Action` '.
     631      'LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '.
     632      'WHERE (`Action`.`Id`='.$Id.')');
     633    if ($DbResult->num_rows > 0)
     634    {
     635      $Action = $DbResult->fetch_assoc();
     636      if ($Action['Icon'] == '') $Action['Icon'] = 'clear.png';
     637      if (substr($Action['URL'], 0, 4) != 'http') $Action['URL'] = Core::Cast($this->System)->Link($Action['URL']);
     638      if (!defined('NEW_PERMISSION') or ModuleUser::Cast(Core::Cast($this->System)->GetModule('User'))->User->CheckPermission('System', 'Read', 'Item', $Id))
     639        $Output .= '<img alt="'.$Action['Title'].'" src="'.Core::Cast($this->System)->Link('/images/favicons/'.$Action['Icon']).
     640        '" width="16" height="16" /> <a href="'.$Action['URL'].'">'.$Action['Title'].'</a>';
     641    }
     642    return $Output;
     643  }
    626644}
Note: See TracChangeset for help on using the changeset viewer.