18 require_once SQ_SYSTEM_ROOT.
'/core/attributes/parameter_map/parameter_map.inc';
52 parent::__construct($assetid);
70 $settings[
'name'] = $request_data[
'name'];
71 $settings[
'value'] = $request_data[
'value'];
72 $settings[
'value_map'] =
'';
74 $new_prefix = str_replace(array(
'[',
']'),
'_', array_get_index($request_data,
'new_prefix',
''));
77 $atr_parameter_map->process($new_prefix.
'_parameter_map');
78 $settings[
'value_map'] = $atr_parameter_map->value;
105 public static function execute($settings, &$state)
108 $var_name = @$settings[
'name'];
109 if (empty($var_name))
return FALSE;
111 if (empty($state[
'asset'])) {
113 if (empty($state[
'assetid'])) {
116 $state[
'asset'] = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($state[
'assetid']);
120 $old_current_asset = $GLOBALS[
'SQ_SYSTEM']->getGlobalDefine(
'CURRENT_ASSET', NULL);
121 $GLOBALS[
'SQ_SYSTEM']->setGlobalDefine(
'CURRENT_ASSET', $state[
'asset']);
123 $parameter_map_value = array_get_index($settings,
'value_map', serialize(Array()));
125 $param_map_value = $atr_parameter_map->getParameterValue(
'value');
127 if (is_null($old_current_asset)) {
128 $GLOBALS[
'SQ_SYSTEM']->unsetGlobalDefine(
'CURRENT_ASSET');
130 $GLOBALS[
'SQ_SYSTEM']->setGlobalDefine(
'CURRENT_ASSET', $old_current_asset);
134 if (!empty($param_map_value)) {
135 $value = $param_map_value;
137 $value = $settings[
'value'];
140 $_SESSION[SQ_SESSION_SANDBOX_INDEX][$var_name] = $value;
160 public static function getInterface($settings, $prefix, $write_access=FALSE)
164 $name = array_get_index($settings,
'name');
166 text_box($prefix.
'[name]', $name);
168 echo
'<b>'.$name.
'</b>';
170 $name_input = ob_get_clean();
173 $value = array_get_index($settings,
'value');
175 text_box($prefix.
'[value]', $value);
177 echo
'<b>'.$value.
'</b>';
179 $value_input = ob_get_clean();
183 $new_prefix = str_replace(array(
'[',
']'),
'_', $prefix);
184 hidden_field($prefix.
'[new_prefix]', $new_prefix);
186 $parameter_map_value = array_get_index($settings,
'value_map', serialize(Array()));
189 $atr_parameter_map->setParameter(
'value',
'Value');
190 echo $atr_parameter_map->paint($new_prefix.
'_parameter_map');
193 $parameter_map_input = ob_get_clean();
195 $output = translate(
'trigger_set_session_var_interface', $name_input, $value_input, $parameter_map_input);