Exemple #1
0
    function show($from = 0, $to = 0)
    {
        global $cfg;
        $ca = new caction();
        $ca->updatelist();
        if (!$from) {
            $sql = 'SELECT count(*) as cnt FROM ' . TBL_MHISTORY . ' h, ' . TBL_SEARCH . ' s WHERE h.s_id = s.id and h.u_id = ' . $this->uid;
            if ($this->filter != -1) {
                $sql .= ' AND tid = ' . $this->filter;
            }
            $this->kpdb->setquery($sql);
            $this->kpdb->query();
            if ($this->kpdb->num() > 0) {
                $row = $this->kpdb->nextrow();
                $this->rows = $row['cnt'];
            }
        }
        $sql = 'SELECT h.tid, h.utime, s.free, h.dpercent, s.id, s.date,h.active, s.album, s.title, s.artist FROM ' . TBL_MHISTORY . ' h, ' . TBL_SEARCH . ' s WHERE h.s_id = s.id and h.u_id = ' . $this->uid;
        if ($this->filter != -1) {
            $sql .= ' AND tid = ' . $this->filter;
        }
        $sql .= ' ORDER BY h.utime DESC';
        if ($from && $to) {
            $sql .= ' LIMIT ' . $from . ',' . $to;
        } else {
            $sql .= ' LIMIT ' . $this->perpage;
        }
        $res = db_execquery($sql, true);
        $options = array(0 => array(-1, get_lang(67)), 1 => array(0, get_lang(183)), 2 => array(1, get_lang(117)), 3 => array(2, get_lang(223)), 4 => array(3, get_lang(267)), 5 => array(4, get_lang(331)));
        ?>
		<form method="post" action="<?php 
        echo PHPSELF;
        ?>
">
		<input type="hidden" name="action" value="userhistory"/>
		<input type="hidden" name="id" value="<?php 
        echo $this->uid;
        ?>
"/>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td width="12%"></td>
			<td width="58%"></td>
			<td width="20%"></td>
			<td width="10%"></td>
		</tr>
		<tr>
			<td class="wtext" valign="top" colspan="4">
				<input class="fatbuttom" type="button" onclick="javascript: location = '<?php 
        echo PHPSELF . '?action=showusers';
        ?>
';" name="back" value="<?php 
        echo get_lang(34);
        ?>
"/>&nbsp;&nbsp;	
				<input class="fatfield" size="3" maxlength="5" type="text" name="chperpage" value="<?php 
        echo $this->perpage;
        ?>
"/> <?php 
        echo get_lang(178);
        ?>
&nbsp; <?php 
        echo genselect('cfilter', $options, $this->filter, false, 'fatfield');
        ?>
&nbsp;
				<input type="submit" value="<?php 
        echo get_lang(107);
        ?>
" name="Refresh" class="fatbuttom"/>
			</td>
		</tr>
		<tr>
			<td colspan="3" height="15"></td>
		</tr>	
		<?php 
        $f2 = new file2();
        $kpwjs = new kpwinjs();
        $tidarray = array(0 => get_lang(183), 1 => get_lang(117), 2 => get_lang(223), 3 => get_lang(267), 4 => get_lang(331));
        if ($res) {
            $cnt = 0;
            while ($row = db_fetch_assoc($res)) {
                $f2->fname = $row['free'];
                $f2->id3['artist'] = $row['artist'];
                $f2->id3['album'] = $row['album'];
                $f2->id3['title'] = $row['title'];
                $title = file_parse($f2, '', '', '[%t - %l - %a|%f]');
                if ($row['active']) {
                    $class = 'filemarked';
                } else {
                    $class = 'wtext';
                }
                if ($cnt % 2 == 0) {
                    echo '<tr class="row2nd">';
                } else {
                    echo '<tr>';
                }
                $fd = new filedesc($f2->fname);
                if (WINDOWPLAYER && $fd->m3u) {
                    $link = '" onclick="javascript: ' . $kpwjs->single($row['id']) . ' return false;';
                } else {
                    $link = $f2->weblink($row['id'], $row['date']);
                }
                ?>
					<td class="file"><?php 
                echo $tidarray[$row['tid']];
                ?>
</td>
					<td class="file" nowrap="nowrap"><a class="hotnb" href="<?php 
                echo $link;
                ?>
"><font class="<?php 
                echo $class;
                ?>
"><?php 
                echo strlen($title) > 60 ? substr($title, 0, 60) . ' ..' : $title;
                ?>
</font></a></td>
					<td class="file"><?php 
                echo date($cfg['dateformat'], $row['utime']);
                ?>
</td>
					<td class="file"><?php 
                if ($row['tid'] == 0 || $row['tid'] == 1) {
                    echo $row['dpercent'] . '%';
                } else {
                    echo '-';
                }
                ?>
</td>
				</tr>
				<?php 
                $cnt++;
            }
        }
        if ($cnt == 0) {
            echo '<tr><td class="file" colspan="4">' . get_lang(10) . '</td></tr>';
        }
        ?>
		</table>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<?php 
    }
Exemple #2
0
        } else {
            $checked = ' checked';
        }
        $t->AddRow("<input type=checkbox name='c_{$c->name}'{$checked}>", "{$c->name}<br>");
    }
    print $t->Render('border=0');
    ?>
</td><td>
<b>Where Columns Match (this part is not working)</b><br>
<?php 
    $t = new PHPLensTable();
    $t->_idprefix = 't_';
    $t->debug = 1;
    foreach ($cols as $c) {
        $t->AddTD('nowrap', 'nowrap');
        $t->AddRow($c->name, genselect('s1_' . $c->name) . "<input type=text name='t1_{$c->name}'> &nbsp; &nbsp;" . genselect('s2_' . $c->name) . "<input type=text name='t2_{$c->name}'>");
    }
    print $t->Render('border=0');
    print "<input type=hidden name=table value='{$tab}'>";
    print "<input type=hidden name=query value=1>";
    ?>
</td></tr></table>
<input type=submit>
</form>
<?php 
}
?>
<pre>
To Do

1. Allow the user to choose col to be primary key, sum(), count()