/[drupal]/contributions/sandbox/alaa/image_pager/image_pager.module
ViewVC logotype

Contents of /contributions/sandbox/alaa/image_pager/image_pager.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Fri Oct 3 09:35:28 2008 UTC (13 months, 3 weeks ago) by alaa
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/x-php
adds next/prev pager for image galleries similar to forum
1 <?php ;
2 // $Id:$
3
4 /**
5 * @file
6 * Adds prev/next navigation links to image nodes belonging to galleries
7 */
8
9
10 /**
11 * Implementation of hook_nodeapi().
12 */
13 function image_pager_nodeapi(&$node, $op, $teaser, $page) {
14
15 if ($teaser) {
16 return;
17 }
18
19 //return if node is not an image
20 if ($node->type != 'image') {
21 return;
22 }
23
24 $vid = variable_get('image_gallery_nav_vocabulary', '');
25
26 //return if image_gallery__nav_vocabulary is not defined
27 //or vocabulary does not exist
28
29 if ($vid) {
30 $vocabulary = taxonomy_vocabulary_load($vid);
31 if (empty($vocabulary)) {
32 return;
33 }
34 } else {
35 return;
36 }
37
38 switch ($op) {
39 case 'view':
40 foreach ($node->taxonomy as $term) {
41 if ($term->vid == $vid) {
42 //TODO: handle images belonging to multiple galleries smoothly
43 $node->tid = $term->tid;
44 }
45 }
46
47 if ($node->tid) {
48 $node->content['forum_navigation'] = array(
49 '#value' => theme('forum_topic_navigation', $node),
50 '#weight' => 100,
51 );
52 }
53 break;
54 }
55 //$sort_order = variable_get('image_gallery_sort_order', IMAGE_GALLERY_SORT_CREATE_DESC);
56 }
57

  ViewVC Help
Powered by ViewVC 1.1.2