public function page() { $sBatch = (string) (\Akvo\WvW\ParticipantRegistry\Common\Model\Registry::getPastParticipationYears() + 1); if (isset($_GET['batch'])) { $sBatch = $_GET['batch']; } $sOrderByColumn = 'date_created'; if (isset($_GET['order_by_column'])) { $sOrderByColumn = $_GET['order_by_column']; } $sOrderByDirection = 'DESC'; if (isset($_GET['order_by_direction'])) { $sOrderByDirection = $_GET['order_by_direction']; } $aOrderBy = array('column' => $sOrderByColumn, 'direction' => $sOrderByDirection); $iPage = 1; if (isset($_GET['paging'])) { $iPage = (int) $_GET['paging']; } // Fetch Schools that have Registered $oRegistry = new \Akvo\WvW\ParticipantRegistry\Admin\Model\Registry(); $aRegistry = $oRegistry->getRegistryForBatch($sBatch, $aOrderBy); $iTotal = count($aRegistry); $iPages = ceil($iTotal / 20); $aRegistry = array_slice($aRegistry, ($iPage - 1) * 20, $iPage * 20); $aContent['total'] = $iTotal; $aContent['page'] = $iPage; $aContent['pages'] = $iPages; $aContent['registry'] = $aRegistry; $aContent['batches'] = $oRegistry->getBatches(); $aContent['page-config'] = array('batch' => $sBatch, 'order_by_column' => $sOrderByColumn, 'order_by_direction' => $sOrderByDirection); ob_start(); require AkvoWvwParticipantRegistry_Plugin_Dir . '/src/Fe/View/scripts/participantlist/participantlist.phtml'; return ob_get_clean(); }
public function getMarkerPoints() { //addresses procees in to geo codes global $wpdb; // Fetch Schools that have Registered $oRegistry = new \Akvo\WvW\ParticipantRegistry\Admin\Model\Registry(); $aData = $oRegistry->getRegistryForBatch(); $aReturn = array(); foreach ($aData as $aRecord) { $aTemp = array('name' => $aRecord['name'], 'lat' => $aRecord['latitude'], 'long' => $aRecord['longitude']); array_push($aReturn, $aTemp); } $sReturnJson = json_encode($aReturn); return $sReturnJson; }
public function page() { $oMap = new Model\Map(); $sZoomFactor = $oMap->getZoomFactor(); $aCenterPoint = $oMap->getCenterPoint(); $sJsonGeocodes = $oMap->getMarkerPoints(); $oRegistry = new \Akvo\WvW\ParticipantRegistry\Admin\Model\Registry(); $aOrderBy = array('column' => 'city', 'direction' => 'ASC'); $aContent['registry'] = $oRegistry->getRegistryForBatch('2014', $aOrderBy); //add school table $aContent['page-config'] = array('batch' => '2014', 'order_by_column' => 'city', 'order_by_direction' => 'ASC'); ob_start(); require AkvoWvwParticipantRegistry_Plugin_Dir . '/src/Fe/View/scripts/map/map.phtml'; return ob_get_clean(); }