You are here

charts_graphs_amcharts.install in Charts and Graphs 7

Same filename and directory in other branches
  1. 6.2 apis/charts_graphs_amcharts/charts_graphs_amcharts.install

Install file for amCharts submodule.

File

apis/charts_graphs_amcharts/charts_graphs_amcharts.install
View source
<?php

/**
 * @file
 *   Install file for amCharts submodule.
 *
 */

/**
 * Implements hook_requirements().
 */
function charts_graphs_amcharts_requirements($phase) {
  $requirements = array();

  // Ensure translations don't break at install time.
  $t = get_t();
  if ($phase == 'runtime') {
    $path = dirname(realpath(__FILE__)) . '/downloaded/';
    $installation_instructions_path = module_exists('advanced_help') ? 'help/charts_graphs/amcharts' : 'http://drupal.org/node/681928';
    $file = 'amcolumn.swf';
    if (!file_exists($path . $file)) {
      $requirements['amcharts_' . $file] = array(
        'title' => $t('amCharts %file file', array(
          '%file' => $file,
        )),
        'description' => $t('amCharts for Charts and Graphs needs the %file file
          to work properly. Please review amCharts !installation_instructions.', array(
          '%file' => $file,
          '!installation_instructions' => l(t('installation instructions'), $installation_instructions_path),
        )),
        'severity' => REQUIREMENT_ERROR,
        'value' => $t('Unavailable'),
      );
    }
    $file = 'amline.swf';
    if (!file_exists($path . $file)) {
      $requirements['amcharts_' . $file] = array(
        'title' => $t('amCharts %file file', array(
          '%file' => $file,
        )),
        'description' => $t('amCharts for Charts and Graphs needs the %file file
          to work properly. Please review amCharts !installation_instructions.', array(
          '%file' => $file,
          '!installation_instructions' => l(t('installation instructions'), $installation_instructions_path),
        )),
        'severity' => REQUIREMENT_ERROR,
        'value' => $t('Unavailable'),
      );
    }
    $file = 'ampie.swf';
    if (!file_exists($path . $file)) {
      $requirements['amcharts_' . $file] = array(
        'title' => $t('amCharts %file file', array(
          '%file' => $file,
        )),
        'description' => $t('amCharts for Charts and Graphsneeds the %file file
          to work properly. Please review amCharts !installation_instructions.', array(
          '%file' => $file,
          '!installation_instructions' => l(t('installation instructions'), $installation_instructions_path),
        )),
        'severity' => REQUIREMENT_ERROR,
        'value' => $t('Unavailable'),
      );
    }
    if (!class_exists('DOMDocument')) {
      $requirements['amcharts_dom_support'] = array(
        'title' => $t('DOM support in PHP'),
        'description' => $t('amCharts for Charts and Graphs needs DOM support in
          PHP. Please review amCharts !installation_instructions and enable it.', array(
          '!installation_instructions' => l(t('installation instructions'), $installation_instructions_path),
        )),
        'severity' => REQUIREMENT_ERROR,
        'value' => $t('Unavailable'),
      );
    }
  }
  return $requirements;
}

Functions