2013-01-30 01:06:39 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ownCloud - News
|
|
|
|
*
|
2013-03-02 22:50:33 +04:00
|
|
|
* @author Alessandro Cosentino
|
2013-01-30 01:06:39 +04:00
|
|
|
* @author Bernhard Posselt
|
|
|
|
* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
|
|
|
|
* @copyright 2012 Bernhard Posselt nukeawhale@gmail.com
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 3 of the License, or any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2013-02-02 03:20:26 +04:00
|
|
|
namespace OCA\News\Controller;
|
2013-01-30 01:06:39 +04:00
|
|
|
|
2013-02-02 03:20:26 +04:00
|
|
|
use \OCA\AppFramework\Controller\Controller;
|
|
|
|
use \OCA\AppFramework\Core\API;
|
|
|
|
use \OCA\AppFramework\Http\Request;
|
2013-03-21 02:33:51 +04:00
|
|
|
|
|
|
|
use \OCA\News\Bl\FolderBl;
|
2013-01-30 01:06:39 +04:00
|
|
|
|
|
|
|
|
2013-02-02 03:20:26 +04:00
|
|
|
class FolderController extends Controller {
|
2013-01-30 01:06:39 +04:00
|
|
|
|
2013-03-21 02:33:51 +04:00
|
|
|
private $folderBl;
|
2013-01-30 01:06:39 +04:00
|
|
|
|
2013-03-21 02:33:51 +04:00
|
|
|
public function __construct(API $api, Request $request, FolderBl $folderBl){
|
2013-02-02 03:21:22 +04:00
|
|
|
parent::__construct($api, $request);
|
2013-03-21 02:33:51 +04:00
|
|
|
$this->folderBl = $folderBl;
|
2013-02-02 03:21:22 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @IsAdminExemption
|
|
|
|
* @IsSubAdminExemption
|
|
|
|
* @Ajax
|
|
|
|
*/
|
2013-03-21 16:16:16 +04:00
|
|
|
public function folders(){
|
2013-03-21 02:33:51 +04:00
|
|
|
$folders = $this->folderBl->findAll($this->api->getUserId());
|
|
|
|
$result = array(
|
|
|
|
'folders' => $folders
|
|
|
|
);
|
|
|
|
return $this->renderJSON($result);
|
2013-02-02 03:21:22 +04:00
|
|
|
}
|
2013-01-30 01:06:39 +04:00
|
|
|
|
|
|
|
|
2013-03-22 00:48:24 +04:00
|
|
|
private function setOpened($isOpened){
|
|
|
|
$userId = $this->api->getUserId();
|
|
|
|
$folderId = $this->params('folderId');
|
|
|
|
|
|
|
|
$this->folderBl->open($folderId, $isOpened, $userId);
|
|
|
|
}
|
|
|
|
|
2013-03-21 20:53:30 +04:00
|
|
|
/**
|
|
|
|
* @IsAdminExemption
|
|
|
|
* @IsSubAdminExemption
|
|
|
|
* @Ajax
|
|
|
|
*/
|
|
|
|
public function open(){
|
2013-03-22 00:48:24 +04:00
|
|
|
$this->setOpened(true);
|
|
|
|
return $this->renderJSON(array());
|
2013-03-21 20:53:30 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-02-02 18:58:40 +04:00
|
|
|
/**
|
|
|
|
* @IsAdminExemption
|
|
|
|
* @IsSubAdminExemption
|
|
|
|
* @Ajax
|
|
|
|
*/
|
|
|
|
public function collapse(){
|
2013-03-22 00:48:24 +04:00
|
|
|
$this->setOpened(false);
|
|
|
|
return $this->renderJSON(array());
|
2013-02-02 18:58:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-21 20:53:30 +04:00
|
|
|
/**
|
|
|
|
* @IsAdminExemption
|
|
|
|
* @IsSubAdminExemption
|
|
|
|
* @Ajax
|
|
|
|
*/
|
|
|
|
public function create(){
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @IsAdminExemption
|
|
|
|
* @IsSubAdminExemption
|
|
|
|
* @Ajax
|
|
|
|
*/
|
|
|
|
public function delete(){
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @IsAdminExemption
|
|
|
|
* @IsSubAdminExemption
|
|
|
|
* @Ajax
|
|
|
|
*/
|
|
|
|
public function rename(){
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-01-30 01:06:39 +04:00
|
|
|
}
|