17 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
18 require_once SQ_SYSTEM_ROOT.
'/core/attributes/parameter_map/parameter_map.inc';
19 require_once SQ_CORE_PACKAGE_PATH.
'/system/triggers/trigger_action/trigger_action.inc';
55 public static function execute($settings, &$state)
57 if (empty($settings[
'layout_assetid']) && empty($settings[
'override_layout_assetid'])) {
63 if (empty($state[
'asset'])) {
65 if (empty($state[
'assetid'])) {
68 $state[
'asset'] = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($state[
'assetid']);
72 $am = $GLOBALS[
'SQ_SYSTEM']->am;
74 if (isset($settings[
'layout_map'])) {
76 $parameter_map_value = array_get_index($settings,
'layout_map', serialize(Array()));
78 $layouts[
'paint_layout::system::frontend'] = $attr_parameter_map->getParameterValue(
'parameter_map_layout_assetid');
79 $layouts[
'override::paint_layout::system::frontend'] = $attr_parameter_map->getParameterValue(
'parameter_map_override_layout_assetid');
83 $layouts[
'paint_layout::system::frontend'] = empty($layouts[
'paint_layout::system::frontend']) ? array_get_index($settings,
'layout_assetid', 0) : $layouts[
'paint_layout::system::frontend'];
84 $layouts[
'override::paint_layout::system::frontend'] = empty($layouts[
'override::paint_layout::system::frontend']) ? array_get_index($settings,
'override_layout_assetid', 0) : $layouts[
'override::paint_layout::system::frontend'];
91 'assetid' => $state[
'asset']->
id,
92 'layout' => isset($settings[
'layout_assetid']) ? $settings[
'layout_assetid'] :
'',
93 'override_layout' => isset($settings[
'override_layout_assetid']) ? $settings[
'override_layout_assetid'] :
'',
109 public static function getInterface($settings, $prefix, $write_access=FALSE)
111 $selected_layout_assetid = empty($settings[
'layout_assetid']) ? 0 : $settings[
'layout_assetid'];
112 $selected_override_layout_assetid = empty($settings[
'override_layout_assetid']) ? 0 : $settings[
'override_layout_assetid'];
115 if ($selected_layout_assetid && !$GLOBALS[
'SQ_SYSTEM']->am->assetExists($selected_layout_assetid)) {
116 $selected_layout_assetid = 0;
118 if ($selected_override_layout_assetid && !$GLOBALS[
'SQ_SYSTEM']->am->assetExists($selected_override_layout_assetid)) {
119 $selected_override_layout_assetid = 0;
123 $new_prefix = str_replace(array(
'[',
']'),
'_', $prefix);
124 hidden_field($prefix.
'[new_prefix]', $new_prefix);
127 if (!$write_access) {
128 $layout_wa = !empty($selected_layout_assetid) ? get_asset_tag_line($selected_layout_assetid) :
'<i>'.translate(
'none').
'</i>';
129 $override_layout_wa = !empty($selected_override_layout_assetid) ? get_asset_tag_line($selected_override_layout_assetid) :
'<i>'.translate(
'none').
'</i>';
132 $layout_buttons = empty($selected_layout_assetid) ? Array(
'clear') : Array(
'clear',
'reset');
133 $override_layout_buttons = empty($selected_override_layout_assetid) ? Array(
'clear') : Array(
'clear',
'reset');
138 <td><?php echo translate(
'trigger_set_paint_layout_select'); ?> </td>
139 <td><?php echo $write_access ? translate(
'trigger_set_paint_layout', asset_finder($prefix.
'[layout_assetid]', $selected_layout_assetid, Array(
'paint_layout_page' =>
'D'),
'sq_sidenav', FALSE,
'null', $layout_buttons)) : $layout_wa; ?> </td>
141 <td><?php echo translate(
'trigger_set_override_paint_layout_select'); ?></td>
142 <td><?php echo $write_access ? translate(
'trigger_set_override_paint_layout', asset_finder($prefix.
'[override_layout_assetid]', $selected_override_layout_assetid, Array(
'paint_layout_page' =>
'D'),
'sq_sidenav', FALSE,
'null', $override_layout_buttons)) : $override_layout_wa; ?> </td>
147 $basic_contents = ob_get_clean();
151 $parameter_map_value = array_get_index($settings,
'layout_map', serialize(Array()));
153 $attr_parameter_map->setParameter(
'parameter_map_layout_assetid',
'Paint Layout Asset ID');
154 $attr_parameter_map->setParameter(
'parameter_map_override_layout_assetid',
'Override Paint Layout Asset ID');
155 echo $attr_parameter_map->paint($new_prefix.
'_parameter_map', !$write_access);
156 $parameter_map_contents = ob_get_clean();
158 return $basic_contents.
'<b>'.translate(
'trigger_set_paint_layout_parameter_map', $parameter_map_contents).
'</b>';
176 if (empty($request_data[
'layout_assetid'][
'assetid']) && empty($request_data[
'override_layout_assetid'][
'assetid'])) {
177 return 'Paint layout not specified';
180 $settings[
'layout_assetid'] = $request_data[
'layout_assetid'][
'assetid'];
181 $settings[
'override_layout_assetid'] = $request_data[
'override_layout_assetid'][
'assetid'];
183 $new_prefix = str_replace(array(
'[',
']'),
'_', array_get_index($request_data,
'new_prefix',
''));
185 $attr_parameter_map->process($new_prefix.
'_parameter_map');
186 $settings[
'layout_map'] = $attr_parameter_map->value;
202 public static function getLocks($settings, &$state)
205 $state[
'assetid'] => Array(