Exemplo n.º 1
0
function track_check()
{
    global $xoopsDB;
    global $tags, $tblstyle;
    echo "<h4'>" . _AM_REFPAGE_CHECK . "</h4>";
    $result = $xoopsDB->query("SELECT * FROM " . TBL . "," . TBR . " WHERE track_from=track_id AND checked=0 ORDER BY ref_id");
    $n = $xoopsDB->getRowsNum($result);
    if ($n) {
        echo "<script>\n<!--\nfunction myCheckAll(formname, switchid, group) {\n\tvar ele = document.forms[formname].elements;\n\tvar switch_cbox = xoopsGetElementById(switchid);\n\tfor (var i = 0; i < ele.length; i++) {\n\t\tvar e = ele[i];\n\t\tif ( (e.name != switch_cbox.name) && (e.id==group) && (e.type == 'checkbox') ) {\n\t\t\te.checked = switch_cbox.checked;\n\t\t}\n\t}\n}\n-->\n</script>";
        $allbox = "<input name='allbox' id='allbox' onclick='myCheckAll(\"refchk\", \"allbox\", \"check\");' type='checkbox' value='Check All' />";
        echo "<form action='index.php' method='post' name='refchk'>";
        echo $allbox . " " . _AM_CHECKALL_CHECK;
        echo "<table {$tblstyle}>\n";
        echo "<tr class='bg1'><th nowrap>" . _AM_REF_CHECKED . "</th><th>" . _AM_REF_URL . "</th></tr>\n";
        $nc = 1;
        $start = isset($_GET['start']) ? intval($_GET['start']) : 0;
        while ($data = $xoopsDB->fetchArray($result)) {
            $bg = $tags[$nc++ % 2];
            $tid = $data['track_id'];
            $uri = $data['track_uri'];
            $rid = $data['ref_id'];
            $url = $data['ref_url'];
            $title = $data['title'];
            $uri = $data['track_uri'];
            $linkto = " " . _TB_LINKTO . " <a href='{$uri}'>" . uri_to_name($uri) . "</a>";
            $clickmark = "target='_blank' onclick='javascript:document.forms[\"refchk\"].elements[\"check[{$rid}]\"].checked=true;'";
            $mkl = $data['linked'] ? "checked" : "";
            $start++;
            echo "<tr class='{$bg}'><td style='text-align:center;'><input type='checkbox' name='check[{$rid}]' id='check' /></td>" . "<td>{$start}. " . "<input type='checkbox' name='link[{$rid}]' {$mkl} />" . "<input type='hidden' name='refid[{$rid}]' value='ok' /> " . make_track_item($data, $linkto, $clickmark) . "</td></tr>\n";
        }
        echo "</table>\n";
        echo "<p><input type='hidden' name='op' value='check_update' />" . "<input type='submit' value='" . _SUBMIT . "' /></p>" . "</form>\n";
    } else {
        echo _AM_NO_UNCHECKED;
    }
}
Exemplo n.º 2
0
 if (!isset($disable) || $disable) {
     redirect_header("index.php", 1, _TB_NOPAGE);
     exit;
 }
 $cond = "track_from={$track_id} AND linked=1 AND nref>=" . $xoopsModuleConfig['threshold'];
 if ($detail) {
     $sql = "SELECT COUNT(ref_id) FROM " . TBR . " WHERE {$cond}";
     $result = $xoopsDB->query($sql);
     list($nrec) = $xoopsDB->fetchRow($result);
 } else {
     $sql = "SELECT title, count(1) FROM " . TBR . " WHERE {$cond} GROUP BY title";
     $result = $xoopsDB->query($sql);
     $nrec = $xoopsDB->GetRowsNum($result);
 }
 $start = $page > 1 ? ($page - 1) * $xoopsModuleConfig['list_max'] : 0;
 $breadcrumbs[] = array('name' => uri_to_name($uri));
 $xoopsTpl->assign('xoops_breadcrumbs', $breadcrumbs);
 if ($detail) {
     // summary by "title"
     $sql = "SELECT * FROM " . TBR . " WHERE {$cond} ORDER BY {$order}";
 } else {
     $sql = "SELECT SUM(nref) nref,COUNT(ref_id) n, title, " . " MAX(mtime) mtime, MIN(since) since," . " MIN(ref_url) ref_url, MAX(context) context" . " FROM " . TBR . " WHERE {$cond}" . " GROUP BY title ORDER BY {$order}";
 }
 $result = $xoopsDB->query($sql, $xoopsModuleConfig['list_max'], $start);
 if ($nrec) {
     $popt = $page > 1 ? "&page={$page}" : "";
     $ordstr = sprintf($order == "nref DESC" ? "<b>%s</b>" : "<a href='index.php?id={$track_id}{$popt}'>%s</a>", _TB_ORDER_NREF) . " | " . sprintf($order == "mtime DESC" ? "<b>%s</b>" : "<a href='index.php?id={$track_id}&order=time{$popt}'>%s</a>", _TB_ORDER_TIME);
     $xoopsTpl->assign('page_control', make_page_index("{$ordstr} - " . _TB_PAGE, $nrec, $page, " <a href='index.php?id={$track_id}{$opt}&page=%d'>(%d)</a>"));
     $referers = array();
     while ($data = $xoopsDB->fetchArray($result)) {
         $data['seq'] = ++$start;