diff options
author | pete <pete@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-26 00:06:16 +0000 |
---|---|---|
committer | pete <pete@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-26 00:06:16 +0000 |
commit | e9cc4a95ca5a6e7192a26a4dc69f62c542158085 (patch) | |
tree | 4d9a1fb2379ab9c34369e50f8484ed0a9813df37 /views/default/friends/picker.php | |
parent | 7e6e58f8b1da4c1a94c7c933d98ead1879658d58 (diff) | |
download | elgg-e9cc4a95ca5a6e7192a26a4dc69f62c542158085.tar.gz elgg-e9cc4a95ca5a6e7192a26a4dc69f62c542158085.tar.bz2 |
friends picker fixed for new page layout, and hopefully I've fixed the load issue too
git-svn-id: https://code.elgg.org/elgg/trunk@1552 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/friends/picker.php')
-rw-r--r-- | views/default/friends/picker.php | 334 |
1 files changed, 168 insertions, 166 deletions
diff --git a/views/default/friends/picker.php b/views/default/friends/picker.php index 4be60b12e..7a0c57c12 100644 --- a/views/default/friends/picker.php +++ b/views/default/friends/picker.php @@ -1,167 +1,169 @@ -<?php
-
- /**
- * Elgg friends picker
- * Lists the friends picker
- *
- * @package Elgg
- * @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
- * @link http://elgg.org/
- *
- * @uses $vars['entities'] The array of ElggUser objects
- */
-
- // Initialise internalname
- if (!isset($vars['internalname'])) {
- $internalname = "friend";
- } else {
- $internalname = $vars['internalname'];
- }
-
- // Initialise values
- if (!isset($vars['value'])) {
- $vars['value'] = array();
- } else {
- if (!is_array($vars['value'])) {
- $vars['value'] = (int) $vars['value'];
- $vars['value'] = array($vars['value']);
- }
- }
-
- // We need to count the number of friends pickers on the page.
- global $friendspicker;
- if (!isset($friendspicker)) $friendspicker = 0;
- $friendspicker++;
-
- $users = array();
- $activeletters = array();
-
- // Sort users by letter
- if (is_array($vars['entities']) && sizeof($vars['entities']))
- foreach($vars['entities'] as $user) {
-
- $letter = strtoupper(substr($user->name,0,1));
- if ($letter >= "0" && $letter <= "9") {
- $letter = "0";
- }
- if (!isset($users[$letter])) {
- $users[$letter] = array();
- }
- $users[$letter][$user->name] = $user;
-
- }
-
-?>
-
-<div class="friends_picker">
- <div class="friendsPicker_wrapper">
- <div id="friendsPicker<?php echo $friendspicker; ?>">
- <div class="friendsPicker_container">
-<?php
-
- // Initialise letters
- $letter = 'A';
- while (1 == 1) {
-?>
- <div class="panel" title="<?php echo $letter; ?>">
- <div class="wrapper">
- <h3><?php echo $letter; ?></h3>
-
-<?php
-
- if (isset($users[$letter])) {
- ksort($users[$letter]);
-
- echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
- $col = 0;
-
- foreach($users[$letter] as $friend) {
- if ($col == 0) echo "<tr>";
-
- //echo "<p>" . $user->name . "</p>";
- $label = elgg_view("profile/icon",array('entity' => $friend, 'size' => 'tiny'));
- $options[$label] = $friend->getGUID();
- if (in_array($friend->getGUID(),$vars['value'])) {
- $checked = "checked = \"checked\"";
- if (!in_array($letter,$activeletters))
- $activeletters[] = $letter;
- } else {
- $checked = "";
- }
-
-?>
-
- <td>
-
- <input type="checkbox" <?php echo $checked; ?> name="<?php echo $internalname; ?>[]" value="<?php echo $options[$label]; ?>" />
-
- </td>
-
- <td >
-
- <div style="width: 25px; margin-bottom: 15px;">
-<?php
-
- echo $label;
-
-?>
- </div>
- </td>
- <td style="width: 300px; padding: 5px;">
-<?php
-
- echo $friend->name;
-
-?>
- </td>
-<?php
-
- $col++;
- if ($col == 3) echo "</tr>";
- }
- if ($col < 3) echo "</tr>";
-
- echo "</table>";
-
- }
-
-?>
-
- </div>
- </div>
-<?php
- if ($letter == 'Z') break;
- $letter++;
- }
-
-?>
- </div>
- </div>
- </div>
-</div>
-
-<script type="text/javascript">
- jQuery(window).bind("load", function() {
- // initialise picker
- $("div#friendsPicker<?php echo $friendspicker; ?>").friendsPicker();
- });
-</script>
-<script>
- jQuery(window).bind("load", function() {
- // manually add class to corresponding tab for panels that have content - needs to be automated eventually
-<?php
- if (sizeof($activeletters) > 0)
- $chararray = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
- foreach($activeletters as $letter) {
- $tab = strpos($chararray, $letter) + 1;
-?>
- $("div#friendsPickerNavigation<?php echo $friendspicker - 1; ?> li.tab<?php echo $tab; ?> a").addClass("tabHasContent");
-<?php
- }
-
-?>
- });
+<?php + + /** + * Elgg friends picker + * Lists the friends picker + * + * @package Elgg + * @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 + * @link http://elgg.org/ + * + * @uses $vars['entities'] The array of ElggUser objects + */ + + // Initialise internalname + if (!isset($vars['internalname'])) { + $internalname = "friend"; + } else { + $internalname = $vars['internalname']; + } + + // Initialise values + if (!isset($vars['value'])) { + $vars['value'] = array(); + } else { + if (!is_array($vars['value'])) { + $vars['value'] = (int) $vars['value']; + $vars['value'] = array($vars['value']); + } + } + + // We need to count the number of friends pickers on the page. + global $friendspicker; + if (!isset($friendspicker)) $friendspicker = 0; + $friendspicker++; + + $users = array(); + $activeletters = array(); + + // Sort users by letter + if (is_array($vars['entities']) && sizeof($vars['entities'])) + foreach($vars['entities'] as $user) { + + $letter = strtoupper(substr($user->name,0,1)); + if ($letter >= "0" && $letter <= "9") { + $letter = "0"; + } + if (!isset($users[$letter])) { + $users[$letter] = array(); + } + $users[$letter][$user->name] = $user; + + } + +?> + +<div class="friends_picker"> + <div class="friendsPicker_wrapper"> + <div id="friendsPicker<?php echo $friendspicker; ?>"> + <div class="friendsPicker_container"> +<?php + + // Initialise letters + $letter = 'A'; + while (1 == 1) { +?> + <div class="panel" title="<?php echo $letter; ?>"> + <div class="wrapper"> + <h3><?php echo $letter; ?></h3> + +<?php + + if (isset($users[$letter])) { + ksort($users[$letter]); + + echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; + $col = 0; + + foreach($users[$letter] as $friend) { + if ($col == 0) echo "<tr>"; + + //echo "<p>" . $user->name . "</p>"; + $label = elgg_view("profile/icon",array('entity' => $friend, 'size' => 'tiny')); + $options[$label] = $friend->getGUID(); + if (in_array($friend->getGUID(),$vars['value'])) { + $checked = "checked = \"checked\""; + if (!in_array($letter,$activeletters)) + $activeletters[] = $letter; + } else { + $checked = ""; + } + +?> + + <td> + + <input type="checkbox" <?php echo $checked; ?> name="<?php echo $internalname; ?>[]" value="<?php echo $options[$label]; ?>" /> + + </td> + + <td > + + <div style="width: 25px; margin-bottom: 15px;"> +<?php + + echo $label; + +?> + </div> + </td> + <td style="width: 300px; padding: 5px;"> +<?php + + echo $friend->name; + +?> + </td> +<?php + + $col++; + if ($col == 3) echo "</tr>"; + } + if ($col < 3) echo "</tr>"; + + echo "</table>"; + + } + +?> + + </div> + </div> +<?php + if ($letter == 'Z') break; + $letter++; + } + +?> + </div> + </div> + </div> +</div> + +<script type="text/javascript"> + //jQuery(window).bind("load", function() { + $(document).ready(function () { + // initialise picker + $("div#friendsPicker<?php echo $friendspicker; ?>").friendsPicker(); + }); +</script> +<script> + //jQuery(window).bind("load", function() { + $(document).ready(function () { + // manually add class to corresponding tab for panels that have content - needs to be automated eventually +<?php + if (sizeof($activeletters) > 0) + $chararray = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + foreach($activeletters as $letter) { + $tab = strpos($chararray, $letter) + 1; +?> + $("div#friendsPickerNavigation<?php echo $friendspicker - 1; ?> li.tab<?php echo $tab; ?> a").addClass("tabHasContent"); +<?php + } + +?> + }); </script>
\ No newline at end of file |