context_condition_views.inc

  1. cis7 sites/all/modules/ulmus/context/plugins/context_condition_views.inc
  2. cle7 sites/all/modules/ulmus/context/plugins/context_condition_views.inc
  3. ecd7 sites/all/modules/ulmus/context/plugins/context_condition_views.inc
  4. elmsmedia7 sites/all/modules/ulmus/context/plugins/context_condition_views.inc
  5. harmony7 sites/all/modules/ulmus/context/plugins/context_condition_views.inc
  6. icor7 sites/all/modules/ulmus/context/plugins/context_condition_views.inc
  7. meedjum_blog7 sites/all/modules/ulmus/context/plugins/context_condition_views.inc
  8. mooc7 sites/all/modules/ulmus/context/plugins/context_condition_views.inc

Classes

File

sites/all/modules/ulmus/context/plugins/context_condition_views.inc
View source
  1. <?php
  2. class context_condition_views extends context_condition {
  3. /**
  4. * Generate a list of database and module provided views.
  5. */
  6. function condition_values() {
  7. $enabled_views = array();
  8. $views = views_get_all_views();
  9. ksort($views);
  10. foreach ($views as $view) {
  11. if (!isset($views[$view->name]->disabled) || !$views[$view->name]->disabled) {
  12. $enabled_views[$view->name] = check_plain($view->name);
  13. // Provide more granular options for each page display
  14. $displays = array();
  15. foreach ($view->display as $id => $display) {
  16. if ($display->display_plugin == 'page') {
  17. $displays[$view->name . ":" . $id] = check_plain("-- {$display->display_title}");
  18. }
  19. }
  20. $enabled_views += $displays;
  21. }
  22. }
  23. return $enabled_views;
  24. }
  25. function execute($view) {
  26. switch ($view->display_handler->display->display_plugin) {
  27. case 'page':
  28. case 'calendar':
  29. // Set contexts for this view.
  30. foreach ($this->get_contexts($view->name) as $context) {
  31. $this->condition_met($context, $view->name);
  32. }
  33. // Set any contexts associated with the current display
  34. if (!empty($view->current_display)) {
  35. foreach ($this->get_contexts("{$view->name}:{$view->current_display}") as $context) {
  36. $this->condition_met($context, "{$view->name}:{$view->current_display}");
  37. }
  38. }
  39. break;
  40. }
  41. }
  42. }