17 require_once SQ_CORE_PACKAGE_PATH.
'/system/conditions/condition/condition_edit_fns.inc';
18 require_once SQ_ATTRIBUTES_PATH.
'/selection/selection.inc';
43 parent::__construct();
62 if (empty($condition_data)) {
63 $condition_data = Array(
'keyword' =>
'',
'operator' =>
'ALL');
66 <table style=
"width: auto" class=
"no-borders">
68 <td><strong><?php echo translate(
'keyword'); ?></strong> </td>
71 $selected_keyword =
'';
72 if (isset($condition_data[
'keyword'])) {
73 $selected_keyword = $condition_data[
'keyword'];
76 if (empty($allowed_keywords)) {
78 $dummy_asset =
new Asset();
79 $allowed_keywords = array_keys($dummy_asset->getAvailableKeywords());
82 $keyword_options = Array();
83 $allowed_keywords = array_merge($allowed_keywords, array_keys(get_available_global_keywords()));
84 foreach ($allowed_keywords as $keyword) {
85 $keyword_options[$keyword] = $keyword;
89 if (!empty($allowed_keywords)) {
91 $keyword_info = self::_getKeywordInfo($selected_keyword, $allowed_keywords);
93 combo_box($prefix.
'[keyword]', array_merge($keyword_options), FALSE, $keyword_info[
'constant_part']);
97 if ($keyword_info[
'is_variable']) {
98 text_box($prefix.
'[keyword_extension]', $keyword_info[
'variable_part'], 30);
101 echo ($keyword_info[
'constant_part']).array_get_index($keyword_info,
'variable_part',
'');
104 echo(translate(
'core_keyword_list_empty'));
110 <td><strong><?php echo translate(
'pattern'); ?></strong> </td>
114 text_box($prefix.
'[keyword_match]', array_get_index($condition_data,
'keyword_match'), 30);
116 echo array_get_index($condition_data,
'keyword_match',
'');
124 check_box($prefix.
'[replace_keyword_in_match]',
'1', array_get_index($condition_data,
'replace_keyword_in_match',
'0'),
'', ($write_access ?
'' :
'disabled="disabled"'));
125 label(
'Replace keywords in pattern', $prefix.
'[replace_keyword_in_match]');
148 'keyword' => $_POST[$prefix][
'keyword'],
149 'keyword_match' => $_POST[$prefix][
'keyword_match'],
150 'replace_keyword_in_match' => array_get_index($_POST[$prefix],
'replace_keyword_in_match',
'0'),
153 if (!empty($_POST[$prefix][
'keyword_extension'])) {
154 $name_extension = trim($_POST[$prefix][
'keyword_extension']);
155 if (!empty($name_extension)) {
156 $results[
'keyword'] .= $name_extension;
188 $ret = Array(
'is_variable' => FALSE,
'constant_part' => $keyword_name,
'variable_part' =>
'');
190 $keyword_parts = Array();
191 foreach ($allowed_keywords as $allowed_keyword) {
192 if (preg_match(
'/_$/', $allowed_keyword)) {
194 if (preg_match(
'/^'.$allowed_keyword.
'(.*)$/', $keyword_name, $keyword_parts)) {
196 $ret = Array(
'is_variable' => TRUE,
'constant_part' => $allowed_keyword,
'variable_part' => $keyword_parts[1]);