viewcontent.json.php 985 Bytes
Newer Older
1
2
3
4
5
6
<?php
/**
 *
 * @package    mahara
 * @subpackage core
 * @author     Catalyst IT Ltd
7
8
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
 * @copyright  For copyright information on Mahara, please see the README file distributed with this software.
9
10
11
12
13
14
15
16
 *
 */

define('INTERNAL', 1);
define('JSON', 1);
require(dirname(dirname(__FILE__)) . '/init.php');
require_once(get_config('libroot') . 'view.php');

17
$id = param_integer('id');
18
19
20
21
22
23
if (!can_view_view($id)) {
    json_reply('local', get_string('accessdenied', 'error'));
}
$view = new View($id);

$smarty = smarty_core();
24
25
$smarty->assign('viewtitle', $view->get('title'));
$smarty->assign('ownername', $view->formatted_owner());
26
$smarty->assign('viewdescription', $view->get('description'));
27
$smarty->assign('viewcontent', $view->build_rows());
Richard Mansfield's avatar
Richard Mansfield committed
28
$smarty->assign('tags', $view->get('tags'));
29
$html = $smarty->fetch('view/viewcontent.tpl');
30
31
32
33
34

json_reply(false, array(
    'message' => null,
    'html' => $html,
));