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


PHP portfolio_format_text_options函数代码示例

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


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

示例1: get_sha1

 /**
  * Calculate a sha1 has of either a single file or a list
  * of files based on the data set by load_data.
  *
  * @return string
  */
 public function get_sha1()
 {
     if ($this->plugin && $this->editor) {
         $plugin = $this->get_submission_plugin();
         $options = portfolio_format_text_options();
         $options->context = context_module::instance($this->cmid);
         $text = format_text($plugin->get_editor_text($this->editor, $this->sid), $plugin->get_editor_format($this->editor, $this->sid), $options);
         $textsha1 = sha1($text);
         $filesha1 = '';
         try {
             $filesha1 = $this->get_sha1_file();
         } catch (portfolio_caller_exception $e) {
             // No files.
         }
         return sha1($textsha1 . $filesha1);
     }
     return $this->get_sha1_file();
 }
开发者ID:covex-nn,项目名称:moodle,代码行数:24,代码来源:locallib.php

示例2: prepare_post

 /**
  * this is a very cut down version of what is in forum_make_mail_post
  *
  * @global object
  * @param int $post
  * @return string
  */
 private function prepare_post($post, $fileoutputextras = null)
 {
     global $DB;
     static $users;
     if (empty($users)) {
         $users = array($this->user->id => $this->user);
     }
     if (!array_key_exists($post->userid, $users)) {
         $users[$post->userid] = $DB->get_record('user', array('id' => $post->userid));
     }
     // add the user object on to the post so we can pass it to the leap writer if necessary
     $post->author = $users[$post->userid];
     $viewfullnames = true;
     // format the post body
     $options = portfolio_format_text_options();
     $format = $this->get('exporter')->get('format');
     $formattedtext = format_text($post->message, $post->messageformat, $options, $this->get('course')->id);
     $formattedtext = portfolio_rewrite_pluginfile_urls($formattedtext, $this->modcontext->id, 'mod_forum', 'post', $post->id, $format);
     $output = '<table border="0" cellpadding="3" cellspacing="0" class="forumpost">';
     $output .= '<tr class="header"><td>';
     // can't print picture.
     $output .= '</td>';
     if ($post->parent) {
         $output .= '<td class="topic">';
     } else {
         $output .= '<td class="topic starter">';
     }
     $output .= '<div class="subject">' . format_string($post->subject) . '</div>';
     $fullname = fullname($users[$post->userid], $viewfullnames);
     $by = new stdClass();
     $by->name = $fullname;
     $by->date = userdate($post->modified, '', $this->user->timezone);
     $output .= '<div class="author">' . get_string('bynameondate', 'forum', $by) . '</div>';
     $output .= '</td></tr>';
     $output .= '<tr><td class="left side" valign="top">';
     $output .= '</td><td class="content">';
     $output .= $formattedtext;
     if (is_array($this->keyedfiles) && array_key_exists($post->id, $this->keyedfiles) && is_array($this->keyedfiles[$post->id]) && count($this->keyedfiles[$post->id]) > 0) {
         $output .= '<div class="attachments">';
         $output .= '<br /><b>' . get_string('attachments', 'forum') . '</b>:<br /><br />';
         foreach ($this->keyedfiles[$post->id] as $file) {
             $output .= $format->file_output($file) . '<br/ >';
         }
         $output .= "</div>";
     }
     $output .= '</td></tr></table>' . "\n\n";
     return $output;
 }
开发者ID:nmicha,项目名称:moodle,代码行数:55,代码来源:locallib.php

