Completed
Branch master (838035)
by Michael
03:45
created
htdocs/modules/extcal/class/pear/Calendar/Factory.php 1 patch
Switch Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -95,58 +95,58 @@
 block discarded – undo
95 95
     {
96 96
         $firstDay = defined('CALENDAR_FIRST_DAY_OF_WEEK') ? CALENDAR_FIRST_DAY_OF_WEEK : 1;
97 97
         switch ($type) {
98
-        case 'Day':
99
-            include_once CALENDAR_ROOT.'Day.php';
98
+            case 'Day':
99
+                include_once CALENDAR_ROOT.'Day.php';
100 100
 
101
-            return new Calendar_Day($y, $m, $d);
102
-        case 'Month':
103
-            // Set default state for which month type to build
104
-            if (!defined('CALENDAR_MONTH_STATE')) {
105
-                define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH);
106
-            }
107
-            switch (CALENDAR_MONTH_STATE) {
108
-            case CALENDAR_USE_MONTH_WEEKDAYS:
109
-                include_once CALENDAR_ROOT.'Month/Weekdays.php';
110
-                $class = 'Calendar_Month_Weekdays';
111
-                break;
112
-            case CALENDAR_USE_MONTH_WEEKS:
113
-                include_once CALENDAR_ROOT.'Month/Weeks.php';
114
-                $class = 'Calendar_Month_Weeks';
115
-                break;
116
-            case CALENDAR_USE_MONTH:
117
-            default:
118
-                include_once CALENDAR_ROOT.'Month.php';
119
-                $class = 'Calendar_Month';
120
-                break;
121
-            }
101
+                return new Calendar_Day($y, $m, $d);
102
+            case 'Month':
103
+                // Set default state for which month type to build
104
+                if (!defined('CALENDAR_MONTH_STATE')) {
105
+                    define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH);
106
+                }
107
+                switch (CALENDAR_MONTH_STATE) {
108
+                    case CALENDAR_USE_MONTH_WEEKDAYS:
109
+                        include_once CALENDAR_ROOT.'Month/Weekdays.php';
110
+                        $class = 'Calendar_Month_Weekdays';
111
+                        break;
112
+                    case CALENDAR_USE_MONTH_WEEKS:
113
+                        include_once CALENDAR_ROOT.'Month/Weeks.php';
114
+                        $class = 'Calendar_Month_Weeks';
115
+                        break;
116
+                    case CALENDAR_USE_MONTH:
117
+                    default:
118
+                        include_once CALENDAR_ROOT.'Month.php';
119
+                        $class = 'Calendar_Month';
120
+                        break;
121
+                }
122 122
 
123 123
             return new $class($y, $m, $firstDay);
124
-        case 'Week':
125
-            include_once CALENDAR_ROOT.'Week.php';
124
+            case 'Week':
125
+                include_once CALENDAR_ROOT.'Week.php';
126 126
 
127
-            return new Calendar_Week($y, $m, $d, $firstDay);
128
-        case 'Hour':
129
-            include_once CALENDAR_ROOT.'Hour.php';
127
+                return new Calendar_Week($y, $m, $d, $firstDay);
128
+            case 'Hour':
129
+                include_once CALENDAR_ROOT.'Hour.php';
130 130
 
131
-            return new Calendar_Hour($y, $m, $d, $h);
132
-        case 'Minute':
133
-            include_once CALENDAR_ROOT.'Minute.php';
131
+                return new Calendar_Hour($y, $m, $d, $h);
132
+            case 'Minute':
133
+                include_once CALENDAR_ROOT.'Minute.php';
134 134
 
135
-            return new Calendar_Minute($y, $m, $d, $h, $i);
136
-        case 'Second':
137
-            include_once CALENDAR_ROOT.'Second.php';
135
+                return new Calendar_Minute($y, $m, $d, $h, $i);
136
+            case 'Second':
137
+                include_once CALENDAR_ROOT.'Second.php';
138 138
 
139
-            return new Calendar_Second($y, $m, $d, $h, $i, $s);
140
-        case 'Year':
141
-            include_once CALENDAR_ROOT.'Year.php';
139
+                return new Calendar_Second($y, $m, $d, $h, $i, $s);
140
+            case 'Year':
141
+                include_once CALENDAR_ROOT.'Year.php';
142 142
 
143
-            return new Calendar_Year($y);
144
-        default:
145
-            include_once 'PEAR.php';
146
-            PEAR::raiseError('Calendar_Factory::create() unrecognised type: '.$type,
147
-                null, PEAR_ERROR_TRIGGER, E_USER_NOTICE, 'Calendar_Factory::create()');
143
+                return new Calendar_Year($y);
144
+            default:
145
+                include_once 'PEAR.php';
146
+                PEAR::raiseError('Calendar_Factory::create() unrecognised type: '.$type,
147
+                    null, PEAR_ERROR_TRIGGER, E_USER_NOTICE, 'Calendar_Factory::create()');
148 148
 
149
-            return false;
149
+                return false;
150 150
         }
151 151
     }
152 152
 
Please login to merge, or discard this patch.
htdocs/modules/extcal/class/pear/Calendar/Util/Textual.php 1 patch
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
             $stamp = mktime(0, 0, 0, $i, 1, 2003);
97 97
             $month = strftime($formats[$format], $stamp);
98 98
             switch ($format) {
99
-            case 'one':
100
-                $month = substr($month, 0, 1);
101
-                break;
102
-            case 'two':
103
-                $month = substr($month, 0, 2);
104
-                break;
99
+                case 'one':
100
+                    $month = substr($month, 0, 1);
101
+                    break;
102
+                case 'two':
103
+                    $month = substr($month, 0, 2);
104
+                    break;
105 105
             }
106 106
             $months[$i] = $month;
107 107
         }
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
             $stamp = mktime(0, 0, 0, 11, $i+2, 2003);
135 135
             $day = strftime($formats[$format], $stamp);
136 136
             switch ($format) {
137
-            case 'one':
138
-                $day = substr($day, 0, 1);
139
-                break;
140
-            case 'two':
141
-                $day = substr($day, 0, 2);
142
-                break;
137
+                case 'one':
138
+                    $day = substr($day, 0, 1);
139
+                    break;
140
+                case 'two':
141
+                    $day = substr($day, 0, 2);
142
+                    break;
143 143
             }
144 144
             $days[$i] = $day;
145 145
         }
Please login to merge, or discard this patch.
htdocs/modules/extcal/class/pear/Calendar/Week.php 1 patch
Switch Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -347,23 +347,23 @@  discard block
 block discarded – undo
347 347
     function prevWeek($format = 'n_in_month')
348 348
     {
349 349
         switch (strtolower($format)) {
350
-        case 'int':
351
-        case 'n_in_month':
352
-            return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') -1;
353
-        case 'n_in_year':
354
-            return $this->cE->getWeekNInYear(
355
-                $this->cE->stampToYear($this->prevWeek),
356
-                $this->cE->stampToMonth($this->prevWeek),
357
-                $this->cE->stampToDay($this->prevWeek));
358
-        case 'array':
359
-            return $this->toArray($this->prevWeek);
360
-        case 'object':
361
-            include_once CALENDAR_ROOT.'Factory.php';
362
-
363
-            return Calendar_Factory::createByTimestamp('Week', $this->prevWeek);
364
-        case 'timestamp':
365
-        default:
366
-            return $this->prevWeek;
350
+            case 'int':
351
+            case 'n_in_month':
352
+                return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') -1;
353
+            case 'n_in_year':
354
+                return $this->cE->getWeekNInYear(
355
+                    $this->cE->stampToYear($this->prevWeek),
356
+                    $this->cE->stampToMonth($this->prevWeek),
357
+                    $this->cE->stampToDay($this->prevWeek));
358
+            case 'array':
359
+                return $this->toArray($this->prevWeek);
360
+            case 'object':
361
+                include_once CALENDAR_ROOT.'Factory.php';
362
+
363
+                return Calendar_Factory::createByTimestamp('Week', $this->prevWeek);
364
+            case 'timestamp':
365
+            default:
366
+                return $this->prevWeek;
367 367
         }
368 368
     }
369 369
 
@@ -378,37 +378,37 @@  discard block
 block discarded – undo
378 378
     function thisWeek($format = 'n_in_month')
