コード例 #1
0
ファイル: emprunteur.class.php プロジェクト: bouchra012/PMB
 function do_fiche_compte($typ_compte)
 {
     global $msg, $charset;
     global $empr_comptes_tmpl;
     global $empr_autre_compte_tmpl;
     global $show_transactions, $date_debut;
     $this->fiche_compte = "";
     if ($typ_compte == 4) {
         $form = $empr_autre_compte_tmpl;
     } else {
         $form = $empr_comptes_tmpl;
     }
     $form = str_replace("!!nom!!", $this->nom, $form);
     $form = str_replace("!!prenom!!", $this->prenom, $form);
     $form = str_replace("!!info_nb_pret!!", $this->nb_pret, $form);
     $form = str_replace("!!info_nb_resa!!", $this->nb_reservations, $form);
     $id_compte = comptes::get_compte_id_from_empr($this->id, $typ_compte);
     if ($id_compte) {
         $cpte = new comptes($id_compte);
         if (!$show_transactions) {
             $show_transactions = 2;
         }
         $form = str_replace("!!id_compte!!", $id_compte, $form);
         $form = str_replace("!!type_compte!!", $cpte->get_typ_compte_lib($typ_compte), $form);
         $form = str_replace("!!typ_compte!!", $typ_compte, $form);
         $form = str_replace("!!solde!!", comptes::format($cpte->get_solde()), $form);
         $form = str_replace("!!non_valide!!", comptes::format($cpte->summarize_transactions("", "", 0, 0)), $form);
         $form = str_replace("!!show_transactions!!", $show_transactions, $form);
         $form = str_replace("!!date_debut!!", htmlentities(stripslashes($date_debut), ENT_QUOTES, $charset), $form);
         if (!$show_transactions) {
             $show_transactions = 1;
         }
         for ($i = 1; $i <= 3; $i++) {
             if ($i == $show_transactions) {
                 $form = str_replace("!!checked{$i}!!", "checked", $form);
             } else {
                 $form = str_replace("!!checked{$i}!!", "", $form);
             }
         }
     }
     if ($typ_compte == 4) {
         // autre compte: afficher les types de transaction...
         $transactype = new transactype_list();
         $type_transac_list = $transactype->get_data();
         foreach ($type_transac_list as $transac) {
             if ($transac["quick_allowed"] && $transac["unit_price"] > 0) {
                 $transac_form .= "\r\n\t\t\t\t\t<input type='button' class='bouton_small' value='" . htmlentities($transac["name"], ENT_QUOTES, $charset) . "'\n\t\t\t\t\t id='transactype_" . $transac["id"] . "' unit_price='" . $transac["unit_price"] . "' \n\t\t\t\t\t onclick=\"sel_type_transactype('" . $transac["id"] . "',this.id,this.value,this.getAttribute('unit_price'));\" align='middle'\r\n\t\t\t\t\t>";
             } elseif ($transac["quick_allowed"]) {
                 $transac_form .= "\r\n\t\t\t\t\t<input type='button' class='bouton_small' value='" . htmlentities($transac["name"], ENT_QUOTES, $charset) . "'\n\t\t\t\t\t id='" . $transac["id"] . "' unit_price='" . $transac["unit_price"] . "' \n\t\t\t\t\t onclick=\"sel_type_transactype('" . $transac["id"] . "',this.id,this.value,this.getAttribute('unit_price'));\" align='middle'\n\t\t\t\t\t>";
             }
         }
         $form = str_replace("!!transactype_list!!", $transac_form, $form);
     }
     $this->fiche_compte = $form;
 }