addStep('dimensiuni', 'Dimensiunile pentru usa.'); $this->addStep('material', 'Materialul pentru usa.'); $this->addStep('culoare', 'Nuanta usii.'); $this->addStep('forma', 'Forma geamului in usa.'); $this->addStep('sticla', 'Modelul sticlei pentru geam.'); $this->addStep('feronerie', 'Feroneria pentru usa.'); $this->addStep('finalizare', 'Vizualizare usa.'); } function process_dimensiuni(&$form) { $inaltime = $this->coalesce($form['inaltime']); if (strlen($inaltime) == 0 || !is_numeric($inaltime) ) $this->addError('inaltime','Valoarea nu este valida'); else if ( $inaltime < 100 || $inaltime > 500 ) $this->addError('inaltime','Nu executam usi mai mari de 5 metri.'); else $this->setValue('inaltime', $inaltime); $latime = $this->coalesce($form['latime']); if (strlen($latime) == 0 || !is_numeric($latime) ) $this->addError('latime','Valoarea nu este valida'); else if ( $latime < 30 || $latime > 300 ) $this->addError('latime','Nu executam usi mai late de 3 metri.'); else $this->setValue('latime', $latime); $grosime = $this->coalesce($form['grosime']); if (strlen($grosime) == 0 || !is_numeric($grosime) ) $this->addError('grosime','Valoarea nu este valida'); else $this->setValue('grosime', $grosime); $prag = $this->coalesce($form['prag']); $this->setValue('prag', $prag); return !$this->isError(); } function prepare_material() { $this->material = array("Lemn masiv","Mdf"); } function process_material(&$form) { $material = $this->coalesce($form['material']); $this->prepare_material(); if ( in_array($material,array_keys($this->material)) ) $this->SetValue('material',$material); else $this->addError('material','Material inexistent'); return !$this->isError(); } function prepare_culoare() { $DIR_FOLII = "images/texturi usi/thumbnail/"; $mysql_row=query("SELECT * FROM modele_folii "); for($i = 0; $iculori[$i]['id'] = $mysql_row[$i]['id_folie']; $this->culori[$i]['nume'] = $mysql_row[$i]['nume']; $this->culori[$i]['picture'] = $DIR_FOLII. $mysql_row[$i]['picture']; } } function process_culoare(&$form) { $culoare = $this->coalesce($form['folie']); $this->prepare_culoare(); $gasit = false; foreach( $this->culori as $key => $value ) if ( $value['id'] == $culoare ) { $gasit = true; break; } if ($gasit) $this->SetValue('culoare',$culoare); else $this->addError('culoare','Nu ati ales nici o culoare.'); return !$this->isError(); } function prepare_forma() { $DIR_FORME = "images/forme usi/thumbnail/"; $mysql_row=query("SELECT * FROM modele_usi "); for($i = 0; $iforme[$i]['id'] = $mysql_row[$i]['id_usa']; $this->forme[$i]['nume'] = $mysql_row[$i]['cod']; $this->forme[$i]['picture'] = $DIR_FORME. $mysql_row[$i]['picture']; } } function process_forma(&$form) { $forma = $this->coalesce($form['forma']); $this->prepare_forma(); $gasit = false; foreach( $this->forme as $key => $value ) if ( $value['id'] == $forma ) { $gasit = true; break; } if ($gasit) $this->SetValue('forma',$forma); else $this->addError('forma','Nu ati ales nici o forma.'); return !$this->isError(); } function prepare_sticla() { $DIR_STICLA = "images/sticla/thumbnail/"; $mysql_row=query("SELECT * FROM sticla "); for($i = 0; $isticle[$i]['id'] = $mysql_row[$i]['sticla_id']; $this->sticle[$i]['nume'] = $mysql_row[$i]['nume']; $this->sticle[$i]['picture'] = $DIR_STICLA. $mysql_row[$i]['picture']; } } function process_sticla(&$form) { $sticla = $this->coalesce($form['sticla']); $this->prepare_sticla(); $gasit = false; foreach( $this->sticle as $key => $value ) if ( $value['id'] == $sticla ) { $gasit = true; break; } if ($gasit) $this->SetValue('sticla',$sticla); else $this->addError('sticla','Nu ati ales nici o sticla.'); return !$this->isError(); } function prepare_feronerie() { $DIR_FERONERIE = "images/feronerie/thumbnail/"; $mysql_row=query("SELECT * FROM feronerie WHERE tip = 'intregi'"); for($i = 0; $iferonerie_i[$i]['id'] = $mysql_row[$i]['fer_id']; $this->feronerie_i[$i]['nume'] = $mysql_row[$i]['nume']; $this->feronerie_i[$i]['picture'] = $DIR_FERONERIE. $mysql_row[$i]['picture']; } $mysql_row=query("SELECT * FROM feronerie WHERE tip = 'sus'"); for($i = 0; $iferonerie_s[$i]['id'] = $mysql_row[$i]['fer_id']; $this->feronerie_s[$i]['nume'] = $mysql_row[$i]['nume']; $this->feronerie_s[$i]['picture'] = $DIR_FERONERIE. $mysql_row[$i]['picture']; } } function process_feronerie(&$form) { $feroneria = $this->coalesce($form['feronerie']); $this->prepare_feronerie(); $gasit = false; foreach( $this->feronerie_i as $key => $value ) if ( $value['id'] == $feroneria ) { $gasit = true; break; } foreach( $this->feronerie_s as $key => $value ) if ( $value['id'] == $feroneria ) { $gasit = true; break; } if ($gasit) $this->SetValue('feronerie',$feroneria); else $this->addError('feronerie','Nu ati ales nici o feronerie.'); return !$this->isError(); } function process_finalizare(&$form) { $email = $this->coalesce($form['email']); if ( $this->isValidEmail( $email ) ) $this->SetValue('email',$email); else $this->addError('email','incorect!'); $nume = $this->coalesce($form['nume']); $this->SetValue('nume',$nume); $tel = $this->coalesce($form['tel']); $this->SetValue('tel',$tel); $nrbuc = $this->coalesce($form['nrbuc']); $this->SetValue('nrbuc',$nrbuc); return !$this->isError(); } function completeCallback() { require("attach_mailer_class.php"); include("usa.class.php"); $usa = new Usa("mea"); $usa->SetFromDb( array("mInaltime" => $this->getValue('inaltime'), "mLatime" => $this->getValue('latime'), "mGrosime" => $this->getValue('grosime'), "mCuloare" => $this->getValue('culoare'), "mForma" => $this->getValue('forma'), "mSticla" => $this->getValue('sticla'), "mFeronerie" => $this->getValue('feronerie') ) ); $body = "
Caracteristici usa
inaltime = ".$usa->mInaltime." cm
latime = ".$usa->mLatime." cm
grosime = ".$usa->mGrosime." cm
inaltime prag = ".$usa->mPrag." cm
material = ".$usa->mMaterial."
textura = ".$usa->mCuloareTxt."
cod decupaj = ".$usa->mFormaTxt."
sticla = ".$usa->mSticlaTxt."
feronerie = ".$usa->mFeronerieTxt."
numar bucati = ".$this->getValue('nrbuc')."
"; $bodyges = $this->getValue('nume')." (".$this->getValue('email')." ) tel:".$this->getValue('tel')." data: ".date("d M Y")."

".$body; $ges_mail = new attach_mailer($name = "COMANDA USA", $from = "gesproduction@gesproduction.ro", $to = "herman@gesproduction.ro", $cc = "", $bcc = "", $subject = "Comanda usa - ".$this->getValue('nume') , $bodyges); $ges_mail->create_attachment_part($usa->mFileName); $ges_mail->process_mail(); //cc emil.hatcu@gesproduction.ro $client_mail = new attach_mailer($name = "GES PRODUCTIONS", $from = "gesproduction@gesproduction.ro", $to = trim($this->getValue('email')), $cc = "", $bcc = "", $subject = "Inregistrare cerere pret usa", "Cererea dumneavoastra a fost inregistrata.
".$body); $client_mail->create_attachment_part($usa->mFileName); $client_mail->process_mail(); } function isValidEmail($email) { return preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$/i', $email); } function renderNav() { ?>