You are here

class Forena in Forena Reports 8

Hierarchy

Expanded class hierarchy of Forena

2 files declare their use of Forena
AjaxPageControllerBase.php in src/Controller/AjaxPageControllerBase.php
ForenaTest.php in tests/src/Unit/ForenaTest.php
8 string references to 'Forena'
forena.info.yml in ./forena.info.yml
forena.info.yml
forena.services.yml in ./forena.services.yml
forena.services.yml
ForenaInegrationTest::getInfo in src/Tests/ForenaInegrationTest.php
forena_pdf.info.yml in forena_pdf/forena_pdf.info.yml
forena_pdf/forena_pdf.info.yml
forena_query.info.yml in forena_query/forena_query.info.yml
forena_query/forena_query.info.yml

... See full list

1 service uses Forena
forena.reports in ./forena.services.yml
Drupal\forena\Forena

File

src/Forena.php, line 11

Namespace

Drupal\forena
View source
class Forena {
  use FrxAPI;
  protected static $instance;

  /**
   * Singleton
   * @return static
   */
  public static function service() {
    if (static::$instance === NULL) {
      static::$instance = new static();
    }
    return static::$instance;
  }
  public function report($report, $parms = []) {
    $content = ReportManager::instance()
      ->report($report, $parms);
    return $content;
  }
  public function setContext($id, $data) {
    $this
      ->setDataContext($id, $data);
  }

  /**
   * @param string $report
   *   Name of the report to run with format.
   * @param array $parms
   *   Parameters to apply to report
   * @return string
   *   The report text.
   */
  public function runReport($report, $parms = []) {
    $content = \Drupal\forena\ReportManager::instance()
      ->report($report, $parms);
    $d = \Drupal\forena\DocManager::instance();
    $doc_type = $d
      ->getDocumentType();
    $email_override = \Drupal::config('forena.settings')
      ->get('email_override');
    $user = \Drupal::currentUser();
    $email = $email_override ? $user
      ->getEmail() : '';
    switch ($doc_type) {
      case 'drupal':
        $content = $content['report']['#template'];
        break;
      case 'email':

        /** @var \Drupal\forena\FrxPlugin\Document\EmailMerge $merge */
        $merge = $d
          ->getDocument();
        $merge
          ->sendMail($email, 0);
        break;
    }
    return $content;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Forena::$instance protected static property
Forena::report public function Run a report with a particular format. Overrides FrxAPI::report
Forena::runReport public function
Forena::service public static function Singleton
Forena::setContext public function
FrxAPI::app public function Returns containing application service
FrxAPI::currentDataContext public function Get the current data context.
FrxAPI::currentDataContextArray public function
FrxAPI::dataManager public function Returns the data manager service
FrxAPI::dataService public function Return Data Service
FrxAPI::documentManager public function Returns the fornea document manager
FrxAPI::error public function Report an error
FrxAPI::getDataContext public function Get the context of a specific id.
FrxAPI::getDocument public function Get the current document
FrxAPI::getReportFileContents public function Load the contents of a file in the report file system.
FrxAPI::innerXML function Enter description here... 1
FrxAPI::popData public function Pop data off of the stack.
FrxAPI::pushData public function Push data onto the Stack
FrxAPI::reportFileSystem public function Get the current report file system.
FrxAPI::setDataContext public function Set Data context by id.
FrxAPI::setDocument public function Change to a specific document type.
FrxAPI::skins public function Get list of skins.