379 379
     {
380 380
         switch (strtolower($format)) {
381
-        case 'int':
382
-        case 'n_in_month':
383
-            if ($this->firstWeek) {
384
-                return 1;
385
-            }
386
-            if ($this->lastWeek) {
387
-                return $this->cE->getWeeksInMonth(
381
+            case 'int':
382
+            case 'n_in_month':
383
+                if ($this->firstWeek) {
384
+                    return 1;
385
+                }
386
+                if ($this->lastWeek) {
387
+                    return $this->cE->getWeeksInMonth(
388
+                        $this->thisYear(),
389
+                        $this->thisMonth(),
390
+                        $this->firstDay);
391
+                }
392
+
393
+                return $this->cE->getWeekNInMonth(
388 394
                     $this->thisYear(),
389 395
                     $this->thisMonth(),
396
+                    $this->thisDay(),
390 397
                     $this->firstDay);
391
-            }
392
-
393
-            return $this->cE->getWeekNInMonth(
394
-                $this->thisYear(),
395
-                $this->thisMonth(),
396
-                $this->thisDay(),
397
-                $this->firstDay);
398
-        case 'n_in_year':
399
-            return $this->cE->getWeekNInYear(
400
-                $this->cE->stampToYear($this->thisWeek),
401
-                $this->cE->stampToMonth($this->thisWeek),
402
-                $this->cE->stampToDay($this->thisWeek));
403
-        case 'array':
404
-            return $this->toArray($this->thisWeek);
405
-        case 'object':
406
-            include_once CALENDAR_ROOT.'Factory.php';
407
-
408
-            return Calendar_Factory::createByTimestamp('Week', $this->thisWeek);
409
-        case 'timestamp':
410
-        default:
411
-            return $this->thisWeek;
398
+            case 'n_in_year':
399
+                return $this->cE->getWeekNInYear(
400
+                    $this->cE->stampToYear($this->thisWeek),
401
+                    $this->cE->stampToMonth($this->thisWeek),
402
+                    $this->cE->stampToDay($this->thisWeek));
403
+            case 'array':
404
+                return $this->toArray($this->thisWeek);
405
+            case 'object':
406
+                include_once CALENDAR_ROOT.'Factory.php';
407
+
408
+                return Calendar_Factory::createByTimestamp('Week', $this->thisWeek);
409
+            case 'timestamp':
410
+            default:
411
+                return $this->thisWeek;
412 412
         }
413 413
     }
414 414
 
@@ -423,23 +423,23 @@  discard block
 block discarded – undo
423 423
     function nextWeek($format = 'n_in_month')
424 424
     {
425 425
         switch (strtolower($format)) {
426
-        case 'int':
427
-        case 'n_in_month':
428
-            return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') +1;
429
-        case 'n_in_year':
430
-            return $this->cE->getWeekNInYear(
431
-                $this->cE->stampToYear($this->nextWeek),
432
-                $this->cE->stampToMonth($this->nextWeek),
433
-                $this->cE->stampToDay($this->nextWeek));
434
-        case 'array':
435
-            return $this->toArray($this->nextWeek);
436
-        case 'object':
437
-            include_once CALENDAR_ROOT.'Factory.php';
438
-
439
-            return Calendar_Factory::createByTimestamp('Week', $this->nextWeek);
440
-        case 'timestamp':
441
-        default:
442
-            return $this->nextWeek;
426
+            case 'int':
427
+            case 'n_in_month':
428
+                return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') +1;
429
+            case 'n_in_year':
430
+                return $this->cE->getWeekNInYear(
431
+                    $this->cE->stampToYear($this->nextWeek),
432
+                    $this->cE->stampToMonth($this->nextWeek),
433
+                    $this->cE->stampToDay($this->nextWeek));
434
+            case 'array':
435
+                return $this->toArray($this->nextWeek);
436
+            case 'object':
437
+                include_once CALENDAR_ROOT.'Factory.php';
438
+
439
+                return Calendar_Factory::createByTimestamp('Week', $this->nextWeek);
440
+            case 'timestamp':
441
+            default:
442
+                return $this->nextWeek;
443 443
         }
444 444
     }
445 445
 
Please login to merge, or discard this patch.
htdocs/modules/extcal/class/pear/Calendar/Calendar.php 1 patch
Switch Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
     {
88 88
         static $engine = false;
89 89
         switch (CALENDAR_ENGINE) {
90
-        case 'PearDate':
91
-            $class = 'Calendar_Engine_PearDate';
92
-            break;
93
-        case 'UnixTS':
94
-        default:
95
-            $class = 'Calendar_Engine_UnixTS';
96
-            break;
90
+            case 'PearDate':
91
+                $class = 'Calendar_Engine_PearDate';
92
+                break;
93
+            case 'UnixTS':
94
+            default:
95
+                $class = 'Calendar_Engine_UnixTS';
96
+                break;
97 97
         }
98 98
         if (!$engine) {
99 99
             if (!class_exists($class)) {
@@ -342,20 +342,20 @@  discard block
 block discarded – undo
342 342
     function returnValue($returnType, $format, $stamp, $default)
343 343
     {
344 344
         switch (strtolower($format)) {
345
-        case 'int':
346
-            return $default;
347
-        case 'array':
348
-            return $this->toArray($stamp);
349
-            break;
350
-        case 'object':
351
-            include_once CALENDAR_ROOT.'Factory.php';
352
-
353
-            return Calendar_Factory::createByTimestamp($returnType, $stamp);
354
-            break;
355
-        case 'timestamp':
356
-        default:
357
-            return $stamp;
358
-            break;
345
+            case 'int':
346
+                return $default;
347
+            case 'array':
348
+                return $this->toArray($stamp);
349
+                break;
350
+            case 'object':
351
+                include_once CALENDAR_ROOT.'Factory.php';
352
+
353
+                return Calendar_Factory::createByTimestamp($returnType, $stamp);
354
+                break;
355
+            case 'timestamp':
356
+            default:
357
+                return $stamp;
358
+                break;
359 359
         }
360 360
     }
361 361
 
Please login to merge, or discard this patch.
htdocs/modules/extcal/admin/event.php 1 patch
Switch Indentation   +320 added lines, -320 removed lines patch added patch discarded remove patch
@@ -51,180 +51,198 @@  discard block
 block discarded – undo
51 51
 
52 52
 switch ($op) {
53 53
 
54
-    case 'enreg':
55
-
56
-        $eventHandler = xoops_getmodulehandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE);
57
-        $fileHandler  = xoops_getmodulehandler(_EXTCAL_CLS_FILE, _EXTCAL_MODULE);
58
-// $t = print_r($_POST,true);
59
-// echo "<pre>{$t}</pre><br>";
60
-// exit;
61
-        // If the date format is wrong
62
-//        if (
63
-//            !preg_match(_EXTCAL_MOTIF_DATE, $_POST['event_start']['date'])
64
-//                || !preg_match(_EXTCAL_MOTIF_DATE, $_POST['event_end']['date'])
65
-//        ) {
66
-//            redirect_header(
67
-//                'event.php', 3, _MD_EXTCAL_WRONG_DATE_FORMAT . "<br />"
68
-//                . implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())
69
-//            );
70
-//            exit;
71
-//        }
72
-
73
-//exit;
74
-        ///////////////////////////////////////////////////////////////////////////////
75
-        extcal_loadImg($_REQUEST, $event_picture1, $event_picture2);
76
-        ///////////////////////////////////////////////////////////////////////////////
77
-        $data = array(
78
-            'event_title'         => $_POST['event_title'],
79
-            'cat_id'              => $_POST['cat_id'],
80
-            'event_desc'          => $_POST['event_desc'],
81
-            'event_nbmember'      => $_POST['event_nbmember'],
82
-            'event_organisateur'  => $_POST['event_organisateur'],
83
-            'event_contact'       => $_POST['event_contact'],
84
-            'event_url'           => $_POST['event_url'],
85
-            'event_email'         => $_POST['event_email'],
86
-            'event_address'       => $_POST['event_address'],
87
-            'event_approved'      => 1,
88
-            'event_start'         => $_POST['event_start'],
89
-            'have_end'            => $_POST['have_end'],
90
-            'event_end'           => $_POST['event_end'],
91
-            'event_picture1'      => @$event_picture1,
92
-            'event_picture2'      => @$event_picture2,
93
-            'event_price'         => @$_POST['event_price'],
94
-            'event_etablissement' => $_POST['event_etablissement'],
95
-            'dohtml'              => $extcalConfig['allow_html'],
96
-            'event_icone'         => $_POST['event_icone']
97
-        );
98
-
99
-        // Event edited
100
-        if (isset($_POST['event_id'])) {
101
-
102
-            if (!$eventHandler->modifyEvent($_POST['event_id'], $data)) {
103
-                redirect_header("event.php", 3, _AM_EXTCAL_EVENT_EDIT_FAILED, false);
54
+        case 'enreg':
55
+
56
+            $eventHandler = xoops_getmodulehandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE);
57
+            $fileHandler  = xoops_getmodulehandler(_EXTCAL_CLS_FILE, _EXTCAL_MODULE);
58
+    // $t = print_r($_POST,true);
59
+    // echo "<pre>{$t}</pre><br>";
60
+    // exit;
61
+            // If the date format is wrong
62
+    //        if (
63
+    //            !preg_match(_EXTCAL_MOTIF_DATE, $_POST['event_start']['date'])
64
+    //                || !preg_match(_EXTCAL_MOTIF_DATE, $_POST['event_end']['date'])
65
+    //        ) {
66
+    //            redirect_header(
67
+    //                'event.php', 3, _MD_EXTCAL_WRONG_DATE_FORMAT . "<br />"
68
+    //                . implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())
69
+    //            );
70
+    //            exit;
71
+    //        }
72
+
73
+    //exit;
74
+            ///////////////////////////////////////////////////////////////////////////////
75
+            extcal_loadImg($_REQUEST, $event_picture1, $event_picture2);
76
+            ///////////////////////////////////////////////////////////////////////////////
77
+            $data = array(
78
+                'event_title'         => $_POST['event_title'],
79
+                'cat_id'              => $_POST['cat_id'],
80
+                'event_desc'          => $_POST['event_desc'],
81
+                'event_nbmember'      => $_POST['event_nbmember'],
82
+                'event_organisateur'  => $_POST['event_organisateur'],
83
+                'event_contact'       => $_POST['event_contact'],
84
+                'event_url'           => $_POST['event_url'],
85
+                'event_email'         => $_POST['event_email'],
86
+                'event_address'       => $_POST['event_address'],
87
+                'event_approved'      => 1,
88
+                'event_start'         => $_POST['event_start'],
89
+                'have_end'            => $_POST['have_end'],
90
+                'event_end'           => $_POST['event_end'],
91
+                'event_picture1'      => @$event_picture1,
92
+                'event_picture2'      => @$event_picture2,
93
+                'event_price'         => @$_POST['event_price'],
94
+                'event_etablissement' => $_POST['event_etablissement'],
95
+                'dohtml'              => $extcalConfig['allow_html'],
96
+                'event_icone'         => $_POST['event_icone']
97
+            );
98
+
99
+            // Event edited
100
+            if (isset($_POST['event_id'])) {
101
+
102
+                if (!$eventHandler->modifyEvent($_POST['event_id'], $data)) {
103
+                    redirect_header("event.php", 3, _AM_EXTCAL_EVENT_EDIT_FAILED, false);
104
+                } else {
105
+                    $fileHandler->createFile(intval($_POST['event_id']));
106
+                    redirect_header("event.php", 3, _AM_EXTCAL_EVENT_EDITED, false);
107
+                }
108
+
109
+                // New event
104 110
             } else {
105
-                $fileHandler->createFile(intval($_POST['event_id']));
106
-                redirect_header("event.php", 3, _AM_EXTCAL_EVENT_EDITED, false);
111
+                $notificationHandler =& xoops_gethandler('notification');
112
+                $catHandler          = xoops_getmodulehandler(_EXTCAL_CLS_CAT, _EXTCAL_MODULE);
113
+
114
+                $data['event_submitter']  = ($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
115
+                $data['event_submitdate'] = time();
116
+
117
+                if ($eventHandler->createEvent($data, $_POST)) {
118
+
119
+                    $fileHandler->createFile($eventHandler->getInsertId());
120
+                    $cat = $catHandler->getCat($_POST['cat_id'], $xoopsUser, 'all');
121
+                    $notificationHandler->triggerEvent('global', 0, 'new_event', array('EVENT_TITLE' => $_POST['event_title']));
122
+                    $notificationHandler->triggerEvent('cat', $_POST['cat_id'], 'new_event_cat', array('EVENT_TITLE' => $_POST['event_title'], 'CAT_NAME' => $cat->getVar('cat_name')));
123
+                    redirect_header("event.php", 3, _AM_EXTCAL_EVENT_CREATED, false);
124
+                } else {
125
+                    redirect_header("event.php", 3, _AM_EXTCAL_EVENT_CREATE_FAILED, false);
126
+                }
127
+
107 128
             }
129
+            break;
108 130
 
109
-            // New event
110
-        } else {
111
-            $notificationHandler =& xoops_gethandler('notification');
112
-            $catHandler          = xoops_getmodulehandler(_EXTCAL_CLS_CAT, _EXTCAL_MODULE);
131
+        case 'clone': /* sur validation du formulaire */
132
+        case 'modify':
133
+            $action = (($op == 'clone') ? 'clone' : 'edit');
134
+            xoops_cp_header();
135
+    //================================================
136
+    // include_once (XOOPS_ROOT_PATH . '/class/xoopsform/tc_calendar/formtccalendar.php');
137
+    //
138
+    // 		  // Call the calendar constructor - use the desired form and format, according to the instructions/samples provided on triconsole.com
139
+    // 		  $dateBirthday = new XoopsTcCalendar("datez1", true, false);
140
+    // 		  //$dateBirthday->setIcon("/images/iconCalendar.gif");
141
+    // 		  $dateBirthday->setIcon("/class/xoopsform/tc_calendar/images/iconCalendar.gif");
142
+    // 		  //$dateBirthday->rtl=false;
143
+    // 		  $dateBirthday->setAutoHide(false);
144
+    //
145
+    //       //$myCalendar->setDate(date('d'), date('m'), date('Y'));
146
+    //       //$dateBirthday->setDate($p['date1_day'], $p['date1_month'], $p['date1_year']);
147
+    // 		  $dateBirthday->setDate(date('d'), date('m'), date('Y'));
148
+    //
149
+    // 		  $dateBirthday->setPath(XOOPS_URL . "/class/xoopsform/tc_calendar/");
150
+    // 		  $dateBirthday->zindex = 150; //default 1
151
+    // 		  $dateBirthday->setYearInterval(1995, date('Y'));
152
+    // 		  $dateBirthday->dateAllow('1960-03-01', date('Y-m-d'));
153
+    // 		  //$dateBirthday->autoSubmit(true, "calendar");
154
+    // 		  $dateBirthday->disabledDay("sat");
155
+    // 		  $dateBirthday->disabledDay("sun");
156
+    // 		  $dateBirthday->setSpecificDate(array("2011-04-14", "2010-12-25"), 0, 'month');
157
+    // 		  $dateBirthday->setSpecificDate(array("2011-04-01"), 0, 'year');
158
+    // 		  $dateBirthday->setAlignment('right', 'bottom'); //optional
159
+    // echo "<table><tr><td>zzzzz</td><td></td><td>";
160
+    // echo $dateBirthday->render();
161
+    // echo "</td></tr></table>";
162
+    //echo $dateBirthday->render();
163
+    //================================================
164
+            // @author      Gregory Mage (Aka Mage)
165
+            //***************************************************************************************
166
+    //         include_once XOOPS_ROOT_PATH . "/modules/extcal/class/admin.php";
167
+            $eventAdmin = new ModuleAdmin();
168
+            echo $eventAdmin->addNavigation('event.php');
169
+            //***************************************************************************************
113 170
 
114
-            $data['event_submitter']  = ($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
115
-            $data['event_submitdate'] = time();
171
+            $eventId      = $_GET['event_id'];
172
+            $eventHandler = xoops_getmodulehandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE);
116 173
 
117
-            if ($eventHandler->createEvent($data, $_POST)) {
174
+            echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _MD_EXTCAL_EDIT_EVENT . '</legend>';
118 175
 
119
-                $fileHandler->createFile($eventHandler->getInsertId());
120
-                $cat = $catHandler->getCat($_POST['cat_id'], $xoopsUser, 'all');
121
-                $notificationHandler->triggerEvent('global', 0, 'new_event', array('EVENT_TITLE' => $_POST['event_title']));
122
-                $notificationHandler->triggerEvent('cat', $_POST['cat_id'], 'new_event_cat', array('EVENT_TITLE' => $_POST['event_title'], 'CAT_NAME' => $cat->getVar('cat_name')));
123
-                redirect_header("event.php", 3, _AM_EXTCAL_EVENT_CREATED, false);
124
-            } else {
125
-                redirect_header("event.php", 3, _AM_EXTCAL_EVENT_CREATE_FAILED, false);
176
+            if ($form = $eventHandler->getEventForm('admin', $action, array('event_id' => $eventId))) {
177
+                $form->display();
126 178
             }
127 179
 
128
-        }
129
-        break;
130
-
131
-    case 'clone': /* sur validation du formulaire */
132
-    case 'modify':
133
-        $action = (($op == 'clone') ? 'clone' : 'edit');
134
-        xoops_cp_header();
135
-//================================================
136
-// include_once (XOOPS_ROOT_PATH . '/class/xoopsform/tc_calendar/formtccalendar.php');
137
-//
138
-// 		  // Call the calendar constructor - use the desired form and format, according to the instructions/samples provided on triconsole.com
139
-// 		  $dateBirthday = new XoopsTcCalendar("datez1", true, false);
140
-// 		  //$dateBirthday->setIcon("/images/iconCalendar.gif");
141
-// 		  $dateBirthday->setIcon("/class/xoopsform/tc_calendar/images/iconCalendar.gif");
142
-// 		  //$dateBirthday->rtl=false;
143
-// 		  $dateBirthday->setAutoHide(false);
144
-//
145
-//       //$myCalendar->setDate(date('d'), date('m'), date('Y'));
146
-//       //$dateBirthday->setDate($p['date1_day'], $p['date1_month'], $p['date1_year']);
147
-// 		  $dateBirthday->setDate(date('d'), date('m'), date('Y'));
148
-//
149
-// 		  $dateBirthday->setPath(XOOPS_URL . "/class/xoopsform/tc_calendar/");
150
-// 		  $dateBirthday->zindex = 150; //default 1
151
-// 		  $dateBirthday->setYearInterval(1995, date('Y'));
152
-// 		  $dateBirthday->dateAllow('1960-03-01', date('Y-m-d'));
153
-// 		  //$dateBirthday->autoSubmit(true, "calendar");
154
-// 		  $dateBirthday->disabledDay("sat");
155
-// 		  $dateBirthday->disabledDay("sun");
156
-// 		  $dateBirthday->setSpecificDate(array("2011-04-14", "2010-12-25"), 0, 'month');
157
-// 		  $dateBirthday->setSpecificDate(array("2011-04-01"), 0, 'year');
158
-// 		  $dateBirthday->setAlignment('right', 'bottom'); //optional
159
-// echo "<table><tr><td>zzzzz</td><td></td><td>";
160
-// echo $dateBirthday->render();
161
-// echo "</td></tr></table>";
162
-//echo $dateBirthday->render();
163
-//================================================
164
-        // @author      Gregory Mage (Aka Mage)
165
-        //***************************************************************************************
166
-//         include_once XOOPS_ROOT_PATH . "/modules/extcal/class/admin.php";
167
-        $eventAdmin = new ModuleAdmin();
168
-        echo $eventAdmin->addNavigation('event.php');
169
-        //***************************************************************************************
170
-
171
-        $eventId      = $_GET['event_id'];
172
-        $eventHandler = xoops_getmodulehandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE);
173
-
174
-        echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _MD_EXTCAL_EDIT_EVENT . '</legend>';
175
-
176
-        if ($form = $eventHandler->getEventForm('admin', $action, array('event_id' => $eventId))) {
177
-            $form->display();
178
-        }
180
+            echo '</fieldset><br />';
179 181
 
180
-        echo '</fieldset><br />';
182
+            xoops_cp_footer();
181 183
 
182
-        xoops_cp_footer();
184
+            break;
183 185
 
184
-        break;
186
+        case 'clone2': /* sur clique de l'icone du formulaire*/
185 187
 
186
-    case 'clone2': /* sur clique de l'icone du formulaire*/
188
+            //$newEventId = 1;
189
+            $eventId      = $_GET['event_id'];
190
+            $eventHandler = xoops_getmodulehandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE);
191
+            $event        = $eventHandler->getEvent($eventId);
192
+            $t            = $event->getVars();
193
+            $data         = array();
194
+            while (list($key, $val) = each($t)) {
195
+                $data[$key] = $val['value'];
196
+            }
187 197
 
188
-        //$newEventId = 1;
189
-        $eventId      = $_GET['event_id'];
190
-        $eventHandler = xoops_getmodulehandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE);
191
-        $event        = $eventHandler->getEvent($eventId);
192
-        $t            = $event->getVars();
193
-        $data         = array();
194
-        while (list($key, $val) = each($t)) {
195
-            $data[$key] = $val['value'];
196
-        }
198
+            $data['event_id'] = 0;
199
+            $data['event_title'] .= ' (' . _AM_EXTCAL_CLONE_OF . $eventId . ')';
197 200
 
198
-        $data['event_id'] = 0;
199
-        $data['event_title'] .= ' (' . _AM_EXTCAL_CLONE_OF . $eventId . ')';
201
+            $newEvent = $eventHandler->create();
202
+            $newEvent->setVars($data);
203
+            $t = $eventHandler->insert($newEvent, true);
200 204
 
201
-        $newEvent = $eventHandler->create();
202
-        $newEvent->setVars($data);
203
-        $t = $eventHandler->insert($newEvent, true);
205
+            $newEventId = $newEvent->getVar('event_id');
206
+            $ts         = print_r($newEventId, true);
204 207
 
205
-        $newEventId = $newEvent->getVar('event_id');
206
-        $ts         = print_r($newEventId, true);
208
+            redirect_header("event.php?op=modify&event_id={$newEventId}", 3, _AM_EXTCAL_EVENT_DELETED, false);
209
+            break;
207 210
 
208
-        redirect_header("event.php?op=modify&event_id={$newEventId}", 3, _AM_EXTCAL_EVENT_DELETED, false);
209
-        break;
211
+        case 'delete':
210 212
 
211
-    case 'delete':
213
+            if (isset($_POST['confirm'])) {
214
+                if (!$GLOBALS['xoopsSecurity']->check()) {
215
+                    redirect_header(
216
+                        'index.php',
217
+                        3,
218
+                        _NOPERM . "<br />" . implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())
219
+                    );
220
+                    exit;
221
+                }
222
+    //             $eventHandler = xoops_getmodulehandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE);
223
+    //             $eventHandler->deleteEvent($_POST['event_id']);
224
+                deleteEvents($_POST['event_id']);
225
+                redirect_header("event.php", 3, _AM_EXTCAL_EVENT_DELETED, false);
212 226
 
213
-        if (isset($_POST['confirm'])) {
214
-            if (!$GLOBALS['xoopsSecurity']->check()) {
215
-                redirect_header(
216
-                    'index.php',
217
-                    3,
218
-                    _NOPERM . "<br />" . implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())
219
-                );
220
-                exit;
227
+            } else {
228
+                xoops_cp_header();
229
+                // @author      Gregory Mage (Aka Mage)
230
+                //***************************************************************************************
231
+                //include_once XOOPS_ROOT_PATH . "/modules/extcal/class/admin.php";
232
+                $eventAdmin = new ModuleAdmin();
233
+                echo $eventAdmin->addNavigation('event.php');
234
+                //***************************************************************************************
235
+
236
+                $hiddens = array('event_id' => $_GET['event_id'], 'form_delete' => '', 'confirm' => 1);
237
+                xoops_confirm($hiddens, 'event.php?op=delete', _AM_EXTCAL_CONFIRM_DELETE_EVENT, _DELETE, 'event.php');
238
+
239
+                xoops_cp_footer();
221 240
             }
222
-//             $eventHandler = xoops_getmodulehandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE);
223
-//             $eventHandler->deleteEvent($_POST['event_id']);
224
-            deleteEvents($_POST['event_id']);
225
-            redirect_header("event.php", 3, _AM_EXTCAL_EVENT_DELETED, false);
226 241
 
227
-        } else {
242
+            break;
243
+
244
+        case 'deleteSelection':
245
+
228 246
             xoops_cp_header();
229 247
             // @author      Gregory Mage (Aka Mage)
230 248
             //***************************************************************************************
@@ -232,197 +250,179 @@  discard block
 block discarded – undo
232 250
             $eventAdmin = new ModuleAdmin();
233 251
             echo $eventAdmin->addNavigation('event.php');
234 252
             //***************************************************************************************
253
+            if (isset($_POST['deleteSelection'][0])) {
254
+                $msg = _AM_EXTCAL_CONFIRM_DELETE_ALL;
255
+                $ids = array_keys($_POST['deleteAllEvents']);
235 256
 
236
-            $hiddens = array('event_id' => $_GET['event_id'], 'form_delete' => '', 'confirm' => 1);
237
-            xoops_confirm($hiddens, 'event.php?op=delete', _AM_EXTCAL_CONFIRM_DELETE_EVENT, _DELETE, 'event.php');
257
+            } else {
258
+                $msg = _AM_EXTCAL_CONFIRM_DELETE_SELECTION;
259
+                $ids = array_keys($_POST['deleteEvents']);
260
+
261
+            }
262
+
263
+    //           $msg = ((isset($_POST['deleteSelection'][0])) ? _AM_EXTCAL_CONFIRM_DELETE_ALL : _AM_EXTCAL_CONFIRM_DELETE_SELECTION);
264
+    //           $ids = array_keys($_POST['deleteEvents']);
265
+            $ids = implode(',', $ids);
266
+            //echo $ids.'<br>';
267
+            $hiddens = array('event_ids' => $ids, 'form_delete' => '', 'confirm' => 1);
268
+            //$hiddens = array('event_ids' => $_POST['deleteEvents'], 'form_delete' => '', 'confirm' => 1);
269
+            xoops_confirm($hiddens, 'event.php?op=deleteSelectionOK', $msg, _DELETE, 'event.php');
238 270
 
239 271
             xoops_cp_footer();
240
-        }
241 272
 
242
-        break;
273
+            break;
243 274
 
244
-    case 'deleteSelection':
275
+        case 'deleteSelectionOK':
276
+    //-----------------------------------------
277
+    // $t = print_r($_GET,true);
278
+    // echo "<hr><pre>{$t}</pre><hr>";
279
+    //
280
+    // $t = print_r($_POST,true);
281
+    // echo "<hr><pre>{$t}</pre><hr>";
282
+    // exit;
283
+    //-----------------------------------------
245 284
 
246
-        xoops_cp_header();
247
-        // @author      Gregory Mage (Aka Mage)
248
-        //***************************************************************************************
249
-        //include_once XOOPS_ROOT_PATH . "/modules/extcal/class/admin.php";
250
-        $eventAdmin = new ModuleAdmin();
251
-        echo $eventAdmin->addNavigation('event.php');
252
-        //***************************************************************************************
253
-        if (isset($_POST['deleteSelection'][0])) {
254
-            $msg = _AM_EXTCAL_CONFIRM_DELETE_ALL;
255
-            $ids = array_keys($_POST['deleteAllEvents']);
285
+            if (isset($_POST['deleteSelection'][0])) {
256 286
 
257
-        } else {
258
-            $msg = _AM_EXTCAL_CONFIRM_DELETE_SELECTION;
259
-            $ids = array_keys($_POST['deleteEvents']);
287
+            } else {
288
+                if (!$GLOBALS['xoopsSecurity']->check()) {
289
+                    redirect_header(
290
+                        'index.php',
291
+                        3,
292
+                        _NOPERM . "<br />" . implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())
293
+                    );
294
+                    exit;
295
+                }
260 296
 
261
-        }
297
+                deleteEvents($_POST['event_ids']);
298
+
299
+                redirect_header("event.php", 3, _AM_EXTCAL_EVENTS_DELETED, false);
262 300
 
263
-//           $msg = ((isset($_POST['deleteSelection'][0])) ? _AM_EXTCAL_CONFIRM_DELETE_ALL : _AM_EXTCAL_CONFIRM_DELETE_SELECTION);
264
-//           $ids = array_keys($_POST['deleteEvents']);
265
-        $ids = implode(',', $ids);
266
-        //echo $ids.'<br>';
267
-        $hiddens = array('event_ids' => $ids, 'form_delete' => '', 'confirm' => 1);
268
-        //$hiddens = array('event_ids' => $_POST['deleteEvents'], 'form_delete' => '', 'confirm' => 1);
269
-        xoops_confirm($hiddens, 'event.php?op=deleteSelectionOK', $msg, _DELETE, 'event.php');
270
-
271
-        xoops_cp_footer();
272
-
273
-        break;
274
-
275
-    case 'deleteSelectionOK':
276
-//-----------------------------------------
277
-// $t = print_r($_GET,true);
278
-// echo "<hr><pre>{$t}</pre><hr>";
279
-//
280
-// $t = print_r($_POST,true);
281
-// echo "<hr><pre>{$t}</pre><hr>";
282
-// exit;
283
-//-----------------------------------------
284
-
285
-        if (isset($_POST['deleteSelection'][0])) {
286
-
287
-        } else {
288
-            if (!$GLOBALS['xoopsSecurity']->check()) {
289
-                redirect_header(
290
-                    'index.php',
291
-                    3,
292
-                    _NOPERM . "<br />" . implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())
293
-                );
294
-                exit;
295 301
             }
296 302
 
297
-            deleteEvents($_POST['event_ids']);
303
+            break;
298 304
 
299
-            redirect_header("event.php", 3, _AM_EXTCAL_EVENTS_DELETED, false);
305
+        case 'default':
306
+        default:
300 307
 
301
-        }
308
+            //global $extcalConfig;
309
+            $extcalConfig      = ExtcalConfig::getHandler();
310
+            $xoopsModuleConfig = $extcalConfig->getModuleConfig();
302 311
 
303
-        break;
304
-
305
-    case 'default':
306
-    default:
307
-
308
-        //global $extcalConfig;
309
-        $extcalConfig      = ExtcalConfig::getHandler();
310
-        $xoopsModuleConfig = $extcalConfig->getModuleConfig();
311
-
312
-        $start          = (isset($_GET['start'])) ? $_GET['start'] : 0;
313
-        $nbEventsByPage = $xoopsModuleConfig['nbEventsByPage'];
314
-
315
-        xoops_cp_header();
316
-        // @author      Gregory Mage (Aka Mage)
317
-        //***************************************************************************************
318
-
319
-        $eventAdmin = new ModuleAdmin();
320
-        echo $eventAdmin->addNavigation('event.php');
321
-        //***************************************************************************************
322
-
323
-        $eventHandler = xoops_getmodulehandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE);
324
-        $events       = $eventHandler->objectToArray($eventHandler->getNewEvent($start, $nbEventsByPage, 0, true), array('cat_id'));
325
-        $eventHandler->formatEventsDate($events, _SHORTDATESTRING);
326
-
327
-        echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _AM_EXTCAL_APPROVED_EVENT . '</legend>';
328
-        echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _AM_EXTCAL_INFORMATION . '</legend>';
329
-        //echo'<img src='. XOOPS_URL .'/'. $moduleInfo->getInfo('dirmoduleadmin').'/assets/images/action/edit.png' .' '.'style=vertical-align:middle;/>&nbsp;&nbsp;' . _AM_EXTCAL_INFO_EDIT . '<br />';
330
-        //echo'<img src='. XOOPS_URL .'/'. $moduleInfo->getInfo('dirmoduleadmin').'/assets/images/action/delete.png'. ' '."style=vertical-align:middle;/>&nbsp;&nbsp;". _AM_EXTCAL_INFO_DELETE;
331
-
332
-        echo '<img src=' . $pathIcon16 . '/edit.png' . ' ' . 'style=vertical-align:middle;/>&nbsp;&nbsp;' . _AM_EXTCAL_INFO_EDIT . '<br />';
333
-        echo '<img src=' . $pathIcon16 . '/delete.png' . ' ' . 'style=vertical-align:middle;/>&nbsp;&nbsp;' . _AM_EXTCAL_INFO_DELETE . '<br />';
334
-
335
-        echo '</fieldset><br />';
336
-
337
-        echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _MD_EXTCAL_SUBMITED_EVENT . '</legend>';
338
-
339
-        echo '<form method="POST" action="event.php">';
340
-        echo '<input type="hidden" name="op" value="deleteSelection" />';
341
-
342
-        echo '<table class="outer" style="width:100%;">';
343
-        echo '<tr style="text-align:center;">';
344
-        echo '<th>' . _AM_EXTCAL_DELETE . '</th>';
345
-        echo '<th>#</th>';
346
-        echo '<th>' . _AM_EXTCAL_CATEGORY . '</th>';
347
-        echo '<th>' . _AM_EXTCAL_TITLE . '</th>';
348
-        echo '<th>' . _AM_EXTCAL_START_DATE . '</th>';
349
-        echo '<th>' . _AM_EXTCAL_END_DATE . '</th>';
350
-        echo '<th>' . _AM_EXTCAL_RECURRENT . '</th>';
351
-        echo '<th>' . _AM_EXTCAL_START_RULES . '</th>';
352
-        echo '<th>' . _AM_EXTCAL_ACTION . '</th>';
353
-
354
-        echo '</tr>';
355
-
356
-        if (count($events) > 0) {
357
-            $i = 0;
358
-            foreach (
359
-                $events as $event
360
-            ) {
361
-                $class = (++$i % 2 == 0) ? 'even' : 'odd';
362
-                echo '<tr style="text-align:left;" class="' . $class . '">';
363
-                echo "<td width='10%' align='center'>";
364
-                echo "<input type='checkbox' name='deleteEvents[{$event['event_id']}]' value='1' >";
365
-                echo "<input type='hidden' name='deleteAllEvents[{$event['event_id']}]' value='1' />";
366
-                echo "</td>";
367
-                echo "<td align = 'center' width='5%'>" . $event['event_id'] . '</td>';
368
-                echo "<td  width='10%'>" . '<a href=cat.php?op=modify&amp;cat_id=' . $event['cat']['cat_id'] . '&form_modify' . '>' . $event['cat']['cat_name'] . '</a>' . '</td>';
369
-
370
-                echo '<td>' . '<a href=event.php?op=modify&amp;event_id=' . $event['event_id'] . '>' . $event['event_title'] . '</a>' . '</td>';
371
-
372
-//                 if ($event['event_isrecur']) {
373
-//                     echo '<td>' . $event['formated_reccur_rule'] . '</td>';
374
-//                 } else {
375
-//                     echo '<td>' . $event['formated_event_start'] . '</td>';
376
-//                 }
377
-
378
-
379
-                echo "<td align = 'center' width='10%'>" . $event['formated_event_start'] . '</td>';
380
-                echo "<td align = 'center' width='10%'>" . $event['formated_event_end'] . '</td>';
381
-                echo '<td align="center">' . (($event['event_isrecur'] == 1) ? _YES : _NO) . '</td>';
382
-                if (!isset($event['formated_reccur_rule'])) {
383
-                    $event['formated_reccur_rule'] = '';
384
-                }
385
-                echo '<td>' . $event['formated_reccur_rule'] . '</td>';
312
+            $start          = (isset($_GET['start'])) ? $_GET['start'] : 0;
313
+            $nbEventsByPage = $xoopsModuleConfig['nbEventsByPage'];
386 314
 
387
-                echo '<td style="width:10%; text-align:center;">';
388
-                echo '<a href=event.php?op=modify&amp;event_id=' . $event['event_id'] . "><img src='" . $pathIcon16 . "/edit.png' title='" . _AM_EXTCAL_ICONE_EDIT . "' /></a>&nbsp;&nbsp;";
389
-                echo '<a href=event.php?op=delete&amp;event_id=' . $event['event_id'] . "><img src='" . $pathIcon16 . "/delete.png' title='" . _AM_EXTCAL_ICONE_DELETE . "' /></a>&nbsp;&nbsp;";
390
-                echo '<a href=event.php?op=clone&amp;event_id=' . $event['event_id'] . "><img src='" . $pathIcon16 . "/editcopy.png' title='" . _AM_EXTCAL_ICONE_CLONE . "' /></a>";
391
-                echo '</td>';
315
+            xoops_cp_header();
316
+            // @author      Gregory Mage (Aka Mage)
317
+            //***************************************************************************************
392 318
 
393
-                echo '</tr>';
394
-            }
395
-            //---------------------------------------------------------
396
-            $pageNav = new XoopsPageNav($eventHandler->getCountNewEvent(), $nbEventsByPage, $start);
319
+            $eventAdmin = new ModuleAdmin();
320
+            echo $eventAdmin->addNavigation('event.php');
321
+            //***************************************************************************************
322
+
323
+            $eventHandler = xoops_getmodulehandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE);
324
+            $events       = $eventHandler->objectToArray($eventHandler->getNewEvent($start, $nbEventsByPage, 0, true), array('cat_id'));
325
+            $eventHandler->formatEventsDate($events, _SHORTDATESTRING);
326
+
327
+            echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _AM_EXTCAL_APPROVED_EVENT . '</legend>';
328
+            echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _AM_EXTCAL_INFORMATION . '</legend>';
329
+            //echo'<img src='. XOOPS_URL .'/'. $moduleInfo->getInfo('dirmoduleadmin').'/assets/images/action/edit.png' .' '.'style=vertical-align:middle;/>&nbsp;&nbsp;' . _AM_EXTCAL_INFO_EDIT . '<br />';
330
+            //echo'<img src='. XOOPS_URL .'/'. $moduleInfo->getInfo('dirmoduleadmin').'/assets/images/action/delete.png'. ' '."style=vertical-align:middle;/>&nbsp;&nbsp;". _AM_EXTCAL_INFO_DELETE;
397 331
 
