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


PHP portfolio_add_button::to_html方法代码示例

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


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

示例1: apply

 public function apply($discussion, $all, $selected, $formdata)
 {
     global $COURSE, $USER, $CFG;
     if (!$CFG->enableportfolios) {
         return '';
     }
     /*
      * It is necessary to encode the array of selected discussion posts as text in order to
      * pass the data in the button callback options because it gets filtered as PARAM_ALPHA
      */
     if (is_array($selected) && !empty($selected)) {
         $seltext = implode('x', $selected);
         $letters = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j');
         $posts = '';
         $selarray = str_split($seltext);
         foreach ($selarray as $char) {
             $posts .= $char == 'x' ? $char : $letters[$char];
         }
     } else {
         $posts = '';
     }
     // get the id of the forum
     $forumobj = $discussion->get_forum();
     $forumngid = $forumobj->get_id();
     require_once $CFG->libdir . '/portfoliolib.php';
     // check if the forum is shared and pass the cloneid in the callback options
     $linkparams = $discussion->get_link_params_array();
     if (array_key_exists('clone', $linkparams)) {
         $cloneid = $linkparams['clone'];
     } else {
         $cloneid = 0;
     }
     $button = new portfolio_add_button();
     $button->set_callback_options('forumng_all_portfolio_caller', array('forumngid' => $forumngid, 'cloneid' => $cloneid, 'posts' => $posts, 'discussionid' => $discussion->get_id()), 'mod_forumng');
     $button->set_formats(PORTFOLIO_FORMAT_PLAINHTML);
     // redirect to the export page
     redirect($button->to_html(PORTFOLIO_ADD_FAKE_URL));
 }
开发者ID:ULCC-QMUL,项目名称:moodle-mod_forumng,代码行数:38,代码来源:export.php

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

示例3: glossary_print_entry_icons

function glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode = '', $hook = '', $type = 'print')
{
    global $USER, $CFG, $DB;
    $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');
    }
    $return .= glossary_print_entry_commentslink($course, $cm, $glossary, $entry, $mode, $hook, 'html');
    if (has_capability('mod/glossary:comment', $context) and $glossary->allowcomments) {
        $output = true;
        $return .= ' <a title="' . get_string('addcomment', 'glossary') . '" href="comment.php?action=add&amp;entryid=' . $entry->id . '"><img src="comment.gif" class="iconsmall" alt="' . get_string('addcomment', 'glossary') . $altsuffix . '" /></a>';
    }
    if (has_capability('mod/glossary:manageentries', $context) or !empty($USER->id) and has_capability('mod/glossary:write', $context) and $entry->userid == $USER->id) {
        // 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="export.gif" class="iconsmall" alt="' . get_string('exporttomainglossary', 'glossary') . $altsuffix . '" /></a>';
            }
        }
        if ($entry->sourceglossaryid) {
            $icon = "minus.gif";
            // graphical metaphor (minus) for deleting an imported entry
        } else {
            $icon = "{$CFG->pixpath}/t/delete.gif";
        }
        //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=\"{$CFG->pixpath}/t/edit.gif\" class=\"iconsmall\" alt=\"" . get_string("edit") . $altsuffix . "\" /></a>";
        } elseif ($importedentry) {
            $return .= " <font size=\"-1\">" . get_string("exportedentry", "glossary") . "</font>";
        }
    }
    if (has_capability('mod/glossary:exportentry', $context) || $entry->userid == $USER->id && has_capability('mod/glossary:exportownentry', $context)) {
        $button = new portfolio_add_button();
        $button->set_callback_options('glossary_entry_portfolio_caller', array('id' => $cm->id, 'entryid' => $entry->id));
        $return .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
    }
    $return .= "&nbsp;&nbsp;";
    // just to make up a little the output in Mozilla ;)
    $return .= '</span>';
    //If we haven't calculated any REAL thing, delete result ($return)
    if (!$output) {
        $return = '';
    }
    //Print or get
    if ($type == 'print') {
        echo $return;
    } else {
        return $return;
    }
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:69,代码来源:lib.php

