Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
content_type_structure_tree_prefs.inc
1 <?php
18 require_once SQ_LIB_PATH.'/config/prefs.inc';
19 require_once SQ_ATTRIBUTES_PATH.'/css_dimension/css_dimension.inc';
20 
33 {
34 
35  var $pref_vars = Array (
36  'SQ_STRUCTURE_TREE_FORMATTING' => Array(
37  'name' => 'structure_tree_title',
38  'description' => 'This preference allows you to change the text options that are displayed',
39  'default' => Array(
40  'bold' => TRUE,
41  'underline' => TRUE,
42  'italic' => TRUE,
43  'delete' => TRUE,
44  'insert' => TRUE,
45  'connections' => TRUE,
46  ),
47  'protected' => FALSE,
48  ),
49  'SQ_STRUCTURE_TREE_NODE_CLASSES' => Array(
50  'name' => 'tree_class_title',
51  'description' => 'This preference allows you to change the class used for each Node',
52  'default' => Array(
53  'node_text' => 'tree_node_text',
54  'node_branches' => 'tree_node_branches',
55  ),
56  'protected' => FALSE,
57  ),
58  );
59 
60 
65  function Content_Type_Structure_Tree_Prefs($pref_file='')
66  {
67  $this->Prefs($pref_file);
68 
69  }//end constructor
70 
71 
82  function paintBackend(&$o, $have_lock, $pref=NULL)
83  {
84  $is_root = $GLOBALS['SQ_SYSTEM']->userRoot();
85  $is_admin = ($is_root || $GLOBALS['SQ_SYSTEM']->userSystemAdmin());
86  if (is_null($pref) || $pref == 'SQ_STRUCTURE_TREE_FORMATTING') {
87  if (is_null($pref)) {
88  $o->openField(translate($this->pref_vars['SQ_STRUCTURE_TREE_FORMATTING']['name']));
89  }
90  $format_options = $this->pref_vars['SQ_STRUCTURE_TREE_FORMATTING']['default'];
91  ?>
92  <table class="sq-backend-table" style="width: 350px;">
93  <tr>
94  <td class="sq-backend-table-header" nowrap="nowrap"><?php echo translate('tree_formatting_options'); ?></td>
95  <td class="sq-backend-table-cell" style="width: 100%;">
96  <?php
97  if ($have_lock && $is_admin) {
98  check_box('SQ_STRUCTURE_SHOW_BOLD', '1', $format_options['bold']);
99  echo translate('tree_bold').'<br />';
100  check_box('SQ_STRUCTURE_SHOW_UNDERLINE', '1', $format_options['underline']);
101  echo translate('tree_underline').'<br />';
102  check_box('SQ_STRUCTURE_SHOW_ITALIC', '1', $format_options['italic']);
103  echo translate('tree_italic').'<br />';
104  check_box('SQ_STRUCTURE_SHOW_DELETE', '1', $format_options['delete']);
105  echo translate('delete').'<br />';
106  check_box('SQ_STRUCTURE_SHOW_INSERT', '1', $format_options['delete']);
107  echo translate('insert').'<br />';
108  check_box('SQ_STRUCTURE_SHOW_CONNECTIONS', '1', $format_options['connections']);
109  echo translate('tree_connections').'<br />';
110  } else {
111  $tick = '<img src="'.sq_web_path('lib').'/web/images/tick.gif" alt="Yes" style="position: relative; right: 0px;"/>';
112  $cross = '<img src="'.sq_web_path('lib').'/web/images/cross.gif" alt="Yes" />';
113  ?>
114  <table>
115  <tr>
116  <td>
117  <?php echo translate('tree_bold'); ?>&nbsp;
118  </td>
119  <td>
120  <?php
121  echo ($format_options['bold'] == TRUE) ? $tick : $cross;
122  ?>
123  </td>
124  </tr>
125  <tr>
126  <td>
127  <?php echo translate('tree_underline'); ?>&nbsp;
128  </td>
129  <td>
130  <?php
131  echo ($format_options['underline'] == TRUE) ? $tick : $cross;
132  ?>
133  </td>
134  </tr>
135  <tr>
136  <td>
137  <?php echo translate('tree_italic'); ?>&nbsp;
138  </td>
139  <td>
140  <?php
141  echo ($format_options['italic'] == TRUE) ? $tick : $cross;
142  ?>
143  </td>
144  </tr>
145  <tr>
146  <td>
147  <?php echo translate('delete'); ?>&nbsp;
148  </td>
149  <td>
150  <?php
151  echo ($format_options['delete'] == TRUE) ? $tick : $cross;
152  ?>
153  </td>
154  </tr>
155  <tr>
156  <td>
157  <?php echo translate('insert'); ?>&nbsp;
158  </td>
159  <td>
160  <?php
161  echo ($format_options['insert'] == TRUE) ? $tick : $cross;
162  ?>
163  </td>
164  </tr>
165  <tr>
166  <td>
167  <?php echo translate('tree_connections'); ?>&nbsp;
168  </td>
169  <td>
170  <?php
171  echo ($format_options['connections'] == TRUE) ? $tick : $cross;
172  ?>
173  </td>
174  </tr>
175  </table>
176  <?php
177  }//end else
178  ?>
179  </td>
180  </tr>
181  </table>
182  <?php
183  if (is_null($pref)) $o->closeField();
184  }//end if
185  if (is_null($pref) || $pref == 'SQ_STRUCTURE_TREE_NODE_CLASSES') {
186  if (is_null($pref)) {
187  $o->openField(translate($this->pref_vars['SQ_STRUCTURE_TREE_NODE_CLASSES']['name']));
188  }
189  $classes = $this->pref_vars['SQ_STRUCTURE_TREE_NODE_CLASSES']['default'];
190  ?>
191  <table class="sq-backend-table" style="width: 350px;">
192  <?php
193  foreach ($classes as $name => $class) {
194  ?>
195  <tr>
196  <td class="sq-backend-table-header" nowrap="nowrap"><?php echo translate($name); ?></td>
197  <td class="sq-backend-table-cell" style="width: 100%;">
198  <?php
199  if ($have_lock && $is_admin) {
200  text_box('SQ_STRUCTURE_TREE_NODE_CLASSES['.$name.']', $class, '20');
201  } else {
202  echo $class;
203  }
204  ?>
205  </td>
206  </tr>
207  <?php
208  }
209  ?>
210  </table>
211  <?php
212  if (is_null($pref)) $o->closeField();
213  }//end if
214 
215  return TRUE;
216 
217  }//end paintBackend()
218 
219 
230  function processBackend(&$o, $have_lock, $pref=NULL)
231  {
232  $is_root = $GLOBALS['SQ_SYSTEM']->userRoot();
233  $is_admin = ($is_root || $GLOBALS['SQ_SYSTEM']->userSystemAdmin());
234  if (!$is_admin) return FALSE;
235 
236  if (is_null($pref) || $pref == 'SQ_STRUCTURE_TREE_FORMATTING') {
237  $this->pref_vars['SQ_STRUCTURE_TREE_FORMATTING']['default']['bold'] = isset($_POST['SQ_STRUCTURE_SHOW_BOLD']);
238  $this->pref_vars['SQ_STRUCTURE_TREE_FORMATTING']['default']['underline'] = isset($_POST['SQ_STRUCTURE_SHOW_UNDERLINE']);
239  $this->pref_vars['SQ_STRUCTURE_TREE_FORMATTING']['default']['italic'] = isset($_POST['SQ_STRUCTURE_SHOW_ITALIC']);
240  $this->pref_vars['SQ_STRUCTURE_TREE_FORMATTING']['default']['delete'] = isset($_POST['SQ_STRUCTURE_SHOW_DELETE']);
241  $this->pref_vars['SQ_STRUCTURE_TREE_FORMATTING']['default']['insert'] = isset($_POST['SQ_STRUCTURE_SHOW_INSERT']);
242  $this->pref_vars['SQ_STRUCTURE_TREE_FORMATTING']['default']['connections'] = isset($_POST['SQ_STRUCTURE_SHOW_CONNECTIONS']);
243  }
244  if (is_null($pref) || $pref == 'SQ_STRUCTURE_TREE_NODE_CLASSES') {
245  $this->pref_vars['SQ_STRUCTURE_TREE_NODE_CLASSES']['default'] = $_POST['SQ_STRUCTURE_TREE_NODE_CLASSES'];
246  }
247  return TRUE;
248 
249  }//end processBackend()
250 
251 
252 }//end class
253 
254 ?>