398
-            echo '<tr><td colspan="2" style="text-align: right;">';
399
-            echo $pageNav->renderNav(2);
400
-            echo '</td>';
332
+            echo '<img src=' . $pathIcon16 . '/edit.png' . ' ' . 'style=vertical-align:middle;/>&nbsp;&nbsp;' . _AM_EXTCAL_INFO_EDIT . '<br />';
333
+            echo '<img src=' . $pathIcon16 . '/delete.png' . ' ' . 'style=vertical-align:middle;/>&nbsp;&nbsp;' . _AM_EXTCAL_INFO_DELETE . '<br />';
401 334
 
402
-            echo '<td colspan="2" style="text-align: right;">';
335
+            echo '</fieldset><br />';
403 336
 
404
-            echo '<input type="submit" value="' . _AM_EXTCAL_DELETE_ALL . '" name="deleteSelection[0]">';
405
-            echo '<input type="submit" value="' . _AM_EXTCAL_DELETE_SELECTION . '" name="deleteSelection[1]">';
337
+            echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _MD_EXTCAL_SUBMITED_EVENT . '</legend>';
338
+
339
+            echo '<form method="POST" action="event.php">';
340
+            echo '<input type="hidden" name="op" value="deleteSelection" />';
341
+
342
+            echo '<table class="outer" style="width:100%;">';
343
+            echo '<tr style="text-align:center;">';
344
+            echo '<th>' . _AM_EXTCAL_DELETE . '</th>';
345
+            echo '<th>#</th>';
346
+            echo '<th>' . _AM_EXTCAL_CATEGORY . '</th>';
347
+            echo '<th>' . _AM_EXTCAL_TITLE . '</th>';
348
+            echo '<th>' . _AM_EXTCAL_START_DATE . '</th>';
349
+            echo '<th>' . _AM_EXTCAL_END_DATE . '</th>';
350
+            echo '<th>' . _AM_EXTCAL_RECURRENT . '</th>';
351
+            echo '<th>' . _AM_EXTCAL_START_RULES . '</th>';
352
+            echo '<th>' . _AM_EXTCAL_ACTION . '</th>';
406 353
 