示例4: trim

                if (empty($data->listtemplate)) {
                    echo $OUTPUT->notification(get_string('nolisttemplate', 'data'));
                    data_generate_default_template($data, 'listtemplate', 0, false, false);
                }
                echo $data->listtemplateheader;
                data_print_template('listtemplate', $records, $data, $search, $page);
                echo $data->listtemplatefooter;
                echo $OUTPUT->paging_bar($totalcount, $page, $nowperpage, $baseurl);
            }
        }
    }
    $search = trim($search);
    if (empty($records)) {
        $records = array();
    }
    if ($mode == '' && !empty($CFG->enableportfolios)) {
        require_once $CFG->libdir . '/portfoliolib.php';
        $button = new portfolio_add_button();
        $button->set_callback_options('data_portfolio_caller', array('id' => $cm->id), '/mod/data/locallib.php');
        if (data_portfolio_caller::has_files($data)) {
            $button->set_formats(array(PORTFOLIO_FORMAT_RICHHTML, PORTFOLIO_FORMAT_LEAP2A));
            // no plain html for us
        }
        echo $button->to_html(PORTFOLIO_ADD_FULL_FORM);
    }
    //Advanced search form doesn't make sense for single (redirects list view)
    if (($maxcount || $mode == 'asearch') && $mode != 'single') {
        data_print_preference_form($data, $perpage, $search, $sort, $order, $search_array, $advanced, $mode);
    }
}
echo $OUTPUT->footer();
开发者ID:hatone,项目名称:moodle,代码行数:31,代码来源:view.php

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

示例6: data_print_template

/**
 * takes a list of records, the current data, a search string,
 * and mode to display prints the translated template
 *
 * @global object
 * @global object
 * @param string $template
 * @param array $records
 * @param object $data
 * @param string $search
 * @param int $page
 * @param bool $return
 * @return mixed
 */
