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


PHP print_group_picture函数代码示例

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


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

示例1: replacements

 /**
  *
  */
 protected function replacements(array $patterns, $entry, array $options = null)
 {
     $field = $this->_field;
     $edit = !empty($options['edit']);
     // Set the group object.
     $group = new \stdClass();
     if ($entry->id < 0) {
         $entry->groupid = $field->df->currentgroup;
     }
     $group->id = $entry->groupid;
     $group->idnumber = isset($entry->groupidnumber) ? $entry->groupidnumber : null;
     $group->name = isset($entry->groupname) ? $entry->groupname : null;
     $group->hidepicture = isset($entry->grouphidepic) ? $entry->grouphidepic : null;
     $group->picture = isset($entry->grouppic) ? $entry->grouppic : null;
     $replacements = array();
     foreach ($patterns as $pattern) {
         $replacements[$pattern] = '';
         list(, $pvar, $part) = array_pad(explode(':', trim($pattern, '[]')), 3, null);
         switch ($pvar) {
             case 'id':
                 $replacements[$pattern] = $group->id ? $group->id : '0';
                 break;
             case 'idnumber':
                 $replacements[$pattern] = $group->idnumber;
                 break;
             case 'name':
                 $replacements[$pattern] = $group->name;
                 break;
             case 'description':
                 // Currently we do not fetch group description.
                 break;
             case 'picture':
                 $replacements[$pattern] = print_group_picture($group, $field->df->course->id, false, true);
                 break;
             case 'picturelarge':
                 $replacements[$pattern] = print_group_picture($group, $field->df->course->id, true, true);
                 break;
             case 'edit':
                 if ($edit and has_capability('mod/dataform:manageentries', $field->df->context)) {
                     $replacements[$pattern] = array(array($this, 'display_edit'), array($entry));
                 } else {
                     $replacements[$pattern] = $group->name;
                 }
                 break;
             case 'members':
                 $replacements[$pattern] = $this->render_browse_members($entry, array('part' => $part));
                 break;
         }
     }
     return $replacements;
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:54,代码来源:renderer.php

示例2: definition_after_data

 /**
  * Extend the form definition after the data has been parsed.
  */
 public function definition_after_data()
 {
     global $COURSE, $DB;
     $mform = $this->_form;
     $groupid = $mform->getElementValue('id');
     if ($group = $DB->get_record('groups', array('id' => $groupid))) {
         // Print picture.
         if (!($pic = print_group_picture($group, $COURSE->id, true, true, false))) {
             $pic = get_string('none');
             if ($mform->elementExists('deletepicture')) {
                 $mform->removeElement('deletepicture');
             }
         }
         $imageelement = $mform->getElement('currentpicture');
         $imageelement->setValue($pic);
     } else {
         if ($mform->elementExists('currentpicture')) {
             $mform->removeElement('currentpicture');
         }
         if ($mform->elementExists('deletepicture')) {
             $mform->removeElement('deletepicture');
         }
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:27,代码来源:group_form.php

示例3: print_group_picture

/**
 * Print a specified group's avatar.
 *
 * @param group $group A single {@link group} object OR array of groups.
 * @param int $courseid The course ID.
 * @param boolean $large Default small picture, or large.
 * @param boolean $return If false print picture, otherwise return the output as string
 * @param boolean $link Enclose image in a link to view specified course?
 * @return string
 * @todo Finish documenting this function
 */
function print_group_picture($group, $courseid, $large = false, $return = false, $link = true)
{
    global $CFG;
    if (is_array($group)) {
        $output = '';
        foreach ($group as $g) {
            $output .= print_group_picture($g, $courseid, $large, true, $link);
        }
        if ($return) {
            return $output;
        } else {
            echo $output;
            return;
        }
    }
    $context = get_context_instance(CONTEXT_COURSE, $courseid);
    if ($group->hidepicture and !has_capability('moodle/course:managegroups', $context)) {
        return '';
    }
    if ($link or has_capability('moodle/site:accessallgroups', $context)) {
        $output = '<a href="' . $CFG->wwwroot . '/user/index.php?id=' . $courseid . '&amp;group=' . $group->id . '">';
    } else {
        $output = '';
    }
    if ($large) {
        $file = 'f1';
    } else {
        $file = 'f2';
    }
    if ($group->picture) {
        // Print custom group picture
        require_once $CFG->libdir . '/filelib.php';
        $grouppictureurl = get_file_url($group->id . '/' . $file . '.jpg', null, 'usergroup');
        $output .= '<img class="grouppicture" src="' . $grouppictureurl . '"' . ' alt="' . s(get_string('group') . ' ' . $group->name) . '" title="' . s($group->name) . '"/>';
    }
    if ($link or has_capability('moodle/site:accessallgroups', $context)) {
        $output .= '</a>';
    }
    if ($return) {
        return $output;
    } else {
        echo $output;
    }
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:55,代码来源:weblib.php

示例4: fullname

     if (is_object($group) and groups_is_member($group->id, $user->id) or !is_object($group) and $group == 0 and in_array($user->id, $notingroup)) {
         // this is our fake group and this user is not a member of another group
         if (isset($form->mailto) && in_array($user->id, $form->mailto)) {
             $checked = 'checked="checked"';
         } else {
             $checked = '';
         }
         $cells[] = "<input type=\"checkbox\" {$checked} id=\"mailto{$t}\" value=\"{$user->id}\" name=\"mailto[{$user->id}]\" />" . "<label for=\"mailto{$t}\">" . fullname($user, true) . '</label>';
         $t++;
     }
 }
 $end = $t;
 // cell1 has the group picture, name and check button
 $cell1 = '';
 if ($group) {
     $cell1 .= print_group_picture($group, $course->id, false, true) . '<br />';
 }
 if ($group) {
     $cell1 .= groups_get_group_name($group->id);
 } else {
     $cell1 .= get_string('notingroup', 'block_quickmail');
 }
 if (count($groups) > 1 and !empty($cells)) {
     $selectlinks = '<a href="javascript:void(0);" onclick="block_quickmail_toggle(true, ' . $start . ', ' . $end . ');">' . get_string('selectall') . '</a> / 
                         <a href="javascript:void(0);" onclick="block_quickmail_toggle(false, ' . $start . ', ' . $end . ');">' . get_string('deselectall') . '</a>';
 } else {
     $selectlinks = '';
 }
 $buttoncount++;
 // cell2 has the checkboxes and the user names inside of a table
 if (empty($cells) and !$group) {
开发者ID:henriquecrang,项目名称:e-UNI,代码行数:31,代码来源:email.php

示例5: data_print_comment

function data_print_comment($data, $comment, $page = 0)
{
    global $USER, $CFG;
    $cm = get_coursemodule_from_instance('data', $data->id);
    $context = get_context_instance(CONTEXT_MODULE, $cm->id);
    $stredit = get_string('edit');
    $strdelete = get_string('delete');
    $user = get_record('user', 'id', $comment->userid);
    echo '<table cellspacing="0" align="center" width="50%" class="datacomment forumpost">';
    echo '<tr class="header"><td class="picture left">';
    print_user_picture($user, $data->course, $user->picture);
    echo '</td>';
    echo '<td class="topic starter" align="left"><div class="author">';
    $fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
    $by = new object();
    $by->name = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&amp;course=' . $data->course . '">' . $fullname . '</a>';
    $by->date = userdate($comment->modified);
    print_string('bynameondate', 'data', $by);
    echo '</div></td></tr>';
    echo '<tr><td class="left side">';
    if ($groups = groups_get_all_groups($data->course, $comment->userid, $cm->groupingid)) {
        print_group_picture($groups, $data->course, false, false, true);
    } else {
        echo '&nbsp;';
    }
    // Actual content
    echo '</td><td class="content" align="left">' . "\n";
    // Print whole message
    echo format_text($comment->content, $comment->format);
    // Commands
    echo '<div class="commands">';
    if (data_isowner($comment->recordid) or has_capability('mod/data:managecomments', $context)) {
        echo '<a href="' . $CFG->wwwroot . '/mod/data/comment.php?rid=' . $comment->recordid . '&amp;mode=edit&amp;commentid=' . $comment->id . '&amp;page=' . $page . '">' . $stredit . '</a>';
        echo '| <a href="' . $CFG->wwwroot . '/mod/data/comment.php?rid=' . $comment->recordid . '&amp;mode=delete&amp;commentid=' . $comment->id . '&amp;page=' . $page . '">' . $strdelete . '</a>';
    }
    echo '</div>';
    echo '</td></tr></table>' . "\n\n";
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:38,代码来源:lib.php

示例6: html_table

 if ($groupingid and $groupingid != $gpgid) {
     continue;
     // do not show
 }
 $table = new html_table();
 $table->head = array(get_string('groupscount', 'group', count($groupdata)), get_string('groupmembers', 'group'), get_string('usercount', 'group'));
 $table->size = array('20%', '70%', '10%');
 $table->align = array('left', 'left', 'center');
 $table->width = '90%';
 $table->data = array();
 foreach ($groupdata as $gpid => $users) {
     if ($groupid and $groupid != $gpid) {
         continue;
     }
     $line = array();
     $name = print_group_picture($groups[$gpid], $course->id, false, true, false) . format_string($groups[$gpid]->name);
     $description = file_rewrite_pluginfile_urls($groups[$gpid]->description, 'pluginfile.php', $context->id, 'group', 'description', $gpid);
     $options = new stdClass();
     $options->noclean = true;
     $options->overflowdiv = true;
     $jsdescription = trim(format_text($description, $groups[$gpid]->descriptionformat, $options));
     if (empty($jsdescription)) {
         $line[] = $name;
     } else {
         $line[] = html_writer::tag('span', $name, array('id' => 'group_' . $gpid));
         $hoverevents['group_' . $gpid] = $jsdescription;
     }
     $fullnames = array();
     foreach ($users as $user) {
         $fullnames[] = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&amp;course=' . $course->id . '">' . fullname($user, true) . '</a>';
     }
开发者ID:JP-Git,项目名称:moodle,代码行数:31,代码来源:overview.php

示例7: referentiel_make_mail_post


//.........这里部分代码省略.........
                    $groupname .= $groupe->name . ' ';
                }
            }
        }
        $strbynameondate = get_string('bynameondate', 'referentiel', $by);
        if (!empty($groupname)) {
            $strbynameondate .= ' - ' . get_string('groupe', 'referentiel', $groupname);
        }
        if (!isset($userto->viewfullnames[$post->id])) {
            $viewfullnames = has_capability('moodle/site:viewfullnames', $context, $userto->id);
        } else {
            $viewfullnames = $userto->viewfullnames[$post->id];
        }
        // format the post body
        $strreferentiel = get_string('referentiel', 'referentiel') . ' ' . referentiel_get_referentiel_name($post->ref_referentiel);
        $output = '<table border="0" cellpadding="3" cellspacing="0" class="forumpost">';
        $output .= '<tr class="header"><td width="35" valign="top" class="picture left">';
        if (!empty($userfrom->id)) {
            $output .= $OUTPUT->user_picture($userfrom, array('courseid' => $course->id, 'link' => true));
        }
        $output .= '</td>';
        $output .= '<td class="topic starter">';
        if ($type == TYPE_CERTIFICAT) {
            $output .= '<div class="subject">' . format_string(get_string('certificat', 'referentiel')) . '</div>';
            $output .= '<div class="author">' . $strbynameondate . '</div>';
            $output .= '</td></tr>';
            $output .= '<tr><td class="left side" valign="top">';
            if (isset($userfrom->groups)) {
                $groups = $userfrom->groups[$post->id];
            } else {
                $group = groups_get_all_groups($course->id, $userfrom->id);
            }
            if ($groups) {
                $output .= print_group_picture($groups, $course->id, false, true, true);
            } else {
                $output .= '&nbsp;';
            }
            $output .= '</td><td class="content">';
            $output .= "<hr>\n";
            $output .= trusttext_strip("<b>" . get_string('certificat', 'referentiel') . "</b> </i>" . $post->id . "</i>");
            $output .= "<br />";
            $la_liste_competences = referentiel_digest_competences_certificat($post->competences_certificat, $post->ref_referentiel, true);
            $output .= trusttext_strip($la_liste_competences);
            $output .= "<br />\n";
            if ($post->decision_jury) {
                $output .= trusttext_strip(get_string('decision_jury', 'referentiel') . ': ' . $post->decision_jury);
                if ($post->date_decision) {
                    $output .= ' ' . trusttext_strip(get_string('date_decision', 'referentiel') . ': ' . userdate($post->date_decision));
                }
                $output .= "<br />\n";
            }
            if ($post->teacherid) {
                $output .= trusttext_strip(get_string('referent', 'referentiel') . ': ' . referentiel_get_user_info($post->teacherid));
                if ($post->verrou) {
                    $output .= ' ' . trusttext_strip(get_string('verrou', 'referentiel'));
                }
                $output .= "<br />\n";
            }
            if ($post->commentaire_certificat) {
                $output .= trusttext_strip(get_string('commentaire', 'referentiel') . ': ' . $post->commentaire_certificat);
                $output .= "<br />\n";
            }
            if ($post->synthese_certificat) {
                $output .= trusttext_strip(get_string('synthese_certificat', 'referentiel') . ': ' . $post->synthese_certificat);
                $output .= "<br />\n";
            }
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:67,代码来源:lib_cron.php

示例8: lightboxgallery_print_comment

function lightboxgallery_print_comment($comment, $context)
{
    global $CFG, $COURSE;
    $user = get_record('user', 'id', $comment->userid);
    echo '<table cellspacing="0" width="50%" class="boxaligncenter datacomment forumpost">';
    echo '<tr class="header"><td class="picture left">' . print_user_picture($user, $COURSE->id, $user->picture, 0, true) . '</td>';
    echo '<td class="topic starter" align="left"><a name="c' . $comment->id . '"></a><div class="author">';
    echo '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&amp;course=' . $COURSE->id . '">' . fullname($user, has_capability('moodle/site:viewfullnames', $context)) . '</a> - ' . userdate($comment->timemodified);
    echo '</div></td></tr>';
    echo '<tr><td class="left side">';
    if ($groups = user_group($COURSE->id, $user->id)) {
        print_group_picture($groups, $COURSE->id, false, false, true);
    } else {
        echo '&nbsp;';
    }
    echo '</td><td class="content" align="left">';
    echo format_text($comment->comment, FORMAT_MOODLE);
    echo '<div class="commands">';
    if (has_capability('mod/lightboxgallery:edit', $context)) {
        echo '<a href="' . $CFG->wwwroot . '/mod/lightboxgallery/comment.php?id=' . $comment->gallery . '&amp;delete=' . $comment->id . '">' . get_string('delete') . '</a>';
    }
    echo '</div>';
    echo '</td></tr></table>';
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:24,代码来源:lib.php

示例9: print_group_picture

/**
 * Print a specified group's avatar.
 *
 * @global object
 * @uses CONTEXT_COURSE
 * @param array|stdClass $group A single {@link group} object OR array of groups.
 * @param int $courseid The course ID.
 * @param boolean $large Default small picture, or large.
 * @param boolean $return If false print picture, otherwise return the output as string
 * @param boolean $link Enclose image in a link to view specified course?
 * @return string|void Depending on the setting of $return
 */
function print_group_picture($group, $courseid, $large = false, $return = false, $link = true)
{
    global $CFG;
    if (is_array($group)) {
        $output = '';
        foreach ($group as $g) {
            $output .= print_group_picture($g, $courseid, $large, true, $link);
        }
        if ($return) {
            return $output;
        } else {
            echo $output;
            return;
        }
    }
    $context = get_context_instance(CONTEXT_COURSE, $courseid);
    // If there is no picture, do nothing
    if (!$group->picture) {
        return '';
    }
    // If picture is hidden, only show to those with course:managegroups
    if ($group->hidepicture and !has_capability('moodle/course:managegroups', $context)) {
        return '';
    }
    if ($link or has_capability('moodle/site:accessallgroups', $context)) {
        $output = '<a href="' . $CFG->wwwroot . '/user/index.php?id=' . $courseid . '&amp;group=' . $group->id . '">';
    } else {
        $output = '';
    }
    if ($large) {
        $file = 'f1';
    } else {
        $file = 'f2';
    }
    $grouppictureurl = moodle_url::make_pluginfile_url($context->id, 'group', 'icon', $group->id, '/', $file);
    $output .= '<img class="grouppicture" src="' . $grouppictureurl . '"' . ' alt="' . s(get_string('group') . ' ' . $group->name) . '" title="' . s($group->name) . '"/>';
    if ($link or has_capability('moodle/site:accessallgroups', $context)) {
        $output .= '</a>';
    }
    if ($return) {
        return $output;
    } else {
        echo $output;
    }
}
开发者ID:hatone,项目名称:moodle,代码行数:57,代码来源:weblib.php

示例10: display_group_pictures

 /**
  * Displays group pictures. This may make a (single) DB query if group
  * data has not yet been retrieved for this discussion.
  * @return string Group pictures HTML (empty string if none) for groups
  * that post author belongs to
  */
 public function display_group_pictures()
 {
     $groups = $this->discussion->get_user_groups($this->get_user()->id);
     if (count($groups) == 0) {
         return '';
     }
     return print_group_picture($groups, $this->get_forum()->get_course_id(), false, true);
 }
开发者ID:ULCC-QMUL,项目名称:moodle-mod_forumng,代码行数:14,代码来源:mod_forumng_post.php

示例11: quora_print_discussion_header

/**
 * This function prints the overview of a discussion in the quora listing.
 * It needs some discussion information and some post information, these
 * happen to be combined for efficiency in the $post parameter by the function
 * that calls this one: quora_print_latest_discussions()
 *
 * @global object
 * @global object
 * @param object $post The post object (passed by reference for speed).
 * @param object $quora The quora object.
 * @param int $group Current group.
 * @param string $datestring Format to use for the dates.
 * @param boolean $cantrack Is tracking enabled for this quora.
 * @param boolean $quoratracked Is the user tracking this quora.
 * @param boolean $canviewparticipants True if user has the viewparticipants permission for this course
 */
function quora_print_discussion_header(&$post, $quora, $group = -1, $datestring = "", $cantrack = true, $quoratracked = true, $canviewparticipants = true, $modcontext = NULL)
{
    global $COURSE, $USER, $CFG, $OUTPUT;
    static $rowcount;
    static $strmarkalldread;
    if (empty($modcontext)) {
        if (!($cm = get_coursemodule_from_instance('quora', $quora->id, $quora->course))) {
            print_error('invalidcoursemodule');
        }
        $modcontext = context_module::instance($cm->id);
    }
    if (!isset($rowcount)) {
        $rowcount = 0;
        $strmarkalldread = get_string('markalldread', 'quora');
    } else {
        $rowcount = ($rowcount + 1) % 2;
    }
    $post->subject = format_string($post->subject, true);
    echo "\n\n";
    echo '<tr class="discussion r' . $rowcount . '">';
    // Topic
    echo '<td class="topic starter">';
    echo '<a href="' . $CFG->wwwroot . '/mod/quora/discuss.php?d=' . $post->discussion . '">' . $post->subject . '</a>';
    echo "</td>\n";
    // Picture
    $postuser = new stdClass();
    $postuserfields = explode(',', user_picture::fields());
    $postuser = username_load_fields_from_object($postuser, $post, null, $postuserfields);
    $postuser->id = $post->userid;
    echo '<td class="picture">';
    echo $OUTPUT->user_picture($postuser, array('courseid' => $quora->course));
    echo "</td>\n";
    // User name
    $fullname = fullname($postuser, has_capability('moodle/site:viewfullnames', $modcontext));
    echo '<td class="author">';
    echo '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $post->userid . '&amp;course=' . $quora->course . '">' . $fullname . '</a>';
    echo "</td>\n";
    // Group picture
    if ($group !== -1) {
        // Groups are active - group is a group data object or NULL
        echo '<td class="picture group">';
        if (!empty($group->picture) and empty($group->hidepicture)) {
            if ($canviewparticipants && $COURSE->groupmode) {
                $picturelink = true;
            } else {
                $picturelink = false;
            }
            print_group_picture($group, $quora->course, false, false, $picturelink);
        } else {
            if (isset($group->id)) {
                if ($canviewparticipants && $COURSE->groupmode) {
                    echo '<a href="' . $CFG->wwwroot . '/user/index.php?id=' . $quora->course . '&amp;group=' . $group->id . '">' . $group->name . '</a>';
                } else {
                    echo $group->name;
                }
            }
        }
        echo "</td>\n";
    }
    if (has_capability('mod/quora:viewdiscussion', $modcontext)) {
        // Show the column with replies
        echo '<td class="replies">';
        echo '<a href="' . $CFG->wwwroot . '/mod/quora/discuss.php?d=' . $post->discussion . '">';
        echo $post->replies . '</a>';
        echo "</td>\n";
        if ($cantrack) {
            echo '<td class="replies">';
            if ($quoratracked) {
                if ($post->unread > 0) {
                    echo '<span class="unread">';
                    echo '<a href="' . $CFG->wwwroot . '/mod/quora/discuss.php?d=' . $post->discussion . '#unread">';
                    echo $post->unread;
                    echo '</a>';
                    echo '<a title="' . $strmarkalldread . '" href="' . $CFG->wwwroot . '/mod/quora/markposts.php?f=' . $quora->id . '&amp;d=' . $post->discussion . '&amp;mark=read&amp;returnpage=view.php">' . '<img src="' . $OUTPUT->pix_url('t/markasread') . '" class="iconsmall" alt="' . $strmarkalldread . '" /></a>';
                    echo '</span>';
                } else {
                    echo '<span class="read">';
                    echo $post->unread;
                    echo '</span>';
                }
            } else {
                echo '<span class="read">';
                echo '-';
                echo '</span>';
//.........这里部分代码省略.........
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:101,代码来源:lib.php

示例12: get_group_picture

 /**
  * The HTML for a group picture.
  *
  * @return string
  */
 public function get_group_picture()
 {
     if (isset($this->userfrom->groups)) {
         $groups = $this->userfrom->groups[$this->forum->id];
     } else {
         $groups = groups_get_all_groups($this->course->id, $this->author->id, $this->cm->groupingid);
     }
     if ($this->get_is_firstpost()) {
         return print_group_picture($groups, $this->course->id, false, true, true);
     }
 }
开发者ID:bewanyk,项目名称:moodle,代码行数:16,代码来源:forum_post.php

示例13: render_oublog_statsinfo

 /**
  * Renders the 'statsinfo' widget - info chart on a blog/post
  * @param oublog_statsinfo $info
  * @return string
  */
 public function render_oublog_statsinfo(oublog_statsinfo $info)
 {
     global $COURSE, $OUTPUT;
     $out = '';
     // Get the avatar picture for user/group.
     if (isset($info->user->courseid)) {
         // Group not user.
         if (!($userpic = print_group_picture($info->user, $info->user->courseid, true, true, false))) {
             // No group pic set, use default user image.
             $userpic = $OUTPUT->pix_icon('u/f2', '');
         }
     } else {
         $userpic = $this->output->user_picture($info->user, array('courseid' => $COURSE->id, 'link' => false));
     }
     $avatar = html_writer::link($info->url, $userpic, array('class' => 'oublog_statsinfo_avatar'));
     $infodiv = html_writer::start_div('oublog_statsinfo_infocol');
     if ($info->stat) {
         $infodiv .= html_writer::start_div('oublog_statsinfo_bar');
         $infodiv .= html_writer::tag('span', $info->stat, array('class' => 'percent_' . $info->percent));
         $infodiv .= html_writer::end_div();
     }
     $infodiv .= html_writer::div($info->label, 'oublog_statsinfo_label');
     $infodiv .= html_writer::end_div();
     $out = $avatar . $infodiv;
     return $this->output->container($out, 'oublog_statsinfo');
 }
开发者ID:nadavkav,项目名称:moodle-mod_oublog,代码行数:31,代码来源:renderer.php

示例14: anonforum_print_discussion_header

/**
 * This function prints the overview of a discussion in the anonforum listing.
 * It needs some discussion information and some post information, these
 * happen to be combined for efficiency in the $post parameter by the function
 * that calls this one: anonforum_print_latest_discussions()
 *
 * @global object
 * @global object
 * @param object $post The post object (passed by reference for speed).
 * @param object $anonforum The anonforum object.
 * @param int $group Current group.
 * @param string $datestring Format to use for the dates.
 * @param boolean $cantrack Is tracking enabled for this anonforum.
 * @param boolean $anonforumtracked Is the user tracking this anonforum.
 * @param boolean $canviewparticipants True if user has the viewparticipants permission for this course
 */
function anonforum_print_discussion_header(&$post, $anonforum, $group = -1, $datestring = "", $cantrack = true, $anonforumtracked = true, $canviewparticipants = true, $modcontext = NULL)
{
    global $USER, $CFG, $OUTPUT, $DB;
    static $rowcount;
    static $strmarkalldread;
    if (empty($modcontext)) {
        if (!($cm = get_coursemodule_from_instance('anonforum', $anonforum->id, $anonforum->course))) {
            print_error('invalidcoursemodule');
        }
        $modcontext = context_module::instance($cm->id);
    }
    if (!isset($rowcount)) {
        $rowcount = 0;
        $strmarkalldread = get_string('markalldread', 'anonforum');
    } else {
        $rowcount = ($rowcount + 1) % 2;
    }
    $post->subject = format_string($post->subject, true);
    echo "\n\n";
    echo '<tr class="discussion r' . $rowcount . '">';
    // Topic
    echo '<td class="topic starter">';
    echo '<a href="' . $CFG->wwwroot . '/mod/anonforum/discuss.php?d=' . $post->discussion . '">' . $post->subject . '</a>';
    echo "</td>\n";
    // Picture
    $postuser = new stdClass();
    if (empty($post->anonymouspost)) {
        $postuserfields = explode(',', user_picture::fields());
        $postuser = username_load_fields_from_object($postuser, $post, null, $postuserfields);
        $postuser->id = $post->userid;
        echo '<td class="picture">';
        echo $OUTPUT->user_picture($postuser, array('courseid' => $anonforum->course));
        echo "</td>\n";
        // User name
        $fullname = fullname($postuser, has_capability('moodle/site:viewfullnames', $modcontext));
        echo '<td class="author">';
        echo '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $post->userid . '&amp;course=' . $anonforum->course . '">' . $fullname . '</a>';
        echo "</td>\n";
    } else {
        $postuser->id = $post->userid;
        $postuser->firstname = get_string('anonymoususer', 'anonforum');
        $postuser->lastname = '';
        $postuser->imagealt = '';
        $postuser->picture = '';
        $postuser->email = '';
        $postuser->firstnamephonetic = '';
        $postuser->lastnamephonetic = '';
        $postuser->middlename = '';
        $postuser->alternatename = '';
        echo '<td class="picture">';
        echo anon_user_picture($postuser);
        echo "</td>\n";
        echo '<td class="author">';
        echo get_string('anonymoususer', 'anonforum');
        echo "</td>\n";
    }
    // Group picture
    if ($group !== -1) {
        // Groups are active - group is a group data object or NULL
        echo '<td class="picture group">';
        if (!empty($group->picture) and empty($group->hidepicture)) {
            print_group_picture($group, $anonforum->course, false, false, true);
        } else {
            if (isset($group->id)) {
                if ($canviewparticipants) {
                    echo '<a href="' . $CFG->wwwroot . '/user/index.php?id=' . $anonforum->course . '&amp;group=' . $group->id . '">' . $group->name . '</a>';
                } else {
                    echo $group->name;
                }
            }
        }
        echo "</td>\n";
    }
    if (has_capability('mod/anonforum:viewdiscussion', $modcontext)) {
        // Show the column with replies
        echo '<td class="replies">';
        echo '<a href="' . $CFG->wwwroot . '/mod/anonforum/discuss.php?d=' . $post->discussion . '">';
        echo $post->replies . '</a>';
        echo "</td>\n";
        if ($cantrack) {
            echo '<td class="replies">';
            if ($anonforumtracked) {
                if ($post->unread > 0) {
                    echo '<span class="unread">';
//.........这里部分代码省略.........
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:101,代码来源:lib.php

示例15: forum_print_discussion_header

/**
 * This function prints the overview of a discussion in the forum listing.
 * It needs some discussion information and some post information, these
 * happen to be combined for efficiency in the $post parameter by the function
 * that calls this one: forum_print_latest_discussions()
 *
 * @global object
 * @global object
 * @param object $post The post object (passed by reference for speed).
 * @param object $forum The forum object.
 * @param int $group Current group.
 * @param string $datestring Format to use for the dates.
 * @param boolean $cantrack Is tracking enabled for this forum.
 * @param boolean $forumtracked Is the user tracking this forum.
 * @param boolean $canviewparticipants True if user has the viewparticipants permission for this course
 * @param boolean $canviewhiddentimedposts True if user has the viewhiddentimedposts permission for this forum
 */
function forum_print_discussion_header(&$post, $forum, $group = -1, $datestring = "", $cantrack = true, $forumtracked = true, $canviewparticipants = true, $modcontext = null, $canviewhiddentimedposts = false)
{
    global $COURSE, $USER, $CFG, $OUTPUT, $PAGE;
    static $rowcount;
    static $strmarkalldread;
    if (empty($modcontext)) {
        if (!($cm = get_coursemodule_from_instance('forum', $forum->id, $forum->course))) {
            print_error('invalidcoursemodule');
        }
        $modcontext = context_module::instance($cm->id);
    }
    if (!isset($rowcount)) {
        $rowcount = 0;
        $strmarkalldread = get_string('markalldread', 'forum');
    } else {
        $rowcount = ($rowcount + 1) % 2;
    }
    $post->subject = format_string($post->subject, true);
    $timeddiscussion = !empty($CFG->forum_enabletimedposts) && ($post->timestart || $post->timeend);
    $timedoutsidewindow = '';
    if ($timeddiscussion && ($post->timestart > time() || $post->timeend != 0 && $post->timeend < time())) {
        $timedoutsidewindow = ' dimmed_text';
    }
    echo "\n\n";
    echo '<tr class="discussion r' . $rowcount . $timedoutsidewindow . '">';
    $topicclass = 'topic starter';
    if (FORUM_DISCUSSION_PINNED == $post->pinned) {
        $topicclass .= ' pinned';
    }
    echo '<td class="' . $topicclass . '">';
    if (FORUM_DISCUSSION_PINNED == $post->pinned) {
        echo $OUTPUT->pix_icon('i/pinned', get_string('discussionpinned', 'forum'), 'mod_forum');
    }
    $canalwaysseetimedpost = $USER->id == $post->userid || $canviewhiddentimedposts;
    if ($timeddiscussion && $canalwaysseetimedpost) {
        echo $PAGE->get_renderer('mod_forum')->timed_discussion_tooltip($post, empty($timedoutsidewindow));
    }
    echo '<a href="' . $CFG->wwwroot . '/mod/forum/discuss.php?d=' . $post->discussion . '">' . $post->subject . '</a>';
    echo "</td>\n";
    // Picture
    $postuser = new stdClass();
    $postuserfields = explode(',', user_picture::fields());
    $postuser = username_load_fields_from_object($postuser, $post, null, $postuserfields);
    $postuser->id = $post->userid;
    echo '<td class="picture">';
    echo $OUTPUT->user_picture($postuser, array('courseid' => $forum->course));
    echo "</td>\n";
    // User name
    $fullname = fullname($postuser, has_capability('moodle/site:viewfullnames', $modcontext));
    echo '<td class="author">';
    echo '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $post->userid . '&amp;course=' . $forum->course . '">' . $fullname . '</a>';
    echo "</td>\n";
    // Group picture
    if ($group !== -1) {
        // Groups are active - group is a group data object or NULL
        echo '<td class="picture group">';
        if (!empty($group->picture) and empty($group->hidepicture)) {
            if ($canviewparticipants && $COURSE->groupmode) {
                $picturelink = true;
            } else {
                $picturelink = false;
            }
            print_group_picture($group, $forum->course, false, false, $picturelink);
        } else {
            if (isset($group->id)) {
                if ($canviewparticipants && $COURSE->groupmode) {
                    echo '<a href="' . $CFG->wwwroot . '/user/index.php?id=' . $forum->course . '&amp;group=' . $group->id . '">' . $group->name . '</a>';
                } else {
                    echo $group->name;
                }
            }
        }
        echo "</td>\n";
    }
    if (has_capability('mod/forum:viewdiscussion', $modcontext)) {
        // Show the column with replies
        echo '<td class="replies">';
        echo '<a href="' . $CFG->wwwroot . '/mod/forum/discuss.php?d=' . $post->discussion . '">';
        echo $post->replies . '</a>';
        echo "</td>\n";
        if ($cantrack) {
            echo '<td class="replies">';
            if ($forumtracked) {
//.........这里部分代码省略.........
开发者ID:rezaies,项目名称:moodle,代码行数:101,代码来源:lib.php


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