calendar.views_default.inc 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. <?php
  2. /**
  3. * @file
  4. * Default views for the Calendar module.
  5. */
  6. /**
  7. * Set up so it can be used as an API to create default calendars for
  8. * specific date fields.
  9. *
  10. * Use variable_set() to establish criteria for default calendars.
  11. * Set the variable in custom modules or in settings.
  12. *
  13. * Example: Add a new default calendar to custom
  14. * calendars that are already configured:
  15. *
  16. * $options = variable_get('calendar_default_view_options', array());
  17. * $option = array(
  18. * 'name' => 'example_event',
  19. * 'description' => 'An example event calendar for the date field.',
  20. * 'path' => 'example_event',
  21. * 'types' => array('example_content_type'),
  22. * 'date_fields' => array('field_example_date'),
  23. * );
  24. * $options[] = $option;
  25. * variable_set('calendar_default_view_options', $options);
  26. *
  27. */
  28. function calendar_views_default_views() {
  29. $views = array();
  30. // Construct the default view with default options.
  31. $view = calendar_views_construct();
  32. $views[$view->name] = $view;
  33. // Then see if there are any custom calendars to be created
  34. // using variable_get().
  35. $calendar_options = variable_get('calendar_default_view_options', array());
  36. foreach ((array) $calendar_options as $calendar_option) {
  37. $view = calendar_views_construct($calendar_option);
  38. $views[$view->name] = $view;
  39. }
  40. return $views;
  41. }
  42. /**
  43. *
  44. * Construct a default calendar to match specified options.
  45. * Views calls it without options, so the basic
  46. * default view will use the default values.
  47. *
  48. * @param $options: an optional array of options to
  49. * create default calendars.
  50. *
  51. * Possible options include:
  52. * @param string $name:
  53. * The view name, if empty, defaults to 'calendar'.
  54. * @param string $description:
  55. * The view description, if empty, defaults to generic description.
  56. * @param string $path:
  57. * The view url, if empty, defaults to 'calendar'.
  58. * @param array $types:
  59. * Array of content types to limit the calendar to those types.
  60. * If empty, defaults to no type filter.
  61. * @param array $date_fields:
  62. * Date fields used to filter the calendar.
  63. * If empty, defaults to array('changed') for node.changed.
  64. * @param array $display_fields:
  65. * Fields to display in the calendar.
  66. * If empty, defaults to title and date fields.
  67. *
  68. * @return the default calendar array.
  69. */
  70. function calendar_views_construct($options = NULL) {
  71. $name = NULL;
  72. $description = NULL;
  73. $path = NULL;
  74. $types = NULL;
  75. $date_fields = NULL;
  76. if (empty($options)) {
  77. $disabled = TRUE;
  78. }
  79. else {
  80. $disabled = FALSE;
  81. extract($options);
  82. }
  83. if (empty($name)) {
  84. $name = 'calendar';
  85. }
  86. if (empty($description)) {
  87. $description = 'A multi-dimensional calendar view with back/next navigation.';
  88. }
  89. if (empty($path)) {
  90. $path = 'calendar';
  91. }
  92. if (empty($types)) {
  93. $types = array();
  94. }
  95. if (empty($date_fields)) {
  96. $date_fields = array('changed');
  97. }
  98. $colors = array();
  99. $date_link_type = '';
  100. foreach ($types as $type => $label) {
  101. $colors[0][$type] = '#ffffff';
  102. $date_link_type = $type;
  103. variable_set('calendar_date_link_' . $type, $path . '/month');
  104. }
  105. $type = '';
  106. if (!empty($types) && is_array($types) && count($types) > 0 ) {
  107. $types = array_keys($types);
  108. $type = $types[0];
  109. }
  110. // Can handle core node timestamp fields or Field date fields.
  111. $aliases = array();
  112. foreach ($date_fields as $field_name) {
  113. if (substr($field_name, 0, 6) == 'field_') {
  114. $table = 'field_data_' . $field_name;
  115. $alias = $table . '.' . $field_name . '_value';
  116. $cck_field = TRUE;
  117. }
  118. else {
  119. $table = 'node';
  120. $alias = $table . '.' . $field_name;
  121. $cck_field = FALSE;
  122. }
  123. $aliases[] = $alias;
  124. }
  125. $view = new view;
  126. $view->name = $name;
  127. $view->description = t("DEPRECATED: Create new calendars using 'add view from template'.") . ' ' . $description;
  128. $view->tag = 'Calendar';
  129. $view->base_table = 'node';
  130. $view->human_name = ucfirst($name) . ' ' . t("(DEPRECATED)");
  131. $view->core = 7;
  132. $view->api_version = '3.0-alpha1';
  133. $view->disabled = $name == 'calendar' ? TRUE : FALSE; /* Edit this to true to make a default view disabled initially */
  134. /* Display: Master */
  135. $handler = $view->new_display('default', 'Master', 'default');
  136. $handler->display->display_options['title'] = $name;
  137. $handler->display->display_options['link_display'] = 'page_1';
  138. $handler->display->display_options['access']['type'] = 'perm';
  139. $handler->display->display_options['cache']['type'] = 'none';
  140. $handler->display->display_options['query']['type'] = 'views_query';
  141. $handler->display->display_options['query']['options']['query_comment'] = FALSE;
  142. $handler->display->display_options['exposed_form']['type'] = 'basic';
  143. $handler->display->display_options['pager']['type'] = 'date_views_pager';
  144. $handler->display->display_options['pager']['options']['date_id'] = 'month';
  145. $handler->display->display_options['pager']['options']['pager_position'] = 'top';
  146. $handler->display->display_options['style_plugin'] = 'calendar_style';
  147. $handler->display->display_options['style_options']['name_size'] = '3';
  148. $handler->display->display_options['style_options']['with_weekno'] = '0';
  149. $handler->display->display_options['style_options']['multiday_theme'] = '1';
  150. $handler->display->display_options['style_options']['theme_style'] = '1';
  151. $handler->display->display_options['style_options']['max_items'] = '0';
  152. $handler->display->display_options['row_plugin'] = 'calendar_entity';
  153. /* Field: Content: Title */
  154. $handler->display->display_options['fields']['title']['id'] = 'title';
  155. $handler->display->display_options['fields']['title']['table'] = 'node';
  156. $handler->display->display_options['fields']['title']['field'] = 'title';
  157. $handler->display->display_options['fields']['title']['label'] = '';
  158. $handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
  159. $handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
  160. $handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
  161. $handler->display->display_options['fields']['title']['alter']['external'] = 0;
  162. $handler->display->display_options['fields']['title']['alter']['replace_spaces'] = 0;
  163. $handler->display->display_options['fields']['title']['alter']['trim_whitespace'] = 0;
  164. $handler->display->display_options['fields']['title']['alter']['nl2br'] = 0;
  165. $handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
  166. $handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
  167. $handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
  168. $handler->display->display_options['fields']['title']['alter']['trim'] = 0;
  169. $handler->display->display_options['fields']['title']['alter']['html'] = 0;
  170. $handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
  171. $handler->display->display_options['fields']['title']['element_default_classes'] = 1;
  172. $handler->display->display_options['fields']['title']['hide_empty'] = 0;
  173. $handler->display->display_options['fields']['title']['empty_zero'] = 0;
  174. $handler->display->display_options['fields']['title']['hide_alter_empty'] = 0;
  175. $handler->display->display_options['fields']['title']['link_to_node'] = 1;
  176. /* Field: Content: Datex */
  177. foreach ($date_fields as $field_name) {
  178. if (substr($field_name, 0, 6) == 'field_') {
  179. $table = 'field_data_' . $field_name;
  180. $cck_field = TRUE;
  181. }
  182. else {
  183. $table = 'node';
  184. $cck_field = FALSE;
  185. }
  186. $handler->display->display_options['fields'][$field_name]['id'] = $field_name;
  187. $handler->display->display_options['fields'][$field_name]['table'] = $table;
  188. $handler->display->display_options['fields'][$field_name]['field'] = $field_name;
  189. $handler->display->display_options['fields'][$field_name]['label'] = '';
  190. $handler->display->display_options['fields'][$field_name]['alter']['alter_text'] = 0;
  191. $handler->display->display_options['fields'][$field_name]['alter']['make_link'] = 0;
  192. $handler->display->display_options['fields'][$field_name]['alter']['absolute'] = 0;
  193. $handler->display->display_options['fields'][$field_name]['alter']['external'] = 0;
  194. $handler->display->display_options['fields'][$field_name]['alter']['replace_spaces'] = 0;
  195. $handler->display->display_options['fields'][$field_name]['alter']['trim_whitespace'] = 0;
  196. $handler->display->display_options['fields'][$field_name]['alter']['nl2br'] = 0;
  197. $handler->display->display_options['fields'][$field_name]['alter']['word_boundary'] = 1;
  198. $handler->display->display_options['fields'][$field_name]['alter']['ellipsis'] = 1;
  199. $handler->display->display_options['fields'][$field_name]['alter']['strip_tags'] = 0;
  200. $handler->display->display_options['fields'][$field_name]['alter']['trim'] = 0;
  201. $handler->display->display_options['fields'][$field_name]['alter']['html'] = 0;
  202. $handler->display->display_options['fields'][$field_name]['element_label_colon'] = FALSE;
  203. $handler->display->display_options['fields'][$field_name]['element_default_classes'] = 1;
  204. $handler->display->display_options['fields'][$field_name]['hide_empty'] = 0;
  205. $handler->display->display_options['fields'][$field_name]['empty_zero'] = 0;
  206. $handler->display->display_options['fields'][$field_name]['hide_alter_empty'] = 0;
  207. if ($cck_field) {
  208. $handler->display->display_options['fields'][$field_name]['settings'] = array(
  209. 'format_type' => 'short',
  210. 'fromto' => 'both',
  211. 'multiple_number' => '',
  212. 'multiple_from' => '',
  213. 'multiple_to' => '',
  214. 'show_repeat_rule' => '',
  215. );
  216. $handler->display->display_options['fields'][$field_name]['group_rows'] = 0;
  217. $handler->display->display_options['fields'][$field_name]['delta_offset'] = '0';
  218. $handler->display->display_options['fields'][$field_name]['delta_reversed'] = 0;
  219. $handler->display->display_options['fields'][$field_name]['field_api_classes'] = 0;
  220. /* Sort criterion */
  221. $handler->display->display_options['sorts'][$field_name . '_value']['id'] = $field_name . '_value';
  222. $handler->display->display_options['sorts'][$field_name . '_value']['table'] = $table;
  223. $handler->display->display_options['sorts'][$field_name . '_value']['field'] = $field_name . '_value';
  224. }
  225. else {
  226. /* Sort criterion */
  227. $handler->display->display_options['sorts'][$field_name]['id'] = $field_name;
  228. $handler->display->display_options['sorts'][$field_name]['table'] = $table;
  229. $handler->display->display_options['sorts'][$field_name]['field'] = $field_name;
  230. }
  231. }
  232. /* Filter criterion: Content: Published */
  233. $handler->display->display_options['filters']['status']['id'] = 'status';
  234. $handler->display->display_options['filters']['status']['table'] = 'node';
  235. $handler->display->display_options['filters']['status']['field'] = 'status';
  236. $handler->display->display_options['filters']['status']['value'] = 1;
  237. $handler->display->display_options['filters']['status']['group'] = 0;
  238. $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
  239. /* Display: Month */
  240. $handler = $view->new_display('page', 'Month', 'page_1');
  241. $handler->display->display_options['defaults']['pager'] = FALSE;
  242. $handler->display->display_options['pager']['type'] = 'date_views_pager';
  243. $handler->display->display_options['pager']['options']['date_id'] = 'month';
  244. $handler->display->display_options['pager']['options']['pager_position'] = 'top';
  245. $handler->display->display_options['defaults']['style_plugin'] = FALSE;
  246. $handler->display->display_options['style_plugin'] = 'calendar_style';
  247. $handler->display->display_options['style_options']['calendar_type'] = 'month';
  248. $handler->display->display_options['style_options']['name_size'] = '3';
  249. $handler->display->display_options['style_options']['mini'] = '0';
  250. $handler->display->display_options['style_options']['with_weekno'] = '0';
  251. $handler->display->display_options['style_options']['multiday_theme'] = '1';
  252. $handler->display->display_options['style_options']['theme_style'] = '1';
  253. $handler->display->display_options['style_options']['max_items'] = '0';
  254. $handler->display->display_options['defaults']['style_options'] = FALSE;
  255. $handler->display->display_options['defaults']['row_plugin'] = FALSE;
  256. $handler->display->display_options['row_plugin'] = 'calendar_entity';
  257. $handler->display->display_options['row_options']['calendar_date_link'] = $type;
  258. $handler->display->display_options['row_options']['colors']['legend'] = 'type';
  259. $handler->display->display_options['row_options']['colors']['calendar_colors_type'] = array();
  260. $handler->display->display_options['row_options']['colors']['calendar_colors_vocabulary'] = array();
  261. $handler->display->display_options['defaults']['row_options'] = FALSE;
  262. $handler->display->display_options['defaults']['arguments'] = FALSE;
  263. /* Contextual filter: Date: Date (node) */
  264. $handler->display->display_options['arguments']['date_argument']['id'] = 'date_argument';
  265. $handler->display->display_options['arguments']['date_argument']['table'] = 'node';
  266. $handler->display->display_options['arguments']['date_argument']['field'] = 'date_argument';
  267. $handler->display->display_options['arguments']['date_argument']['default_action'] = 'default';
  268. $handler->display->display_options['arguments']['date_argument']['default_argument_type'] = 'date';
  269. $handler->display->display_options['arguments']['date_argument']['default_argument_skip_url'] = 0;
  270. $handler->display->display_options['arguments']['date_argument']['summary']['format'] = 'default_summary';
  271. $handler->display->display_options['arguments']['date_argument']['year_range'] = '-3:+3';
  272. $handler->display->display_options['arguments']['date_argument']['granularity'] = 'month';
  273. $handler->display->display_options['arguments']['date_argument']['add_delta'] = 'yes';
  274. $handler->display->display_options['arguments']['date_argument']['date_fields'] = drupal_map_assoc($aliases);
  275. $handler->display->display_options['arguments']['date_argument']['date_method'] = 'OR';
  276. $handler->display->display_options['arguments']['date_argument']['date_group'] = 'date';
  277. $handler->display->display_options['path'] = $path . '/month';
  278. $handler->display->display_options['menu']['title'] = 'Month';
  279. $handler->display->display_options['menu']['weight'] = '0';
  280. $handler->display->display_options['tab_options']['type'] = 'normal';
  281. $handler->display->display_options['tab_options']['title'] = 'Month';
  282. $handler->display->display_options['tab_options']['weight'] = '0';
  283. /* Display: Week */
  284. $handler = $view->new_display('page', 'Week', 'page_2');
  285. $handler->display->display_options['defaults']['pager'] = FALSE;
  286. $handler->display->display_options['pager']['type'] = 'date_views_pager';
  287. $handler->display->display_options['pager']['options']['date_id'] = 'week';
  288. $handler->display->display_options['pager']['options']['pager_position'] = 'top';
  289. $handler->display->display_options['defaults']['style_plugin'] = FALSE;
  290. $handler->display->display_options['style_plugin'] = 'calendar_style';
  291. $handler->display->display_options['style_options']['calendar_type'] = 'week';
  292. $handler->display->display_options['style_options']['name_size'] = '3';
  293. $handler->display->display_options['style_options']['mini'] = '0';
  294. $handler->display->display_options['style_options']['with_weekno'] = '0';
  295. $handler->display->display_options['style_options']['multiday_theme'] = '1';
  296. $handler->display->display_options['style_options']['groupby_times'] = 'hour';
  297. $handler->display->display_options['style_options']['theme_style'] = '1';
  298. $handler->display->display_options['style_options']['max_items'] = '0';
  299. $handler->display->display_options['defaults']['style_options'] = FALSE;
  300. $handler->display->display_options['defaults']['row_plugin'] = FALSE;
  301. $handler->display->display_options['row_plugin'] = 'calendar_entity';
  302. $handler->display->display_options['defaults']['row_options'] = FALSE;
  303. $handler->display->display_options['defaults']['arguments'] = FALSE;
  304. /* Contextual filter: Date: Date (node) */
  305. $handler->display->display_options['arguments']['date_argument']['id'] = 'date_argument';
  306. $handler->display->display_options['arguments']['date_argument']['table'] = 'node';
  307. $handler->display->display_options['arguments']['date_argument']['field'] = 'date_argument';
  308. $handler->display->display_options['arguments']['date_argument']['default_action'] = 'default';
  309. $handler->display->display_options['arguments']['date_argument']['default_argument_type'] = 'date';
  310. $handler->display->display_options['arguments']['date_argument']['default_argument_skip_url'] = 0;
  311. $handler->display->display_options['arguments']['date_argument']['summary']['format'] = 'default_summary';
  312. $handler->display->display_options['arguments']['date_argument']['year_range'] = '-3:+3';
  313. $handler->display->display_options['arguments']['date_argument']['granularity'] = 'week';
  314. $handler->display->display_options['arguments']['date_argument']['add_delta'] = 'yes';
  315. $handler->display->display_options['arguments']['date_argument']['date_fields'] = drupal_map_assoc($aliases);
  316. $handler->display->display_options['arguments']['date_argument']['date_method'] = 'OR';
  317. $handler->display->display_options['arguments']['date_argument']['date_group'] = 'date';
  318. $handler->display->display_options['path'] = $path . '/week';
  319. $handler->display->display_options['menu']['title'] = 'Week';
  320. $handler->display->display_options['menu']['weight'] = '2';
  321. /* Display: Day */
  322. $handler = $view->new_display('page', 'Day', 'page_3');
  323. $handler->display->display_options['defaults']['pager'] = FALSE;
  324. $handler->display->display_options['pager']['type'] = 'date_views_pager';
  325. $handler->display->display_options['pager']['options']['date_id'] = 'day';
  326. $handler->display->display_options['pager']['options']['pager_position'] = 'top';
  327. $handler->display->display_options['defaults']['style_plugin'] = FALSE;
  328. $handler->display->display_options['style_plugin'] = 'calendar_style';
  329. $handler->display->display_options['style_options']['calendar_type'] = 'day';
  330. $handler->display->display_options['style_options']['name_size'] = '3';
  331. $handler->display->display_options['style_options']['mini'] = '0';
  332. $handler->display->display_options['style_options']['with_weekno'] = '0';
  333. $handler->display->display_options['style_options']['multiday_theme'] = '1';
  334. $handler->display->display_options['style_options']['theme_style'] = '1';
  335. $handler->display->display_options['style_options']['max_items'] = '0';
  336. $handler->display->display_options['style_options']['groupby_times'] = 'hour';
  337. $handler->display->display_options['defaults']['style_options'] = FALSE;
  338. $handler->display->display_options['defaults']['row_plugin'] = FALSE;
  339. $handler->display->display_options['row_plugin'] = 'calendar_entity';
  340. $handler->display->display_options['defaults']['row_options'] = FALSE;
  341. $handler->display->display_options['defaults']['arguments'] = FALSE;
  342. /* Contextual filter: Date: Date (node) */
  343. $handler->display->display_options['arguments']['date_argument']['id'] = 'date_argument';
  344. $handler->display->display_options['arguments']['date_argument']['table'] = 'node';
  345. $handler->display->display_options['arguments']['date_argument']['field'] = 'date_argument';
  346. $handler->display->display_options['arguments']['date_argument']['default_action'] = 'default';
  347. $handler->display->display_options['arguments']['date_argument']['default_argument_type'] = 'date';
  348. $handler->display->display_options['arguments']['date_argument']['default_argument_skip_url'] = 0;
  349. $handler->display->display_options['arguments']['date_argument']['summary']['format'] = 'default_summary';
  350. $handler->display->display_options['arguments']['date_argument']['year_range'] = '-3:+3';
  351. $handler->display->display_options['arguments']['date_argument']['granularity'] = 'day';
  352. $handler->display->display_options['arguments']['date_argument']['add_delta'] = '';
  353. $handler->display->display_options['arguments']['date_argument']['date_fields'] = drupal_map_assoc($aliases);
  354. $handler->display->display_options['arguments']['date_argument']['date_method'] = 'OR';
  355. $handler->display->display_options['arguments']['date_argument']['date_group'] = 'date';
  356. $handler->display->display_options['path'] = $path . '/day';
  357. $handler->display->display_options['menu']['title'] = 'Day';
  358. $handler->display->display_options['menu']['weight'] = '3';
  359. /* Display: Year */
  360. $handler = $view->new_display('page', 'Year', 'page');
  361. $handler->display->display_options['defaults']['pager'] = FALSE;
  362. $handler->display->display_options['pager']['type'] = 'date_views_pager';
  363. $handler->display->display_options['pager']['options']['date_id'] = 'year';
  364. $handler->display->display_options['pager']['options']['pager_position'] = 'top';
  365. $handler->display->display_options['defaults']['style_plugin'] = FALSE;
  366. $handler->display->display_options['style_plugin'] = 'calendar_style';
  367. $handler->display->display_options['style_options']['calendar_type'] = 'year';
  368. $handler->display->display_options['style_options']['name_size'] = '1';
  369. $handler->display->display_options['style_options']['mini'] = '0';
  370. $handler->display->display_options['style_options']['with_weekno'] = '0';
  371. $handler->display->display_options['style_options']['multiday_theme'] = '1';
  372. $handler->display->display_options['style_options']['theme_style'] = '1';
  373. $handler->display->display_options['style_options']['max_items'] = '0';
  374. $handler->display->display_options['defaults']['style_options'] = FALSE;
  375. $handler->display->display_options['defaults']['row_plugin'] = FALSE;
  376. $handler->display->display_options['row_plugin'] = 'calendar_entity';
  377. $handler->display->display_options['defaults']['row_options'] = FALSE;
  378. $handler->display->display_options['defaults']['arguments'] = FALSE;
  379. /* Contextual filter: Date: Date (node) */
  380. $handler->display->display_options['arguments']['date_argument']['id'] = 'date_argument';
  381. $handler->display->display_options['arguments']['date_argument']['table'] = 'node';
  382. $handler->display->display_options['arguments']['date_argument']['field'] = 'date_argument';
  383. $handler->display->display_options['arguments']['date_argument']['default_action'] = 'default';
  384. $handler->display->display_options['arguments']['date_argument']['default_argument_type'] = 'date';
  385. $handler->display->display_options['arguments']['date_argument']['default_argument_skip_url'] = 0;
  386. $handler->display->display_options['arguments']['date_argument']['summary']['format'] = 'default_summary';
  387. $handler->display->display_options['arguments']['date_argument']['year_range'] = '-3:+3';
  388. $handler->display->display_options['arguments']['date_argument']['granularity'] = 'year';
  389. $handler->display->display_options['arguments']['date_argument']['add_delta'] = 'yes';
  390. $handler->display->display_options['arguments']['date_argument']['date_fields'] = drupal_map_assoc($aliases);
  391. $handler->display->display_options['arguments']['date_argument']['date_method'] = 'OR';
  392. $handler->display->display_options['arguments']['date_argument']['date_group'] = 'date';
  393. $handler->display->display_options['path'] = $path . '/year';
  394. $handler->display->display_options['menu']['title'] = 'Year';
  395. $handler->display->display_options['menu']['weight'] = '4';
  396. /* Display: Block */
  397. $handler = $view->new_display('block', 'Block', 'block_1');
  398. $handler->display->display_options['defaults']['pager'] = FALSE;
  399. $handler->display->display_options['pager']['type'] = 'date_views_pager';
  400. $handler->display->display_options['pager']['options']['date_id'] = 'mini';
  401. $handler->display->display_options['pager']['options']['pager_position'] = 'top';
  402. $handler->display->display_options['defaults']['style_plugin'] = FALSE;
  403. $handler->display->display_options['style_plugin'] = 'calendar_style';
  404. $handler->display->display_options['style_options']['calendar_type'] = 'month';
  405. $handler->display->display_options['style_options']['name_size'] = '1';
  406. $handler->display->display_options['style_options']['mini'] = '1';
  407. $handler->display->display_options['style_options']['with_weekno'] = '0';
  408. $handler->display->display_options['style_options']['multiday_theme'] = '1';
  409. $handler->display->display_options['style_options']['theme_style'] = '1';
  410. $handler->display->display_options['style_options']['max_items'] = '0';
  411. $handler->display->display_options['defaults']['style_options'] = FALSE;
  412. $handler->display->display_options['defaults']['row_plugin'] = FALSE;
  413. $handler->display->display_options['row_plugin'] = 'calendar_entity';
  414. $handler->display->display_options['defaults']['row_options'] = FALSE;
  415. $handler->display->display_options['defaults']['arguments'] = FALSE;
  416. /* Contextual filter: Date: Date (node) */
  417. $handler->display->display_options['arguments']['date_argument']['id'] = 'date_argument';
  418. $handler->display->display_options['arguments']['date_argument']['table'] = 'node';
  419. $handler->display->display_options['arguments']['date_argument']['field'] = 'date_argument';
  420. $handler->display->display_options['arguments']['date_argument']['default_action'] = 'default';
  421. $handler->display->display_options['arguments']['date_argument']['default_argument_type'] = 'date';
  422. $handler->display->display_options['arguments']['date_argument']['default_argument_skip_url'] = 0;
  423. $handler->display->display_options['arguments']['date_argument']['summary']['format'] = 'default_summary';
  424. $handler->display->display_options['arguments']['date_argument']['year_range'] = '-3:+3';
  425. $handler->display->display_options['arguments']['date_argument']['granularity'] = 'month';
  426. $handler->display->display_options['arguments']['date_argument']['add_delta'] = 'yes';
  427. $handler->display->display_options['arguments']['date_argument']['date_fields'] = drupal_map_assoc($aliases);
  428. $handler->display->display_options['arguments']['date_argument']['date_method'] = 'OR';
  429. $handler->display->display_options['arguments']['date_argument']['date_group'] = 'date';
  430. if (module_exists('date_ical')) {
  431. /* Display: iCal */
  432. $handler = $view->new_display('feed', 'iCal', 'feed_1');
  433. $handler->display->display_options['pager']['type'] = 'some';
  434. $handler->display->display_options['style_plugin'] = 'date_ical';
  435. $handler->display->display_options['row_plugin'] = 'date_ical';
  436. $handler->display->display_options['row_options']['date_field'] = $aliases[0];
  437. $handler->display->display_options['defaults']['filters'] = FALSE;
  438. /* Filter criterion: Content: Published */
  439. $handler->display->display_options['filters']['status']['id'] = 'status';
  440. $handler->display->display_options['filters']['status']['table'] = 'node';
  441. $handler->display->display_options['filters']['status']['field'] = 'status';
  442. $handler->display->display_options['filters']['status']['value'] = 1;
  443. $handler->display->display_options['filters']['status']['group'] = 0;
  444. $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
  445. /* Filter criterion: Date: Date (node) */
  446. $handler->display->display_options['filters']['date_filter']['id'] = 'date_filter';
  447. $handler->display->display_options['filters']['date_filter']['table'] = 'node';
  448. $handler->display->display_options['filters']['date_filter']['field'] = 'date_filter';
  449. $handler->display->display_options['filters']['date_filter']['operator'] = '>=';
  450. $handler->display->display_options['filters']['date_filter']['granularity'] = 'day';
  451. $handler->display->display_options['filters']['date_filter']['form_type'] = 'date_select';
  452. $handler->display->display_options['filters']['date_filter']['default_date'] = 'now';
  453. $handler->display->display_options['filters']['date_filter']['default_to_date'] = '';
  454. $handler->display->display_options['filters']['date_filter']['year_range'] = '-3:+3';
  455. $handler->display->display_options['filters']['date_filter']['add_delta'] = 'yes';
  456. $handler->display->display_options['filters']['date_filter']['date_fields'] = drupal_map_assoc($aliases);
  457. $handler->display->display_options['filters']['date_filter']['date_method'] = 'OR';
  458. $handler->display->display_options['filters']['date_filter']['date_group'] = 'date';
  459. $handler->display->display_options['path'] = $path . '/ical/%/calendar.ics';
  460. $handler->display->display_options['displays'] = array(
  461. 'page' => 'page',
  462. 'page_1' => 'page_1',
  463. 'page_2' => 'page_2',
  464. 'page_3' => 'page_3',
  465. 'block_1' => 'block_1',
  466. 'default' => 0,
  467. );
  468. } // End if module_exists()
  469. /* Display: Upcoming */
  470. $handler = $view->new_display('block', 'Upcoming', 'block_2');
  471. $handler->display->display_options['display_description'] = 'Upcoming events block';
  472. $handler->display->display_options['defaults']['pager'] = FALSE;
  473. $handler->display->display_options['pager']['type'] = 'some';
  474. $handler->display->display_options['pager']['options']['items_per_page'] = '5';
  475. $handler->display->display_options['pager']['options']['offset'] = '0';
  476. $handler->display->display_options['defaults']['style_plugin'] = FALSE;
  477. $handler->display->display_options['style_plugin'] = 'list';
  478. $handler->display->display_options['defaults']['style_options'] = FALSE;
  479. $handler->display->display_options['defaults']['row_plugin'] = FALSE;
  480. $handler->display->display_options['row_plugin'] = 'fields';
  481. $handler->display->display_options['row_options']['links'] = 1;
  482. $handler->display->display_options['row_options']['comments'] = 0;
  483. $handler->display->display_options['defaults']['row_options'] = FALSE;
  484. $handler->display->display_options['defaults']['filters'] = FALSE;
  485. /* Filter criterion: Content: Published */
  486. $handler->display->display_options['filters']['status']['id'] = 'status';
  487. $handler->display->display_options['filters']['status']['table'] = 'node';
  488. $handler->display->display_options['filters']['status']['field'] = 'status';
  489. $handler->display->display_options['filters']['status']['value'] = 1;
  490. $handler->display->display_options['filters']['status']['group'] = 0;
  491. $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
  492. /* Filter criterion: Date: Date (node) */
  493. $handler->display->display_options['filters']['date_filter']['id'] = 'date_filter';
  494. $handler->display->display_options['filters']['date_filter']['table'] = 'node';
  495. $handler->display->display_options['filters']['date_filter']['field'] = 'date_filter';
  496. $handler->display->display_options['filters']['date_filter']['operator'] = '>=';
  497. $handler->display->display_options['filters']['date_filter']['granularity'] = 'day';
  498. $handler->display->display_options['filters']['date_filter']['form_type'] = 'date_select';
  499. $handler->display->display_options['filters']['date_filter']['default_date'] = 'now';
  500. $handler->display->display_options['filters']['date_filter']['default_to_date'] = '';
  501. $handler->display->display_options['filters']['date_filter']['year_range'] = '-3:+3';
  502. $handler->display->display_options['filters']['date_filter']['add_delta'] = 'yes';
  503. $handler->display->display_options['filters']['date_filter']['date_fields'] = drupal_map_assoc($aliases);
  504. $handler->display->display_options['filters']['date_filter']['date_method'] = 'OR';
  505. $handler->display->display_options['filters']['date_filter']['date_group'] = 'date';
  506. $translatables[$name] = array(
  507. t('Master'),
  508. t($name),
  509. t('more'),
  510. t('Apply'),
  511. t('Reset'),
  512. t('Sort by'),
  513. t('Asc'),
  514. t('Desc'),
  515. t('Year'),
  516. t('All'),
  517. t('Month'),
  518. t('Week'),
  519. t('Day'),
  520. t('Block'),
  521. t('iCal'),
  522. t('Upcoming'),
  523. t('Upcoming events block'),
  524. );
  525. return $view;
  526. }