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

Langage PHP Discussion :

Appel d'une fonction n'affiche pas le résultat


Sujet :

Langage PHP

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Invité
    Invité(e)
    Par défaut Appel d'une fonction n'affiche pas le résultat
    Bonjour ,
    j'ai un souci avec ce fichier qui n'affiche pas le résultat de la fonction :_constructTreeNode

    merci en avance voir mon code
    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
    <?php
     
    $id = Tools::getValue('id');
    $action = Tools::getValue('action');
     
    // suppression du block
    if(!empty($id) && $action=='del'){
        Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'discount
                                    WHERE `id_discount`="'.$id.'"');
        Form::msgConfirm($this->l('Block supprimé'),array('module'=>'codepromoauto','form'=>'default'));
    }
     
    function _constructTreeNode($node)
    	{	
    	    $ret = '	<tr>
    						<td><input type="checkbox" name="categoryBox[]" class="noborder" value="'.$node['id'].'"/> &nbsp;</td>
    						<td>'.$node['id'].'</td>
    						<td><label for="groupBox_'.$node['id'].'" class="t">'.$node['name'].'</label></td>';
    	    if(!empty($node['children']))
    	    {
    	    	$ret .= '	<tr>';	    	
    	        foreach ($node['children'] AS $child)
    	            $ret .= constructTreeNode($child);
    	        $ret .= '	</tr>';
    	    }
    	    $ret .= '	</tr>';
    	    return $ret;
    	}
     
    $this->_html.= Html::linkBo($this->l('Accédez Ã* la configuration'),array('module'=>'codepromoauto','form'=>'configuration'),array('img'=>'config.png')).'<br/><br/>';
    $this->_html.= Html::linkBo($this->l('Nouveau bloc'),array('module'=>'codepromoauto','form'=>'codepromoauto'),array('img'=>'add.png')).'<br/><br/>';
     
    $blocks = Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'discount_type_lang WHERE `id_lang`="'.$cookie->id_lang.'"');
    $this->_html.=
    '<fieldset>
    			<legend>'.$this->l('Options imported voucher').'</legend>	
    
    			<label>'.$this->l('Type:').' &nbsp;</label>
    			<div class="margin-form">
    			<select name="id_discount_type" id="id_discount_type" onchange="free_shipping()">
    				<option value="0">'.$this->l('-- Choose --').'</option>';
    				$discountTypes = Discount::getDiscountTypes(intval($cookie->id_lang));
    				foreach ($discountTypes AS $discountType)
    				$this->_html .= '<option value="'.intval($discountType['id_discount_type']).'">'.$discountType['name'].'</option>';
     
    			$this->_html .= '</select> <sup>*</sup>
    			</div>
    			
    			<div id="value-div" style="display:none">
    				<label>'.$this->l('Value:&nbsp;').'</label>
    				<div class="margin-form">
    					<input style="float:left;width:80px" type="text" name="value" id="discount_value" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\');" />
    					<select id="id_currency" name="id_currency" style="float:left;margin-left:10px;width:50px;display:none">
    						<option value="0">--</option>';
    						foreach (Currency::getCurrencies() as $row)
    							$this->_html .='<option value="'.(int)$row['id_currency'].'">'.$row['sign'].'</option>';
    					$this->_html .= '</select>
    					<span id="percent-span" style="margin-left:10px;display:none;float:left;font-size:12px;font-weight:bold;color:black"> %</span>
    					<sup style="float:left;margin-left:5px">*</sup>
    					<p class="clear">'.$this->l('Either the monetary amount or the %, depending on Type selected above').'</p>
    				</div>	
    				<div class="clear">&nbsp;</div>			
    			</div>
    			
    			
    			
    			<label>'.$this->l('Description:').' &nbsp;</label>
    				';
    					foreach ($this->_languages as $language)
    						$this->_html .= '<div id="description_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
    											<input size="33" type="text" name="description_'.$language['id_lang'].'" /><sup> *</sup>
    											<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
    											
    										</div>';							
    		$this->_html .= $this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'description', 'description', true);
    		$this->_html .= '<br/><div class="clear" / >
    			<br/>
    			
    			<label>'.$this->l('Categories:').' &nbsp;</label>';
    				$ulTree = '<table cellspacing="0" cellpadding="0" class="table" style="width: 29.5em;">
    								<tr>
    									<th>'.$this->l('Choose').'</th>
    									<th>'.$this->l('ID').'</th>
    									<th>'.$this->l('Categories').'</th>
    								</tr>';
    								foreach ($categTree['children'] AS $child)
    								    $ulTree .= $this->_constructTreeNode($child);				    
    				$ulTree .= '</table>'."\n";
     
    				$this->_html .= $ulTree;
    				$this->_html .= '<div class="clear" / >
    			
    			<br/>
    			<p>
    			<label>'.$this->l('Total quantity:').' </label>
    				<div class="margin-form">
    					<input type="text" size="15" name="quantity" /> <sup>*</sup>
    					<p class="clear">'.$this->l('Total quantity available (mainly for vouchers open to everyone)').'</p>
    				</div>
    				<label>'.$this->l('Qty per each user:').' </label>
    				<div class="margin-form">
    					<input type="text" size="15" name="quantity_per_user" /> <sup>*</sup>
    					<p class="clear">'.$this->l('Number of times a single customer can use this voucher').'</p>
    				</div>
    				<label>'.$this->l('Minimum amount').'</label>
    				<div class="margin-form">
    					<input type="text" size="15" name="minimal" onkeyup="javascript:this.value = this.value.replace(/,/g, \'.\'); " /> <sup>*</sup>
    					<p class="clear">'.$this->l('Leave blank or 0 if not applicable').'</p>
    				</div>
    				<div class="margin-form">
    					<p>
    						<input type="checkbox" name="cumulable" id="cumulable_on" value="1" />
    						<label class="t" for="cumulable_on"> '.$this->l('Cumulative with other vouchers').'</label>
    					</p>
    				</div>
    				<div class="margin-form">
    					<p>
    						<input type="checkbox" name="cumulable_reduction" id="cumulable_reduction_on" value="1" />
    						<label class="t" for="cumulable_reduction_on"> '.$this->l('Cumulative with price reductions').'</label>
    					</p>
    				</div>';
    				includeDatepicker(array('date_from', 'date_to'), true);
    				$this->_html .= '<label>'.$this->l('From:').' </label>
    				<div class="margin-form">
    					<input type="text" size="20" id="date_from" name="date_from" /> <sup>*</sup>
    					<p class="clear">'.$this->l('Start date/time from which voucher can be used').'<br />'.$this->l('Format: YYYY-MM-DD HH:MM:SS').'</p>
    				</div>
    				<label>'.$this->l('To:').' </label>
    				<div class="margin-form">
    					<input type="text" size="20" id="date_to" name="date_to" /> <sup>*</sup>
    					<p class="clear">'.$this->l('End date/time at which voucher is no longer valid').'<br />'.$this->l('Format: YYYY-MM-DD HH:MM:SS').'</p>
    				</div>
    				<label>'.$this->l('Status:').' </label>
    				<div class="margin-form">
    					<input type="radio" name="active" id="active_on" value="1"/>
    					<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
    					<input type="radio" name="active" id="active_off" />
    					<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
    					<p>'.$this->l('Enable or disable voucher').'</p>
    				</div>
    						
    			<br/><br/>
    				
    				<label>'.$this->l('File add &nbsp;').'&nbsp; </label>
    				<input type="file" name="fileCSV" />
    				<br/><br/>
    				<div class="margin-form clear">
    					<input class="button" type="submit" name="submitCsv" class="button" value="'.$this->l('Update').'">
    				</div>			
    			</fieldset>';
     
     
    ?>

  2. #2
    Rédacteur

    Avatar de Bovino
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2008
    Messages
    23 647
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2008
    Messages : 23 647
    Billets dans le blog
    20
    Par défaut
    Ta classe, elle est déclarée où ?
    Pas de question technique par MP !
    Tout le monde peut participer à developpez.com, vous avez une idée, contactez-moi !
    Mes formations video2brain : La formation complète sur JavaScriptJavaScript et le DOM par la pratiquePHP 5 et MySQL : les fondamentaux
    Mon livre sur jQuery
    Module Firefox / Chrome d'intégration de JSFiddle et CodePen sur le forum

  3. #3
    Invité
    Invité(e)
    Par défaut
    Pour ce fichier j'ai pas de classe

    Merci en avance

  4. #4
    Expert confirmé

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Par défaut
    fait un var_dump($ulTree)

  5. #5
    Rédacteur

    Avatar de Bovino
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2008
    Messages
    23 647
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2008
    Messages : 23 647
    Billets dans le blog
    20
    Par défaut
    $this s'applique à quoi selon toi ?
    Pas de question technique par MP !
    Tout le monde peut participer à developpez.com, vous avez une idée, contactez-moi !
    Mes formations video2brain : La formation complète sur JavaScriptJavaScript et le DOM par la pratiquePHP 5 et MySQL : les fondamentaux
    Mon livre sur jQuery
    Module Firefox / Chrome d'intégration de JSFiddle et CodePen sur le forum

  6. #6
    Invité
    Invité(e)
    Par défaut
    merci de vous réponse en fait j'ai fait s'afficher juste le
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    string '<table cellspacing="0" cellpadding="0" class="table" style="width: 29.5em;">
    								<tr>
    									<th>Choisir</th>
    									<th>ID</th>
    									<th>Catégories</th>
    								</tr></table>
    merci en avance

  7. #7
    Expert confirmé

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Par défaut
    a part recité on pas pas faire grand chose pour toi ...

    Citation Envoyé par Bovino Voir le message
    $this s'applique à quoi selon toi ?

Discussions similaires

  1. une fonction n'est pas appelée sous IE
    Par pierrot10 dans le forum jQuery
    Réponses: 2
    Dernier message: 04/10/2013, 13h11
  2. Réponses: 2
    Dernier message: 27/09/2013, 10h40
  3. Réponses: 6
    Dernier message: 17/12/2010, 19h05
  4. Réponses: 6
    Dernier message: 09/01/2007, 02h15
  5. A la recherche de l'appel d'une fonction...
    Par karl3i dans le forum C
    Réponses: 3
    Dernier message: 24/09/2003, 13h34

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