Merge branch 'develop' of https://github.com/getgrav/grav-plugin-admin into develop

This commit is contained in:
Andy Miller
2015-12-01 11:02:47 -07:00
15 changed files with 117 additions and 60 deletions

View File

@@ -9,6 +9,7 @@ use Grav\Common\Grav;
use Grav\Common\Uri;
use Grav\Common\Data;
use Grav\Common\Page;
use Grav\Common\Page\Pages;
use Grav\Common\Page\Collection;
use Grav\Common\User\User;
use Grav\Common\Utils;
@@ -487,8 +488,25 @@ class AdminController
// Filter by page type
if (count($flags)) {
$types = $flags;
$collection = $collection->ofOneOfTheseTypes($types);
$types = [];
$pageTypes = Pages::pageTypes();
foreach ($pageTypes as $pageType) {
if (($pageType = array_search($pageType, $flags)) !== false) {
$types[] = $pageType;
unset($flags[$pageType]);
}
}
if (count($types)) {
$collection = $collection->ofOneOfTheseTypes($types);
}
}
// Filter by page type
if (count($flags)) {
$accessLevels = $flags;
$collection = $collection->ofOneOfTheseAccessLevels($accessLevels);
}
}
@@ -496,8 +514,6 @@ class AdminController
foreach ($collection as $page) {
foreach ($queries as $query) {
$query = trim($query);
// $page->content();
if (stripos($page->getRawContent(), $query) === false && stripos($page->title(), $query) === false) {
$collection->remove($page);
}
@@ -798,7 +814,7 @@ class AdminController
/**
* Handles installing plugins and themes
*
* @return bool True is the action was performed
* @return bool True if the action was performed
*/
public function taskInstall()
{
@@ -827,7 +843,7 @@ class AdminController
/**
* Handles updating Grav
*
* @return bool True is the action was performed
* @return bool True if the action was performed
*/
public function taskUpdategrav()
{
@@ -851,7 +867,7 @@ class AdminController
/**
* Handles updating plugins and themes
*
* @return bool True is the action was performed
* @return bool True if the action was performed
*/
public function taskUpdate()
{
@@ -909,7 +925,7 @@ class AdminController
/**
* Handles uninstalling plugins and themes
*
* @return bool True is the action was performed
* @return bool True if the action was performed
*/
public function taskUninstall()
{
@@ -1046,6 +1062,11 @@ class AdminController
return true;
}
if ($this->view == 'groups') {
$this->setRedirect("{$this->view}/{$this->post['groupname']}");
return true;
}
if ($this->view != 'pages') {
return false;
}