示例#1
0
文件: post.php 项目: Br3nda/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 3 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, see <http://www.gnu.org/licenses/>.
 *
 * @package    mahara
 * @subpackage blocktype-wall
 * @author     Catalyst IT Ltd
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @copyright  (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz
 *
 */
define('INTERNAL', 1);
require_once dirname(dirname(dirname(__FILE__))) . '/init.php';
define('TITLE', get_string('wallpost', 'blocktype.wall'));
require_once 'pieforms/pieform.php';
require_once get_config('docroot') . 'blocktype/lib.php';
$wall = param_integer('instance');
$instance = new BlockInstance($wall);
safe_require('blocktype', 'wall');
PluginBlocktypeWall::wallpost_form($instance);
示例#2
0
 */
define('INTERNAL', 1);
define('PUBLIC', 1);
require dirname(dirname(dirname(__FILE__))) . '/init.php';
require_once 'view.php';
safe_require('blocktype', 'wall');
define('TITLE', get_string('viewwall', 'blocktype.wall'));
$instanceid = param_integer('id');
$reply = param_boolean('reply', false);
// TODO send this to the form
$postid = 0;
if ($reply) {
    $postid = param_integer('postid');
    // TODO just fetch this thread
}
$postid = param_integer('postid', 0);
$block = new BlockInstance($instanceid);
$view = $block->get_view();
$owner = $view->get_owner_object();
$smarty = smarty(array(), array(), array(), array('sidebars' => false));
$smarty->assign('displayname', display_name($owner));
$smarty->assign('instanceid', $instanceid);
$smarty->assign('owner', $owner);
$smarty->assign('wholewall', true);
$smarty->assign('ownwall', !empty($USER) && $USER->get('id') == $owner->id);
if ($posts = PluginBlocktypeWall::fetch_posts($block, true)) {
    $smarty->assign('wallposts', $posts);
} else {
    $smarty->assign('wallmessage', get_string('noposts', 'blocktype.wall'));
}
$smarty->display('blocktype:wall:wallposts.tpl');
示例#3
0
 * @subpackage blocktype-wall
 * @author     Maxime Rigo
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @copyright  (C) 2009 Maxime Rigo
 * @copyright  (C) 2009 Catalyst IT Ltd http://catalyst.net.nz
 *
 */
define('INTERNAL', 1);
require dirname(dirname(dirname(__FILE__))) . '/init.php';
require_once 'view.php';
safe_require('blocktype', 'wall');
$postid = param_integer('postid');
$return = param_variable('return');
$wallpost = get_record('blocktype_wall_post', 'id', $postid);
$instance = new BlockInstance($wallpost->instance);
$view = new View($instance->get('view'));
if (!PluginBlocktypeWall::can_delete_wallpost($wallpost->from, $view->get('owner'))) {
    throw new AccessDeniedException();
}
$goto = $return == 'wall' ? '/blocktype/wall/wall.php?id=' . $instance->get('id') : '/user/view.php?id=' . $view->get('owner');
$form = pieform(array('name' => 'deletepost', 'renderer' => 'div', 'autofocus' => false, 'elements' => array('title' => array('value' => get_string('deletepostsure', 'blocktype.wall')), 'submit' => array('type' => 'submitcancel', 'value' => array(get_string('yes'), get_string('no')), 'goto' => $goto))));
function deletepost_submit(Pieform $form, $values)
{
    global $SESSION, $postid, $goto;
    delete_records('blocktype_wall_post', 'id', $postid);
    $SESSION->add_ok_msg(get_string('deletepostsuccess', 'blocktype.wall'));
    redirect($goto);
}
$smarty = smarty();
$smarty->assign('deleteform', $form);
$smarty->display('blocktype:wall:deletepost.tpl');
 *
 */
define('INTERNAL', 1);
require dirname(dirname(dirname(__FILE__))) . '/init.php';
require_once 'view.php';
safe_require('blocktype', 'wall');
$postid = param_integer('postid');
$return = param_variable('return');
if (!($wallpost = get_record('blocktype_wall_post', 'id', $postid))) {
    throw new NotFoundException();
}
if (!($instance = new BlockInstance($wallpost->instance))) {
    throw new NotFoundException();
}
$owner = $instance->get_view()->get('owner');
if (!PluginBlocktypeWall::can_delete_wallpost($wallpost->from, $owner)) {
    throw new AccessDeniedException();
}
$goto = $return == 'wall' ? '/blocktype/wall/wall.php?id=' . $instance->get('id') : profile_url($owner);
$form = pieform(array('name' => 'deletepost', 'renderer' => 'div', 'autofocus' => false, 'elements' => array('title' => array('value' => get_string('deletepostsure', 'blocktype.wall')), 'submit' => array('type' => 'submitcancel', 'value' => array(get_string('yes'), get_string('no')), 'goto' => $goto))));
function deletepost_submit(Pieform $form, $values)
{
    global $SESSION, $postid, $goto;
    delete_records('blocktype_wall_post', 'id', $postid);
    $SESSION->add_ok_msg(get_string('deletepostsuccess', 'blocktype.wall'));
    redirect($goto);
}
$smarty = smarty();
$smarty->assign('deleteform', $form);
$smarty->assign('PAGEHEADING', get_string('deletepost', 'blocktype.wall'));
$smarty->display('blocktype:wall:deletepost.tpl');