Esempio n. 1
0
function queued_downloading($phpvars, $page)
{
    if (count($phpvars['queuedgroups']) == 0) {
        return;
    }
    global $GroupsPerPage, $supportpostparam, $TimeZoneCorrection;
    $cnt = count($phpvars['queuedgroups']);
    $pagecount = pagecount($cnt, $GroupsPerPage);
    if ($page > $pagecount) {
        $page = $pagecount;
    }
    if ($page < 1) {
        $page = 1;
    }
    echo '<div class = "block"><center>Queued</center><br>';
    echo '<table width="100%">';
    echo '<tr><td colspan="' . ($supportpostparam ? 8 : 7) . '"></td><td>name</td><td width="20">category</td><td width="50" align="right">age</td><td width="60" align="right">total</td><td width="60" align="right">left</td><td width="100" align="right">estimated time</td></tr>';
    foreach (array_slice($phpvars['queuedgroups'], ($page - 1) * $GroupsPerPage, $GroupsPerPage) as $cur_queued) {
        $grouppaused = $cur_queued['PausedSizeLo'] != 0 && $cur_queued['RemainingSizeLo'] == $cur_queued['PausedSizeLo'];
        if ($grouppaused) {
            echo '<tr class="pausedgroup">';
        } else {
            echo '<tr class="unpausedgroup">';
        }
        echo '<td width="10"><a href="javascript:updatestatus(\'status.php?action=groupdelete&offset=0&id=' . $cur_queued['LastID'] . '\')"><IMG src=images/cancel.gif width=15 height=15 alt="remove nzb" title="remove nzb"></a></td>';
        echo '<td width="10"><a href="javascript:updatestatus(\'status.php?action=groupmovetop&offset=0&id=' . $cur_queued['LastID'] . '\')"><IMG src=images/first.gif width=15 height=15 alt="move nzb to top in queue" title="move nzb to top in queue"></a></td>';
        echo '<td width="10"><a href="javascript:updatestatus(\'status.php?action=groupmoveoffset&offset=-1&id=' . $cur_queued['LastID'] . '\')"><IMG src=images/up.gif width=15 height=15 alt="move nzb up" title="move nzb up"></a></td>';
        echo '<td width="10"><a href="javascript:updatestatus(\'status.php?action=groupmoveoffset&offset=1&id=' . $cur_queued['LastID'] . '\')"><IMG src=images/down.gif width=15 height=15 alt="move nzb down" title="move nzb down"></a></td>';
        echo '<td width="10"><a href="javascript:updatestatus(\'status.php?action=groupmovebottom&offset=0&id=' . $cur_queued['LastID'] . '\')"><IMG src=images/last.gif width=15 height=15 alt="move nzb to bottom in queue" title="move nzb to bottom in queue"></a></td>';
        echo '<td width="10"><a href="javascript:updatestatus(\'status.php?action=grouppause&offset=0&id=' . $cur_queued['LastID'] . '\')"><IMG src=images/pause.gif width=15 height=15 alt="pause nzb" title="pause nzb"></a></td>';
        echo '<td width="10"><a href="javascript:updatestatus(\'status.php?action=groupresume&offset=0&id=' . $cur_queued['LastID'] . '\')"><IMG src=images/resume.gif width=15 height=15 alt="resume nzb" title="resume nzb"></a></td>';
        if ($supportpostparam) {
            echo '<td width="10"><a href="javascript:updatestatus(\'status.php?editpostparam=1&id=' . $cur_queued['LastID'] . '\')"><IMG src=images/post' . (postprocess_disabled($cur_queued) ? '-nopp' : '') . '.gif width=15 height=15 alt="edit parameters" title="edit post-processing parameters"></a></td>';
        }
        echo '<td>' . namereplace($cur_queued['NZBNicename']) . '</td>';
        echo '<td width="20">';
        add_category_combo($cur_queued['Category'], $cur_queued['LastID'], $grouppaused);
        echo '</td>';
        echo '<td align="right">' . formatAge($cur_queued['MinPostTime'] + $TimeZoneCorrection * 60 * 60) . '</td>';
        echo '<td align="right">' . formatSizeMB($cur_queued['FileSizeMB']) . '</td>';
        echo '<td align="right">' . formatSizeMB($cur_queued['RemainingSizeMB'] - $cur_queued['PausedSizeMB']) . '</td>';
        if ($phpvars['status']['DownloadRate'] > 0) {
            echo '<td align="right">' . sec2hms(($cur_queued['RemainingSizeMB'] - $cur_queued['PausedSizeMB']) / ($phpvars['status']['DownloadRate'] / 1024 / 1024)) . '</td>';
        } else {
            echo '<td align="right"></td>';
        }
        echo '</tr>';
    }
    echo '</table>';
    if ($cnt > $GroupsPerPage) {
        pagelist($cnt, $page, $GroupsPerPage, 'page');
    }
    echo '</div>';
}
Esempio n. 2
0
function queued_downloading($phpvars, $page)
{
    if (count($phpvars['queuedgroups']) == 0) {
        return;
    }
    global $GroupsPerPage, $supportpostparam, $TimeZoneCorrection, $sort, $sortord, $Categories;
    $i = 0;
    $groups = $phpvars['queuedgroups'];
    foreach ($groups as &$aSingleArray) {
        $aSingleArray['_queueid'] = $i;
        $i++;
    }
    $cnt = count($groups);
    $pagecount = pagecount($cnt, $GroupsPerPage);
    if ($page > $pagecount) {
        $page = $pagecount;
    }
    if ($page < 1) {
        $page = 1;
    }
    echo '<div class = "block"><center>Queued</center><br>';
    echo '<table width="100%">';
    echo '<tr class="nowrap"><td colspan="' . ($supportpostparam ? 9 : 8) . '"><a href="javascript:updatestatus(\'status.php?page=1&sort=id\');" class="commandlink">queue position</a>' . ($sort == 'id' && !$sortord ? '<img class="arrow" src="images/desc.gif">' : '') . '</td>';
    echo '<td width="20" align="right"><a href="javascript:updatestatus(\'status.php?page=1&sort=prio\');" class="' . ($sort == "prio" ? 'commandlinkactive">priority</a>  <img class="arrow" src="images/' . ($sortord ? 'asc.gif">' : 'desc.gif">') : 'commandlink">priority</a>') . '&nbsp;&nbsp;</td>';
    echo '<td><a href="javascript:updatestatus(\'status.php?page=1&sort=name\');" class="' . ($sort == "name" ? 'commandlinkactive">name</a>  <img class="arrow" src="images/' . ($sortord ? 'asc.gif">' : 'desc.gif">') : 'commandlink">name</a>') . '</td>';
    echo '<td width="20" align="right"><a href="javascript:updatestatus(\'status.php?page=1&sort=cat\');" class="' . ($sort == "cat" ? 'commandlinkactive">category</a> <img class="arrow" src="images/' . ($sortord ? 'asc.gif">' : 'desc.gif">') : 'commandlink">category</a>') . '</td>';
    echo '<td width="50" align="right"><a href="javascript:updatestatus(\'status.php?page=1&sort=age\');" class="' . ($sort == "age" ? 'commandlinkactive">age</a> <img class="arrow" src="images/' . ($sortord ? 'asc.gif">' : 'desc.gif">') : 'commandlink">age</a>') . '</td>';
    echo '<td width="60" align="right"><a href="javascript:updatestatus(\'status.php?page=1&sort=tot\');" class="' . ($sort == "tot" ? 'commandlinkactive">total</a> <img class="arrow" src="images/' . ($sortord ? 'asc.gif">' : 'desc.gif">') : 'commandlink">total</a>') . '</td>';
    echo '<td width="60" align="right"><a href="javascript:updatestatus(\'status.php?page=1&sort=left\');" class="' . ($sort == "left" ? 'commandlinkactive">left</a> <img class="arrow" src="images/' . ($sortord ? 'asc.gif">' : 'desc.gif">') : 'commandlink">left</a>') . '</td>';
    echo '<td width="100" align="right">estimated time</td></tr>';
    if ($sort == "id") {
        if (!$sortord) {
            $groups = array_reverse($groups);
        }
    } else {
        $tmp = array();
        foreach ($groups as &$aSingleArray) {
            switch ($sort) {
                case "age":
                    $tmp[] =& $aSingleArray["MinPostTime"];
                    break;
                case "prio":
                    $tmp[] =& $aSingleArray["MaxPriority"];
                    break;
                case "name":
                    $tmp[] =& $aSingleArray["NZBNicename"];
                    break;
                case "tot":
                    $tmp[] =& $aSingleArray["FileSizeMB"];
                    break;
                case "left":
                    $aSingleArray['_sizeleft'] = $aSingleArray['RemainingSizeMB'] - $aSingleArray['PausedSizeMB'];
                    $tmp[] =& $aSingleArray['_sizeleft'];
                    break;
                case "cat":
                    $tmp[] =& $aSingleArray["Category"];
                    break;
            }
        }
        switch ($sort) {
            case "age":
                array_multisort($tmp, $sortord ? SORT_DESC : SORT_ASC, SORT_NUMERIC, $groups);
                break;
            case "tot":
            case "left":
            case "prio":
                array_multisort($tmp, $sortord ? SORT_ASC : SORT_DESC, SORT_NUMERIC, $groups);
                break;
            case "name":
            case "cat":
                $tmp = array_map('strtolower', $tmp);
                array_multisort($tmp, $sortord ? SORT_ASC : SORT_DESC, SORT_STRING, $groups);
                break;
        }
    }
    foreach (array_slice($groups, ($page - 1) * $GroupsPerPage, $GroupsPerPage) as $cur_queued) {
        $grouppaused = $cur_queued['PausedSizeLo'] != 0 && $cur_queued['RemainingSizeLo'] == $cur_queued['PausedSizeLo'];
        if ($grouppaused) {
            echo '<tr class="pausedgroup">';
        } else {
            echo '<tr class="unpausedgroup">';
        }
        echo '<td width="10">' . $cur_queued['_queueid'] . '</td>';
        echo '<td width="15"><a href="javascript:updatestatus(\'status.php?action=groupdelete&offset=0&id=' . $cur_queued['LastID'] . '\')"><IMG src=images/cancel.gif width=15 height=15 alt="remove nzb" title="remove nzb"></a></td>';
        echo '<td width="15"><a href="javascript:updatestatus(\'status.php?action=groupmovetop&offset=0&id=' . $cur_queued['LastID'] . '\')"><IMG src=images/first.gif width=15 height=15 alt="move nzb to top in queue" title="move nzb to top in queue"></a></td>';
        if ($sort == "id") {
            echo '<td width="10"><a href="javascript:updatestatus(\'status.php?action=groupmoveoffset&offset=-1&id=' . $cur_queued['LastID'] . '\')"><IMG src=images/up.gif width=15 height=15 alt="move nzb up" title="move nzb up"></a></td>';
        } else {
            echo '<td width="15"></td>';
        }
        if ($sort == "id") {
            echo '<td width="10"><a href="javascript:updatestatus(\'status.php?action=groupmoveoffset&offset=1&id=' . $cur_queued['LastID'] . '\')"><IMG src=images/down.gif width=15 height=15 alt="move nzb down" title="move nzb down"></a></td>';
        } else {
            echo '<td width="15"></td>';
        }
        echo '<td width="15"><a href="javascript:updatestatus(\'status.php?action=groupmovebottom&offset=0&id=' . $cur_queued['LastID'] . '\')"><IMG src=images/last.gif width=15 height=15 alt="move nzb to bottom in queue" title="move nzb to bottom in queue"></a></td>';
        echo '<td width="15"><a href="javascript:updatestatus(\'status.php?action=grouppause&offset=0&id=' . $cur_queued['LastID'] . '\')"><IMG src=images/pause.gif width=15 height=15 alt="pause nzb" title="pause nzb"></a></td>';
        echo '<td width="15"><a href="javascript:updatestatus(\'status.php?action=groupresume&offset=0&id=' . $cur_queued['LastID'] . '\')"><IMG src=images/resume.gif width=15 height=15 alt="resume nzb" title="resume nzb"></a></td>';
        if ($supportpostparam) {
            echo '<td width="15"><a href="javascript:updatestatus(\'status.php?editpostparam=1&id=' . $cur_queued['LastID'] . '\')"><IMG src=images/post' . (postprocess_disabled($cur_queued) ? '-nopp' : '') . '.gif width=15 height=15 alt="edit parameters" title="edit post-processing parameters"></a></td>';
        }
        echo '<td width="20" align="right">';
        add_priority_combo($cur_queued['MaxPriority'], $cur_queued['LastID'], $grouppaused);
        echo '</td>';
        echo '<td>' . namereplace($cur_queued['NZBNicename']) . '</td>';
        echo '<td width="20" align="right">';
        add_category_combo($cur_queued['Category'], $cur_queued['LastID'], $grouppaused);
        echo '</td>';
        echo '<td align="right">' . formatAge($cur_queued['MinPostTime'] + $TimeZoneCorrection * 60 * 60) . '</td>';
        echo '<td align="right">' . formatSizeMB($cur_queued['FileSizeMB']) . '</td>';
        echo '<td align="right">' . formatSizeMB($cur_queued['RemainingSizeMB'] - $cur_queued['PausedSizeMB']) . '</td>';
        if ($phpvars['status']['DownloadRate'] > 0) {
            echo '<td align="right">' . sec2hms(($cur_queued['RemainingSizeMB'] - $cur_queued['PausedSizeMB']) / ($phpvars['status']['DownloadRate'] / 1024 / 1024)) . '</td>';
        } else {
            echo '<td align="right"></td>';
        }
        echo '</tr>';
    }
    echo '</table>';
    if ($cnt > $GroupsPerPage) {
        pagelist($cnt, $page, $GroupsPerPage, 'page');
    }
    echo '</div>';
}