| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: jcalendar.module,v 1.1.4.17 2010/11/21 12:24:45 karens Exp $ 3 4 /** 5 * @file 6 * jQuery Calendar UI features. 7 */ 8 9 /** 10 * Display help and module information 11 * @param section which section of the site we're displaying help 12 * @return help text for section 13 */ 14 function jcalendar_help($path, $arg) { 15 $output = ''; 16 switch ($path) { 17 case "admin/help#jcalendar": 18 $output = '<p>'. t("Creates a popup for calendar dates.") .'</p>'; 19 break; 20 } 21 return $output; 22 } // function jcalendar_help 23 24 /** 25 * Get calendar node for popup 26 * @param integer nid Node id. 27 * @param string id Date field unique id. 28 * @return string HTML for node 29 */ 30 function get_calendar_node($nid, $id) { 31 $GLOBALS['devel_shutdown'] = FALSE; 32 if (is_numeric($nid)) { 33 if ($node = node_load($nid)) { 34 if (node_access("view", $node)) { 35 $node->date_id = $id; 36 $node->date_repeat_show = FALSE; 37 print theme('jcalendar_view', $node); 38 } 39 } 40 }} 41 42 /** 43 * Implemetation of hook_menu() 44 */ 45 function jcalendar_menu() { 46 47 $items['jcalendar/getnode'] = array( 48 'title' => 'Get Calendar Node', 49 'page callback' => 'get_calendar_node', 50 'page arguments' => array(2, 3), 51 'access callback' => TRUE, 52 'type' => MENU_CALLBACK, 53 ); 54 return $items; 55 } 56 57 /** 58 * Override the calendar view to inject javascript. 59 * @param view Which view we are using. 60 * @return unknown as of yet. 61 */ 62 function jcalendar_views_pre_view(&$view, &$display_id) { 63 static $js_added = false; 64 if ($js_added) { 65 return; 66 } 67 foreach ($view->display as $display) { 68 if ($display->display_plugin == 'calendar') { 69 $js_added = true; 70 $path = drupal_get_path('module', 'jcalendar'); 71 $settings['jcalendar']['path'] = base_path() . $path; 72 drupal_add_js($settings, 'setting'); 73 drupal_add_js($path .'/jcalendar.js'); 74 drupal_add_css($path .'/jcalendar.css'); 75 } 76 } 77 } 78 79 /** 80 * Implementation of hook_theme(). 81 */ 82 function jcalendar_theme() { 83 return array( 84 'jcalendar_view' => array('arguments' => array('node' => NULL)), 85 ); 86 } 87 88 /** 89 * Overrideable theme for the jcalendar popup view. 90 * 91 * Defaults to show the standard teaser view of the node. 92 */ 93 function theme_jcalendar_view($node) { 94 $output = node_view($node, TRUE); 95 $output .= '<div id="nodelink">'. l(t('more', array(), $node->language), calendar_get_node_link($node)) .'</div>'; 96 return $output; 97 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |