public static function main() { $Member = Member::orderBy('nickname')->get(); $user_list = array(); foreach ($Member as $query) { $full_name = $query->nickname . " - " . $query->name . " " . $query->surname; $user_id = $query->id; $user_list[] = "[" . $user_id . "] " . $full_name; } echo json_encode($user_list); }
public static function create_userform($user_id, $value) { $user = Member::orderBy('name')->get(); $html = "<select name='" . $value . "' id='" . $value . "' class='form-control'>\n <option value='0'>none</option>"; foreach ($user as $recode) { $html .= "<option value='" . $recode->id . "'"; if ($user_id == $recode->id) { $html .= " selected='selected'"; } $html .= ">" . $recode->nickname . " - " . $recode->name . " " . $recode->surname . "</option>"; } $html .= "</select>"; return $html; }
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>"; }
public static function getuserform($id, $type) { $user = Member::orderBy('name')->get(); if ($type == 'edit') { $event = event::where("id", "=", $id)->first(); $id = $event->staff_contact_id; } echo "<select name='staff_contact_id' id='staff_contact_id' class='form-control'>"; foreach ($user as $recode) { echo "<option value='" . $recode->id . "'"; if ($id == $recode->id) { echo " selected='selected'"; } echo ">" . $recode->nickname . " - " . $recode->name . " " . $recode->surname . "</option>"; } echo "</select>"; }
<?php //namespace App\Http\Controllers; use App\Models\Member; //Class InstituteController extends Controller{ //public static function getinstitute(){ $user = Member::orderBy('name')->get(); $user_list = array(); foreach ($user as $record) { $user_list[] = $record->nickname . "-" . $record->name . " " . $record->surname . "[" . $record->id . "]"; } echo json_encode($user_list); //} //}