Skip to content

Commit

Permalink
v.1.1 with support for displaying user profile photo.
Browse files Browse the repository at this point in the history
  • Loading branch information
dziudek committed Nov 2, 2013
1 parent a1b9fc3 commit 5f83d9b
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 5 deletions.
42 changes: 41 additions & 1 deletion mod_gk_js_feed/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function getData() {
"url" => $url,
"username" => $username
);
} else {
} elseif($this->config['content_type'] == 'photo') {
$query = '
SELECT
a.id AS id,
Expand Down Expand Up @@ -142,6 +142,46 @@ public function getData() {
"photo" => $photo,
"url" => $url
);
} elseif($this->config['content_type'] == 'user') {
$user_condition = '';

if(trim($this->config['user_id']) != '' && is_numeric($this->config['user_id'])) {
$user_condition = ' u.userid = ' . $this->config['user_id'] . ' ';
} else {
$user_condition = ' 1=1 ORDER BY u.userid DESC';
}

$query = '
SELECT
userid
FROM
#__community_users AS u
WHERE
'.$user_condition.'
LIMIT
'.$this->config['offset'].', 1;';

$db->setQuery($query);
// check if some statuses was detected
$avatar = '';
$url = '';
$username = '';

if($statuses = $db->loadObjectList()) {
foreach($statuses as $status) {
$user_id = $status->userid;
$user = CFactory::getUser($user_id);
$username = CStringHelper::escape($user->getDisplayName());
$avatar = $user->getAvatar();
$url = CRoute::_('index.php?option=com_community&view=profile&userid='.$user_id );
}
}
// return the data array
return array(
"avatar" => $avatar,
"url" => $url,
"username" => $username
);
}
}
// function to render module code
Expand Down
1 change: 1 addition & 0 deletions mod_gk_js_feed/language/en-GB.mod_gk_js_feed.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ MOD_JS_FEED_CONTENT_TYPE="Content type"
MOD_JS_FEED_CONTENT_TYPE_DESC="You can select the type of content displayed in the module"
MOD_JS_FEED_STATUS="Status"
MOD_JS_FEED_PHOTO="Photo"
MOD_JS_FEED_USER="User profile"
MOD_JS_FEED_DATA_SOURCE="Data source"
MOD_JS_FEED_DATA_SOURCE_DESC="You can specify the data source of the statuses"
MOD_JS_FEED_LATEST_STATUSES="Latest status updates"
Expand Down
7 changes: 4 additions & 3 deletions mod_gk_js_feed/mod_gk_js_feed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<extension type="module" version="1.6.0" client="site" method="upgrade">
<name>GK JomSocial Feed</name>
<author>GavickPro</author>
<creationDate>18/09/2013</creationDate>
<creationDate>02/11/2013</creationDate>
<copyright>Copyright (C) 2013 GavickPro. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.gavickpro.com</authorUrl>
<version>1.0.2</version>
<version>1.1</version>
<description><![CDATA[
<style type="text/css">
span.readonly { padding: 10px; font-family: Arial; font-size:13px !important; font-weight: normal !important; text-align: justify; color: #4d4d4d; line-height: 24px; }
Expand All @@ -18,7 +18,7 @@
span.readonly p.license { border-top: 1px solid #eee; font-size: 11px; margin: 30px 26px 0; padding: 6px 0; }
</style>
<span class="readonly"><h1>GK JomSocial Feed<small>ver. 1.0.2</small></h1><p>With the GK JomSocial Feed module, you can implement space-saving blocks on websites and incorporate a variety of JomSocial statuses. There are a few useful options for selecting specific statuses.</p></p><p class='license'>GK JomSocial Feed is released under the <a target="_blank" href="http://www.gnu.org/licenses/gpl-2.0.html">GNU/GPL v2 license.</a></p></span>
<span class="readonly"><h1>GK JomSocial Feed<small>ver. 1.1</small></h1><p>With the GK JomSocial Feed module, you can implement space-saving blocks on websites and incorporate a variety of JomSocial statuses. There are a few useful options for selecting specific statuses.</p></p><p class='license'>GK JomSocial Feed is released under the <a target="_blank" href="http://www.gnu.org/licenses/gpl-2.0.html">GNU/GPL v2 license.</a></p></span>
]]></description>
<files>
<filename module="mod_gk_js_feed">mod_gk_js_feed.php</filename>
Expand Down Expand Up @@ -47,6 +47,7 @@
<field name="content_type" type="list" default="status" label="MOD_JS_FEED_CONTENT_TYPE" description="MOD_JS_FEED_CONTENT_TYPE_DESC">
<option value="status">MOD_JS_FEED_STATUS</option>
<option value="photo">MOD_JS_FEED_PHOTO</option>
<option value="user">MOD_JS_FEED_USER</option>
</field>

<field name="data_source" type="list" default="latest" label="MOD_JS_FEED_DATA_SOURCE" description="MOD_JS_FEED_DATA_SOURCE_DESC">
Expand Down
64 changes: 64 additions & 0 deletions mod_gk_js_feed/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,67 @@
font-size: 11px;
}
}

