source: trunk/bookmarks/index.php @ 1847

Revision 1847, 4.4 KB checked in by Xiping.Wang, 20 months ago (diff)

[trunk] 1.change logged layout to float. 2.Signup form refactor

Line 
1<?php
2/*
3       
4        This file is part of omCollab.
5       
6        Copyright (c) 2008 omCollab (Openmethodology Project)
7        http://www.openmethodology.org
8        http://mike2.openmethodology.org/wiki/OmCollab
9       
10        And parts copyright of Scuttle project
11        (http://sourceforge.net/projects/scuttle/, http://scuttle.org/)
12       
13        omCollab is free software: you can redistribute it and/or modify
14        it under the terms of the GNU General Public License as published by
15        the Free Software Foundation, either version 3 of the License, or
16        (at your option) any later version.
17       
18        omCollab is distributed in the hope that it will be useful,
19        but WITHOUT ANY WARRANTY; without even the implied warranty of
20        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21        GNU General Public License for more details.
22
23*/
24
25require_once('header.inc.php');
26
27$oBookmarkService =& ServiceFactory::getServiceInstance('BookmarkService');
28$oTemplateService =& ServiceFactory::getServiceInstance('TemplateService');
29$oUserService     =& ServiceFactory::getServiceInstance('UserService');
30$oCacheService    =& ServiceFactory::getServiceInstance('CacheService');
31
32$aTemplateVars = array();
33
34//MUST USE WIKI TO LOG OUT:
35//if ( isset( $_GET['action'] ) ){
36//    if ( $_GET['action'] == 'logout' ) {
37//        $oUserService->logout();
38//        $aTemplateVars['msg'] = T_( 'You have now logged out' );
39//    }
40//}
41
42// Header variables
43$aTemplateVars['loadjs']         = true;
44$aTemplateVars['bLoadJqueryPhp'] = true;
45$aTemplateVars['rsschannels']    = array( array( sprintf( T_( '%s: Recent bookmarks' )
46                                                        , $sitename )
47                                                , createURL( 'rss' ) ) );
48
49if ($usecache) {
50    // Generate hash for caching on
51    $sHashText = $_SERVER['REQUEST_URI'];
52    if ($oUserService->isLoggedOn()) {
53        $sHashText .= $oUserService->getCurrentUserID();
54    }
55    $sMd5Hash = md5( $sHashText );
56
57    // Cache for 15 minutes
58    $oCacheService->Start( $sMd5Hash, 900 );
59}
60
61// Pagination
62$iPerPage = getPerPageCount();
63if (isset($_GET['page']) && intval($_GET['page']) > 1) {
64    $iPage  = $_GET['page'];
65    $iStart = ( $iPage - 1) * $iPerPage;
66} else {
67    $iPage  = 0;
68    $iStart = 0;
69}
70
71$sDateEnd   = date( 'Y-m-d H:i:s', strtotime( 'tomorrow' ) );
72$sDateStart = date( 'Y-m-d H:i:s', strtotime( $sDateEnd .' -'. $defaultRecentDays .' days' ) );
73
74$aTemplateVars['page']           = $iPage;
75$aTemplateVars['start']          = $iStart;
76$aTemplateVars['popCount']       = 30;
77$aTemplateVars['sidebar_blocks'] = array('profile','subscribe'); // changed by zhongzhen on 2010-08-03
78// $aTemplateVars['sidebar_blocks'] = array('profile','subscribe','partners','user-activity','recent-tags'); // Original code before changing by zhongzhen on 2010-08-14
79
80//zero-rated pos in array shld be ( n * row ) where n = $iNumberOfBlocksPerRow - see bottom.inc.php
81//to ensure it is always on the right (it is hidden if empty therfore would leave a 'hole')
82$aTemplateVars['aBottomBlocks']  = array('recent-bookmarks','recent-comments','zero-rated','featured-contributor','top-contributors'); // changed by zhongzhen on 2010-08-03
83//$aTemplateVars['aBottomBlocks']  = array('recent-bookmarks','recent-comments','zero-rated'); changed by zhongzhen on 2010-08-14
84
85$aTemplateVars['range']          = 'all';
86$aTemplateVars['pagetitle']      = T_('Share your favorite Information Management links');
87$aTemplateVars['subtitle']       = T_('Bookmarks');
88$aTemplateVars['bookmarkCount']  = $iStart + 1;
89
90$aBookmarks =& $oBookmarkService->getBookmarks( $iStart
91                                              , $iPerPage
92                                              , NULL
93                                              , NULL
94                                              , NULL
95                                              , getSortOrder()
96                                              , NULL
97                                              , $sDateStart
98                                              , $sDateEnd );
99
100$aTemplateVars['total']     =  $aBookmarks['total'];
101$aTemplateVars['bookmarks'] =& $aBookmarks['bookmarks'];
102$aTemplateVars['cat_url']   =  createURL('tags', '%2$s');
103$aTemplateVars['nav_url']   =  createURL('index', '%3$s');
104
105$aTemplateVars['show_sort_controls'] = true;
106
107
108$oTemplateService->loadTemplate('bookmarks.tpl', $aTemplateVars);
109
110if ($usecache) {
111    // Cache output if existing copy has expired
112    $oCacheService->End( $sMd5Hash );
113}
114?>
Note: See TracBrowser for help on using the repository browser.