]> git.mxchange.org Git - friendica.git/commitdiff
first step to get html code from photos.php removed
authorrabuzarus <>
Wed, 27 May 2015 01:35:29 +0000 (03:35 +0200)
committerrabuzarus <>
Wed, 27 May 2015 01:35:29 +0000 (03:35 +0200)
mod/photos.php
view/templates/photo_albums.tpl [new file with mode: 0644]

index f8bba01b00cd0de593986470127ed752e86c681d..3ae5bbf3920e9eb701388b079c51bfe1af003ad4 100644 (file)
@@ -41,8 +41,57 @@ function photos_init(&$a) {
                $albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d $sql_extra order by created desc",
                        intval($a->data['user']['uid'])
                );
-
-               if(count($albums)) {
+                
+                $ret = array('success' => false);
+                $albums_visible = ((intval($a->data['user']['hidewall']) && (! local_user()) && (! remote_user())) ? false : true);
+                
+                foreach($albums as $k => $album) {                
+                        if( $album['album'] === 'Contact Photos') {
+                                unset ($albums[$k]['album']);
+                        }
+                }
+
+                if($albums) {
+                        if ($albums_visible) {
+                                $ret['success'] = true;
+                        }
+                        $ret['albums'] = array();
+                        foreach($albums as $k => $album) {
+                                $entry = array(
+                                        'text' => $album['album'],
+                                        'total' => $album['total'], 
+                                        'url' => z_root() . '/photos/' . $channel['channel_address'] . '/album/' . bin2hex($album['album']), 
+                                        'urlencode' => urlencode($album['album']),
+                                        'bin2hex' => bin2hex($album['album'])
+                                );
+                                $ret['albums'][] = $entry;
+                        }
+                }
+
+                /*return $ret;*/
+                
+                $o = '';
+                
+                if(! $albums) {
+                        if(array_key_exists('albums', get_app()->data))
+                                $albums = get_app()->data['albums'];
+                        else
+                                $albums = $ret;
+                }
+                
+                $albums = $ret;                
+                
+
+                if($albums['success']) {
+                        $o = replace_macros(get_markup_template('photo_albums.tpl'),array(
+                                '$nick'    => $a->data['user']['nickname'],
+                                '$title'   => t('Photo Albums'),
+                                '$albums'  => $albums['albums'],
+                                '$baseurl' => z_root()
+                        ));
+                }
+
+/*             if(count($albums)) {
                        $a->data['albums'] = $albums;
 
                        $albums_visible = ((intval($a->data['user']['hidewall']) && (! local_user()) && (! remote_user())) ? false : true);     
@@ -69,6 +118,8 @@ function photos_init(&$a) {
 
                        $o .= '</div>';
                }
+ * 
+ */
 
                if(! x($a->page,'aside'))
                        $a->page['aside'] = '';
diff --git a/view/templates/photo_albums.tpl b/view/templates/photo_albums.tpl
new file mode 100644 (file)
index 0000000..bbbf5c4
--- /dev/null
@@ -0,0 +1,13 @@
+<div id="side-bar-photos-albums" class="widget">
+       <h3>{{$title}}</h3>
+       <ul class="nav nav-pills nav-stacked">
+               <li><a href="{{$baseurl}}/photos/{{$nick}}" title="{{$title}}" >Recent Photos</a></li>
+               {{if $albums}}
+               {{foreach $albums as $al}}
+               {{if $al.text}}
+               <li><a href="{{$baseurl}}/photos/{{$nick}}/album/{{$al.bin2hex}}">{{$al.text}}</a></li>
+               {{/if}}
+               {{/foreach}}
+               {{/if}}
+       </ul>
+</div>