You are here

sheetnode_phpexcel.install in Sheetnode 7.2

Install, update and uninstall functions for the sheetnode_PHPExcel module.

File

modules/sheetnode_phpexcel/sheetnode_phpexcel.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the sheetnode_PHPExcel module.
 */

/**
 * Implementation of hook_requirements().
 */
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;
}

/**
 * Implementation of hook_uninstall().
 */
function sheetnode_phpexcel_uninstall() {
  variable_del('sheetnode_phpexcel_library_path');
  variable_del('sheetnode_phpexcel_export_links');
  variable_del('sheetnode_phpexcel_pdf_renderer_path');
}

Functions