diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/comment/helpers/comment_event.php | 12 | ||||
-rw-r--r-- | modules/comment/views/user_profile_comments.html.php | 20 | ||||
-rw-r--r-- | modules/gallery/controllers/user_profile.php | 17 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_event.php | 18 | ||||
-rw-r--r-- | modules/gallery/views/user_profile.html.php | 37 | ||||
-rw-r--r-- | modules/gallery/views/user_profile_info.html.php | 9 |
6 files changed, 78 insertions, 35 deletions
diff --git a/modules/comment/helpers/comment_event.php b/modules/comment/helpers/comment_event.php index bd336cda..12e8d73f 100644 --- a/modules/comment/helpers/comment_event.php +++ b/modules/comment/helpers/comment_event.php @@ -76,4 +76,16 @@ class comment_event_Core { $data[] = $row->text; } } + + static function show_user_profile($data) { + $view = new View("user_profile_comments.html"); + $view->comments = ORM::factory("comment") + ->order_by("created", "DESC") + ->where("state", "=", "published") + ->where("author_id", "=", $data->user->id) + ->find_all(); + if ($view->comments->count()) { + $data->content[] = (object)array("title" => t("Comments"), "view" => $view); + } + } } diff --git a/modules/comment/views/user_profile_comments.html.php b/modules/comment/views/user_profile_comments.html.php new file mode 100644 index 00000000..a2a641ba --- /dev/null +++ b/modules/comment/views/user_profile_comments.html.php @@ -0,0 +1,20 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div id="g-comment-detail"> +<ul> + <? foreach ($comments as $comment): ?> + <li id="g-comment-<?= $comment->id ?>"> + <p class="g-author"> + <?= t('on %date for %title ', + array("date" => date("Y-M-d H:i:s", $comment->created), + "title" => $comment->item()->title)); ?> + <a href="<?= $comment->item()->url() ?>"> + <?= $comment->item()->thumb_img(array(), 50) ?> + </a> + </p> + <div> + <?= nl2br(html::purify($comment->text)) ?> + </div> + </li> + <? endforeach ?> +</ul> +</div> 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> |