getPrefix() . 'postrating'; $options = Typecho_Widget::widget('Widget_Options'); $contents = Typecho_Widget::widget('Widget_Abstract_Contents'); $hash = substr(md5(Typecho_Widget::widget('Widget_User')->authCode), -10); // 安全密鑰, 別人無法得知此數值 // 勾選式刪除 if (isset($_POST['hash']) && $_POST['hash'] == $hash) { // 單篇選擇 if (isset($_POST['created'])) { $created = $_POST['created']; $select = $db->delete('table.postrating'); foreach($created as $row) { $select->orWhere('created = ?', $row); } $db->query($select); // 總覽選擇 } elseif (isset($_POST['cid'])) { $cid = $_POST['cid']; $select = $db->delete('table.postrating'); foreach($cid as $row) { $select->orWhere('cid = ?', $row); } $db->query($select); } } if (isset($_GET['cid'])) { // 取得單篇文章 $result = $contents->push($db->fetchRow($contents->select()->where('table.contents.cid = ?', $_GET['cid']))); // 取得單篇文章的評分 $query = $db->fetchAll($db->select()->from('table.postrating')->where('cid = ?', $_GET['cid'])->order('created', Typecho_Db::SORT_DESC)); } ?>
 标题: 《', $result['title'], '》'; ?>

▲ 返回上层 操作: 全选, 不选    选中项: 删除评分

日期 评分 IP 评分者
删除 ★"; } ?>
没有任何評分
fetchAll($db->select('cid', 'rating')->from('table.postrating')); foreach ($query as $row) { $rating_cid[] = $row['cid']; $rating[$row['cid']][] = $row['rating']; } // 取得所有 cid $post_cid = Typecho_Common::arrayFlatten($db->fetchAll($db->select('cid')->from('table.contents')), 'cid'); // 刪除不存在 cid 的評分 (若文章已刪除, 就要刪除此 cid 評分) $query = isset($rating_cid) ? array_diff(array_unique($rating_cid), $post_cid) : ''; if ($query) { $select = $db->delete('table.postrating'); foreach ($query as $row) { $select->orWhere('cid = ?', $row); } $db->query($select); } ?>
have()): ?> next()): ?> alt(' class="even"', ''); ?> id="theId(); ?>"> status && 'waiting' != $posts->status): ?> colspan="2"> cid])): ?> title(); ?> title(); ?> status || 'waiting' == $posts->status): ?>
cid 标题 评分人数 累计分数 平均得分 作者 分类
cid(); ?> status): ?> view status ? '草稿' : '待审核'; ?> cid]) ? count($rating[$posts->cid], 1) : '--'; ?> cid]) ? array_sum($rating[$posts->cid]) : '--'; ?> cid]) ? number_format(array_sum($rating[$posts->cid])/count($rating[$posts->cid], 1), 2) : '--'; ?> author(); ?> categories; $length = count($categories); ?> $val): ?>
没有任何文章
have()): ?>
    pageNav(); ?>