load->library('email'); $message = ''; $message .= ''; $message .= ''; foreach($data as $key=> $value) { if(in_array($key,array('hash','id_user','form','draft','year','month','day','banner'))) continue; // bypasso if($key=='informativa' && $value==1) $value='accettato'; $message .= ''; $message .= ''; $message .= ''; $message .= ''; } $to = 'info@avipitalia.it'; // In case any of our lines are larger than 70 characters, we should use wordwrap() // $message = wordwrap($message, 70, "\r\n"); $config['charset'] = 'iso-8859-1'; $config['wordwrap'] = TRUE; $config['mailtype'] = 'html'; self::$ci->email->initialize($config); self::$ci->email->from('noreply@avipitalia.it', 'AVIP ITALIA'); // self::$ci->email->to('virgolamobile@gmail.com'); self::$ci->email->to('info@avipitalia.it'); self::$ci->email->subject('Invio candidatura dal sito'); self::$ci->email->message($message); if(isset($GLOBALS['uda'])) { self::$ci->email->attach(FCPATH . 'uploads/' . $GLOBALS['uda']); // echo FCPATH . 'uploads/' . $GLOBALS['uda']; unset($GLOBALS['uda']); } self::$ci->email->send(); // $headers = 'MIME-Version: 1.0' . "\r\n"; // $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; // $headers .= 'To: INFO ' . "\r\n"; // $headers .= 'To: INFO ' . "\r\n"; // $headers .= 'From: AVIP ITALIA ' . "\r\n"; // Send // $sent = false; // if(isset($data['nome'])) { // $sent = mail($to, $title, $message, $headers); // } } /** * Processes the form POST data. * * @param FTL_Binding 'init' tag (not the user one because this method is run before any tag parsing) * This tag is supposed to be only used to send Emails. * With this tag, Emails views have access to the global tags, but not to any other * object tag. * * @return void * */ public static function process_data(FTL_Binding $tag) { // Name of the form : Must be send to identify the form. $form_name = self::$ci->input->post('form'); // Because Form are processed before any tag rendering, we have to run the validation if (TagManager_Form::validate($form_name)) { $post = self::$ci->input->post(); //This will move the uploaded file to root/uploads/ of your domain //This generates a double path, so I don't recommend it $c['upload_path'] = FCPATH.'/uploads/'; $c['upload_path'] = FCPATH.'/uploads/'; $c['allowed_types'] = 'doc|docx|pdf'; self::$ci->load->library('upload', $c); // self::$ci->upload->do_upload(); // // $post_data = self::$ci->upload->data(); // salvo self::$ci->load->model('Ajaxform_module_model', 'ajaxform_module_model', TRUE); $data = self::$ci->input->post(); $data['id_user'] = self::$ci->ajaxform_module_model->add_user(); $id = self::$ci->ajaxform_module_model->save($data); if(((int) $data['id_user'])>0) { // qui so che รจ ho salvato } self::_send_mail("Candidatura dal sito",$data); // // ... Here you do what you want with the data ... // // For the example, we will send one email to the address the user gave in the form // // Send the posted data to the Email library and send the Email // as defined in /themes/your_theme/config/forms.php // TagManager_Email::send_form_emails($tag, $form_name, $posted); $message = TagManager_Form::get_form_message('success'); TagManager_Form::set_additional_success($form_name, $message); $redirect = TagManager_Form::get_form_redirect(); if ($redirect !== FALSE) redirect($redirect); // Posted data // To see the posted array, uncomment trace($posted) // If you prefer to see these data through one log file, // uncomment log_message(...) and be sure /application/config/config.php contains : // $config['log_threshold'] = 1; // The log files are located in : /application/logs/log-YYYY-MM-DD.php // We prefer to log our 'dev' data as 'error' to not see the all CodeIgniter 'debug' messages. $post = self::$ci->input->post(); // trace($posted); // log_message('error', print_r($posted, TRUE)); // SFS : Fires the event declared in Stop Form Spam module config // Do we go further in the form processing ? Yes by default. $go_further = TRUE; $results = Event::fire('Form.career.check', $post); if (is_array($results)) { foreach($results as $result) if ( ! $result) $go_further = FALSE; } if ($go_further) { // Send the posted data to the Email library and send the Email // as defined in /themes/your_theme/config/forms.php // TagManager_Email::send_form_emails($tag, $form_name, $post); // Add one custom Success message // Get the messages key defined in : /themes/your_theme/config/forms.php // You can also set directly one lang translated key $message = TagManager_Form::get_form_message('success'); TagManager_Form::set_additional_success($form_name, $message); // Alternative : Set the message by using directly one lang translated key : // TagManager_Form::set_additional_success($form_name, lang('form_message_success')); } // Use of the 'redirect' option of the form config. // If no redirect after processing, the form data can be send again if the user refreshes the page // To avoid that, we use the redirection directive as set in the config file: // /themes/your_theme/config/forms.php $redirect = TagManager_Form::get_form_redirect(); if ($redirect !== FALSE) redirect($redirect); } // Normally, nothing should be done here, because the validation process refill the form // and doesn't redirect, so the user's filled in data can be used to fill the form again. // Remember : If you redirect here, the form refill will not be done, as the data are lost // (no access to the posted data anymore after redirection) else { } } }




MODULO INVIATO DAL SITO AVIPITALIA.IT
' . $key . '' . $value . '