コード例 #1
0
 public function __construct($filter = null)
 {
     if (null === $filter) {
         $filter = new Model_Road_Filter();
     }
     $this->setFilter($filter);
     $this->setMapper(Model_DB_Road_Mapper::get_instance());
 }
コード例 #2
0
 public function uploadAction()
 {
     $data = array();
     try {
         $roadId = $this->getRequestIdRoad();
         if ($roadId == 0) {
             throw new Exception("Incorrect Road ID");
         } else {
             /** @var $road Model_DB_Road_Object */
             $road = Model_DB_Road_Mapper::get_instance()->find($roadId);
         }
         $road->loadDataFromJSON($this->getRequestData());
         $data['success'] = true;
     } catch (Exception $e) {
         $data['success'] = false;
         $data['message'] = $e->getMessage();
     }
     $this->_helper->json->sendJson($data);
 }
コード例 #3
0
 public function approximateAction()
 {
     try {
         /** @var $dbRoad Model_DB_Road_Object */
         $dbRoad = Model_DB_Road_Mapper::get_instance()->find($this->getRequestIdRoad());
         $length = array(1.11, 1.38, 1.66, 1.85, 2.08, 2.22, 2.77, 2.78, 3.46, 3.7, 4.62, 5.53, 5.55, 7.4, 8.300000000000001, 9.23, 11.1, 13.85, 16.6, 22.2, 27.7);
         $road = new Model_Road($dbRoad);
         $data = array();
         for ($i = 0; $i < count($length); $i++) {
             $profile = new Model_Microprofile();
             $profile->setLength($length[$i]);
             $profile->setStep($dbRoad->getStep());
             $profile->setSourceRoad($road);
             $data[] = $profile;
         }
         $this->view->assign("data", $data);
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
コード例 #4
0
 public function save()
 {
     Model_DB_Road_Mapper::get_instance()->save($this);
 }