You are here

public function InstapageCmsPluginDebugLogModel::getLogHTML in Instapage plugin 8.3

Same name and namespace in other branches
  1. 7.3 core/models/InstapageCmsPluginDebugLogModel.php \InstapageCmsPluginDebugLogModel::getLogHTML()

Gets the HTML with debug log. Template for th og is in /templates/log.php file.

Return value

string Log in HTML format.

File

core/models/InstapageCmsPluginDebugLogModel.php, line 111

Class

InstapageCmsPluginDebugLogModel
Class responsible for storing the data in debug log.

Code

public function getLogHTML() {
  if (InstapageCmsPluginConnector::currentUserCanManage() && $this
    ->isDiagnosticMode()) {
    try {
      $pluginsHtml = InstapageCmsPluginConnector::getSelectedConnector()
        ->getPluginsDebugHTML();
      $optionsHtml = InstapageCmsPluginConnector::getSelectedConnector()
        ->getOptionsDebugHTML();
      $phpinfoHtml = $this
        ->getPhpInfoHTML();
      $rows = $this
        ->read();
      $view = InstapageCmsPluginViewModel::getInstance();
      $view
        ->init(INSTAPAGE_PLUGIN_PATH . '/templates/log.php');
      $view->rows = $rows;
      $view->currentDate = date("Ymd_His");
      $view->dbStructure = $this
        ->getDbStructure();
      $view->pluginsHtml = $pluginsHtml;
      $view->optionsHtml = $optionsHtml;
      $view->phpinfoHtml = $phpinfoHtml;
      $html = $view
        ->fetch();
      return $html;
    } catch (Exception $e) {
      throw $e;
    }
  }
  else {
    throw new Exception(__('Instapage log can be downloaded only in diagnostic mode.'));
  }
}