C_Display_Type_Installer

The NextGEN Gallery C Display Type Installer class.

Defined (1)

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

/products/photocrati_nextgen/modules/nextgen_gallery_display/module.nextgen_gallery_display.php  
  1. class C_Display_Type_Installer 
  2. function get_registry() 
  3. return C_Component_Registry::get_instance(); 
  4.  
  5. /** 
  6. * Installs a display type 
  7. * @param string $name 
  8. * @param array $properties 
  9. */ 
  10. function install_display_type($name, $properties=array()) 
  11. // Try to find the existing entity. If it doesn't exist, we'll create 
  12. $fs = C_Fs::get_instance(); 
  13. $mapper = C_Display_Type_Mapper::get_instance(); 
  14. $display_type = $mapper->find_by_name($name); 
  15. if (!$display_type) $display_type = new stdClass; 
  16.  
  17. // Update the properties of the display type 
  18. $properties['name'] = $name; 
  19. $properties['installed_at_version'] = NGG_PLUGIN_VERSION; 
  20. foreach ($properties as $key=>$val) { 
  21. if ($key == 'preview_image_relpath') { 
  22. $val = $fs->find_static_abspath($val, FALSE, TRUE); 
  23. $display_type->$key = $val; 
  24.  
  25. // Save the entity 
  26. $retval = $mapper->save($display_type); 
  27. return $retval; 
  28.  
  29. /** 
  30. * Deletes all displayed galleries 
  31. */ 
  32. function uninstall_displayed_galleries() 
  33. $mapper = C_Displayed_Gallery_Mapper::get_instance(); 
  34. $mapper->delete()->run_query(); 
  35.  
  36. /** 
  37. * Uninstalls all display types 
  38. */ 
  39. function uninstall_display_types() 
  40. $mapper = C_Display_Type_Mapper::get_instance(); 
  41. $mapper->delete()->run_query(); 
  42.  
  43. /** 
  44. * Installs displayed gallery sources 
  45. */ 
  46. function install($reset=FALSE) 
  47. // Display types are registered in other modules 
  48.  
  49. /** 
  50. * Uninstalls this module 
  51. */ 
  52. function uninstall($hard = FALSE) 
  53. C_Photocrati_Transient_Manager::flush(); 
  54.  
  55. $this->uninstall_display_types(); 
  56.  
  57. // TODO temporary Don't remove galleries on uninstall 
  58. //if ($hard) $this->uninstall_displayed_galleries();