Example #1
0
 public function confirmation($id = '')
 {
     if (!empty($id)) {
         $booking = CabBooking::first(array('id = ?' => $id, 'user_id' => $this->user->id));
         if (!empty($booking)) {
             $driver = CabDriver::first(array('id = ?' => $booking->id));
             $user = User::first(array('id = ?' => $driver->user_id));
             $view = $this->getActionView();
             $view->set('booking', $booking)->set('driver', $driver)->set('user', $user);
         } else {
             header('/');
         }
     } else {
         header('/');
     }
 }
Example #2
0
 public function documents()
 {
     $driver = User::first(array('id = ?' => $this->user->id));
     if ($driver->cab_driver == 1) {
         $view = $this->getActionView();
         $view_l = $this->getLayoutView();
         $driver = CabDriver::first(array('id = ?' => $this->user->id, 'vinfo_flag' => 1));
         if (!empty($driver)) {
             $view->set('vinfo', '');
         }
         $driver = CabDriver::first(array('approval = ?' => 0));
         if (!empty($driver)) {
             $view->set('sent_for_approval', '');
         }
         $driver = CabDriver::first(array('approval = ?' => 1));
         if (!empty($driver)) {
             $view->set('approved', '');
             $view_l->set('approved', '');
         }
         if (RequestMethods::post('docs')) {
             $target_dir = "/public/uploads/drivers/";
             $target_file = APP_PATH . $target_dir . $this->user->id . '_';
             $img = 0;
             // Check if image file is a actual image or fake image
             $check = getimagesize($_FILES["lic"]["tmp_name"]);
             $imageFileType1 = pathinfo($_FILES["lic"]["name"], PATHINFO_EXTENSION);
             if ($check !== false) {
                 $img++;
             }
             if ($imageFileType1 != "jpg" && $imageFileType1 != "png" && $imageFileType1 != "jpeg" && $_FILES["lic"]["size"] > 5000000) {
                 $img--;
             }
             $check = getimagesize($_FILES["v_ins"]["tmp_name"]);
             $imageFileType2 = pathinfo($_FILES["v_ins"]["name"], PATHINFO_EXTENSION);
             if ($check !== false) {
                 $img++;
             }
             if ($imageFileType2 != "jpg" && $imageFileType2 != "png" && $imageFileType2 != "jpeg" && $_FILES["v_ins"]["size"] > 5000000) {
                 $img--;
             }
             $check = getimagesize($_FILES["r_cer"]["tmp_name"]);
             $imageFileType3 = pathinfo($_FILES["r_cer"]["name"], PATHINFO_EXTENSION);
             if ($check !== false) {
                 $img++;
             }
             if ($imageFileType3 != "jpg" && $imageFileType3 != "png" && $imageFileType3 != "jpeg" && $_FILES["r_cer"]["size"] > 5000000) {
                 $img--;
             }
             if ($img == 3) {
                 $flag = 0;
                 if (move_uploaded_file($_FILES["lic"]["tmp_name"], $target_file . '1.' . $imageFileType1)) {
                     $flag++;
                 }
                 if (move_uploaded_file($_FILES["v_ins"]["tmp_name"], $target_file . '2.' . $imageFileType2)) {
                     $flag++;
                 }
                 if (move_uploaded_file($_FILES["r_cer"]["tmp_name"], $target_file . '3.' . $imageFileType3)) {
                     $flag++;
                 }
                 $driver->lic_img_ext = $imageFileType1;
                 $driver->v_ins_img_ext = $imageFileType2;
                 $driver->r_cer_img_ext = $imageFileType3;
                 if ($flag == 3) {
                     $driver->doc_flag = 1;
                     $driver->approval = 0;
                     $driver->save();
                     $view->set('sent_for_approval', '');
                 } else {
                     $view->set('error', '');
                 }
             } else {
                 $view->set('error', '');
             }
         }
     } else {
         header('/');
     }
 }
Example #3
0
 /**
  * @before _secure, changeLayout
  */
 public function d_requests($imgid = '')
 {
     $this->seo(array("title" => "Dashboard", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     if (!empty($imgid)) {
         $ext = CabDriver::first(array('id = ?' => $imgid));
         if (!empty($ext)) {
             $view->set('imgid', $imgid)->set('lic_img_ext', $ext->lic_img_ext)->set('v_ins_img_ext', $ext->v_ins_img_ext)->set('r_cer_img_ext', $ext->r_cer_img_ext);
         }
     }
     if (RequestMethods::post('appid')) {
         $d = CabDriver::first(array('id = ?' => RequestMethods::post('appid')));
         $d->approval = 1;
         $d->save();
     }
     if (RequestMethods::post('disappid')) {
         $d = CabDriver::first(array('id = ?' => RequestMethods::post('disappid')));
         $d->approval = 0;
         $d->save();
     }
     $drivers = CabDriver::all(array('doc_flag = ?' => '1'));
     $view->set('drivers', $drivers);
 }