function data_print_template($template, $records, $data, $search='', $page=0, $return=false) {
    global $CFG, $DB, $OUTPUT;
    $cm = get_coursemodule_from_instance('data', $data->id);
    $context = get_context_instance(CONTEXT_MODULE, $cm->id);

    static $fields = NULL;
    static $isteacher;
    static $dataid = NULL;

    if (empty($dataid)) {
        $dataid = $data->id;
    } else if ($dataid != $data->id) {
        $fields = NULL;
    }

    if (empty($fields)) {
        $fieldrecords = $DB->get_records('data_fields', array('dataid'=>$data->id));
        foreach ($fieldrecords as $fieldrecord) {
            $fields[]= data_get_field($fieldrecord, $data);
        }
        $isteacher = has_capability('mod/data:managetemplates', $context);
    }

    if (empty($records)) {
        return;
    }

    foreach ($records as $record) {   // Might be just one for the single template

    // Replacing tags
        $patterns = array();
        $replacement = array();

    // Then we generate strings to replace for normal tags
        foreach ($fields as $field) {
            $patterns[]='[['.$field->field->name.']]';
            $replacement[] = highlight($search, $field->display_browse_field($record->id, $template));
        }

    // Replacing special tags (##Edit##, ##Delete##, ##More##)
        $patterns[]='##edit##';
        $patterns[]='##delete##';
        if (has_capability('mod/data:manageentries', $context) or data_isowner($record->id)) {
            $replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/edit.php?d='
                             .$data->id.'&amp;rid='.$record->id.'&amp;sesskey='.sesskey().'"><img src="'.$OUTPUT->pix_url('t/edit') . '" class="iconsmall" alt="'.get_string('edit').'" title="'.get_string('edit').'" /></a>';
            $replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/view.php?d='
                             .$data->id.'&amp;delete='.$record->id.'&amp;sesskey='.sesskey().'"><img src="'.$OUTPUT->pix_url('t/delete') . '" class="iconsmall" alt="'.get_string('delete').'" title="'.get_string('delete').'" /></a>';
        } else {
            $replacement[] = '';
            $replacement[] = '';
        }

        $moreurl = $CFG->wwwroot . '/mod/data/view.php?d=' . $data->id . '&amp;rid=' . $record->id;
        if ($search) {
            $moreurl .= '&amp;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);
//.........这里部分代码省略.........
开发者ID:nottmoo,项目名称:moodle,代码行数:101,代码来源:lib.php

示例7: referentiel_menu_certificat

function referentiel_menu_certificat($context, $certificat_id, $referentiel_instance_id, $verrou, $userid = 0, $select_acc = 0, $rang = 0, $dossier_ferme)
{
    global $CFG;
    global $OUTPUT;
    global $USER;
    $s = "";
    $s .= '<tr valign="top">';
    $s .= '<td align="center" colspan="6">' . "\n";
    $s .= '&nbsp; <a href="' . $CFG->wwwroot . '/mod/referentiel/certificat.php?d=' . $referentiel_instance_id . '&amp;select_acc=' . $select_acc . '&amp;certificat_id=' . $certificat_id . '&amp;userid=' . $userid . '&amp;mode=listcertifsingle&amp;sesskey=' . sesskey() . '#certificat_' . $certificat_id . '"><img src="' . $OUTPUT->pix_url('search', 'referentiel') . '" alt="' . get_string('plus', 'referentiel') . '" title="' . get_string('plus', 'referentiel') . '" /></a>' . "\n";
    if (!$dossier_ferme) {
        $s .= '&nbsp; <a href="' . $CFG->wwwroot . '/mod/referentiel/certificat.php?d=' . $referentiel_instance_id . '&amp;select_acc=' . $select_acc . '&amp;certificat_id=' . $certificat_id . '&amp;userid=' . $userid . '&amp;mode=updatecertif&amp;sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('/t/edit') . '" alt="' . get_string('edit') . '" title="' . get_string('edit') . '" /></a>' . "\n";
    }
    if (has_capability('mod/referentiel:comment', $context) && !$dossier_ferme) {
        //		or referentiel_certificat_isowner($certificat_id)) {
        $s .= '&nbsp; <a href="' . $CFG->wwwroot . '/mod/referentiel/certificat.php?d=' . $referentiel_instance_id . '&amp;select_acc=' . $select_acc . '&amp;certificat_id=' . $certificat_id . '&amp;userid=' . $userid . '&amp;mode=commentcertif&amp;sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('feedback', 'referentiel') . '" alt="' . get_string('comment', 'referentiel') . '" title="' . get_string('comment', 'referentiel') . '" /></a>' . "\n";
    }
    if (has_capability('mod/referentiel:managecertif', $context)) {
        $s .= '&nbsp; <a href="' . $CFG->wwwroot . '/mod/referentiel/certificat.php?d=' . $referentiel_instance_id . '&amp;select_acc=' . $select_acc . '&amp;certificat_id=' . $certificat_id . '&amp;userid=' . $userid . '&amp;mode=deletecertif&amp;sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('/t/delete') . '" alt="' . get_string('certificat_initialiser', 'referentiel') . '" title="' . get_string('certificat_initialiser', 'referentiel') . '" /></a>' . "\n";
        if (!$dossier_ferme) {
            if ($verrou) {
                $s .= '&nbsp; <a href="' . $CFG->wwwroot . '/mod/referentiel/certificat.php?d=' . $referentiel_instance_id . '&amp;select_acc=' . $select_acc . '&amp;certificat_id=' . $certificat_id . '&amp;userid=' . $userid . '&amp;mode=deverrouiller&amp;sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('/t/go') . '" alt="' . get_string('deverrouiller', 'referentiel') . '" title="' . get_string('deverrouiller', 'referentiel') . '" /></a>' . "\n";
            } else {
                $s .= '&nbsp; <a href="' . $CFG->wwwroot . '/mod/referentiel/certificat.php?d=' . $referentiel_instance_id . '&amp;select_acc=' . $select_acc . '&amp;certificat_id=' . $certificat_id . '&amp;userid=' . $userid . '&amp;mode=verrouiller&amp;sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('/t/stop') . '" alt="' . get_string('verrouiller', 'referentiel') . '" title="' . get_string('verrouiller', 'referentiel') . '" /></a>' . "\n";
            }
            $s .= '&nbsp; <a href="' . $CFG->wwwroot . '/mod/referentiel/certificat.php?d=' . $referentiel_instance_id . '&amp;select_acc=' . $select_acc . '&amp;certificat_id=' . $certificat_id . '&amp;userid=' . $userid . '&amp;mode=clorecertificat&amp;sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('cadenas_f', 'referentiel') . '" alt="' . get_string('c_clore', 'referentiel') . '" title="' . get_string('c_clore', 'referentiel') . '" /></a>' . "\n";
        } else {
            $s .= '&nbsp; <a href="' . $CFG->wwwroot . '/mod/referentiel/certificat.php?d=' . $referentiel_instance_id . '&amp;select_acc=' . $select_acc . '&amp;certificat_id=' . $certificat_id . '&amp;userid=' . $userid . '&amp;mode=ouvrircertificat&amp;sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('cadenas_o', 'referentiel') . '" alt="' . get_string('c_ouvrir', 'referentiel') . '" title="' . get_string('c_ouvrir', 'referentiel') . '" /></a>' . "\n";
        }
        if (referentiel_site_can_print_referentiel($referentiel_instance_id)) {
            $s .= '&nbsp; <a href="' . $CFG->wwwroot . '/mod/referentiel/print_certificat.php?d=' . $referentiel_instance_id . '&amp;select_acc=' . $select_acc . '&amp;certificat_id=' . $certificat_id . '&amp;userid=' . $userid . '&amp;mode=printcertif&amp;sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('printer', 'referentiel') . '" alt="' . get_string('print', 'referentiel') . '" title="' . get_string('print', 'referentiel') . '" /></a>' . "\n";
        }
    }
    // Portofolio
    if (!empty($CFG->enableportfolios)) {
        require_once $CFG->libdir . '/portfoliolib.php';
        // Mahara export stuff
        $button = new portfolio_add_button();
        // Version anterieure à Moodle 2.4
        // $button->set_callback_options('referentiel_portfolio_caller',
        //            array('instanceid' => $referentiel_instance_id, 'certificatid' => $certificat_id, 'report' => 0, 'export_format' => ''), '/mod/referentiel/portfolio/mahara/locallib_portfolio.php');
        // Version Moodle 2.4
        $button->set_callback_options('referentiel_portfolio_caller', array('instanceid' => $referentiel_instance_id, 'certificatid' => $certificat_id, 'report' => 0, 'export_format' => ''), 'mod_referentiel');
        $button->set_formats(array(PORTFOLIO_FORMAT_PLAINHTML, PORTFOLIO_FORMAT_LEAP2A));
        $s .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
        // Mahara ATranscript stuff
        // Ne pas activer pour le moment (juin 2012) car le developpement n'est pas achevé
        if (MAHARA_ARTEFACT_ATRANSCRIPT) {
            $button = new portfolio_add_button();
            // Version antérieure à Moodle 2.4
            //            $button->set_callback_options('atranscript_portfolio_caller',
            //                array('instanceid' => $referentiel_instance_id, 'userid' => $USER->id, 'certificatid' => $certificat_id, 'export_format' => PORTFOLIO_FORMAT_LEAP2A), '/mod/referentiel/portfolio/mahara/atranscript_artefact/locallib_portfolio.php');
            // Version  Moodle 2.4
            $button->set_callback_options('atranscript_portfolio_caller', array('instanceid' => $referentiel_instance_id, 'userid' => $USER->id, 'certificatid' => $certificat_id, 'export_format' => PORTFOLIO_FORMAT_LEAP2A), 'mod_referentiel');
            $button->set_formats(array(PORTFOLIO_FORMAT_LEAP2A));
            $s .= $button->to_html(PORTFOLIO_ADD_ICON_LINK, get_string('atranscript', 'referentiel'));
            // $s.=$button->to_html(PORTFOLIO_ADD_TEXT_LINK);
        }
    }
    $s .= '</td></tr>' . "\n";
    if ($rang % 2 == 0) {
        $s .= '<td class="couleur_paire" heigth="4" colspan="6"></td>' . "\n";
    } else {
        $s .= '<td class="couleur_impaire" heigth="4" colspan="6"></td>' . "\n";
    }
    return $s;
}
开发者ID:jfruitet,项目名称:moodle_referentiel,代码行数:66,代码来源:print_lib_certificat.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: array

        } else {
            $canaudit = 0;
        }
        if (empty($oubloguser->id)) {
            $oubloguser->id = 0;
        }
        $tagid = null;
        if (!is_null($tag)) {
            // Make tag work with portfolio param cleaning by looking up id.
            if ($tagrec = $DB->get_record('oublog_tags', array('tag' => $tag), 'id')) {
                $tagid = $tagrec->id;
            }
        }
        $button = new portfolio_add_button();
        $button->set_callback_options('oublog_all_portfolio_caller', array('postid' => $post->id, 'oublogid' => $oublog->id, 'offset' => $offset, 'currentgroup' => $currentgroup, 'currentindividual' => $currentindividual, 'oubloguserid' => $oubloguser->id, 'canaudit' => $canaudit, 'tag' => $tagid, 'cmid' => $cm->id), 'mod_oublog');
        echo $button->to_html(PORTFOLIO_ADD_TEXT_LINK) . get_string('exportpostscomments', 'oublog');
    }
    echo '</div>';
}
// Print information allowing the user to log in if necessary, or letting
// them know if there are no posts in the blog.
if (isguestuser() && $USER->id == $user) {
    print '<p class="oublog_loginnote">' . get_string('guestblog', 'oublog', 'bloglogin.php?returnurl=' . urlencode($returnurl)) . '</p>';
} else {
    if (!isloggedin() || isguestuser()) {
        print '<p class="oublog_loginnote">' . get_string('maybehiddenposts', 'oublog', (object) array('link' => 'bloglogin.php?returnurl=' . urlencode($returnurl), 'name' => oublog_get_displayname($oublog))) . '</p>';
    } else {
        if (!$posts) {
            print '<p class="oublog_noposts">' . get_string('noposts', 'oublog', oublog_get_displayname($oublog)) . '</p>';
        }
    }
开发者ID:nadavkav,项目名称:moodle-mod_oublog,代码行数:31,代码来源:view.php

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

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

示例12: post_get_commands

 /**
  * @param stdClass $post
  * @param stdClass $discussion
  * @param stdClass $cm
  * @param bool $canreply
  * @return array
  * @throws coding_exception
  * @author Mark Nielsen
  */
 public function post_get_commands($post, $discussion, $cm, $canreply)
 {
     global $CFG, $USER;
     $discussionlink = new moodle_url('/mod/hsuforum/discuss.php', array('d' => $post->discussion));
     $ownpost = (isloggedin() and $post->userid == $USER->id);
     $commands = array();
     if (!property_exists($post, 'privatereply')) {
         throw new coding_exception('Must set post\'s privatereply property!');
     }
     $forum = hsuforum_get_cm_forum($cm);
     if ($canreply and empty($post->privatereply)) {
         $postuser = hsuforum_extract_postuser($post, $forum, context_module::instance($cm->id));
         $replytitle = get_string('replybuttontitle', 'hsuforum', strip_tags($postuser->fullname));
         $commands['reply'] = html_writer::link(new moodle_url('/mod/hsuforum/post.php', array('reply' => $post->id)), get_string('reply', 'hsuforum'), array('title' => $replytitle, 'class' => 'hsuforum-reply-link btn btn-default'));
     }
     // Hack for allow to edit news posts those are not displayed yet until they are displayed
     $age = time() - $post->created;
     if (!$post->parent && $forum->type == 'news' && $discussion->timestart > time()) {
         $age = 0;
     }
     if ($ownpost && $age < $CFG->maxeditingtime || local::cached_has_capability('mod/hsuforum:editanypost', context_module::instance($cm->id))) {
         $commands['edit'] = html_writer::link(new moodle_url('/mod/hsuforum/post.php', array('edit' => $post->id)), get_string('edit', 'hsuforum'));
     }
     if ($ownpost && $age < $CFG->maxeditingtime && local::cached_has_capability('mod/hsuforum:deleteownpost', context_module::instance($cm->id)) || local::cached_has_capability('mod/hsuforum:deleteanypost', context_module::instance($cm->id))) {
         $commands['delete'] = html_writer::link(new moodle_url('/mod/hsuforum/post.php', array('delete' => $post->id)), get_string('delete', 'hsuforum'));
     }
     if (local::cached_has_capability('mod/hsuforum:splitdiscussions', context_module::instance($cm->id)) && $post->parent && !$post->privatereply && $forum->type != 'single') {
         $commands['split'] = html_writer::link(new moodle_url('/mod/hsuforum/post.php', array('prune' => $post->id)), get_string('prune', 'hsuforum'), array('title' => get_string('pruneheading', 'hsuforum')));
     }
     if ($CFG->enableportfolios && empty($forum->anonymous) && (local::cached_has_capability('mod/hsuforum:exportpost', context_module::instance($cm->id)) || $ownpost && local::cached_has_capability('mod/hsuforum:exportownpost', context_module::instance($cm->id)))) {
         require_once $CFG->libdir . '/portfoliolib.php';
         $button = new portfolio_add_button();
         $button->set_callback_options('hsuforum_portfolio_caller', array('postid' => $post->id), 'mod_hsuforum');
         list($attachments, $attachedimages) = hsuforum_print_attachments($post, $cm, 'separateimages');
         if (empty($attachments)) {
             $button->set_formats(PORTFOLIO_FORMAT_PLAINHTML);
         } else {
             $button->set_formats(PORTFOLIO_FORMAT_RICHHTML);
         }
         $porfoliohtml = $button->to_html(PORTFOLIO_ADD_TEXT_LINK);
         if (!empty($porfoliohtml)) {
             $commands['portfolio'] = $porfoliohtml;
         }
     }
     $rating = $this->post_rating($post);
     if (!empty($rating)) {
         $commands['rating'] = $rating;
     }
     return $commands;
 }
开发者ID:cdsmith-umn,项目名称:moodle-mod_hsuforum,代码行数:59,代码来源:renderer.php

示例13: 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;
     $mode = optional_param('mode', '', PARAM_ALPHA);
     $offset = optional_param('offset', 0, PARAM_INT);
     if (!$userid) {
         if (!isloggedin()) {
             return '';
         }
         $userid = $USER->id;
     }
     $output = '';
     $submission = $this->get_submission($userid);
     $candelete = $this->can_delete_files($submission);
     $strdelete = get_string('delete');
     if ($this->drafts_tracked() and $this->isopen() and !$this->is_finalized($submission) and !empty($mode)) {
         // only during grading
         $output .= '<strong>' . get_string('draft', 'assignment') . ':</strong><br />';
     }
     if ($this->notes_allowed() and !empty($submission->data1) and !empty($mode)) {
         // only during grading
         $npurl = $CFG->wwwroot . "/mod/assignment/type/upload/notes.php?id={$this->cm->id}&amp;userid={$userid}&amp;offset={$offset}&amp;mode=single";
         $output .= '<a href="' . $npurl . '">' . get_string('notes', 'assignment') . '</a><br />';
     }
     $fs = get_file_storage();
     $browser = get_file_browser();
     if ($files = $fs->get_area_files($this->context->id, 'assignment_submission', $userid, "timemodified", false)) {
         $button = new portfolio_add_button();
         foreach ($files as $file) {
             $filename = $file->get_filename();
             $mimetype = $file->get_mimetype();
             $icon = mimeinfo_from_type('icon', $mimetype);
             $path = $browser->encodepath($CFG->wwwroot . '/pluginfile.php', '/' . $this->context->id . '/assignment_submission/' . $userid . '/' . $filename);
             $output .= '<a href="' . $path . '" ><img src="' . $CFG->pixpath . '/f/' . $icon . '" class="icon" alt="' . $icon . '" />' . s($filename) . '</a>';
             if ($candelete) {
                 $delurl = "{$CFG->wwwroot}/mod/assignment/delete.php?id={$this->cm->id}&amp;file=" . rawurlencode($filename) . "&amp;userid={$submission->userid}&amp;mode={$mode}&amp;offset={$offset}";
                 $output .= '<a href="' . $delurl . '">&nbsp;' . '<img title="' . $strdelete . '" src="' . $CFG->pixpath . '/t/delete.gif" class="iconsmall" alt="" /></a> ';
             }
             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/lib.php');
                 $button->set_formats(portfolio_format_from_file($file));
                 $output .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
             }
             $output .= '<br />';
         }
         if (count($files) > 1 && has_capability('mod/assignment:exportownsubmission', $this->context)) {
             $button->set_callback_options('assignment_portfolio_caller', array('id' => $this->cm->id), '/mod/assignment/lib.php');
             $button->set_formats(PORTFOLIO_FORMAT_FILE);
             $output .= $button->to_html();
         }
     }
     if ($this->drafts_tracked() and $this->isopen() and has_capability('mod/assignment:grade', $this->context) and $mode != '') {
         // we do not want it on view.php page
         if ($this->can_unfinalize($submission)) {
             $options = array('id' => $this->cm->id, 'userid' => $userid, 'action' => 'unfinalize', 'mode' => $mode, 'offset' => $offset);
             $output .= print_single_button('upload.php', $options, get_string('unfinalize', 'assignment'), 'post', '_self', true);
         } else {
             if ($this->can_finalize($submission)) {
                 $options = array('id' => $this->cm->id, 'userid' => $userid, 'action' => 'finalizeclose', 'mode' => $mode, 'offset' => $offset);
                 $output .= print_single_button('upload.php', $options, get_string('finalize', 'assignment'), 'post', '_self', true);
             }
         }
     }
     $output = '<div class="files">' . $output . '</div>';
     if ($return) {
         return $output;
     }
     echo $output;
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:76,代码来源:assignment.class.php

