diff options
author | zotlabs <mike@macgirvin.com> | 2016-11-24 15:08:31 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2016-11-24 15:08:31 -0800 |
commit | 08a4bbb7d0b9c63ec97bb4f74e5842cc3ea8ee77 (patch) | |
tree | bd2b85d4a39c2d185d11d6c795a0a1a35e4abf99 | |
parent | 1596391a2ebcdfe9955e28b1db14adc05a6856da (diff) | |
download | volse-hubzilla-08a4bbb7d0b9c63ec97bb4f74e5842cc3ea8ee77.tar.gz volse-hubzilla-08a4bbb7d0b9c63ec97bb4f74e5842cc3ea8ee77.tar.bz2 volse-hubzilla-08a4bbb7d0b9c63ec97bb4f74e5842cc3ea8ee77.zip |
prev-next navigation for mod_connedit
-rw-r--r-- | Zotlabs/Module/Connedit.php | 39 | ||||
-rwxr-xr-x | view/tpl/abook_edit.tpl | 10 |
2 files changed, 46 insertions, 3 deletions
diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 5ab6f814b..9dfa871f7 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -41,11 +41,16 @@ class Connedit extends \Zotlabs\Web\Controller { } } + $channel = \App::get_channel(); if($channel) head_set_icon($channel['xchan_photo_s']); } + + static public function xchan_name_sort($a,$b) { + return strcasecmp($a['xchan_name'],$b['xchan_name']); + } /* @brief Evaluate posted values and set changes * @@ -546,9 +551,34 @@ class Connedit extends \Zotlabs\Web\Controller { if(\App::$poi) { + $abook_prev = 0; + $abook_next = 0; + $contact_id = \App::$poi['abook_id']; $contact = \App::$poi; - + + $cn = q("SELECT abook_id, xchan_name from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and abook_self = 0", + intval(local_channel()) + ); + if($cn) { + usort($cn, '\\Zotlabs\\Module\\Connedit::xchan_name_sort'); + + $pntotal = count($cn); + + for($x = 0; $x < $pntotal; $x ++) { + if($cn[$x]['abook_id'] == $contact_id) { + if($x === 0) + $abook_prev = 0; + else + $abook_prev = $cn[$x - 1]['abook_id']; + if($x === $pntotal) + $abook_next = 0; + else + $abook_next = $cn[$x +1]['abook_id']; + } + } + } + $tools = array( 'view' => array( @@ -615,8 +645,10 @@ class Connedit extends \Zotlabs\Web\Controller { $self = false; - if(intval($contact['abook_self'])) + if(intval($contact['abook_self'])) { $self = true; + $abook_prev = $abook_next = 0; + } $tpl = get_markup_template("abook_edit.tpl"); @@ -792,7 +824,8 @@ class Connedit extends \Zotlabs\Web\Controller { '$multiprofs' => $multiprofs, '$contact_id' => $contact['abook_id'], '$name' => $contact['xchan_name'], - + '$abook_prev' => $abook_prev, + '$abook_next' => $abook_next )); $arr = array('contact' => $contact,'output' => $o); diff --git a/view/tpl/abook_edit.tpl b/view/tpl/abook_edit.tpl index 835948096..e7e5b928f 100755 --- a/view/tpl/abook_edit.tpl +++ b/view/tpl/abook_edit.tpl @@ -1,6 +1,16 @@ <div class="generic-content-wrapper"> <div class="section-title-wrapper"> {{if $notself}} + {{if $abook_prev || $abook_next}} + <div class="btn-group pull-right"> + {{if $abook_prev}} + <a href="connedit/{{$abook_prev}}" class="btn btn-default btn-xs" ><i class="fa fa-backward"></i></a> + {{/if}} + {{if $abook_next}} + <a href="connedit/{{$abook_next}}" class="btn btn-default btn-xs" ><i class="fa fa-forward"></i></a> + {{/if}} + </div> + {{/if}} <div class="dropdown pull-right"> <button id="connection-dropdown" class="btn btn-default btn-xs" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fa fa-caret-down"></i> {{$tools_label}} |