IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

MkFramework Discussion :

Creation d'un plugin_calendar


Sujet :

MkFramework

  1. #1
    Membre habitué
    Homme Profil pro
    Assistant statisticien
    Inscrit en
    Juillet 2009
    Messages
    132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Réunion

    Informations professionnelles :
    Activité : Assistant statisticien
    Secteur : Santé

    Informations forums :
    Inscription : Juillet 2009
    Messages : 132
    Points : 168
    Points
    168
    Par défaut Creation d'un plugin_calendar
    Bonjour,
    Je rencontre un probleme.
    Voici le message d'erreur qui au demeurant est simple :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
     
    Undefined variable: weeks
    #0 /Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/module/calendrier/view/list.php(33): exception_error_handler(8, 'Undefined varia...', '/Applications/M...', 33, Array)
    #1 /Applications/MAMP/htdocs/mkframework-4.130.8/lib/framework/class_view.php(85): include('/Applications/M...')
    #2 /Applications/MAMP/htdocs/mkframework-4.130.8/lib/framework/class_layout.php(158): _view->show()
    #3 /Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/layout/bootstrap.php(35): _layout->load('main')
    #4 /Applications/MAMP/htdocs/mkframework-4.130.8/lib/framework/class_layout.php(122): include('/Applications/M...')
    #5 /Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/module/calendrier/main.php(45): _layout->show()
    #6 /Applications/MAMP/htdocs/mkframework-4.130.8/lib/framework/class_root.php(276): module_calendrier->after()
    #7 /Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/public/index.php(47): _root->run()
    #8 {main}
     
    Detail:
    #0 /Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/module/calendrier/view/list.php (33) 
    exception_error_handler( , 'Undefined variable: weeks' , '/Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/module/calendrier/view/list.php' , , Array ( [events] => plugin_event Object ( ) [calendar] => plugin_calendar Object ( [days] => Array ( [0] => Lundi [1] => Mardi [2] => Mercredi [3] => Jeudi [4] => Vendredi [5] => Samedi [6] => Dimanche ) [months:plugin_calendar:private] => Array ( [0] => Janvier [1] => Février [2] => Mars [3] => Avril [4] => Mai [5] => Juin [6] => Juillet [7] => Aout [8] => Septembre [9] => Octobre [10] => Novembre [11] => Décembre ) [month] => 4 [year] => 2018 [day] => 23 ) [e] => ErrorException Object ( [message:protected] => Undefined index: month [string:Exception:private] => [code:protected] => 0 [file:protected] => /Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/module/calendrier/view/list.php [line:protected] => 5 [trace:Exception:private] => Array ( [0] => Array ( [file] => /Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/module/calendrier/view/list.php [line] => 5 [function] => exception_error_handler [args] => Array ( [0] => 8 [1] => Undefined index: month [2] => /Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/module/calendrier/view/list.php [3] => 5 [4] => Array ( [events] => plugin_event Object ( ) ) ) ) [1] => Array ( [file] => /Applications/MAMP/htdocs/mkframework-4.130.8/lib/framework/class_view.php [line] => 85 [args] => Array ( [0] => /Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/module/calendrier/view/list.php ) [function] => include ) [2] => Array ( [file] => /Applications/MAMP/htdocs/mkframework-4.130.8/lib/framework/class_layout.php [line] => 158 [function] => show [class] => _view [type] => -> [args] => Array ( ) ) [3] => Array ( [file] => /Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/layout/bootstrap.php [line] => 35 [function] => load [class] => _layout [type] => -> [args] => Array ( [0] => main ) ) [4] => Array ( [file] => /Applications/MAMP/htdocs/mkframework-4.130.8/lib/framework/class_layout.php [line] => 122 [args] => Array ( [0] => /Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/layout/bootstrap.php ) [function] => include ) [5] => Array ( [file] => /Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/module/calendrier/main.php [line] => 45 [function] => show [class] => _layout [type] => -> [args] => Array ( ) ) [6] => Array ( [file] => /Applications/MAMP/htdocs/mkframework-4.130.8/lib/framework/class_root.php [line] => 276 [function] => after [class] => module_calendrier [type] => -> [args] => Array ( ) ) [7] => Array ( [file] => /Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/public/index.php [line] => 47 [function] => run [class] => _root [type] => -> [args] => Array ( ) ) ) [previous:Exception:private] => [severity:protected] => 8 ) ) ) 
    #1 /Applications/MAMP/htdocs/mkframework-4.130.8/lib/framework/class_view.php (85) 
    include( '/Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/module/calendrier/view/list.php' ) 
    #2 /Applications/MAMP/htdocs/mkframework-4.130.8/lib/framework/class_layout.php (158) 
    _view -> show( ) 
    #3 /Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/layout/bootstrap.php (35) 
    _layout -> load( 'main' ) 
    #4 /Applications/MAMP/htdocs/mkframework-4.130.8/lib/framework/class_layout.php (122) 
    include( '/Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/layout/bootstrap.php' ) 
    #5 /Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/module/calendrier/main.php (45) 
    _layout -> show( ) 
    #6 /Applications/MAMP/htdocs/mkframework-4.130.8/lib/framework/class_root.php (276) 
    module_calendrier -> after( ) 
    #7 /Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/public/index.php (47) 
    _root -> run( ) 
    #8 {main}
    Fichier : /Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/module/calendrier/view/list.php ligne 33
     
    Message : Undefined variable: weeks
     
    15	} catch (\Exception $e){
    16	    $calendar = new plugin_calendar();
    17	}
    18	
    19	
    20	?>
    21	
    22	<div class="calendar">
    23	
    24	    <div class="flex-container">
    25	        <h1><?= $calendar->toString(); ?></h1> 
    26	            <div class="fleche">
    27	                <a href="<?= $this->getLink('calendrier::list',array('month' =>$calendar->previousMonth()->month, 'year'=> $calendar->previousMonth()->year)) ?>" class="btn btn-fleche">&lt;</a>
    28	                <a href="<?= $this->getLink('calendrier::list',array('month' =>$calendar->nextMonth()->month, 'year'=> $calendar->nextMonth()->year)) ?>" class="btn btn-fleche">&gt;</a>
    29	            </div>
    30	    </div>
    31	
    32	
    33	    <table class="calendar_table calendar_table--<?php echo $weeks; ?>weeks">
    34	        <?php for ($i=0; $i < $weeks; $i++): ?>
    35	            <tr>
    36	                <?php foreach ($calendar->days as $k => $day): 
    37	                    $cloneStart = clone $start;
    38	                    $date = $cloneStart->modify("+" .($k + $i * 7). " days");
    39	                    $cloneDate = clone $date;
    40	                    $date1 = $cloneDate->format('Y-m-d');
    41	                    $oDate = new plugin_date($date1,'Y-m-d');
    42	                    $currentDay = Date('Y-m-d');
    43	                    $isToday = Date('Y-m-d') === $date->format('Y-m-d');
    44	                    $eventsForDay = $events[$date->format('Y-m-d')] ? $events[$date->format('Y-m-d')]: [];
    45	                    
    46	                ?>
    47	                    <td class="<?= $calendar->withinMonth($date) ? '' : 'calendar_othermonth'; ?> <?= $oDate->isBank() == true ? 'calendar_backFerie' : ''; ?> <?= $isToday ? 'is_today' : ''; ?>">
    48	                        <?php if ($i === 0): ?>
    49	                            <div class="calendar_weekday "><?= $day ?></div>
    50	                        <?php endif; ?>
    Navigation
    Module:calendrier Action:index
    $_GET
    Array
    (
    [:nav] => calendrier::index
    )
    $_POST
    Array
    (
    )
    $_SESSION
    Array
    (
    [ip] => 363baea9cba210afac6d7a556fca596e30c46333
    [userAgent] => e43a2e13d30adc416c2177cd82edf74fc6c72ef1
    [timeout] => 1524507772
    [oAccount] => O:9:"row_users":4:{s:14:"*sClassModel";s:11:"model_users";s:28:"abstract_row_bChooseUpdate";b:1;s:13:"*_tProperty";a:8:{s:2:"id";s:2:"14";s:10:"centres_id";s:1:"1";s:11:"services_id";s:1:"1";s:4:"name";s:6:"Dijoux";s:8:"lastName";s:15:"Béatrice";s:5:"email";s:38:"beatrice.dijoux@ersm-reunion.cnamts.fr";s:8:"password";s:40:"5a0f1fe5a83b5e0dbf23ec27271e01013cd46c87";s:11:"isConnected";s:1:"1";}s:21:"*_tPropertyToUpdate";N;}
    [gestionuser_tabAllowDeny] => Array
    (
    [rightsManagerMulti::index] => Array
    (
    [deny] => 1
    )
     
    [actions::index] => Array
    (
    [access] => 1
    )
     
    [groupe::index] => Array
    (
    [deny] => 1
    )
     
    [groupe::list] => Array
    (
    [deny] => 1
    )
     
    [auth::logout] => Array
    (
    [access] => 1
    )
     
    [items::list] => Array
    (
    [deny] => 1
    )
     
    [calendrier::index] => Array
    (
    [access] => 1
    )
     
    [messagerie::list] => Array
    (
    [access] => 1
    )
     
    [users::index] => Array
    (
    [access] => 1
    )
     
    [voitures::index] => Array
    (
    [access] => 1
    )
     
    [bareme::index] => Array
    (
    [access] => 1
    )
     
    [rightsManagerMulti::groupUser] => Array
    (
    [access] => 1
    )
     
    [reservations::list] => Array
    (
    [access] => 1
    )
     
    )
     
    )
    $_SERVER
    Array
    (
    [HTTP_HOST] => localhost:8888
    [HTTP_CONNECTION] => keep-alive
    [HTTP_CACHE_CONTROL] => max-age=0
    [HTTP_UPGRADE_INSECURE_REQUESTS] => 1
    [HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
    [HTTP_REFERER] => http://localhost:8888/mkframework-4.130.8/data/genere/oreli3/public/index.php?:nav=calendrier::index
    [HTTP_ACCEPT_ENCODING] => gzip, deflate, br
    [HTTP_ACCEPT_LANGUAGE] => fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7
    [HTTP_COOKIE] => PHPSESSID=hveqsl81ieftr9k0q1afpf08kt
    [PATH] => /usr/bin:/bin:/usr/sbin:/sbin
    [SERVER_SIGNATURE] => 
    [SERVER_SOFTWARE] => Apache/2.2.34 (Unix) mod_wsgi/3.5 Python/2.7.13 PHP/7.2.1 mod_ssl/2.2.34 OpenSSL/1.0.2j DAV/2 mod_fastcgi/2.4.6 mod_perl/2.0.9 Perl/v5.24.0
    [SERVER_NAME] => localhost
    [SERVER_ADDR] => ::1
    [SERVER_PORT] => 8888
    [REMOTE_ADDR] => ::1
    [DOCUMENT_ROOT] => /Applications/MAMP/htdocs
    [SERVER_ADMIN] => you@example.com
    [SCRIPT_FILENAME] => /Applications/MAMP/htdocs/mkframework-4.130.8/data/genere/oreli3/public/index.php
    [REMOTE_PORT] => 62354
    [GATEWAY_INTERFACE] => CGI/1.1
    [SERVER_PROTOCOL] => HTTP/1.1
    [REQUEST_METHOD] => GET
    [QUERY_STRING] => :nav=calendrier::index
    [REQUEST_URI] => /mkframework-4.130.8/data/genere/oreli3/public/index.php?:nav=calendrier::index
    [SCRIPT_NAME] => /mkframework-4.130.8/data/genere/oreli3/public/index.php
    [PHP_SELF] => /mkframework-4.130.8/data/genere/oreli3/public/index.php
    [REQUEST_TIME_FLOAT] => 1524505972.552
    [REQUEST_TIME] => 1524505972
    [argv] => Array
    (
    [0] => :nav=calendrier::index
    )
     
    [argc] => 1
    )
    Voici mon calendrier::list

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
     
    <?php
     
    try{
        $events = new plugin_event();
        $calendar = new plugin_calendar($_GET['month'] ? $_GET['month']: null, $_GET['year'] ?$_GET['year'] : null);
        $start = $calendar->getStartingDay();
        $start = $start->format('N') === '1' ? $start : $calendar->getStartingDay()->modify('Last monday');
        $weeks = $calendar->getWeeks();
        $nbreWeeks = (6 + 7 * ($weeks -1));
        $clone = (clone $start);
        $end = $clone->modify('+'. $nbreWeeks .' days');
        $events = $events->getEventsBetweenByDay($start,$end);
        plugin_debug::addSpy('$calendar',$calendar);
     
    } catch (\Exception $e){
        $calendar = new plugin_calendar();
    }
     
     
    ?>
     
    <div class="calendar">
     
        <div class="flex-container">
            <h1><?= $calendar->toString(); ?></h1> 
                <div class="fleche">
                    <a href="<?= $this->getLink('calendrier::list',array('month' =>$calendar->previousMonth()->month, 'year'=> $calendar->previousMonth()->year)) ?>" class="btn btn-fleche">&lt;</a>
                    <a href="<?= $this->getLink('calendrier::list',array('month' =>$calendar->nextMonth()->month, 'year'=> $calendar->nextMonth()->year)) ?>" class="btn btn-fleche">&gt;</a>
                </div>
        </div>
     
     
        <table class="calendar_table calendar_table--<?php echo $weeks; ?>weeks">
            <?php for ($i=0; $i < $weeks; $i++): ?>
                <tr>
                    <?php foreach ($calendar->days as $k => $day): 
                        $cloneStart = clone $start;
                        $date = $cloneStart->modify("+" .($k + $i * 7). " days");
                        $cloneDate = clone $date;
                        $date1 = $cloneDate->format('Y-m-d');
                        $oDate = new plugin_date($date1,'Y-m-d');
                        $currentDay = Date('Y-m-d');
                        $isToday = Date('Y-m-d') === $date->format('Y-m-d');
                        $eventsForDay = $events[$date->format('Y-m-d')] ? $events[$date->format('Y-m-d')]: [];
     
                    ?>
                        <td class="<?= $calendar->withinMonth($date) ? '' : 'calendar_othermonth'; ?> <?= $oDate->isBank() == true ? 'calendar_backFerie' : ''; ?> <?= $isToday ? 'is_today' : ''; ?>">
                            <?php if ($i === 0): ?>
                                <div class="calendar_weekday "><?= $day ?></div>
                            <?php endif; ?>
                            <div class="calendar_day <?= $oDate->isBank() == true ? 'calendar_ferie' : ''; ?> <?= $currentDay == $date1  ? 'calendar_currentDay' : ''; ?>"><?= $date->format('d'); ?></div>
                            <?php foreach ($eventsForDay as $key => $event): ?>
                                <div class="calendar_event">
                                <?php $id = $event['id'];?>
                                <a  href="<?php echo $this->getLink('reservations::edit',array('id'=> $id, 'calendrier' => 'true')) ?>">
                                    <?= $event['time_a'] ?> => <?= $event['time_jusqua'] ?> - <?= $event['name'] ?> <?= $event['lastName'] ?> - <?= $event['intitule'] ?> 
                                </a>
                                </div>
                            <?php endforeach ?>
                        </td>
                    <?php endforeach; ?>
                </tr>
            <?php endfor; ?>
        </table>
     
        <a class="calendar_button" href="<?php echo $this->getLink('reservations::new',array( 'calendrier' => 'true')) ?>">+</a>
     
    </div>
    Voici mon plugin
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
     
    <?php
    /*
    This file is part of Mkframework.
    
    Mkframework is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License.
    
    Mkframework is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.
    
    You should have received a copy of the GNU Lesser General Public License
    along with Mkframework.  If not, see <http://www.gnu.org/licenses/>.
    
    */
    /** 
    * plugin_calendar classe pour generer un calendrier dynamique avec des évenements
    * @author Mika
    * @link http://mkf.mkdevs.com/
    */
    class plugin_calendar{
     
        public $days = ['Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi','Dimanche'];
        private $months = ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Aout','Septembre','Octobre','Novembre','Décembre'];
        public $month;
        public $year;
        public $day;
     
        public function __construct($month = null, $year = null, $day = null){
     
            if ($month === null) {
               $month = intval(date('m'));
            }
     
            if ($year === null) {
                $year = intval(date('Y'));
            }
     
            if ($day === null) {
                $day = intval(date('d'));
            }
     
            if ($month < 1 || $month > 12){
                throw new Exception("le mois $month n'est pas valide");
            }
     
            if ($year < 1970) {
                throw new Exception("L'année est avant 1970");
            }
            $this->month = $month;
            $this->year = $year;
            $this->day = $day;
        }
     
        public function getStartingDay(){
            return $start = new DateTime("{$this->year}-{$this->month}-01");
        }
     
        public function toString(){
            return $this->months[$this->month - 1] . ' ' . $this->year;
        }
     
        public function getWeeks(){
            $start = $this->getStartingDay();
            $end1 = clone $start;
            $end = $end1->modify('+1 month -1 day');
            $startWeek = intval($start->format('W'));
            $endWeek = intval($end->format('W'));
     
            if ($endWeek === 1) {
                $endClone = clone $end;
                $endWeek = intval($endClone->modify('-7 days')->format('W')) + 1;
            }
            $weeks = $endWeek - $startWeek + 1;
            if($weeks < 0){
                $weeks = intval($end->format('W'));
            }
            return $weeks;
     
        }
     
        public function withinMonth($date){
            return $this->getStartingDay()->format('Y-m') === $date->format('Y-m');
        }
     
        public function nextMonth(){
            $month = $this->month + 1 ;
            $year = $this->year;
            if ($month > 12) {
                $month = 1;
                $year += 1;
            }
            return new plugin_calendar($month, $year);
        }
     
        public function previousMonth(){
            $month = $this->month - 1 ;
            $year = $this->year;
            if ($month < 1) {
                $month = 12;
                $year -= 1;
            }
            return new plugin_calendar($month, $year);
        }
     
     
     
     
    }
    Où est mon erreur?

  2. #2
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 100
    Points
    19 100
    Billets dans le blog
    17
    Par défaut
    Vous utilisez une variable $weeks ligne 33 qui n'est pas défini

    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    33	    <table class="calendar_table calendar_table--<?php echo $weeks; ?>weeks">
    Framework php sécurisé et simple à prendre en main avec générateur web http://mkframework.com/ (hebergé sur developpez.com)
    Mes cours/tutoriaux

  3. #3
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 100
    Points
    19 100
    Billets dans le blog
    17
    Par défaut
    En relisant votre code, je pense que vous avez une exception qui vous fait passer dans le catch avant de definir votre variable $weeks

    il faudrait afficher l'exception et la corriger dans ce cas

    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
     
    <?php
     
    try{
        $events = new plugin_event();
        $calendar = new plugin_calendar($_GET['month'] ? $_GET['month']: null, $_GET['year'] ?$_GET['year'] : null);
        $start = $calendar->getStartingDay();
        $start = $start->format('N') === '1' ? $start : $calendar->getStartingDay()->modify('Last monday');
        $weeks = $calendar->getWeeks();
        $nbreWeeks = (6 + 7 * ($weeks -1));
        $clone = (clone $start);
        $end = $clone->modify('+'. $nbreWeeks .' days');
        $events = $events->getEventsBetweenByDay($start,$end);
        plugin_debug::addSpy('$calendar',$calendar);
     
    } catch (\Exception $e){
       print( $e->getMessage() );
     
        $calendar = new plugin_calendar();
    }
     
     
    ?>

    d'ailleurs pourquoi faire ainsi ? vous anticipez sur une erreur ?
    Framework php sécurisé et simple à prendre en main avec générateur web http://mkframework.com/ (hebergé sur developpez.com)
    Mes cours/tutoriaux

  4. #4
    Membre habitué
    Homme Profil pro
    Assistant statisticien
    Inscrit en
    Juillet 2009
    Messages
    132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Réunion

    Informations professionnelles :
    Activité : Assistant statisticien
    Secteur : Santé

    Informations forums :
    Inscription : Juillet 2009
    Messages : 132
    Points : 168
    Points
    168
    Par défaut plugin_calendar
    oui au cas où

    Que penses tu du plugin_calendar ainsi que le plugin event?

Discussions similaires

  1. [VB6] Création de composant
    Par Tchetch dans le forum VB 6 et antérieur
    Réponses: 2
    Dernier message: 21/10/2002, 14h52
  2. [c++ builder] creation de surface sur TPanel
    Par JEG dans le forum DirectX
    Réponses: 7
    Dernier message: 23/09/2002, 22h41
  3. [Kylix] SIGSEGV 11 - creation form
    Par pram dans le forum EDI
    Réponses: 1
    Dernier message: 29/08/2002, 15h24
  4. Creation de fiche dynamique
    Par Mouss26 dans le forum C++Builder
    Réponses: 7
    Dernier message: 24/07/2002, 07h56
  5. Creation d une clee dans la registry en VC++
    Par rico27fr dans le forum MFC
    Réponses: 4
    Dernier message: 30/05/2002, 12h36

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo