]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-list_rallyes.php
Renamed script to baseUrl to make it more clear
[mailer.git] / inc / modules / admin / what-list_rallyes.php
index 7f6f64a1475a3a4fb647946f1155b9f3f24bb486..88207882415018499c5e262a5bdb5f4aa48e2cb3 100644 (file)
  * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
  * $Author::                                                          $ *
- * Needs to be in all Files and every File needs "svn propset           *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -43,7 +41,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 } // END - if
 
 // Add description as navigation point
-addMenuDescription('admin', __FILE__);
+addYouAreHereLink('admin', __FILE__);
 
 // Init message
 $message = '';
@@ -104,7 +102,7 @@ if (isGetRequestParameterSet('rallye')) {
        runFilterChain('run_sqls');
 } elseif (isFormSent('remove')) {
        // Delete rallyes
-       if (countPostSelection() > 0) {
+       if (ifPostContainsSelections()) {
                // Init SQLs
                initSqls();
 
@@ -123,14 +121,14 @@ if (isGetRequestParameterSet('rallye')) {
                runFilterChain('run_sqls');
 
                // Output message
-               $message = getMessage('RALLYE_DELETED');
+               $message = '{--RALLYE_DELETED--}';
        } else {
                // No rallye selected to delete!
-               $message = getMessage('RALLYE_DELETE_NOTHING_SELECTED');
+               $message = '{--RALLYE_DELETE_NOTHING_SELECTED--}';
        }
 } elseif (isFormSent('change')) {
        // Change rallye
-       if (countSelection(postRequestParameter('title')) > 0) {
+       if (ifPostContainsSelections('title')) {
                // Init SQLs
                initSqls();
 
@@ -173,15 +171,15 @@ LIMIT 1",
                runFilterChain('run_sqls');
 
                // Output message
-               $message = getMessage('RALLYE_CHANGED');
+               $message = '{--RALLYE_CHANGED--}';
        }
 }
 
 if (isFormSent('edit')) {
        // Check for selections
-       if (countPostSelection() > 0) {
+       if (ifPostContainsSelections()) {
                // Make all selected and deactivated rallyes editable
-               $OUT = ''; $SW = 2;
+               $OUT = '';
                foreach (postRequestParameter('sel') as $id => $selected) {
                        // Load rallye basic data
                        $result = SQL_QUERY_ESC("SELECT
@@ -199,38 +197,34 @@ LIMIT 1",
                        SQL_FREERESULT($result);
 
                        // Starting day
-                       $content['s_sec']   = addSelectionBox('sec'  , date('s', $content['start_time']), 'start', $id);
-                       $content['s_min']   = addSelectionBox('min'  , date('i', $content['start_time']), 'start', $id);
-                       $content['s_hour']  = addSelectionBox('hour' , date('G', $content['start_time']), 'start', $id);
-                       $content['s_day']   = addSelectionBox('day'  , date('d', $content['start_time']), 'start', $id);
-                       $content['s_month'] = addSelectionBox('month', date('m', $content['start_time']), 'start', $id);
-                       $content['s_year']  = addSelectionBox('year' , date('Y', $content['start_time']), 'start', $id);
+                       $content['s_sec']   = addSelectionBox('sec'  , getSecond($content['start_time'])   , 'start', $id);
+                       $content['s_min']   = addSelectionBox('min'  , getMinute($content['start_time'])   , 'start', $id);
+                       $content['s_hour']  = addSelectionBox('hour' , getShortHour($content['start_time']), 'start', $id);
+                       $content['s_day']   = addSelectionBox('day'  , getDay($content['start_time'])      , 'start', $id);
+                       $content['s_month'] = addSelectionBox('month', getMonth($content['start_time'])    , 'start', $id);
+                       $content['s_year']  = addSelectionBox('year' , getYear($content['start_time'])     , 'start', $id);
 
                        // Ending day
-                       $content['e_sec']   = addSelectionBox('sec'  , date('s', $content['end_time'])  , 'end'  , $id);
-                       $content['e_min']   = addSelectionBox('min'  , date('i', $content['end_time'])  , 'end'  , $id);
-                       $content['e_hour']  = addSelectionBox('hour' , date('G', $content['end_time'])  , 'end'  , $id);
-                       $content['e_day']   = addSelectionBox('day'  , date('d', $content['end_time'])  , 'end'  , $id);
-                       $content['e_month'] = addSelectionBox('month', date('m', $content['end_time'])  , 'end'  , $id);
-                       $content['e_year']  = addSelectionBox('year' , date('Y', $content['end_time'])  , 'end'  , $id);
+                       $content['e_sec']   = addSelectionBox('sec'  , getSecond($content['end_time'])     , 'end'  , $id);
+                       $content['e_min']   = addSelectionBox('min'  , getMinute($content['end_time'])     , 'end'  , $id);
+                       $content['e_hour']  = addSelectionBox('hour' , getShortHour($content['end_time'])  , 'end'  , $id);
+                       $content['e_day']   = addSelectionBox('day'  , getDay($content['end_time'])        , 'end'  , $id);
+                       $content['e_month'] = addSelectionBox('month', getMonth($content['end_time'])      , 'end'  , $id);
+                       $content['e_year']  = addSelectionBox('year' , getYear($content['end_time'])       , 'end'  , $id);
 
                        // Remember other values
                        $content['templ']      = addReferalRallyeTemplateSelection('templ['.$id.']', $content['template']);
-                       $content['sw']         = $SW;
                        $content['id']         = $id;
 
                        // Output row
                        $OUT .= loadTemplate('admin_edit_rallyes_row', true, $content);
-
-                       // Color switching
-                       $SW = 3 - $SW;
                } // END - foreach
 
                // Load final template
                loadTemplate('admin_edit_rallyes', false, $OUT);
        } else {
                // Nothing selected to edit
-               loadTemplate('admin_settings_saved', false, getMessage('RALLYE_NO_RALLYES_SELECTED'));
+               displayMessage('{--RALLYE_NO_RALLYES_SELECTED--}');
        }
 } elseif ((getRequestParameter('sub') == 'users') && (getRequestParameter('rallye') > 0)) {
        // List users and their refs before start and current
@@ -243,19 +237,22 @@ WHERE
 ORDER BY
        `userid` ASC",
                array(bigintval(getRequestParameter('rallye'))), __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) > 0) {
-               $OUT = ''; $SW = 2;
+       if (!SQL_HASZERONUMS($result)) {
+               $OUT = '';
                $content['rallye'] = getRequestParameter('rallye');
                while ($row = SQL_FETCHARRAY($result)) {
                        // Check for referal count
-                       $cnt = getReferalRallyeRefsCount($row['userid'], $row['refs']);
+                       $count = getReferalRallyeRefsCount($row['userid'], $row['refs']);
 
                        // Init variables
                        $bl = '';
                        $br = '';
 
                        // Output row
-                       if (($row['curr_points'] > 0) && ($cnt > 0)) { $bl = '<strong>'; $br = '</strong>'; }
+                       if (($row['curr_points'] > 0) && ($count > 0)) {
+                               $bl = '<strong>';
+                               $br = '</strong>';
+                       } // END - if
 
                        // Get user points
                        $points = countSumTotalData($row['userid'], 'user_points', 'points', 'userid', false, " AND `ref_depth`=1 LIMIT 1");
@@ -263,18 +260,16 @@ ORDER BY
 
                        // Prepare content
                        $row = array(
-                               'sw'      => $SW ,
                                'userid'  => $row['userid'],
                                'bold_l'  => $bl ,
                                'bold_r'  => $br ,
-                               'rews'    => $row['refs'],
-                               'cnt'     => $cnt,
+                               'refs'    => $row['refs'],
+                               'cnt'     => $count,
                                'opoints' => ($points - $row['curr_points']),
                        );
 
                        // Load row template and switch color
                        $OUT .= loadTemplate('admin_list_rallye_usr_row', true, $row);
-                       $SW = 3 - $SW;
                } // END - while
 
                // Remember rows
@@ -288,7 +283,7 @@ ORDER BY
                loadTemplate('admin_list_rallye_usr', false, $content);
        } else {
                // No entries found?
-               loadTemplate('admin_settings_saved', false, getMessage('RALLYE_ADMIN_USERS_404'));
+               displayMessage('{--RALLYE_ADMIN_USERS_404--}');
        }
 } else {
        // Start listing rallyes
@@ -301,13 +296,10 @@ ORDER BY
        `start_time` DESC", __FILE__, __LINE__);
 
        // Records found?
-       if (SQL_NUMROWS($result) > 0) {
+       if (!SQL_HASZERONUMS($result)) {
                // List found rallyes
-               $OUT = ''; $SW = 2;
+               $OUT = '';
                while ($data = SQL_FETCHARRAY($result)) {
-                       // Load admin login
-                       $data['login'] = getAdminLogin($data['admin_id']);
-
                        // Count joined userids
                        $users = countSumTotalData($data['id'], 'rallye_users', 'id', 'rallye_id', true);
 
@@ -317,18 +309,11 @@ ORDER BY
                                $users = '<a href="{%url=modules.php?module=admin&amp;what=list_rallyes&amp;sub=users&amp;rallye=' . $data['id'] . '%}" title="{--RALLYE_LIST_USERS_TITLE--}">' . $users . '</a>';
                        } // END - if
 
-                       // Alter some variables
-                       if (empty($data['login']))    $data['login']     = '???';
-                       if (empty($data['template'])) $data['template']  = '---';
-                       if (empty($data['descr']))    $data['descr']     = '---';
-
                        // Transfer data into array for the template
                        $row = array(
-                               'select'            => '<input type="checkbox" name="sel[' . $data['id'] . ']" class="admin_normal" value="1" />',
+                               'select'            => '<input type="checkbox" name="sel[' . $data['id'] . ']" class="form_field" value="1" />',
                                'admin_id'          => $data['admin_id'],
-                               'login'             => $data['login'],
                                'id'                => $data['id'],
-                               'sw'                => $SW,
                                'title'             => $data['title'],
                                'template'          => $data['template'],
                                'users_content'     => $users,
@@ -349,12 +334,12 @@ ORDER BY
                                case 'Y':
                                        // Rallye is active so do not edit it!
                                        $row['select']       = '<div class="big">' . $row['id'] . '</div>';
-                                       $row['active_title'] = getMessage('RALLYE_DEACTIVATE_NOW');
+                                       $row['active_title'] = '{--RALLYE_DEACTIVATE_NOW--}';
                                        $row['active']       = '0';
                                        break;
 
                                case 'N':
-                                       $row['active_title'] = getMessage('RALLYE_ACTIVATE_NOW');
+                                       $row['active_title'] = '{--RALLYE_ACTIVATE_NOW--}';
                                        $row['active']       = 1;
                                        break;
                        } // END - switch
@@ -362,12 +347,12 @@ ORDER BY
                        // Notification to members?
                        switch ($data['send_notify']) {
                                case 'Y':
-                                       $row['notify_title'] = getMessage('RALLYE_STOP_NOTIFY_NOW');
+                                       $row['notify_title'] = '{--RALLYE_STOP_NOTIFY_NOW--}';
                                        $row['notify']       = '0';
                                        break;
 
                                case 'N':
-                                       $row['notify_title'] = getMessage('RALLYE_START_NOTIFY_NOW');
+                                       $row['notify_title'] = '{--RALLYE_START_NOTIFY_NOW--}';
                                        $row['notify']       = 1;
                                        break;
                        } // END - switch
@@ -375,19 +360,18 @@ ORDER BY
                        // Auto-add of new joined members?
                        switch ($data['auto_add_new_user']) {
                                case 'Y':
-                                       $row['auto_title'] = getMessage('RALLYE_STOP_AUTO_ADD_NOW');
+                                       $row['auto_title'] = '{--RALLYE_STOP_AUTO_ADD_NOW--}';
                                        $row['auto']       = '0';
                                        break;
 
                                case 'N':
-                                       $row['auto_title'] = getMessage('RALLYE_START_AUTO_ADD_NOW');
+                                       $row['auto_title'] = '{--RALLYE_START_AUTO_ADD_NOW--}';
                                        $row['auto']       = 1;
                                        break;
                        } // END - switch
 
                        // Output row
                        $OUT .= loadTemplate('admin_list_rallyes_row', true, $row);
-                       $SW = 3 - $SW;
                } // END - while
 
                // Free memory
@@ -400,7 +384,7 @@ ORDER BY
                loadTemplate('admin_list_rallyes', false, $content);
        } else {
                // No rallyes setup so far
-               loadTemplate('admin_settings_saved', false, getMessage('RALLYE_NO_RALLYES_SETUP'));
+               displayMessage('{--RALLYE_NO_RALLYES_SETUP--}');
        }
 }