本文整理汇总了PHP中ArtefactTypeComment::last_public_comment方法的典型用法代码示例。如果您正苦于以下问题:PHP ArtefactTypeComment::last_public_comment方法的具体用法?PHP ArtefactTypeComment::last_public_comment怎么用?PHP ArtefactTypeComment::last_public_comment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArtefactTypeComment
的用法示例。
在下文中一共展示了ArtefactTypeComment::last_public_comment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ArtefactTypeComment
$comment = new ArtefactTypeComment($id);
if ($USER->get('id') != $comment->get('author')) {
throw new AccessDeniedException(get_string('canteditnotauthor', 'artefact.comment'));
}
$onview = $comment->get('onview');
if ($onview && $onview != $viewid) {
throw new NotFoundException(get_string('commentnotinview', 'artefact.comment', $id, $viewid));
}
$maxage = (int) get_config_plugin('artefact', 'comment', 'commenteditabletime');
$editableafter = time() - 60 * $maxage;
$goto = $comment->get_view_url($viewid, false);
if ($comment->get('ctime') < $editableafter) {
$SESSION->add_error_msg(get_string('cantedittooold', 'artefact.comment', $maxage));
redirect($goto);
}
$lastcomment = ArtefactTypeComment::last_public_comment($viewid, $comment->get('onartefact'));
if (!$comment->get('private') && $id != $lastcomment->id) {
$SESSION->add_error_msg(get_string('cantedithasreplies', 'artefact.comment'));
redirect($goto);
}
$elements = array();
$elements['message'] = array('type' => 'wysiwyg', 'title' => get_string('message'), 'rows' => 5, 'cols' => 80, 'defaultvalue' => $comment->get('description'), 'rules' => array('maxlength' => 8192));
if (get_config_plugin('artefact', 'comment', 'commentratings')) {
$elements['rating'] = array('type' => 'radio', 'title' => get_string('rating', 'artefact.comment'), 'options' => array('1' => '', '2' => '', '3' => '', '4' => '', '5' => ''), 'class' => 'star', 'defaultvalue' => $comment->get('rating'));
} else {
$elements['rating'] = array('type' => 'hidden', 'value' => $comment->get('rating'));
}
$elements['ispublic'] = array('type' => 'checkbox', 'title' => get_string('makepublic', 'artefact.comment'), 'defaultvalue' => !$comment->get('private'));
if (get_config('licensemetadata')) {
$elements['license'] = license_form_el_basic($comment);
$elements['licensing_advanced'] = license_form_el_advanced($comment);