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


PHP comment::output方法代码示例

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


在下文中一共展示了comment::output方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:35,代码来源:block_comments.php

示例2: 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;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:39,代码来源:block_comments.php

示例3: print_html

 /**
  * Prints or returns the HTML for this blog entry.
  *
  * @param bool $return
  * @return string
  */
 public function print_html($return = false)
 {
     global $USER, $CFG, $COURSE, $DB, $OUTPUT, $PAGE;
     $user = $DB->get_record('user', array('id' => $this->userid));
     $cmttext = '';
     if (!empty($CFG->usecomments) and $CFG->blogusecomments) {
         require_once $CFG->dirroot . '/comment/lib.php';
         // Comments
         $cmt = new stdClass();
         $cmt->context = get_context_instance(CONTEXT_USER, $user->id);
         $cmt->courseid = $PAGE->course->id;
         $cmt->area = 'format_blog';
         $cmt->itemid = $this->id;
         $cmt->showcount = $CFG->blogshowcommentscount;
         $cmt->component = 'blog';
         $comment = new comment($cmt);
         $cmttext = $comment->output(true);
     }
     $this->summary = file_rewrite_pluginfile_urls($this->summary, 'pluginfile.php', SYSCONTEXTID, 'blog', 'post', $this->id);
     $options = array('overflowdiv' => true);
     $template['body'] = format_text($this->summary, $this->summaryformat, $options) . $cmttext;
     $template['title'] = format_string($this->subject);
     $template['userid'] = $user->id;
     $template['author'] = fullname($user);
     $template['created'] = userdate($this->created);
     if ($this->created != $this->lastmodified) {
         $template['lastmod'] = userdate($this->lastmodified);
     }
     $template['publishstate'] = $this->publishstate;
     $stredit = get_string('edit');
     $strdelete = get_string('delete');
     // Check to see if the entry is unassociated with group/course level access
     $unassociatedentry = false;
     if (!empty($CFG->useblogassociations) && ($this->publishstate == 'group' || $this->publishstate == 'course')) {
         if (!$DB->record_exists('blog_association', array('blogid' => $this->id))) {
             $unassociatedentry = true;
         }
     }
     // Start printing of the blog
     $table = new html_table();
     $table->cellspacing = 0;
     $table->attributes['class'] = 'forumpost blog_entry blog' . ($unassociatedentry ? 'draft' : $template['publishstate']);
     $table->attributes['id'] = 'b' . $this->id;
     $table->width = '100%';
     $picturecell = new html_table_cell();
     $picturecell->attributes['class'] = 'picture left';
     $picturecell->text = $OUTPUT->user_picture($user);
     $table->head[] = $picturecell;
     $topiccell = new html_table_cell();
     $topiccell->attributes['class'] = 'topic starter';
     $titlelink = html_writer::link(new moodle_url('/blog/index.php', array('entryid' => $this->id)), $template['title']);
     $topiccell->text = $OUTPUT->container($titlelink, 'subject');
     $topiccell->text .= $OUTPUT->container_start('author');
     $fullname = fullname($user, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $PAGE->course->id)));
     $by = new stdClass();
     $by->name = html_writer::link(new moodle_url('/user/view.php', array('id' => $user->id, 'course' => $PAGE->course->id)), $fullname);
     $by->date = $template['created'];
     $topiccell->text .= get_string('bynameondate', 'forum', $by);
     $topiccell->text .= $OUTPUT->container_end();
     if ($this->uniquehash && $this->content) {
         if ($externalblog = $DB->get_record('blog_external', array('id' => $this->content))) {
             $urlparts = parse_url($externalblog->url);
             $topiccell->text .= $OUTPUT->container(get_string('retrievedfrom', 'blog') . get_string('labelsep', 'langconfig') . html_writer::link($urlparts['scheme'] . '://' . $urlparts['host'], $externalblog->name), 'externalblog');
         }
     }
     $topiccell->header = false;
     $table->head[] = $topiccell;
     // Actual content
     $mainrow = new html_table_row();
     $leftsidecell = new html_table_cell();
     $leftsidecell->attributes['class'] = 'left side';
     $mainrow->cells[] = $leftsidecell;
     $contentcell = new html_table_cell();
     $contentcell->attributes['class'] = 'content';
     $attachedimages = $OUTPUT->container($this->print_attachments(), 'attachments');
     // retrieve associations in case they're needed early
     $blogassociations = $DB->get_records('blog_association', array('blogid' => $this->id));
     // determine text for publish state
     switch ($template['publishstate']) {
         case 'draft':
             $blogtype = get_string('publishtonoone', 'blog');
             break;
         case 'site':
             $blogtype = get_string('publishtosite', 'blog');
             break;
         case 'public':
             $blogtype = get_string('publishtoworld', 'blog');
             break;
         default:
             $blogtype = '';
             break;
     }
     $contentcell->text .= $OUTPUT->container($blogtype, 'audience');
     $contentcell->text .= $template['body'];
