示例#1
0
  	<?php 
require_once __DIR__ . '/../../../businessLogic/business.php';
$business = new business();
$offers = array();
// get the connected user id
if (isset($_COOKIE['auth'])) {
    $token = $_COOKIE['auth'];
    $id;
    $info = $business->check_token($token);
    if ($info != FALSE) {
        $user = $business->view_user($info['id']);
        $username = $user['loginId'];
        $usertype = $business->get_user_type($username);
        if ($usertype == 'company') {
            $id = $info['id'];
            $offers = $business->view_internship_offers($id);
        } else {
            $id = $_GET['id'];
            $offers = $business->view_internship_offers($id);
        }
    }
}
if ($offers) {
    foreach ($offers as $value) {
        if (isset($_GET['id'])) {
            echo '<div class="btn-group" role="group" aria-label="...">
                <button class="btn btn-default"><a href=./../../offers/' . $value['linkToOffer'] . '>' . $value['linkToOffer'] . '</a></button>
                <button class="btn btn-danger"><a href=./../../services/deleteOffer.php?id=' . $value['linkToOffer'] . '&idCompany=' . $_GET['id'] . '>delete</a></button>
              </div>
              <br/>';
        } else {