コード例 #1
0
ファイル: lib.php プロジェクト: kienv/mahara
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     global $USER;
     if ($editing) {
         $smarty = smarty_core();
         $smarty->assign('editing', get_string('ineditordescription1', 'blocktype.comment/comment'));
         $html = $smarty->fetch('blocktype:comment:comment.tpl');
         return $html;
     }
     // Feedback list pagination requires limit/offset params
     $limit = param_integer('limit', 10);
     $offset = param_integer('offset', 0);
     $showcomment = param_integer('showcomment', null);
     // Create the "make feedback private form" now if it's been submitted
     if (param_variable('make_public_submit', null)) {
         pieform(ArtefactTypeComment::make_public_form(param_integer('comment')));
     } else {
         if (param_variable('delete_comment_submit_x', null)) {
             pieform(ArtefactTypeComment::delete_comment_form(param_integer('comment')));
         }
     }
     $view = new View($instance->get('view'));
     $submittedgroup = (int) $view->get('submittedgroup');
     if ($USER->is_logged_in() && $submittedgroup && group_user_can_assess_submitted_views($submittedgroup, $USER->get('id'))) {
         $releaseform = true;
     } else {
         $releaseform = false;
     }
     // If the view has comments turned off, tutors can still leave
     // comments if the view is submitted to their group.
     if (!empty($releaseform) || $view->user_comments_allowed($USER)) {
         $addfeedbackpopup = true;
     }
     safe_require('artefact', 'comment');
     $commentoptions = ArtefactTypeComment::get_comment_options();
     $commentoptions->limit = $limit;
     $commentoptions->offset = $offset;
     $commentoptions->showcomment = $showcomment;
     $commentoptions->view = $instance->get_view();
     $feedback = ArtefactTypeComment::get_comments($commentoptions);
     $smarty = smarty_core();
     $smarty->assign('feedback', $feedback);
     if (isset($addfeedbackpopup)) {
         $smarty->assign('enablecomments', 1);
         $smarty->assign('addfeedbackpopup', $addfeedbackpopup);
     }
     $html = $smarty->fetch('blocktype:comment:comment.tpl');
     return $html;
 }
コード例 #2
0
ファイル: view.php プロジェクト: agwells/Mahara-1
    // the saving of the atime change. Can't use $view->set('dirty', true)
    // as that will also get the view object to update the mtime which is not
    // what we want.
    $view->set('atime', time() - 1);
    $view->commit();
}
// Feedback list pagination requires limit/offset params
$limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
$showcomment = param_integer('showcomment', null);
// Create the "make feedback private form" now if it's been submitted
if (param_variable('make_public_submit', null)) {
    pieform(ArtefactTypeComment::make_public_form(param_integer('comment')));
} else {
    if (param_variable('delete_comment_submit_x', null)) {
        pieform(ArtefactTypeComment::delete_comment_form(param_integer('comment')));
    }
}
$owner = $view->get('owner');
$viewtype = $view->get('type');
if ($viewtype == 'profile' || $viewtype == 'dashboard' || $viewtype == 'grouphomepage') {
    redirect($view->get_url());
}
define('TITLE', $view->get('title'));
$collection = $view->get('collection');
$submittedgroup = (int) $view->get('submittedgroup');
if ($USER->is_logged_in() && $submittedgroup && group_user_can_assess_submitted_views($submittedgroup, $USER->get('id'))) {
    // The user is a tutor of the group that this view has
    // been submitted to, and is entitled to release the view
    $submittedgroup = get_record('group', 'id', $submittedgroup);
    // If the view is part of a submitted collection, the whole