Merge branch 'refs/heads/master' into Issue_1561

This commit is contained in:
Daniel Camargo 2013-11-28 10:33:45 -02:00
commit 655d71b046
5 changed files with 85 additions and 2 deletions

View File

@ -808,6 +808,13 @@ strong, .formspringmeFooter a {
}
}
.author {
display: none;
}
.permalink .author {
display: block;
}
{CustomCSS}
</style>
{block:IfGoogleAnalyticsWebPropertyID}<script>
@ -933,7 +940,7 @@ _gaq.push(['_trackPageview']);
{block:IfShowPostNotes}{block:NoteCount}<a href="{Permalink}" title="See post with notes">{NoteCountWithLabel}</a>{/block:NoteCount}{/block:IfShowPostNotes}
{block:Date}{block:IfDisqusShortname}<a href="{Permalink}#disqus_thread" class="comments">{lang:View comments}</a> {/block:IfDisqusShortname}{/block:Date}
{block:Reblog}(via <a href="{ReblogParentURL}" title="{ReblogParentTitle}">{ReblogParentName}</a>{block:RebloggedFromReblog} &amp; <a href="{ReblogRootURL}" title="{ReblogRootTitle}">{ReblogRootName}</a>{block:RebloggedFromReblog}){/block:Reblog}
{block:HasTags}<span class="tags">Tags: {block:Tags}<a href="{TagURL}">{Tag}</a> {/block:Tags}</span>{/block:HasTags}
{block:HasTags}<span class="tags">{block:Tags}#<a href="{TagURL}">{Tag}</a> {/block:Tags}</span>{/block:HasTags}
</div>
{block:IfShowPostNotes}{block:PostNotes}<div class="notecontainer">{PostNotes}</div>{/block:PostNotes}{/block:IfShowPostNotes}

View File

@ -0,0 +1,32 @@
<?php
class Controller_test_userimage extends Crunchbutton_Controller_Account {
public function init() {
$users = User::q('
select `user`.* from `user` left join user_auth using(id_user)
where
user_auth.active=1
and user.active=1
and ((user_auth.type = "local" and user_auth.email LIKE "%@%") or (user_auth.type = "facebook"))
group by `user`.id_user
order by `user`.id_user
');
$c = 0;
foreach ($users as $user) {
if ($user->image()) {
$image = ['name' => $user->name, 'image' => $user->image()];
if (strpos($user->image(),'gravitar')) {
$image['type'] = 'gravitar';
} else {
$image['type'] = 'facebook';
}
$images[] = $image;
$c++;
}
}
Cana::view()->images = $images;
Cana::view()->layout('layout/blank');
Cana::view()->useFilter(false);
Cana::view()->display('test/userimage');
}
}

View File

@ -213,7 +213,7 @@ class Crunchbutton_Notification_Log extends Cana_Table {
$group_name = Config::getVal( Crunchbutton_Notification_Log::MAX_CALL_GROUP_KEY );
$group = Crunchbutton_Group::byName( $group_name );
if( $group->id_group ){
return $group->users();
return Crunchbutton_Admin_Group::q( "SELECT a.* FROM admin a INNER JOIN admin_group ag ON ag.id_admin = a.id_admin AND ag.id_group = {$group->id_group}" );
}
return false;
}

View File

@ -226,6 +226,28 @@ class Crunchbutton_User extends Cana_Table {
public function debits(){
return Crunchbutton_Credit::debitByUser( $this->id_user );
}
public function image() {
if (!isset($this->_image)) {
$auths = $this->auths();
foreach ($auths as $auth) {
if ($auth->type == 'facebook') {
$image = 'http://graph.facebook.com/'.$auth->auth.'/picture?type=square&height=200&width=200';
break;
}
}
if (!$image) {
foreach ($auths as $auth) {
if ($auth->type == 'local') {
$image = 'http://www.gravatar.com/avatar/'.md5(strtolower($auth->email)).'?s=480&d=404';
break;
}
}
}
$this->_image = $image;
}
return $this->_image;
}
public function __construct($id = null) {
parent::__construct();

View File

@ -0,0 +1,22 @@
<style>
.image {
height: 100px;
width: 100px;
}
.hidden {
display: none;
}
</style>
<? foreach ($this->images as $image) : ?>
<img src="<?=$image['image']?>" class="image <?=$image['type']?>">
<? endforeach ; ?>
<div class="count"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('img').error(function () {
$(this).addClass('hidden');
});
});
</script>