本文整理汇总了PHP中comment::set_view_permission方法的典型用法代码示例。如果您正苦于以下问题:PHP comment::set_view_permission方法的具体用法?PHP comment::set_view_permission怎么用?PHP comment::set_view_permission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comment
的用法示例。
在下文中一共展示了comment::set_view_permission方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: list
function get_content()
{
global $CFG, $PAGE;
if (!$CFG->usecomments) {
$this->content->text = '';
if ($this->page->user_is_editing()) {
$this->content->text = get_string('disabledcomments');
}
return $this->content;
}
if ($this->content !== NULL) {
return $this->content;
}
if (empty($this->instance)) {
return null;
}
$this->content->footer = '';
$this->content->text = '';
list($context, $course, $cm) = get_context_info_array($PAGE->context->id);
$args = new stdClass();
$args->context = $PAGE->context;
$args->course = $course;
$args->area = 'page_comments';
$args->itemid = 0;
// set 'env' to tell moodle tweak ui for this block
$args->env = 'block_comments';
$args->component = 'block_comments';
$args->linktext = get_string('showcomments');
$comment = new comment($args);
$comment->set_view_permission(true);
$this->content = new stdClass();
$this->content->text = $comment->output(true);
$this->content->footer = '';
return $this->content;
}
示例2: displayComments
public function displayComments($resource_id, $instance)
{
//instance ce u stvari biti ovo gde dodamo (add_instance), na stranici kursa
//Mozda prvo da se izlistaju svi resursi pa da se omoguce komentari
comment::init();
$options = new stdClass();
$options->area = 'resource_comments';
$options->course = $course;
$options->context = $context;
$options->itemid = $itemid;
$options->component = 'component_1';
$options->showcount = true;
$options->displaycancel = true;
$comment = new comment($options);
$comment->set_view_permission(true);
}
示例3: stdClass
function get_content()
{
global $CFG, $PAGE;
if ($this->content !== NULL) {
return $this->content;
}
if (!$CFG->usecomments) {
$this->content = new stdClass();
$this->content->text = '';
if ($this->page->user_is_editing()) {
$this->content->text = get_string('disabledcomments');
}
return $this->content;
}
$this->content = new stdClass();
$this->content->footer = '';
$this->content->text = '';
if (empty($this->instance)) {
return $this->content;
}
list($context, $course, $cm) = get_context_info_array($PAGE->context->id);
$args = new stdClass();
$args->context = $PAGE->context;
$args->course = $course;
$args->area = 'page_comments';
$args->itemid = 0;
$args->component = 'block_comments';
$args->linktext = get_string('showcomments');
$args->notoggle = true;
$args->autostart = true;
$args->displaycancel = false;
$comment = new comment($args);
$comment->set_view_permission(true);
$comment->set_fullwidth();
$this->content = new stdClass();
$this->content->text = $comment->output(true);
$this->content->footer = '';
return $this->content;
}
示例4: upgrade
/**
* Upgrade the submission from the old assignment to the new one
*
* @param context $oldcontext The context for the old assignment
* @param stdClass $oldassignment The data record for the old assignment
* @param stdClass $oldsubmission The data record for the old submission
* @param stdClass $submission The new submission record
* @param string $log Record upgrade messages in the log
* @return bool true or false - false will trigger a rollback
*/
public function upgrade(context $oldcontext, stdClass $oldassignment, stdClass $oldsubmission, stdClass $submission, &$log)
{
if ($oldsubmission->data1 != '') {
// need to used this innit() otherwise it shows up undefined !
// require js for commenting
comment::init();
$options = new stdClass();
$options->area = 'submission_comments_upgrade';
$options->course = $this->assignment->get_course();
$options->context = $this->assignment->get_context();
$options->itemid = $submission->id;
$options->component = 'assignsubmission_comments';
$options->showcount = true;
$options->displaycancel = true;
$comment = new comment($options);
$comment->add($oldsubmission->data1);
$comment->set_view_permission(true);
return $comment->output(true);
}
return true;
}
示例5: upgrade
/**
* Upgrade the submission from the old setaskment to the new one
*
* @param context $oldcontext The context for the old setaskment
* @param stdClass $oldsetaskment The data record for the old setaskment
* @param stdClass $oldsubmission The data record for the old submission
* @param stdClass $submission The new submission record
* @param string $log Record upgrade messages in the log
* @return bool true or false - false will trigger a rollback
*/
public function upgrade(context $oldcontext, stdClass $oldsetaskment, stdClass $oldsubmission, stdClass $submission, &$log)
{
if ($oldsubmission->data1 != '') {
// Need to used this init() otherwise it does not have the javascript includes.
comment::init();
$options = new stdClass();
$options->area = 'submission_comments_upgrade';
$options->course = $this->setaskment->get_course();
$options->context = $this->setaskment->get_context();
$options->itemid = $submission->id;
$options->component = 'setasksubmission_comments';
$options->showcount = true;
$options->displaycancel = true;
$comment = new comment($options);
$comment->add($oldsubmission->data1);
$comment->set_view_permission(true);
return $comment->output(true);
}
return true;
}