Пример #1
0
    //unset cookies
    setcookie("username", "", time() - 7200);
    header('Location: login.php');
}
if (isset($_SESSION['admin_id']) && !get_published_batch_id()) {
    header('Location: admin.php');
}
?>
    <div class="content">
        <div class="topContent">
            <?php 
if (isset($_SESSION['user_id'])) {
    if (get_published_batch_id()) {
        $user = $_SESSION['user_id'];
        $name = get_user_by_id($user);
        $batch = get_published_batch_id();
        echo "<h2>" . get_text('Information') . " " . strtolower(get_text('About')) . ": {$name['0']} {$name['1']}</h2>";
        ?>
                    <p>
                        <a href="pdf.php?id=<?php 
        echo $_SESSION['user_id'];
        ?>
"><?php 
        echo get_text('View') . ' ' . get_text('PDF');
        ?>
</a>
                    </p>
                    <?php 
        get_user_info($user, $batch);
    }
}
Пример #2
0
    <ul>
        <?php 
if (isset($_SESSION['user_id']) && !get_published_batch_id() || strpos($_SERVER['PHP_SELF'], 'forgot.php') !== false) {
    ?>
            <li <?php 
    if ($selected_page == 'Home') {
        echo 'class="active"';
    }
    ?>
><a href="index.php"><?php 
    echo get_text('Home');
    ?>
</a></li>
        <?php 
}
if (isset($_SESSION['user_id']) && get_published_batch_id()) {
    ?>
            <li <?php 
    if ($selected_page == 'User') {
        echo 'class="active"';
    }
    ?>
><a href="user.php"><?php 
    echo get_text('My_results');
    ?>
</a></li>
        <?php 
}
?>
        <?php 
if (isset($_SESSION['admin_id'])) {
<?php

include 'core/init.php';
if (isset($_GET['id']) && isset($_GET['action'])) {
    if ($_GET['action'] != 'View') {
        $batch = $_GET['id'];
        $action = $_GET['action'];
        switch ($_GET['action']) {
            case 'Start':
                stop_batch(get_published_batch_id());
                start_batch($_GET['id']);
                break;
            case 'Calculate':
                calculate_couples($_GET['id']);
                break;
            case 'Accept':
                accept_calculated_polls($_GET['id']);
                break;
            case 'Run':
                run_batch($_GET['id']);
                break;
            case 'Publish':
                publish_batch($_GET['id']);
                break;
            case 'Stop':
                stop_batch($_GET['id']);
                break;
            default:
                # code...
                break;
        }
Пример #4
0
function get_average_score($user, $question)
{
    $batch = get_published_batch_id();
    $user = (int) $user;
    $question = (int) $question;
    $query = mysql_query("SELECT Name FROM answer_enum WHERE ID = (SELECT Average_Score FROM average_score_view WHERE Reviewee = {$user} AND Question = {$question} AND Batch = {$batch})");
    if (!$query || mysql_num_rows($query) < 0) {
        echo mysql_error();
        return false;
    } else {
        if (mysql_num_rows($query) == 0) {
            return 0;
        }
        return mysql_result($query, 0);
    }
}
Пример #5
0
,parameter<?php 
            echo $parameter['ID'];
            ?>
.value);"/>
                                </td>
                            </form>
                        </tr>
                    <?php 
        }
        ?>
                    </tbody>
                </table>
            </div>
        <?php 
    } else {
        if (!get_published_batch_id() && !get_stopped_batch_id() && !get_calculating_batch_id() && !get_accepted_batch_id()) {
            ?>
            <div class="topContent">
                <?php 
            echo get_text('Admin_intro');
            ?>
            </div>
        <?php 
        }
    }
}
?>
        <div class="middleContent">

            <h2><?php 
echo get_text('List_of_batches');
Пример #6
0
<?php

$selected_page = "Home";
require 'includes/header.php';
if (!get_running1_batch_id() && !get_running2_batch_id() && !get_published_batch_id()) {
    // destroy session
    session_destroy();
    //unset cookies
    setcookie("username", "", time() - 7200);
    header('Location: login.php');
}
protect_page();
if (get_published_batch_id()) {
    header('Location: user.php');
}
?>

<?php 
if (get_running1_batch_id()) {
    require 'includes/fase1/index.php';
} else {
    if (get_running2_batch_id()) {
        require 'includes/fase2/index.php';
    }
}
?>

<?php 
require 'includes/footer.php';