aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-01-15 17:32:41 -0800
committerfriendica <info@friendica.com>2015-01-15 17:32:41 -0800
commit597b07e8cc40144abce63f0779d28c2dbc376a22 (patch)
treec6cb92ab968fa1099bba35c34cd621776855572c
parente7932d97a25bf621082e93f47816a2a107a6d05f (diff)
downloadvolse-hubzilla-597b07e8cc40144abce63f0779d28c2dbc376a22.tar.gz
volse-hubzilla-597b07e8cc40144abce63f0779d28c2dbc376a22.tar.bz2
volse-hubzilla-597b07e8cc40144abce63f0779d28c2dbc376a22.zip
poco rating - add a test module for pulling out ratings
-rw-r--r--mod/connedit.php18
-rw-r--r--mod/prep.php38
-rwxr-xr-xview/tpl/abook_edit.tpl3
-rw-r--r--view/tpl/prep.tpl36
4 files changed, 90 insertions, 5 deletions
diff --git a/mod/connedit.php b/mod/connedit.php
index 87d5e9eca..c27f4588a 100644
--- a/mod/connedit.php
+++ b/mod/connedit.php
@@ -534,11 +534,21 @@ function connedit_content(&$a) {
));
}
+ $poco_rating = get_config('system','poco_rating_enable');
+ // if unset default to enabled
+ if($poco_rating === false)
+ $poco_rating = true;
+
+ if($poco_rating) {
+ $rating = replace_macros(get_markup_template('rating_slider.tpl'),array(
+ '$min' => -10,
+ '$val' => (($contact['abook_rating']) ? $contact['abook_rating'] : 0),
+ ));
+ }
+ else {
+ $rating = false;
+ }
- $rating = replace_macros(get_markup_template('rating_slider.tpl'),array(
- '$min' => -10,
- '$val' => (($contact['abook_rating']) ? $contact['abook_rating'] : 0),
- ));
$perms = array();
$channel = $a->get_channel();
diff --git a/mod/prep.php b/mod/prep.php
new file mode 100644
index 000000000..e53f7ac4e
--- /dev/null
+++ b/mod/prep.php
@@ -0,0 +1,38 @@
+<?php
+
+function prep_content(&$a) {
+
+ if(argc() > 1)
+ $hash = argv(1);
+
+ if(! $hash) {
+ notice('Must supply a channel identififier.');
+ return;
+ }
+
+ $p = q("select * from xchan where xchan_hash like '%s'",
+ dbesc($hash . '%')
+ );
+
+ $r = q("select * from xlink left join xchan on xlink_xchan = xchan_hash where xlink_link like '%s' and xlink_rating != 0",
+ dbesc($hash . '%')
+ );
+
+ $ret = array();
+
+ if($p && $r) {
+ $ret['poi'] = $p[0];
+ $ret['raters'] = $r;
+
+ $o = replace_macros(get_markup_template('prep.tpl'),array(
+ '$header' => t('Ratings'),
+ '$poi' => $p[0],
+ '$raters' => $r
+ ));
+
+ return $o;
+ }
+ return '';
+}
+
+ \ No newline at end of file
diff --git a/view/tpl/abook_edit.tpl b/view/tpl/abook_edit.tpl
index 3709944e9..7c75bfac4 100755
--- a/view/tpl/abook_edit.tpl
+++ b/view/tpl/abook_edit.tpl
@@ -76,11 +76,12 @@
</div>
{{/if}}
+{{if $rating}}
{{if $notself}}
<h3 class="abook-rating-text-desc">{{$lbl_rating_txt}}</h3>
<textarea name="rating_text" id="rating-text" >{{$rating_txt}}</textarea>
{{/if}}
-
+{{/if}}
{{if $multiprofs }}
<div>
diff --git a/view/tpl/prep.tpl b/view/tpl/prep.tpl
new file mode 100644
index 000000000..d0c1e5ec6
--- /dev/null
+++ b/view/tpl/prep.tpl
@@ -0,0 +1,36 @@
+<h1>{{$header}}</h1>
+
+{{if $poi}}
+
+<div class="directory-item lframe" id="directory-item-{{$poi.xchan_hash}}" >
+
+<div class="contact-photo-wrapper" id="directory-photo-wrapper-{{$poi.xchan_hash}}" >
+<div class="contact-photo" id="directory-photo-{{$poi.xchan_hash}}" >
+<a href="{{$poi.xchan_url}}" class="directory-profile-link" id="directory-profile-link-{{$poi.xchan_hash}}" ><img class="directory-photo-img" src="{{$poi.xchan_photo_l}}" alt="{{$poi.xchan_addr}}" title="{{$poi.xchan_addr}}" /></a>
+<div class="contact-name">{{$poi.xchan_name}}</div>
+</div>
+</div>
+{{/if}}
+
+{{if $raters}}
+{{foreach $raters as $r}}
+
+<div class="directory-item lframe" id="directory-item-{{$r.xchan_hash}}" >
+
+<div class="contact-photo-wrapper" id="directory-photo-wrapper-{{$r.xchan_hash}}" >
+<div class="contact-photo" id="directory-photo-{{$r.xchan_hash}}" >
+<a href="{{$r.xchan_url}}" class="directory-profile-link" id="directory-profile-link-{{$r.xchan_hash}}" ><img class="directory-photo-img" src="{{$r.xchan_photo_l}}" alt="{{$r.xchan_addr}}" title="{{$r.xchan_addr}}" /></a>
+<div class="contact-name">{{$r.xchan_name}}</div>
+</div>
+Rating: {{$r.xlink_rating}}
+{{if $r.xlink_rating_text}}
+Reason: {{$r.xlink_rating_text}}
+{{/if}}
+</div>
+{{/foreach}}
+{{/if}}
+
+
+
+
+