C_Review_Notice

The NextGEN Gallery C Review Notice class.

Defined (1)

The class is defined in the following location(s).

/products/photocrati_nextgen/modules/nextgen_admin/package.module.nextgen_admin.php  
  1. class C_Review_Notice 
  2. function __construct($params = array()) 
  3. $this->_data['name'] = $params['name']; 
  4. $this->_data['range'] = $params['range']; 
  5. $this->_data['follows'] = $params['follows']; 
  6. function get_name() 
  7. return $this->_data['name']; 
  8. function get_gallery_count() 
  9. // Get the total # of galleries if we don't have them 
  10. $settings = C_NextGen_Settings::get_instance(); 
  11. $count = $settings->get('gallery_count', FALSE); 
  12. if (!$count) { 
  13. $count = M_NextGen_Admin::update_gallery_count_setting(); 
  14. return $count; 
  15. function get_range() 
  16. return $this->_data['range']; 
  17. function is_renderable() 
  18. return ($this->is_on_dashboard() || $this->is_on_ngg_admin_page()) && $this->is_at_gallery_count() && $this->is_previous_notice_dismissed() && $this->gallery_created_flag_check(); 
  19. function gallery_created_flag_check() 
  20. $settings = C_NextGen_Settings::get_instance(); 
  21. return $settings->get('gallery_created_after_reviews_introduced'); 
  22. function is_at_gallery_count() 
  23. $retval = FALSE; 
  24. $range = $this->_data['range']; 
  25. $count = $this->get_gallery_count(); 
  26. $manager = C_Admin_Notification_Manager::get_instance(); 
  27. // Determine if we match the current range 
  28. if ($count >= $range['min'] && $count <= $range['max']) { 
  29. $retval = TRUE; 
  30. // If the current number of galleries exceeds the parent notice's maximum we should dismiss the parent 
  31. if (!empty($this->_data['follows'])) { 
  32. $follows = $this->_data['follows']; 
  33. $parent_range = $follows->get_range(); 
  34. if ($count > $parent_range['max'] && !$manager->is_dismissed($follows->get_name())) { 
  35. $manager->dismiss($follows->get_name(), 2); 
  36. return $retval; 
  37. function is_previous_notice_dismissed($level = FALSE) 
  38. $retval = FALSE; 
  39. $manager = C_Admin_Notification_Manager::get_instance(); 
  40. if (empty($level)) { 
  41. $level = $this; 
  42. if (!empty($level->_data['follows'])) { 
  43. $parent = $level->_data['follows']; 
  44. $retval = $manager->is_dismissed($parent->get_name()); 
  45. if (!$retval && !empty($parent->_data['follows'])) { 
  46. $retval = $this->is_previous_notice_dismissed($parent); 
  47. } else { 
  48. $retval = TRUE; 
  49. return $retval; 
  50. function is_on_dashboard() 
  51. return preg_match('#/wp-admin/?(index\\.php)?$#', $_SERVER['REQUEST_URI']) == TRUE; 
  52. function is_on_ngg_admin_page() 
  53. // Do not show this notification inside of the ATP popup 
  54. return (preg_match("/wp-admin.*(ngg|nextgen).*/", $_SERVER['REQUEST_URI']) || isset($_REQUEST['page']) && preg_match("/ngg|nextgen/", $_REQUEST['page'])) && strpos(strtolower($_SERVER['REQUEST_URI']), '&attach_to_post') == false; 
  55. function render() 
  56. $view = new C_MVC_View('photocrati-nextgen_admin#review_notice', array('number' => $this->get_gallery_count())); 
  57. return $view->render(TRUE); 
  58. function dismiss($code) 
  59. $retval = array('dismiss' => TRUE, 'persist' => TRUE, 'success' => TRUE, 'code' => $code, 'dismiss_code' => $code); 
  60. $manager = C_Admin_Notification_Manager::get_instance(); 
  61. if ($code == 1 || $code == 3) { 
  62. $retval['review_level_1'] = $manager->dismiss('review_level_1', 2); 
  63. $retval['review_level_2'] = $manager->dismiss('review_level_2', 2); 
  64. $retval['review_level_3'] = $manager->dismiss('review_level_3', 2); 
  65. return $retval;