407
-            echo '</td>';
408 354
             echo '</tr>';
409
-        } else {
410
-            echo '<tr><td colspan="5">' . _AM_EXTCAL_NO_PENDING_EVENT . '</td></tr>';
411
-        }
412
-        echo '</table>';
413
-        echo '</form>';
414 355
 
415
-        echo '</fieldset>';
416
-        echo '</fieldset><br /><br />';
417
-        //Fin de la liste des evennement -------------------------------------
418
-        echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _MD_EXTCAL_SUBMIT_EVENT . '</legend>';
356
+            if (count($events) > 0) {
357
+                $i = 0;
358
+                foreach (
359
+                    $events as $event
360
+                ) {
361
+                    $class = (++$i % 2 == 0) ? 'even' : 'odd';
362
+                    echo '<tr style="text-align:left;" class="' . $class . '">';
363
+                    echo "<td width='10%' align='center'>";
364
+                    echo "<input type='checkbox' name='deleteEvents[{$event['event_id']}]' value='1' >";
365
+                    echo "<input type='hidden' name='deleteAllEvents[{$event['event_id']}]' value='1' />";
366
+                    echo "</td>";
367
+                    echo "<td align = 'center' width='5%'>" . $event['event_id'] . '</td>';
368
+                    echo "<td  width='10%'>" . '<a href=cat.php?op=modify&amp;cat_id=' . $event['cat']['cat_id'] . '&form_modify' . '>' . $event['cat']['cat_name'] . '</a>' . '</td>';
369
+
370
+                    echo '<td>' . '<a href=event.php?op=modify&amp;event_id=' . $event['event_id'] . '>' . $event['event_title'] . '</a>' . '</td>';
371
+
372
+    //                 if ($event['event_isrecur']) {
373
+    //                     echo '<td>' . $event['formated_reccur_rule'] . '</td>';
374
+    //                 } else {
375
+    //                     echo '<td>' . $event['formated_event_start'] . '</td>';
376
+    //                 }
377
+
378
+
379
+                    echo "<td align = 'center' width='10%'>" . $event['formated_event_start'] . '</td>';
380
+                    echo "<td align = 'center' width='10%'>" . $event['formated_event_end'] . '</td>';
381
+                    echo '<td align="center">' . (($event['event_isrecur'] == 1) ? _YES : _NO) . '</td>';
382
+                    if (!isset($event['formated_reccur_rule'])) {
383
+                        $event['formated_reccur_rule'] = '';
384
+                    }
385
+                    echo '<td>' . $event['formated_reccur_rule'] . '</td>';
386
+
387
+                    echo '<td style="width:10%; text-align:center;">';
388
+                    echo '<a href=event.php?op=modify&amp;event_id=' . $event['event_id'] . "><img src='" . $pathIcon16 . "/edit.png' title='" . _AM_EXTCAL_ICONE_EDIT . "' /></a>&nbsp;&nbsp;";
389
+                    echo '<a href=event.php?op=delete&amp;event_id=' . $event['event_id'] . "><img src='" . $pathIcon16 . "/delete.png' title='" . _AM_EXTCAL_ICONE_DELETE . "' /></a>&nbsp;&nbsp;";
390
+                    echo '<a href=event.php?op=clone&amp;event_id=' . $event['event_id'] . "><img src='" . $pathIcon16 . "/editcopy.png' title='" . _AM_EXTCAL_ICONE_CLONE . "' /></a>";
391
+                    echo '</td>';
392
+
393
+                    echo '</tr>';
394
+                }
395
+                //---------------------------------------------------------
396
+                $pageNav = new XoopsPageNav($eventHandler->getCountNewEvent(), $nbEventsByPage, $start);
397
+
398
+                echo '<tr><td colspan="2" style="text-align: right;">';
399
+                echo $pageNav->renderNav(2);
400
+                echo '</td>';
401
+
402
+                echo '<td colspan="2" style="text-align: right;">';
403
+
404
+                echo '<input type="submit" value="' . _AM_EXTCAL_DELETE_ALL . '" name="deleteSelection[0]">';
405
+                echo '<input type="submit" value="' . _AM_EXTCAL_DELETE_SELECTION . '" name="deleteSelection[1]">';
419 406
 
420
-        $form = $eventHandler->getEventForm('admin');
421
-        $form->display();
407
+                echo '</td>';
408
+                echo '</tr>';
409
+            } else {
410
+                echo '<tr><td colspan="5">' . _AM_EXTCAL_NO_PENDING_EVENT . '</td></tr>';
411
+            }
412
+            echo '</table>';
413
+            echo '</form>';
414
+
415
+            echo '</fieldset>';
416
+            echo '</fieldset><br /><br />';
417
+            //Fin de la liste des evennement -------------------------------------
418
+            echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _MD_EXTCAL_SUBMIT_EVENT . '</legend>';
419
+
420
+            $form = $eventHandler->getEventForm('admin');
421
+            $form->display();
422 422
 
