Esempio n. 1
0
 public static function getidcard($id, $type)
 {
     $root_url = dirname($_SERVER['PHP_SELF']);
     $count = idcard::where('id_user', '=', $id)->count();
     if ($count == 1) {
         $resultidcard = idcard::where('id_user', '=', $id)->first();
         //old code
         /*if($type == 'image'){
             return $resultidcard->id_name;
           }else if($type == 'thumbnail'){
             return $resultidcard->id_thumbnail;
           }*/
         $ext = pathinfo($resultidcard->id_name, PATHINFO_EXTENSION);
         if ($ext == 'pdf') {
             $thumbnail_size = 100;
         } else {
             $thumbnail_size = 206;
         }
         $thumbnail_url = "background-image: url(" . $root_url . "/" . $resultidcard->id_thumbnail . "); display: block; background-position: center center; width: " . $thumbnail_size . "px; padding-top: " . $thumbnail_size . "px;";
         echo "<a href='" . $root_url . "/upload_file/idcard/default/" . $resultidcard->id_name . "' target='_blank'>\n                  <i style='" . $thumbnail_url . "'></i>\n                </a>";
     } else {
         $thumbnail_url = "background-image: url(" . $root_url . "/upload_file/idcard/thumbnail/nofile.png); display: block; background-position: center center; width: 106px; padding-top: 106px;";
         echo "<a>\n                  <i style='" . $thumbnail_url . "'></i>\n                  </a>";
     }
 }