/* User content type */
.gkJSFeedType-user {
background: #e74c3c;
}
.gkJSFeedType-user > a {
background-position: center center;
background-size: cover;
height: 100%;
opacity: 1; filter: alpha(opacity=100);
position: absolute;
-webkit-transition: all .3s ease-out;
-moz-transition: all .3s ease-out;
-ms-transition: all .3s ease-out;
-o-transition: all .3s ease-out;
transition: all .3s ease-out;
-webkit-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0);
-ms-transform: translate3d(0, 0, 0);
-o-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
width: 100%!important;
}
.gkJSFeedType-user > a > span {
background: #e74c3c;
color: #fff;
height: 100%;
opacity: 0; filter: alpha(opacity=0);
position: absolute;
text-align: center;
top: 0;
-webkit-transition: all .3s ease-out;
-moz-transition: all .3s ease-out;
-ms-transition: all .3s ease-out;
-o-transition: all .3s ease-out;
transition: all .3s ease-out;
width: 100%;
}
.gkJSFeedType-user:hover > a > span {
opacity: 1; filter: alpha(opacity=100);
}
.gkJSFeedType-user > a > span > em {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
font-size: 16px;
font-weight: bold;
left: 0;
line-height: 20px;
margin: 20px 0 0 0;
padding: 0 10px;
position: absolute;
top: 50%;
-webkit-transition: all .3s ease-out;
-moz-transition: all .3s ease-out;
-ms-transition: all .3s ease-out;
-o-transition: all .3s ease-out;
transition: all .3s ease-out;
width: 100%;
}
.gkJSFeedType-user:hover > a > span > em {
margin: -10px 0 0 0;
}
8 changes: 7 additions & 1 deletion mod_gk_js_feed/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<?php else : ?>
<?php echo JText::_('MOD_JS_FEED_NO_STATUS'); ?>
<?php endif; ?>
<?php else : ?>
<?php elseif($this->config['content_type'] == 'photo') : ?>
<?php if($status['url'] != '') : ?>
<?php
$uri = JURI::getInstance();
Expand All @@ -55,5 +55,11 @@
<?php else : ?>
<?php echo JText::_('MOD_JS_FEED_NO_STATUS'); ?>
<?php endif; ?>
<?php elseif($this->config['content_type'] == 'user'): ?>
<?php if($status['avatar'] != '') : ?>
<a href="<?php echo $status['url']; ?>" class="gkAvatar" style="background-image: url('<?php echo $status['avatar']; ?>');">
<span><em><?php echo $status['username']; ?></em></span>
</a>
<?php endif; ?>
<?php endif; ?>
</div>

0 comments on commit 5f83d9b

Please sign in to comment.