//.........这里部分代码省略.........
开发者ID:nfreear,项目名称:moodle,代码行数:101,代码来源:locallib.php

示例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;
 }
开发者ID:rama1712,项目名称:moodle,代码行数:31,代码来源:locallib.php

示例5: data_print_template


//.........这里部分代码省略.........
            $moreurl .= '&filter=1';
        }
        $patterns[]='##more##';
        $replacement[] = '<a href="' . $moreurl . '"><img src="' . $OUTPUT->pix_url('i/search') . '" class="iconsmall" alt="' . get_string('more', 'data') . '" title="' . get_string('more', 'data') . '" /></a>';

        $patterns[]='##moreurl##';
        $replacement[] = $moreurl;

        $patterns[]='##user##';
        $replacement[] = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$record->userid.
                               '&amp;course='.$data->course.'">'.fullname($record).'</a>';

        $patterns[]='##export##';

        if (!empty($CFG->enableportfolios) && ($template == 'singletemplate' || $template == 'listtemplate')
            && ((has_capability('mod/data:exportentry', $context)
                || (data_isowner($record->id) && has_capability('mod/data:exportownentry', $context))))) {
            require_once($CFG->libdir . '/portfoliolib.php');
            $button = new portfolio_add_button();
            $button->set_callback_options('data_portfolio_caller', array('id' => $cm->id, 'recordid' => $record->id), '/mod/data/locallib.php');
            list($formats, $files) = data_portfolio_caller::formats($fields, $record);
            $button->set_formats($formats);
            $replacement[] = $button->to_html(PORTFOLIO_ADD_ICON_LINK);
        } else {
            $replacement[] = '';
        }

        $patterns[] = '##timeadded##';
        $replacement[] = userdate($record->timecreated);

        $patterns[] = '##timemodified##';
        $replacement [] = userdate($record->timemodified);

        $patterns[]='##approve##';
        if (has_capability('mod/data:approve', $context) && ($data->approval) && (!$record->approved)){
            $replacement[] = '<span class="approve"><a href="'.$CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&amp;approve='.$record->id.'&amp;sesskey='.sesskey().'"><img src="'.$OUTPUT->pix_url('i/approve') . '" class="icon" alt="'.get_string('approve').'" /></a></span>';
        } else {
            $replacement[] = '';
        }

        $patterns[]='##comments##';
        if (($template == 'listtemplate') && ($data->comments)) {

            if (!empty($CFG->usecomments)) {
                require_once($CFG->dirroot  . '/comment/lib.php');
                list($context, $course, $cm) = get_context_info_array($context->id);
                $cmt = new stdClass();
                $cmt->context = $context;
                $cmt->course  = $course;
                $cmt->cm      = $cm;
                $cmt->area    = 'database_entry';
                $cmt->itemid  = $record->id;
                $cmt->showcount = true;
                $cmt->component = 'mod_data';
                $comment = new comment($cmt);
                $replacement[] = $comment->output(true);
            }
        } else {
            $replacement[] = '';
        }

        // actual replacement of the tags
        $newtext = str_ireplace($patterns, $replacement, $data->{$template});

        // no more html formatting and filtering - see MDL-6635
        if ($return) {
            return $newtext;
        } else {
            echo $newtext;

            // hack alert - return is always false in singletemplate anyway ;-)
            /**********************************
             *    Printing Ratings Form       *
             *********************************/
            if ($template == 'singletemplate') {    //prints ratings options
                data_print_ratings($data, $record);
            }

            /**********************************
             *    Printing Comments Form       *
             *********************************/
            if (($template == 'singletemplate') && ($data->comments)) {
                if (!empty($CFG->usecomments)) {
                    require_once($CFG->dirroot . '/comment/lib.php');
                    list($context, $course, $cm) = get_context_info_array($context->id);
                    $cmt = new stdClass();
                    $cmt->context = $context;
                    $cmt->course  = $course;
                    $cmt->cm      = $cm;
                    $cmt->area    = 'database_entry';
                    $cmt->itemid  = $record->id;
                    $cmt->showcount = true;
                    $cmt->component = 'mod_data';
                    $comment = new comment($cmt);
                    $comment->output(false);
                }
            }
        }
    }
}
开发者ID:nottmoo,项目名称:moodle,代码行数:101,代码来源:lib.php

