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


PHP portfolio_add_button::set_format_by_file方法代码示例

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


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

示例1: foreach

    /**
     * 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

示例2: 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

示例3: preprocess

 /**
  * Preprocessing the file list to add the portfolio links if required.
  *
  * @param array $dir
  * @param string $filearea
  * @param string $component
  * @return void
  */
 public function preprocess($dir, $filearea, $component)
 {
     global $CFG;
     foreach ($dir['subdirs'] as $subdir) {
         $this->preprocess($subdir, $filearea, $component);
     }
     foreach ($dir['files'] as $file) {
         $file->portfoliobutton = '';
         if (!empty($CFG->enableportfolios)) {
             $button = new portfolio_add_button();
             if (has_capability('mod/sepl:exportownsubmission', $this->context)) {
                 $portfolioparams = array('cmid' => $this->cm->id, 'fileid' => $file->get_id());
                 $button->set_callback_options('sepl_portfolio_caller', $portfolioparams, 'mod_sepl');
                 $button->set_format_by_file($file);
                 $file->portfoliobutton = $button->to_html(PORTFOLIO_ADD_ICON_LINK);
             }
         }
         $path = '/' . $this->context->id . '/' . $component . '/' . $filearea . '/' . $file->get_itemid() . $file->get_filepath() . $file->get_filename();
         $url = file_encode_url("{$CFG->wwwroot}/pluginfile.php", $path, true);
         $filename = $file->get_filename();
         $file->fileurl = html_writer::link($url, $filename);
     }
 }
开发者ID:krzpassrl,项目名称:SRL_Moodle_Baseline,代码行数:31,代码来源:renderable.php

示例4: preprocess

 public function preprocess($dir, $filearea) {
     global $CFG;
     foreach ($dir['subdirs'] as $subdir) {
         $this->preprocess($subdir, $filearea);
     }
     foreach ($dir['files'] as $file) {
         $file->portfoliobutton = '';
         if (!empty($CFG->enableportfolios)) {
             $button = new portfolio_add_button();
             if (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);
                 $file->portfoliobutton = $button->to_html(PORTFOLIO_ADD_ICON_LINK);
             }
         }
         $url = file_encode_url("$CFG->wwwroot/pluginfile.php", '/'.$this->context->id.'/mod_assignment/'.$filearea.'/'.$file->get_itemid(). $file->get_filepath().$file->get_filename(), true);
         $filename = $file->get_filename();
         $file->fileurl = html_writer::link($url, $filename);
     }
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:20,代码来源:renderer.php

示例5: 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 = get_context_instance(CONTEXT_MODULE, $cm->id))) {
        return $type !== 'separateimages' ? '' : array('', '');
    }
    $strattachment = get_string('attachment', 'forum');
    $fs = get_file_storage();
    $imagereturn = '';
    $output = '';
    $canexport = has_capability('mod/forum:exportpost', $context) || $post->userid == $USER->id && has_capability('mod/forum:exportownpost', $context);
    require_once $CFG->libdir . '/portfoliolib.php';
    if ($files = $fs->get_area_files($context->id, 'mod_forum', 'attachment', $post->id, "timemodified", false)) {
        $button = new portfolio_add_button();
        foreach ($files as $file) {
            $filename = $file->get_filename();
            $mimetype = $file->get_mimetype();
            $iconimage = '<img src="' . $OUTPUT->pix_url(file_mimetype_icon($mimetype)) . '" class="icon" alt="' . $mimetype . '" />';
            $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/locallib.php');
                    $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/locallib.php');
                            $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/locallib.php');
                            $button->set_format_by_file($file);
                            $output .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
                        }
                        $output .= '<br />';
                    }
                }
            }
        }
    }
    if ($type !== 'separateimages') {
        return $output;
    } else {
        return array($output, $imagereturn);
    }
}
开发者ID:hitphp,项目名称:moodle,代码行数:78,代码来源:lib.php

示例6: 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

