コード例 #1
0
ファイル: remaining.php プロジェクト: Kayomani/Obsidian
function ExecBlock($master)
{
    $lan = new Lan_events();
    $lan->get(getCurrentLID());
    $now = strtotime("now");
    $start = strtotime($lan->start);
    $end = strtotime($lan->end);
    $diff = 0;
    $ndiff = 1;
    if ($start < $end) {
        $diff = $end - $start;
        $ndiff = $now - $start;
    }
    $percent = round($ndiff / $diff * 100);
    if ($percent < 0) {
        $percent = 0;
    }
    if ($percent > 100) {
        $percent = 100;
    }
    $percent = 100 - $percent;
    $master->Smarty->assign("percent", $percent);
}
コード例 #2
0
ファイル: jukebox.php プロジェクト: Kayomani/Obsidian
        for ($j = 0; $j < $i; $j++) {
            if ($data[$j]->datetime > $data[$j + 1]->datetime) {
                $tmp = $data[$j];
                $data[$j] = $data[$j + 1];
                $data[$j + 1] = $tmp;
                $swapped = true;
            }
        }
        if (!$swapped) {
            return $data;
        }
    }
}
$lan = new Lan_events();
$lanid = $lan->escape(getCurrentLID());
$success = $lan->get($lanid);
if ($success) {
    $start = new Lan_timetable();
    $start->when = date("D jS M H:i", strtotime($lan->start));
    $start->type = 'start';
    $start->diff = getDiffDateTime(strtotime($lan->start));
    $start->datetime = strtotime($lan->start);
    $events[] = $start;
    $event = new Lan_timetable();
    $event->lan_id = getCurrentLID();
    $event->orderBy('"when" ASC');
    $game = new Lan_games();
    $event->selectAs($game, "game_%s");
    $event->joinAdd($game, "LEFT");
    $event->find();
    while ($event->fetch()) {
コード例 #3
0
ファイル: attendance.php プロジェクト: Kayomani/Obsidian
<?php

//Put non UI logic in a difference file
include 'attendance.logic.php';
$lan = new Lan_events();
$success = $lan->get(getCurrentLID());
$state = "notsignedup";
if ($success) {
    $lan->text = str_replace("\\n", "\n", $lan->text);
    $lan->text = str_replace("\\r", "\r", $lan->text);
    $master->Smarty->assign("lan", $lan);
    $attendees = new Lan_attendees();
    $user = new Lan_users();
    $attendees->lan_id = getCurrentLID();
    $attendees->joinAdd($user);
    $attendees->orderBy('username');
    $attendees->find();
    $attendeeslist = array();
    while ($attendees->fetch()) {
        if (streq(getCurrentUID(), $attendees->user_id)) {
            $state = "signedup";
        }
        $sold = new Lan_addons_sold();
        $sold->lan_id = getCurrentLID();
        $sold->user_id = $attendees->user_id;
        $sold->find();
        $soldlists = array();
        while ($sold->fetch()) {
            $g = new Lan_addons_groups();
            $g->get($sold->addon_id);
            $soldlists[] = $g->name;
コード例 #4
0
ファイル: admin.php プロジェクト: Kayomani/Obsidian
include 'admin.logic.php';
function convertDateIn($data)
{
    $date = strtotime($data);
    $fdate = strftime("%Y-%m-%d %H:%M:00", $date);
    return $fdate;
}
function convertDateOut($data)
{
    $date = strtotime($data);
    $fdate = strftime("%d/%m/%Y %H:%M", $date);
    return $fdate;
}
$lan = new Lan_events();
if (isset($_GET["id"])) {
    if ($lan->get($lan->escape($_GET["id"]))) {
        $lan->start = convertDateOut($lan->start);
        $lan->end = convertDateOut($lan->end);
        // Get attendees
        $attendees = new Lan_attendees();
        $attendees->lan_id = $lan->id;
        $attendees->find();
        $attendeeslist = array();
        $Frontend = new FrontEnd();
        $allusers = $Frontend->getAllUsers();
        while ($attendees->fetch()) {
            // Get tickets for the attendee
            $sold = new Lan_addons_sold();
            $sold->lan_id = $lan->id;
            $sold->user_id = $attendees->user_id;
            $sold->find();
コード例 #5
0
ファイル: lantime.php プロジェクト: Kayomani/Obsidian
function setupLanTime($id, $value, $smarty)
{
    $lan = new Lan_events();
    $lan->get(getCurrentLID());
    $days = array();
    $oneday = 24 * 60 * 60;
    //Add first day
    $first = new LanTime();
    $first->text = date("l jS", strtotime($lan->start));
    $first->value = strtotime(date("d-m-Y 00:00:00", strtotime($lan->start)));
    $days[] = $first;
    //Add each further day
    $querydate = strtotime(date("d-m-Y 00:00:00", strtotime($lan->start) + $oneday));
    while ($querydate < strtotime($lan->end)) {
        $day = new LanTime();
        $day->text = date("l jS", $querydate);
        $day->value = $querydate;
        $days[] = $day;
        $querydate = $querydate + $oneday;
    }
    $smarty->assign("lantime_" . $id . "_days", $days);
    //Time
    $hours = array();
    for ($i = 0; $i < 10; $i++) {
        $lt = new LanTime();
        $lt->text = "0" . $i . ":00";
        $lt->value = $i * 60 * 60;
        $hours[] = $lt;
        $lt = new LanTime();
        $lt->text = "0" . $i . ":15";
        $lt->value = $i * 60 * 60 + 15 * 60;
        $hours[] = $lt;
        $lt = new LanTime();
        $lt->text = "0" . $i . ":30";
        $lt->value = $i * 60 * 60 + 30 * 60;
        $hours[] = $lt;
        $lt = new LanTime();
        $lt->text = "0" . $i . ":45";
        $lt->value = $i * 60 * 60 + 45 * 60;
        $hours[] = $lt;
    }
    for ($i = 10; $i < 24; $i++) {
        $lt = new LanTime();
        $lt->text = $i . ":00";
        $lt->value = $i * 60 * 60;
        $hours[] = $lt;
        $lt = new LanTime();
        $lt->text = $i . ":15";
        $lt->value = $i * 60 * 60 + 15 * 60;
        $hours[] = $lt;
        $lt = new LanTime();
        $lt->text = $i . ":30";
        $lt->value = $i * 60 * 60 + 30 * 60;
        $hours[] = $lt;
        $lt = new LanTime();
        $lt->text = $i . ":45";
        $lt->value = $i * 60 * 60 + 45 * 60;
        $hours[] = $lt;
    }
    $smarty->assign("lantime_" . $id . "_time", $hours);
    $template = '';
    if (file_exists("skins/" . Config::$theme . "/lantime.htm")) {
        $template = file_get_contents("skins/" . Config::$theme . "/lantime.htm");
    } else {
        $template = file_get_contents("skins/default/lantime.htm");
    }
    $template = str_replace("%%ID%%", $id, $template);
    //Set value
    if (null == $value) {
        $value = date("d-m-Y H:00:00", strtotime("now"));
    }
    $smarty->assign("lantime_" . $id . "_selectedday", strtotime(date("d-m-Y 00:00:00", strtotime($value))));
    $smarty->assign("lantime_" . $id . "_selectedtime", date("G", strtotime($value)) * (60 * 60) + date("i", strtotime($value)) * 60);
    $smarty->assign("lantime_" . $id . "_tmpl", $template);
}
コード例 #6
0
ファイル: admin.php プロジェクト: Kayomani/Obsidian
if (defined("LANMAN_AJAX")) {
    include 'rpc.php';
    die;
}
/*
 * Seat types:
 * 0: Normal
 * 1: Staff only
 * 2: Disabled
 */
if (!isset($_GET["id"])) {
    $master->Smarty->assign("msg", "Unknown lan");
    $master->Smarty->display('error.tpl');
    return;
} else {
    $lan = new Lan_events();
    $success = $lan->get($lan->escape($_GET["id"]));
    if ($success) {
        if (!file_exists($lan->layout) || streq($lan->layout, "")) {
            $lan->layout = "images/no_seating_plan.png";
        }
        $master->Smarty->assign("img", $lan->layout);
        $master->Smarty->assign("size", cssifysize($lan->layout));
    } else {
        $master->Smarty->assign("msg", "Unknown lan");
        $master->Smarty->display('error.tpl');
        return;
    }
    $master->Smarty->assign("id", $lan->id);
}
コード例 #7
0
ファイル: seats.logic.php プロジェクト: Kayomani/Obsidian
<?php

if (isset($_GET["action"])) {
    switch ($_GET["action"]) {
        case 'sit':
            $lan = new Lan_events();
            $lan->get(getCurrentLID());
            $attendees = new Lan_attendees();
            $attendees->lan_id = getCurrentLID();
            $attendees->user_id = getCurrentUID();
            if ($attendees->count() == 0) {
                $master->AddWarning("You are not signed up to this LAN.");
                break;
            } else {
                $allowSeating = false;
                $tickets = new Lan_addons_sold();
                $tickets->user_id = getCurrentUID();
                $tickets->lan_id = $lan->id;
                $ticktypes = new Lan_addons_groups();
                $tickets->joinAdd($ticktypes, "LEFT");
                $tickets->selectAs($ticktypes, 'type_%s');
                $tickets->find();
                $a = array();
                while ($tickets->fetch()) {
                    if (0 == strcmp($tickets->type_allowSeating, '1')) {
                        $allowSeating = true;
                    }
                }
                if ($allowSeating) {
                    $exseat = new Lan_seats();
                    $exseat->user_id = getCurrentUID();