* Browse all options.
*/
public function browse() {
- $mapper = CRM_Extension_System::singleton()->getMapper();
- $manager = CRM_Extension_System::singleton()->getManager();
// build announcements at the top of the page
$this->assign('extAddNewEnabled', CRM_Extension_System::singleton()->getBrowser()->isEnabled());
// TODO: Debate whether to immediately detect changes in underlying source tree
// $manager->refresh();
- // build list of local extensions
+ $localExtensionRows = $this->formatLocalExtensionRows();
+ $this->assign('localExtensionRows', $localExtensionRows);
+
+ $remoteExtensionRows = $this->formatRemoteExtensionRows($localExtensionRows);
+ $this->assign('remoteExtensionRows', $remoteExtensionRows);
+ }
+
+ /**
+ * Get the list of local extensions and format them as a table with
+ * status and action data.
+ *
+ * @return array
+ */
+ public function formatLocalExtensionRows() {
+ $mapper = CRM_Extension_System::singleton()->getMapper();
+ $manager = CRM_Extension_System::singleton()->getManager();
+
$localExtensionRows = array(); // array($pseudo_id => extended_CRM_Extension_Info)
$keys = array_keys($manager->getStatuses());
sort($keys);
$localExtensionRows[$row['id']] = $row;
}
- $this->assign('localExtensionRows', $localExtensionRows);
+ return $localExtensionRows;
+ }
+ /**
+ * Get the list of local extensions and format them as a table with
+ * status and action data.
+ *
+ * @param array $localExtensionRows
+ * @return array
+ */
+ public function formatRemoteExtensionRows($localExtensionRows) {
try {
$remoteExtensions = CRM_Extension_System::singleton()->getBrowser()->getExtensions();
}
}
$remoteExtensionRows[$row['id']] = $row;
}
- $this->assign('remoteExtensionRows', $remoteExtensionRows);
+
+ return $remoteExtensionRows;
}
/**