示例3: entry_content

 /**
  * helper function to get the html content of an entry
  * for both this class and the full glossary exporter
  * this is a very simplified version of the dictionary format output,
  * but with its 500 levels of indirection removed
  * and file rewriting handled by the portfolio export format.
  *
  * @param stdclass $course
  * @param stdclass $cm
  * @param stdclass $glossary
  * @param stdclass $entry
  *
  * @return string
  */
 public static function entry_content($course, $cm, $glossary, $entry, $aliases, $format)
 {
     global $OUTPUT, $DB;
     $entry = clone $entry;
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
     $options = portfolio_format_text_options();
     $options->trusted = $entry->definitiontrust;
     $options->context = $context;
     $output = '<table class="glossarypost dictionary" cellspacing="0">' . "\n";
     $output .= '<tr valign="top">' . "\n";
     $output .= '<td class="entry">' . "\n";
     $output .= '<div class="concept">';
     $output .= format_text($OUTPUT->heading($entry->concept, 3), FORMAT_MOODLE, $options);
     $output .= '</div> ' . "\n";
     $entry->definition = format_text($entry->definition, $entry->definitionformat, $options);
     $output .= portfolio_rewrite_pluginfile_urls($entry->definition, $context->id, 'mod_glossary', 'entry', $entry->id, $format);
     if (isset($entry->footer)) {
         $output .= $entry->footer;
     }
     $output .= '</td></tr>' . "\n";
     if (!empty($aliases)) {
         $aliases = explode(',', $aliases->alias);
         $output .= '<tr valign="top"><td class="entrylowersection">';
         $key = count($aliases) == 1 ? 'alias' : 'aliases';
         $output .= get_string($key, 'glossary') . ': ';
         foreach ($aliases as $alias) {
             $output .= s($alias) . ',';
         }
         $output = substr($output, 0, -1);
         $output .= '</td></tr>' . "\n";
     }
     if ($entry->sourceglossaryid == $cm->instance) {
         if (!($maincm = get_coursemodule_from_instance('glossary', $entry->glossaryid))) {
             return '';
         }
         $filecontext = get_context_instance(CONTEXT_MODULE, $maincm->id);
     } else {
         $filecontext = $context;
     }
     $fs = get_file_storage();
     if ($files = $fs->get_area_files($filecontext->id, 'mod_glossary', 'attachment', $entry->id, "timemodified", false)) {
         $output .= '<table border="0" width="100%"><tr><td>' . "\n";
         foreach ($files as $file) {
             $output .= $format->file_output($file);
         }
         $output .= '</td></tr></table>' . "\n";
     }
     $output .= '</table>' . "\n";
     return $output;
 }
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:64,代码来源:locallib.php