423
-        echo '</fieldset>';
423
+            echo '</fieldset>';
424 424
 
425
-        include_once __DIR__ . '/admin_footer.php';
425
+            include_once __DIR__ . '/admin_footer.php';
426 426
 
427
-        break;
427
+            break;
428 428
 }
Please login to merge, or discard this patch.
htdocs/modules/extcal/admin/index.php 1 patch
Switch Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 
37 37
 switch ($op) {
38 38
 
39
-    case 'notification':
39
+        case 'notification':
40 40
 
41
-        switch ($fct) {
41
+            switch ($fct) {
42 42
 
43 43
             case 'send':
44 44
 
@@ -132,81 +132,81 @@  discard block
 block discarded – undo
132 132
 
133 133
                 break;
134 134
 
135
-        }
135
+            }
136 136
 
137 137
         break;
138 138
 
139
-    default:
140
-    case 'default':
141
-        // @author      Gregory Mage (Aka Mage)
142
-        //***************************************************************************************
143
-        xoops_cp_header();
144
-//        include_once XOOPS_ROOT_PATH . "/modules/extcal/class/admin.php";
145
-        $catHandler   = xoops_getmodulehandler(_EXTCAL_CLS_CAT, _EXTCAL_MODULE);
146
-        $eventHandler = xoops_getmodulehandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE);
147
-        $indexAdmin   = new ModuleAdmin();
148
-        $indexAdmin->addInfoBox(_MI_EXTCAL_DASHBOARD);
149
-        $indexAdmin->addInfoBoxLine(_MI_EXTCAL_DASHBOARD, "<infolabel>" . _AM_EXTCAL_INDEX_CATEGORIES . "</infolabel>", $catHandler->getCount(), 'Green');
150
-        $indexAdmin->addInfoBoxLine(_MI_EXTCAL_DASHBOARD, "<infolabel>" . _AM_EXTCAL_INDEX_EVENT . "</infolabel>", $eventHandler->getCount(new Criteria('event_approved', 1)), 'Green');
151
-        $indexAdmin->addInfoBoxLine(_MI_EXTCAL_DASHBOARD, "<infolabel>" . _AM_EXTCAL_INDEX_PENDING . "</infolabel>", $eventHandler->getCount(new Criteria('event_approved', 0)), 'Red');
152
-        $criteriaCompo = new CriteriaCompo();
153
-        $criteriaCompo->add(new Criteria('event_approved', 1));
154
-        $criteriaCompo->add(new Criteria('event_start', time(), '>='));
155
-        $indexAdmin->addInfoBoxLine(_MI_EXTCAL_DASHBOARD, "<infolabel>" . _AM_EXTCAL_INDEX_APPROVED . "</infolabel><infotext>", $eventHandler->getCount($criteriaCompo) . "</infotext>", 'Green');
156
-
157
-        $indexAdmin->addConfigBoxLine();
158
-        $indexAdmin->addConfigBoxLine(_AM_EXTCAL_PEAR_PATH);
159
-        $indexAdmin->addConfigBoxLine(_EXTCAL_PEAR_ROOT, 'folder');
160
-
161
-//JJD
162
-//         $indexAdmin->addConfigBoxLine(XOOPS_ROOT_PATH,'folder');
163
-
164
-//        $indexAdmin->addLineConfigLabel(_AM_EXTCAL_CONFIG_PHP, $xoopsModule->getInfo("min_php"), 'php');
165
-//        $indexAdmin->addLineConfigLabel(_AM_EXTCAL_CONFIG_XOOPS, $xoopsModule->getInfo("min_xoops"), 'xoops');
166
-        echo $indexAdmin->addNavigation('index.php');
167
-        echo $indexAdmin->renderIndex();
168
-        //***************************************************************************************
169
-        $pendingEvent = $eventHandler->objectToArray($eventHandler->getPendingEvent(), array('cat_id'));
170
-        $eventHandler->formatEventsDate($pendingEvent, 'd/m/Y');
171
-
172
-        echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _AM_EXTCAL_PENDING_EVENT . '</legend>';
173
-        echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _AM_EXTCAL_INFORMATION . '</legend>';
174
-//        echo '<img src="../assets/images/icons/on.png"  />&nbsp;&nbsp;'._AM_EXTCAL_INFO_APPROVE_PENDING_EVENT.'<br />';
175
-        echo '<img src=' . $pathIcon16 . '/edit.png />&nbsp;&nbsp;' . _AM_EXTCAL_INFO_EDIT_PENDING_EVENT . '<br />';
176
-        echo '<img src=' . $pathIcon16 . '/delete.png />&nbsp;&nbsp;' . _AM_EXTCAL_INFO_DELETE_PENDING_EVENT . '<br />';
177
-        echo '</fieldset><br />';
178
-
179
-        echo '<table class="outer" style="width:100%;">';
180
-        echo '<tr style="text-align:center;">';
181
-        echo '<th>' . _AM_EXTCAL_CATEGORY . '</th>';
182
-        echo '<th>' . _AM_EXTCAL_TITLE . '</th>';
183
-        echo '<th>' . _AM_EXTCAL_START_DATE . '</th>';
184
-        echo '<th>' . _AM_EXTCAL_ACTION . '</th>';
185
-        echo '</tr>';
186
-
187
-        if (count($pendingEvent) > 0) {
188
-            $i = 0;
189
-            foreach (
190
-                $pendingEvent as $event
191
-            ) {
192
-                $class = (++$i % 2 == 0) ? 'even' : 'odd';
193
-                echo '<tr style="text-align:center;" class="' . $class . '">';
194
-                echo '<td>' . $event['cat']['cat_name'] . '</td>';
195
-                echo '<td>' . $event['event_title'] . '</td>';
196
-                echo '<td>' . $event['formated_event_start'] . '</td>';
197
-                echo '<td style="width:10%; text-align:center;">';
198
-                echo '<a href="event.php?op=modify&amp;event_id=' . $event['event_id'] . '"><img src=' . $pathIcon16 . '/edit.png /></a>&nbsp;&nbsp;';
199
-                echo '<a href="event.php?op=delete&amp;event_id=' . $event['event_id'] . '"><img src=' . $pathIcon16 . '/delete.png /></a>';
200
-                echo '</td>';
201
-                echo '</tr>';
139
+        default:
140
+        case 'default':
141
+            // @author      Gregory Mage (Aka Mage)
142
+            //***************************************************************************************
143
+            xoops_cp_header();
144
+    //        include_once XOOPS_ROOT_PATH . "/modules/extcal/class/admin.php";
145
+            $catHandler   = xoops_getmodulehandler(_EXTCAL_CLS_CAT, _EXTCAL_MODULE);
146
+            $eventHandler = xoops_getmodulehandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE);
147
+            $indexAdmin   = new ModuleAdmin();
148
+            $indexAdmin->addInfoBox(_MI_EXTCAL_DASHBOARD);
149
+            $indexAdmin->addInfoBoxLine(_MI_EXTCAL_DASHBOARD, "<infolabel>" . _AM_EXTCAL_INDEX_CATEGORIES . "</infolabel>", $catHandler->getCount(), 'Green');
150
+            $indexAdmin->addInfoBoxLine(_MI_EXTCAL_DASHBOARD, "<infolabel>" . _AM_EXTCAL_INDEX_EVENT . "</infolabel>", $eventHandler->getCount(new Criteria('event_approved', 1)), 'Green');
151
+            $indexAdmin->addInfoBoxLine(_MI_EXTCAL_DASHBOARD, "<infolabel>" . _AM_EXTCAL_INDEX_PENDING . "</infolabel>", $eventHandler->getCount(new Criteria('event_approved', 0)), 'Red');
152
+            $criteriaCompo = new CriteriaCompo();
153
+            $criteriaCompo->add(new Criteria('event_approved', 1));
154
+            $criteriaCompo->add(new Criteria('event_start', time(), '>='));
155
+            $indexAdmin->addInfoBoxLine(_MI_EXTCAL_DASHBOARD, "<infolabel>" . _AM_EXTCAL_INDEX_APPROVED . "</infolabel><infotext>", $eventHandler->getCount($criteriaCompo) . "</infotext>", 'Green');
156
+
157
+            $indexAdmin->addConfigBoxLine();
158
+            $indexAdmin->addConfigBoxLine(_AM_EXTCAL_PEAR_PATH);
159
+            $indexAdmin->addConfigBoxLine(_EXTCAL_PEAR_ROOT, 'folder');
160
+
161
+    //JJD
162
+    //         $indexAdmin->addConfigBoxLine(XOOPS_ROOT_PATH,'folder');
163
+
164
+    //        $indexAdmin->addLineConfigLabel(_AM_EXTCAL_CONFIG_PHP, $xoopsModule->getInfo("min_php"), 'php');
165
+    //        $indexAdmin->addLineConfigLabel(_AM_EXTCAL_CONFIG_XOOPS, $xoopsModule->getInfo("min_xoops"), 'xoops');
166
+            echo $indexAdmin->addNavigation('index.php');
167
+            echo $indexAdmin->renderIndex();
168
+            //***************************************************************************************
169
+            $pendingEvent = $eventHandler->objectToArray($eventHandler->getPendingEvent(), array('cat_id'));
170
+            $eventHandler->formatEventsDate($pendingEvent, 'd/m/Y');
171
+
172
+            echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _AM_EXTCAL_PENDING_EVENT . '</legend>';
173
+            echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _AM_EXTCAL_INFORMATION . '</legend>';
174
+    //        echo '<img src="../assets/images/icons/on.png"  />&nbsp;&nbsp;'._AM_EXTCAL_INFO_APPROVE_PENDING_EVENT.'<br />';
175
+            echo '<img src=' . $pathIcon16 . '/edit.png />&nbsp;&nbsp;' . _AM_EXTCAL_INFO_EDIT_PENDING_EVENT . '<br />';
176
+            echo '<img src=' . $pathIcon16 . '/delete.png />&nbsp;&nbsp;' . _AM_EXTCAL_INFO_DELETE_PENDING_EVENT . '<br />';
177
+            echo '</fieldset><br />';
178
+
179
+            echo '<table class="outer" style="width:100%;">';
180
+            echo '<tr style="text-align:center;">';
181
+            echo '<th>' . _AM_EXTCAL_CATEGORY . '</th>';
182
+            echo '<th>' . _AM_EXTCAL_TITLE . '</th>';
183
+            echo '<th>' . _AM_EXTCAL_START_DATE . '</th>';
184
+            echo '<th>' . _AM_EXTCAL_ACTION . '</th>';
185
+            echo '</tr>';
186
+
187
+            if (count($pendingEvent) > 0) {
188
+                $i = 0;
189
+                foreach (
190
+                    $pendingEvent as $event
191
+                ) {
192
+                    $class = (++$i % 2 == 0) ? 'even' : 'odd';
193
+                    echo '<tr style="text-align:center;" class="' . $class . '">';
194
+                    echo '<td>' . $event['cat']['cat_name'] . '</td>';
195
+                    echo '<td>' . $event['event_title'] . '</td>';
196
+                    echo '<td>' . $event['formated_event_start'] . '</td>';
197
+                    echo '<td style="width:10%; text-align:center;">';
198
+                    echo '<a href="event.php?op=modify&amp;event_id=' . $event['event_id'] . '"><img src=' . $pathIcon16 . '/edit.png /></a>&nbsp;&nbsp;';
199
+                    echo '<a href="event.php?op=delete&amp;event_id=' . $event['event_id'] . '"><img src=' . $pathIcon16 . '/delete.png /></a>';
200
+                    echo '</td>';
201
+                    echo '</tr>';
202
+                }
203
+            } else {
204
+                echo '<tr><td colspan="4">' . _AM_EXTCAL_NO_PENDING_EVENT . '</td></tr>';
202 205
             }
203
-        } else {
204
-            echo '<tr><td colspan="4">' . _AM_EXTCAL_NO_PENDING_EVENT . '</td></tr>';
205
-        }
206 206
 
207
-        echo '</table></fieldset><br />';
207
+            echo '</table></fieldset><br />';
208 208
 
209
-        include_once __DIR__ . '/admin_footer.php';
209
+            include_once __DIR__ . '/admin_footer.php';
210 210
 
211
-        break;
211
+            break;
212 212
 }
Please login to merge, or discard this patch.