aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/profile/languages/en.php1
-rw-r--r--mod/profile/profile_lib.php34
-rw-r--r--mod/profile/start.php20
-rw-r--r--mod/profile/views/default/profile/profile_content.php13
-rwxr-xr-xmod/profile/views/default/profile/profile_contents/activity.php48
-rw-r--r--mod/profile/views/default/profile/profile_contents/commentwall.php9
-rwxr-xr-xmod/profile/views/default/profile/profile_contents/details.php87
-rwxr-xr-xmod/profile/views/default/profile/profile_contents/friends.php15
-rwxr-xr-xmod/profile/views/default/profile/profile_contents/twitter.php10
-rw-r--r--mod/profile/views/default/profile/sidebar.php (renamed from mod/profile/views/default/profile/profile_contents/sidebar.php)0
10 files changed, 121 insertions, 116 deletions
diff --git a/mod/profile/languages/en.php b/mod/profile/languages/en.php
index df40854ff..d8f4e1848 100644
--- a/mod/profile/languages/en.php
+++ b/mod/profile/languages/en.php
@@ -112,6 +112,7 @@ You cannot reply to this email.",
* Profile error messages
*/
+ 'profile:no_friends' => 'This person hasn\'t added any friends yet!',
'profile:noaccess' => "You do not have permission to edit this profile.",
'profile:notfound' => "Sorry, we could not find the specified profile.",
'profile:icon:notfound' => "Sorry, there was a problem uploading your profile picture.",
diff --git a/mod/profile/profile_lib.php b/mod/profile/profile_lib.php
index b38286e1e..909191847 100644
--- a/mod/profile/profile_lib.php
+++ b/mod/profile/profile_lib.php
@@ -15,38 +15,24 @@
* @param string $username The username of the profile to display
* @param string $section Which section is currently selected.
*
- * return mixed FALSE or html for the profile.
+ * @todo - This should really use a plugin hook to get the list of plugin tabs
+ *
+ * @return mixed FALSE or html for the profile.
*/
function profile_get_user_profile_html($user, $section = 'activity') {
$body = elgg_view('profile/profile_navigation', array('section' => $section, 'entity' => $user));
$view_options = array('entity' => $user);
- switch($section){
- case 'friends':
- $body .= elgg_view('profile/profile_contents/friends', $view_options);
- break;
+ if ($section == 'commentwall') {
+ $comments = $user->getAnnotations('commentwall', 200, 0, 'desc');
+ $view_options['comments'] = $comments;
+ }
- case 'twitter':
- $body .= elgg_view('profile/profile_contents/twitter', $view_options);
- break;
- case 'feeds':
- $body .= elgg_view('profile/profile_contents/feeds', $view_options);
- break;
- case 'commentwall':
- $comments = $user->getAnnotations('commentwall', 200, 0, 'desc');
- $body .= elgg_view('profile/profile_contents/commentwall', array("entity" => $user, "comments" => $comments));
- break;
- case 'details':
- $body .= elgg_view('profile/profile_contents/details', $view_options);
- break;
+ $content = elgg_view("profile/profile_contents/$section", $view_options);
- default:
- case 'activity':
- $body .= elgg_view('profile/profile_contents/activity', $view_options);
- break;
- }
+ $body .= elgg_view('profile/profile_content', array('content' => $content));
- $body .= elgg_view('profile/profile_contents/sidebar', array('section' => $section));
+ $body .= elgg_view('profile/sidebar', array('section' => $section));
return $body;
}
diff --git a/mod/profile/start.php b/mod/profile/start.php
index 90caa8f64..17a55e1f9 100644
--- a/mod/profile/start.php
+++ b/mod/profile/start.php
@@ -50,7 +50,11 @@ function profile_init() {
// Now override icons
register_plugin_hook('entity:icon:url', 'user', 'profile_usericon_hook');
-
+
+ // allow ECML in parts of the profile
+ register_plugin_hook('get_views', 'ecml', 'profile_ecml_views_hook');
+
+ // default profile fields admin item
elgg_add_admin_submenu_item('defaultprofile', elgg_echo('profile:edit:default'), 'appearance');
}
@@ -258,6 +262,20 @@ function profile_usericon_hook($hook, $entity_type, $returnvalue, $params){
}
}
+/**
+ * Parse ECML on parts of the profile
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $return_value
+ * @param unknown_type $params
+ */
+function profile_ecml_views_hook($hook, $entity_type, $return_value, $params) {
+ $return_value['profile/profile_content'] = elgg_echo('profile');
+
+ return $return_value;
+}
+
// Make sure the profile initialisation function is called on initialisation
register_elgg_event_handler('init','system','profile_init',1);
register_elgg_event_handler('init','system','profile_fields_setup', 10000); // Ensure this runs after other plugins
diff --git a/mod/profile/views/default/profile/profile_content.php b/mod/profile/views/default/profile/profile_content.php
new file mode 100644
index 000000000..4fb43e7c9
--- /dev/null
+++ b/mod/profile/views/default/profile/profile_content.php
@@ -0,0 +1,13 @@
+<?php
+/**
+ * Wrapper for profile content
+ *
+ * @uses string $vars['content'] - Profile body
+ */
+
+$content = elgg_get_array_value('content', $vars, '');
+
+?>
+<div id="profile_content">
+ <?php echo $content; ?>
+</div> \ No newline at end of file
diff --git a/mod/profile/views/default/profile/profile_contents/activity.php b/mod/profile/views/default/profile/profile_contents/activity.php
index 588ed89d1..ccd2a3915 100755
--- a/mod/profile/views/default/profile/profile_contents/activity.php
+++ b/mod/profile/views/default/profile/profile_contents/activity.php
@@ -2,29 +2,31 @@
/**
* Elgg user display (details)
* @uses $vars['entity'] The user entity
+ *
+ * @todo this needs to recieve a list of activity or HTML in $vars that's generated by a plugin hook.
+ * None of this logic should be here.
*/
- $limit = 20;
-?>
-<div id="profile_content">
- <?php
- if(is_plugin_enabled('thewire')) {
- // users last status msg, if they posted one
- echo elgg_view("profile/status", array("entity" => $vars['entity']));
- }
- if(is_plugin_enabled('conversations')) {
- // users last status msg, if they posted one
- echo elgg_view("profile/status", array("entity" => $vars['entity']));
- }
- if(is_plugin_enabled('riverdashboard')) {
- //select the correct river
- if (get_plugin_setting('activitytype', 'riverdashboard') == 'classic') {
- echo elgg_view_river_items($vars['entity']->getGuid(), 0, '', '', '', '', $limit,0,0,false,true);
- } else {
- echo elgg_view_river_items($vars['entity']->getGuid(), 0, '', '', '', '', $limit,0,0,false,false);
- echo elgg_view('riverdashboard/js');
- }
+$limit = 20;
+
+if (is_plugin_enabled('thewire')) {
+ // users last status msg, if they posted one
+ echo elgg_view("profile/status", array("entity" => $vars['entity']));
+}
+
+if (is_plugin_enabled('conversations')) {
+ // users last status msg, if they posted one
+ echo elgg_view("profile/status", array("entity" => $vars['entity']));
+}
+
+if (is_plugin_enabled('riverdashboard')) {
+ //select the correct river
+ if (get_plugin_setting('activitytype', 'riverdashboard') == 'classic') {
+ echo elgg_view_river_items($vars['entity']->getGuid(), 0, '', '', '', '', $limit,0,0,false,true);
} else {
- echo "Riverdashboard not loaded";
+ echo elgg_view_river_items($vars['entity']->getGuid(), 0, '', '', '', '', $limit,0,0,false,false);
+ echo elgg_view('riverdashboard/js');
}
- ?>
-</div>
+} else {
+ // @todo this should not be here.
+ echo "Riverdashboard not loaded";
+} \ No newline at end of file
diff --git a/mod/profile/views/default/profile/profile_contents/commentwall.php b/mod/profile/views/default/profile/profile_contents/commentwall.php
index f3a2adb1c..7e8a1d97d 100644
--- a/mod/profile/views/default/profile/profile_contents/commentwall.php
+++ b/mod/profile/views/default/profile/profile_contents/commentwall.php
@@ -2,12 +2,9 @@
/**
* Elgg profile comment wall
*/
-?>
-<div id="profile_content">
-<?php
-if(isloggedin()){
+
+if (isloggedin()) {
echo elgg_view("profile/commentwall/commentwalladd");
}
+
echo elgg_view("profile/commentwall/commentwall", array('annotation' => $vars['comments']));
-?>
-</div> \ No newline at end of file
diff --git a/mod/profile/views/default/profile/profile_contents/details.php b/mod/profile/views/default/profile/profile_contents/details.php
index d040cef75..6a214557d 100755
--- a/mod/profile/views/default/profile/profile_contents/details.php
+++ b/mod/profile/views/default/profile/profile_contents/details.php
@@ -3,54 +3,47 @@
* Elgg user display (details)
* @uses $vars['entity'] The user entity
*/
-?>
-<div id="profile_content">
-<?php
- // Simple XFN
- $rel = "";
- if (page_owner() == $vars['entity']->guid)
- $rel = 'me';
- else if (check_entity_relationship(page_owner(), 'friend', $vars['entity']->guid))
- $rel = 'friend';
- $even_odd = null;
- if (is_array($vars['config']->profile) && sizeof($vars['config']->profile) > 0)
- foreach($vars['config']->profile as $shortname => $valtype) {
- if ($shortname != "description") {
- $value = $vars['entity']->$shortname;
- if (!empty($value)) {
- //This function controls the alternating class
- $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even';
-?>
- <p class="<?php echo $even_odd; ?>">
- <b><?php
- echo elgg_echo("profile:{$shortname}");
- ?>: </b>
- <?php
- echo elgg_view("output/{$valtype}",array('value' => $vars['entity']->$shortname));
- ?>
- </p>
- <?php
- }
- }
- }
-?>
-<?php
- if (!get_plugin_setting('user_defined_fields', 'profile')) {
-?>
-<?php
- if ($vars['entity']->isBanned()) {
- echo "<div class='banned_user'>";
- echo elgg_echo('profile:banned');
- echo "</div>";
- }else{
- if($vars['entity']->description){
- echo "<p class='aboutme_title'><b>" . elgg_echo("profile:aboutme") . "</b></p>";
- echo "<div class='aboutme_contents'>" .elgg_view('output/longtext', array('value' => $vars['entity']->description))."</div>";
+// Simple XFN
+$rel = "";
+if (page_owner() == $vars['entity']->guid) {
+ $rel = 'me';
+} else if (check_entity_relationship(page_owner(), 'friend', $vars['entity']->guid)) {
+ $rel = 'friend';
+}
+
+$even_odd = null;
+if (is_array($vars['config']->profile) && sizeof($vars['config']->profile) > 0) {
+ foreach($vars['config']->profile as $shortname => $valtype) {
+ if ($shortname != "description") {
+ $value = $vars['entity']->$shortname;
+ if (!empty($value)) {
+ //This function controls the alternating class
+ $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even';
+ ?>
+ <p class="<?php echo $even_odd; ?>">
+ <b><?php
+ echo elgg_echo("profile:{$shortname}");
+ ?>: </b>
+ <?php
+ echo elgg_view("output/{$valtype}", array('value' => $vars['entity']->$shortname));
+ ?>
+ </p>
+ <?php
}
- ?>
-<?php } ?>
- <?php
}
+ }
+}
- echo "</div>"; \ No newline at end of file
+if (!get_plugin_setting('user_defined_fields', 'profile')) {
+ if ($vars['entity']->isBanned()) {
+ echo "<div class='banned_user'>";
+ echo elgg_echo('profile:banned');
+ echo "</div>";
+ } else {
+ if ($vars['entity']->description) {
+ echo "<p class='aboutme_title'><b>" . elgg_echo("profile:aboutme") . "</b></p>";
+ echo "<div class='aboutme_contents'>" . elgg_view('output/longtext', array('value' => $vars['entity']->description)) . "</div>";
+ }
+ }
+} \ No newline at end of file
diff --git a/mod/profile/views/default/profile/profile_contents/friends.php b/mod/profile/views/default/profile/profile_contents/friends.php
index a097f3830..9195629e5 100755
--- a/mod/profile/views/default/profile/profile_contents/friends.php
+++ b/mod/profile/views/default/profile/profile_contents/friends.php
@@ -3,13 +3,10 @@
* Profile friends
**/
-$friends = list_entities_from_relationship('friend',$vars['entity']->getGUID(),false,'user','',0,10,false);
-if(!$friends)
- $friends = "<p>This user has not made any friends yet.</p>";
+$friends = list_entities_from_relationship('friend', $vars['entity']->getGUID(), FALSE, 'user', '', 0, 10, FALSE);
-?>
-<div id="profile_content">
- <?php
- echo $friends;
- ?>
-</div> \ No newline at end of file
+if(!$friends) {
+ $friends = '<p>' . elgg_echo('profile:no_friends') . '</p>';
+}
+
+echo $friends; \ No newline at end of file
diff --git a/mod/profile/views/default/profile/profile_contents/twitter.php b/mod/profile/views/default/profile/profile_contents/twitter.php
index f9b6f5d54..06a0551d4 100755
--- a/mod/profile/views/default/profile/profile_contents/twitter.php
+++ b/mod/profile/views/default/profile/profile_contents/twitter.php
@@ -8,12 +8,10 @@ $twitter_username = $vars['entity']->twitter;
// if the twitter username is empty, then do not show
if($twitter_username){
?>
-<div id="profile_content">
- <ul id="twitter_update_list"></ul>
- <p class="visit_twitter"><a href="http://twitter.com/<?php echo $twitter_username; ?>" target="_blank"><?php echo elgg_echo("twitter:visit"); ?></a></p>
- <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
- <script type="text/javascript" src="http://twitter.com/statuses/user_timeline/<?php echo $twitter_username; ?>.json?callback=twitterCallback2&count=10"></script>
-</div>
+<ul id="twitter_update_list"></ul>
+<p class="visit_twitter"><a href="http://twitter.com/<?php echo $twitter_username; ?>" target="_blank"><?php echo elgg_echo("twitter:visit"); ?></a></p>
+<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
+<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/<?php echo $twitter_username; ?>.json?callback=twitterCallback2&count=10"></script>
<?php
} \ No newline at end of file
diff --git a/mod/profile/views/default/profile/profile_contents/sidebar.php b/mod/profile/views/default/profile/sidebar.php
index 43e3d1087..43e3d1087 100644
--- a/mod/profile/views/default/profile/profile_contents/sidebar.php
+++ b/mod/profile/views/default/profile/sidebar.php