Beispiel #1
0
function sub_article($parent_id, $nos, $pre = null)
{
    $db = new FQuery();
    $db->connect();
    $sql = $db->select(FDBPrefix . "article_category", "*", "parent_id={$parent_id}");
    $no = 1;
    while ($qr = mysql_fetch_array($sql)) {
        $db->select(FDBPrefix . 'article', '*', "category={$qr['id']}");
        $sum = mysql_affected_rows();
        $sql2 = $db->select(FDBPrefix . 'user_group');
        while ($qrs = mysql_fetch_array($sql2)) {
            if ($qrs['level'] == $qr['level']) {
                $level = "{$qrs['group_name']}";
            } else {
                $level = _Public;
            }
        }
        if ($qr['level'] >= $_SESSION['USER_LEVEL']) {
            $checkbox = "<input type='checkbox' data-name='rad-{$qr['id']}' name='check_category[]' value='{$qr['id']}' rel='ck'>";
            $name = "<a class='tips' data-placement='right'  title='" . Edit . "' href='?app=article&view=category&act=edit&id={$qr['id']}'>{$qr['name']}</a>";
        } else {
            $checkbox = "<span class='icon lock'></lock>";
            $name = "{$qr['name']}";
        }
        echo "<tr>";
        echo "<td align='center'>{$checkbox}</td><td>{$pre}|_ {$name} <span class='label label-primary right visible-xs'>{$sum}</span></td><td align='center'  class='hidden-xs'>{$level}</td><td align='center'  class='hidden-xs'>{$sum}</td>";
        echo "</tr>";
        sub_article($qr['id'], "{$nos}.{$no}", $pre . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
        $no++;
    }
}
Beispiel #2
0
$sql = $db->select(FDBPrefix . 'article_category', '*', "parent_id=0");
$no = 1;
while ($qr = mysql_fetch_array($sql)) {
    //num of total article
    $db->select(FDBPrefix . 'article', '*', "category={$qr['id']}");
    $num = mysql_affected_rows();
    //creat user group values
    $sql2 = $db->select(FDBPrefix . 'user_group', '*', "level={$qr['level']}");
    $level = mysql_fetch_array($sql2);
    if ($qr['level'] == 99) {
        $level = _Public;
    } else {
        $level = $level['group_name'];
    }
    if ($_SESSION['USER_LEVEL'] <= $qr['level']) {
        $name = "<a class='tips' data-placement='right' title='" . Edit . "' href='?app=article&view=category&act=edit&id={$qr['id']}'>{$qr['name']}</a>";
        $checkbox = "<input type='checkbox' data-name='rad-{$qr['id']}' name='check_category[]' value='{$qr['id']}' rel='ck'>";
    } else {
        $checkbox = "<span class='icon lock'></lock>";
        $name = "{$qr['name']}";
    }
    echo "<tr>";
    echo "<td align='center'>{$checkbox}</td><td>{$name} <span class='label label-primary right visible-xs'>{$num}</span></td><td align='center' class='hidden-xs'>{$level}</td><td align='center' class='hidden-xs'>{$num}</td>";
    echo "</tr>";
    sub_article($qr['id'], $no, "<span style='display: none'>{$name}</span>");
    $no++;
}
?>
        </tbody>			
	</table>
</form>