summaryrefslogtreecommitdiff
path: root/modules/gallery
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery')
-rw-r--r--modules/gallery/controllers/user_profile.php17
-rw-r--r--modules/gallery/helpers/gallery_event.php18
-rw-r--r--modules/gallery/views/user_profile.html.php37
-rw-r--r--modules/gallery/views/user_profile_info.html.php9
4 files changed, 46 insertions, 35 deletions
diff --git a/modules/gallery/controllers/user_profile.php b/modules/gallery/controllers/user_profile.php
index 808531da..6159894d 100644
--- a/modules/gallery/controllers/user_profile.php
+++ b/modules/gallery/controllers/user_profile.php
@@ -31,25 +31,16 @@ class User_Profile_Controller extends Controller {
// @todo modify user_home to supply a link to their album,
// @todo add list of watches
- // @todo add all comments
// @todo add rest api key
$v->content->user = $user;
- $v->content->height = 250;
$v->content->not_current = !$is_current_active;
$v->content->editable = identity::is_writable() && $display_all;
$v->content->return = SafeString::of(Input::instance()->get("return"));
- $fields = array("name" => t("Name"), "locale" => t("Locale"), "email" => t("Email"),
- "full_name" => t("Full name"), "url" => "Web site");
- if (!$display_all) {
- $fields = array("name" => t("Name"), "full_name" => t("Full name"), "url" => "Web site");
- }
- $v->content->fields = array();
- foreach ($fields as $field => $label) {
- if (!empty($user->$field)) {
- $v->content->fields[(string)$label->for_html()] = $user->$field;
- }
- }
+ $event_data = (object)array("user" => $user, "display_all" => $display_all, "content" => array());
+ module::event("show_user_profile", $event_data);
+ Kohana_Log::add("error", Kohana::debug($event_data));
+ $v->content->info_parts = $event_data->content;
print $v;
}
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index 29940ac6..6b70513a 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -377,4 +377,22 @@ class gallery_event_Core {
}
}
}
+
+ static function show_user_profile($data) {
+ $v = new View("user_profile_info.html");
+
+ $fields = array("name" => t("Name"), "locale" => t("Locale"), "email" => t("Email"),
+ "full_name" => t("Full name"), "url" => "Web site");
+ if (!$data->display_all) {
+ $fields = array("name" => t("Name"), "full_name" => t("Full name"), "url" => "Web site");
+ }
+ $v->fields = array();
+ foreach ($fields as $field => $label) {
+ if (!empty($data->user->$field)) {
+ $v->fields[(string)$label->for_html()] = $data->user->$field;
+ }
+ }
+ $data->content[] = (object)array("title" => t("User information"), "view" => $v);
+
+ }
}
diff --git a/modules/gallery/views/user_profile.html.php b/modules/gallery/views/user_profile.html.php
index e7ce56b3..bcfa5346 100644
--- a/modules/gallery/views/user_profile.html.php
+++ b/modules/gallery/views/user_profile.html.php
@@ -1,9 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<style>
- #g-user-profile #g-profile-buttons {
- bottom: 0;
- position: absolute;
- right: 0;
+ #g-user-profile div {
+ margin-top: 1em;
}
#g-user-profile fieldset {
@@ -25,30 +23,25 @@
}
</style>
-<script>
- $("#g-user-profile").ready(function() {
- //$("#g-profile-return").click(function(event) {
- // window.location = <?= $return->for_js() ?>;
- //});
- });
-</script>
-<div id="g-user-profile" style="height: <?= $height ?>px">
- <h1 style="display: none"><?= t("%name Profile", array("name" => $user->display_name())) ?></h1>
+<div id="g-user-profile">
+ <h1>
+ <a href="#">
+ <img src="<?= $user->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>"
+ alt="<?= html::clean_attribute($user->display_name()) ?>"
+ class="g-avatar" width="40" height="40" />
+ </a>
+ <?= t("%name Profile", array("name" => $user->display_name())) ?>
+ </h1>
+ <? foreach ($info_parts as $info): ?>
<div>
<fieldset>
- <label><?= t("User information") ?></label>
+ <label><?= $info->title ?></label>
<div>
- <table>
- <? foreach ($fields as $field => $value): ?>
- <tr>
- <td><?= $field ?></td>
- <td><?= $value ?></td>
- </tr>
- <? endforeach ?>
- </table>
+ <?= $info->view ?>
</div>
</fieldset>
</div>
+ <? endforeach ?>
<div id="g-profile-buttons" class="ui-helper-clearfix g-right">
<? if (!$user->guest && $not_current && !empty($user->email)): ?>
<a class="g-button ui-icon-right ui-state-default ui-corner-all g-dialog-link"
diff --git a/modules/gallery/views/user_profile_info.html.php b/modules/gallery/views/user_profile_info.html.php
new file mode 100644
index 00000000..2a2549c8
--- /dev/null
+++ b/modules/gallery/views/user_profile_info.html.php
@@ -0,0 +1,9 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<table>
+ <? foreach ($fields as $field => $value): ?>
+ <tr>
+ <td><?= $field ?></td>
+ <td><?= $value ?></td>
+ </tr>
+ <? endforeach ?>
+</table>