dereine / politiker_stopp

politiker_stopp

This URL has Read+Write access

politiker_stopp / politiker_stopp.module
100644 83 lines (73 sloc) 1.711 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?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;
}