aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-09-16 11:11:08 -0300
committerSilvio <silvio@devlet.com.br>2010-09-16 11:11:08 -0300
commit21bd1c86b53d26645a8d6f36624cd6bfb0041f61 (patch)
treec489a09b067f9f3a8996ae6d6d67b99dd9105b12
parentaaf77d9ffa20677ade451c1008aa25733dc572dc (diff)
downloadcinisis-21bd1c86b53d26645a8d6f36624cd6bfb0041f61.tar.gz
cinisis-21bd1c86b53d26645a8d6f36624cd6bfb0041f61.tar.bz2
New map methods
-rw-r--r--classes/IsisMap.php77
1 files changed, 77 insertions, 0 deletions
diff --git a/classes/IsisMap.php b/classes/IsisMap.php
index 5e800f8..05a954e 100644
--- a/classes/IsisMap.php
+++ b/classes/IsisMap.php
@@ -347,4 +347,81 @@ class IsisMap extends IsisReader {
return FALSE;
}
+
+ /**
+ * Get attributes based on field and subfield.
+ *
+ * @param $field
+ * Field data from ISIS database schema.
+ *
+ * @param $subfield
+ * Subfield name.
+ *
+ * @return
+ * Attributes.
+ */
+ public function getAttributes(&$model, $field, $subfield = null)
+ {
+ $attributes = array();
+ $map = $this->getFullMap($field);
+
+ if ($map)
+ {
+ if (isset($map['attributes']['field']))
+ {
+ $attributes = $map['attributes']['field'];
+ }
+
+ if ($subfield == null)
+ {
+ return $attributes;
+ }
+
+ $key = $this->getSubfieldKey($field, $subfield);
+
+ if (isset($map['attributes'][$key]))
+ {
+ $attributes = array_merge($attributes, $map['attributes'][$key]);
+ }
+ }
+
+ return $attributes;
+ }
+
+ /**
+ * Defines the denied field combinations.
+ *
+ * @param $field
+ * Field data from ISIS database schema.
+ *
+ * @return
+ * Denied field combinations.
+ */
+ public function getDeniedCombinations($field)
+ {
+ /**
+ * Sample denied combination.
+ */
+ /**
+ $sample = array(
+ 0 => array('a', 'b', 'c'), // a AND b AND c OR
+ 1 => array('a', 'c', '!d'), // a AND b BUT WITHOUT d OR
+ 2 => array('a', 'b', '*'), // a AND b AND any other item OR
+ 3 => array('*2'), // ANY two items together OR
+ 4 => array('main', '*'), // main AND ANY other item OR
+ );
+ */
+
+ $map = $this->getFullMap($field);
+
+ if ($map)
+ {
+ if (isset($map['denied']))
+ {
+ return $map['denied'];
+ }
+ }
+
+ return array();
+ }
}