/
json.php
36 lines (31 loc) · 965 Bytes
/
json.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
* Joomlatools Framework - https://www.joomlatools.com/developer/framework/
*
* @copyright Copyright (C) 2011 Johan Janssens and Timble CVBA. (http://www.timble.net)
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
* @link http://github.com/joomlatools/joomlatools-framework-files for the canonical source repository
*/
/**
* Json View
*
* @author Ercan Ozkaya <https://github.com/ercanozkaya>
* @package Koowa\Component\Files
*/
class ComFilesViewJson extends KViewJson
{
protected function _renderData()
{
$output = parent::_renderData();
if (!$this->isCollection())
{
$entity = $this->getModel()->fetch();
$status = $entity->getStatus() !== KDatabase::STATUS_FAILED;
$output['status'] = $status;
if ($status === false){
$output['error'] = $entity->getStatusMessage();
}
}
return $output;
}
}