<?php
// $Id$
/**
* @file
* Adds a politiker stopp button.
*
* @TODO
* Only shown for certain roles.
* Add block with a banner.
*/
/**
* politiker_stopp.module
*
* @author
* Daniel Wehner <daniel.wehner@erdfisch.de>
*/
/**
* Implementation of hook_footer().
*/
function politiker_stopp_footer() {
return theme('politiker_stopp_footer');
}
/**
* Implementation of hook_init().
*/
function politiker_stopp_init() {
drupal_add_css(drupal_get_path('module', 'politiker_stopp') .'/politiker_stopp.css');
}
/**
* Implementation of hook_theme().
*/
function politiker_stopp_theme() {
return array(
'politiker_stopp_footer' => array(
'template' => 'politiker-stopp-footer',
),
'politiker_stopp_banner' => array(
),
);
}
/**
* Implementation of hook_block().
*/
function politiker_stopp_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks = array();
$blocks[0] = array(
'info' => t('Politiker Stopp Banner'),
);
return $blocks;
case 'view':
switch ($delta) {
case 0:
// @TODO add theme function and display the banner as block.
$block = array(
'subject' => '',
'content' => theme('politiker_stopp_banner'),
);
return $block;
}
}
}
/**
* @TODO need comments.
*/
function theme_politiker_stopp_banner() {
$output = '';
// @TODO Theme image does not work??
$image = theme('image', 'http://gfx.politiker-stopp.de/politiker-stopp-button.png');
$output .= l($image, 'http://www.politiker-stopp.de', array('html' => TRUE, 'attributes' => array('target' => '_blank')));
return $output;
}