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


PHP plagiarism_get_links函数代码示例

本文整理汇总了PHP中plagiarism_get_links函数的典型用法代码示例。如果您正苦于以下问题:PHP plagiarism_get_links函数的具体用法?PHP plagiarism_get_links怎么用?PHP plagiarism_get_links使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: print_student_answer

    function print_student_answer($userid, $return=false){
        global $CFG, $USER, $OUTPUT;

        $fs = get_file_storage();
        $browser = get_file_browser();

        $output = '';

        if ($submission = $this->get_submission($userid)) {
            if ($files = $fs->get_area_files($this->context->id, 'mod_assignment', 'submission', $submission->id, "timemodified", false)) {
                foreach ($files as $file) {
                    $filename = $file->get_filename();
                    $found = true;
                    $mimetype = $file->get_mimetype();
                    $path = file_encode_url($CFG->wwwroot.'/pluginfile.php', '/'.$this->context->id.'/mod_assignment/submission/'.$submission->id.'/'.$filename);
                    $output .= '<a href="'.$path.'" >'.$OUTPUT->pix_icon(file_file_icon($file), get_mimetype_description($file), 'moodle', array('class' => 'icon')).s($filename).'</a><br />';
                    $output .= plagiarism_get_links(array('userid'=>$userid, 'file'=>$file, 'cmid'=>$this->cm->id, 'course'=>$this->course, 'assignment'=>$this->assignment));
                    $output .='<br/>';
                }
            }
        }

        $output = '<div class="files">'.$output.'</div>';
        return $output;
    }
开发者ID:JP-Git,项目名称:moodle,代码行数:25,代码来源:assignment.class.php

示例2: htmllize_tree

    /**
     * Internal function - creates htmls structure suitable for YUI tree.
     */
    protected function htmllize_tree($tree, $dir) {
        global $CFG;
        $yuiconfig = array();
        $yuiconfig['type'] = 'html';

        if (empty($dir['subdirs']) and empty($dir['files'])) {
            return '';
        }

        $result = '<ul>';
        foreach ($dir['subdirs'] as $subdir) {
            $image = $this->output->pix_icon(file_folder_icon(), $subdir['dirname'], 'moodle', array('class'=>'icon'));
            $result .= '<li yuiConfig=\''.json_encode($yuiconfig).'\'><div>'.$image.' '.s($subdir['dirname']).'</div> '.$this->htmllize_tree($tree, $subdir).'</li>';
        }

        foreach ($dir['files'] as $file) {
            $filename = $file->get_filename();
            if ($CFG->enableplagiarism) {
                require_once($CFG->libdir.'/plagiarismlib.php');
                $plagiarsmlinks = plagiarism_get_links(array('userid'=>$file->get_userid(), 'file'=>$file, 'cmid'=>$tree->cm->id, 'course'=>$tree->course));
            } else {
                $plagiarsmlinks = '';
            }
            $image = $this->output->pix_icon(file_file_icon($file), $filename, 'moodle', array('class'=>'icon'));
            $result .= '<li yuiConfig=\''.json_encode($yuiconfig).'\'><div>'.$image.' '.$file->fileurl.' '.$plagiarsmlinks.$file->portfoliobutton.'</div></li>';
        }

        $result .= '</ul>';

        return $result;
    }
开发者ID:JP-Git,项目名称:moodle,代码行数:34,代码来源:renderer.php

示例3: forum_print_attachments

/**
 * Returns attachments as formated text/html optionally with separate images
 *
 * @global object
 * @global object
 * @global object
 * @param object $post
 * @param object $cm
 * @param string $type html/text/separateimages
 * @return mixed string or array of (html text withouth images and image HTML)
 */
