You are here

views_gantt.install in Views Gantt 7

Same filename and directory in other branches
  1. 7.2 views_gantt.install

Install, update and uninstall functions for the views_gantt module.

File

views_gantt.install
View source
<?php

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

/**
 * Implements hook_requirements().
 */
function views_gantt_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    $t = get_t();
    $library = libraries_detect('dhtmlxgantt');
    if (empty($library['installed'])) {
      $requirements['dhtmlxgantt'] = array(
        'title' => $t('dhtmlxGantt'),
        'severity' => REQUIREMENT_ERROR,
        'description' => $t('You need to download the !dhtmlxgantt, extract the archive
         and place files from the dhtmlxGantt folder in the %path directory on your server.', array(
          '!dhtmlxgantt' => l($t('dhtmlxGantt'), $library['download url']),
          '%path' => 'sites/all/libraries/dhtmlxgantt',
        )),
        'value' => $t('dhtmlxgantt %lib', array(
          '%lib' => $library['version'],
        )),
      );
    }
    else {
      $requirements['dhtmlxgantt'] = array(
        'title' => $t('dhtmlxGantt'),
        'severity' => REQUIREMENT_OK,
        'value' => $t('dhtmlxgantt %lib', array(
          '%lib' => $library['version'],
        )),
      );
    }
  }
  return $requirements;
}

/**
 * Implements hook_enable().
 */
function views_gantt_enable() {
  $library = libraries_detect('dhtmlxgantt');
  if (empty($library['installed'])) {
    $t = get_t();
    $message = $t('You need to download the !dhtmlxgantt, extract the archive
     and place files from the dhtmlxGantt folder in the %path directory on your server.', array(
      '!dhtmlxgantt' => l($t('dhtmlxGantt'), $library['download url']),
      '%path' => 'sites/all/libraries/dhtmlxgantt',
    ));
    drupal_set_message($message, 'warning');
  }
}

Functions