当前位置: 首页>>代码示例>>PHP>>正文


PHP ArtefactTypeComment::get_comments方法代码示例

本文整理汇总了PHP中ArtefactTypeComment::get_comments方法的典型用法代码示例。如果您正苦于以下问题:PHP ArtefactTypeComment::get_comments方法的具体用法?PHP ArtefactTypeComment::get_comments怎么用?PHP ArtefactTypeComment::get_comments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArtefactTypeComment的用法示例。


在下文中一共展示了ArtefactTypeComment::get_comments方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render_instance

 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;
 }
开发者ID:kienv,项目名称:mahara,代码行数:49,代码来源:lib.php

示例2: isset

    $moderate = isset($commenttype) && $commenttype === 'private';
    $addfeedbackform = pieform(ArtefactTypeComment::add_comment_form($defaultprivate, $moderate));
}
if ($USER->is_logged_in()) {
    $objectionform = pieform(objection_form());
    if ($notrudeform = notrude_form()) {
        $notrudeform = pieform($notrudeform);
    }
}
$viewbeingwatched = (int) record_exists('usr_watchlist_view', 'usr', $USER->get('id'), 'view', $viewid);
$commentoptions = ArtefactTypeComment::get_comment_options();
$commentoptions->limit = $limit;
$commentoptions->offset = $offset;
$commentoptions->showcomment = $showcomment;
$commentoptions->view = $view;
$feedback = ArtefactTypeComment::get_comments($commentoptions);
// Set up theme
$viewtheme = $view->get('theme');
if ($viewtheme && $THEME->basename != $viewtheme) {
    $THEME = new Theme($viewtheme);
}
$headers = array();
$headers[] = '<link rel="stylesheet" type="text/css" href="' . append_version_number(get_config('wwwroot') . 'js/jquery/jquery-ui/css/ui-lightness/jquery-ui-1.10.2.min.css') . '">';
$headers = array_merge($headers, $view->get_all_blocktype_css());
// Set up skin, if the page has one
$viewskin = $view->get('skin');
$issiteview = $view->get('institution') == 'mahara';
if ($viewskin && get_config('skins') && can_use_skins($owner, false, $issiteview) && (!isset($THEME->skins) || $THEME->skins !== false)) {
    $skin = array('skinid' => $viewskin, 'viewid' => $view->get('id'));
    $skindata = unserialize(get_field('skin', 'viewskin', 'id', $viewskin));
} else {
开发者ID:agwells,项目名称:Mahara-1,代码行数:31,代码来源:view.php

示例3: add_feedback_form_submit

function add_feedback_form_submit(Pieform $form, $values)
{
    global $view, $artefact, $USER;
    $data = (object) array('title' => get_string('Comment', 'artefact.comment'), 'description' => $values['message']);
    if ($artefact) {
        $data->onartefact = $artefact->get('id');
        $data->owner = $artefact->get('owner');
        $data->group = $artefact->get('group');
        $data->institution = $artefact->get('institution');
    } else {
        $data->onview = $view->get('id');
        $data->owner = $view->get('owner');
        $data->group = $view->get('group');
        $data->institution = $view->get('institution');
    }
    if ($author = $USER->get('id')) {
        $anonymous = false;
        $data->author = $author;
    } else {
        $anonymous = true;
        $data->authorname = $values['authorname'];
    }
    if (isset($values['moderate']) && $values['ispublic'] && !$USER->can_edit_view($view)) {
        $data->private = 1;
        $data->requestpublic = 'author';
        $moderated = true;
    } else {
        $data->private = (int) (!$values['ispublic']);
        $moderated = false;
    }
    $private = $data->private;
    if (get_config('licensemetadata')) {
        $data->license = $values['license'];
        $data->licensor = $values['licensor'];
        $data->licensorurl = $values['licensorurl'];
    }
    if (isset($values['rating'])) {
        $data->rating = valid_rating($values['rating']);
    }
    $comment = new ArtefactTypeComment(0, $data);
    db_begin();
    $comment->commit();
    $url = $comment->get_view_url($view->get('id'), true, false);
    $goto = get_config('wwwroot') . $url;
    if (isset($data->requestpublic) && $data->requestpublic === 'author' && $data->owner) {
        $arg = $author ? display_name($USER, null, true) : $data->authorname;
        $moderatemsg = (object) array('subject' => false, 'message' => false, 'strings' => (object) array('subject' => (object) array('key' => 'makepublicrequestsubject', 'section' => 'artefact.comment', 'args' => array()), 'message' => (object) array('key' => 'makepublicrequestbyauthormessage', 'section' => 'artefact.comment', 'args' => array(hsc($arg))), 'urltext' => (object) array('key' => 'Comment', 'section' => 'artefact.comment')), 'users' => array($data->owner), 'url' => $url);
    }
    if (!empty($values['attachments']) && is_array($values['attachments']) && !empty($data->author)) {
        require_once get_config('libroot') . 'uploadmanager.php';
        safe_require('artefact', 'file');
        $ownerlang = empty($data->owner) ? get_config('lang') : get_user_language($data->owner);
        $folderid = ArtefactTypeFolder::get_folder_id(get_string_from_language($ownerlang, 'feedbackattachdirname', 'artefact.comment'), get_string_from_language($ownerlang, 'feedbackattachdirdesc', 'artefact.comment'), null, true, $data->owner, $data->group, $data->institution);
        $attachment = (object) array('owner' => $data->owner, 'group' => $data->group, 'institution' => $data->institution, 'author' => $data->author, 'allowcomments' => 0, 'parent' => $folderid, 'description' => get_string_from_language($ownerlang, 'feedbackonviewbyuser', 'artefact.comment', $view->get('title'), display_name($USER)));
        foreach ($values['attachments'] as $filesindex) {
            $originalname = $_FILES[$filesindex]['name'];
            $attachment->title = ArtefactTypeFileBase::get_new_file_title($originalname, $folderid, $data->owner, $data->group, $data->institution);
            try {
                $fileid = ArtefactTypeFile::save_uploaded_file($filesindex, $attachment);
            } catch (QuotaExceededException $e) {
                if ($data->owner == $USER->get('id')) {
                    $form->reply(PIEFORM_ERR, array('message' => $e->getMessage()));
                }
                redirect($goto);
            } catch (UploadException $e) {
                $form->reply(PIEFORM_ERR, array('message' => $e->getMessage()));
                redirect($goto);
            }
            $comment->attach($fileid);
        }
    }
    require_once 'activity.php';
    $data = (object) array('commentid' => $comment->get('id'), 'viewid' => $view->get('id'));
    activity_occurred('feedback', $data, 'artefact', 'comment');
    if (isset($moderatemsg)) {
        activity_occurred('maharamessage', $moderatemsg);
    }
    db_commit();
    $newlist = ArtefactTypeComment::get_comments(10, 0, 'last', $view, $artefact);
    // If you're anonymous and your message is moderated or private, then you won't
    // be able to tell what happened to it. So we'll provide some more explanation in
    // the feedback message.
    if ($anonymous && $moderated) {
        $message = get_string('feedbacksubmittedmoderatedanon', 'artefact.comment');
    } else {
        if ($anonymous && $private) {
            $message = get_string('feedbacksubmittedprivateanon', 'artefact.comment');
        } else {
            $message = get_string('feedbacksubmitted', 'artefact.comment');
        }
    }
    $form->reply(PIEFORM_OK, array('message' => $message, 'goto' => $goto, 'data' => $newlist));
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:93,代码来源:lib.php

示例4: array

$content .= $rendered['html'];
// Build the path to the artefact, through its parents
$artefactpath = array();
$parent = $artefact->get('parent');
while ($parent !== null) {
    // This loop could get expensive when there are a lot of parents. But at least
    // it works, unlike the old attempt
    $parentobj = artefact_instance_from_id($parent);
    if (artefact_in_view($parent, $viewid)) {
        array_unshift($artefactpath, array('url' => get_config('wwwroot') . 'view/artefact.php?artefact=' . $parent . '&view=' . $viewid, 'title' => $parentobj->display_title()));
    }
    $parent = $parentobj->get('parent');
}
$artefactpath[] = array('url' => '', 'title' => $artefact->display_title());
// Feedback
$feedback = ArtefactTypeComment::get_comments($limit, $offset, $showcomment, $view, $artefact);
$javascript = <<<EOF
var viewid = {$viewid};
addLoadEvent(function () {
    paginator = {$feedback->pagination_js}
});
EOF;
if ($artefact->get('allowcomments')) {
    $anonfeedback = !$USER->is_logged_in() && view_has_token($viewid, get_cookie('viewaccess:' . $viewid));
    $addfeedbackform = pieform(ArtefactTypeComment::add_comment_form(false, $artefact->get('approvecomments')));
}
$objectionform = pieform(objection_form());
if ($notrudeform = $view->notrude_form()) {
    $notrudeform = pieform($notrudeform);
}
$viewbeingwatched = (int) record_exists('usr_watchlist_view', 'usr', $USER->get('id'), 'view', $viewid);
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:31,代码来源:artefact.php

示例5: dump_view_export_data

 /**
  * Dumps all views into the HTML export
  */
 private function dump_view_export_data()
 {
     safe_require('artefact', 'comment');
     $progressstart = 55;
     $progressend = 75;
     $i = 0;
     $viewcount = count($this->views);
     $rootpath = $this->exportingoneview ? './' : '../../';
     $smarty = $this->get_smarty($rootpath);
     foreach ($this->views as $viewid => $view) {
         $this->notify_progress_callback(intval($progressstart + ++$i / $viewcount * ($progressend - $progressstart)), get_string('exportingviewsprogress', 'export', $i, $viewcount));
         $smarty->assign('page_heading', $view->get('title'));
         $smarty->assign('viewdescription', $view->get('description'));
         if ($this->exportingoneview) {
             $smarty->assign('nobreadcrumbs', true);
             $directory = $this->exportdir . '/' . $this->rootdir;
         } else {
             $smarty->assign('breadcrumbs', array(array('text' => get_string('Views', 'view')), array('text' => $view->get('title'), 'path' => 'index.html')));
             $directory = $this->exportdir . '/' . $this->rootdir . '/views/' . self::text_to_filename($view->get('title'));
             if (is_dir($directory)) {
                 throw new SystemException(get_string('duplicatepagetitle', 'export.html'));
             }
             if (!check_dir_exists($directory)) {
                 throw new SystemException("Could not create directory for view {$viewid}");
             }
         }
         // Collection menu data
         if (isset($this->viewcollection[$viewid]) && $this->viewexportmode == PluginExport::EXPORT_COLLECTIONS) {
             $smarty->assign_by_ref('collectionname', $this->collections[$this->viewcollection[$viewid]]->get('name'));
             $smarty->assign_by_ref('collectionmenu', $this->collection_menu($this->viewcollection[$viewid]));
             $smarty->assign('viewid', $viewid);
         }
         $outputfilter = new HtmlExportOutputFilter($rootpath, $this);
         // Include comments
         if ($this->includefeedback) {
             $commentoptions = ArtefactTypeComment::get_comment_options();
             $commentoptions->view = $view;
             $commentoptions->limit = 0;
             $commentoptions->export = true;
             if ($feedback = ArtefactTypeComment::get_comments($commentoptions)) {
                 $feedback->tablerows = $outputfilter->filter($feedback->tablerows);
             }
             $smarty->assign('feedback', $feedback);
         }
         $smarty->assign('view', $outputfilter->filter($view->build_rows(false, true)));
         $content = $smarty->fetch('export:html:view.tpl');
         if (!file_put_contents("{$directory}/index.html", $content)) {
             throw new SystemException("Could not write view page for view {$viewid}");
         }
     }
 }
开发者ID:rboyatt,项目名称:mahara,代码行数:54,代码来源:lib.php

示例6: get_artefact_comments_for_view

 /**
  * Fetching the comments for an artefact to display on a view
  *
  * @param   ArtefactType  $artfact  The artefact to display comments for
  * @param   object  $view     The view on which the artefact appears
  * @param   int     $blockid  The id of the block instance that connects the artefact to the view
  * @param   bool    $html     Whether to return the information rendered as html or not
  * @param   bool    $editing  Whether we are view edit mode or not
  *
  * @return  array   $commentcount, $comments   The count of comments and either the comments
  *                                             or the html to render them.
  */
 public function get_artefact_comments_for_view(ArtefactType $artefact, $view, $blockid, $html = true, $editing = false)
 {
     global $USER;
     if (!is_object($artefact) || !is_object($view)) {
         throw new MaharaException('we do not have the right information to display the comments');
     }
     $commentoptions = ArtefactTypeComment::get_comment_options();
     $commentoptions->limit = 0;
     $commentoptions->view = $view;
     $commentoptions->artefact = $artefact;
     $commentoptions->onview = true;
     $comments = ArtefactTypeComment::get_comments($commentoptions);
     $commentcount = isset($comments->count) ? $comments->count : 0;
     // If there are no comments, and comments are not allowed, don't display anything.
     if ($commentcount == 0 && !$artefact->get('allowcomments')) {
         return array(0, '');
     }
     $artefacttitle = $artefact->title;
     $artefacturl = get_config('wwwroot') . 'artefact/artefact.php?view=' . $view->get('id') . '&artefact=' . $artefact->get('id');
     if ($html) {
         $smarty = smarty_core();
         $smarty->assign('artefacturl', $artefacturl);
         $smarty->assign('artefacttitle', $artefacttitle);
         $smarty->assign('blockid', $blockid);
         $smarty->assign('commentcount', $commentcount);
         $smarty->assign('comments', $comments);
         $smarty->assign('editing', $editing);
         $smarty->assign('allowcomments', $artefact->get('allowcomments'));
         $smarty->assign('allowcommentsadd', $artefact->get('allowcomments') && ($USER->is_logged_in() || !$USER->is_logged_in() && get_config('anonymouscomments')));
         $render = $smarty->fetch('artefact/artefactcommentsview.tpl');
         return array($commentcount, $render);
     } else {
         return array($commentcount, $comments);
     }
 }
开发者ID:kienv,项目名称:mahara,代码行数:47,代码来源:lib.php

示例7: define

/**
 *
 * @package    mahara
 * @subpackage artefact-comment
 * @author     Catalyst IT Ltd
 * @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.
 *
 */
define('INTERNAL', 1);
define('PUBLIC', 1);
define('JSON', 1);
require dirname(dirname(dirname(__FILE__))) . '/init.php';
require_once get_config('libroot') . 'view.php';
require_once get_config('libroot') . 'pieforms/pieform.php';
safe_require('artefact', 'comment');
$extradata = json_decode(param_variable('extradata'));
if (!can_view_view($extradata->view)) {
    json_reply('local', get_string('noaccesstoview', 'view'));
}
if (!empty($extradata->artefact) && !artefact_in_view($extradata->artefact, $extradata->view)) {
    json_reply('local', get_string('accessdenied', 'error'));
}
$limit = param_integer('limit', 10);
$offset = param_integer('offset');
if (!empty($extradata->artefact)) {
    $artefact = artefact_instance_from_id($extradata->artefact);
}
$view = new View($extradata->view);
$data = ArtefactTypeComment::get_comments($limit, $offset, null, $view, $artefact);
json_reply(false, array('data' => $data));
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:comments.json.php

示例8: sorttablebycolumn

    $data['ecommenters'] = $extcommenters;
    $data['mcomments'] = $membercomments;
    $data['ecomments'] = $extcomments;
    $data['comments'] = $commenters;
    $data['baseurl'] = $needsubdomain ? $view->get_url(true) : $wwwroot . $view->get_url(false);
}
if (in_array($sort, array('title', 'sharedby', 'mcomments', 'ecomments'))) {
    sorttablebycolumn($sharedviews, $sort, $direction);
}
$sharedviews = array_slice($sharedviews, $offset, $limit);
list($searchform, $groupviews, $unusedpagination) = View::views_by_owner($group->id);
$groupviews = $groupviews->data;
$groupviewscount = count($groupviews);
foreach ($groupviews as &$data) {
    $view = new View($data['id']);
    $comments = ArtefactTypeComment::get_comments(0, 0, null, $view);
    $extcommenters = 0;
    $membercommenters = 0;
    $extcomments = 0;
    $membercomments = 0;
    $commenters = array();
    foreach ($comments->data as $c) {
        if (empty($c->author)) {
            if (!isset($commenters[$c->authorname])) {
                $commenters[$c->authorname] = array();
            }
            $commenters[$c->authorname]['commenter'] = $c->authorname;
            $commenters[$c->authorname]['count'] = isset($commenters[$c->authorname]['count']) ? $commenters[$c->authorname]['count'] + 1 : 1;
            if ($commenters[$c->authorname]['count'] == 1) {
                $extcommenters++;
            }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:report.php

示例9: define

 * @copyright  For copyright information on Mahara, please see the README file distributed with this software.
 *
 */
define('INTERNAL', 1);
define('PUBLIC', 1);
define('JSON', 1);
require dirname(dirname(dirname(__FILE__))) . '/init.php';
require_once get_config('libroot') . 'view.php';
require_once get_config('libroot') . 'pieforms/pieform.php';
safe_require('artefact', 'comment');
$extradata = json_decode(param_variable('extradata'));
if (!can_view_view($extradata->view)) {
    json_reply('local', get_string('noaccesstoview', 'view'));
}
if (!empty($extradata->artefact) && !artefact_in_view($extradata->artefact, $extradata->view)) {
    json_reply('local', get_string('accessdenied', 'error'));
}
$limit = param_integer('limit', 10);
$offset = param_integer('offset');
$artefact = null;
if (!empty($extradata->artefact)) {
    $artefact = artefact_instance_from_id($extradata->artefact);
}
$view = new View($extradata->view);
$commentoptions = ArtefactTypeComment::get_comment_options();
$commentoptions->limit = $limit;
$commentoptions->offset = $offset;
$commentoptions->view = $view;
$commentoptions->artefact = $artefact;
$data = ArtefactTypeComment::get_comments($commentoptions);
json_reply(false, array('data' => $data));
开发者ID:rboyatt,项目名称:mahara,代码行数:31,代码来源:comments.json.php


注:本文中的ArtefactTypeComment::get_comments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。