~ubuntu-branches/ubuntu/lucid/mahara/lucid-security

1 by Nigel McNie
Import upstream version 1.0.2
1
<?php
2
/**
3
 * Mahara: Electronic portfolio, weblog, resume builder and social networking
1.3.3 by Francois Marier
Import upstream version 1.2.0
4
 * Copyright (C) 2006-2009 Catalyst IT Ltd and others; see:
5
 *                         http://wiki.mahara.org/Contributors
1 by Nigel McNie
Import upstream version 1.0.2
6
 *
7
 * This program is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation, either version 3 of the License, or
10
 * (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 *
20
 * @package    mahara
21
 * @subpackage core
22
 * @author     Catalyst IT Ltd
23
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
1.3.3 by Francois Marier
Import upstream version 1.2.0
24
 * @copyright  (C) 2006-2009 Catalyst IT Ltd http://catalyst.net.nz
1 by Nigel McNie
Import upstream version 1.0.2
25
 *
26
 */
27
28
define('INTERNAL', 1);
29
define('JSON', 1);
30
require(dirname(dirname(__FILE__)) . '/init.php');
31
require('view.php');
32
require('form/elements/artefactchooser.php');
33
34
$extradata = json_decode(param_variable('extradata'));
35
36
safe_require('blocktype', $extradata->blocktype);
37
$data = pieform_element_artefactchooser_set_attributes(
38
    call_static_method(generate_class_name('blocktype', $extradata->blocktype), 'artefactchooser_element', $extradata->value)
39
);
40
$data['offset'] = param_integer('offset', 0);
1.1.6 by Francois Marier
Import upstream version 1.1.0
41
list($html, $pagination, $count, $offset) = View::build_artefactchooser_data($data, $extradata->group, $extradata->institution);
1 by Nigel McNie
Import upstream version 1.0.2
42
43
json_reply(false, array(
44
    'message' => null,
45
    'data' => array(
46
        'tablerows' => $html,
47
        'pagination' => $pagination['html'],
48
        'pagination_js' => $pagination['javascript'],
49
        'count' => $count,
50
        'results' => $count . ' ' . ($count == 1 ? get_string('result') : get_string('results')),
51
        'offset' => $offset,
52
    )
53
));
54
55
?>