diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-08-22 23:15:43 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-08-22 23:15:43 +0000 |
commit | 60c1387a16ea4944674b0c9da2273158d1fbf0b4 (patch) | |
tree | 6f94aaf77a7d794f489212ff50f08f5211a18126 /mod/friends/views/default/widgets | |
parent | ca08eb6d170d375ef4fca53604956f3474c7db19 (diff) | |
download | elgg-60c1387a16ea4944674b0c9da2273158d1fbf0b4.tar.gz elgg-60c1387a16ea4944674b0c9da2273158d1fbf0b4.tar.bz2 |
Merged r6757:6810 from 1.7 branch into trunk
git-svn-id: http://code.elgg.org/elgg/trunk@6850 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/friends/views/default/widgets')
-rw-r--r-- | mod/friends/views/default/widgets/friends/edit.php | 89 | ||||
-rw-r--r-- | mod/friends/views/default/widgets/friends/view.php | 78 |
2 files changed, 87 insertions, 80 deletions
diff --git a/mod/friends/views/default/widgets/friends/edit.php b/mod/friends/views/default/widgets/friends/edit.php index 0d9d44136..50c44af3c 100644 --- a/mod/friends/views/default/widgets/friends/edit.php +++ b/mod/friends/views/default/widgets/friends/edit.php @@ -1,44 +1,61 @@ <?php - /** - * Elgg Friends - * Friend widget options - * - * @package ElggFriends - * @subpackage Core - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - +/** + * Elgg Friends + * Friend widget options + * + * @package ElggFriends + * @subpackage Core + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + +$selections = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20, 30, 50, 100); +$icon_sizes = array('small', 'tiny'); + +// set defaults +if (!isset($vars['entity']->num_display)) { + $vars['entity']->num_display = 12; + $vars['entity']->icon_size = 'small'; +} + +// handle upgrade to 1.7.2 from previous versions +if ($vars['entity']->icon_size == 1) { + $vars['entity']->icon_size = 'small'; +} elseif ($vars['entity']->icon_size == 2) { + $vars['entity']->icon_size = 'tiny'; +} ?> <p> - <?php echo elgg_echo("friends:num_display"); ?>: - <select name="params[num_display]"> - <option value="1" <?php if($vars['entity']->num_display == 1) echo "SELECTED"; ?>>1</option> - <option value="2" <?php if($vars['entity']->num_display == 2) echo "SELECTED"; ?>>2</option> - <option value="3" <?php if($vars['entity']->num_display == 3) echo "SELECTED"; ?>>3</option> - <option value="4" <?php if($vars['entity']->num_display == 4) echo "SELECTED"; ?>>4</option> - <option value="5" <?php if($vars['entity']->num_display == 5) echo "SELECTED"; ?>>5</option> - <option value="6" <?php if($vars['entity']->num_display == 6) echo "SELECTED"; ?>>6</option> - <option value="7" <?php if($vars['entity']->num_display == 7) echo "SELECTED"; ?>>7</option> - <option value="8" <?php if($vars['entity']->num_display == 8) echo "SELECTED"; ?>>8</option> - <option value="9" <?php if($vars['entity']->num_display == 9) echo "SELECTED"; ?>>9</option> - <option value="10" <?php if($vars['entity']->num_display == 10) echo "SELECTED"; ?>>10</option> - <option value="15" <?php if($vars['entity']->num_display == 15) echo "SELECTED"; ?>>15</option> - <option value="20" <?php if($vars['entity']->num_display == 20) echo "SELECTED"; ?>>20</option> - <option value="30" <?php if($vars['entity']->num_display == 30) echo "SELECTED"; ?>>30</option> - <option value="50" <?php if($vars['entity']->num_display == 50) echo "SELECTED"; ?>>50</option> - <option value="100" <?php if($vars['entity']->num_display == 100) echo "SELECTED"; ?>>100</option> - </select> + <?php echo elgg_echo("friends:num_display"); ?>: + <select name="params[num_display]"> +<?php +foreach ($selections as $selection) { + $selected = ''; + if ($vars['entity']->num_display == $selection) { + $selected = 'selected="selected"'; + } + echo "<option value=\"$selection\" $selected>$selection</option>"; +} +?> + </select> </p> <p> - <?php echo elgg_echo("friends:icon_size"); ?> - <select name="params[icon_size]"> - <option value="1" <?php if($vars['entity']->icon_size == 1) echo "SELECTED"; ?>><?php echo elgg_echo("friends:small"); ?></option> - <option value="2" <?php if($vars['entity']->icon_size == 2) echo "SELECTED"; ?>><?php echo elgg_echo("friends:tiny"); ?></option> - </select> -</p>
\ No newline at end of file + <?php echo elgg_echo("friends:icon_size"); ?> + <select name="params[icon_size]"> +<?php +foreach ($icon_sizes as $size) { + $selected = ''; + if ($vars['entity']->icon_size == $size) { + $selected = 'selected="selected"'; + } + $label = elgg_echo("friends:$size"); + echo "<option value=\"$size\" $selected>$label</option>"; +} +?> + </select> +</p> diff --git a/mod/friends/views/default/widgets/friends/view.php b/mod/friends/views/default/widgets/friends/view.php index ab702399a..4532e7ace 100644 --- a/mod/friends/views/default/widgets/friends/view.php +++ b/mod/friends/views/default/widgets/friends/view.php @@ -1,50 +1,40 @@ <?php - /** - * Elgg Friends - * Friend widget options - * - * @package ElggFriends - * @subpackage Core - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - - - //the page owner - $owner = get_user($vars['entity']->owner_guid); - - //the number of files to display - $num = (int) $vars['entity']->num_display; - if (!$num) - $num = 8; - - //get the correct size - $size = (int) $vars['entity']->icon_size; - if (!$size || $size == 1){ - $size_value = "small"; - }else{ - $size_value = "tiny"; - } - - // Get the users friends - $friends = $owner->getFriends("", $num, $offset = 0); - - // If there are any $friend to view, view them - if (is_array($friends) && sizeof($friends) > 0) { +/** + * Elgg Friends + * Friend widget display view + * + * @package ElggFriends + * @subpackage Core + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + + +// owner of the profile page +$owner = get_user($vars['entity']->owner_guid); + +// the number of friends to display +$num = (int) $vars['entity']->num_display; - echo "<div id=\"widget_friends_list\">"; +// get the correct size +$size = $vars['entity']->icon_size; - foreach($friends as $friend) { - echo "<div class=\"widget_friends_singlefriend\" >"; - echo elgg_view("profile/icon",array('entity' => get_user($friend->guid), 'size' => $size_value)); - echo "</div>"; - } +// Get the user's friends +$friends = $owner->getFriends("", $num); +// If there are any friends to view, view them +if (is_array($friends) && sizeof($friends) > 0) { + + echo "<div id=\"widget_friends_list\">"; + + foreach($friends as $friend) { + echo "<div class=\"widget_friends_singlefriend\" >"; + echo elgg_view("profile/icon",array('entity' => get_user($friend->guid), 'size' => $size)); echo "</div>"; - - } - -?>
\ No newline at end of file + } + + echo "</div>"; +} |