Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
content_type_raw_html_edit_fns.inc
1 <?php
18 require_once SQ_CORE_PACKAGE_PATH.'/content_type/content_type_edit_fns.inc';
19 
32 {
33 
34 
39  function __construct()
40  {
41  parent::__construct();
42 
43  }//end constructor
44 
45 
55  function paintBackend(&$asset, $prefix)
56  {
57  if ($asset->writeAccess('attributes')) {
58  $size = $GLOBALS['SQ_SYSTEM']->getUserPrefs($asset->type(), 'SQ_RAW_HTML_SIZE');
59  $html = $asset->attr('html');
60 
61  $em = $GLOBALS['SQ_SYSTEM']->getEventManager();
62  $keywords = Array();
63  $prepared_keywords = Array();
64  $keyword_vars = Array('keywords' => &$keywords);
65  $em->broadcastEvent($asset, 'requestKeywords', $keyword_vars);
66  if (!empty($keywords)) {
67  foreach ($keywords as $key => $name) {
68  $prepared_keywords['%'.$key.'%'] = $name;
69  }
70  keyword_selector($prepared_keywords, $prefix.'_html');
71  }
72  text_area($prefix.'_html', $html, '', '', 0, 'style="width: '.$size['width'].'; height: '.$size['height'].'; font-family: \'Courier New\', Courier, monospace; display: block"');
73  }
74  return TRUE;
75 
76  }//end paintBackend()
77 
78 
89  function processBackend($link, &$asset, $prefix)
90  {
91  if ($asset->writeAccess('attributes')) {
92  if (isset($_POST[$prefix.'_html'])) {
93  $html = $_POST[$prefix.'_html'];
94  $current_html = $asset->attr('html');
95  if ($html != $current_html) {
96  if ($asset->setAttrValue('html', $html)) return TRUE;
97  }
98  }
99  }
100  return FALSE;
101 
102  }//end processBackend()
103 
104 
105 }//end class
106 
107 ?>