示例6: data_print_template


//.........这里部分代码省略.........
        $patterns[] = '##moreurl##';
        $replacement[] = $moreurl;
        $patterns[] = '##delcheck##';
        if ($canmanageentries) {
            $replacement[] = html_writer::checkbox('delcheck[]', $record->id, false, '', array('class' => 'recordcheckbox'));
        } else {
            $replacement[] = '';
        }
        $patterns[] = '##user##';
        $replacement[] = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $record->userid . '&amp;course=' . $data->course . '">' . fullname($record) . '</a>';
        $patterns[] = '##userpicture##';
        $ruser = user_picture::unalias($record, null, 'userid');
        $replacement[] = $OUTPUT->user_picture($ruser, array('courseid' => $data->course));
        $patterns[] = '##export##';
        if (!empty($CFG->enableportfolios) && ($template == 'singletemplate' || $template == 'listtemplate') && (has_capability('mod/data:exportentry', $context) || data_isowner($record->id) && has_capability('mod/data:exportownentry', $context))) {
            require_once $CFG->libdir . '/portfoliolib.php';
            $button = new portfolio_add_button();
            $button->set_callback_options('data_portfolio_caller', array('id' => $cm->id, 'recordid' => $record->id), 'mod_data');
            list($formats, $files) = data_portfolio_caller::formats($fields, $record);
            $button->set_formats($formats);
            $replacement[] = $button->to_html(PORTFOLIO_ADD_ICON_LINK);
        } else {
            $replacement[] = '';
        }
        $patterns[] = '##timeadded##';
        $replacement[] = userdate($record->timecreated);
        $patterns[] = '##timemodified##';
        $replacement[] = userdate($record->timemodified);
        $patterns[] = '##approve##';
        if (has_capability('mod/data:approve', $context) && $data->approval && !$record->approved) {
            $approveurl = new moodle_url($jumpurl, array('approve' => $record->id));
            $approveicon = new pix_icon('t/approve', get_string('approve', 'data'), '', array('class' => 'iconsmall'));
            $replacement[] = html_writer::tag('span', $OUTPUT->action_icon($approveurl, $approveicon), array('class' => 'approve'));
        } else {
            $replacement[] = '';
        }
        $patterns[] = '##disapprove##';
        if (has_capability('mod/data:approve', $context) && $data->approval && $record->approved) {
            $disapproveurl = new moodle_url($jumpurl, array('disapprove' => $record->id));
            $disapproveicon = new pix_icon('t/block', get_string('disapprove', 'data'), '', array('class' => 'iconsmall'));
            $replacement[] = html_writer::tag('span', $OUTPUT->action_icon($disapproveurl, $disapproveicon), array('class' => 'disapprove'));
        } else {
            $replacement[] = '';
        }
        $patterns[] = '##comments##';
        if ($template == 'listtemplate' && $data->comments) {
            if (!empty($CFG->usecomments)) {
                require_once $CFG->dirroot . '/comment/lib.php';
                list($context, $course, $cm) = get_context_info_array($context->id);
                $cmt = new stdClass();
                $cmt->context = $context;
                $cmt->course = $course;
                $cmt->cm = $cm;
                $cmt->area = 'database_entry';
                $cmt->itemid = $record->id;
                $cmt->showcount = true;
                $cmt->component = 'mod_data';
                $comment = new comment($cmt);
                $replacement[] = $comment->output(true);
            }
        } else {
            $replacement[] = '';
        }
        // actual replacement of the tags
        $newtext = str_ireplace($patterns, $replacement, $data->{$template});
        // no more html formatting and filtering - see MDL-6635
        if ($return) {
            return $newtext;
        } else {
            echo $newtext;
            // hack alert - return is always false in singletemplate anyway ;-)
            /**********************************
             *    Printing Ratings Form       *
             *********************************/
            if ($template == 'singletemplate') {
                //prints ratings options
                data_print_ratings($data, $record);
            }
            /**********************************
             *    Printing Comments Form       *
             *********************************/
            if ($template == 'singletemplate' && $data->comments) {
                if (!empty($CFG->usecomments)) {
                    require_once $CFG->dirroot . '/comment/lib.php';
                    list($context, $course, $cm) = get_context_info_array($context->id);
                    $cmt = new stdClass();
                    $cmt->context = $context;
                    $cmt->course = $course;
                    $cmt->cm = $cm;
                    $cmt->area = 'database_entry';
                    $cmt->itemid = $record->id;
                    $cmt->showcount = true;
                    $cmt->component = 'mod_data';
                    $comment = new comment($cmt);
                    $comment->output(false);
                }
            }
        }
    }
}
开发者ID:Keneth1212,项目名称:moodle,代码行数:101,代码来源:lib.php

