aboutsummaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rw-r--r--classes/IsisMap.php35
-rw-r--r--classes/helpers/CinisisDisplayHelper.php59
2 files changed, 93 insertions, 1 deletions
diff --git a/classes/IsisMap.php b/classes/IsisMap.php
index e73e178..05c7ae9 100644
--- a/classes/IsisMap.php
+++ b/classes/IsisMap.php
@@ -279,6 +279,25 @@ class IsisMap extends IsisReader {
}
/**
+ * Get all subfield names.
+ *
+ * @param $field_key
+ * Field key.
+ *
+ * @return
+ * Array with subfield names.
+ */
+ public function getSubfieldNames($field_key) {
+ $subfields = array();
+
+ foreach ($this->format['fields'][$field_key]['subfields'] as $key => $value) {
+ $subfields[$key] = $value;
+ }
+
+ return $subfields;
+ }
+
+ /**
* Get a field name.
*
* @param $field_key
@@ -290,4 +309,20 @@ class IsisMap extends IsisReader {
public function getFieldName($field_key) {
return $this->format['fields'][$field_key]['name'];
}
+
+ /**
+ * Get all field names.
+ *
+ * @return
+ * Array with field names.
+ */
+ public function getFieldNames() {
+ $fields = array();
+
+ foreach ($this->format['fields'] as $key => $field) {
+ $fields[$key] = $field['name'];
+ }
+
+ return $fields;
+ }
}
diff --git a/classes/helpers/CinisisDisplayHelper.php b/classes/helpers/CinisisDisplayHelper.php
index 2f8fa65..0eb8d28 100644
--- a/classes/helpers/CinisisDisplayHelper.php
+++ b/classes/helpers/CinisisDisplayHelper.php
@@ -407,7 +407,7 @@ class CinisisDisplayHelper {
* @param $items
* Array with items to be merged.
*/
- protected function webMergeCsvItems($items) {
+ protected static function webMergeCsvItems($items) {
if (!empty($items)) {
self::csv(implode(';', $items));
}
@@ -415,4 +415,61 @@ class CinisisDisplayHelper {
self::csv();
}
}
+
+ /**
+ * Renders a radio button.
+ *
+ * @param $name
+ * Radio name.
+ *
+ * @param $value
+ * Radio value.
+ *
+ * @param $caption
+ * Radio caption.
+ *
+ * @param $checked
+ * Whether the radio is checked.
+ *
+ * @return
+ * HTML rendered radio button.
+ */
+ protected static function webRadio($name, $value, $caption, $checked = NULL) {
+ return '<input type="radio" name="'. $name .'" value="'. $value .'" '. $checked .' > '. $caption .'<br />';
+ }
+
+ /**
+ * Draws a combination of radio buttons.
+ *
+ * @param $name
+ * Radio names.
+ *
+ * @param $data
+ * Array with values and captions.
+ *
+ * @param $checked
+ * Index of the selected option.
+ */
+ protected static function webRadios($name, $data, $checked = NULL) {
+ $radios = '<table><tr><td>';
+ $count = 0;
+
+ foreach ($data as $key => $value) {
+ if ($count++ > 5) {
+ $count = 0;
+ $radios .= '</td><td>';
+ }
+
+ if ($key == $checked) {
+ $radios .= self::webRadio($name, $key, $value, 'checked');
+ }
+ else {
+ $radios .= self::webRadio($name, $key, $value);
+ }
+ }
+
+ $radios .= '</td></tr></table>';
+
+ return $radios;
+ }
}