Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
content_type_image_management.inc
1 <?php
18 require_once SQ_INCLUDE_PATH.'/asset_management.inc';
19 
31 {
32 
33 
38  function __construct(&$pm)
39  {
40  $this->Asset_Management($pm);
41 
42  $this->vars = Array(
43  'display_settings' => Array(
44  'added' => '0.1',
45  'type' => 'serialise',
46  'default' => Array(),
47  ),
48  'on_click' => Array(
49  'added' => '0.1',
50  'type' => 'selection',
51  'default' => 'none',
52  'parameters' => Array(
53  'multiple' => FALSE,
54  'allow_empty' => FALSE,
55  'options' => Array(
56  'none' => 'No Action',
57  'new_window' => 'Open Image in New Window',
58  'current_window' => 'Open Image in Current Window',
59  'inline' => 'Open Inline Image Preview',
60  ),
61  ),
62  ),
63  );
64 
65  }//end constructor
66 
67 
77  function _upgrade($current_version)
78  {
79  if (!parent::_upgrade($current_version)) return FALSE;
80 
81  if (version_compare($current_version, '0.2', '<')) {
82  pre_echo('UPGRADING FILE ASSETS - FROM VERSION '.$current_version);
83  $preferences = Array();
84  if (is_file(SQ_DATA_PATH.'/private/conf/preferences.inc')) {
85  include SQ_DATA_PATH.'/private/conf/preferences.inc';
86 
87  $type_code = $this->getAssetType();
88  $preferences[$type_code]['SQ_CONTENT_TYPE_IMAGE_DEFAULTS']['default']['html_layout'] = 'table';
89  $preferences[$type_code]['SQ_CONTENT_TYPE_IMAGE_FIELDS']['default']['html_layout'] = TRUE;
90  $preferences[$type_code]['SQ_CONTENT_TYPE_IMAGE_CLASSES']['default']['image_div'] = 'image_div';
91  $preferences[$type_code]['SQ_CONTENT_TYPE_IMAGE_CLASSES']['default']['caption_div'] = 'caption_div';
92  $preferences[$type_code]['SQ_CONTENT_TYPE_IMAGE_PREVIEW']['default']['image_div'] = 'preview_image_div';
93  $preferences[$type_code]['SQ_CONTENT_TYPE_IMAGE_PREVIEW']['default']['close_preview_div'] = 'close_preview_div';
94 
95  // save the updated preferences file
96  $str = '<'.'?php $preferences = '.var_export($preferences, TRUE).'; ?'.'>';
97  if (!string_to_file($str, SQ_DATA_PATH.'/private/conf/preferences.inc')) {
98  return FALSE;
99  }
100  }
101  }//end if version 0.2
102 
103  return TRUE;
104 
105  }//end _upgrade()
106 
107 
108 }//end class
109 
110 ?>