示例7: 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;
 }
开发者ID:krzpassrl,项目名称:SRL_Moodle_db,代码行数:30,代码来源:locallib.php

示例8: glossary_print_entry_icons

/**
 *
 * @global object
 * @global object
 * @global object
 * @param object $course
 * @param object $cm
 * @param object $glossary
 * @param object $entry
 * @param string $mode
 * @param string $hook
 * @param string $type
 * @return string|void
 */
function glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode='',$hook='', $type = 'print') {
    global $USER, $CFG, $DB, $OUTPUT;

    $context = get_context_instance(CONTEXT_MODULE, $cm->id);

    $output = false;   //To decide if we must really return text in "return". Activate when needed only!
    $importedentry = ($entry->sourceglossaryid == $glossary->id);
    $ismainglossary = $glossary->mainglossary;


    $return = '<span class="commands">';
    // Differentiate links for each entry.
    $altsuffix = ': '.strip_tags(format_text($entry->concept));

    if (!$entry->approved) {
        $output = true;
        $return .= get_string('entryishidden','glossary');
    }

    $iscurrentuser = ($entry->userid == $USER->id);

    if (has_capability('mod/glossary:manageentries', $context) or (isloggedin() and has_capability('mod/glossary:write', $context) and $iscurrentuser)) {
        // only teachers can export entries so check it out
        if (has_capability('mod/glossary:export', $context) and !$ismainglossary and !$importedentry) {
            $mainglossary = $DB->get_record('glossary', array('mainglossary'=>1,'course'=>$course->id));
            if ( $mainglossary ) {  // if there is a main glossary defined, allow to export the current entry
                $output = true;
                $return .= ' <a title="'.get_string('exporttomainglossary','glossary') . '" href="exportentry.php?id='.$entry->id.'&amp;prevmode='.$mode.'&amp;hook='.urlencode($hook).'"><img src="'.$OUTPUT->pix_url('export', 'glossary').'" class="iconsmall" alt="'.get_string('exporttomainglossary','glossary').$altsuffix.'" /></a>';
            }
        }

        if ( $entry->sourceglossaryid ) {
            $icon = $OUTPUT->pix_url('minus', 'glossary');   // graphical metaphor (minus) for deleting an imported entry
        } else {
            $icon = $OUTPUT->pix_url('t/delete');
        }

        //Decide if an entry is editable:
        // -It isn't a imported entry (so nobody can edit a imported (from secondary to main) entry)) and
        // -The user is teacher or he is a student with time permissions (edit period or editalways defined).
        $ineditperiod = ((time() - $entry->timecreated <  $CFG->maxeditingtime) || $glossary->editalways);
        if ( !$importedentry and (has_capability('mod/glossary:manageentries', $context) or ($entry->userid == $USER->id and ($ineditperiod and has_capability('mod/glossary:write', $context))))) {
            $output = true;
            $return .= " <a title=\"" . get_string("delete") . "\" href=\"deleteentry.php?id=$cm->id&amp;mode=delete&amp;entry=$entry->id&amp;prevmode=$mode&amp;hook=".urlencode($hook)."\"><img src=\"";
            $return .= $icon;
            $return .= "\" class=\"iconsmall\" alt=\"" . get_string("delete") .$altsuffix."\" /></a> ";

            $return .= " <a title=\"" . get_string("edit") . "\" href=\"edit.php?cmid=$cm->id&amp;id=$entry->id&amp;mode=$mode&amp;hook=".urlencode($hook)."\"><img src=\"" . $OUTPUT->pix_url('t/edit') . "\" class=\"iconsmall\" alt=\"" . get_string("edit") .$altsuffix. "\" /></a>";
        } elseif ( $importedentry ) {
            $return .= " <font size=\"-1\">" . get_string("exportedentry","glossary") . "</font>";
        }
    }
    if (!empty($CFG->enableportfolios) && (has_capability('mod/glossary:exportentry', $context) || ($iscurrentuser && has_capability('mod/glossary:exportownentry', $context)))) {
        require_once($CFG->libdir . '/portfoliolib.php');
        $button = new portfolio_add_button();
        $button->set_callback_options('glossary_entry_portfolio_caller',  array('id' => $cm->id, 'entryid' => $entry->id), '/mod/glossary/locallib.php');

        $filecontext = $context;
        if ($entry->sourceglossaryid == $cm->instance) {
            if ($maincm = get_coursemodule_from_instance('glossary', $entry->glossaryid)) {
                $filecontext = get_context_instance(CONTEXT_MODULE, $maincm->id);
            }
        }
        $fs = get_file_storage();
        if ($files = $fs->get_area_files($filecontext->id, 'mod_glossary', 'attachment', $entry->id, "timemodified", false)) {
            $button->set_formats(PORTFOLIO_FORMAT_RICHHTML);
        } else {
            $button->set_formats(PORTFOLIO_FORMAT_PLAINHTML);
        }

        $return .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
    }
    $return .= "&nbsp;&nbsp;"; // just to make up a little the output in Mozilla ;)

    $return .= '</span>';

    if (!empty($CFG->usecomments) && has_capability('mod/glossary:comment', $context) and $glossary->allowcomments) {
        require_once($CFG->dirroot . '/comment/lib.php');
        $cmt = new stdClass();
        $cmt->component = 'mod_glossary';
        $cmt->context  = $context;
        $cmt->course   = $course;
        $cmt->cm       = $cm;
        $cmt->area     = 'glossary_entry';
        $cmt->itemid   = $entry->id;
        $cmt->showcount = true;
//.........这里部分代码省略.........
开发者ID:rolandovanegas,项目名称:moodle,代码行数:101,代码来源:lib.php

示例9: pcast_display_episode_comments

/**
 * Displays all comments for a single episode
 * @global stdClass $CFG
 * @param object $episode
 * @param object $cm
 * @param object $course
 */
function pcast_display_episode_comments($episode, $cm, $course)
{
    global $CFG;
    $html = '';
    if ($episode->userscancomment) {
        //Get episode comments and display the comment box
        $context = get_context_instance(CONTEXT_MODULE, $cm->id);
        $output = true;
        // Generate comment box using API
        if (!empty($CFG->usecomments)) {
            require_once $CFG->dirroot . '/comment/lib.php';
            $cmt = new stdClass();
            $cmt->component = 'pcast';
            $cmt->context = $context;
            $cmt->course = $course;
            $cmt->cm = $cm;
            $cmt->area = 'pcast_episode';
            $cmt->itemid = $episode->id;
            $cmt->showcount = true;
            $comment = new comment($cmt);
            $html = html_writer::tag('div', $comment->output(true), array('class' => 'pcast-comments'));
        }
    }
    echo $html;
}
开发者ID:rtsfc,项目名称:moodle-mod_pcast,代码行数:32,代码来源:locallib.php

示例10: get_socialinfo

 public function get_socialinfo()
 {
     global $CFG, $DB;
     $info = new \stdClass();
     $info->ratings = null;
     $info->contextid = $this->get_context()->id;
     if ($this->gallery->can_like()) {
         $info->likes = $DB->count_records('mediagallery_userfeedback', array('itemid' => $this->record->id, 'liked' => 1));
         $info->likedbyme = false;
         if ($fb = $this->get_userfeedback()) {
             if ($fb->liked) {
                 $info->likedbyme = true;
             }
         }
     }
     if ($this->gallery->can_comment()) {
         $cmtopt = new \stdClass();
         $cmtopt->area = 'item';
         $cmtopt->context = $this->get_context();
         $cmtopt->itemid = $this->record->id;
         $cmtopt->showcount = true;
         $cmtopt->component = 'mod_mediagallery';
         $cmtopt->autostart = true;
         $comment = new \comment($cmtopt);
         $info->commentcontrol = $comment->output(true);
         preg_match('#comment-link-([\\w]+)#', $info->commentcontrol, $matches);
         $info->client_id = isset($matches[1]) ? $matches[1] : null;
     }
     // Creator name.
     $info->extradetails = '';
     return $info;
 }
开发者ID:eSrem,项目名称:moodle-mod_mediagallery,代码行数:32,代码来源:item.php

示例11: display_browse

 /**
  *
  */
 public function display_browse($entry, $options = array())
 {
     global $DB, $CFG;
     $field = $this->_field;
     $fieldid = $field->id;
     $df = $field->get_df();
     // Only for existing entries.
     if (!($entry->id > 0)) {
         return '';
     }
     $str = '';
     require_once "{$CFG->dirroot}/comment/lib.php";
     $cmt = new stdClass();
     $cmt->context = $df->context;
     $cmt->courseid = $df->course->id;
     $cmt->cm = $df->cm;
     $cmt->itemid = $entry->id;
     $cmt->component = 'mod_dataform';
     $cmt->area = $field->name;
     $cmt->showcount = isset($options['showcount']) ? $options['showcount'] : true;
     if (!empty($options['count'])) {
         $comment = new comment($cmt);
         $str = $comment->count();
     } else {
         foreach ($options as $key => $val) {
             $cmt->{$key} = $val;
         }
         $comment = new comment($cmt);
         $str = $comment->output(true);
     }
     return $str;
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:35,代码来源:renderer.php

示例12: array

            $showurl = new moodle_url($baseurl, array('action' => 'hide', 'sesskey' => sesskey()));
            $showicon = $OUTPUT->pix_icon('t/hide', get_string('hide'));
        }
        $showicon = html_writer::link($showurl, $showicon);
        $actions = array($editicon, $delicon, $showicon);
        echo '<strong>' . format_string($contrib->title) . '</strong>  ' . implode(' ', $actions) . '</br>';
        echo date('l jS F Y', $contrib->timemodified);
        echo '</br></br>';
        $contribtext = file_rewrite_pluginfile_urls($contrib->content, 'pluginfile.php', $context->id, 'mod_giportfolio', 'contribution', $contrib->id);
        echo format_text($contribtext, $contrib->contentformat, array('noclean' => true, 'context' => $context));
        echo '</br>';
        $files = giportfolio_print_attachments($contrib, $cm, $type = null, $align = "right");
        if ($files) {
            echo "<table border=\"0\" width=\"100%\" align=\"{$align}\"><tr><td align=\"{$align}\" nowrap=\"nowrap\">\n";
            echo $files;
            echo "</td></tr></table>\n";
        }
        echo '</br>';
        $commentopts->itemid = $contrib->id;
        $commentbox = new comment($commentopts);
        echo $commentbox->output();
        echo '</br>';
        echo '</br>';
    }
}
// SYNERGY.
echo $OUTPUT->box_end();
echo '</br>';
// Lower navigation.
echo '<div class="navbottom">' . $chnavigation . '</div>';
echo $OUTPUT->footer();
开发者ID:andrewhancox,项目名称:moodle-mod_giportfolio,代码行数:31,代码来源:viewgiportfolio.php

