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

CodeIgniter PHP Discussion :

Erreur lors du passage de données entre le contrôleur et la vue


Sujet :

CodeIgniter PHP

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éprouvé Avatar de Savak
    Homme Profil pro
    Ingénieur Etude et Développement
    Inscrit en
    Avril 2012
    Messages
    111
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Ingénieur Etude et Développement

    Informations forums :
    Inscription : Avril 2012
    Messages : 111
    Par défaut Erreur lors du passage de données entre le contrôleur et la vue
    Bonjour à tous!

    Amis de Developpez.com, I need your help!

    Voilà mon problème : je suis actuellement en train de travailler sur un projet avec le framework CodeIgniter. Tout se passait bien jusqu'à ce que je rencontre une erreur lors de l'appel de la fonction public "vueChauffage()" de mon contrôleur : "Message: Cannot modify header information - headers already sent by (output started at /var/www/rtconso/system/database/drivers/pdo/pdo_result.php:261)"

    Je vous transmets le code concerné :

    Le contrôleur "Moteur_calcul" :
    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
    <?php
    defined('BASEPATH') OR exit('No direct script access allowed');
     
    class Moteur_calcul extends CI_Controller {
     
        protected $idClient;
     
        function __construct() {
            parent::__construct();
     
            //Chargement des modèles nécessaires au moteur de calcul
            $this->load->model('Consommation_model');
            $this->load->model('Client_model');
            $this->load->model('Donnees_client_model');
     
            //Chargement des librairies nécessaires au moteur de calcul
            $this->load->library('moteur_calcul_lib');
            $this->load->library('moteur_calcul_chauffage_lib');
            $this->load->library('moteur_calcul_refroidissement_lib');
            $this->load->library('moteur_calcul_ecs_lib');
     
            //Récupération de l'id du client
            $this->idClient = $this->Client_model->getIdClient($this->session->userdata('idutilisateur'));
        }
     
        public function index(){
     
        }
     
        public function vueChauffage(){
            //Chargement du header
            $this->load->view('template/header');
     
            //Récupération des données
            $data['srt']=$this->moteur_calcul_chauffage_lib->getSrt($this->idClient);
            $data['deperdition']=$this->moteur_calcul_chauffage_lib->getDeperdition($this->idClient);
            $data['temperature']=$this->moteur_calcul_chauffage_lib->getTemperatureThermostat($this->idClient);
            $data['energie']= $this->moteur_calcul_chauffage_lib->getEnergie();
            $data['consoAnnuelle']=$this->moteur_calcul_chauffage_lib->getConsoAnnuelle($this->idClient);
            $data['consoMensuelleChauffage']=$this->moteur_calcul_chauffage_lib->getConsoMensuelleChauffage($this->idClient);
            $data['periode']= $this->moteur_calcul_chauffage_lib->getPeriode();
            $data['repartition']= $this->moteur_calcul_chauffage_lib->getRepartition($this->idClient);
            $data['consoMensuelleKwhm']=$this->moteur_calcul_chauffage_lib->getConsoMensuelleKwhm($this->idClient);
            $data['tabDju']=$this->moteur_calcul_chauffage_lib->getDju($this->idClient);
            $data['tabDjm']=$this->moteur_calcul_chauffage_lib->getDjm($this->idClient);
            $data['consoKwhefj']=$this->moteur_calcul_chauffage_lib->getConsoKwhefj($this->idClient);
            $data['consoBois']=$this->moteur_calcul_chauffage_lib->getConsoBois($this->idClient);
            $data['consoElec']=$this->moteur_calcul_chauffage_lib->getConsoElec($this->idClient);
            $data['consoGaz']=$this->moteur_calcul_chauffage_lib->getConsoGaz($this->idClient);
            $data['consoFod']=$this->moteur_calcul_chauffage_lib->getConsoFod($this->idClient);
            $data['consoCharbon']=$this->moteur_calcul_chauffage_lib->getConsoCharbon($this->idClient);
            $data['consoReseau']=$this->moteur_calcul_chauffage_lib->getConsoReseau($this->idClient);
            $data['tabDjmCorrige']=$this->moteur_calcul_chauffage_lib->getDjmCorrige($this->idClient);
            $data['tabDjuCorrige']=$this->moteur_calcul_chauffage_lib->getDjuCorrige($this->idClient);
     
            //Chargement et envoie des résultats à la vue
            $this->load->view('moteur_calcul/Chauffage_view',$data);
     
            //Chargement du footer
            $this->load->view('template/footer');
        }
    }
    La librairie mère "Moteur_calcul_lib" :
    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
    <?php
    defined('BASEPATH') OR exit('No direct script access allowed');
     
    class Moteur_calcul_lib {
     
        protected $CI;
     
        function __construct() {
            // Assign the CodeIgniter super-object
            $this->CI =& get_instance();
     
            //Chargement des modèles nécessaires au moteur de calcul
            $this->CI->load->model('Consommation_model');
            $this->CI->load->model('Client_model');
            $this->CI->load->model('Donnees_client_model');
            $this->CI->load->model('Energie_model');
            $this->CI->load->model('Periode_model');
        }
     
        public function getSrt($idClient){
            //Récupération de la surface thermique du client connecté
            $srt = $this->CI->Donnees_client_model->getLigneDonneesClient($idClient)->srt;
            return $srt;
        }
     
        public function getDeperdition($idClient){
            //Récupération du total des déperditions ramené à la Srt du client connecté
            $deperdition = $this->CI->Donnees_client_model->getLigneDonneesClient($idClient)->deperdition;
            return $deperdition;
        }
     
        public function getConsoAnnuelle($idClient){
            //Récupération des consommations annuelles du client connecté
            $lignesConsoAnnuelle = $this->CI->Consommation_model->getConsoAnnuelle($idClient);
            $tabConsoAnnuelle = array();
            foreach ($lignesConsoAnnuelle as $ligne) {
                $tabConsoAnnuelle[]=$ligne->resultat;
            }
            return $tabConsoAnnuelle;
        }
     
        public function getConsoMensuelleChauffage($idClient){
            //Récupération des consommations mensuelles du client connecté
            $lignesConsoMensuelle = $this->CI->Consommation_model->getConsoMensuelleChauffage($idClient);
            $tabConsoMensuelle = array();
            foreach ($lignesConsoMensuelle as $ligne) {
                $tabConsoMensuelle[]=$ligne->resultat;
            }
            //Calcul de la consommation sur l'année
            $totalAnnee=$tabConsoMensuelle[0]+$tabConsoMensuelle[1]+$tabConsoMensuelle[2]+$tabConsoMensuelle[3]+
                    $tabConsoMensuelle[4]+$tabConsoMensuelle[5]+$tabConsoMensuelle[6]+$tabConsoMensuelle[7]+$tabConsoMensuelle[8]+
                    $tabConsoMensuelle[9]+$tabConsoMensuelle[10]+$tabConsoMensuelle[11];
            $tabConsoMensuelle[]=$totalAnnee;
            //On retourne le tableau contenant les consommations mensuelles
            return $tabConsoMensuelle;
        }
     
        public function getConsoMensuelleRefroidissement($idClient){
            //Récupération des consommations mensuelles du client connecté
            $lignesConsoMensuelle = $this->CI->Consommation_model->getConsoMensuelleRefroidissement($idClient);
            $tabConsoMensuelle = array();
            foreach ($lignesConsoMensuelle as $ligne) {
                $tabConsoMensuelle[]=$ligne->resultat;
            }
            //Calcul de la consommation sur l'année
            $totalAnnee=$tabConsoMensuelle[0]+$tabConsoMensuelle[1]+$tabConsoMensuelle[2]+$tabConsoMensuelle[3]+
                    $tabConsoMensuelle[4]+$tabConsoMensuelle[5]+$tabConsoMensuelle[6]+$tabConsoMensuelle[7]+$tabConsoMensuelle[8]+
                    $tabConsoMensuelle[9]+$tabConsoMensuelle[10]+$tabConsoMensuelle[11];
            $tabConsoMensuelle[]=$totalAnnee;
            //On retourne le tableau contenant les consommations mensuelles
            return $tabConsoMensuelle;
        }
     
        public function getConsoMensuelleECS($idClient){
            //Récupération des consommations mensuelles du client connecté
            $lignesConsoMensuelle = $this->CI->Consommation_model->getConsoMensuelleECS($idClient);
            $tabConsoMensuelle = array();
            foreach ($lignesConsoMensuelle as $ligne) {
                $tabConsoMensuelle[]=$ligne->resultat;
            }
            //Calcul de la consommation sur l'année
            $totalAnnee=$tabConsoMensuelle[0]+$tabConsoMensuelle[1]+$tabConsoMensuelle[2]+$tabConsoMensuelle[3]+
                    $tabConsoMensuelle[4]+$tabConsoMensuelle[5]+$tabConsoMensuelle[6]+$tabConsoMensuelle[7]+$tabConsoMensuelle[8]+
                    $tabConsoMensuelle[9]+$tabConsoMensuelle[10]+$tabConsoMensuelle[11];
            $tabConsoMensuelle[]=$totalAnnee;
            //On retourne le tableau contenant les consommations mensuelles
            return $tabConsoMensuelle;
        }
     
        public function getConsoMensuelleEclairage($idClient){
            //Récupération des consommations mensuelles du client connecté
            $lignesConsoMensuelle = $this->CI->Consommation_model->getConsoMensuelleEclairage($idClient);
            $tabConsoMensuelle = array();
            foreach ($lignesConsoMensuelle as $ligne) {
                $tabConsoMensuelle[]=$ligne->resultat;
            }
            //Calcul de la consommation sur l'année
            $totalAnnee=$tabConsoMensuelle[0]+$tabConsoMensuelle[1]+$tabConsoMensuelle[2]+$tabConsoMensuelle[3]+
                    $tabConsoMensuelle[4]+$tabConsoMensuelle[5]+$tabConsoMensuelle[6]+$tabConsoMensuelle[7]+$tabConsoMensuelle[8]+
                    $tabConsoMensuelle[9]+$tabConsoMensuelle[10]+$tabConsoMensuelle[11];
            $tabConsoMensuelle[]=$totalAnnee;
            //On retourne le tableau contenant les consommations mensuelles
            return $tabConsoMensuelle;
        }
     
        public function getConsoMensuelleAuxV($idClient){
            //Récupération des consommations mensuelles du client connecté
            $lignesConsoMensuelle = $this->CI->Consommation_model->getConsoMensuelleAuxV($idClient);
            $tabConsoMensuelle = array();
            foreach ($lignesConsoMensuelle as $ligne) {
                $tabConsoMensuelle[]=$ligne->resultat;
            }
            //Calcul de la consommation sur l'année
            $totalAnnee=$tabConsoMensuelle[0]+$tabConsoMensuelle[1]+$tabConsoMensuelle[2]+$tabConsoMensuelle[3]+
                    $tabConsoMensuelle[4]+$tabConsoMensuelle[5]+$tabConsoMensuelle[6]+$tabConsoMensuelle[7]+$tabConsoMensuelle[8]+
                    $tabConsoMensuelle[9]+$tabConsoMensuelle[10]+$tabConsoMensuelle[11];
            $tabConsoMensuelle[]=$totalAnnee;
            //On retourne le tableau contenant les consommations mensuelles
            return $tabConsoMensuelle;
        }
     
        public function getConsoMensuelleAuxD($idClient){
            //Récupération des consommations mensuelles du client connecté
            $lignesConsoMensuelle = $this->CI->Consommation_model->getConsoMensuelleAuxD($idClient);
            $tabConsoMensuelle = array();
            foreach ($lignesConsoMensuelle as $ligne) {
                $tabConsoMensuelle[]=$ligne->resultat;
            }
            //Calcul de la consommation sur l'année
            $totalAnnee=$tabConsoMensuelle[0]+$tabConsoMensuelle[1]+$tabConsoMensuelle[2]+$tabConsoMensuelle[3]+
                    $tabConsoMensuelle[4]+$tabConsoMensuelle[5]+$tabConsoMensuelle[6]+$tabConsoMensuelle[7]+$tabConsoMensuelle[8]+
                    $tabConsoMensuelle[9]+$tabConsoMensuelle[10]+$tabConsoMensuelle[11];
            $tabConsoMensuelle[]=$totalAnnee;
            //On retourne le tableau contenant les consommations mensuelles
            return $tabConsoMensuelle;
        }
     
        public function getPourcentageConso($idClient){
            $totalConso = $this->getConsoMensuelleChauffage($idClient)[12]+$this->getConsoMensuelleRefroidissement($idClient)[12]+
                    $this->getConsoMensuelleECS($idClient)[12]+$this->getConsoMensuelleEclairage($idClient)[12]+
                    $this->getConsoMensuelleAuxV($idClient)[12]+$this->getConsoMensuelleAuxD($idClient)[12];
            $tabPourcentageConso=array(
                'chauffage'=>$this->getConsoMensuelleChauffage($idClient)[12]/$totalConso*100,
                'refroidissement'=>$this->getConsoMensuelleRefroidissement($idClient)[12]/$totalConso*100,
                'ecs'=>$this->getConsoMensuelleECS($idClient)[12]/$totalConso*100,
                'autres'=>($this->getConsoMensuelleEclairage($idClient)[12]+$this->getConsoMensuelleAuxV($idClient)[12]+$this->getConsoMensuelleAuxD($idClient)[12])/$totalConso*100
            );
            return $tabPourcentageConso;
        }
     
        public function getEnergie(){
            // Récupération du contenu de la table énergie
            $lignesEnergie = $this->CI->Energie_model->getLigneEnergie();
            $tabEnergie = array();
            foreach ($lignesEnergie as $ligne) {
                $tabEnergie[]=$ligne->nom_energie;
            }
            return $tabEnergie;
        }
     
        public function getPeriode(){
            // Récupération du contenu de la table énergie
            $lignesPeriode = $this->CI->Periode_model->getLignePeriode();
            $tabPeriode = array();
            foreach ($lignesPeriode as $ligne) {
                $tabPeriode[]=$ligne->nom_periode;
            }
            return $tabPeriode;
        }
     
        public function getTemperatureThermostat($idClient){
            // Récupération de la temperature du thermostat idiqué par le client
            return $this->CI->Donnees_client_model->getLigneDonneesClient($idClient)->temperature_thermo;
        }
    }
    La librairie enfant "Moteur_calcul_chauffage_lib" :
    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
    <?php
    defined('BASEPATH') OR exit('No direct script access allowed');
     
    class Moteur_calcul_chauffage_lib extends Moteur_calcul_lib {
     
        function __construct() {
            parent::__construct();
        }
     
        public function getRepartition($idClient){
            if ($this->getConsoMensuelleChauffage($idClient)[12]!=0){
                $tabRepartition = array(
                $this->getConsoAnnuelle($idClient)[0]/$this->getConsoMensuelleChauffage($idClient)[12],
                $this->getConsoAnnuelle($idClient)[3]/$this->getConsoMensuelleChauffage($idClient)[12],
                $this->getConsoAnnuelle($idClient)[6]/$this->getConsoMensuelleChauffage($idClient)[12],
                $this->getConsoAnnuelle($idClient)[9]/$this->getConsoMensuelleChauffage($idClient)[12],
                $this->getConsoAnnuelle($idClient)[12]/$this->getConsoMensuelleChauffage($idClient)[12],
                $this->getConsoAnnuelle($idClient)[18]/$this->getConsoMensuelleChauffage($idClient)[12]
                );
            }else{
                $tabRepartition = array(0,0,0,0,0,0);
            }
            return $tabRepartition;
        }
     
        public function getConsoMensuelleKwhm($idClient){
            $facteur = $this->getRepartition($idClient)[0]/1+$this->getRepartition($idClient)[1]/1+
                    $this->getRepartition($idClient)[2]/1+$this->getRepartition($idClient)[3]/1+
                    $this->getRepartition($idClient)[4]/CONV_EP_EF_ELEC+$this->getRepartition($idClient)[5]/1;
            $tabConso = array();
            foreach ($this->getConsoMensuelleChauffage($idClient) as $conso) {
                $tabConso[]=$conso*$facteur;
            }
            return $tabConso;
        }
     
        public function getDju($idClient){
            $tabDju = array();
            foreach ($this->getConsoMensuelleKwhm($idClient) as $kwhm) {
                $tabDju[]=($kwhm*1000)/($this->getDeperdition($idClient)*24);
            }
            return $tabDju;
        }
     
        public function getDjm($idClient){
            $tabDjm = array();
            $tabDjm[]=$this->getDju($idClient)[0]/31;
            $tabDjm[]=$this->getDju($idClient)[1]/28;
            $tabDjm[]=$this->getDju($idClient)[2]/31;
            $tabDjm[]=$this->getDju($idClient)[3]/30;
            $tabDjm[]=$this->getDju($idClient)[4]/31;
            $tabDjm[]=$this->getDju($idClient)[5]/30;
            $tabDjm[]=$this->getDju($idClient)[6]/31;
            $tabDjm[]=$this->getDju($idClient)[7]/31;
            $tabDjm[]=$this->getDju($idClient)[8]/30;
            $tabDjm[]=$this->getDju($idClient)[9]/31;
            $tabDjm[]=$this->getDju($idClient)[10]/30;
            $tabDjm[]=$this->getDju($idClient)[11]/31;
            $tabDjm[]=$this->getDju($idClient)[12]/31;  //Total
            return $tabDjm;
        }
     
        public function getConsoKwhefj($idClient){
            $tabConsoKwhefj = array();
            $tabConsoKwhefj[]=$this->getConsoMensuelleKwhm($idClient)[0]*$this->getSrt($idClient)/31;
            $tabConsoKwhefj[]=$this->getConsoMensuelleKwhm($idClient)[1]*$this->getSrt($idClient)/28;
            $tabConsoKwhefj[]=$this->getConsoMensuelleKwhm($idClient)[2]*$this->getSrt($idClient)/31;
            $tabConsoKwhefj[]=$this->getConsoMensuelleKwhm($idClient)[3]*$this->getSrt($idClient)/30;
            $tabConsoKwhefj[]=$this->getConsoMensuelleKwhm($idClient)[4]*$this->getSrt($idClient)/31;
            $tabConsoKwhefj[]=$this->getConsoMensuelleKwhm($idClient)[5]*$this->getSrt($idClient)/30;
            $tabConsoKwhefj[]=$this->getConsoMensuelleKwhm($idClient)[6]*$this->getSrt($idClient)/31;
            $tabConsoKwhefj[]=$this->getConsoMensuelleKwhm($idClient)[7]*$this->getSrt($idClient)/31;
            $tabConsoKwhefj[]=$this->getConsoMensuelleKwhm($idClient)[8]*$this->getSrt($idClient)/30;
            $tabConsoKwhefj[]=$this->getConsoMensuelleKwhm($idClient)[9]*$this->getSrt($idClient)/31;
            $tabConsoKwhefj[]=$this->getConsoMensuelleKwhm($idClient)[10]*$this->getSrt($idClient)/30;
            $tabConsoKwhefj[]=$this->getConsoMensuelleKwhm($idClient)[11]*$this->getSrt($idClient)/31;
            $tabConsoKwhefj[]=$this->getConsoMensuelleKwhm($idClient)[12]*$this->getSrt($idClient)/31;
            return $tabConsoKwhefj;
        }
     
        public function getConsoBois($idClient){
            $tabConsoBois = array();
            foreach ($this->getConsoKwhefj($idClient) as $conso) {
                $tabConsoBois[]=$conso*$this->getRepartition($idClient)[3];
            }
            return $tabConsoBois;
        }
     
        public function getConsoElec($idClient){
            $tabConsoElec = array();
            foreach ($this->getConsoKwhefj($idClient) as $conso) {
                $tabConsoElec[]=$conso*$this->getRepartition($idClient)[4];
            }
            return $tabConsoElec;
        }
     
        public function getConsoGaz($idClient){
            $tabConsoGaz = array();
            foreach ($this->getConsoKwhefj($idClient) as $conso) {
                $tabConsoGaz[]=$conso*$this->getRepartition($idClient)[0];
            }
            return $tabConsoGaz;
        }
     
        public function getConsoFod($idClient){
            $tabConsoFod = array();
            foreach ($this->getConsoKwhefj($idClient) as $conso) {
                $tabConsoFod[]=$conso*$this->getRepartition($idClient)[1];
            }
            return $tabConsoFod;
        }
     
        public function getConsoCharbon($idClient){
            $tabConsoCharbon = array();
            foreach ($this->getConsoKwhefj($idClient) as $conso) {
                $tabConsoCharbon[]=$conso*$this->getRepartition($idClient)[2];
            }
            return $tabConsoCharbon;
        }
     
        public function getConsoReseau($idClient){
            $tabConsoReseau = array();
            foreach ($this->getConsoKwhefj($idClient) as $conso) {
                $tabConsoReseau[]=$conso*$this->getRepartition($idClient)[5];
            }
            return $tabConsoReseau;
        }
     
        public function getDjmCorrige($idClient){
            $tabDjmCorrige = array();
            for ($i=0;$i<12;$i++){
                if ($this->getDjm($idClient)[$i] > 0){
                    $tabDjmCorrige[$i]=$this->getDjm($idClient)[$i]+$this->getTemperatureThermostat($idClient)-TEMP_THER_BASE;
                }else{
                    $tabDjmCorrige[$i]=0;
                }
            }
            $tabDjmCorrige[12]=0;
            foreach ($tabDjmCorrige as $value){
                $tabDjmCorrige[12]=$tabDjmCorrige[12]+$value;
            }
            return $tabDjmCorrige;
        }
     
        public function getDjuCorrige($idClient){
            $tabDjuCorrige = array();
            $tabDjuCorrige[]=$this->getDjmCorrige($idClient)[0]*31;
            $tabDjuCorrige[]=$this->getDjmCorrige($idClient)[1]*28;
            $tabDjuCorrige[]=$this->getDjmCorrige($idClient)[2]*31;
            $tabDjuCorrige[]=$this->getDjmCorrige($idClient)[3]*30;
            $tabDjuCorrige[]=$this->getDjmCorrige($idClient)[4]*31;
            $tabDjuCorrige[]=$this->getDjmCorrige($idClient)[5]*30;
            $tabDjuCorrige[]=$this->getDjmCorrige($idClient)[6]*31;
            $tabDjuCorrige[]=$this->getDjmCorrige($idClient)[7]*31;
            $tabDjuCorrige[]=$this->getDjmCorrige($idClient)[8]*30;
            $tabDjuCorrige[]=$this->getDjmCorrige($idClient)[9]*31;
            $tabDjuCorrige[]=$this->getDjmCorrige($idClient)[10]*30;
            $tabDjuCorrige[]=$this->getDjmCorrige($idClient)[11]*31;
            $total=0;
            foreach ($tabDjuCorrige as $value) {
                $total=$total+$value; //Total
            }
            $tabDjuCorrige[]=$total;
            return $tabDjuCorrige;
        }
    }
    La vue "Chauffage_view" :
    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
    <!-- =============== BEGIN #page ==============================-->
    <div id="page">
      <div class="vague"></div>
      <!-- =========== BEGIN CONTENT FOR THE PAGE =========================================================================== -->
      <div class="page-content" role="main">
     
    <div class="container">
      <div class="row sixteen-gutter background-white">
        <div class="col-sm-12 col-md-12">
          <h3>Moteur de calcul pour le chauffage</h3>
          <h4>Données générales</h4>
          <table class="table table-bordered">
            <thead>
              <tr>
                <th>Surface thermique (en m²)</th>
                <th>Total des déperditions ramené à la Srt (en W/m²Srt.K)</th>
                <th>Température thermostat (en °C)</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td><?php echo $srt;?></td>
                <td><?php echo $deperdition;?></td>
                <td><?php echo $temperature;?></td>
              </tr>
            </tbody>
          </table>
          <h4>Conversion Ep/Ef par type d'énergie</h4>
          <table class="table table-bordered">
            <thead>
              <tr>
                <?php for ($i=1;$i<7;$i++):?>
                  <th><?php echo $energie[$i];?></th>
                <?php endfor;?>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td><?php echo CONV_EP_EF_ELEC;?></td>
                <td>1</td>
              </tr>
            </tbody>
          </table>
          <h4>Résultat des consommations annuelles par énergie pour le chauffage (en Kwhep/m² Srt)</h4>
          <table class="table table-bordered">
            <thead>
              <tr>
                <?php for ($i=1;$i<7;$i++):?>
                  <th><?php echo $energie[$i];?></th>
                <?php endfor;?>
              </tr>
            </thead>
            <tbody>
                <tr>
                <td><?php echo $consoAnnuelle[0];?></td>
                <td><?php echo $consoAnnuelle[3];?></td>
                <td><?php echo $consoAnnuelle[6];?></td>
                <td><?php echo $consoAnnuelle[9];?></td>
                <td><?php echo $consoAnnuelle[12];?></td>
                <td><?php echo $consoAnnuelle[18];?></td>
              </tr>
            </tbody>
          </table>
          <h4>Répartition (en %)</h4>
          <table class="table table-bordered">
            <thead>
              <tr>
                <?php for ($i=1;$i<7;$i++):?>
                  <th><?php echo $energie[$i];?></th>
                <?php endfor;?>
              </tr>
            </thead>
            <tbody>
              <tr>
                <?php foreach ($repartition as $rep):?>
                  <td><?php echo number_format($rep,2);?></td>
                <?php endforeach;?>
              </tr>
            </tbody>
          </table>
          <h4>Résultats détaillés sur les consommations d'énergie du chauffage (données relevées del'étude thermique)</h4>
          <table class="table table-bordered">
            <thead>
              <tr>
                <th>Mois</th>
                <?php for ($i=1;$i<13;$i++):?>
                  <td><?php echo $periode[$i];?></td>
                <?php endfor;?>
                <td><?php echo $periode[0];?></td>
              </tr>
            </thead>
            <tbody>
              <tr>
                <th>Consommations mensuelles(en Kwhep/m² Srt)</th>
                <?php foreach ($consoMensuelleChauffage as $consoMC):?>
                  <td><?php echo $consoMC;?></td>
                <?php endforeach;?>
              </tr>
              <tr>
                <th>Consommations mensuelles(en Kwh/m² Srt)</th>
                <?php foreach ($consoMensuelleKwhm as $Kwhm):?>
                  <td><?php echo number_format($Kwhm,2);?></td>
                <?php endforeach;?>
              </tr>
              <tr>
                <th>Dju (Kelvin.Jours unifiés)</th>
                <?php foreach ($tabDju as $dju):?>
                  <td><?php echo number_format($dju,2);?></td>
                <?php endforeach;?>
              </tr>
              <tr>
                <th>Dj Moyen (Kelvin. jour moyen)</th>
                <?php foreach ($tabDjm as $djm):?>
                  <td><?php echo number_format($djm,2);?></td>
                <?php endforeach;?>
              </tr>
              <tr>
                <th>Consommations journalières (en kWhef/j)</th>
                <?php foreach ($consoKwhefj as $conso):?>
                  <td><?php echo number_format($conso,2);?></td>
                <?php endforeach;?>
              </tr>
              <tr>
                <th>Consommations journalières de bois(en kWhef/j)</th>
                <?php foreach ($consoBois as $consoB):?>
                  <td><?php echo number_format($consoB,2);?></td>
                <?php endforeach;?>
              </tr>
              <tr>
                <th>Consommations journalières d'électricité (en kWhef/j)</th>
                <?php foreach ($consoElec as $consoE):?>
                  <td><?php echo number_format($consoE,2);?></td>
                <?php endforeach;?>
              </tr>
              <tr>
                <th>Consommations journalières de gaz (en kWhef/j)</th>
                <?php foreach ($consoGaz as $consoG):?>
                  <td><?php echo number_format($consoG,2);?></td>
                <?php endforeach;?>
              </tr>
              <tr>
                <th>Consommations journalières de FOD (en kWhef/j)</th>
                <?php foreach ($consoFod as $consoF):?>
                  <td><?php echo number_format($consoF,2);?></td>
                <?php endforeach;?>
              </tr>
              <tr>
                <th>Consommations journalières de charbon (en kWhef/j)</th>
                <?php foreach ($consoCharbon as $consoC):?>
                  <td><?php echo number_format($consoC,2);?></td>
                <?php endforeach;?>
              </tr>
              <tr>
                <th>Consommations journalières du réseau de chaleur (en kWhef/j)</th>
                <?php foreach ($consoReseau as $consoR):?>
                  <td><?php echo number_format($consoR,2);?></td>
                <?php endforeach;?>
              </tr>
            </tbody>
          </table>
          <h4>Résultats détaillés sur les consommations d'énergie du chauffage (valeurs corrigées grâce aux données client)</h4>
          <table class="table table-bordered">
            <thead>
              <tr>
                <th>Mois</th>
                <?php for ($i=1;$i<13;$i++):?>
                  <td><?php echo $periode[$i];?></td>
                <?php endfor;?>
                <td><?php echo $periode[0];?></td>
              </tr>
            </thead>
            <tbody>
              <tr>
                <th>Dj Moyen corrigé (Kelvin. jour moyen)</th>
                <?php foreach ($tabDjmCorrige as $djmC):?>
                <td><?php echo number_format($djmC,2);?></td>
                <?php endforeach;?>
              </tr>
              <tr>
                <th>Dju corrigé (Kelvin.Jours unifiés)</th>
                <?php foreach ($tabDjuCorrige as $djuC):?>
                <td><?php echo number_format($djuC,2);?></td>
                <?php endforeach;?>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
    </div>
    </div>
    Je vous fais grâce des modèles qui sont composés de requêtes SQL basiques et qui je pense, ne sont pas la source de mon problème. Si jamais vous voulez tout de même les voir, n'hésitez pas à me demander.

    Et donc, lorsque je vais dans mon navigateur pour tester ma page (qui n'est en fait composée que de tableaux me permettant de vérifier des données) avec l'adresse suivante : http://localhost/rtconso/Moteur_calcul/vueChauffage, je me trouve face à l'erreur précédemment mentionnée.

    Après quelques recherche, je suis tombé sur ce post qui semblait pourvoir m'aidez. J'ai appliqué chaque correctif mentionné mais sans résultat... Il se peut que je soit passé à côté de quelque chose mais après y avoir passé mon après-midi d'hier sans solutionner mon problème, j'ai décider de venir mendier votre aide

    Une dernière chose : lorsque je supprime la ligne
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $data['tabDjuCorrige']=$this->moteur_calcul_chauffage_lib->getDjuCorrige($this->idClient);
    du contrôleur et la ligne du tableau associé dans la vue, tout roule... Je me suis donc penché sur la fonction de la librairie correspondant à cette ligne mais je n'ai rien trouvé d'incohérent ou en rapport avec mon message d'erreur...

    Je pense avoir fais le tour. Si jamais je me suis mal exprimé sur un point ou qu'il manque des informations vous permettant de m'aider, n'hésitez pas à me demander s'il vous plaît.

    Merci d'avance!

  2. #2
    Membre extrêmement actif
    Avatar de randriano
    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    1 221
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Madagascar

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 221
    Par défaut
    Que c'est beau de lire un code CodeIgniter!

    Mais je ne vois pas aussi où est le bug dans ces codes que tu as donnés.
    On dirait qu'il y a un echo quelque part dans les fonctions du library. Essayez peut-être par mettre tous les load->view() à la fin de la méthode?
    randriano.dvp.com
    Développeur. Product Owner [Agile]. Sites web, mobile apps, système d'information (SI).

  3. #3
    Membre éprouvé Avatar de Savak
    Homme Profil pro
    Ingénieur Etude et Développement
    Inscrit en
    Avril 2012
    Messages
    111
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Ingénieur Etude et Développement

    Informations forums :
    Inscription : Avril 2012
    Messages : 111
    Par défaut
    Merci pour ta réponse randriano.

    Après vérification, je peux t'affirmer qu'il n'y a aucun "echo" dans mes librairies, mes modèles ou encore mes contrôleurs. Tous les affichages se font dans les vues.

    Essayez peut-être par mettre tous les load->view() à la fin de la méthode?
    Je l'ai fais comme ci-dessous mais ça n'a pas résolu mon problème...

    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
        public function vueChauffage(){
            //Récupération des données
            $data['srt']=$this->moteur_calcul_chauffage_lib->getSrt($this->idClient);
            $data['deperdition']=$this->moteur_calcul_chauffage_lib->getDeperdition($this->idClient);
            $data['temperature']=$this->moteur_calcul_chauffage_lib->getTemperatureThermostat($this->idClient);
            $data['energie']= $this->moteur_calcul_chauffage_lib->getEnergie();
            $data['consoAnnuelle']=$this->moteur_calcul_chauffage_lib->getConsoAnnuelle($this->idClient);
            $data['consoMensuelleChauffage']=$this->moteur_calcul_chauffage_lib->getConsoMensuelleChauffage($this->idClient);
            $data['periode']= $this->moteur_calcul_chauffage_lib->getPeriode();
            $data['repartition']= $this->moteur_calcul_chauffage_lib->getRepartition($this->idClient);
            $data['consoMensuelleKwhm']=$this->moteur_calcul_chauffage_lib->getConsoMensuelleKwhm($this->idClient);
            $data['tabDju']=$this->moteur_calcul_chauffage_lib->getDju($this->idClient);
            $data['tabDjm']=$this->moteur_calcul_chauffage_lib->getDjm($this->idClient);
            $data['consoKwhefj']=$this->moteur_calcul_chauffage_lib->getConsoKwhefj($this->idClient);
            $data['consoBois']=$this->moteur_calcul_chauffage_lib->getConsoBois($this->idClient);
            $data['consoElec']=$this->moteur_calcul_chauffage_lib->getConsoElec($this->idClient);
            $data['consoGaz']=$this->moteur_calcul_chauffage_lib->getConsoGaz($this->idClient);
            $data['consoFod']=$this->moteur_calcul_chauffage_lib->getConsoFod($this->idClient);
            $data['consoCharbon']=$this->moteur_calcul_chauffage_lib->getConsoCharbon($this->idClient);
            $data['consoReseau']=$this->moteur_calcul_chauffage_lib->getConsoReseau($this->idClient);
            $data['tabDjmCorrige']=$this->moteur_calcul_chauffage_lib->getDjmCorrige($this->idClient);
            $data['tabDjuCorrige']=$this->moteur_calcul_chauffage_lib->getDjuCorrige($this->idClient);
     
            //Chargement du header
            $this->load->view('template/header');
     
            //Chargement et envoie des résultats à la vue
            $this->load->view('moteur_calcul/Chauffage_view',$data);
     
            //Chargement du footer
            $this->load->view('template/footer');
        }

  4. #4
    Membre Expert
    Avatar de Spartacusply
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mai 2011
    Messages
    1 723
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2011
    Messages : 1 723
    Par défaut
    Il serait bon d'aller regarder ce qu'il se passe ici :

    output started at /var/www/rtconso/system/database/drivers/pdo/pdo_result.php:261
    A priori cette ligne affiche quelque chose qu'elle ne devrait pas...

    Egalement (mais là c'est HS), il y a de grosses optimisations de performances à faire au niveau du code.

  5. #5
    Membre éprouvé Avatar de Savak
    Homme Profil pro
    Ingénieur Etude et Développement
    Inscrit en
    Avril 2012
    Messages
    111
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Ingénieur Etude et Développement

    Informations forums :
    Inscription : Avril 2012
    Messages : 111
    Par défaut
    Bonjour Spartacusply et merci pour ta réponse.

    Il serait bon d'aller regarder ce qu'il se passe ici :

    output started at /var/www/rtconso/system/database/drivers/pdo/pdo_result.php:261
    Le fichier pdo_result.php est un fichier source du framework CodeIgniter. De plus, après quelques tests supplémentaires, je me rends compte que le chemin indiqué après le "output started at" est différent à chaque fois ou presque.

    Egalement (mais là c'est HS), il y a de grosses optimisations de performances à faire au niveau du code.
    Je m'en doutais... Mes pages sont vraiment longues à charger donc ce que tu me dis ne me surprends pas. Est-ce que tu aurais un conseil ou deux quant à l'optimisation de mon code?

    Edit : Je viens de penser à un truc. Se pourrait-il que le fait que mon code soit dégueulasse (je parle au niveau optimisation) est un rapport avec l'erreur de base? Comme je vous l'ai dis ci-dessus, mes pages s'affichent très lentement et il m'arrive même d'avoir une erreur de type Maximum execution time of 30 seconds exceeded.

  6. #6
    Membre extrêmement actif
    Avatar de randriano
    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    1 221
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Madagascar

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 221
    Par défaut
    Ça change à chaque erreur, très bizarre!

    Les fichiers après output started sont peut-être encodés avec BOM (utf8 avec bom)? Le code est issu d'un gestionnaire de sources comme svn qui a été mal configuré?

    Ou bien essaie avec une autre version de CodeIgniter car c'est peut-être un bug de la version que tu utilises?
    randriano.dvp.com
    Développeur. Product Owner [Agile]. Sites web, mobile apps, système d'information (SI).

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Erreur lors de passage de donnée à la JSP
    Par TheEtudiant dans le forum Spring
    Réponses: 4
    Dernier message: 05/01/2015, 14h47
  2. erreurs lors de passage de valeurs par un struct
    Par Aliveli dans le forum Visual C++
    Réponses: 2
    Dernier message: 16/10/2006, 00h15
  3. passage de données entre formulaires
    Par patbeautifulday1 dans le forum Access
    Réponses: 1
    Dernier message: 30/08/2006, 19h06
  4. passage de données entre page
    Par flatron dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 27/01/2006, 14h50
  5. Passage de données entre deux pages
    Par spica92 dans le forum ASP
    Réponses: 2
    Dernier message: 08/09/2005, 15h38

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