]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Modified output/confirmlink view to accept a class param.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 30 Jun 2009 13:28:51 +0000 (13:28 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 30 Jun 2009 13:28:51 +0000 (13:28 +0000)
user_remove_friend() uses remove_user_from_access_collection() instead of raw SQL.
Deleting an access collection prompts using output/confirmlink.

git-svn-id: https://code.elgg.org/elgg/trunk@3368 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/users.php
views/default/friends/collection.php
views/default/output/confirmlink.php

index 5f562845c250069bc28779ed29a9ad827c64a0cd..46636548bb3ece808ebb3b34d74836157b2e1b21 100644 (file)
                \r
                $user_guid = (int) $user_guid; \r
                $friend_guid = (int) $friend_guid;\r
-               if (!remove_entity_relationship($user_guid, "friend", $friend_guid)){\r
-                       return false;\r
-               }\r
                \r
                // perform cleanup for access lists.\r
                $collections = get_user_access_collections($user_guid);\r
-               $in_arr = array();\r
                foreach ($collections as $collection) {\r
-                       $in_arr[] = $collection->id;\r
+                       remove_user_from_access_collection($friend_guid, $collection->id);\r
                }\r
-               $query = "DELETE FROM `{$CONFIG->dbprefix}access_collection_membership`\r
-                       WHERE `user_guid` = '$friend_guid'\r
-                       AND `access_collection_id` IN(" . implode($in_arr, ',') . ")";\r
-               delete_data($query);\r
                \r
-               // delete_data() might return nothing if no rows were affected.\r
-               // the users has been removed already, so we safely return true.\r
-               return true;\r
+               return remove_entity_relationship($user_guid, "friend", $friend_guid);\r
        }\r
        \r
        /**\r
index a12ad6e6a5b6a8666effc6b3458e0a3f4965c5d2..1a9949cc9ae634e0770008c9c7d693d1dbaef2a1 100644 (file)
                \r
                        //as collections are private, check that the logged in user is the owner\r
                        if($coll->owner_guid == $_SESSION['user']->getGUID()) {\r
-                               $confirm = addslashes(elgg_echo('question:areyousure'));\r
-                               echo "<div class=\"friends_collections_controls\"> <a href=\"" . $vars['url'] . "action/friends/deletecollection?collection={$coll->id}\" class=\"delete_collection\" onclick=\"if (!confirm('{$confirm}')) { return false; }; $('div.friends_picker').empty();\"> </a>";\r
+                               echo "<div class=\"friends_collections_controls\">";\r
+                               echo elgg_view('output/confirmlink', array(\r
+                                               'href' => $vars['url'] . 'action/friends/deletecollection?collection=' . $coll->id,\r
+                                               'class' => 'delete_collection'\r
+                                               ));\r
                                echo "</div>";\r
                        }\r
                        echo $coll->name;\r
index 0843083f0d727a9cbe2c4f04b90ad0efe3449b6a..a8929930092c55fe00e3d10cb78c22ac158ad513 100644 (file)
                if (strpos($link, '?')>0) $sep = "&";
                $link = "$link{$sep}__elgg_token=$token&__elgg_ts=$ts";
        }\r
+       \r
+       if ($vars['class']) {\r
+               $class = 'class="' . $vars['class'] . '"';\r
+       } else {\r
+               $class = '';\r
+       }\r
 ?>\r
-<a href="<?php echo $link; ?>" onclick="return confirm('<?php echo addslashes($confirm); ?>');"><?php echo htmlentities($vars['text'], ENT_QUOTES, 'UTF-8'); ?></a>
\ No newline at end of file
+<a href="<?php echo $link; ?>" <?php echo $class; ?> onclick="return confirm('<?php echo addslashes($confirm); ?>');"><?php echo htmlentities($vars['text'], ENT_QUOTES, 'UTF-8'); ?></a>
\ No newline at end of file