$options = array('output' => API_OUTPUT_EXTEND, 'preservekeys' => true); if (!is_null($writeonly)) { $options['editable'] = true; } $sysmaps = API::Map()->get($options); order_result($sysmaps, 'name'); foreach ($sysmaps as $sysmap) { $description = new CSpan($sysmap['name'], 'link'); if ($multiselect) { $js_action = 'javascript: addValue(' . zbx_jsvalue($reference) . ', ' . zbx_jsvalue($sysmap['sysmapid']) . ');'; } else { $values = array($dstfld1 => $sysmap[$srcfld1], $dstfld2 => $sysmap[$srcfld2]); $js_action = 'javascript: addValues(' . zbx_jsvalue($dstfrm) . ', ' . zbx_jsvalue($values) . '); close_window(); return false;'; } if (isset($excludeids[$sysmap['sysmapid']])) { $description->removeAttribute('class'); } else { $description->setAttribute('onclick', $js_action . ' jQuery(this).removeAttr("onclick");'); } if ($multiselect) { $description = new CCol(array(new CCheckBox('sysmaps[' . zbx_jsValue($sysmap[$srcfld1]) . ']', null, null, $sysmap['sysmapid']), $description)); } $table->addRow($description); unset($description); } if ($multiselect) { $button = new CButton('select', _('Select'), "javascript: addSelectedValues('sysmaps', " . zbx_jsvalue($reference) . ');'); $table->setFooter(new CCol($button, 'right')); insert_js('var popupReference = ' . zbx_jsvalue($sysmaps, true) . ';'); } $form->addItem($table);