untagged tweak
This commit is contained in:
parent
e5f469a1e0
commit
338f836287
5 changed files with 18 additions and 9 deletions
|
@ -18,7 +18,9 @@
|
||||||
<div id="sidebar-taglist">
|
<div id="sidebar-taglist">
|
||||||
<ul id="sidebar-taglist-overview">
|
<ul id="sidebar-taglist-overview">
|
||||||
<li id="sidebar-taglist-top"><a href="?tag=*">ALL (<?= $all_count ?>)</a></li>
|
<li id="sidebar-taglist-top"><a href="?tag=*">ALL (<?= $all_count ?>)</a></li>
|
||||||
|
<? if ($none_count > 0): ?>
|
||||||
<li id="sidebar-taglist-top"><a href="?tag=_">UNTAGGED (<?= $none_count ?>)</a></li>
|
<li id="sidebar-taglist-top"><a href="?tag=_">UNTAGGED (<?= $none_count ?>)</a></li>
|
||||||
|
<? endif; ?>
|
||||||
<li id="sidebar-taglist-top"><a href="?action=new_tag">ADD TAG</a></li>
|
<li id="sidebar-taglist-top"><a href="?action=new_tag">ADD TAG</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -34,6 +34,9 @@
|
||||||
<div id="sidebar-taglist">
|
<div id="sidebar-taglist">
|
||||||
<ul>
|
<ul>
|
||||||
<li id="sidebar-taglist-top"><a href="?tag=*">ALL (<?= $doc_count ?>)</a></li>
|
<li id="sidebar-taglist-top"><a href="?tag=*">ALL (<?= $doc_count ?>)</a></li>
|
||||||
|
<? if ($none_count > 0): ?>
|
||||||
|
<li id="sidebar-taglist-top"><a href="?tag=_">UNTAGGED (<?= $none_count ?>)</a></li>
|
||||||
|
<? endif; ?>
|
||||||
<?
|
<?
|
||||||
foreach($tags as $tag){
|
foreach($tags as $tag){
|
||||||
echo '<li><a href="?tag=' . $tag['name'] . "\">" . $tag['name'] . " (" . $tag['count'] . ")</a></li>";
|
echo '<li><a href="?tag=' . $tag['name'] . "\">" . $tag['name'] . " (" . $tag['count'] . ")</a></li>";
|
||||||
|
|
|
@ -19,6 +19,17 @@ class PileDB {
|
||||||
return $ret_count[0];
|
return $ret_count[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getUntaggedDocCount(){
|
||||||
|
$ret_count = $this->db->query("SELECT
|
||||||
|
count(ID)
|
||||||
|
FROM
|
||||||
|
Documents d
|
||||||
|
LEFT OUTER JOIN
|
||||||
|
DocumentstoTags dt ON dt.Document = d.ID
|
||||||
|
WHERE dt.Document IS NULL")->fetchArray(SQLITE3_NUM);
|
||||||
|
return $ret_count[0];
|
||||||
|
}
|
||||||
|
|
||||||
public function getTags(){
|
public function getTags(){
|
||||||
$tag_query = "SELECT
|
$tag_query = "SELECT
|
||||||
ID, Name, count(Document)
|
ID, Name, count(Document)
|
||||||
|
|
|
@ -110,15 +110,7 @@ if (isset($_SESSION['ID'])){
|
||||||
}
|
}
|
||||||
|
|
||||||
$all_count = $db->getDocCount();
|
$all_count = $db->getDocCount();
|
||||||
|
$none_count = $db->getUntaggedDocCount();
|
||||||
$ret_count = $db->query("SELECT
|
|
||||||
count(ID)
|
|
||||||
FROM
|
|
||||||
Documents d
|
|
||||||
LEFT OUTER JOIN
|
|
||||||
DocumentstoTags dt ON dt.Document = d.ID
|
|
||||||
WHERE dt.Document IS NULL")->fetchArray(SQLITE3_NUM);
|
|
||||||
$none_count = $ret_count[0];
|
|
||||||
|
|
||||||
$tags = $db->getTags();
|
$tags = $db->getTags();
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ if (isset($_GET["item"])) {
|
||||||
|
|
||||||
$page = new Template();
|
$page = new Template();
|
||||||
$page->doc_count = $db->getDocCount();
|
$page->doc_count = $db->getDocCount();
|
||||||
|
$page->none_count = $db->getUntaggedDocCount();
|
||||||
$page->tags = $db->getTags();
|
$page->tags = $db->getTags();
|
||||||
$page->content = $content;
|
$page->content = $content;
|
||||||
$page->logged = isset($_SESSION["ID"]);
|
$page->logged = isset($_SESSION["ID"]);
|
||||||
|
|
Loading…
Reference in a new issue