Extension ext-surfbar continued:
[mailer.git] / inc / modules / member / what-list_surfbar.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 09/17/2008 *
4  * ===================                          Last change: 09/17/2008 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-list_surfbar.php                            *
8  * -------------------------------------------------------------------- *
9  * Short description : Surfbar URL statistics                           *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Surfbar-Statistiken                              *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
20  * For more information visit: http://www.mxchange.org                  *
21  *                                                                      *
22  * This program is free software; you can redistribute it and/or modify *
23  * it under the terms of the GNU General Public License as published by *
24  * the Free Software Foundation; either version 2 of the License, or    *
25  * (at your option) any later version.                                  *
26  *                                                                      *
27  * This program is distributed in the hope that it will be useful,      *
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
30  * GNU General Public License for more details.                         *
31  *                                                                      *
32  * You should have received a copy of the GNU General Public License    *
33  * along with this program; if not, write to the Free Software          *
34  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         die();
41 } elseif (!isMember()) {
42         redirectToIndexMemberOnlyModule();
43 }
44
45 // Add description as navigation point
46 addYouAreHereLink('member', __FILE__);
47
48 if ((!isExtensionActive('surfbar')) && (!isAdmin())) {
49         displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=surfbar%}');
50         return;
51 } // END - if
52
53 // Load user URLs
54 $urlArray = SURFBAR_GET_USER_URLS();
55
56 // Are there entries or form is submitted?
57 if ((isFormSent()) && (isPostRequestParameterSet('action')) && (isPostRequestParameterSet('id'))) {
58         // Process the form
59         if (SURFBAR_MEMBER_DO_FORM(postRequestArray(), $urlArray)) {
60                 // Action performed but shall we display it?
61                 if (((postRequestParameter('action') != 'edit') && (postRequestParameter('action') != 'delete')) || (isPostRequestParameterSet('execute'))) {
62                         // Display "action done" message if action is wether 'edit' nor 'delete' or has been executed
63                         displayMessage('{--MEMBER_SURFBAR_ACTION_DONE--}');
64                 } // END - if
65         } else {
66                 // Something went wrong
67                 displayMessage('{--MEMBER_SURFBAR_ACTION_FAILED--}');
68         }
69 } elseif (count($urlArray) > 0) {
70         // List all URLs
71         $OUT = '';
72         foreach ($urlArray as $id => $content) {
73                 // "Translate"/insert data
74                 if ($content['url_views_total'] > 0) {
75                         // Include link to stats
76                         $content['url_views_total'] = '[<a href="{%url=modules.php?module=login&amp;what=list_surfbar%}">{%pipe,translateComma=' . $content['url_views_total'] . '%}</a>]';
77                 } // END - if
78                 $content['url_registered']  = generateDateTime($content['url_registered'], '2');
79                 $content['url_last_locked'] = generateDateTime($content['url_last_locked'], '2');
80                 $content['actions']         = SURFBAR_MEMBER_ACTIONS($content['url_id'], $content['url_status']);
81
82                 // Load row template
83                 $OUT .= loadTemplate('member_list_surfbar_row', true, $content);
84         } // END - foreach
85
86         // Load main template
87         loadTemplate('member_list_surfbar', false, $OUT);
88 } else {
89         // No URLs booked so far
90         displayMessage('{--MEMBER_SURFBAR_NO_URLS_FOUND--}');
91 }
92
93 // [EOF]
94 ?>