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;
     }
     $batches = get_batches();
     ?>
     <tr>
         <th><?php 
Ejemplo n.º 2
0
    include_once "../shared/header.php";
    if (isset($_REQUEST['msg'])) {
        echo '<font class="error">' . H($_REQUEST['msg']) . '</font>';
    }
    $form['values'] = $values;
    $form['errors'] = $errs;
    Form::display($form);
    layout_links();
    include_once "../shared/footer.php";
    exit;
}
$lines = file($values['command_file']['tmp_name']);
if ($lines === false) {
    $errors = array("Couldn't read file: " . $values['command_file']['tmp_name']);
} else {
    $errors = run_batch($lines, $values['date']);
}
if ($errors) {
    include_once "../shared/header.php";
    echo '<font class="error">' . $loc->getText("Actions which did not produce an error have completed. Think carefully before uploading the same file again, or some circulations may be recorded twice.") . '</font>';
    echo '<div class="errorbox">';
    echo '<span class="errorhdr">' . $loc->getText('Errors') . '</span>';
    echo '<ul>';
    foreach ($errors as $e) {
        echo '<li>' . H($e) . '</li>';
    }
    echo '</ul></div>';
    Form::display($form);
    layout_links();
    include_once "../shared/footer.php";
    exit;