codeigniter : formulaires

kkkkkkkkkkkkkkkkkkkkkkkkkk

Cette page a été vue 659 fois. Date de mise à jour : 05/11/2015 18:51:32.

Formulaire de saisie bancaire


	public function display_operation_form($mode, $record, $error) {
		// récupération de l'identifiant
		if ($mode == 'creation') {
			$ccid = 'not_set';
		} else {
			$ccid = $this->uri->segment(3);
		}
		// acquisition de la liste des types
		$types   = $this->modele->get_types();
		// acquisition de la liste des comptes
		$comptes = $this->modele->get_comptes();
		// attributs pour les labels
		$label_attributes = array('class' => 'styled');
		// début du formulaire('url', $attributes, $hidden) avec champ caché pour ccid
		echo "\t\t\t" . form_open('bank/operation_write/', array('class' => 'formContainer', 'id' => 'bank_cc_form'), array('mode' => $mode, 'ccid' => $ccid) ) . "\r\n" ;
		echo "\t\t\t" . form_fieldset('Saisie d\'une opération sur le compte courant') . "\r\n" ;
		// affectation des valeurs de champs spécifiques
		if($ccid == 'not_set'){
			// cas d'une création
			$ccid       = set_value('ccid', 100001);
			$date_ope   = set_value('date_ope');		// 1443693600 = 2015-10-01 12:00:00
			$kind_id    = set_value('kind_id', 100);
			$account_id = set_value('account_id', 1003);
			$chq_num    = set_value('chq_num');
			$wording    = set_value('wording');
			$debit      = set_value('debit');
			$credit     = set_value('credit');
			$status     = set_value('status', 'new');
		} else {
			// cas d'une modification
			$date_ope   = $record['date_ope'];		// 1443693600 = 2015-10-01 12:00:00
			$kind_id    = $record['kind_id'];
			$account_id = $record['account_id'];
			$chq_num    = $record['chq_num'];
			$wording    = $record['wording'];
			$debit      = $record['debit'];
			$credit     = $record['credit'];
			$status     = $record['status'];
		}
		// champ date pour la date d'opération
		echo "\t\t\t\t<div class=\"fieldContainer\">\r\n" ;
		echo "\t\t\t\t\t" . form_label('date', 'date_ope', $label_attributes) . "\r\n" ;
		echo "\t\t\t\t\t<div class=\"thefield\">\r\n" ;
		echo "\t\t\t\t\t\t" . form_input(array(
			'name' => 'date_ope',
			'id' => 'date_ope',
			'type' => 'date',
			'value' => $date_ope,
			'size' => '32',
		)) . "\r\n" ;
		echo "\t\t\t\t\t</div>\r\n" ;
		echo "\t\t\t\t</div>\r\n" ;
		// champ select pour type (select)
		echo "\t\t\t\t<div class=\"fieldContainer\">\r\n" ;
		echo "\t\t\t\t\t" . form_label('type', 'kid', $label_attributes) . "\r\n" ;
		echo "\t\t\t\t\t<div class=\"thefield\">\r\n" ;
		echo "\t\t\t\t\t\t" . form_dropdown('kid', $types, $kid) . "\r\n" ;
		echo "\t\t\t\t\t</div>\r\n" ;
		echo "\t\t\t\t\t</div>\r\n" ;
		// champ numéro de chèque (text)
		echo "\t\t\t\t<div class=\"fieldContainer\">\r\n" ;
		echo "\t\t\t\t\t" . form_label('numéro de chèque', 'chq_num', $label_attributes) . "\r\n" ;
		echo "\t\t\t\t\t<div class=\"thefield\">\r\n" ;
		echo "\t\t\t\t\t\t" . form_input(array(
			'name' => 'chq_num',
			'id' => 'chq_num',
			'value' => $chq_num,
			'size' => '16',
		)) . "\r\n" ;
		echo "\t\t\t\t\t</div>\r\n" ;
		echo "\t\t\t\t</div>\r\n" ;
		// champ select pour compte (select)
		echo "\t\t\t\t<div class=\"fieldContainer\">\r\n" ;
		echo "\t\t\t\t\t" . form_label('compte', 'aid', $label_attributes) . "\r\n" ;
		echo "\t\t\t\t\t<div class=\"thefield\">\r\n" ;
		echo "\t\t\t\t\t\t" . form_dropdown('aid', $comptes, $aid) . "\r\n" ;
		echo "\t\t\t\t\t</div>\r\n" ;
		echo "\t\t\t\t\t</div>\r\n" ;
		// champ Libellé écriture (text)
		echo "\t\t\t\t<div class=\"fieldContainer\">\r\n" ;
		echo "\t\t\t\t\t" . form_label('Libellé écriture', 'wording', $label_attributes) . "\r\n" ;
		echo "\t\t\t\t\t<div class=\"thefield\">\r\n" ;
		echo "\t\t\t\t\t\t" . form_input(array(
			'name' => 'wording',
			'id' => 'wording',
			'value' => $wording,
			'size' => '64',
			'maxlength' => '64',
		)) . "\r\n" ;
		echo "\t\t\t\t\t\t" . form_error('wording') . "\r\n" ;
		echo "\t\t\t\t\t</div>\r\n" ;
		echo "\t\t\t\t</div>\r\n" ;

		// champ débit (text)
		echo "\t\t\t\t<div class=\"fieldContainer\">\r\n" ;
				echo "\t\t\t\t\t" . form_label('débit', 'debit', $label_attributes) . "\r\n" ;
				echo "\t\t\t\t\t<div class=\"thefield\">\r\n" ;
				echo "\t\t\t\t\t\t" . form_input(array(
					'name' => 'debit',
					'id' => 'debit',
					'value' => $debit,
				)) . "\r\n" ;
				echo "\t\t\t\t\t</div>\r\n" ;
				echo "\t\t\t\t</div>\r\n" ;
		// champ crédit (text)
		echo "\t\t\t\t<div class=\"fieldContainer\">\r\n" ;
				echo "\t\t\t\t\t" . form_label('crédit', 'credit', $label_attributes) . "\r\n" ;
				echo "\t\t\t\t\t<div class=\"thefield\">\r\n" ;
				echo "\t\t\t\t\t\t" . form_input(array(
					'name' => 'credit',
					'id' => 'credit',
					'value' => $credit,
				)) . "\r\n" ;
				echo "\t\t\t\t\t</div>\r\n" ;
				echo "\t\t\t\t</div>\r\n" ;
		// fin du fieldset | champ de validation | fin du formulaire
		echo "\t\t\t</fieldset>\r\n";
		echo "\t\t\t<div class=\"buttonsdiv\">\r\n";
		echo "\t\t\t\t<input type=\"submit\" value=\"valider la saisie\" />\r\n" ;
		echo "\t\t\t</div>\r\n";
		echo "\t\t\t</form><!--  #Formulaire de saisie -->\r\n";
	}