示例14: render_export_all_li

 /**
  * Renders the 'export entire wiki' link.
  *
  * @param object $subwiki Subwiki data object
  * @param bool $anyfiles True if any page of subwiki contains files
  * @param array $wikiparamsarray associative array
  * @return string HTML content of list item with link, or nothing if none
  */
 public function render_export_all_li($subwiki, $anyfiles, $wikiparamsarray)
 {
     global $CFG;
     if (!$CFG->enableportfolios) {
         return '';
     }
     $button = new portfolio_add_button();
     $button->set_callback_options('ouwiki_all_portfolio_caller', $wikiparamsarray, 'mod_ouwiki');
     if ($anyfiles) {
         $button->set_formats(PORTFOLIO_FORMAT_PLAINHTML);
     } else {
         $button->set_formats(PORTFOLIO_FORMAT_RICHHTML);
     }
     return html_writer::tag('li', $button->to_html(PORTFOLIO_ADD_TEXT_LINK));
 }
开发者ID:salmonmoose,项目名称:moodle-mod_ouwiki,代码行数:23,代码来源:renderer.php

示例15: render_post


//.........这里部分代码省略.........
             }
             if (!$forexport && !$email) {
                 $output .= html_writer::tag('a', $taglinktext, array('href' => $baseurl . '&tag=' . urlencode($taglink))) . ' ';
             } else {
                 $output .= $taglinktext . ' ';
             }
             $tagcounter++;
         }
         $output .= html_writer::end_tag('div');
     }
     $output .= html_writer::start_tag('div', array('class' => 'oublog-post-links'));
     if (!$forexport && !$email) {
         $output .= html_writer::tag('a', $strpermalink, array('href' => $CFG->wwwroot . '/mod/oublog/viewpost.php?post=' . $post->id)) . ' ';
     }
     if (!$post->deletedby) {
         if ($post->userid == $USER->id || $canmanageposts) {
             if (!$forexport && !$email) {
                 $output .= html_writer::tag('a', $stredit, array('href' => $CFG->wwwroot . '/mod/oublog/editpost.php?blog=' . $post->oublogid . '&post=' . $post->id)) . ' ';
                 if ($post->userid !== $USER->id) {
                     // Add email and 'oublog_deleteandemail' to delete link.
                     $output .= html_writer::tag('a', $strdelete, array('href' => $CFG->wwwroot . '/mod/oublog/deletepost.php?blog=' . $post->oublogid . '&post=' . $post->id . '&delete=1', 'class' => 'oublog_deleteandemail_' . $post->id));
                     self::render_oublog_print_delete_dialog($cm->id, $post->id);
                 } else {
                     $output .= html_writer::tag('a', $strdelete, array('href' => $CFG->wwwroot . '/mod/oublog/deletepost.php?blog=' . $post->oublogid . '&post=' . $post->id . '&delete=1'));
                 }
             }
         }
         // Show portfolio export link.
         if (!empty($CFG->enableportfolios) && (has_capability('mod/oublog:exportpost', $modcontext) || $post->userid == $USER->id && has_capability('mod/oublog:exportownpost', $modcontext))) {
             if (!$forexport && !$email) {
                 require_once $CFG->libdir . '/portfoliolib.php';
                 $button = new portfolio_add_button();
                 $button->set_callback_options('oublog_portfolio_caller', array('postid' => $post->id), 'mod_oublog');
                 if (empty($files)) {
                     $button->set_formats(PORTFOLIO_FORMAT_PLAINHTML);
                 } else {
                     $button->set_formats(PORTFOLIO_FORMAT_RICHHTML);
                 }
                 $output .= $button->to_html(PORTFOLIO_ADD_TEXT_LINK) . ' ';
             }
         }
         // Show OU Alerts reporting link.
         if (isloggedin() && oublog_oualerts_enabled() && oublog_get_reportingemail($oublog) && !($post->userid == $USER->id) && !$post->deletedby) {
             $itemnurl = new moodle_url('/mod/oublog/viewpost.php', array('post' => $post->id));
             $reportlink = oualerts_generate_alert_form_url('oublog', $modcontext->id, 'post', $post->id, $itemnurl, $itemnurl, '', false, true);
             if ($reportlink != '' && !$forexport && !$email) {
                 $output .= html_writer::tag('a', get_string('postalert', 'oublog'), array('href' => $reportlink));
             }
         }
         // Show comments.
         if ($post->allowcomments) {
             // If this is the current user's post, show pending comments too.
             $showpendingcomments = $post->userid == $USER->id && !empty($post->pendingcomments);
             if ((isset($post->comments) || $showpendingcomments) && $commentcount) {
                 // Show number of comments.
                 if (isset($post->comments)) {
                     $linktext = get_string(count($post->comments) == 1 ? 'onecomment' : 'ncomments', 'oublog', count($post->comments));
                 }
                 // Show number of pending comments.
                 if (isset($post->pendingcomments)) {
                     // Use different string if we already have normal comments too.
                     if (isset($post->comments)) {
                         $linktext .= get_string($post->pendingcomments == 1 ? 'onependingafter' : 'npendingafter', 'oublog', $post->pendingcomments);
                     } else {
                         $linktext = get_string($post->pendingcomments == 1 ? 'onepending' : 'npending', 'oublog', $post->pendingcomments);
                     }
                 }
                 if (!$forexport) {
                     // Display link.
                     $output .= html_writer::tag('a', $linktext, array('href' => $CFG->wwwroot . '/mod/oublog/viewpost.php?post=' . $post->id . '#oublogcomments'));
                 } else {
                     $output .= $linktext;
                 }
                 // Display information about most recent comment.
                 if (isset($post->comments)) {
                     $last = array_pop($post->comments);
                     array_push($post->comments, $last);
                     $a = new stdClass();
                     if ($last->userid) {
                         $a->fullname = fullname($last);
                     } else {
                         $a->fullname = s($last->authorname);
                     }
                     $a->timeposted = oublog_date($last->timeposted, true);
                     $output .= ' ' . get_string('lastcomment', 'oublog', $a);
                 }
             } else {
                 if (oublog_can_comment($cm, $oublog, $post)) {
                     if (!$forexport && !$email) {
                         $output .= html_writer::tag('a', $strcomment, array('href' => $CFG->wwwroot . '/mod/oublog/editcomment.php?blog=' . $post->oublogid . '&post=' . $post->id));
                     }
                 }
             }
         }
     }
     $output .= html_writer::end_tag('div');
     $output .= html_writer::end_tag('div');
     $output .= html_writer::end_tag('div');
     return $output;
 }
开发者ID:nadavkav,项目名称:moodle-mod_oublog,代码行数:101,代码来源:renderer.php


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