예제 #1
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>";
 }
예제 #2
0
    $album = albums::where('id', $id);
    $images = images::where('album_id', $id, 'all');
    $dados = array('pagina' => 'images_view', 'album' => $album, 'users' => $users, 'images' => $images);
    $app->render('layout.php', $dados);
});
$app->get('/admin/images/photo/delete/:id', function ($id) use($app) {
    login::estaLogado('user_logado', $app);
    $users = users::where('name', $_SESSION['name']);
    $view = $app->view();
    $view->setTemplatesDirectory(TEMPLATE_ADMIN);
    $album = albums::where('id', $id);
    $images = images::where('album_id', $id, 'all');
    $dados = array('pagina' => 'images_delete', 'album' => $album, 'users' => $users, 'images' => $images);
    $app->render('layout.php', $dados);
});
$app->get('/image/allow-access/:id', function ($id) use($app) {
    $attributes = ['open' => 1];
    $images = new images();
    $images->atualizar($id, $attributes);
});
$app->get('/image/deny-access/:id', function ($id) use($app) {
    $attributes = ['open' => 0];
    $images = new images();
    $images->atualizar($id, $attributes);
});
$app->delete('/image/delete/:id', function ($id) use($app) {
    $id = filter_var($id, FILTER_SANITIZE_NUMBER_INT);
    $images = new \app\models\images();
    $images->deletar($id);
    echo 'deletou';
});
예제 #3
0
<?php

use app\traits\login;
use app\models\users;
use app\models\categories;
use app\models\albums;
use app\models\images;
use app\models\orders;
$app->get('/painel', function () use($app) {
    login::estaLogado('user_logado', $app);
    $users = users::where('name', $_SESSION['name']);
    $categories = categories::find('all');
    $albums = albums::find('all');
    $images = images::find('all');
    $orders = orders::find('all');
    $view = $app->view();
    $view->setTemplatesDirectory(TEMPLATE_ADMIN);
    $dados = array('pagina' => 'painel', 'name' => $_SESSION['name'], 'users' => $users, 'categories' => $categories, 'albums' => $albums, 'images' => $images, 'orders' => $orders);
    $app->render('layout.php', $dados);
});
예제 #4
0
        $dados = array('categories' => $categories, 'customer' => $customer, 'items_order' => $items_order);
        $template = $twig->loadTemplate('order_detail.html');
        $template->display($dados);
    } else {
    }
});
$app->get('/area-do-cliente/:id/:slug', function ($id, $slug) use($app, $twig) {
    $logado = login::banLogado('user_logado', $app);
    if ($logado) {
        $customer = customers::where('name', $_SESSION['name']);
    } else {
    }
    $categories = \app\models\categories::listar();
    $album = \app\models\albums::where('slug', $slug);
    $id = $album->id;
    $_SESSION['album'] = $id;
    $images = \app\models\images::all(array('conditions' => array('album_id = ?', $id)));
    $dados = array('categories' => $categories, 'album' => $album, 'images' => $images, 'customer' => $customer);
    $template = $twig->loadTemplate('customer-albums-photos.html');
    $template->display($dados);
});
$app->get('/image/buy/:id', function ($id) use($app) {
    $attributes = ['purchased' => 1];
    $images = new \app\models\images();
    $images->atualizar($id, $attributes);
});
$app->get('/image/purchased/:id', function ($id) use($app) {
    $attributes = ['purchased' => 0];
    $images = new \app\models\images();
    $images->atualizar($id, $attributes);
});
예제 #5
0
$app->get('/:slug', function ($slug) use($app, $twig) {
    $logado = login::customerLogado('user_logado', $app);
    if ($logado) {
        $customer = customers::where('name', $_SESSION['name']);
    } else {
        $customer = null;
    }
    $categories = \app\models\categories::listar();
    $category = \app\models\categories::where('slug', $slug);
    $id = $category->id;
    $albums = \app\models\albums::where('category_id', $id, 'all');
    $dados = array('categories' => $categories, 'category' => $category, 'albums' => $albums, 'customer' => $customer);
    $template = $twig->loadTemplate('album.html');
    $template->display($dados);
});
$app->get('/:slug/:album', function ($slug, $album) use($app, $twig) {
    $logado = login::customerLogado('user_logado', $app);
    if ($logado) {
        $customer = customers::where('name', $_SESSION['name']);
    } else {
        $customer = null;
    }
    $categories = \app\models\categories::listar();
    $album = \app\models\albums::where('slug', $album);
    $id = $album->id;
    //$images = \app\models\images::where('album_id',$id, 'all');
    $images = \app\models\images::all(array('conditions' => array('album_id = ? AND open = ?', $id, 1)));
    $dados = array('categories' => $categories, 'album' => $album, 'images' => $images, 'customer' => $customer);
    $template = $twig->loadTemplate('photo.html');
    $template->display($dados);
});
예제 #6
0
 public static function getImage($id, $type)
 {
     $root_url = dirname($_SERVER['PHP_SELF']);
     $count = upload::where('image_user', '=', $id)->count();
     if ($count == 1) {
         $images = upload::where('image_user', '=', $id)->first();
         $thumbnail_url = "background-image: url(" . $root_url . "/" . $images->image_thumbnail . "); display: block; background-position: center center; width: 206px; padding-top: 206px;";
         echo "<a href='" . $root_url . "/upload_file/images/default/" . $images->image_name . "' target='_blank'>\n                  <i style='" . $thumbnail_url . "'></i>\n                </a>";
     } else {
         $thumbnail_url = "background-image: url(" . $root_url . "/upload_file/images/thumbnail/avatar_noPhoto.jpg); display: block; background-position: center center; width: 206px; padding-top: 206px;";
         echo "<a>\n                  <i style='" . $thumbnail_url . "'></i>\n                </a>";
     }
 }
예제 #7
0
    $slug = $app->request()->post('album-slug');
    if (empty($name) || empty($slug)) {
        $app->flash('erro', 'Nome ou Slug não podem ser vazios');
        $app->redirect('/admin/albums');
    } else {
        $attributes = ['name' => $name, 'category_id' => $category, 'price' => $price, 'slug' => $slug];
        $album = new albums();
        $album->atualizar($id, $attributes);
        $app->flash('sucesso', 'Categoria alterada com sucesso !');
        $app->redirect('/admin/albums');
    }
});
$app->post('/admin/albums/delete/:id', function ($id) use($app) {
    $albums = new albums();
    $images = new images();
    $imageCadastrada = images::where('album_id', $id);
    if (count($imageCadastrada) > 0) {
        $app->flash('erro', 'Este álbum possui fotos cadastradas');
        $app->redirect('/admin/albums');
    } else {
        $albums->deletar($id);
        $app->flash('sucesso', 'Álbum deletado com sucesso !');
        $app->redirect('/admin/albums');
    }
});
$app->post('/admin/albums/cover/:id', function () use($app) {
    $id = $app->request()->post('album-id');
    $foto = $_FILES['foto']['name'];
    $temp_foto = $_FILES['foto']['tmp_name'];
    $extensoes_permitidas = array('jpg', 'jpeg', 'png');
    if (empty($foto)) {
예제 #8
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();
 }