Beispiel #1
0
    authorize();
}
Header('Content-Type: text/csv; charset=cp1251');
Header('Content-disposition: attachment;filename=status.csv');
$status = getStatus(isset($_GET['contest']) ? $_GET['contest'] : $curcontest);
/**
 * @param  $status Status
 * @return array
 */
function getStatusInfo($status)
{
    $result = array();
    $result[] = $status->getSubmitId();
    $result[] = $status->getUserId();
    $result[] = $status->getTaskId();
    $result[] = $status->getLangId();
    $result[] = $status->getTime();
    $result[] = $status->getResult();
    $result[] = $status->getTask();
    $result[] = $status->getNickname();
    $result[] = $status->getCity();
    $result[] = $status->getStudyplace();
    $result[] = $status->getInfo();
    $result[] = $status->getDivision();
    return $result;
}
$fp = fopen('php://output', 'w');
foreach ($status as $_ => $status) {
    fputcsv($fp, getStatusInfo($status), ';');
}
fclose($fp);
Beispiel #2
0
function displayWhatsupList()
{
    $offset = 0;
    if (isset($_GET['offset'])) {
        $offset = $_GET['offset'];
    }
    $status_raw = getStatusInfo();
    $status = array('NEXT' => $status_raw['next'], 'NOW' => $status_raw['onair'], 'LAST' => $status_raw['played']);
    if ($status_raw['online'] == true) {
        $online_status = 'online';
    } else {
        $online_status = 'offline';
    }
    echo "<table class=\"playlist\">\n";
    $bgclr = 1;
    foreach ($status as $key => $row) {
        echo "<tr id=\"{$key}\">\n";
        echo " <td class=\"pl_title\">{$key}</td>\n";
        if ($row['playtime'] != '—') {
            $arr = preg_split('/:/', $row['playtime']);
            $localepoch = gmmktime($arr[0], $arr[1] - $offset, $arr[2]);
            $time = gmdate('H:i:s', $localepoch);
        } else {
            $time = '—';
        }
        echo " <td>{$time}</td>\n";
        if ($row['name'] == '—') {
            echo "  <td>—</td>\n";
        } elseif ($row['homepage'] == '—') {
            echo "  <td>{$row['name']}, {$row['city']}, {$row['country']}</td>\n";
        } else {
            echo "  <td><a href=\"{$row['homepage']}\">{$row['name']}</a>, {$row['city']}, {$row['country']}</td>\n";
        }
        echo "</tr>\n";
    }
    echo "</table>\n";
    /*
    ?>
    <table id="streamlist">
    <tr>
      <th id="hide"></th>
      <th>TIME</th>
      <th>RADIO</th>
      <th>URL</th>
      <th>CITY</th>
      <th>COUNTRY</th>
    </tr>
    <?php
      $bgclr = 0;
      while(list($role, $time, $name, $homepage, $url, $city, $country) = mysql_fetch_array($result)) {
        echo "<tr class=\"bg$bgclr\">\n";
        $bgclr += 1;
        $bgclr = fmod($bgclr, 2);
        echo " <td>$role</td>\n";
        echo " <td>$time</td>\n";
        if ($homepage == '') {
          echo "  <td>$name</td>\n";
        } else {
          echo "  <td><a href=\"$homepage\">$name</a></td>\n";
        }
        echo "  <td><a href=\"$url\">" . truncateUrl($url) . "</a></td>\n";
        echo "  <td>$city</td>\n";
        echo "  <td> $country</td>\n";
        echo "</tr>\n";
      }
      echo "</table>\n";
    */
}