示例13: render_resources_comments_ratings

/**
 * 
 * 
 * 
 * 
 */
function render_resources_comments_ratings($course, $modules, $modinfo, $section, $page_context)
{
    global $USER, $OUTPUT;
    foreach ($modules as $module) {
        $cm = $modinfo->get_cm($module->id);
        //Avoid comments and ratings for default 'News forum'
        if ($module->section == $section->id && $cm->name != 'News forum') {
            $url = new moodle_url('/mod/resource/view.php?id=' . $module->id);
            echo html_writer::link($url, $cm->name);
            //            echo $cm->name . '<br>';
            $args = new stdClass();
            $args->context = $page_context;
            $args->course = $course;
            $args->area = 'resource';
            $args->itemid = $module->id;
            $args->component = 'block_comments_and_ratings';
            $args->showcount = true;
            $comment = new comment($args);
            $comment->set_fullwidth();
            $comment->output(false);
            echo '<hr>';
            //            $ratingargs = new stdClass;
            //            $ratingargs->context = $page_context;
            //            $ratingargs->component = 'block_comments_and_ratings';
            //            $ratingargs->ratingarea = 'resource';
            //            $ratingargs->items = $modules;
            //            $ratingargs->userid = $USER->id;
            //            $ratingargs->scaleid = 1;
            //            $ratingargs->aggregate = $cm->name;
            //            $rm = new rating_manager();
            //            $modules = $rm->get_ratings($ratingargs);
            //
            //            $output .= $OUTPUT->render($module->rating);
        }
    }
}
开发者ID:Chevijan,项目名称:moodle-plugin,代码行数:42,代码来源:locallib.php

