A_Styles_Form

Class A_Styles_Form.

Defined (1)

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

/products/photocrati_nextgen/modules/nextgen_other_options/package.module.nextgen_other_options.php  
  1. class A_Styles_Form extends Mixin 
  2. function get_model() 
  3. return C_Settings_Model::get_instance(); 
  4. function get_title() 
  5. return __('Styles', 'nggallery'); 
  6. function render() 
  7. return $this->object->render_partial('photocrati-nextgen_other_options#styling_tab', array('activateCSS_label' => __('Enable custom CSS', 'nggallery'), 'activateCSS' => $this->object->get_model()->activateCSS, 'select_stylesheet_label' => __('What stylesheet would you like to use?', 'nggallery'), 'stylesheets' => C_NextGen_Style_Manager::get_instance()->find_all_stylesheets(), 'activated_stylesheet' => $this->object->get_model()->CSSfile, 'hidden_label' => __('(Show Customization Options)', 'nggallery'), 'active_label' => __('(Hide Customization Options)', 'nggallery'), 'cssfile_contents_label' => __('File Content:', 'nggallery'), 'writable_label' => __('Changes you make to the contents will be saved to', 'nggallery'), 'readonly_label' => __('You could edit this file if it were writable', 'nggallery')), TRUE); 
  8. function save_action() 
  9. // Ensure that we have 
  10. if ($settings = $this->object->param('style_settings')) { 
  11. $valid = TRUE; 
  12. // the desired file, but users shouldn't use this to write files that don't end in .css anyway 
  13. $file_info = pathinfo($settings['CSSfile']); 
  14. if (strpos($file_info['extension'], 'css') === FALSE) { 
  15. $valid = FALSE; 
  16. // TODO: C_Page's add_error() doesn't seem to work here so we should report that we aren't saving 
  17. if ($valid) { 
  18. $this->object->get_model()->set($settings)->save(); 
  19. // Are we to modify the CSS file? 
  20. if ($valid && ($contents = $this->object->param('cssfile_contents'))) { 
  21. // Find filename 
  22. $css_file = $settings['CSSfile']; 
  23. $styles = C_NextGen_Style_Manager::get_instance(); 
  24. $styles->save($contents, $css_file);