示例7: get_p_links

 /**
  * Produces a list of portfolio links to the file recorded byuser
  *
  * @param $submissionid this submission's id
  * @return string the portfolio export link
  */
 public function get_p_links($submissionid)
 {
     global $CFG, $OUTPUT, $DB;
     $output = "";
     $fs = get_file_storage();
     $files = $fs->get_area_files($this->assignment->get_context()->id, ASSIGNSUBMISSION_ONLINEPOODLL_COMPONENT, ASSIGNSUBMISSION_ONLINEPOODLL_FILEAREA, $submissionid, "id", false);
     if (!empty($files)) {
         require_once $CFG->dirroot . '/mod/assignment/locallib.php';
         if ($CFG->enableportfolios) {
             require_once $CFG->libdir . '/portfoliolib.php';
         }
         //Add portfolio download links if appropriate
         foreach ($files as $file) {
             if ($CFG->enableportfolios && has_capability('mod/assign:exportownsubmission', $this->assignment->get_context())) {
                 require_once $CFG->libdir . '/portfoliolib.php';
                 $button = new portfolio_add_button();
                 $button->set_callback_options('assign_portfolio_caller', array('cmid' => $this->assignment->get_course_module()->id, 'component' => "assignsubmission_onlinepoodll", 'area' => ASSIGNSUBMISSION_ONLINEPOODLL_FILEAREA, 'sid' => $submissionid), '/mod/assign/portfolio_callback.php');
                 $button->set_format_by_file($file);
                 $output .= $button->to_html(PORTFOLIO_ADD_TEXT_LINK);
             }
             $output .= '<br />';
         }
     }
     $output = '<div class="files" style="float:left;margin-left:5px;">' . $output . '</div><br clear="all" />';
     return $output;
 }
开发者ID:laiello,项目名称:poodll.poodll23,代码行数:32,代码来源:locallib.php

示例8: referentiel_get_manage_archives

