mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Extended print_user_picture to support a pixel size in the old
$large = true/false field ... you can now specify an arbitrary size in there.
This commit is contained in:
parent
1313852db2
commit
4c6c0e01a2
1 changed files with 12 additions and 8 deletions
|
@ -1893,8 +1893,8 @@ function print_simple_box_end() {
|
||||||
* @param string $method ?
|
* @param string $method ?
|
||||||
* @todo Finish documenting this function
|
* @todo Finish documenting this function
|
||||||
*/
|
*/
|
||||||
function print_single_button($link, $options, $label='OK', $method='get') {
|
function print_single_button($link, $options, $label='OK', $method='get', $target='_self') {
|
||||||
echo '<form action="'. $link .'" method="'. $method .'">';
|
echo '<form action="'. $link .'" method="'. $method .'" target="'.$target.'">';
|
||||||
if ($options) {
|
if ($options) {
|
||||||
foreach ($options as $name => $value) {
|
foreach ($options as $name => $value) {
|
||||||
echo '<input type="hidden" name="'. $name .'" value="'. $value .'" />';
|
echo '<input type="hidden" name="'. $name .'" value="'. $value .'" />';
|
||||||
|
@ -1967,13 +1967,13 @@ function print_file_picture($path, $courseid=0, $height='', $width='', $link='')
|
||||||
* @param int $userid ?
|
* @param int $userid ?
|
||||||
* @param int $courseid ?
|
* @param int $courseid ?
|
||||||
* @param boolean $picture Print the user picture?
|
* @param boolean $picture Print the user picture?
|
||||||
* @param boolean $large Should the picture be printed at 100 pixels or 35?
|
* @param int $size Size in pixels. Special values are (true/1 = 100px) and (false/0 = 35px) for backward compatability
|
||||||
* @param boolean $returnstring If false print picture to current page, otherwise return the output as string
|
* @param boolean $returnstring If false print picture to current page, otherwise return the output as string
|
||||||
* @param boolean $link Enclose printed image in a link to view specified course?
|
* @param boolean $link Enclose printed image in a link to view specified course?
|
||||||
* return string
|
* return string
|
||||||
* @todo Finish documenting this function
|
* @todo Finish documenting this function
|
||||||
*/
|
*/
|
||||||
function print_user_picture($userid, $courseid, $picture, $large=false, $returnstring=false, $link=true) {
|
function print_user_picture($userid, $courseid, $picture, $size=0, $returnstring=false, $link=true) {
|
||||||
global $CFG;
|
global $CFG;
|
||||||
|
|
||||||
if ($link) {
|
if ($link) {
|
||||||
|
@ -1981,12 +1981,16 @@ function print_user_picture($userid, $courseid, $picture, $large=false, $returns
|
||||||
} else {
|
} else {
|
||||||
$output = '';
|
$output = '';
|
||||||
}
|
}
|
||||||
if ($large) {
|
if (empty($size)) {
|
||||||
$file = 'f1';
|
|
||||||
$size = 100;
|
|
||||||
} else {
|
|
||||||
$file = 'f2';
|
$file = 'f2';
|
||||||
$size = 35;
|
$size = 35;
|
||||||
|
} else if ($size === true or $size == 1) {
|
||||||
|
$file = 'f1';
|
||||||
|
$size = 100;
|
||||||
|
} else if ($size >= 50) {
|
||||||
|
$file = 'f1';
|
||||||
|
} else {
|
||||||
|
$file = 'f2';
|
||||||
}
|
}
|
||||||
if ($picture) { // Print custom user picture
|
if ($picture) { // Print custom user picture
|
||||||
if ($CFG->slasharguments) { // Use this method if possible for better caching
|
if ($CFG->slasharguments) { // Use this method if possible for better caching
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue