Exemplo n.º 1
0
<?php

header("content-type:text/html; charset=utf-8");
include 'permission.php';
require_once 'include/db_operator_class.php';
$type = $_GET['type'];
if ($type == 'all') {
    $week = $_GET['week'];
    $level = $_GET['level'];
    if ($level == null) {
        $level = $_SESSION['team'];
    }
    $problems = get_ProblemsOnWeek($week, $level);
    echo json_encode($problems);
} else {
    if ($type == 'detail') {
        $probId = $_GET['probID'];
        $problems = get_ProblemContentById($probId);
        echo json_encode($problems);
    }
}
Exemplo n.º 2
0
    if ($current_week <= 0) {
        $current_week = 1;
    }
    if ($current_week > $week) {
        $current_week = $week;
    }
} else {
    $current_week = $week;
}
if (isset($_GET['level'])) {
    $level = $_GET['level'];
    $group = $level;
    $problems = get_ProblemsOnWeek($current_week, $level);
} else {
    $group = $team;
    $problems = get_ProblemsOnWeek($current_week, $team);
}
if ($problems != null) {
    for ($i = 0; $i < count($problems); $i++) {
        $score = get_ScoresByProb($problems[$i]['id']);
        $commentCount = get_CommentsCountByProb($problems[$i]['id']);
        $problems[$i]['score'] = $score;
        $problems[$i]['commentCount'] = $commentCount['count(*)'];
    }
    $smarty->assign('problems', $problems);
} else {
    $smarty->assign('problems', '');
}
$smarty->assign('name', $_SESSION['name']);
$smarty->assign('week', $week);
$smarty->assign('current_week', $current_week);