示例14: array

        if ($contribution->status != local_amos_contribution::STATE_REJECTED) {
            echo $output->single_button(new moodle_url($PAGE->url, array('reject' => $id)), get_string('contribreject', 'local_amos'), 'post', array('class' => 'singlebutton reject'));
        }
    }
    echo $output->help_icon('contribactions', 'local_amos');
    echo html_writer::end_tag('div');
    if (!empty($CFG->usecomments)) {
        $options = new stdClass();
        $options->context = get_system_context();
        $options->area = 'amos_contribution';
        $options->itemid = $contribution->id;
        $options->showcount = true;
        $options->component = 'local_amos';
        $options->autostart = true;
        $commentmanager = new comment($options);
        echo $output->container($commentmanager->output(), 'commentswrapper');
    }
    echo $output->footer();
    exit;
}
// Incoming contributions
if (has_capability('local/amos:commit', get_system_context())) {
    $maintenances = $DB->get_records('amos_translators', array('userid' => $USER->id));
    $maintainerof = array();
    // list of languages the USER is maintainer of, or 'all'
    foreach ($maintenances as $maintained) {
        if ($maintained->lang === 'X') {
            $maintainerof = 'all';
            break;
        }
        $maintainerof[] = $maintained->lang;
开发者ID:jobyh,项目名称:moodle-local_amos,代码行数:31,代码来源:contrib.php


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