tagsearch.php 992 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
 *
 */

define('INTERNAL', 1);
define('JSON', 1);

require(dirname(dirname(__FILE__)) . '/init.php');
16
require_once('searchlib.php');
17

18
19
20
if ($tag = param_variable('tag', null)) {
    $tag = urldecode($tag);
}
21
$limit  = param_integer('limit', 10);
22
$offset = param_integer('offset', 0);
23
$sort   = param_alpha('sort', 'name');
24
$type   = param_alpha('type', null);
25
26
$owner  = (object) array('type' => 'user', 'id' => $USER->get('id'));

27
$data = get_portfolio_items_by_tag($tag, $owner, $limit, $offset, $sort, $type);
28
build_portfolio_search_html($data);
29
$data->tagdisplay = is_null($tag) ? get_string('alltags') : hsc(str_shorten_text($tag, 50));
30
$data->tagurl = urlencode($tag);
31
32

json_reply(false, array('data' => $data));