示例4: portfolio_prepare_package

 function portfolio_prepare_package($exporter, $user) {
     $submission = $this->get_submission($user->id);
     $options = portfolio_format_text_options();
     $html = format_text($submission->data1, $submission->data2, $options);
     $html = portfolio_rewrite_pluginfile_urls($html, $this->context->id, 'mod_assignment', $this->filearea, $submission->id, $exporter->get('format'));
     if (in_array($exporter->get('formatclass'), array(PORTFOLIO_FORMAT_PLAINHTML, PORTFOLIO_FORMAT_RICHHTML))) {
         if ($files = $exporter->get('caller')->get('multifiles')) {
             foreach ($files as $f) {
                 $exporter->copy_existing_file($f);
             }
         }
         return $exporter->write_new_file($html, 'assignment.html', !empty($files));
     } else if ($exporter->get('formatclass') == PORTFOLIO_FORMAT_LEAP2A) {
         $leapwriter = $exporter->get('format')->leap2a_writer();
         $entry = new portfolio_format_leap2a_entry('assignmentonline' . $this->assignment->id, $this->assignment->name, 'resource', $html);
         $entry->add_category('web', 'resource_type');
         $entry->published = $submission->timecreated;
         $entry->updated = $submission->timemodified;
         $entry->author = $user;
         $leapwriter->add_entry($entry);
         if ($files = $exporter->get('caller')->get('multifiles')) {
             $leapwriter->link_files($entry, $files, 'assignmentonline' . $this->assignment->id . 'file');
             foreach ($files as $f) {
                 $exporter->copy_existing_file($f);
             }
         }
         $exporter->write_new_file($leapwriter->to_xml(), $exporter->get('format')->manifest_name(), true);
     } else {
         debugging('invalid format class: ' . $exporter->get('formatclass'));
     }
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:31,代码来源:assignment.class.php

示例5: format_exported_text

    /**
     * Helper function to call {@link format_text()} on exported text.
     *
     * We need to call {@link format_text()} to convert the text into HTML, but
     * we have to keep the original @@PLUGINFILE@@ placeholder there without a
     * warning so that {@link portfolio_rewrite_pluginfile_urls()} can do its work.
     *
     * @param string $text
     * @param int $format
     * @return string HTML
     */
    protected function format_exported_text($text, $format) {

        $text = str_replace('@@PLUGINFILE@@', '@@ORIGINALPLUGINFILE@@', $text);
        $html = format_text($text, $format, portfolio_format_text_options());
        $html = str_replace('@@ORIGINALPLUGINFILE@@', '@@PLUGINFILE@@', $html);

        return $html;
    }
开发者ID:rezaies,项目名称:moodle,代码行数:19,代码来源:portfolio_caller.php

示例6: prepare_certificat

 /**
  * this is a very cut down version of what is in referentiel_certificat print_lib
  *
  * @global object
  * @return string
  */
 private function prepare_certificat()
 {
     global $DB;
     $output = '';
     if (!empty($this->certificat)) {
         $fullname = '';
         $fullnameteacher = get_string('l_inconnu', 'referentiel');
         if (!empty($this->certificat->userid)) {
             $user = $DB->get_record('user', array('id' => $this->certificat->userid));
             if ($user) {
                 $fullname = fullname($user, true);
                 $login = $user->username;
             }
         }
         if (!empty($this->certificat->teacherid)) {
             $teacher = $DB->get_record('user', array('id' => $this->certificat->teacherid));
             if ($teacher) {
                 $fullnameteacher = fullname($teacher, true);
             }
         }
         $by = new stdClass();
         $by->name = $fullnameteacher;
         $by->date = date("Y-m-d H:i:s");
         $liste_empreintes = referentiel_purge_dernier_separateur(referentiel_get_liste_empreintes_competence($this->certificat->ref_referentiel), '/');
         $liste_description_competences_poids = referentiel_purge_dernier_separateur(referentiel_get_liste_poids($this->certificat->ref_referentiel), '|');
         // $liste_competences=referentiel_affiche_competences_certificat('/',':',$this->certificat->competences_certificat, $liste_empreintes);
         $liste_competences = $this->affiche_competences_validees('/', ':', $this->certificat->competences_certificat, $liste_empreintes, $liste_description_competences_poids);
         // format the body
         $s = '<h3>' . get_string('certification', 'referentiel') . ' ';
         if (!empty($this->occurrence->url_referentiel)) {
             $s .= get_string('referentiel', 'referentiel') . ' <a href="' . $this->occurrence->url_referentiel . '" target="_blank">' . $this->occurrence->code_referentiel . '</a></h3>' . "\n";
         } else {
             $s .= get_string('referentiel', 'referentiel') . ' ' . $this->occurrence->code_referentiel . '</h3>' . "\n";
         }
         $s .= '<p><b>' . get_string('name', 'referentiel') . ':</b> ' . $fullname . ' (<i>' . $login . '</i>)<br />' . '<b>' . get_string('userid', 'referentiel') . '</b>: #' . $this->certificat->userid . '<br />' . '<b>' . get_string('id', 'referentiel') . get_string('certificat', 'referentiel') . '</b>: #' . $this->certificat->id . '<br />' . '<b>' . get_string('competences_certificat', 'referentiel') . ':</b><br />' . $liste_competences . '<br />' . "\n";
         //                    .'<b>'.get_string('competences_declarees', 'referentiel', $fullname).':</b><br />'.$this->certificat->competences_activite.'<br />'
         if (!empty($this->certificat->verrou)) {
             $s .= '<i>' . get_string('certificat', 'referentiel') . ' ' . get_string('verrou', 'referentiel') . '</i><br />' . "\n";
         }
         if (!empty($this->certificat->synthese_certificat)) {
             $s .= '<b>' . get_string('synthese_certificat', 'referentiel') . ':</b> ' . $this->certificat->synthese_certificat . '<br />' . "\n";
         }
         if (empty($this->certificat->decision_jury)) {
             $s .= '<b>' . get_string('decisionnotfound', 'referentiel', date("Y-m-d")) . '</b><br />';
         } else {
             $s .= '<b>' . get_string('decision_jury', 'referentiel') . ':</b> ' . $this->certificat->decision_jury . '<br />';
         }
         if (!empty($this->certificat->teacherid)) {
             $s .= '<b>' . get_string('referent', 'referentiel') . ':</b> ' . referentiel_get_user_info($this->certificat->teacherid) . '<br />';
         }
         if (!empty($this->certificat->date_decision)) {
             $s .= '<b>' . get_string('date_decision', 'referentiel') . ':</b> ' . userdate($this->certificat->date_decision) . '<br />';
         }
         if (!empty($this->certificat->commentaire_certificat)) {
             $s .= '<b>' . get_string('commentaire_certificat', 'referentiel') . ': </b>' . $this->certificat->commentaire_certificat . '</p>' . "\n";
         }
         $s .= '</p>' . "\n";
         // echo $s;
         // exit;
         $options = portfolio_format_text_options();
         $format = $this->get('exporter')->get('format');
         $formattedtext = format_text($s, FORMAT_HTML, $options);
         // $formattedtext = portfolio_rewrite_pluginfile_urls($formattedtext, $this->context->id, 'mod_referentiel', 'certificat', $certificat->id, $format);
         $output = '<table border="0" cellpadding="3" cellspacing="1" bgcolor="#333300">';
         $output .= '<tr valign="top" bgcolor="#ffffff"><td>';
         $output .= '<div><b>' . get_string('certificat', 'referentiel') . ' ' . format_string($this->occurrence->code_referentiel) . '</b></div>';
         if (!empty($this->certificat->decision_jury)) {
             $output .= '<div>' . get_string('proposedbynameondate', 'referentiel', $by) . '</div>';
         } else {
             $output .= '<div>' . get_string('evaluatedbynameondate', 'referentiel', $by) . '</div>';
         }
         $output .= '</td></tr>';
         $output .= '<tr valign="top" bgcolor="#ffffff"><td align="left">';
         $output .= $formattedtext;
         $output .= '</td></tr></table>' . "\n\n";
     }
     return $output;
 }
开发者ID:jfruitet,项目名称:moodle_referentiel,代码行数:84,代码来源:locallib.php

示例7: get_page_html

 /**
  * Obtains page html suitable for use in portfolio export.
  * @param object $pageversion Page and version data
  * @param array $attachments Attachments array indexed by versionid
  * @param object $context Moodle context object
  * @param object $ouwiki OU wiki object
  * @param object $subwiki Subwiki object
  * @param object $course Course object
  * @param bool $withannotations If true, includes annotations
  * @param portfolio_format $portfolioformat Portfolio format
  * @param string $plugin the portfolio plugin being used.
  * @return string HTML code
  */
 static function get_page_html($pageversion, $attachments, $context, $ouwiki, $subwiki, $course, $withannotations, portfolio_format $portfolioformat, $plugin)
 {
     global $DB;
     // Format the page body
     $options = portfolio_format_text_options();
     $formattedtext = format_text($pageversion->xhtml, $pageversion->xhtmlformat, $options, $course->id);
     $formattedtext = portfolio_rewrite_pluginfile_urls($formattedtext, $context->id, 'mod_ouwiki', 'content', $pageversion->versionid, $portfolioformat);
     // Get annotations - only if using annotation system. prevents unnecessary db access
     if ($ouwiki->annotation) {
         $annotations = ouwiki_get_annotations($pageversion);
     } else {
         $annotations = array();
     }
     // Convert or remove the annotations
     if ($ouwiki->annotation && count($annotations)) {
         ouwiki_highlight_existing_annotations($formattedtext, $annotations, $withannotations ? 'portfolio' : 'clear');
     }
     // Do overall page, starting with title
     $title = $pageversion->title;
     if ($title === null) {
         $title = get_string('startpage', 'ouwiki');
     }
     $output = html_writer::tag('h2', s($title));
     // Last change info
     $user = (object) array('id' => $pageversion->userid, 'firstname' => $pageversion->firstname, 'lastname' => $pageversion->lastname);
     $lastchange = get_string('lastchange', 'ouwiki', (object) array('date' => userdate($pageversion->timecreated), 'userlink' => ouwiki_display_user($user, $course->id)));
     $output .= html_writer::tag('p', html_writer::tag('small', html_writer::tag('i', $lastchange)));
     // Main text
     $output .= html_writer::tag('div', $formattedtext);
     // Word count
     if ($ouwiki->enablewordcount) {
         $wordcount = get_string('numwords', 'ouwiki', $pageversion->wordcount);
         $output .= html_writer::tag('div', html_writer::empty_tag('br'));
         $output .= html_writer::tag('p', html_writer::tag('small', $wordcount), array('class' => 'ouw_wordcount'));
     }
     // Attachments
     if ($attachments[$pageversion->versionid]) {
         $output .= html_writer::start_tag('div', array('class' => 'attachments'));
         $output .= html_writer::tag('h3', get_string('attachments', 'ouwiki'));
         $output .= html_writer::start_tag('ul');
         foreach ($attachments[$pageversion->versionid] as $file) {
             if ($plugin == 'rtf') {
                 $filename = $file->get_filename();
                 $path = moodle_url::make_pluginfile_url($context->id, 'mod_ouwiki', 'attachment', $pageversion->versionid, '/', $filename, true);
                 $atag = html_writer::tag('a', $filename, array('href' => $path));
             } else {
                 $atag = $portfolioformat->file_output($file);
             }
             $output .= html_writer::tag('li', $atag);
         }
         $output .= html_writer::end_tag('ul');
         $output .= html_writer::end_tag('div');
     }
     return $output;
 }
开发者ID:ndunand,项目名称:moodle-mod_ouwiki,代码行数:68,代码来源:portfoliolib.php

示例8: get_page_html

 /**
  * Obtains page html suitable for use in portfolio export.
  * @param object $pageversion Page and version data
  * @param array $attachments Attachments array indexed by versionid
  * @param object $context Moodle context object
  * @param object $ouwiki OU wiki object
  * @param object $subwiki Subwiki object
  * @param object $course Course object
  * @param bool $withannotations If true, includes annotations
  * @param portfolio_format $portfolioformat Portfolio format
  * @param string $plugin the portfolio plugin being used.
  * @return string HTML code
  */
 public static function get_page_html($pageversion, $attachments, $context, $ouwiki, $subwiki, $course, $withannotations, portfolio_format $portfolioformat, $plugin)
 {
     global $DB;
     // Format the page body.
     $options = portfolio_format_text_options();
     $options->filter = true;
     $formattedtext = portfolio_rewrite_pluginfile_urls($pageversion->xhtml, $context->id, 'mod_ouwiki', 'content', $pageversion->versionid, $portfolioformat);
     $formattedtext = format_text($formattedtext, $pageversion->xhtmlformat, $options, $course->id);
     // Get annotations - only if using annotation system. prevents unnecessary db access.
     if ($ouwiki->annotation) {
         $annotations = ouwiki_get_annotations($pageversion);
     } else {
         $annotations = array();
     }
     // Convert or remove the annotations.
     if ($ouwiki->annotation && count($annotations)) {
         ouwiki_highlight_existing_annotations($formattedtext, $annotations, $withannotations ? 'portfolio' : 'clear');
     }
     // Do overall page, starting with title.
     $title = $pageversion->title;
     if ($title === '') {
         $title = get_string('startpage', 'ouwiki');
     }
     $output = html_writer::tag('h2', s($title));
     // Last change info.
     $user = new stdClass();
     foreach (explode(',', user_picture::fields()) as $field) {
         if ($field == 'id') {
             $user->id = $pageversion->userid;
         } else {
             $user->{$field} = $pageversion->{$field};
         }
     }
     $lastchange = get_string('lastchange', 'ouwiki', (object) array('date' => userdate($pageversion->timecreated), 'userlink' => ouwiki_display_user($user, $course->id)));
     $output .= html_writer::tag('p', html_writer::tag('small', html_writer::tag('i', $lastchange)));
     // Main text.
     $output .= html_writer::tag('div', $formattedtext);
     // Word count.
     if ($ouwiki->enablewordcount) {
         $wordcount = get_string('numwords', 'ouwiki', $pageversion->wordcount);
         $output .= html_writer::tag('div', html_writer::empty_tag('br'));
         $output .= html_writer::tag('p', html_writer::tag('small', $wordcount), array('class' => 'ouw_wordcount'));
     }
     // Attachments.
     if ($attachments[$pageversion->versionid]) {
         $output .= html_writer::start_tag('div', array('class' => 'attachments'));
         $output .= html_writer::tag('h3', get_string('attachments', 'ouwiki'));
         $output .= html_writer::start_tag('ul');
         foreach ($attachments[$pageversion->versionid] as $file) {
             if ($plugin == 'rtf') {
                 $filename = $file->get_filename();
                 $path = moodle_url::make_pluginfile_url($context->id, 'mod_ouwiki', 'attachment', $pageversion->versionid, '/', $filename, true);
                 $atag = html_writer::tag('a', $filename, array('href' => $path));
             } else {
                 $atag = $portfolioformat->file_output($file);
             }
             $output .= html_writer::tag('li', $atag);
         }
         $output .= html_writer::end_tag('ul');
         $output .= html_writer::end_tag('div');
     }
     // Replace all user links with user name so that you can not access user links from within exported document.
     $output = preg_replace('~<a href="[^"]*/user/view.php[^"]*"\\s*>(.*?)</a>~', '$1', $output);
     return $output;
 }
开发者ID:salmonmoose,项目名称:moodle-mod_ouwiki,代码行数:78,代码来源:locallib.php


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