function forum_print_attachments($post, $cm, $type) {
    global $CFG, $DB, $USER, $OUTPUT;

    if (empty($post->attachment)) {
        return $type !== 'separateimages' ? '' : array('', '');
    }

    if (!in_array($type, array('separateimages', 'html', 'text'))) {
        return $type !== 'separateimages' ? '' : array('', '');
    }

    if (!$context = context_module::instance($cm->id)) {
        return $type !== 'separateimages' ? '' : array('', '');
    }
    $strattachment = get_string('attachment', 'forum');

    $fs = get_file_storage();

    $imagereturn = '';
    $output = '';

    $canexport = !empty($CFG->enableportfolios) && (has_capability('mod/forum:exportpost', $context) || ($post->userid == $USER->id && has_capability('mod/forum:exportownpost', $context)));

    if ($canexport) {
        require_once($CFG->libdir.'/portfoliolib.php');
    }

    $files = $fs->get_area_files($context->id, 'mod_forum', 'attachment', $post->id, "timemodified", false);
    if ($files) {
        if ($canexport) {
            $button = new portfolio_add_button();
        }
        foreach ($files as $file) {
            $filename = $file->get_filename();
            $mimetype = $file->get_mimetype();
            $iconimage = $OUTPUT->pix_icon(file_file_icon($file), get_mimetype_description($file), 'moodle', array('class' => 'icon'));
            $path = file_encode_url($CFG->wwwroot.'/pluginfile.php', '/'.$context->id.'/mod_forum/attachment/'.$post->id.'/'.$filename);

            if ($type == 'html') {
                $output .= "<a href=\"$path\">$iconimage</a> ";
                $output .= "<a href=\"$path\">".s($filename)."</a>";
                if ($canexport) {
                    $button->set_callback_options('forum_portfolio_caller', array('postid' => $post->id, 'attachment' => $file->get_id()), 'mod_forum');
                    $button->set_format_by_file($file);
                    $output .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
                }
                $output .= "<br />";

            } else if ($type == 'text') {
                $output .= "$strattachment ".s($filename).":\n$path\n";

            } else { //'returnimages'
                if (in_array($mimetype, array('image/gif', 'image/jpeg', 'image/png'))) {
                    // Image attachments don't get printed as links
                    $imagereturn .= "<br /><img src=\"$path\" alt=\"\" />";
                    if ($canexport) {
                        $button->set_callback_options('forum_portfolio_caller', array('postid' => $post->id, 'attachment' => $file->get_id()), 'mod_forum');
                        $button->set_format_by_file($file);
                        $imagereturn .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
                    }
                } else {
                    $output .= "<a href=\"$path\">$iconimage</a> ";
                    $output .= format_text("<a href=\"$path\">".s($filename)."</a>", FORMAT_HTML, array('context'=>$context));
                    if ($canexport) {
                        $button->set_callback_options('forum_portfolio_caller', array('postid' => $post->id, 'attachment' => $file->get_id()), 'mod_forum');
                        $button->set_format_by_file($file);
                        $output .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
                    }
                    $output .= '<br />';
                }
            }

            if (!empty($CFG->enableplagiarism)) {
                require_once($CFG->libdir.'/plagiarismlib.php');
                $output .= plagiarism_get_links(array('userid' => $post->userid,
                    'file' => $file,
                    'cmid' => $cm->id,
                    'course' => $post->course,
                    'forum' => $post->forum));
                $output .= '<br />';
            }
        }
    }

    if ($type !== 'separateimages') {
        return $output;

    } else {
        return array($output, $imagereturn);
//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:lib.php

示例4: print_user_files

    /**
     * Produces a list of links to the files uploaded by a user
     *
     * @param $userid int optional id of the user. If 0 then $USER->id is used.
     * @param $return boolean optional defaults to false. If true the list is returned rather than printed
     * @return string optional
     */
    function print_user_files($userid=0, $return=false) {
        global $CFG, $USER, $OUTPUT;

        if (!$userid) {
            if (!isloggedin()) {
                return '';
            }
            $userid = $USER->id;
        }

        $output = '';

        $fs = get_file_storage();

        $found = false;

        $submission = $this->get_submission($userid);

        if (($submission) && $files = $fs->get_area_files($this->context->id, 'mod_assignment', 'submission', $submission->id, "timemodified", false)) {
            require_once($CFG->libdir.'/portfoliolib.php');
            require_once($CFG->dirroot . '/mod/assignment/locallib.php');
            $button = new portfolio_add_button();
            foreach ($files as $file) {
                $filename = $file->get_filename();
                $found = true;
                $mimetype = $file->get_mimetype();
                $path = file_encode_url($CFG->wwwroot.'/pluginfile.php', '/'.$this->context->id.'/mod_assignment/submission/'.$submission->id.'/'.$filename);
                $output .= '<a href="'.$path.'" ><img src="'.$OUTPUT->pix_url(file_mimetype_icon($mimetype)).'" class="icon" alt="'.$mimetype.'" />'.s($filename).'</a>';
                if ($this->portfolio_exportable() && has_capability('mod/assignment:exportownsubmission', $this->context)) {
                    $button->set_callback_options('assignment_portfolio_caller', array('id' => $this->cm->id, 'fileid' => $file->get_id()), '/mod/assignment/locallib.php');
                    $button->set_format_by_file($file);
                    $output .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
                }
                $output .= plagiarism_get_links(array('userid'=>$userid, 'file'=>$file, 'cmid'=>$this->cm->id, 'course'=>$this->course, 'assignment'=>$this->assignment));
                $output .= '<br />';
            }
            if (count($files) > 1  && $this->portfolio_exportable() && has_capability('mod/assignment:exportownsubmission', $this->context)) {
                $button->set_callback_options('assignment_portfolio_caller', array('id' => $this->cm->id), '/mod/assignment/locallib.php');
                $output .= '<br />'  . $button->to_html();
            }
        }

        $output = '<div class="files">'.$output.'</div>';

        if ($return) {
            return $output;
        }
        echo $output;
    }
开发者ID:nuckey,项目名称:moodle,代码行数:56,代码来源:lib.php

示例5: helper_submission_attachments

 /**
  * Renders a list of files attached to the submission
  *
  * If format==html, then format a html string. If format==text, then format a text-only string.
  * Otherwise, returns html for non-images and html to display the image inline.
  *
  * @param int $submissionid submission identifier
  * @param string format the format of the returned string - html|text
  * @return string formatted text to be echoed
  */
 protected function helper_submission_attachments($submissionid, $format = 'html')
 {
     global $CFG;
     require_once $CFG->libdir . '/filelib.php';
     $fs = get_file_storage();
     $ctx = $this->page->context;
     $files = $fs->get_area_files($ctx->id, 'mod_workshop', 'submission_attachment', $submissionid);
     $outputimgs = '';
     // images to be displayed inline
     $outputfiles = '';
     // list of attachment files
     foreach ($files as $file) {
         if ($file->is_directory()) {
             continue;
         }
         $filepath = $file->get_filepath();
         $filename = $file->get_filename();
         $fileurl = moodle_url::make_pluginfile_url($ctx->id, 'mod_workshop', 'submission_attachment', $submissionid, $filepath, $filename, true);
         $embedurl = moodle_url::make_pluginfile_url($ctx->id, 'mod_workshop', 'submission_attachment', $submissionid, $filepath, $filename, false);
         $embedurl = new moodle_url($embedurl, array('preview' => 'bigthumb'));
         $type = $file->get_mimetype();
         $image = $this->output->pix_icon(file_file_icon($file), get_mimetype_description($file), 'moodle', array('class' => 'icon'));
         $linkhtml = html_writer::link($fileurl, $image . substr($filepath, 1) . $filename);
         $linktxt = "{$filename} [{$fileurl}]";
         if ($format == 'html') {
             if (file_mimetype_in_typegroup($type, 'web_image')) {
                 $preview = html_writer::empty_tag('img', array('src' => $embedurl, 'alt' => '', 'class' => 'preview'));
                 $preview = html_writer::tag('a', $preview, array('href' => $fileurl));
                 $outputimgs .= $this->output->container($preview);
             } else {
                 $outputfiles .= html_writer::tag('li', $linkhtml, array('class' => $type));
             }
         } else {
             if ($format == 'text') {
                 $outputfiles .= $linktxt . PHP_EOL;
             }
         }
         if (!empty($CFG->enableplagiarism)) {
             require_once $CFG->libdir . '/plagiarismlib.php';
             $outputfiles .= plagiarism_get_links(array('userid' => $file->get_userid(), 'file' => $file, 'cmid' => $this->page->cm->id, 'course' => $this->page->course->id));
         }
     }
     if ($format == 'html') {
         if ($outputimgs) {
             $outputimgs = $this->output->container($outputimgs, 'images');
         }
         if ($outputfiles) {
             $outputfiles = html_writer::tag('ul', $outputfiles, array('class' => 'files'));
         }
         return $this->output->container($outputimgs . $outputfiles, 'attachments');
     } else {
         return $outputfiles;
     }
 }
开发者ID:dg711,项目名称:moodle,代码行数:64,代码来源:renderer.php

示例6: view_summary

 /**
  * Display onlinetext word count in the submission status table
  *
  * @param stdClass $submission
  * @param bool $showviewlink - If the summary has been truncated set this to true
  * @return string
  */
 public function view_summary(stdClass $submission, &$showviewlink)
 {
     global $CFG;
     $onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
     // always show the view link
     $showviewlink = true;
     if ($onlinetextsubmission) {
         $text = $this->assignment->render_editor_content(ASSIGNSUBMISSION_ONLINETEXT_FILEAREA, $onlinetextsubmission->submission, $this->get_type(), 'onlinetext', 'assignsubmission_onlinetext');
         $shorttext = shorten_text($text, 140);
         $plagiarismlinks = '';
         if (!empty($CFG->enableplagiarism)) {
             require_once $CFG->libdir . '/plagiarismlib.php';
             $plagiarismlinks .= plagiarism_get_links(array('userid' => $submission->userid, 'content' => trim(format_text($onlinetextsubmission->onlinetext, $onlinetextsubmission->onlineformat, array('context' => $this->assignment->get_context()))), 'cmid' => $this->assignment->get_course_module()->id, 'course' => $this->assignment->get_course()->id, 'assignment' => $submission->assignment));
         }
         if ($text != $shorttext) {
             return $shorttext . $plagiarismlinks . get_string('numwords', 'assignsubmission_onlinetext', count_words($text));
         } else {
             return $shorttext . $plagiarismlinks;
         }
     }
     return '';
 }
开发者ID:vinoth4891,项目名称:clinique,代码行数:29,代码来源:locallib.php

示例7: __construct

 /**
  * The constructor
  *
  * @param context $context
  * @param int $sid
  * @param string $filearea
  * @param string $component
  */
 public function __construct(context $context, $sid, $filearea, $component)
 {
     global $CFG;
     $this->context = $context;
     list($context, $course, $cm) = get_context_info_array($context->id);
     $this->cm = $cm;
     $this->course = $course;
     $fs = get_file_storage();
     $this->dir = $fs->get_area_tree($this->context->id, $component, $filearea, $sid);
     $files = $fs->get_area_files($this->context->id, $component, $filearea, $sid, "timemodified", false);
     if (!empty($CFG->enableportfolios)) {
         require_once $CFG->libdir . '/portfoliolib.php';
         if (count($files) >= 1 && has_capability('mod/assign:exportownsubmission', $this->context)) {
             $button = new portfolio_add_button();
             $button->set_callback_options('assign_portfolio_caller', array('cmid' => $this->cm->id, 'sid' => $sid, 'area' => $filearea, 'component' => $component), '/mod/assign/portfolio_callback.php');
             $button->reset_formats();
             $this->portfolioform = $button->to_html(PORTFOLIO_ADD_TEXT_LINK);
         }
     }
     // plagiarism check if it is enabled
     $output = '';
     if (!empty($CFG->enableplagiarism)) {
         require_once $CFG->libdir . '/plagiarismlib.php';
         // for plagiarism_get_links
         $assignment = new assign($this->context, null, null);
         foreach ($files as $file) {
             $output .= plagiarism_get_links(array('userid' => $sid, 'file' => $file, 'cmid' => $this->cm->id, 'course' => $this->course, 'assignment' => $assignment->get_instance()));
             $output .= '<br />';
         }
     }
     $this->preprocess($this->dir, $filearea, $component);
 }
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:40,代码来源:renderable.php

示例8: view

 /**
  * Display the saved text content from the editor in the view table
  *
  * @param stdClass $submission
  * @return string
  */
 public function view(stdClass $submission)
 {
     global $CFG;
     $result = '';
     $onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
     if ($onlinetextsubmission) {
         // Render for portfolio API.
         $result .= $this->assignment->render_editor_content(ASSIGNSUBMISSION_ONLINETEXT_FILEAREA, $onlinetextsubmission->submission, $this->get_type(), 'onlinetext', 'assignsubmission_onlinetext');
         $plagiarismlinks = '';
         if (!empty($CFG->enableplagiarism)) {
             require_once $CFG->libdir . '/plagiarismlib.php';
             $plagiarismlinks .= plagiarism_get_links(array('userid' => $submission->userid, 'content' => trim($result), 'cmid' => $this->assignment->get_course_module()->id, 'course' => $this->assignment->get_course()->id, 'assignment' => $submission->assignment));
         }
     }
     return $plagiarismlinks . $result;
 }
开发者ID:qanuj,项目名称:moodle,代码行数:22,代码来源:locallib.php

示例9: quora_print_attachments

/**
 * Returns attachments as formated text/html optionally with separate images
 *
 * @global object
 * @global object
 * @global object
 * @param object $post
 * @param object $cm
 * @param string $type html/text/separateimages
 * @return mixed string or array of (html text withouth images and image HTML)
 */
function quora_print_attachments($post, $cm, $type)
{
    global $CFG, $DB, $USER, $OUTPUT;
    if (empty($post->attachment)) {
        return $type !== 'separateimages' ? '' : array('', '');
    }
    if (!in_array($type, array('separateimages', 'html', 'text'))) {
        return $type !== 'separateimages' ? '' : array('', '');
    }
    if (!($context = context_module::instance($cm->id))) {
        return $type !== 'separateimages' ? '' : array('', '');
    }
    $strattachment = get_string('attachment', 'quora');
    $fs = get_file_storage();
    $imagereturn = '';
    $output = '';
    $canexport = !empty($CFG->enableportfolios) && (has_capability('mod/quora:exportpost', $context) || $post->userid == $USER->id && has_capability('mod/quora:exportownpost', $context));
    if ($canexport) {
        require_once $CFG->libdir . '/portfoliolib.php';
    }
    // We retrieve all files according to the time that they were created.  In the case that several files were uploaded
    // at the sametime (e.g. in the case of drag/drop upload) we revert to using the filename.
    $files = $fs->get_area_files($context->id, 'mod_quora', 'attachment', $post->id, "filename", false);
    if ($files) {
        if ($canexport) {
            $button = new portfolio_add_button();
        }
        foreach ($files as $file) {
            $filename = $file->get_filename();
            $mimetype = $file->get_mimetype();
            $iconimage = $OUTPUT->pix_icon(file_file_icon($file), get_mimetype_description($file), 'moodle', array('class' => 'icon'));
            $path = file_encode_url($CFG->wwwroot . '/pluginfile.php', '/' . $context->id . '/mod_quora/attachment/' . $post->id . '/' . $filename);
            if ($type == 'html') {
                $output .= "<a href=\"{$path}\">{$iconimage}</a> ";
                $output .= "<a href=\"{$path}\">" . s($filename) . "</a>";
                if ($canexport) {
                    $button->set_callback_options('quora_portfolio_caller', array('postid' => $post->id, 'attachment' => $file->get_id()), 'mod_quora');
                    $button->set_format_by_file($file);
                    $output .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
                }
                $output .= "<br />";
            } else {
                if ($type == 'text') {
                    $output .= "{$strattachment} " . s($filename) . ":\n{$path}\n";
                } else {
                    //'returnimages'
                    if (in_array($mimetype, array('image/gif', 'image/jpeg', 'image/png'))) {
                        // Image attachments don't get printed as links
                        $imagereturn .= "<br /><img src=\"{$path}\" alt=\"\" />";
                        if ($canexport) {
                            $button->set_callback_options('quora_portfolio_caller', array('postid' => $post->id, 'attachment' => $file->get_id()), 'mod_quora');
                            $button->set_format_by_file($file);
                            $imagereturn .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
                        }
                    } else {
                        $output .= "<a href=\"{$path}\">{$iconimage}</a> ";
                        $output .= format_text("<a href=\"{$path}\">" . s($filename) . "</a>", FORMAT_HTML, array('context' => $context));
                        if ($canexport) {
                            $button->set_callback_options('quora_portfolio_caller', array('postid' => $post->id, 'attachment' => $file->get_id()), 'mod_quora');
                            $button->set_format_by_file($file);
                            $output .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
                        }
                        $output .= '<br />';
                    }
                }
            }
            if (!empty($CFG->enableplagiarism)) {
                require_once $CFG->libdir . '/plagiarismlib.php';
                $output .= plagiarism_get_links(array('userid' => $post->userid, 'file' => $file, 'cmid' => $cm->id, 'course' => $cm->course, 'quora' => $cm->instance));
                $output .= '<br />';
            }
        }
    }
    if ($type !== 'separateimages') {
        return $output;
    } else {
        return array($output, $imagereturn);
    }
}
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:90,代码来源:lib.php


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