public function processForm(array $input = null, $validator = null, $csv_handler = null)
	{
		if($input)
		{
			$this->form_input = $input;
		}
		else
		{
			$this->fillFormInput();
		}

		$validator = ($validator) ? $validator : new ValidatorFormInputModel($this);
		$csv_handler = ($csv_handler) ? $csv_handler : new CsvFileHandler();

		if ( $validator->validateInput() && $this->checkColumns() )
		{
			// process form
			$csv_file = $csv_handler->getTemporary();
			if($csv_file)
			{
				try
				{
					$csv_handler->updateHeaders($csv_file, $this->form_input["columns"], $this->form_input["table_name"]);
				}
				catch(UnalignedArrayException $e)
				{
					$this->appendError("No_temporary", "Invalid Column names." );
					return $this->getIsExecuted();
				}

				try
				{
					$csv_handler->saveToDb($this->form_input['types']);
					$this->is_executed = true;
				}
				catch( HeadersNotSetException $e)
				{
					$this->appendError("Save_err", "Cannot save data: check if dmbs support transaction.");
				}
				catch( PDOException $e)
				{
					$this->appendError("Save_err", $e->getMessage() );
				}
				catch( Exception $e)
				{
					$this->appendError("Save_err", $e->getMessage() );
				}
			}
			else
			{
				$this->appendError("No_temporary","No data available to save");
			}
		}
		return $this->getIsExecuted();
	}
public function processForm(array $input = null, $validator = null, $csv_handler = null)
	{
		if($input)
		{
			$this->form_input = $input;
		}
		else
		{
			$this->fillFormInput();
		}

		$validator = ($validator) ? $validator : new ValidatorFormInputModel($this);
		$csv_handler = ($csv_handler) ? $csv_handler : new CsvFileHandler();

		if ( $validator->validateInput() && $this->checkColumns() )
		{
			// process form
			$csv_file = $csv_handler->getTemporary();
			if($csv_file)
			{
				try
				{
					$csv_handler->updateHeaders($csv_file, $this->form_input["columns"], $this->form_input["table_name"]);
				}
				catch(UnalignedArrayException $e)
				{
					$this->appendError("No_temporary", "Invalid Column names." );
					return $this->getIsExecuted();
				}

				try
				{
					$csv_handler->saveToDb($this->form_input['types']);
					$this->is_executed = true;
				}
				catch( HeadersNotSetException $e)
				{
					$this->appendError("Save_err", "Cannot save data: check if dmbs support transaction.");
				}
				catch( PDOException $e)
				{
					$this->appendError("Save_err", $e->getMessage() );
				}
				catch( Exception $e)
				{
					$this->appendError("Save_err", $e->getMessage() );
				}
			}
			else
			{
				$this->appendError("No_temporary","No data available to save");
			}
		}
		return $this->getIsExecuted();
	}
public function processForm ( array $ input = null , $ validator = null , $ csv_handler = null ) { if ( $ input ) { $ this -> form_input = $ input ; } else { $ this -> fillFormInput ( ) ; } $ validator = ( $ validator ) ? $ validator : new ValidatorFormInputModel ( $ this ) ; $ csv_handler = ( $ csv_handler ) ? $ csv_handler : new CsvFileHandler ( ) ; if ( $ validator -> validateInput ( ) && $ this -> checkColumns ( ) ) { // process form $ csv_file = $ csv_handler -> getTemporary ( ) ; if ( $ csv_file ) { try { $ csv_handler -> updateHeaders ( $ csv_file , $ this -> form_input [ "columns" ] , $ this -> form_input [ "table_name" ] ) ; } catch ( UnalignedArrayException $ e ) { $ this -> appendError ( "No_temporary" , "Invalid Column names." ) ; return $ this -> getIsExecuted ( ) ; } try { $ csv_handler -> saveToDb ( $ this -> form_input [ 'types' ] ) ; $ this -> is_executed = true ; } catch ( HeadersNotSetException $ e ) { $ this -> appendError ( "Save_err" , "Cannot save data: check if dmbs support transaction." ) ; } catch ( PDOException $ e ) { $ this -> appendError ( "Save_err" , $ e -> getMessage ( ) ) ; } catch ( Exception $ e ) { $ this -> appendError ( "Save_err" , $ e -> getMessage ( ) ) ; } } else { $ this -> appendError ( "No_temporary" , "No data available to save" ) ; } } return $ this -> getIsExecuted ( ) ; }
Process the form and return the next state
@return  Boolean $is_executed
Process the form and return the next state