Ejemplo n.º 1
0
 /**
  * Logs with an arbitrary level.
  *
  * @param mixed $level
  * @param string $message
  * @param array $context
  *
  * @return null
  */
 public function log($level, $message, array $context = array())
 {
     /** @var NotificationLog $oSCMSNotificationLog */
     $oSCMSNotificationLog = DataSource::factory(NotificationLog::cls());
     $oSCMSNotificationLog->code = 0;
     $oSCMSNotificationLog->type = $level;
     $oSCMSNotificationLog->message = addslashes(trim(strtr($message, $context)));
     $oSCMSNotificationLog->ip = $_SERVER["REMOTE_ADDR"];
     $oSCMSNotificationLog->date = date('Y-m-d H:i:s');
     $oSCMSNotificationLog->commit();
 }
Ejemplo n.º 2
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $view = new ViewConfiguration();
     /** @var NotificationLog $oNotificationLogs */
     $oNotificationLogs = DataSource::factory(NotificationLog::cls());
     /** @var NotificationLog[] $aNotificationLogs */
     $aNotificationLogs = $oNotificationLogs->findAll();
     $DataGrid = new DataGrid();
     $DataGrid->setCaption('Список параметров')->setAttributes(['class' => 'table table-bordered table-hover table-striped'])->addColumn((new Column())->setDisplayName('#')->setHeaderAttributes(['style' => 'text-align: center; vertical-align: middle;'])->switchOnCounter())->addColumn((new Column())->setDisplayName('Тип')->setValueName('type')->setHeaderAttributes(['style' => 'text-align: center; vertical-align: middle;'])->setCallback(function (NotificationLog $data) {
         echo $data->type;
     }))->addColumn((new Column())->setDisplayName('Сообщение')->setValueName('message')->setHeaderAttributes(['style' => 'text-align: center; vertical-align: middle;'])->setBodyAttributes(['class' => 'text-justify']))->addColumn((new Column())->setDisplayName('IP-адрес')->setValueName('ip')->setHeaderAttributes(['style' => 'text-align: center; vertical-align: middle;']))->setDataSet($aNotificationLogs);
     $view->DataGrid = $DataGrid;
     $this->getFrame()->bindView('content', $view)->render();
 }
Ejemplo n.º 3
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $ModuleInstaller = new ModuleInstaller();
     $view = new ViewMain();
     /** @var NotificationLog $oNotificationLogs */
     $oNotificationLogs = DataSource::factory(NotificationLog::cls());
     $oNotificationLogs->builder()->order('date', 'desc')->limit(100);
     /** @var NotificationLog[] $aNotificationLogs */
     $aNotificationLogs = $oNotificationLogs->findAll();
     $Select = new Select();
     DataSource::getCurrent()->query($Select->table('notification_log')->field('count(*)', 'count')->build());
     $logsCount = DataSource::getCurrent()->fetchAssoc()[0]['count'];
     $modulesManifests = $ModuleInstaller->findManifests();
     $view->aNotificationLogs = $aNotificationLogs;
     $view->modulesManifests = $modulesManifests;
     $view->logsCount = $logsCount;
     $this->Frame->bindView('content', $view);
     $this->Frame->render();
 }