Commit 6a6846d7 authored by Mindiell's avatar Mindiell
Browse files

First commit

parents
; $Id$
name = "Timeline"
description =
core = 6.x
package = "La Quadrature"
<?php
// $Id$
/**
* @file
* Installation file for lqdn_timeline module.
*
* @ingroup lqdn
*/
/**
* Implementation of hook_schema().
*/
function lqdn_timeline_schema() {
$schema['lqdn_timline'] = array(
'description' => '',
'fields' => array(
'eid' => array(
'description' => 'The primary identifier for an event.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE),
'did' => array(
'description' => 'The primary identifier for a dossier.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE),
'language' => array(
'description' => '',
'type' => 'varchar',
'length' => 10,
'not null' => TRUE,
'default' => ''),
'date' => array(
'description' => '',
'type' => 'int',
'not null' => TRUE,
'default' => ''),
'visible_date' => array(
'description' => '',
'type' => 'text',
'not null' => TRUE,
'default' => ''),
'content' => array(
'description' => '',
'type' => 'text',
'not null' => TRUE,
'default' => ''),
),
'indexes' => array(
),
'unique keys' => array(
),
'primary key' => array('eid'),
);
return $schema;
}
function lqdn_timeline_install() {
drupal_install_schema('lqdn_timeline');
}
function lqdn_timeline_uninstall() {
drupal_uninstall_schema('lqdn_timeline');
}
<?php
function lqdn_dossiers_block($op = 'list', $delta = 0, $edit = array()) {
global $language;
if ($op == 'list') {
$result = db_query("SELECT `did`, `machine_name` FROM {lqdn_dossiers}");
while ($data = db_fetch_object($result)) {
$blocks['timeline-' . $data->did]['info'] = t('Timeline of the dossier @dossier',
array('@dossier' =>$data->machine_name));
}
return $blocks;
}
elseif ($op == 'view') {
$query = "
SELECT d.`did`, d.`machine_name`, c.`name`, c.`language`
FROM {lqdn_dossiers} d
LEFT JOIN {lqdn_dossiers_contents} c
ON d.`did` = c.`did` AND c.`language` = '%s'
";
$result = db_query($query, $language->language);
while ($data = db_fetch_object($result)) {
if ($delta == 'timeline-' . $data->did) {
$block['subject'] = $data->name;
$block['content'] = _lqdn_timeline_block($data);
return $block;
}
}
}
}
function _lqdn_timeline_block($_dossier) {
$query = "SELECT * FROM {lqdn_timeline} WHERE `did`='%d' AND `language`='%s'";
$result = db_query($query, $_dossier->did, $_dossier->language);
$events = array();
while ($data = db_fetch_object($result))
$events[] = $data;
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment