Exemple #1
0
<?php

require_once '../class.db.php';
isset($_REQUEST['id_pool']) ? $id_pool = $_REQUEST['id_pool'] : ($id_pool = "");
isset($_REQUEST['id_saison']) ? $id_saison = $_REQUEST['id_saison'] : ($id_saison = "");
isset($_REQUEST['poolName']) ? $poolName = $_REQUEST['poolName'] : ($poolName = "");
isset($_REQUEST['gerant']) ? $gerant = $_REQUEST['gerant'] : ($gerant = "");
isset($_REQUEST['periode']) ? $periode = $_REQUEST['periode'] : ($periode = "");
isset($_REQUEST['func']) ? $func = $_REQUEST['func'] : ($func = "");
isset($_REQUEST['id_player']) ? $id_player = $_REQUEST['id_player'] : ($id_player = "");
isset($_REQUEST['injured']) ? $injured = $_REQUEST['injured'] : ($injured = "");
isset($_REQUEST['force_injury']) ? $force_injury = $_REQUEST['force_injury'] : ($force_injury = "");
isset($_REQUEST['force_injury_raison']) ? $force_injury_raison = $_REQUEST['force_injury_raison'] : ($force_injury_raison = "");
echo "func: {$func}";
DB::dbConnect(strtolower($poolName));
switch ($func) {
    case "chgPlayerInjuryStatus":
        $q = "update joueurs_nhl set injured='{$injured}',force_injury='{$force_injury}',force_injury_raison=\"{$force_injury_raison}\"\n                    where\n                         id_pool = {$id_pool}\n                         and saison_id = {$id_saison}\n                         and periode >= {$periode}\n                         and id_player = {$id_player}";
        //echo $q;
        DB::dbUpdate($q);
        $q = "update joueurs_nhl_1st_day set injured='{$injured}',force_injury='{$force_injury}',force_injury_raison=\"{$force_injury_raison}\"\n                    where\n                         id_pool = {$id_pool}\n                         and saison_id = {$id_saison}\n                         and periode >= {$periode}\n                         and id_player = {$id_player}";
        DB::dbUpdate($q);
        break;
}
Exemple #2
0
require_once '../lib/db.php';
require_once '../lib/admin.php';
require_once '../lib/html.php';
session_start();
$db = new DB();
$admin = new ADMIN();
$html = new HTML();
//print_r($_REQUEST);
//--> Add
if ($_REQUEST['action'] == "add" && $_REQUEST['frm_supplier_name'] && $_REQUEST['frm_supplier_phone_number']) {
    // filter input
    if (!$_REQUEST['frm_supplier_active']) {
        $_REQUEST['frm_supplier_active'] = "no";
    }
    // the query
    $db->dbConnect();
    $query = "INSERT INTO `mbs_suppliers` (`supplier_id`, \n\t\t\t\t\t\t\t\t\t\t   `supplier_name`, \n\t\t\t\t\t\t\t\t\t\t   `supplier_email`, \n\t\t\t\t\t\t\t\t\t\t   `supplier_phone_number`, \n\t\t\t\t\t\t\t\t\t\t   `supplier_postal_address`, \n\t\t\t\t\t\t\t\t\t\t   `supplier_last_year_purchase`, \n\t\t\t\t\t\t\t\t\t\t   `supplier_target`, \n\t\t\t\t\t\t\t\t\t\t   `supplier_growth_incentives`, \n\t\t\t\t\t\t\t\t\t\t   `supplier_budget`, \n\t\t\t\t\t\t\t\t\t\t   `supplier_po_ref_number`, \n\t\t\t\t\t\t\t\t\t\t   `supplier_active`, \n\t\t\t\t\t\t\t\t\t\t   `supplier_created_date`, \n\t\t\t\t\t\t\t\t\t\t   `supplier_created_by`, \n\t\t\t\t\t\t\t\t\t\t   `supplier_modified_date`, \n\t\t\t\t\t\t\t\t\t\t   `supplier_modified_by`) \n\n\t\t\t\tVALUES (NULL, \n\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_name']) . "', \n\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_email']) . "', \n\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_phone_number']) . "', \n\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_postal_address']) . "', \n\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_last_year_purchase']) . "', \n\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_target']) . "', \n\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_growth_incentives']) . "', \n\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_budget']) . "', \n\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_po_ref_number']) . "', \n\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_active']) . "', \n\t\t\t\t\t\t'" . date('Y-m-d H:i:s') . "', \n\t\t\t\t\t\t'" . $_SESSION['user']['login_name'] . "',\n\t\t\t\t\t\t'" . date('Y-m-d H:i:s') . "', \n\t\t\t\t\t\t'" . $_SESSION['user']['login_name'] . "')";
    $result = mysql_query($query);
    $intID = mysql_insert_id();
    if ($result) {
        // Insert the Marketing Contact
        if ($intID && $_REQUEST['frm_supplier_contact_name']) {
            $queryContact = "INSERT INTO `mbs_suppliers_marketing_contacts` (`supplier_contact_id`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  `supplier_id`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  `supplier_contact_name`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  `supplier_contact_position`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  `supplier_contact_email`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  `supplier_contact_phone_number`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  `supplier_contact_mobile_number`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  `supplier_contact_postal_address`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  `supplier_contact_active`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  `supplier_contact_created_date`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  `supplier_contact_created_by`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  `supplier_contact_modified_date`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  `supplier_contact_modified_by`) \n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES (NULL, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $intID . "', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_contact_name']) . "', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_contact_position']) . "', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_contact_email']) . "', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_contact_phone_number']) . "', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_contact_mobile_number']) . "', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_contact_postal_address']) . "', \t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'yes', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . date('Y-m-d H:i:s') . "', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['user']['login_name'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . date('Y-m-d H:i:s') . "', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['user']['login_name'] . "')";
            $resultContact = mysql_query($queryContact);
        }
        // if ($intID && $_REQUEST['frm_supplier_contact_name'])
        // Insert the Account Contact
        if ($intID && $_REQUEST['frm_supplier_account_name']) {
            $queryAccount = "INSERT INTO `mbs_suppliers_account_contacts` (`supplier_account_id`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   `supplier_id`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   `supplier_account_name`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   `supplier_account_email`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   `supplier_account_phone_number`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   `supplier_account_postal_address`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   `supplier_account_active`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   `supplier_account_created_date`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   `supplier_account_created_by`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   `supplier_account_modified_date`, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   `supplier_account_modified_by`) \n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES (NULL, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $intID . "', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_account_name']) . "', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_account_email']) . "', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_account_phone_number']) . "', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . mysql_real_escape_string($_REQUEST['frm_supplier_account_postal_address']) . "', \t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'yes', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . date('Y-m-d H:i:s') . "', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['user']['login_name'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . date('Y-m-d H:i:s') . "', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['user']['login_name'] . "')";
            $resultAccount = mysql_query($queryAccount);
        }
