You are here

agenda.install in Agenda 6.2

Same filename and directory in other branches
  1. 6 agenda.install
  2. 7.2 agenda.install
  3. 7 agenda.install

Install, uninstall and scheme functions for the agenda module.

File

agenda.install
View source
<?php

/**
 * @file
 * Install, uninstall and scheme functions for the agenda module.
 */

/**
 * Implementation of hook_uninstall().
 */
function agenda_uninstall() {
  drupal_uninstall_schema('agenda');
  variable_del('agenda_googleapi');
}

/**
 * Implementation of hook_install().
 */
function agenda_install() {
  drupal_install_schema('agenda');
  agenda_install_example_block();
}

/**
 *
 */
function agenda_update_6001() {
  $updates = array();
  agenda_install();
  db_query("DELETE FROM {variable} WHERE name LIKE 'agenda_%'");
  return $updates;
}

/**
 * Install an example block
 */
function agenda_install_example_block() {
  db_query("\n    INSERT INTO {agenda} (bid, name, value)\n    VALUES\n    \t(1,'noeventstext','<p>No upcoming events</p>'),\n    \t(1,'timeformat','h:ia'),\n    \t(1,'customdate','l, F jS'),\n    \t(1,'dateformat','custom'),\n    \t(1,'maxevents','60'),\n    \t(1,'datelimit','60'),\n    \t(1,'start','Feb 1st, 2009'),\n    \t(1,'end','April 1st, 2009'),\n    \t(1,'title','Example agenda block'),\n    \t(1,'linktext','View this event in Google Calendar'),\n      (1, 'hangoutlinktext', 'Join Google Calendar Event Hangout'),\n    \t(1,'cachetime','3600'),\n    \t(1,'display_keys','start time, end date, end time, published, description, link'),\n    \t(1,'hide_labels','description, link'),\n    \t(1,'calendars','drupalagenda@gmail.com')");
}

/**
 * Implementation of hook_schema().
 */
function agenda_schema() {
  $schema['agenda'] = array(
    'description' => t('Hold agenda settings'),
    'fields' => array(
      'id' => array(
        'description' => t('ID'),
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'disp-width' => '11',
      ),
      'bid' => array(
        'description' => t('Block ID'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
        'disp-width' => '11',
      ),
      'name' => array(
        'description' => t('Name of the setting'),
        'type' => 'varchar',
        'length' => 50,
        'not null' => TRUE,
      ),
      'value' => array(
        'description' => t('Value of the setting'),
        'type' => 'varchar',
        'length' => 1024,
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'unique keys' => array(
      'kvp' => array(
        'bid',
        'name',
      ),
    ),
    'indexes' => array(
      'bid' => array(
        'bid',
      ),
    ),
  );
  return $schema;
}

Functions

Namesort descending Description
agenda_install Implementation of hook_install().
agenda_install_example_block Install an example block
agenda_schema Implementation of hook_schema().
agenda_uninstall Implementation of hook_uninstall().
agenda_update_6001