index.php 1.86 KB
Newer Older
Alastair Pharo's avatar
Alastair Pharo committed
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
/**
 * This program is part of Mahara
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 *
 * @package    mahara
 * @subpackage artefact-blog
 * @author     Alastair Pharo <alastair@catalyst.net.nz>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @copyright  (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
 *
 */

define('INTERNAL', 1);
define('MENUITEM', 'myblogs');

require(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
safe_require('artefact', 'blog');

// This is the wwwroot.
$wwwroot = get_config('wwwroot');

// This JavaScript creates a table to display the blog entries.
37
$js = <<<EOF
Alastair Pharo's avatar
Alastair Pharo committed
38
39
40
41
42
43
44
45

var bloglist = new TableRenderer(
    'bloglist',
    'index.json.php',
    [
        function(r) {
            return TD(
              null,
Alastair Pharo's avatar
Alastair Pharo committed
46
              A({'href':'{$wwwroot}artefact/blog/view/?id=' + r.id}, r.title)
Alastair Pharo's avatar
Alastair Pharo committed
47
48
            );
        },
49
50
51
52
53
        function(r) {
            var td = TD();
            td.innerHTML = r.description;
            return td;
        }
Alastair Pharo's avatar
Alastair Pharo committed
54
55
56
57
58
    ]
);

bloglist.updateOnLoad();

59
EOF;
Alastair Pharo's avatar
Alastair Pharo committed
60
61
62
63
64
65
66

$smarty = smarty(array('tablerenderer'));
$smarty->assign_by_ref('INLINEJAVASCRIPT', $js);
$smarty->assign_by_ref('blogs', $blogs);
$smarty->display('artefact:blog:list.tpl');

?>