## Modification:
##
## 2014-08-27: Modification du format html des pages webs
## -------------------------------------------------------------------------------
##################################################################################
require_once '/data/disk1/www/interPool/src/class.db.php';
require_once '/data/disk1/www/interPool/admin_scripts/init.php';
/*----------------------------
MAIN
*/
$logFile = "/data/disk1/www/interPool/logs/update_id_capgeek.log";
$DESTDIR = "/data/disk1/www/interPool/downloads/capgeek";
$DESTDIR_PLAYER = "{$DESTDIR}/players";
$INSERTFILE = "/data/disk1/www/interPool/sql/upd_id_capgeek_doinsert.sql";
@unlink($INSERTFILE);
DB::dbConnect();
foreach (glob("{$DESTDIR}/*.html") as $item) {
    writelog($logFile, "info", "Analyzing file '{$item}'");
    unset($linesA);
    $linesA = file($item);
    foreach ($linesA as $line_number => $line) {
        if (preg_match("/href=\"\\/player\\//", $line, $matches, PREG_OFFSET_CAPTURE)) {
            $id_capgeek = 0;
            //echo $line;
            $ar1 = explode(">", $line);
            $ar2 = explode("/", $ar1[1]);
            $id_capgeek = substr($ar2[2], 0, strlen($ar2[2]) - 1);
            $player_lastname = $ar1[2];
            $player_lastname = trim($player_lastname);
            $player_lastname = substr($player_lastname, 0, strlen($player_lastname) - 1);
            // prénom du joueur
<?php

require_once 'config.DB_eSession.php';
require_once 'class.DB_eSession.php';
require_once '../class.interpool.php';
require_once '../class.db.php';
require_once '../browser_detection.php';
$sess_param['name'] = "DRAFT_INTERPOOL";
$sess = new DB_eSession($sess_param);
// session_start() done.
// récupérer certaines informations de la session
$id_pool = $sess->getSessVar('id_pool', 0);
$id_saison = $sess->getSessVar('id_saison', 0);
$gerant = $sess->getSessVar('gerant', 0);
$poolName = $sess->getSessVar('poolName', 0);
$pool = new interPool();
// Connexion a la bd
DB::dbConnect(strtolower($poolName)) or die("Erreur de connexion à la bd '{$poolName}'");
//$pool->dbConnect(strtolower($poolName)) or die("Erreur de connexion à la bd '$poolName'");
$query = "select do_refresh\r\n          from\r\n               draft_refresh_screen\r\n          where\r\n               id_pool = {$id_pool}\r\n               and saison_id = {$id_saison}\r\n               and id_gerant = {$gerant}";
$data = DB::dbSelect($query);
$data = $data[0];
$do_refresh = $data['do_refresh'];
if ($do_refresh != 0) {
    $query = "update draft_refresh_screen set do_refresh=0\r\n                     where\r\n                         id_pool = {$id_pool}\r\n                         and saison_id = {$id_saison}\r\n                         and id_gerant = {$gerant}";
    DB::dbUpdate($query);
}
//$pool -> dbClose();
DB::dbClose();
echo $do_refresh;
unset($query, $resultID, $message, $pool, $id_pool, $id_saison, $poolName, $gerant, $sess, $data, $do_refresh);
DB::dbConnect();
$q = "SELECT id,name,toUpdate,saison FROM pools where toUpdate = 'Y'";
$data = DB::dbSelect($q);
DB::dbClose();
foreach ($data as $item) {
    $id_pool = $item['id'];
    $name = $item['name'];
    $toUpdate = $item['toUpdate'];
    $id_saison = $item['saison'];
    //if ($id_pool != 8) continue;
    if ($toUpdate != 'Y') {
        writelog($logFile, strtoupper($name), "toUpdate of pool '{$name}' (id={$id_pool}) is set to 'N'");
        continue;
    }
    writelog($logFile, strtoupper($name), "Pool {$name} ({$id_pool})");
    DB::dbConnect(strtolower($name));
    $configA = $upd->getPoolConfig($id_pool, $id_saison);
    $date_debut_saison = $configA['date_debut_saison'];
    $pts_but_f = $configA['pts_but_f'];
    $pts_passe_f = $configA['pts_passe_f'];
    $pts_but_d = $configA['pts_but_d'];
    $pts_passe_d = $configA['pts_passe_d'];
    $pts_win = $configA['pts_victoire_gardien'];
    $pts_loss = $configA['pts_defaite_gardien'];
    $pts_tie = $configA['pts_nulle_gardien'];
    $pts_shutout = $configA['pts_blanc_gardien'];
    $periode = $upd->getPeriode($id_pool, $id_saison, $today);
    $date_begin_per = $upd->getPeriodeDateDebut($id_pool, $id_saison, $periode);
    $date_begin_per == $today ? $view2use = "view_alignementGerant_1st_day" : ($view2use = "view_alignementGerant");
    $q = "select id,real_name_abrege from accounts\n          where\n               id_pool = {$id_pool}\n               and saison_id = {$id_saison}";
    $data2 = DB::dbSelect($q);
Exemple #6
0
 function checkSupplierCatalogueStock($intSupplierId, $text, $strYear, $strMonth)
 {
     $conn = DB::dbConnect();
     $maxSpot = 384;
     $spot;
     $theme;
     if (strpos($text, "Catalogue - IN 2 Health") !== false) {
         $theme = "Catalogue - IN 2 Health";
     } else {
         if (strpos($text, "Catalogue - Pharmacy4Less") !== false) {
             $theme = "Catalogue - Pharmacy4Less";
         } else {
             if (strpos($text, "Catalogue - Roy Young") !== false) {
                 $theme = "Catalogue - Roy Young";
             } else {
                 if (strpos($text, "Themed Catalogue - Pharmacy4Less") !== false) {
                     $theme = "Themed Catalogue - Pharmacy4Less";
                 } else {
                     if (strpos($text, "Themed Catalogue - Roy Young") !== false) {
                         $theme = "Themed Catalogue - Roy Young";
                     }
                 }
             }
         }
     }
     if (strpos($text, "Double Spot") !== false) {
         $spot = 2;
     } else {
         if (strpos($text, "Full Page") !== false) {
             $spot = 16;
         } else {
             if (strpos($text, "8 Spots") !== false) {
                 $spot = 8;
             } else {
                 if (strpos($text, "4 Spots") !== false) {
                     $spot = 4;
                 } else {
                     if (strpos($text, "Single Spot") !== false) {
                         $spot = 1;
                     } else {
                         if (strpos($text, "Themed Supplementary") !== false) {
                             $spot = 2;
                         }
                     }
                 }
             }
         }
     }
     $query = "SELECT \n\t\t\t\t\tSUM(\n\t\t\t\t\t\tCASE\n\t\t\t\t    \t\tWHEN LOCATE('Double Spot',activity.activity_name)>0 THEN '2'\n\t\t\t\t\t\t\tWHEN LOCATE('Full Page',activity.activity_name)>0 THEN '16'\n\t\t\t\t\t\t\tWHEN LOCATE('8 Spots',activity.activity_name)>0 THEN '8'\n\t\t\t\t\t\t\tWHEN LOCATE('4 Spots',activity.activity_name)>0 THEN '4'\n\t\t\t\t\t\t\tWHEN LOCATE('Single Spot',activity.activity_name)>0 THEN '1'\n\t\t\t\t\t\t\tWHEN LOCATE('Themed Supplementary',activity.activity_name)>0 THEN '2'\n\t\t\t\t    \tEND\n\t\t\t\t\t) AS stock\n\t\t\t\tFROM \n\t\t\t\t\tmbs_bookings_activities AS booking \n\t\t\t\tINNER JOIN \n\t\t\t\t\tmbs_activities AS activity \n\t\t\t\t\tON activity.activity_id = booking.activity_id \n\t\t\t\tWHERE \n\t\t\t\t\tactivity.activity_name like '%" . $theme . "%'\n\t\t\t\t\tAND booking_activity_month = '" . $strMonth . "' \n\t\t\t\t\tAND booking_activity_year = '" . $strYear . "'";
     $result = mysql_query($query, $conn);
     $row = mysql_fetch_assoc($result);
     if ($row['stock'] + $spot <= 384) {
         return TRUE;
     } else {
         return FALSE;
     }
 }
Exemple #7
0
 function affichage_scoreboard($ptr_pool, $ptr_sess)
 {
     /*
     Je vais le faire de la manière suivante: avant 10h00 am, je vais afficher les résultats de la veille et le clic du match
     ira sur la page de tous les scores de la veille.
     Après 10h00, je vais afficher les matchs du jour, que ce soit en cours, à venir ou terminé.
     Une fois les matchs du jour terminé, j'afficherai les matchs à venir.
     */
     echo "<div id=\"gameReel\">\n";
     echo "<div id=\"hdrSB\">";
     echo "<div class=\"hdrSBLeftRule\"></div>\n";
     $SB_max = 14;
     $compteur_SB = 0;
     $id_pool = $ptr_sess->getSessVar('id_pool', 0);
     $id_saison = $ptr_sess->getSessVar('id_saison', '0');
     $poolName = $ptr_sess->getSessVar('poolName', '');
     DB::dbConnect(strtolower($poolName));
     // quelle ronde somme-nous rendus?
     $query = "select * from playoffs2_config\n                         where\n                              id_pool = {$id_pool}\n                              and saison_id = {$id_saison}";
     $data = DB::dbSelect($query);
     $data = $data[0];
     $ronde_nhl = $data['ronde_nhl'];
     switch ($ronde_nhl) {
         case 1:
             $date_debut_ronde = $data['date_debut_series'];
             break;
         case 2:
             $date_debut_ronde = $data['date_debut_ronde2'];
             break;
         case 3:
             $date_debut_ronde = $data['date_debut_ronde3'];
             break;
         case 4:
             $date_debut_ronde = $data['date_debut_ronde4'];
             break;
     }
     $q = "select a.home,a.visitor,a.game_result\n                    from schedule_playoffs a,playoffs_series_nhl b\n                    where\n                         (a.home = b.team1 or a.home = b.team2)\n                         and a.date >= b.date_debut_ronde\n                         and a.game_result != '-'\n                         and b.saison_id = {$id_saison}\n                         and b.ronde = {$ronde_nhl}";
     $data = DB::dbSelect($q);
     foreach ($data as $item) {
         $home = $item['home'];
         $visitor = $item['visitor'];
         $game_result = $item['game_result'];
         list($visitor_score, $toto, $home_score, $ot) = explode(" ", $game_result);
         if ($visitor_score > $home_score) {
             isset($teamWins[$visitor]) ? $teamWins[$visitor]++ : ($teamWins[$visitor] = 1);
         } else {
             isset($teamWins[$home]) ? $teamWins[$home]++ : ($teamWins[$home] = 1);
         }
     }
     if ($ptr_pool->todayDate->format('H') <= "06") {
         $today = $ptr_pool->yesterday;
         $link_to_gs = "individuel";
         $journee = "Aujourd'hui";
     } elseif ($ptr_pool->todayDate->format('H') <= "09") {
         $today = $ptr_pool->yesterday;
         $link_to_gs = "global";
         $journee = "Hier";
     } else {
         $today = $ptr_pool->today;
         $journee = "Aujourd'hui";
     }
     if ($journee == "Hier") {
         // premièrement, affichage des résultats de la veille...
         $query = "select home,visitor,time,game_result\n                         from schedule_playoffs\n                         where date = '{$today}'\n                         order by time asc";
         $resultID = mysql_query($query, $ptr_pool->handle);
         while ($data = mysql_fetch_array($resultID, MYSQL_ASSOC)) {
             $home_team = $data['home'];
             $visitor_team = $data['visitor'];
             $game_time = $data['time'];
             $game_result = $data[game_result];
             // abbréviation des équipes...
             $query2 = "select abbr from teams where id = {$home_team}";
             $resultID2 = mysql_query($query2, $ptr_pool->handle);
             $data2 = mysql_fetch_array($resultID2, MYSQL_ASSOC);
             mysql_free_result($resultID2);
             $abbr_home = $data2['abbr'];
             $query2 = "select abbr from teams where id = {$visitor_team}";
             $resultID2 = mysql_query($query2, $ptr_pool->handle);
             $data2 = mysql_fetch_array($resultID2, MYSQL_ASSOC);
             mysql_free_result($resultID2);
             $abbr_visitor = $data2['abbr'];
             $game_resultA = split(" ", $game_result);
             $goals_visitor = $game_resultA[0];
             $goals_home = $game_resultA[2];
             $ot_str = $game_resultA[3];
             isset($teamWins[$home_team]) ? $home_wins = $teamWins[$home_team] : ($home_wins = 0);
             isset($teamWins[$visitor_team]) ? $visitor_wins = $teamWins[$visitor_team] : ($visitor_wins = 0);
             if ($home_wins > $visitor_wins) {
                 $str_series = "{$abbr_home} mène {$home_wins}-{$visitor_wins}";
             } elseif ($visitor_wins > $home_wins) {
                 $str_series = "{$abbr_visitor} mène {$visitor_wins}-{$home_wins}";
             } else {
                 $str_series = "Égal {$home_wins}-{$visitor_wins}";
             }
             echo "<div class=\"hdrSBFinalGame\" onmouseover=\"this.style.cursor='pointer';\" " . "onclick=\"window.open('http://www.nhl.com/scores/index.html','NHL GS','resizable=yes,scrollbars=yes,status=no');\">\n";
             echo "<table cellpadding=0 cellspacing=0 border=0 width=90%>\n";
             echo "<tr>\n";
             echo "<td colspan=2 valign=\"bottom\" class=\"hdrSBLink\"><span class=\"hdrSBRed\">{$journee}</span></td>\n";
             echo "</tr>\n";
             echo "<tr>\n";
             echo "<td><span class=\"hdrSBStrg\">{$abbr_visitor}</span></td>\n";
             echo "<td align=\"right\"><span class=\"hdrSBStrg\">{$goals_visitor}</span></td>\n";
             echo "</tr>\n";
             echo "<tr>\n";
             echo "<td><span class=\"hdrSBStrg\">{$abbr_home}</span></td>\n";
             echo "<td align=\"right\"><span class=\"hdrSBStrg\">{$goals_home}</span></td>\n";
             echo "</tr>\n";
             echo "<tr>\n";
             echo "<td colspan=2 valign=\"top\"><span class=\"hdrSBRed\">FINAL {$ot_str}</span></td>\n";
             echo "</tr>\n";
             echo "<tr>\n";
             echo "<td colspan=2 valign=\"top\"><span class=\"hdrSBStrg\">{$str_series}</span></td>\n";
             echo "</tr>\n";
             echo "</table>\n";
             echo "</div>\n";
             $compteur_SB++;
             unset($ot_str, $game_time);
         }
         mysql_free_result($resultID);
         if ($compteur_SB > 0) {
             echo "<div class=\"hdrSBRule\"></div>\n";
             echo "<div class=\"hdrSBRule\"></div>\n";
         }
         // Ensuite, les matchs du jour
         $query = "select home,visitor,time,match_no\n                         from schedule_playoffs\n                         where date = '{$ptr_pool->today}'\n                         order by time asc";
         $resultID = mysql_query($query, $ptr_pool->handle);
         while ($data = mysql_fetch_array($resultID, MYSQL_ASSOC)) {
             if ($compteur_SB > $SB_max) {
                 break;
             }
             $home_team = $data['home'];
             $visitor_team = $data['visitor'];
             $game_timeA = split(" ", $data['time']);
             $game_time = $game_timeA[0];
             $match_no = $data['match_no'];
             // abbréviation des équipes...
             $query2 = "select abbr from teams where id = {$home_team}";
             $resultID2 = mysql_query($query2, $ptr_pool->handle);
             $data2 = mysql_fetch_array($resultID2, MYSQL_ASSOC);
             mysql_free_result($resultID2);
             $abbr_home = $data2['abbr'];
             $query2 = "select abbr from teams where id = {$visitor_team}";
             $resultID2 = mysql_query($query2, $ptr_pool->handle);
             $data2 = mysql_fetch_array($resultID2, MYSQL_ASSOC);
             mysql_free_result($resultID2);
             $abbr_visitor = $data2['abbr'];
             isset($teamWins[$home_team]) ? $home_wins = $teamWins[$home_team] : ($home_wins = 0);
             isset($teamWins[$visitor_team]) ? $visitor_wins = $teamWins[$visitor_team] : ($visitor_wins = 0);
             if ($home_wins > $visitor_wins) {
                 $str_series = "{$abbr_home} mène {$home_wins}-{$visitor_wins}";
             } elseif ($visitor_wins > $home_wins) {
                 $str_series = "{$abbr_visitor} mène {$visitor_wins}-{$home_wins}";
             } else {
                 $str_series = "Égal {$home_wins}-{$visitor_wins}";
             }
             echo "<div class=\"hdrSBTodayGame\" onmouseover=\"this.style.cursor='pointer';\" " . "onclick=\"window.open('http://www.nhl.com/scores/index.html','NHL GS','width=640,height=480,resizable=yes,scrollbars=yes,status=no');\">\n";
             echo "<table cellpadding=0 cellspacing=0 border=0 width=90%>\n";
             echo "<tr>\n";
             echo "<td colspan=2 valign=\"bottom\" class=\"hdrSBLink\"><span class=\"hdrSBYellow\">Aujourd'hui</span></td>\n";
             echo "</tr>\n";
             echo "<tr>\n";
             echo "<td><span class=\"hdrSBStrg\">{$abbr_visitor}</span></td>\n";
             echo "<td align=\"right\"><span class=\"hdrSBStrg\">-</span></td>\n";
             echo "</tr>\n";
             echo "<tr>\n";
             echo "<td><span class=\"hdrSBStrg\">{$abbr_home}</span></td>\n";
             echo "<td align=\"right\"><span class=\"hdrSBStrg\">-</span></td>\n";
             echo "</tr>\n";
             echo "<tr>\n";
             echo "<td nowrap colspan=2 valign=\"top\"><span class=\"hdrSBYellow\">{$game_time} &nbsp;(#{$match_no})</span></td>\n";
             echo "</tr>\n";
             echo "<tr>\n";
             echo "<td nowrap colspan=2 valign=\"top\"><span class=\"hdrSBStrg\">{$str_series}</span></td>\n";
             echo "</tr>\n";
             echo "</table>\n";
             echo "</div>\n";
             $compteur_SB++;
             unset($ot_str, $game_time);
         }
         mysql_free_result($resultID);
         // Finalement, si le compteur du scoreboard n'est pas à son maximum, on affiche les matchs
         // à venir jusqu'à la limite du compteur.
         if ($compteur_SB < $SB_max) {
             echo "<div class=\"hdrSBRule\"></div>\n";
             echo "<div class=\"hdrSBRule\"></div>\n";
             $nbre_de_sb_a_ajouter = $SB_max - $compteur_SB;
             if ($ptr_pool->todayDate->format('H') <= "09") {
                 list($year, $month, $day) = split("-", $ptr_pool->today);
                 $_mydate = Datetime::createFromFormat('Y-m-d', $ptr_pool->today, $ptr_pool->timeZone);
                 $_mydate->modify("+1 day");
                 $tomorrow = $_mydate->format('Y-m-d');
             } else {
                 list($year, $month, $day) = split("-", $today);
                 $_mydate = Datetime::createFromFormat('Y-m-d', $today, $ptr_pool->timeZone);
                 $_mydate->modify("+1 day");
                 $tomorrow = $_mydate->format('Y-m-d');
             }
             //$tomorrow = date("Y-m-d",((mktime(10,0,0,$month,$day,$year)) + 86400));
             $query = "select home,visitor,time,date,match_no\n                              from schedule_playoffs\n                              where date >= '{$tomorrow}'\n                              order by date asc,time asc\n                              limit {$nbre_de_sb_a_ajouter}";
             $resultID = mysql_query($query, $ptr_pool->handle);
             $date_en_traitement = "";
             while ($data = mysql_fetch_array($resultID, MYSQL_ASSOC)) {
                 $home_team = $data['home'];
                 $visitor_team = $data['visitor'];
                 $game_timeA = split(" ", $data['time']);
                 $game_time = $game_timeA[0];
                 $game_date = $data['date'];
                 $match_no = $data['match_no'];
                 if ($game_time == "") {
                     $game_time = "TBD";
                 }
                 // abbréviation des équipes...
                 $query2 = "select abbr from teams where id = {$home_team}";
                 $resultID2 = mysql_query($query2, $ptr_pool->handle);
                 $data2 = mysql_fetch_array($resultID2, MYSQL_ASSOC);
                 mysql_free_result($resultID2);
                 $abbr_home = $data2['abbr'];
                 $query2 = "select abbr from teams where id = {$visitor_team}";
                 $resultID2 = mysql_query($query2, $ptr_pool->handle);
                 $data2 = mysql_fetch_array($resultID2, MYSQL_ASSOC);
                 mysql_free_result($resultID2);
                 $abbr_visitor = $data2['abbr'];
                 if ($date_en_traitement == "") {
                     $date_en_traitement = $game_date;
                 }
                 if ("{$game_date}" != "{$date_en_traitement}") {
                     echo "<div class=\"hdrSBRule\"></div>\n";
                     echo "<div class=\"hdrSBRule\"></div>\n";
                     $date_en_traitement = $game_date;
                 }
                 $_mydate = Datetime::createFromFormat('Y-m-d', $game_date, $ptr_pool->timeZone);
                 $day = $_mydate->format("j");
                 $day_str = $_mydate->format("D");
                 $month = $_mydate->format("m");
                 switch ($day_str) {
                     case "Mon":
                         $day_str = "Lun";
                         break;
                     case "Tue":
                         $day_str = "Mar";
                         break;
                     case "Wed":
                         $day_str = "Mer";
                         break;
                     case "Thu":
                         $day_str = "Jeu";
                         break;
                     case "Fri":
                         $day_str = "Ven";
                         break;
                     case "Sat":
                         $day_str = "Sam";
                         break;
                     case "Sun":
                         $day_str = "Dim";
                         break;
                 }
                 isset($teamWins[$home_team]) ? $home_wins = $teamWins[$home_team] : ($home_wins = 0);
                 isset($teamWins[$visitor_team]) ? $visitor_wins = $teamWins[$visitor_team] : ($visitor_wins = 0);
                 if ($home_wins > $visitor_wins) {
                     $str_series = "{$abbr_home} mène {$home_wins}-{$visitor_wins}";
                 } elseif ($visitor_wins > $home_wins) {
                     $str_series = "{$abbr_visitor} mène {$visitor_wins}-{$home_wins}";
                 } else {
                     $str_series = "Égal {$home_wins}-{$visitor_wins}";
                 }
                 echo "<div class=\"hdrSBFutureGame\" onmouseover=\"this.style.cursor='pointer';\" " . "onclick=\"window.open('http://www.nhl.com/scores/index.html','NHL GS','width=640,height=480,resizable=yes,scrollbars=yes,status=no');\">\n";
                 echo "<table cellpadding=0 cellspacing=0 border=0 width=90%>\n";
                 echo "<tr>\n";
                 echo "<td colspan=2 valign=\"bottom\" class=\"hdrSBLink\"><span class=\"hdrSBGrey\">{$day_str} {$day}/{$month}</span></td>\n";
                 echo "</tr>\n";
                 echo "<tr>\n";
                 echo "<td><span class=\"hdrSBStrg\">{$abbr_visitor}</span></td>\n";
                 echo "<td align=\"right\"><span class=\"hdrSBStrg\">-</span></td>\n";
                 echo "</tr>\n";
                 echo "<tr>\n";
                 echo "<td><span class=\"hdrSBStrg\">{$abbr_home}</span></td>\n";
                 echo "<td align=\"right\"><span class=\"hdrSBStrg\">-</span></td>\n";
                 echo "</tr>\n";
                 echo "<tr>\n";
                 echo "<td nowrap colspan=2 valign=\"top\"><span class=\"hdrSBGrey\">{$game_time} &nbsp;(#{$match_no})</span></td>\n";
                 echo "</tr>\n";
                 echo "<tr>\n";
                 echo "<td nowrap colspan=2 valign=\"top\"><span class=\"hdrSBStrg\">{$str_series}</span></td>\n";
                 echo "</tr>\n";
                 echo "</table>\n";
                 echo "</div>\n";
                 $compteur_SB++;
                 unset($ot_str, $game_time);
             }
         }
     } else {
         // schedule du jour
         $query = "select home,visitor,time,match_no\n                         from schedule_playoffs\n                         where date = '{$today}'\n                         order by time asc";
         $resultID = mysql_query($query, $ptr_pool->handle);
         //Pour avoir les parties terminées en premier, suivi des parties en cours et finalement,
         // les parties qui vont se jouer plus tard, on va créer des arrays afin de vérifier
         // les données de la tables 'live'. Les games finished seront placées au début d'une nouvelle
         // array et c'est cette dernière que je vais traiter par la suite.
         while ($data = mysql_fetch_array($resultID, MYSQL_ASSOC)) {
             $home_team = $data['home'];
             $visitor_team = $data['visitor'];
             $game_timeA = split(" ", $data['time']);
             $game_time = $game_timeA[0];
             $match_no = $data['match_no'];
             $homeTeamA[] = $home_team;
             $visitorTeamA[] = $visitor_team;
             $gameTimeA[] = $game_time;
             $match_noA[] = $match_no;
         }
         mysql_free_result($resultID);
         unset($homeTeamBonOrderA, $visitorTeamBonOrdreA, $gameTimeBonOrdreA);
         $index_array = 20;
         $first_index_array = 20;
         if (count($homeTeamA) > 0) {
             foreach ($homeTeamA as $index => $home_team) {
                 $query = "select temps_ecoule\n                                   from live_stats.statsPlayers_live\n                                   where id_team = {$home_team}\n                                   limit 1";
                 $resultID = mysql_query($query, $ptr_pool->handle);
                 $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                 mysql_free_result($resultID);
                 if (eregi("Final", $data[temps_ecoule])) {
                     $first_index_array--;
                     $homeTeamBonOrderA[$first_index_array] = $home_team;
                     $visitorTeamBonOrdreA[$first_index_array] = $visitorTeamA[$index];
                     $gameTimeBonOrdreA[$first_index_array] = $gameTimeA[$index];
                     $match_noBonOrdreA[$first_index_array] = $match_noA[$index];
                 } else {
                     $homeTeamBonOrderA[$index_array] = $home_team;
                     $visitorTeamBonOrdreA[$index_array] = $visitorTeamA[$index];
                     $gameTimeBonOrdreA[$index_array] = $gameTimeA[$index];
                     $match_noBonOrdreA[$index_array] = $match_noA[$index];
                     $index_array++;
                 }
             }
             ksort($homeTeamBonOrderA);
             ksort($visitorTeamBonOrdreA);
             ksort($gameTimeBonOrdreA);
             ksort($match_noBonOrdreA);
             foreach ($homeTeamBonOrderA as $index => $home_team) {
                 $visitor_team = $visitorTeamBonOrdreA[$index];
                 $game_time = $gameTimeBonOrdreA[$index];
                 $match_no = $match_noBonOrdreA[$index];
                 // abbréviation des équipes...
                 $query2 = "select abbr from teams where id = {$home_team}";
                 $resultID2 = mysql_query($query2, $ptr_pool->handle);
                 $data2 = mysql_fetch_array($resultID2, MYSQL_ASSOC);
                 mysql_free_result($resultID2);
                 $abbr_home = $data2['abbr'];
                 $query2 = "select abbr from teams where id = {$visitor_team}";
                 $resultID2 = mysql_query($query2, $ptr_pool->handle);
                 $data2 = mysql_fetch_array($resultID2, MYSQL_ASSOC);
                 mysql_free_result($resultID2);
                 $abbr_visitor = $data2['abbr'];
                 // si l'heure actuelle est plus petite que l'heure du match...
                 list($heure, $minute) = split(":", $game_time);
                 if ($ptr_pool->todayDate->format('H') < "{$heure}" || $ptr_pool->todayDate->format('H') == "{$heure}" && $ptr_pool->todayDate->format('i') < "{$minute}") {
                     if ($previous_game_was_finished != "") {
                         echo "<div class=\"hdrSBRule\"></div>\n";
                         echo "<div class=\"hdrSBRule\"></div>\n";
                         $previous_game_was_finished = "";
                     }
                     isset($teamWins[$home_team]) ? $home_wins = $teamWins[$home_team] : ($home_wins = 0);
                     isset($teamWins[$visitor_team]) ? $visitor_wins = $teamWins[$visitor_team] : ($visitor_wins = 0);
                     if ($home_wins > $visitor_wins) {
                         $str_series = "{$abbr_home} mène {$home_wins}-{$visitor_wins}";
                     } elseif ($visitor_wins > $home_wins) {
                         $str_series = "{$abbr_visitor} mène {$visitor_wins}-{$home_wins}";
                     } else {
                         $str_series = "Égal {$home_wins}-{$visitor_wins}";
                     }
                     echo "<div class=\"hdrSBTodayGame\" onmouseover=\"this.style.cursor='pointer';\" " . "onclick=\"window.open('http://www.nhl.com/scores/index.html','NHL GS','width=640,height=480,resizable=yes,scrollbars=yes,status=no');\">\n";
                     echo "<table cellpadding=0 cellspacing=0 border=0 width=90%>\n";
                     echo "<tr>\n";
                     echo "<td colspan=2 valign=\"bottom\" class=\"hdrSBLink\"><span class=\"hdrSBYellow\">Aujourd'hui</span></td>\n";
                     echo "</tr>\n";
                     echo "<tr>\n";
                     echo "<td><span class=\"hdrSBStrg\">{$abbr_visitor}</span></td>\n";
                     echo "<td align=\"right\"><span class=\"hdrSBStrg\">-</span></td>\n";
                     echo "</tr>\n";
                     echo "<tr>\n";
                     echo "<td><span class=\"hdrSBStrg\">{$abbr_home}</span></td>\n";
                     echo "<td align=\"right\"><span class=\"hdrSBStrg\">-</span></td>\n";
                     echo "</tr>\n";
                     echo "<tr>\n";
                     echo "<td nowrap colspan=2 valign=\"top\"><span class=\"hdrSBYellow\">{$game_time} &nbsp;(#{$match_no})</span></td>\n";
                     echo "</tr>\n";
                     echo "<tr>\n";
                     echo "<td nowrap colspan=2 valign=\"top\"><span class=\"hdrSBStrg\">{$str_series}</span></td>\n";
                     echo "</tr>\n";
                     echo "</table>\n";
                     echo "</div>\n";
                 } else {
                     // le match est soit en cours, soit terminé.
                     $query = "select team_goals,adv_goals,temps_ecoule,gs_link\n                                        from live_stats.statsPlayers_live\n                                        where id_team = {$home_team}\n                                        limit 1";
                     $resultID = mysql_query($query, $ptr_pool->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $my_team_goals = $data['team_goals'];
                     $my_adv_goals = $data['adv_goals'];
                     $my_temps_ecoule = $data['temps_ecoule'];
                     $my_gs_link = $data['gs_link'];
                     if (eregi("Final", $my_temps_ecoule)) {
                         $previous_game_was_finished = "oui";
                         isset($teamWins[$home_team]) ? $home_wins = $teamWins[$home_team] : ($home_wins = 0);
                         isset($teamWins[$visitor_team]) ? $visitor_wins = $teamWins[$visitor_team] : ($visitor_wins = 0);
                         // on ajoute la victoire du jour...
                         if ($my_adv_goals > $my_team_goals) {
                             $visitor_wins++;
                         } else {
                             $home_wins++;
                         }
                         if ($home_wins > $visitor_wins) {
                             $str_series = "{$abbr_home} mène {$home_wins}-{$visitor_wins}";
                         } elseif ($visitor_wins > $home_wins) {
                             $str_series = "{$abbr_visitor} mène {$visitor_wins}-{$home_wins}";
                         } else {
                             $str_series = "Égal {$home_wins}-{$visitor_wins}";
                         }
                         echo "<div class=\"hdrSBFinalGame\" onmouseover=\"this.style.cursor='pointer';\" " . "onclick=\"window.open('{$my_gs_link}','NHL GS','resizable=yes,scrollbars=yes,status=no');\">\n";
                         echo "<table cellpadding=0 cellspacing=0 border=0 width=90%>\n";
                         echo "<tr>\n";
                         echo "<td colspan=2 valign=\"bottom\" class=\"hdrSBLink\"><span class=\"hdrSBRed\">Aujourd'hui</span></td>\n";
                         echo "</tr>\n";
                         echo "<tr>\n";
                         echo "<td><span class=\"hdrSBStrg\">{$abbr_visitor}</span></td>\n";
                         echo "<td align=\"right\"><span class=\"hdrSBStrg\">{$my_adv_goals}</span></td>\n";
                         echo "</tr>\n";
                         echo "<tr>\n";
                         echo "<td><span class=\"hdrSBStrg\">{$abbr_home}</span></td>\n";
                         echo "<td align=\"right\"><span class=\"hdrSBStrg\">{$my_team_goals}</span></td>\n";
                         echo "</tr>\n";
                         echo "<tr>\n";
                         echo "<td colspan=2 valign=\"top\"><span class=\"hdrSBRed\">" . $my_temps_ecoule . "</span></td>\n";
                         echo "</tr>\n";
                         echo "<tr>\n";
                         echo "<td nowrap colspan=2 valign=\"top\"><span class=\"hdrSBStrg\">{$str_series}</span></td>\n";
                         echo "</tr>\n";
                         echo "</table>\n";
                         echo "</div>\n";
                     } else {
                         // le match est en cours...
                         if ($previous_game_was_finished != "") {
                             echo "<div class=\"hdrSBRule\"></div>\n";
                             echo "<div class=\"hdrSBRule\"></div>\n";
                             $previous_game_was_finished = "";
                         }
                         $str_temps_ecoule = "";
                         if ($my_temps_ecoule == "") {
                             $str_temps_ecoule = "???";
                             $period = 0;
                         } else {
                             $str_temps_ecoule = $my_temps_ecoule;
                         }
                         /*
                         if (eregi("remaining",$my_temps_ecoule)) {
                              $totoA = split(" ",$my_temps_ecoule);
                              if ($totoA[0] == "Period") {
                                   $period = $totoA[1];
                                   $time_remaining = $totoA[2];
                              } else {
                                   $period = $totoA[0];
                                   $time_remaining = $totoA[1];
                              }
                              $time_remaining = substr($time_remaining,1,strlen($time_remaining)-1);
                              $str_temps_ecoule = "$time_remaining ";
                         }
                         
                         if (eregi("end of",$my_temps_ecoule)) {
                              $totoA = split(" ",$my_temps_ecoule);
                              $period = $totoA[count($totoA)-1];
                              $str_temps_ecoule = "END ";
                         }
                         
                         switch($period) {
                              case "0":
                                   break;
                              case "1":
                                   $str_temps_ecoule .= "1st";
                                   break;
                              case "2":
                                   $str_temps_ecoule .= "2nd";
                                   break;
                              case "3":
                                   $str_temps_ecoule .= "3rd";
                                   break;
                              case "4":
                                   $str_temps_ecoule .= "1st OT";
                                   break;
                              case "5":
                                   $str_temps_ecoule .= "2nd OT";
                                   break;
                              case "6":
                                   $str_temps_ecoule .= "3rd OT";
                                   break;
                              case "7":
                                   $str_temps_ecoule .= "4th OT";
                                   break;
                              case "8":
                                   $str_temps_ecoule .= "5th OT";
                                   break;
                              case "9":
                                   $str_temps_ecoule .= "6th OT";
                                   break;
                              default:
                                   $str_temps_ecoule .= "OT";
                                   break;
                         }
                         */
                         isset($teamWins[$home_team]) ? $home_wins = $teamWins[$home_team] : ($home_wins = 0);
                         isset($teamWins[$visitor_team]) ? $visitor_wins = $teamWins[$visitor_team] : ($visitor_wins = 0);
                         if ($home_wins > $visitor_wins) {
                             $str_series = "{$abbr_home} mène {$home_wins}-{$visitor_wins}";
                         } elseif ($visitor_wins > $home_wins) {
                             $str_series = "{$abbr_visitor} mène {$visitor_wins}-{$home_wins}";
                         } else {
                             $str_series = "Égal {$home_wins}-{$visitor_wins}";
                         }
                         echo "<div class=\"hdrSBTodayGame\" onmouseover=\"this.style.cursor='pointer';\" " . "onclick=\"window.open('{$my_gs_link}','NHL GS','resizable=yes,scrollbars=yes,status=no');\">\n";
                         echo "<table cellpadding=0 cellspacing=0 border=0 width=90%>\n";
                         echo "<tr>\n";
                         echo "<td colspan=2 valign=\"bottom\" class=\"hdrSBLink\"><span class=\"hdrSBYellow\">En cours...</span></td>\n";
                         echo "</tr>\n";
                         echo "<tr>\n";
                         echo "<td><span class=\"hdrSBStrg\">{$abbr_visitor}</span></td>\n";
                         echo "<td align=\"right\"><span class=\"hdrSBStrg\">{$my_adv_goals}</span></td>\n";
                         echo "</tr>\n";
                         echo "<tr>\n";
                         echo "<td><span class=\"hdrSBStrg\">{$abbr_home}</span></td>\n";
                         echo "<td align=\"right\"><span class=\"hdrSBStrg\">{$my_team_goals}</span></td>\n";
                         echo "</tr>\n";
                         echo "<tr>\n";
                         echo "<td colspan=2 valign=\"top\"><span class=\"hdrSBYellow\">{$str_temps_ecoule}</span></td>\n";
                         echo "</tr>\n";
                         echo "<tr>\n";
                         echo "<td colspan=2 valign=\"top\"><span class=\"hdrSBStrg\">{$str_series}</span></td>\n";
                         echo "</tr>\n";
                         echo "</table>\n";
                         echo "</div>\n";
                     }
                 }
                 $compteur_SB++;
                 unset($ot_str, $journee, $game_time);
             }
         }
         // Finalement, si le compteur du scoreboard n'est pas à son maximum, on affiche les matchs
         // à venir jusqu'à la limite du compteur.
         if ($compteur_SB < $SB_max) {
             if ($compteur_SB > 0) {
                 echo "<div class=\"hdrSBRule\"></div>\n";
                 echo "<div class=\"hdrSBRule\"></div>\n";
             }
             $nbre_de_sb_a_ajouter = $SB_max - $compteur_SB;
             list($year, $month, $day) = split("-", $today);
             $_mydate = Datetime::createFromFormat('Y-m-d', $today, $ptr_pool->timeZone);
             $_mydate->modify("+1 day");
             $tomorrow = $_mydate->format('Y-m-d');
             $query = "select home,visitor,time,date,match_no\n                              from schedule_playoffs\n                              where date >= '{$tomorrow}'\n                              order by date asc,time asc\n                              limit {$nbre_de_sb_a_ajouter}";
             $resultID = mysql_query($query, $ptr_pool->handle);
             $date_en_traitement = "";
             while ($data = mysql_fetch_array($resultID, MYSQL_ASSOC)) {
                 $home_team = $data['home'];
                 $visitor_team = $data['visitor'];
                 $game_timeA = split(" ", $data['time']);
                 $game_time = $game_timeA[0];
                 $game_date = $data['date'];
                 $match_no = $data['match_no'];
                 if ($game_time == "") {
                     $game_time = "TBD";
                 }
                 // abbréviation des équipes...
                 $query2 = "select abbr from teams where id = {$home_team}";
                 $resultID2 = mysql_query($query2, $ptr_pool->handle);
                 $data2 = mysql_fetch_array($resultID2, MYSQL_ASSOC);
                 mysql_free_result($resultID2);
                 $abbr_home = $data2['abbr'];
                 $query2 = "select abbr from teams where id = {$visitor_team}";
                 $resultID2 = mysql_query($query2, $ptr_pool->handle);
                 $data2 = mysql_fetch_array($resultID2, MYSQL_ASSOC);
                 mysql_free_result($resultID2);
                 $abbr_visitor = $data2['abbr'];
                 if ($date_en_traitement == "") {
                     $date_en_traitement = $game_date;
                 }
                 if ("{$game_date}" != "{$date_en_traitement}") {
                     echo "<div class=\"hdrSBRule\"></div>\n";
                     echo "<div class=\"hdrSBRule\"></div>\n";
                     $date_en_traitement = $game_date;
                 }
                 $_mydate = Datetime::createFromFormat('Y-m-d', $game_date, $ptr_pool->timeZone);
                 $day = $_mydate->format("j");
                 $day_str = $_mydate->format("D");
                 $month = $_mydate->format("m");
                 switch ($day_str) {
                     case "Mon":
                         $day_str = "Lun";
                         break;
                     case "Tue":
                         $day_str = "Mar";
                         break;
                     case "Wed":
                         $day_str = "Mer";
                         break;
                     case "Thu":
                         $day_str = "Jeu";
                         break;
                     case "Fri":
                         $day_str = "Ven";
                         break;
                     case "Sat":
                         $day_str = "Sam";
                         break;
                     case "Sun":
                         $day_str = "Dim";
                         break;
                 }
                 isset($teamWins[$home_team]) ? $home_wins = $teamWins[$home_team] : ($home_wins = 0);
                 isset($teamWins[$visitor_team]) ? $visitor_wins = $teamWins[$visitor_team] : ($visitor_wins = 0);
                 if ($home_wins > $visitor_wins) {
                     $str_series = "{$abbr_home} mène {$home_wins}-{$visitor_wins}";
                 } elseif ($visitor_wins > $home_wins) {
                     $str_series = "{$abbr_visitor} mène {$visitor_wins}-{$home_wins}";
                 } else {
                     $str_series = "Égal {$home_wins}-{$visitor_wins}";
                 }
                 echo "<div class=\"hdrSBFutureGame\" onmouseover=\"this.style.cursor='pointer';\" " . "onclick=\"window.open('http://www.nhl.com/scores/index.html','NHL GS','resizable=yes,scrollbars=yes,status=no');\">\n";
                 echo "<table cellpadding=0 cellspacing=0 border=0 width=90%>\n";
                 echo "<tr>\n";
                 echo "<td colspan=2 valign=\"bottom\" class=\"hdrSBLink\"><span class=\"hdrSBGrey\">{$day_str} {$day}/{$month}</span></td>\n";
                 echo "</tr>\n";
                 echo "<tr>\n";
                 echo "<td><span class=\"hdrSBStrg\">{$abbr_visitor}</span></td>\n";
                 echo "<td align=\"right\"><span class=\"hdrSBStrg\">-</span></td>\n";
                 echo "</tr>\n";
                 echo "<tr>\n";
                 echo "<td><span class=\"hdrSBStrg\">{$abbr_home}</span></td>\n";
                 echo "<td align=\"right\"><span class=\"hdrSBStrg\">-</span></td>\n";
                 echo "</tr>\n";
                 echo "<tr>\n";
                 echo "<td nowrap colspan=2 valign=\"top\"><span class=\"hdrSBGrey\">{$game_time} &nbsp;(#{$match_no})</span></td>\n";
                 echo "</tr>\n";
                 echo "<tr>\n";
                 echo "<td nowrap colspan=2 valign=\"top\"><span class=\"hdrSBStrg\">{$str_series}</span></td>\n";
                 echo "</tr>\n";
                 echo "</table>\n";
                 echo "</div>\n";
                 $compteur_SB++;
                 unset($ot_str, $journee, $game_time);
             }
         }
     }
     echo "<div class=\"hdrSBRule\"></div>\n";
     echo "</div>\n";
     echo "</div>\n";
     DB::dbClose();
 }
Exemple #8
0
    function showReportGeneralMonthly($intMonth, $intYear)
    {
        global $STR_URL;
        // vars
        $intMinBookingTime = 3600 * 24 * 7;
        // 3600 seconds * 24 hours * 14 days
        DB::dbConnect();
        ?>
		<script type="text/javascript" src="<?php 
        echo $STR_URL;
        ?>
js/jqplot/jquery.jqplot.min.js"></script>
		<script type="text/javascript" src="<?php 
        echo $STR_URL;
        ?>
js/jqplot/plugins/jqplot.pieRenderer.min.js"></script>
		
		
		<div align="center" style="margin-top:20px;">
		<form id="frm_report_date" method="get" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
">									
							
				<select id="month" name="month" class="input-medium">
					<?php 
        for ($i = 1; $i <= 12; $i++) {
            ?>
	
					<option value="<?php 
            echo $i;
            ?>
"<?php 
            if ($_REQUEST['month'] && $_REQUEST['month'] == $i) {
                ?>
 selected="selected"<?php 
            } elseif (!$_REQUEST['month'] && date('n') == $i) {
                ?>
 selected="selected"<?php 
            }
            ?>
><?php 
            echo HTML::getMonthName($i);
            ?>
</option>
					<?php 
        }
        ?>
				</select>
			
				<select id="year" name="year" class="input-small">
					<?php 
        for ($i = date('Y') - 1; $i < date('Y') + 4; $i++) {
            ?>
	
					<option value="<?php 
            echo $i;
            ?>
"<?php 
            if ($_REQUEST['year'] && $_REQUEST['year'] == $i) {
                ?>
 selected="selected"<?php 
            } elseif (!$_REQUEST['year'] && date('Y') == $i) {
                ?>
 selected="selected"<?php 
            }
            ?>
><?php 
            echo $i;
            ?>
</option>
					<?php 
        }
        ?>
				</select><br />

				<input class="btn" type="submit" value="Submit" />				
						
		</form>
		</div>

		<div style="text-align:center;clear:both;"><h2>General Report (<?php 
        echo HTML::getMonthName($intMonth) . " " . $intYear;
        ?>
)</h2></div>

		<!-- In-Store -->
		<div style="clear:both;"><h3 style="font-size:1.3em;">In-Store</h3></div>
		<table class="table table-bordered table-hover">
			<thead class="well">					
				<tr>
					<th style="text-align:center;width:20%;"><strong>Store</strong></th>
					<?php 
        // Get the In-Store activities
        $queryInStore = "SELECT * FROM `mbs_activities` WHERE `activity_category` = 'in-store' AND `activity_store_related` = 'yes' ORDER BY `activity_name`";
        $resultInStore = mysql_query($queryInStore);
        $intCountIntStore = mysql_num_rows($resultInStore);
        $arrDataInStoreAct = array();
        while ($rowInStore = mysql_fetch_assoc($resultInStore)) {
            $arrDataInStoreAct[] = $rowInStore;
            ?>
								<th style="text-align:center;"><strong><?php 
            echo htmlspecialchars($rowInStore['activity_name']);
            ?>
</strong></th>
							<?php 
        }
        ?>
				</tr>			  
			</thead>

			<tbody>
					
		<?php 
        $queryStore = "SELECT * FROM `mbs_stores` ORDER BY `store_name`";
        $resultStore = mysql_query($queryStore);
        while ($rowStore = mysql_fetch_assoc($resultStore)) {
            ?>
						
			<tr>
				<td><div style="text-align:left;"><?php 
            echo htmlspecialchars($rowStore['store_name']);
            ?>
</div></td>	
				
				<?php 
            for ($i = 0; $i < $intCountIntStore; $i++) {
                $arrInStoreResult = DB::checkActivityInStoreByDateTime($arrDataInStoreAct[$i]['activity_id'], $rowStore['store_id'], $intYear, $intMonth);
                $strBookingCode = DB::dbIDToField('mbs_bookings', 'booking_id', $arrInStoreResult['booking_id'], 'booking_code');
                $strBookingName = DB::dbIDToField('mbs_bookings', 'booking_id', $arrInStoreResult['booking_id'], 'booking_name');
                ?>
 
				
				<td style="background-color:<?php 
                if (count($arrInStoreResult) > 1) {
                    ?>
#f2dede<?php 
                } elseif (mktime(0, 0, 0, $intMonth, 1, $intYear) < time() + $intMinBookingTime) {
                    ?>
#ddd<?php 
                } else {
                    ?>
#dff0d8<?php 
                }
                ?>
;">
					<div style="text-align:center;font-size:0.8em;">
						<?php 
                if (count($arrInStoreResult) > 1) {
                    ?>
							<a href="booking_view.php?booking_id=<?php 
                    echo $arrInStoreResult['booking_id'];
                    ?>
&action=view#id<?php 
                    echo $arrInStoreResult['booking_activity_id'];
                    ?>
" title="<?php 
                    echo htmlspecialchars($strBookingCode);
                    ?>
 / <?php 
                    echo htmlspecialchars($strBookingName);
                    ?>
"><em><?php 
                    echo htmlspecialchars($strBookingCode);
                    ?>
</em></a>	
						<?php 
                } elseif (mktime(0, 0, 0, $intMonth, 1, $intYear) < time() + $intMinBookingTime) {
                    ?>
						N/A	
						<?php 
                } else {
                    ?>
							<a href="booking.php?action=add&frm_activity_id=<?php 
                    echo $arrDataInStoreAct[$i]['activity_id'];
                    ?>
&frm_store_id=<?php 
                    echo $rowStore['store_id'];
                    ?>
" style="color:#468847;">Available</a>
						<?php 
                }
                ?>
					</div>
				</td>
				
				<?php 
            }
            ?>
			</tr>	
		
		<?php 
        }
        // while ($rowStore = mysql_fetch_assoc($resultStore))
        ?>
					
			</tbody>
			<tfoot>
				<!--Sub Total-->
				<tr>
					<td><div style="text-align:right;"><strong>Sub-Total</strong></div></td>
					<?php 
        for ($i = 0; $i < $intCountIntStore; $i++) {
            $arrInStoreSubTotal = DB::getActivityInStoreTotalByDateTime($arrDataInStoreAct[$i]['activity_id'], $intYear, $intMonth);
            $strInStoreSubTotal = $arrInStoreSubTotal['booking_activity_price_total'];
            $strInStoreSubTotal = $strInStoreSubTotal;
            $strInStoreTotal += $strInStoreSubTotal;
            ?>
					<td><div style="text-align:right;">$<?php 
            echo htmlspecialchars(number_format($strInStoreSubTotal, 2));
            ?>
</div></td>
					<?php 
        }
        ?>
				</tr>
				<!-- Total -->
				<tr>					
					<td colspan="<?php 
        echo $intCountIntStore;
        ?>
"><div style="text-align:right;"><strong>Total</strong></div></td>
					<td style="background-color:#ddd;"><div style="text-align:right;"><strong>$<?php 
        echo htmlspecialchars(number_format($strInStoreTotal, 2));
        ?>
</strong></div></td>
				</tr>
			</tfoot>					
		</table>


		<!-- Catalogue -->
		<div style="clear:both;"><h3 style="font-size:1.3em;">Catalogue</h3></div>
		<table class="table table-bordered table-hover">
			<thead class="well">					
				<tr>
					<th style="text-align:center;width:20%;"><strong>Size/Spot</strong></th>
					<th style="text-align:center;"><strong>Booking</strong></th>
					<th style="text-align:center;width:20%;"><strong>Total</strong></th>
				</tr>
			</thead>
			<tbody>
		<?php 
        $queryCatalogue = "SELECT * FROM `mbs_activities` WHERE `activity_category` = 'catalogue' ORDER BY `activity_name`";
        $resultCatalogue = mysql_query($queryCatalogue);
        while ($rowCatalogue = mysql_fetch_assoc($resultCatalogue)) {
            $arrCatalogue = DB::getActivityByDateTime($rowCatalogue['activity_id'], $intYear, $intMonth);
            $strBookingCode = DB::dbIDToField('mbs_bookings', 'booking_id', $arrCatalogue['booking_id'], 'booking_code');
            $strBookingName = DB::dbIDToField('mbs_bookings', 'booking_id', $arrCatalogue['booking_id'], 'booking_name');
            $strCataloguePrice = $arrCatalogue['booking_activity_price_total'];
            $strCataloguePriceTotal += $strCataloguePrice;
            ?>
				<tr>
					<td><div style="text-align:left;"><?php 
            echo htmlspecialchars($rowCatalogue['activity_name']);
            ?>
</div></td>
					<td style="background-color:<?php 
            if (count($arrCatalogue) > 1) {
                ?>
#f2dede<?php 
            } elseif (mktime(0, 0, 0, $intMonth, 1, $intYear) < time() + $intMinBookingTime) {
                ?>
#ddd<?php 
            } else {
                ?>
#dff0d8<?php 
            }
            ?>
;">
					<div style="text-align:center;">
						<?php 
            if (count($arrCatalogue) > 1) {
                ?>
							<a href="booking_view.php?booking_id=<?php 
                echo $arrCatalogue['booking_id'];
                ?>
&action=view#id<?php 
                echo $arrCatalogue['booking_activity_id'];
                ?>
" title="<?php 
                echo htmlspecialchars($strBookingCode);
                ?>
 / <?php 
                echo htmlspecialchars($strBookingName);
                ?>
"><em><?php 
                echo htmlspecialchars($strBookingCode);
                ?>
</em></a>	
						<?php 
            } elseif (mktime(0, 0, 0, $intMonth, 1, $intYear) < time() + $intMinBookingTime) {
                ?>
						N/A	
						<?php 
            } else {
                ?>
							<a href="booking.php?action=add&frm_activity_id=<?php 
                echo $rowCatalogue['activity_id'];
                ?>
" style="color:#468847;">Available</a>
						<?php 
            }
            ?>
					</div>
				</td>
					<td><div style="text-align:right;">$<?php 
            echo htmlspecialchars(number_format($strCataloguePrice));
            ?>
</div></td>	
				</tr>
		<?php 
        }
        ?>
		
			</tbody>			
			<tfoot>
				<td colspan="2"><div style="text-align:right;"><strong>Total</strong></div></td>
				<td style="background-color:#ddd;"><div style="text-align:right;"><strong>$<?php 
        echo htmlspecialchars(number_format($strCataloguePriceTotal, 2));
        ?>
</strong></div></td>
			</tfoot>
		</table>


		<!-- Newspaper -->
		<div style="clear:both;"><h3 style="font-size:1.3em;">Newspaper</h3></div>
		<table class="table table-bordered table-hover">
			<thead class="well">					
				<tr>
					<th style="text-align:center;width:20%;"><strong>Size/Spot</strong></th>
					<th style="text-align:center;"><strong>Booking</strong></th>
					<th style="text-align:center;width:20%;"><strong>Total</strong></th>
				</tr>
			</thead>
			<tbody>
		<?php 
        $queryNewspaper = "SELECT * FROM `mbs_activities` WHERE `activity_category` = 'newspaper' ORDER BY `activity_name`";
        $resultNewspaper = mysql_query($queryNewspaper);
        while ($rowNewspaper = mysql_fetch_assoc($resultNewspaper)) {
            $arrNewspaper = DB::getActivityByDateTime($rowNewspaper['activity_id'], $intYear, $intMonth);
            $strBookingCode = DB::dbIDToField('mbs_bookings', 'booking_id', $arrNewspaper['booking_id'], 'booking_code');
            $strBookingName = DB::dbIDToField('mbs_bookings', 'booking_id', $arrNewspaper['booking_id'], 'booking_name');
            $strNewspaperPrice = $arrNewspaper['booking_activity_price_total'];
            $strNewspaperPriceTotal += $strNewspaperPrice;
            ?>
				<tr>
					<td><div style="text-align:left;"><?php 
            echo htmlspecialchars($rowNewspaper['activity_name']);
            ?>
</div></td>
					<td style="background-color:<?php 
            if (count($arrNewspaper) > 1) {
                ?>
#f2dede<?php 
            } elseif (mktime(0, 0, 0, $intMonth, 1, $intYear) < time() + $intMinBookingTime) {
                ?>
#ddd<?php 
            } else {
                ?>
#dff0d8<?php 
            }
            ?>
;">
					<div style="text-align:center;">
						<?php 
            if (count($arrNewspaper) > 1) {
                ?>
							<a href="booking_view.php?booking_id=<?php 
                echo $arrNewspaper['booking_id'];
                ?>
&action=view#id<?php 
                echo $arrNewspaper['booking_activity_id'];
                ?>
" title="<?php 
                echo htmlspecialchars($strBookingCode);
                ?>
 / <?php 
                echo htmlspecialchars($strBookingName);
                ?>
"><em><?php 
                echo htmlspecialchars($strBookingCode);
                ?>
</em></a>	
						<?php 
            } elseif (mktime(0, 0, 0, $intMonth, 1, $intYear) < time() + $intMinBookingTime) {
                ?>
						N/A	
						<?php 
            } else {
                ?>
							<a href="booking.php?action=add&frm_activity_id=<?php 
                echo $rowNewspaper['activity_id'];
                ?>
" style="color:#468847;">Available</a>
						<?php 
            }
            ?>
					</div>
				</td>
					<td><div style="text-align:right;">$<?php 
            echo htmlspecialchars(number_format($strNewspaperPrice));
            ?>
</div></td>	
				</tr>
		<?php 
        }
        ?>
		
			</tbody>			
			<tfoot>
				<td colspan="2"><div style="text-align:right;"><strong>Total</strong></div></td>
				<td style="background-color:#ddd;"><div style="text-align:right;"><strong>$<?php 
        echo htmlspecialchars(number_format($strNewspaperPriceTotal, 2));
        ?>
</strong></div></td>
			</tfoot>
		</table>


		<!-- Email -->
		<div style="clear:both;"><h3 style="font-size:1.3em;">4 YOU Email</h3></div>
		<table class="table table-bordered table-hover">
			<thead class="well">					
				<tr>
					<th style="text-align:center;width:20%;"><strong>Size/Spot</strong></th>
					<th style="text-align:center;"><strong>Booking</strong></th>
					<th style="text-align:center;width:20%;"><strong>Total</strong></th>
				</tr>
			</thead>
			<tbody>
		<?php 
        $queryEmail = "SELECT * FROM `mbs_activities` WHERE `activity_category` = 'email' ORDER BY `activity_name`";
        $resultEmail = mysql_query($queryEmail);
        while ($rowEmail = mysql_fetch_assoc($resultEmail)) {
            $arrEmail = DB::getActivityByDateTime($rowEmail['activity_id'], $intYear, $intMonth);
            $strBookingCode = DB::dbIDToField('mbs_bookings', 'booking_id', $arrEmail['booking_id'], 'booking_code');
            $strBookingName = DB::dbIDToField('mbs_bookings', 'booking_id', $arrEmail['booking_id'], 'booking_name');
            $strEmailPrice = $arrEmail['booking_activity_price_total'];
            $strEmailPriceTotal += $strEmailPrice;
            ?>
				<tr>
					<td><div style="text-align:left;"><?php 
            echo htmlspecialchars($rowEmail['activity_name']);
            ?>
</div></td>
					<td style="background-color:<?php 
            if (count($arrEmail) > 1) {
                ?>
#f2dede<?php 
            } elseif (mktime(0, 0, 0, $intMonth, 1, $intYear) < time() + $intMinBookingTime) {
                ?>
#ddd<?php 
            } else {
                ?>
#dff0d8<?php 
            }
            ?>
;">
					<div style="text-align:center;">
						<?php 
            if (count($arrEmail) > 1) {
                ?>
							<a href="booking_view.php?booking_id=<?php 
                echo $arrEmail['booking_id'];
                ?>
&action=view#id<?php 
                echo $arrEmail['booking_activity_id'];
                ?>
" title="<?php 
                echo htmlspecialchars($strBookingCode);
                ?>
 / <?php 
                echo htmlspecialchars($strBookingName);
                ?>
"><em><?php 
                echo htmlspecialchars($strBookingCode);
                ?>
</em></a>	
						<?php 
            } elseif (mktime(0, 0, 0, $intMonth, 1, $intYear) < time() + $intMinBookingTime) {
                ?>
						N/A	
						<?php 
            } else {
                ?>
							<a href="booking.php?action=add&frm_activity_id=<?php 
                echo $rowEmail['activity_id'];
                ?>
" style="color:#468847;">Available</a>
						<?php 
            }
            ?>
					</div>
				</td>
					<td><div style="text-align:right;">$<?php 
            echo htmlspecialchars(number_format($strEmailPrice));
            ?>
</div></td>	
				</tr>
		<?php 
        }
        ?>
		
			</tbody>			
			<tfoot>
				<td colspan="2"><div style="text-align:right;"><strong>Total</strong></div></td>
				<td style="background-color:#ddd;"><div style="text-align:right;"><strong>$<?php 
        echo htmlspecialchars(number_format($strEmailPriceTotal, 2));
        ?>
</strong></div></td>
			</tfoot>
		</table>


		<!-- Other -->
		<div style="clear:both;"><h3 style="font-size:1.3em;">Other</h3></div>
		<table class="table table-bordered table-hover">
			<thead class="well">					
				<tr>
					<th style="text-align:center;width:20%;"><strong>Activity</strong></th>
					<th style="text-align:center;"><strong>Booking</strong></th>
					<th style="text-align:center;width:20%;"><strong>Total</strong></th>
				</tr>
			</thead>
			<tbody>
		<?php 
        $queryOther = "SELECT * FROM `mbs_activities` WHERE `activity_category` = 'other' ORDER BY `activity_name`";
        $resultOther = mysql_query($queryOther);
        while ($rowOther = mysql_fetch_assoc($resultOther)) {
            $arrOther = DB::getActivityByDateTime($rowOther['activity_id'], $intYear, $intMonth);
            $strBookingCode = DB::dbIDToField('mbs_bookings', 'booking_id', $arrOther['booking_id'], 'booking_code');
            $strBookingName = DB::dbIDToField('mbs_bookings', 'booking_id', $arrOther['booking_id'], 'booking_name');
            $strOtherPrice = $arrOther['booking_activity_price_total'];
            $strOtherPriceTotal += $strOtherPrice;
            ?>
				<tr>
					<td><div style="text-align:left;"><?php 
            echo htmlspecialchars($rowOther['activity_name']);
            ?>
</div></td>
					<td style="background-color:<?php 
            if (count($arrOther) > 1) {
                ?>
#f2dede<?php 
            } elseif (mktime(0, 0, 0, $intMonth, 1, $intYear) < time() + $intMinBookingTime) {
                ?>
#ddd<?php 
            } else {
                ?>
#dff0d8<?php 
            }
            ?>
;">
					<div style="text-align:center;">
						<?php 
            if (count($arrOther) > 1) {
                ?>
							<a href="booking_view.php?booking_id=<?php 
                echo $arrOther['booking_id'];
                ?>
&action=view#id<?php 
                echo $arrOther['booking_activity_id'];
                ?>
" title="<?php 
                echo htmlspecialchars($strBookingCode);
                ?>
 / <?php 
                echo htmlspecialchars($strBookingName);
                ?>
"><em><?php 
                echo htmlspecialchars($strBookingCode);
                ?>
</em></a>	
						<?php 
            } elseif (mktime(0, 0, 0, $intMonth, 1, $intYear) < time() + $intMinBookingTime) {
                ?>
						N/A	
						<?php 
            } else {
                ?>
							<a href="booking.php?action=add&frm_activity_id=<?php 
                echo $rowOther['activity_id'];
                ?>
" style="color:#468847;">Available</a>
						<?php 
            }
            ?>
					</div>
				</td>
					<td><div style="text-align:right;">$<?php 
            echo htmlspecialchars(number_format($strOtherPrice));
            ?>
</div></td>	
				</tr>
		<?php 
        }
        ?>
		
			</tbody>			
			<tfoot>
				<td colspan="2"><div style="text-align:right;"><strong>Total</strong></div></td>
				<td style="background-color:#ddd;"><div style="text-align:right;"><strong>$<?php 
        echo htmlspecialchars(number_format($strOtherPriceTotal, 2));
        ?>
</strong></div></td>
			</tfoot>
		</table>



		<div style="clear:both;"><h3 style="font-size:1.3em;">Summary</h3></div>
		<table class="table table-bordered table-hover">
			<thead class="well">					
				<tr>
					<th style="text-align:center;width:20%;"><strong>Summary</strong></th>
					<th style="text-align:center;width:20%;"><strong>Data</strong></th>
					<th style="text-align:center;"><strong>Chart</strong></th>
				</tr>
			</thead>
			<tbody>
		<?php 
        $strTotal = $strInStoreTotal + $strCataloguePriceTotal + $strNewspaperPriceTotal + $strEmailPriceTotal + $strOtherPriceTotal;
        ?>
				
				<tr>
					<td><div style="text-align:left;">In-Store</div></td>
					<td><div style="text-align:right;"><strong>$<?php 
        echo number_format($strInStoreTotal);
        ?>
</strong></div></td>
					<td rowspan="6"><div id="chart"></div></td>
				</tr>
				<tr>
					<td><div style="text-align:left;">Catalogue</div></td>
					<td><div style="text-align:right;"><strong>$<?php 
        echo number_format($strCataloguePriceTotal);
        ?>
</strong></div></td>					
				</tr>
				<tr>
					<td><div style="text-align:left;">Newspaper</div></td>
					<td><div style="text-align:right;"><strong>$<?php 
        echo number_format($strNewspaperPriceTotal);
        ?>
</strong></div></td>					
				</tr>
				<tr>
					<td><div style="text-align:left;">4 YOU Email</div></td>
					<td><div style="text-align:right;"><strong>$<?php 
        echo number_format($strEmailPriceTotal);
        ?>
</strong></div></td>					
				</tr>
				<tr>
					<td><div style="text-align:left;">Other</div></td>
					<td><div style="text-align:right;"><strong>$<?php 
        echo number_format($strOtherPriceTotal);
        ?>
</strong></div></td>					
				</tr>
				<tr>
					<td><div style="text-align:left;"><strong>Total Amount</strong></div></td>
					<td style="background-color:#ccc;">
					<div style="text-align:right;"><strong>$<?php 
        echo number_format($strTotal);
        ?>
</strong></div>
					</td>
					
				</tr>
		
			</tbody>			
			<tfoot>				
			</tfoot>
		</table>

		

		<script>
			$(document).ready(function(){
			  var data = [
			    ['In-Store', <?php 
        echo $strInStoreTotal;
        ?>
],['Catalogue', <?php 
        echo $strCataloguePriceTotal;
        ?>
], ['Newspaper', <?php 
        echo $strNewspaperPriceTotal;
        ?>
], 
			    ['4 You Email', <?php 
        echo $strEmailPriceTotal;
        ?>
],['Other', <?php 
        echo $strOtherPriceTotal;
        ?>
]
			  ];
			  var plot = jQuery.jqplot ('chart', [data], 
			    { 
			      seriesDefaults: {
			        // Make this a pie chart.
			        renderer: jQuery.jqplot.PieRenderer, 
			        rendererOptions: {
			          // Put data labels on the pie slices.
			          // By default, labels show the percentage of the slice.
			          showDataLabels: true
			        }
			        
			      },
			      title: 'Revenue <?php 
        echo HTML::getMonthName($intMonth) . " " . $intYear;
        ?>
',
			      grid: {
            			drawBorder: false, 
            			drawGridlines: false,
            			background: '#ffffff',
            			shadow:false
        		  }, 
        		  seriesColors:['#f00', '#0f0', '#00f', '#fa0', '#b51be0'],
			      legend: { show:true, location: 'e' }
			    }
			  );
			});		
		</script>

		<?php 
        // The Log
        $strLog = "View monthly General Report for \"" . HTML::getMonthName($intMonth) . " " . $intYear . "\"";
        $queryLog = "INSERT INTO `logs` (`log_id`, \n\t\t\t\t\t\t\t\t\t\t `log_user`, \n\t\t\t\t\t\t\t\t\t\t `log_action`, \n\t\t\t\t\t\t\t\t\t\t `log_time`, \n\t\t\t\t\t\t\t\t\t\t `log_from`, \n\t\t\t\t\t\t\t\t\t\t `log_logout`)\n\n\t\t\t\t\tVALUES (NULL, \n\t\t\t\t\t\t\t'" . $_SESSION['user']['login_name'] . "',\n\t\t\t\t\t\t\t'" . mysql_real_escape_string($strLog) . "',\n\t\t\t\t\t\t\t'" . date('Y-m-d H:i:s') . "',\n\t\t\t\t\t\t\t'" . $_SESSION['user']['ip_address'] . "', \n\t\t\t\t\t\t\tNULL)";
        $resultLog = mysql_query($queryLog);
        #echo "<div class='well' style=''>";
        #echo "<strong>Debug:</strong><br />";
        #print_r($_REQUEST);
        #echo "</div>";
    }
Exemple #9
0
 function generateBookingCode()
 {
     DB::dbConnect();
     $query = "SHOW TABLE STATUS LIKE 'mbs_bookings'";
     $result = mysql_query($query);
     $row = mysql_fetch_assoc($result);
     $intIncrement = $row['Auto_increment'];
     $intIncrementLength = strlen($intIncrement);
     $strResult = "P4L";
     $intCount = 12 - intval(strlen($strResult)) - intval($intIncrementLength);
     for ($i = 0; $i < $intCount; $i++) {
         $strResult .= "0";
     }
     $strResult .= $intIncrement;
     return $strResult;
 }
Exemple #10
0
 function saveLoginInfo($logID)
 {
     $this->conn = DB::dbConnect();
     $query = "UPDATE `logs`  \n\t\t       \t  SET `log_logout` = '" . date("Y-m-d H:i:s") . "' \n\t\t\t\t  WHERE `log_id` = '" . $logID . "'";
     $result = mysql_query($query);
     // update user table
     $query2 = "UPDATE `users` SET `user_last_login_time` = '" . $_SESSION['user']['login_time'] . "', \n\t\t\t\t\t\t\t\t\t  `user_last_login_from` = '" . $_SESSION['user']['ip_address'] . "' \n\t\t\t\t\t\t\t\tWHERE `user_id` = '" . $_SESSION['user']['id'] . "' LIMIT 1";
     $result2 = mysql_query($query2);
     /* add log table */
     $result3 = mysql_query("INSERT INTO `logs`  \n\t\t\t\t\t\t\t\t(log_user,\n\t\t\t\t\t\t\t\t log_action,\n\t\t\t\t\t\t\t\t log_time,\n\t\t\t\t\t\t\t\t log_from)\n\t\n\t\t\t\t\t\t\t\t VALUES ('" . $_SESSION['user']['login_name'] . "',\n\t\t\t\t\t\t\t\t         'Logout successfully from " . $_SESSION['user']['ip_address'] . "',\n\t\t\t\t\t\t\t\t\t\t '" . date('Y-m-d H:i:s') . "',\n\t\t\t\t\t\t\t\t\t\t '" . $_SESSION['user']['ip_address'] . "')");
     if ($result) {
         return 1;
     } else {
         return 0;
     }
 }
Exemple #11
0
    function viewEmail()
    {
        $this->conn = DB::dbConnect();
        $query = "SELECT mbs_emails.email_created_date,mbs_emails.email_created_by,mbs_emails.email_modified_date,mbs_emails.email_modified_by,mbs_emails.email_id, mbs_emails.email_name, mbs_emails.email_address, mbs_emails.email_id, mbs_stores.store_name FROM (mbs_emails left join mbs_stores on mbs_emails.store_id = mbs_stores.store_id)\n\n\t\t WHERE mbs_emails.email_id = '" . $_REQUEST['email_id'] . "' LIMIT 1";
        //$query = "SELECT * FROM `mbs_emails` WHERE `email_id` = '" . $_REQUEST['email_id'] . "' LIMIT 1";
        $result = mysql_query($query);
        if ($result) {
            $row = mysql_fetch_assoc($result);
            ?>







			<h2>Email Information &raquo; <?php 
            echo stripslashes($row['email_name']);
            ?>
</h2>



			<table cellpadding="5" cellspacing="1" border="0">



			  <tr>



			  	<td colspan="2">



			  	<div align="left">



			  	<?php 
            if ($_SESSION['user']['type'] == 'admin') {
                ?>
<a class="btn" href="email_add.php" title="New Email"><img src="<?php 
                echo $STR_URL;
                ?>
img/add_icon.png" /> New Email</a>&nbsp;&nbsp;&nbsp; <a class="btn" href="email_edit.php?email_id=<?php 
                echo $row['email_id'];
                ?>
" title="Edit Email"><img src="<?php 
                echo $STR_URL;
                ?>
img/edit_icon.png" /> Edit</a>&nbsp;&nbsp;&nbsp; <a class="btn" href="email_delete.php?email_id=<?php 
                echo $row['email_id'];
                ?>
&action=delete" title="Delete Email" onclick="return confirmDeleteEmail(this.form)"><img src="<?php 
                echo $STR_URL;
                ?>
img/delete_icon.png" /> Delete</a>&nbsp;&nbsp;&nbsp; <a class="btn" href="email_list.php" title="Email List"><img src="<?php 
                echo $STR_URL;
                ?>
img/list_icon.png" /> List</a><?php 
            } else {
                echo '&nbsp;';
            }
            ?>
			  	



				 </div>			  	



			  	</td>



			  </tr>			  



			  



			  <tr>



			  	<td width="30%"><strong>Store</strong></td>



			  	<td>: <strong><?php 
            echo stripslashes($row['store_name']);
            ?>
</strong></td>



			  </tr>		



			  <tr>



			  	<td width="30%"><strong>Name</strong></td>



			  	<td>: <strong><?php 
            echo stripslashes($row['email_name']);
            ?>
</strong></td>



			  </tr>			  



			  <tr>



			  	<td><strong>Email Address</strong></td>



			  	<td>: <?php 
            echo stripslashes($row['email_address']);
            ?>
</td>



			  </tr>





			</table>



			



			



			<ul>				



				<li><strong>Created on:</strong> <?php 
            echo HTML::convertDateTime($row['email_created_date']);
            ?>
 by <strong><?php 
            echo stripslashes($row['email_created_by']);
            ?>
</strong></li>



				<li><strong>Last modified on:</strong> <?php 
            echo HTML::convertDateTime($row['email_modified_date']);
            ?>
 by <strong><?php 
            echo stripslashes($row['email_modified_by']);
            ?>
</strong></li>



			</ul>



			<?php 
        } else {
            echo "<div align=\"center\"><p><strong>Found no data!</strong></p></div>";
        }
        ?>



		<div align="center">



		<form name="myform" action="<?php 
        if (preg_match("/_exec/", $_SERVER['HTTP_REFERER'])) {
            if ($_SESSION['user']['type'] == 'admin') {
                echo "email_list.php";
            } else {
                echo "email_list.php";
            }
        } else {
            echo $_SERVER['HTTP_REFERER'];
        }
        ?>
">



			<input class="btn" type="submit" value="Back">



		</form>



		</div>		



		<?php 
    }
Exemple #12
0
function listBooking()
{
    global $arrSiteConfig;
    global $STR_URL;
    global $TABLE_MAX_ROW_PER_PAGE;
    DB::dbConnect();
    // If page number not set, set it to 1
    if (!$_REQUEST['page_num']) {
        $_REQUEST['page_num'] = 1;
    }
    // Setting queries and pages
    $offset = ($_REQUEST['page_num'] - 1) * $TABLE_MAX_ROW_PER_PAGE;
    $this->conn = DB::dbConnect();
    $strSearchText = stripslashes($_REQUEST['frm_search_text']);
    // sort variables
    if (!$_REQUEST['sortmode']) {
        $_REQUEST['sortmode'] = "asc";
    }
    $strSortMode = $_REQUEST['sortmode'];
    if ($_REQUEST['frm_search_text']) {
        // search query	*********************************************************************************
        $query = "SELECT * FROM `mbs_bookings` \n\t\t\t\t\t  \t\t  WHERE (`booking_name` LIKE '%" . mysql_real_escape_string($strSearchText) . "%'\n\t\t\t\t\t  \t\t  \t\t OR `booking_code` LIKE '%" . mysql_real_escape_string($strSearchText) . "%' \n\t\t\t\t\t  \t\t\t     OR `booking_description` LIKE '%" . mysql_real_escape_string($strSearchText) . "%')\n\t\t\t\t\t  \t\t\t     ORDER BY ";
        if ($_REQUEST['sortby']) {
            $query .= "`" . mysql_real_escape_string($_REQUEST['sortby']) . "` " . $strSortMode . ", `booking_id`";
        } else {
            $query .= "`booking_code` ASC, `booking_name` ASC, `booking_created_date` DESC";
        }
        $query .= " LIMIT " . $offset . "," . $TABLE_MAX_ROW_PER_PAGE;
        // search query	total ***************************************************************************
        $queryTotal = "SELECT COUNT(*) FROM `mbs_bookings` \n\t\t\t\t\t  \t\t\t          WHERE (`booking_name` LIKE '%" . mysql_real_escape_string($strSearchText) . "%' \n\t\t\t\t\t  \t\t\t          \t     OR `booking_code` LIKE '%" . mysql_real_escape_string($strSearchText) . "%'\n\t\t\t\t\t  \t\t\t                 OR `booking_description` LIKE '%" . mysql_real_escape_string($strSearchText) . "%')";
    } else {
        // the query ************************************************************************************
        $query = "SELECT * FROM `mbs_bookings` ORDER BY ";
        if ($_REQUEST['sortby']) {
            $query .= " `" . mysql_real_escape_string($_REQUEST['sortby']) . "` " . $strSortMode . ", `booking_id`";
        } else {
            $query .= " `booking_code`, `booking_name`";
        }
        $query .= " LIMIT " . $offset . "," . $TABLE_MAX_ROW_PER_PAGE;
        // the query total ******************************************************************************
        $queryTotal = "SELECT COUNT(*) FROM `mbs_bookings`";
    }
    $result = mysql_query($query, $this->conn);
    $resultTotal = mysql_query($queryTotal, $this->conn);
    $rowTotal = mysql_fetch_row($resultTotal);
    $totalPage = ceil($rowTotal[0] / $TABLE_MAX_ROW_PER_PAGE);
    $strResult = "";
    #echo "<div style=\"padding:15px; background-color:#eee;\">";
    #echo "<strong>Query:</strong> " . $query . "<br /><br />";
    #echo "<strong>Query Total:</strong> " . $queryTotal . "<br /><br />";
    #echo "</div>";
    // javascript to pop up message
    $strResult .= "\n\t\t\n\t\t\t\t\t";
    // search form
    $strResult .= "\n\t\t\t<form name=\"search_booking_data\" method=\"post\" action=\"" . $STR_URL . "booking_list.php\">\n\t\t\t\t<input type=\"hidden\" name=\"frm_search_referer\" value=\"" . $_SERVER['PHP_SELF'] . "\" />\n\t\t\t\t<input type=\"text\" name=\"frm_search_text\" size=\"40\" maxlength=\"128\" value=\"";
    if ($_REQUEST['frm_search_text']) {
        $strResult .= stripslashes($_REQUEST['frm_search_text']);
    }
    $strResult .= "\" />\t\t\t\t\n\t\t\t\t<input class=\"btn\" type=\"submit\" name=\"frm_search_submit\" value=\"Search Bookings\" onclick=\"return validateSearch(this.form)\" /><br />\n\t\t\t</form>\n\t\t\t";
    // the form
    $strResult .= "\n\t\t\t<form id=\"frm_booking\" method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\" />\n\t\t\t";
    $strResult .= "<div align=\"right\">";
    // the refresh link
    if ($_SESSION['user']['type'] == 'admin' || ADMIN::getModulePrivilege('bookings', 'list') !== 0) {
        $strResult .= "<a class=\"btn\" href=\"" . $STR_URL . ADMIN::getModuleFile('bookings', 'list') . "\" title=\"Booking List\"><img src=\"" . $STR_URL . "img/refresh_icon.png\" /> Refresh</a>";
    }
    $strResult .= "&nbsp;&nbsp;&nbsp;";
    // the add link
    if ($_SESSION['user']['type'] == 'admin' || ADMIN::getModulePrivilege('bookings', 'add') !== 0) {
        $strResult .= "<a class=\"btn ajax callbacks cboxElement\" href=\"" . $STR_URL . ADMIN::getModuleFile('bookings', 'add') . "?pop=yes\" title=\"New Booking\"><img src=\"" . $STR_URL . "img/add_icon.png\" /> New Booking</a>";
    }
    $strResult .= "\t</div>";
    if ($strSortMode == "asc") {
        $strSortMode = "desc";
    } elseif ($strSortMode == "desc") {
        $strSortMode = "asc";
    }
    // the table
    $strResult .= "\t\t\t\n\t\t\t<div align=\"center\"><h2>Booking List</h2></div>\n\t\t\t<div align=\"right\">" . HTML::showPaging($rowTotal[0], $totalPage, 4, array(array('frm_search_text', urlencode($_REQUEST['frm_search_text'])), array('pop', urlencode('yes')), array('sortby', urlencode($_REQUEST['sortby'])), array('sortmode', urlencode($_REQUEST['sortmode'])))) . "</div>\n\n\t\t\t<section id=\"table_booking_list\">\n\t\t\t<table class=\"table table-bordered table-hover\" summary=\"Booking List\">\n\t\t\t<caption>Booking List</caption>\n\t\t\t<thead>\n\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<th scope=\"col\" width=\"5%\"><div align=\"center\">No</div></th>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t<th scope=\"col\"><div align=\"center\"><a href=\"" . $_SERVER['PHP_SELF'] . "?page_num=" . intval($_REQUEST['page_num']) . "&frm_search_text=" . urlencode($_REQUEST['frm_search_text']) . "&sortby=booking_name&sortmode=" . $strSortMode . "\">Code/Name</a></div></th>\n\t\t\t\t\t<th scope=\"col\"><div align=\"center\"><a href=\"" . $_SERVER['PHP_SELF'] . "?page_num=" . intval($_REQUEST['page_num']) . "&frm_search_text=" . urlencode($_REQUEST['frm_search_text']) . "&sortby=booking_normal_retail_price&sortmode=" . $strSortMode . "\">Normal Retail Price</a></div></th>\n\t\t\t\t\t<th scope=\"col\"><div align=\"center\"><a href=\"" . $_SERVER['PHP_SELF'] . "?page_num=" . intval($_REQUEST['page_num']) . "&frm_search_text=" . urlencode($_REQUEST['frm_search_text']) . "&sortby=booking_promo_price&sortmode=" . $strSortMode . "\">Promo Price</a></div></th>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t";
    // edit / delete column
    if ($_SESSION['user']['type'] == 'admin' || ADMIN::getModulePrivilege('bookings', 'edit') !== 0 && $_SESSION['user']['type'] == 'user' || ADMIN::getModulePrivilege('bookings', 'delete') !== 0 && $_SESSION['user']['type'] == 'user') {
        $strResult .= "\t\n\t\t\t\t\t<th scope=\"col\" width=\"20%\"><div align=\"center\">Edit/Delete</div></th>\n\t\t\t\t\t";
    }
    $strResult .= "\n\t\t\t\t</tr>\n\t\t\t</thead>\t\n\t\t\t\n\t\t\t<tbody>\n\t\t\t";
    if ($rowTotal[0] > 0) {
        $no = $offset;
        while ($row = mysql_fetch_assoc($result)) {
            $no++;
            // link
            $strLink = ADMIN::getModuleFile('bookings', 'view') . "?booking_id=" . urlencode($row['booking_id']) . "&frm_search_text=" . urlencode($_REQUEST['frm_search_text']) . "&page_num=" . $_REQUEST['page_num'] . "&pop=yes";
            $strResult .= "\n\t\t\t\t\t\t<tr ";
            if ($no % 2 == 0) {
                $strResult .= "class=\"odd\"";
            }
            $strResult .= ">\n\t\t\t\t\t\t\t<td id=\"r" . $row['booking_id'] . "\"><div align=\"right\">" . $no . ".</div></td>\t\t\t\t\t\t\n\t\t\t\t\t\t\t<td><div align=\"left\">";
            if ($_SESSION['user']['type'] == 'admin' || $strPrivView == "yes") {
                $strResult .= "<a class=\"ajax callbacks cboxElement\" href=\"" . $STR_URL . $strLink . "\" title=\"" . html_entity_decode(strtoupper($row['booking_name'])) . "\">";
            }
            $strResult .= "<strong>" . html_entity_decode(stripslashes($row['booking_code'])) . " / " . html_entity_decode(stripslashes($row['booking_name'])) . "</strong>";
            if ($_SESSION['user']['type'] == 'admin' || $strPrivView == "yes") {
                "</a>";
            }
            $strResult .= "</div></td>\n\t\t\t\t\t\t\t<td><div align=\"right\"><strong>\$" . html_entity_decode(stripslashes($row['booking_normal_retail_price'])) . "</strong></div></td>\n\t\t\t\t\t\t\t<td><div align=\"right\"><strong>\$" . html_entity_decode(stripslashes($row['booking_promo_price'])) . "</strong></div></td>\t\t\t\t\t\t\t\n\t\t\t\t\t\t";
            // action column
            if ($_SESSION['user']['type'] == 'admin' || ADMIN::getModulePrivilege('bookings', 'edit') !== 0 && $_SESSION['user']['type'] == 'user' || ADMIN::getModulePrivilege('bookings', 'delete') !== 0 && $_SESSION['user']['type'] == 'user') {
                $strResult .= "<td><div align=\"center\">";
                // edit
                if ($_SESSION['user']['type'] == 'admin' || ADMIN::getModulePrivilege('bookings', 'edit') !== 0 && $_SESSION['user']['type'] == 'user') {
                    $strResult .= "<a class=\"btn ajax callbacks cboxElement\" href=\"" . $STR_URL . "booking.php?booking_id=" . html_entity_decode($row['booking_id']) . "&action=edit&pop=yes\" title=\"Edit Booking\"><img src=\"" . $STR_URL . "img/edit_icon.png\" /> Edit</a>";
                }
                $strResult .= "&nbsp;&nbsp;";
                // delete
                if ($_SESSION['user']['type'] == 'admin' || ADMIN::getModulePrivilege('bookings', 'delete') !== 0 && $_SESSION['user']['type'] == 'user') {
                    $strResult .= "<a id=\"frm_delete_button_" . $row['booking_id'] . "\" class=\"btn\" href=\"" . $STR_URL . "booking_list.php?booking_id=" . $row['booking_id'] . "&action=delete\" title=\"Delete Booking\"><img src=\"" . $STR_URL . "img/delete_icon.png\" /> Delete</a> ";
                }
                $strResult .= "</div></td>";
            }
            $strResult .= "\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t";
        }
        // end while($row = )
    } else {
        $strResult .= "<tr><td colspan=\"5\"><div align=\"center\">Found no data</div></td></tr>";
    }
    $strResult .= "\n\t\t\t</tbody>\n\t\t\t<tfoot>\n\t\t\t\t<tr>\n\t\t\t\t\t<th scope=\"row\" colspan=\"2\">Total: " . $rowTotal[0] . "</th>\t\t\t\t\t\n\t\t\t\t\t<td colspan=\"3\">" . HTML::showPaging($rowTotal[0], $totalPage, 4, array(array('frm_search_text', urlencode($_REQUEST['frm_search_text'])), array('pop', urlencode('yes')), array('sortby', urlencode($_REQUEST['sortby'])), array('sortmode', urlencode($_REQUEST['sortmode'])))) . "</td>\n\t\t\t\t</tr>\n\t\t\t</tfoot>\n\t\t\t</table>\n\t\t\t</section>\n\t\t\t</form>\n\t\t\t<a class=\"btn\" href=\"#content\"><i class=\"icon-arrow-up\"></i> Back to top</a>\n\n\n\t\t\t<script>\n\t\t\t\t\$(document).ready(function () {\n\t\t\t\t\tvar strID;\n\t\t\t\t\tvar intID;\n\t\t\t\t\tvar deleteConf;\t\n\t\t\t\n\t\t\t\t\t\$('a').click(function(event) {\n        \t\t\t\tstrID = event.target.id;        \t\t\t\t        \t\t\t\t\n\t\t\t\t\t\tintID = strID.replace('frm_delete_button_', '');\t\t\t\t\t\t\n\n\t\t\t\t\t\tif (intID && intID !== '')\n\t\t\t\t\t\t{\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (confirmDeleteBooking())\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\$(this).closest('tr').remove();\t\n\n\t\t\t\t\t\t\t\tvar dataString = 'action=delete&booking_id=' + intID;\t\t\t\t\t\t\t\n\t\t      \t\t\t\t   \n\t\t\t\t\t\t\t\tvar request = \$.ajax({\t\t\t\t\t\t\t    \n\t\t\t\t\t\t\t\t\turl: 'ajax/booking_proc.php',\n\t\t\t\t\t\t\t\t\ttype: 'post', \n\t\t\t\t\t\t\t\t\tdata: dataString,\n\t\t\t\t\t\t\t\t\tsuccess: function(msg) {\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\$.gritter.add({\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\ttitle: 'Info',\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\ttext: '<p>' + msg + '</p>',\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\timage: '" . $STR_URL . "img/accepted.png',\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tsticky: false,\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\ttime: '3000'\n\t\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t    \n\t\t\t\t\t\t\t\t});\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn false;\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\t\t\t\n\t\t\t\t\t\t\n    \t\t\t\t});\n \n\t\t\t\t});\n\t\t\t</script>\n\t\t\t";
    // The Log
    $strLog = "View the Booking List";
    $queryLog = "INSERT INTO `logs` (`log_id`, \n\t\t\t\t\t\t\t\t\t\t `log_user`, \n\t\t\t\t\t\t\t\t\t\t `log_action`, \n\t\t\t\t\t\t\t\t\t\t `log_time`, \n\t\t\t\t\t\t\t\t\t\t `log_from`, \n\t\t\t\t\t\t\t\t\t\t `log_logout`)\n\n\t\t\t\t\tVALUES (NULL, \n\t\t\t\t\t\t\t'" . $_SESSION['user']['login_name'] . "',\n\t\t\t\t\t\t\t'" . mysql_real_escape_string($strLog) . "',\n\t\t\t\t\t\t\t'" . date('Y-m-d H:i:s') . "',\n\t\t\t\t\t\t\t'" . $_SESSION['user']['ip_address'] . "', \n\t\t\t\t\t\t\tNULL)";
    $resultLog = mysql_query($queryLog);
    echo $strResult;
}