aboutsummaryrefslogtreecommitdiffstats
path: root/include/widgets.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-02-05 19:38:43 -0800
committerfriendica <info@friendica.com>2015-02-05 19:38:43 -0800
commit4b348d248975ba07ba9cea62f51eb52d6afb5645 (patch)
treefc60c2d05958c2a458ac72b03e1e7ddffce0c41b /include/widgets.php
parentaafed50a0ea8a8d7091572473dcb8e4fb8cd4602 (diff)
parentb948fbaeda84f4358722222b4a2d5555ef10b82e (diff)
downloadvolse-hubzilla-4b348d248975ba07ba9cea62f51eb52d6afb5645.tar.gz
volse-hubzilla-4b348d248975ba07ba9cea62f51eb52d6afb5645.tar.bz2
volse-hubzilla-4b348d248975ba07ba9cea62f51eb52d6afb5645.zip
Merge branch 'master' into tres
Conflicts: view/css/mod_events.css view/theme/redbasic/css/style.css
Diffstat (limited to 'include/widgets.php')
-rw-r--r--include/widgets.php60
1 files changed, 60 insertions, 0 deletions
diff --git a/include/widgets.php b/include/widgets.php
index 882e21f1c..7cc9fc708 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -903,3 +903,63 @@ function widget_random_block($arr) {
return $o;
}
+
+
+function widget_rating($arr) {
+ $a = get_app();
+
+ $poco_rating = get_config('system','poco_rating_enable');
+ if((! $poco_rating) && ($poco_rating !== false)) {
+ return;
+ }
+
+ if($arr['target'])
+ $hash = $arr['target'];
+ else
+ $hash = $a->poi['xchan_hash'];
+
+ if(! $hash)
+ return;
+
+ $url = '';
+ $remote = false;
+
+ if(remote_channel() && ! local_channel()) {
+ $ob = $a->get_observer();
+ if($ob && $ob['xchan_url']) {
+ $p = parse_url($ob['xchan_url']);
+ if($p) {
+ $url = $p['scheme'] . '://' . $p['host'] . (($p['port']) ? ':' . $p['port'] : '');
+ $url .= '/rate?f=&target=' . urlencode($hash);
+ }
+ $remote = true;
+ }
+ }
+
+ $self = false;
+
+ if(local_channel()) {
+ $channel = $a->get_channel();
+
+ if($hash == $channel['channel_hash'])
+ $self = true;
+
+ head_add_js('ratings.js');
+
+ }
+
+ if((($remote) || (local_channel())) && (! $self)) {
+ $o = '<div class="widget rateme">';
+ if($remote)
+ $o .= '<a class="rateme" href="' . $url . '"><i class="icon-pencil"></i> ' . t('Rate Me') . '</a>';
+ else
+ $o .= '<div class="rateme fakelink" onclick="doRatings(\'' . $hash . '\'); return false;"><i class="icon-pencil"></i> ' . t('Rate Me') . '</div>';
+ $o .= '</div>';
+ }
+
+ $o .= '<div class="widget rateme"><a class="rateme" href="ratings/' . $hash . '"><i class="icon-eye-open"></i> ' . t('View Ratings') . '</a>';
+ $o .= '</div>';
+
+ return $o;
+
+}