You are here

function sheetnode_phpexcel_requirements in Sheetnode 7.2

Same name and namespace in other branches
  1. 5 modules/sheetnode_phpexcel/sheetnode_phpexcel.install \sheetnode_phpexcel_requirements()
  2. 6 modules/sheetnode_phpexcel/sheetnode_phpexcel.install \sheetnode_phpexcel_requirements()
  3. 7 modules/sheetnode_phpexcel/sheetnode_phpexcel.install \sheetnode_phpexcel_requirements()

Implementation of hook_requirements().

File

modules/sheetnode_phpexcel/sheetnode_phpexcel.install, line 10
Install, update and uninstall functions for the sheetnode_PHPExcel module.

Code

function sheetnode_phpexcel_requirements($phase) {
  $requirements = array();
  $t = get_t();
  if ($phase == 'runtime') {

    // PHPExcel library.
    $satisfied = _sheetnode_phpexcel_load_library(SHEETNODE_PHPEXCEL_LIBRARY);
    $requirements['sheetnode_phpexcel_library'] = array(
      'title' => $t('PHPExcel library'),
      'value' => $satisfied ? PHPExcel_Calculation_Functions::VERSION() : $t('Missing. Please adjust your paths at <a href="!url">Sheetnode PHPExcel settings page</a>.', array(
        '!url' => url('admin/config/content/sheetnode/phpexcel'),
      )),
      'severity' => $satisfied ? REQUIREMENT_OK : REQUIREMENT_ERROR,
    );

    // TCPDF library.
    $satisfied = _sheetnode_phpexcel_load_library(SHEETNODE_PHPEXCEL_PDF_RENDERER);
    if ($satisfied) {
      $tcPDF = new TCPDF();
      if (method_exists($tcPDF, 'getTCPDFVersion')) {
        $version = 'TCPDF ' . $tcPDF
          ->getTCPDFVersion();
      }
      else {
        $version = 'TCPDF ' . $t("(version unknown)");
      }
    }
    $requirements['sheetnode_phpexcel_pdf_renderer'] = array(
      'title' => $t('TCPDF library'),
      'value' => $satisfied ? $version : $t('Missing. Please adjust your paths at <a href="!url">Sheetnode PHPExcel settings page</a>.', array(
        '!url' => url('admin/config/content/sheetnode/phpexcel'),
      )),
      'severity' => $satisfied ? REQUIREMENT_OK : REQUIREMENT_ERROR,
    );
  }
  return $requirements;
}