Sticky content
This commit is contained in:
parent
bf573fca1e
commit
c814c0da9e
|
@ -34,6 +34,7 @@ if (empty($published) && $Url->pageNumber()>1) {
|
||||||
$drafts = $dbPages->getDraftDB(true);
|
$drafts = $dbPages->getDraftDB(true);
|
||||||
$scheduled = $dbPages->getScheduledDB(true);
|
$scheduled = $dbPages->getScheduledDB(true);
|
||||||
$static = $dbPages->getStaticDB(true);
|
$static = $dbPages->getStaticDB(true);
|
||||||
|
$sticky = $dbPages->getStickyDB(true);
|
||||||
|
|
||||||
// Title of the page
|
// Title of the page
|
||||||
$layout['title'] .= ' - '.$Language->g('Manage content');
|
$layout['title'] .= ' - '.$Language->g('Manage content');
|
|
@ -29,6 +29,7 @@ function table($status, $icon='arrow-circle-o-down') {
|
||||||
global $drafts;
|
global $drafts;
|
||||||
global $scheduled;
|
global $scheduled;
|
||||||
global $static;
|
global $static;
|
||||||
|
global $sticky;
|
||||||
|
|
||||||
if ($status=='published') {
|
if ($status=='published') {
|
||||||
$list = $published;
|
$list = $published;
|
||||||
|
@ -38,6 +39,8 @@ function table($status, $icon='arrow-circle-o-down') {
|
||||||
$list = $scheduled;
|
$list = $scheduled;
|
||||||
} elseif ($status=='static') {
|
} elseif ($status=='static') {
|
||||||
$list = $static;
|
$list = $static;
|
||||||
|
} elseif ($status=='sticky') {
|
||||||
|
$list = $sticky;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($list)) {
|
if (!empty($list)) {
|
||||||
|
@ -109,6 +112,7 @@ if ($Url->pageNumber()==1) {
|
||||||
table('draft', 'spinner');
|
table('draft', 'spinner');
|
||||||
table('scheduled', 'clock-o');
|
table('scheduled', 'clock-o');
|
||||||
table('static', 'thumb-tack');
|
table('static', 'thumb-tack');
|
||||||
|
table('sticky', 'sticky-note-o');
|
||||||
}
|
}
|
||||||
table('published', '');
|
table('published', '');
|
||||||
|
|
||||||
|
|
|
@ -143,6 +143,7 @@ echo '<div class="bl-publish-sidebar uk-width-2-10">';
|
||||||
'options'=>array(
|
'options'=>array(
|
||||||
'published'=>$L->g('Published'),
|
'published'=>$L->g('Published'),
|
||||||
'static'=>$L->g('Static'),
|
'static'=>$L->g('Static'),
|
||||||
|
'sticky'=>$L->g('Sticky'),
|
||||||
'draft'=>$L->g('Draft')
|
'draft'=>$L->g('Draft')
|
||||||
),
|
),
|
||||||
'selected'=>$page->status(),
|
'selected'=>$page->status(),
|
||||||
|
|
|
@ -121,6 +121,7 @@ echo '<div class="bl-publish-sidebar uk-width-2-10">';
|
||||||
'options'=>array(
|
'options'=>array(
|
||||||
'published'=>$L->g('Published'),
|
'published'=>$L->g('Published'),
|
||||||
'static'=>$L->g('Static'),
|
'static'=>$L->g('Static'),
|
||||||
|
'sticky'=>$L->g('Sticky'),
|
||||||
'draft'=>$L->g('Draft')
|
'draft'=>$L->g('Draft')
|
||||||
),
|
),
|
||||||
'selected'=>'published',
|
'selected'=>'published',
|
||||||
|
|
|
@ -10,7 +10,7 @@ class dbPages extends dbJSON
|
||||||
'description'=> array('inFile'=>false, 'value'=>''),
|
'description'=> array('inFile'=>false, 'value'=>''),
|
||||||
'username'=> array('inFile'=>false, 'value'=>''),
|
'username'=> array('inFile'=>false, 'value'=>''),
|
||||||
'tags'=> array('inFile'=>false, 'value'=>array()),
|
'tags'=> array('inFile'=>false, 'value'=>array()),
|
||||||
'status'=> array('inFile'=>false, 'value'=>'published'), // published, draft, scheduled
|
'status'=> array('inFile'=>false, 'value'=>'published'), // published, draft, sticky, scheduled
|
||||||
'type'=> array('inFile'=>false, 'value'=>'post'), // post, page
|
'type'=> array('inFile'=>false, 'value'=>'post'), // post, page
|
||||||
'date'=> array('inFile'=>false, 'value'=>''),
|
'date'=> array('inFile'=>false, 'value'=>''),
|
||||||
'dateModified'=> array('inFile'=>false, 'value'=>''),
|
'dateModified'=> array('inFile'=>false, 'value'=>''),
|
||||||
|
@ -372,6 +372,21 @@ class dbPages extends dbJSON
|
||||||
return $tmp;
|
return $tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns an array with a list of keys of sticky pages
|
||||||
|
public function getStickyDB($onlyKeys=true)
|
||||||
|
{
|
||||||
|
$tmp = $this->db;
|
||||||
|
foreach ($tmp as $key=>$fields) {
|
||||||
|
if($fields['status']!='sticky') {
|
||||||
|
unset($tmp[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($onlyKeys) {
|
||||||
|
return array_keys($tmp);
|
||||||
|
}
|
||||||
|
return $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
// Return an array with the database for a page, FALSE otherwise
|
// Return an array with the database for a page, FALSE otherwise
|
||||||
public function getPageDB($key)
|
public function getPageDB($key)
|
||||||
{
|
{
|
||||||
|
|
|
@ -159,6 +159,12 @@ function buildPagesFor($for, $categoryKey=false, $tagKey=false) {
|
||||||
$onlyPublished = true;
|
$onlyPublished = true;
|
||||||
$amountOfItems = $Site->itemsPerPage();
|
$amountOfItems = $Site->itemsPerPage();
|
||||||
$list = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished);
|
$list = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished);
|
||||||
|
|
||||||
|
// Include sticky pages only in the first page
|
||||||
|
if ($pageNumber==1) {
|
||||||
|
$sticky = $dbPages->getStickyDB();
|
||||||
|
$list = array_merge($sticky, $list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elseif ($for=='category') {
|
elseif ($for=='category') {
|
||||||
$amountOfItems = $Site->itemsPerPage();
|
$amountOfItems = $Site->itemsPerPage();
|
||||||
|
|
Loading…
Reference in New Issue