public function updateCoordinatesAction() { $lng = trim($this->_getParam('lng', '')); $lat = trim($this->_getParam('lat', '')); $coordinates = "{$lng},{$lat}"; $now = time(); $driver = new Model_Driver($this->code); $driver->set('coordinates', $coordinates); $driver->set('locate_time', $now); $driver->save(); $this->sendResult(); }
public function editDriverAction() { $code = $this->_getParam('code', ''); $driver = new Model_Driver($code); $availableParams = array('name', 'phone'); foreach ($availableParams as $paramName) { $value = trim($this->_getParam($paramName, '')); $colName = str_replace('-', '_', $paramName); $driver->set($colName, $value); } if (empty($code)) { $code = substr(str_shuffle('12345678901234567890123456789012345678901234567890'), 0, 8); $verify = substr(str_shuffle('ABCDEFGHJKLMNPQRSTUVWXYZABCDEFGHJKLMNPQRSTUVWXYZABCDEFGHJKLMNPQRSTUVWXYZABCDEFGHJKLMNPQRSTUVWXYZ'), 0, 4); $driver->set('code', $code); $driver->set('code_verify', $verify); } $driver->save(); $this->_redirect('drivers'); }