plugins position

This commit is contained in:
Diego Najar 2017-07-30 23:15:33 +02:00
parent e1866d05d5
commit 3111c11ca3
10 changed files with 32 additions and 18 deletions

View File

@ -33,6 +33,12 @@ class dbList extends dbJSON
$list = $this->db[$key]['list']; $list = $this->db[$key]['list'];
if ($amountOfItems==-1) {
// Invert keys to values, is necesary returns as key the key pages
$list = array_flip($list);
return $list;
}
// The first page number is 1, so the real is 0 // The first page number is 1, so the real is 0
$realPageNumber = $pageNumber - 1; $realPageNumber = $pageNumber - 1;

View File

@ -181,6 +181,11 @@ class Plugin {
return $this->getMetadata('website'); return $this->getMetadata('website');
} }
public function position()
{
return $this->getValue('position');
}
public function version() public function version()
{ {
return $this->getMetadata('version'); return $this->getMetadata('version');
@ -220,7 +225,7 @@ class Plugin {
} }
// Return TRUE if the installation success, otherwise FALSE. // Return TRUE if the installation success, otherwise FALSE.
public function install($position=0) public function install($position=1)
{ {
if($this->installed()) { if($this->installed()) {
return false; return false;

View File

@ -51,7 +51,7 @@ echo '
} }
for($i=1; $i<=Paginator::amountOfPages(); $i++) { for($i=1; $i<=Paginator::amountOfPages(); $i++) {
echo '<li><a href="'.Paginator::absoluteUrl($i).'" class="page">'.$i.'</a></li>'; echo '<li><a href="'.Paginator::numberUrl($i).'" class="page">'.$i.'</a></li>';
} }
// Show next page link // Show next page link

View File

@ -14,7 +14,7 @@ HTML::formOpen(array('class'=>'uk-form-horizontal'));
HTML::formSelect(array( HTML::formSelect(array(
'name'=>'itemsPerPage', 'name'=>'itemsPerPage',
'label'=>$L->g('Items per page'), 'label'=>$L->g('Items per page'),
'options'=>array('1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6','7'=>'7','8'=>'8'), 'options'=>array('1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6','7'=>'7','8'=>'8', '-1'=>'All pages'),
'selected'=>$Site->itemsPerPage(), 'selected'=>$Site->itemsPerPage(),
'class'=>'uk-width-1-3 uk-form-medium', 'class'=>'uk-width-1-3 uk-form-medium',
'tip'=>$L->g('Number of items to show per page') 'tip'=>$L->g('Number of items to show per page')

View File

@ -102,6 +102,11 @@ function buildPlugins()
} }
} }
} }
uasort($plugins['siteSidebar'], function ($a, $b) {
return $a->position()>$b->position();
}
);
} }
} }

View File

@ -134,9 +134,6 @@ elseif( $Url->whereAmI()==='admin' ) {
// Set page 404 not found // Set page 404 not found
if ($Url->notFound()) { if ($Url->notFound()) {
$Url->setWhereAmI('page');
$Url->setHttpCode(404);
$page = $Page = buildPage('error'); $page = $Page = buildPage('error');
if ($page===false) { if ($page===false) {
$page = buildErrorPage(); $page = buildErrorPage();

View File

@ -144,6 +144,7 @@ class Url
public function setNotFound() public function setNotFound()
{ {
$this->whereAmI = 'page';
$this->notFound = true; $this->notFound = true;
$this->httpCode = 404; $this->httpCode = 404;
$this->httpMessage = 'Not Found'; $this->httpMessage = 'Not Found';

View File

@ -30,7 +30,7 @@ div.plugin a {
cursor: pointer; cursor: pointer;
display: block; display: block;
font-size: 1.1em; font-size: 1.1em;
padding: 0.625em 0; padding: 0;
} }
/* Plugin Tags /* Plugin Tags