function referentiel_get_manage_archives($contextid, $titre, $appli, $userid_filtre = 0, $instanceid = 0, $ok_portfolio = false, $report = false, $export_format = '')
{
    // retourne la liste des liens vers des fichiers stockes dans le filearea
    // propose la suppression
    global $CFG;
    global $OUTPUT;
    // Archives older than REFERENTIEL_ARCHIVE_OBSOLETE days will be deleted.
    $delai_destruction = REFERENTIEL_ARCHIVE_OBSOLETE * 24 * 3600;
    $date_obsolete = time() - $delai_destruction;
    $msg = get_string('archive_deleted', 'referentiel', date("Y-m-d H:i:s.", $date_obsolete));
    $s = '';
    $total_size = 0;
    $nfile = 0;
    // fileareas autorisees
    $filearea = 'archive';
    $strauthor = get_string('auteur', 'referentiel');
    $strfilename = get_string('filename', 'referentiel');
    $strfilesize = get_string('filesize', 'referentiel');
    $strtimecreated = get_string('timecreated', 'referentiel');
    $strtimemodified = get_string('timemodified', 'referentiel');
    $strmimetype = get_string('mimetype', 'referentiel');
    $strmenu = get_string('delete');
    $strportfolio = get_string('publishporttfolio', 'referentiel');
    $strurl = get_string('url');
    // publication via potfolio
    if ($ok_portfolio) {
        require_once $CFG->libdir . '/portfoliolib.php';
    }
    $fs = get_file_storage();
    if ($files = $fs->get_area_files($contextid, 'mod_referentiel', $filearea, 0, "timemodified", false)) {
        $table = new html_table();
        if ($ok_portfolio) {
            $table->head = array($strauthor, $strfilename, $strfilesize, $strtimecreated, $strtimemodified, $strmimetype, $strmenu, $strportfolio);
            $table->align = array("right", "center", "left", "left", "left", "center", "center", "center");
        } else {
            $table->head = array($strauthor, $strfilename, $strfilesize, $strtimecreated, $strtimemodified, $strmimetype, $strmenu);
            $table->align = array("right", "center", "left", "left", "left", "center", "center");
        }
        $ok = false;
        //drapeau d'affichage
        foreach ($files as $file) {
            // print_object($file);
            $filesize = $file->get_filesize();
            $filename = $file->get_filename();
            $mimetype = $file->get_mimetype();
            $filepath = $file->get_filepath();
            $iconimage = '<img src="' . $OUTPUT->pix_url(file_mimetype_icon($mimetype)) . '" class="icon" alt="' . $mimetype . '" />';
            $userid = 0;
            $author = '';
            $parts = explode('/', $filepath);
            if (is_array($parts)) {
                $refrefid = $parts[1];
                if (isset($parts[2])) {
                    $userid = trim($parts[2]);
                    // echo "<br />USER:$userid\n";
                    $author = '#' . $userid . ' ' . referentiel_get_user_info($userid);
                }
            }
            $fullpath = '/' . $contextid . '/mod_referentiel/' . $filearea . '/' . '0' . $filepath . $filename;
            // echo "<br />FULPATH :: $fullpath \n";
            $timecreated = userdate($file->get_timecreated(), "%Y/%m/%d-%H:%M", 99, false);
            $timemodified = userdate($file->get_timemodified(), "%Y/%m/%d-%H:%M", 99, false);
            $link = new moodle_url($CFG->wwwroot . '/pluginfile.php' . $fullpath);
            $url = ' <a href="' . $link . '" target="_blank">' . $iconimage . $filename . '</a><br />' . "\n";
            $delete_link = '<input type="checkbox" name="deletefile[]"  value="' . $fullpath . '" />' . "\n";
            if ($userid && ($userid_filtre == 0 || $userid == $userid_filtre)) {
                // afficher ce fichier
                $ok = true;
                $output_button = '';
                // Publish button
                if ($ok_portfolio) {
                    $params = array('instanceid' => $instanceid, 'attachment' => $file->get_id(), 'report' => $report, 'export_format' => $export_format);
                    // DEBUG
                    /*
                    echo "<br />DEBUG :: lib_archive.php :: 585 :: PARAM PORTFOLIO<br />\n";
                    print_object($params);
                    echo "<br />\n";
                    // exit;
                    */
                    $button = new portfolio_add_button();
                    // Version anterieure à Moodle 2.4
                    //                    $button->set_callback_options('referentiel_portfolio_caller',
                    //                        $params, '/mod/referentiel/portfolio/mahara/locallib_portfolio.php');
                    // Version Moodle 2.4
                    $button->set_callback_options('referentiel_portfolio_caller', $params, 'mod_referentiel');
                    $button->set_format_by_file($file);
                    // $button->set_formats(array(PORTFOLIO_FORMAT_FILE));
                    // $output_button = "<a href=\"$path\">$iconimage</a> ";
                    $output_button .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
                    $table->data[] = array($author, $url, display_size($filesize), $timecreated, $timemodified, $mimetype, $delete_link, $output_button);
                } else {
                    $table->data[] = array($author, $url, display_size($filesize), $timecreated, $timemodified, $mimetype, $delete_link);
                }
                $total_size += $filesize;
                $nfile++;
            }
        }
        if ($ok) {
            if ($ok_portfolio) {
                $table->data[] = array('', get_string('nbfile', 'referentiel', $nfile), get_string('totalsize', 'referentiel', display_size($total_size)), '', '', '', '');
//.........这里部分代码省略.........
开发者ID:jfruitet,项目名称:moodle_referentiel,代码行数:101,代码来源:lib_archive.php

示例9: get_p_links

 /**
  * Produces a list of portfolio links to the file recorded byuser
  *
  * @param $submissionid this submission's id
  * @return string the portfolio export link
  */
 public function get_p_links($submissionid)
 {
     global $CFG, $OUTPUT, $DB;
     $output = "";
     $fs = get_file_storage();
     $files = $fs->get_area_files($this->assignment->get_context()->id, ASSIGNSUBMISSION_ONLINEPOODLL_COMPONENT, ASSIGNSUBMISSION_ONLINEPOODLL_FILEAREA, $submissionid, "id", false);
     if (!empty($files)) {
         //this was nec for portfolios prior to M2.7.
         if (file_exists($CFG->dirroot . '/mod/assignment/locallib.php')) {
             require_once $CFG->dirroot . '/mod/assignment/locallib.php';
         }
         if ($CFG->enableportfolios) {
             require_once $CFG->libdir . '/portfoliolib.php';
         }
         //Add portfolio download links if appropriate
         foreach ($files as $file) {
             //in the case of splash images we will have two files.
             //we just want one link, and for the video file
             if ($this->get_config('recordertype') == OP_REPLYVIDEO) {
                 $fname = $file->get_filename();
                 $fext = pathinfo($fname, PATHINFO_EXTENSION);
                 if ($fext == 'jpg' || $fext == 'png') {
                     continue;
                 }
             }
             if ($CFG->enableportfolios && has_capability('mod/assign:exportownsubmission', $this->assignment->get_context())) {
                 require_once $CFG->libdir . '/portfoliolib.php';
                 $button = new portfolio_add_button();
                 //API changes. See https://github.com/moodle/moodle/blob/master/portfolio/upgrade.txt#L6
                 if ($CFG->version < 2012120300) {
                     $finalparam = '/mod/assign/portfolio_callback.php';
                 } else {
                     $finalparam = 'mod_assign';
                 }
                 $button->set_callback_options('assign_portfolio_caller', array('cmid' => $this->assignment->get_course_module()->id, 'component' => ASSIGNSUBMISSION_ONLINEPOODLL_COMPONENT, 'area' => ASSIGNSUBMISSION_ONLINEPOODLL_FILEAREA, 'sid' => $submissionid), $finalparam);
                 $button->set_format_by_file($file);
                 $output .= $button->to_html(PORTFOLIO_ADD_TEXT_LINK);
             }
             $output .= '<br />';
         }
     }
     $output = '<div class="files" style="float:left;margin-left:5px;">' . $output . '</div><br clear="all" />';
     return $output;
 }
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:50,代码来源:locallib.php


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