/** * search systems by name * @param $f3 * @param $params */ public function search($f3, $params) { $ccpDB = $this->getDB('CCP'); $searchToken = ''; // check for search parameter if (isset($params['arg1'])) { $searchToken = $params['arg1']; } $this->whereQuery = "WHERE\n map_sys.solarSystemName LIKE '%" . $searchToken . "%'"; $query = $this->_getQuery(); $rows = $ccpDB->exec($query); // format result $mapper = new Mapper\CcpSystemsMapper($rows); $data = $mapper->getData(); echo json_encode($data); }
/** * search systems by name * @param \Base $f3 * @param array $params */ public function search(\Base $f3, $params) { $ccpDB = $this->getDB('CCP'); $searchToken = ''; // check for search parameter if (isset($params['arg1'])) { $searchToken = $params['arg1']; } // some "edge cases" for testing trueSec rounding... //$searchToken = 'H472-N'; // -0.000001 -> 0.0 //$searchToken = 'X1E-OQ'; // -0.099426 -> -0.10 //$searchToken = 'BKK4-H'; // -0.049954 -> -0.05 //$searchToken = 'Uhtafal'; // 0.499612 -> 0.5 (HS) //$searchToken = 'Oshaima'; // 0.453128 -> 0.5 (HS) //$searchToken = 'Ayeroilen'; // 0.446568 -> 0.4 (LS) //$searchToken = 'Enderailen'; // 0.448785 -> 0.4 (LS) //$searchToken = 'Neziel'; // 0.449943 -> 0.4 (LS) //$searchToken = 'Naga'; // 0.033684 -> 0.1 (LS) $this->whereQuery = "WHERE\n map_sys.solarSystemName LIKE '%" . $searchToken . "%'"; $query = $this->_getQuery(); $rows = $ccpDB->exec($query); // format result $mapper = new Mapper\CcpSystemsMapper($rows); $data = $mapper->getData(); echo json_encode($data); }