Esempio n. 2
0
 public static function admingetuser($filter_group, $filter_value, $sort)
 {
     $root_url = dirname($_SERVER['PHP_SELF']);
     $count_MS = Userdetail::where('shirts', 'LIKE', 'MS')->count();
     $count_MM = Userdetail::where('shirts', 'LIKE', 'MM')->count();
     $count_ML = Userdetail::where('shirts', 'LIKE', 'ML')->count();
     $count_WS = Userdetail::where('shirts', 'LIKE', 'WS')->count();
     $count_WM = Userdetail::where('shirts', 'LIKE', 'WM')->count();
     $count_WL = Userdetail::where('shirts', 'LIKE', 'WL')->count();
     if ($filter_value == 'all') {
         $data = Member::orderBy('id')->get();
     } else {
         if ($filter_value == 0) {
             $data = Member::where('district', '=', NULL)->orwhere('district', '=', '0')->orderBy('district')->get();
         } else {
             $data = Member::where('district', '=', $filter_value)->orderBy('district')->get();
         }
     }
     echo "<p>จำนวนรายชื่อทั้งหมด : <b id='row_sum'>" . count($data) . "</b></p>";
     echo "<p>จำนวนเสื้อผู้ชายทั้งหมด MS : <b>" . $count_MS . "</b> , MM : <b>" . $count_MM . "</b> , ML : <b>" . $count_ML . "</b> </p>";
     echo "<p>จำนวนเสื้อผู้หญิงทั้งหมด WS : <b>" . $count_WS . "</b> , WM : <b>" . $count_WM . "</b> , WL : <b>" . $count_WL . "</b> </p>";
     echo "<table class='table table-bordered table-hover table-striped'>\n                <thead>\n                  <tr>\n                    <th class='text-center'>#</th>\n                    <th class='text-center'>ชื่อ - นามสกุล</th>\n                    <th class='text-center'>ชื่อเล่น</th>\n                    <th class='text-center no_print'>อีเมล</th>\n                    <th class='text-center'>โทรศัพท์</th>\n                    <th class='text-center'>เขต</th>\n                    <th class='text-center'>เกรด</th>\n                    <th class='text-center'>ขนาดเสื้อ</th>\n                    <th class='text-center'>remark</th>\n                    <th class='text-center'>สถานะผู้ใช้</th>\n                    <th class='text-center no_print'>ดำเนินการ</th>\n                  </tr>\n                </thead>\n                <tbody>";
     foreach ($data as $record) {
         //get idcard path
         $countid = idcard::where('id_user', '=', $record->id)->count();
         if ($countid == 1) {
             $resultidcard = idcard::where('id_user', '=', $record->id)->first();
             $idpath = $root_url . "/upload_file/idcard/default/" . $resultidcard->id_name;
         } else {
             $idpath = "";
         }
         //End get idcard path
         //get image path
         $countimage = upload::where('image_user', '=', $record->id)->count();
         if ($countimage == 1) {
             $resultimage = upload::where('image_user', '=', $record->id)->first();
             $image = $root_url . "/upload_file/images/default/" . $resultimage->image_name;
         } else {
             $image = "";
         }
         //End get image path
         //get distric
         if ($record->district == 0 || $record->district == NULL) {
             $district = "ต่างจังหวัด";
         } else {
             $resultdistric = district::where('id', '=', $record->district)->first();
             $district = $resultdistric->name;
         }
         //ENd get distric
         //get user detail
         $countuserdetail = Userdetail::where('id', '=', $record->id)->count();
         if ($countuserdetail == 1) {
             $Userdetail = Userdetail::where('id', '=', $record->id)->first();
             $grade = $Userdetail->grade;
             $remark = $Userdetail->remark;
             $shirts = $Userdetail->shirts;
             if ($grade == 0) {
                 $grade = "none";
             } else {
                 if ($grade == 1) {
                     $grade = "D";
                 } else {
                     if ($grade == 2) {
                         $grade = "C";
                     } else {
                         if ($grade == 3) {
                             $grade = "B";
                         } else {
                             $grade = "A";
                         }
                     }
                 }
             }
         } else {
             $grade = "none";
             $shirts = "none";
             $remark = "";
         }
         //end get user detail
         $u_status = $record->validate;
         $mail_st = substr($u_status, 1, 1);
         $id_st = substr($u_status, 2, 1);
         $id_valid = substr($u_status, 3, 1);
         echo "<tr><td>" . $record->id . "</td><td><a href='profile_admin/" . $record->id . "'>" . $record->name . " " . $record->surname . "</a></td><td>" . $record->nickname . "</td><td class='no_print'>" . $record->email . "</td><td class='text-center'>" . $record->phone . "</td><td class='text-center'>" . $district . "</td><td class='text-center'>" . $grade . "</td><td class='text-center'>" . $shirts . "</td><td>" . $remark . "</td><td class='text-center'>";
         //check image profile
         if ($countimage == 1) {
             echo "<a href='" . $image . "' target='_blank' ><label class='fa fa-photo' style='cursor:pointer;'></label></a>";
         }
         //check validate email
         if ($mail_st == 1) {
             echo "<img src='" . $root_url . "/public/image/email-valid.png' width='20px' />";
         } else {
             echo "<img src='" . $root_url . "/public/image/email-not.png' width='20px' />";
         }
         //check id card status
         if ($id_st == 1 && $id_valid == 1) {
             echo "<a href='" . $idpath . "' target='_blank'><img src='" . $root_url . "/public/image/id-valid.png' width='20px' /></a>";
         } else {
             if ($id_st == 1 && $id_valid == 0) {
                 echo "<a href='" . $idpath . "' target='_blank'><img src='" . $root_url . "/public/image/id-not.png' width='20px' /></a>";
             }
         }
         echo "</td><td class='text-center no_print'><a href='useredit_admin/" . $record->id . "'><img src='" . $root_url . "/public/image/file_edit.png' width='20px' /></a>\n                <a href='reportrequestjob/" . $record->id . "' target='_blank'>\n                <i class='fa fa-file-text fa-lg request_this_event' style='cursor:pointer;'></i>\n                </a>\n                </td></tr>";
     }
     echo "</tbody>\n                </table>";
 }
Esempio n. 3
0
 public static function save_database($user_id, $save_name, $role_method)
 {
     if ($role_method == "profile") {
         $count = imageDB::where('image_user', '=', $user_id)->count();
         if ($count == 1) {
             $database = imageDB::where('image_user', '=', $user_id)->first();
         } else {
             $database = new imageDB();
         }
         $database->image_name = $save_name;
         $database->image_thumbnail = "upload_file/images/thumbnail/" . $save_name;
         $database->image_user = $user_id;
     } else {
         $count = idcardDB::where('id_user', '=', $user_id)->count();
         if ($count == 1) {
             $database = idcardDB::where('id_user', '=', $user_id)->first();
         } else {
             $database = new idcardDB();
         }
         $database->id_name = $save_name;
         $database->id_thumbnail = "upload_file/idcard/thumbnail/" . $save_name;
         $database->id_user = $user_id;
         //update id validate status
         $user = Member::where('id', '=', $user_id)->first();
         $validate = $user->validate;
         $mail_st = substr($validate, 1, 1);
         $verify_id = substr($validate, 3, 1);
         $new_validate = "1" . $mail_st . "1" . $verify_id;
         $user->validate = $new_validate;
         $user->save();
         //End update id validate status
     }
     $database->save();
 }