Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
page_redirect_edit_fns.inc
1 <?php
18 require_once SQ_CORE_PACKAGE_PATH.'/page/page_edit_fns.inc';
19 
32 {
33 
34 
39  function __construct()
40  {
41  parent::__construct();
42  $this->static_screens['details']['lock_type'] = 'redirect';
43 
44  }//end constructor
45 
46 
57  function paintRedirectAssetid(&$asset, &$o, $prefix)
58  {
59  $redirect_asset = $asset->getRedirectAsset();
60  if ($asset->writeAccess('links')) {
61  asset_finder($prefix.'_redirect_assetid', (is_null($redirect_asset) ? 0 : $redirect_asset->id));
62  } else {
63  if (is_null($redirect_asset)) {
64  echo translate('cms_redirect_none_set');
65  } else {
66  echo get_asset_tag_line($redirect_asset->id);
67  }
68  }
69  return TRUE;
70 
71  }//end paintRedirectAssetid()
72 
73 
84  function processRedirectAssetid(&$asset, &$o, $prefix)
85  {
86  if (!isset($_POST[$prefix.'_redirect_assetid']['assetid']) || (isset($asset->_tmp['reverting_to_system_version']) && $asset->_tmp['reverting_to_system_version'])) {
87  return TRUE;
88  }
89 
90  $redirect_assetid = $_POST[$prefix.'_redirect_assetid']['assetid'];
91 
92  if ($redirect_assetid) {
93  $redirect_asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($redirect_assetid);
94  } else {
95  $redirect_asset = NULL;
96  }
97 
98  return $asset->setRedirectAsset($redirect_asset);
99 
100  }//end processRedirectAssetid()
101 
102 
113  function paintSessionVariables(&$asset, &$o, $prefix)
114  {
115  $wa = $asset->writeAccess('attributes');
116  $pmap = $asset->getAttribute('session_variables');
117  $current_params = $pmap->_params;
118  // Add in the variable names
119  $fields = $asset->attr('session_vars');
120  if (!empty($fields)) {
121  $vars = explode("\n", $fields);
122  foreach ($vars as $value) {
123  $index = str_replace(' ', '_', $value);
124  $index = rtrim($index, "\r");
125  $current_params['parameters'][$index] = 'Session Variable: '.$value;
126  }//end foreach
127  }//end if
128  $pmap->_params = $current_params;
129  if ($wa) {
130  $pmap->paint($prefix);
131  } else {
132  $pmap->paint($prefix, TRUE);
133  }
134  return TRUE;
135 
136  }//end paintSessionVariables()
137 
138 
149  function processSessionVariables(&$asset, &$o, $prefix)
150  {
151  $wa = $asset->writeAccess('attributes');
152  $pmap = $asset->getAttribute('session_variables');
153  if ($wa) {
154  $pmap->process($prefix);
155  $asset->setAttrValue('session_variables', $pmap->value);
156  $asset->saveAttributes();
157  }//end if
158 
159  return TRUE;
160 
161  }//end processSessionVariables()
162 
163 
164 }//end class
165 
166 ?>