Permalink
Browse files

Backend / JSONP / Map in old column names to minimize switch-over has…

…sle.
  • Loading branch information...
1 parent decfb74 commit 7abe935af3aa14fdef795e5948699362f61f1d76 @radgeek committed Dec 14, 2012
Showing with 33 additions and 1 deletion.
  1. +33 −1 extensions/fusion/sahanageofeature.class.php
@@ -34,7 +34,7 @@ public function longitude () {
return $ret;
}
- public function properties ( $geo = true ) {
+ public function properties ( $geo = true, $mapped = true ) {
$pp = $this->data->properties;
if ($geo) :
@@ -43,6 +43,24 @@ public function properties ( $geo = true ) {
$pp->Longitude = $this->longitude();
endif;
+ if ($mapped) :
+ foreach ($this->mapped_columns() as $to => $from) :
+ $vals = array();
+ $from = explode('|', $from);
+ foreach ($from as $prop) :
+ if (property_exists($pp, $prop)) :
+ if (is_null($val)) :
+ $vals[] = $pp->$prop;
+ endif;
+ endif;
+ endforeach;
+
+ if (count($vals) > 0) :
+ $pp->$to = implode("\n", $vals);
+ endif;
+ endforeach;
+ endif;
+
return $pp;
}
@@ -76,5 +94,19 @@ public function to_table ( &$cols ) {
return $ret;
} /* SahanaGeoFeature::to_table () */
+ function mapped_columns () {
+ return array(
+ "Title" => "name",
+ "Address" => "addr",
+ "DateAndTimes" => "open",
+ "Description" => "comments",
+ "Status" => "urgent|needed|no",
+ "Link" => "web",
+ "Region" => "L4",
+ "State" => "L1",
+ );
+ }
+
+
}

0 comments on commit 7abe935

Please sign in to comment.