12-13-2014, 05:54 AM
(This post was last modified: 12-13-2014, 05:55 AM by juninhodeluca.)
Hello guys,
I have an webapp which the user insert a specific sheet. Those sheets are predefined by the admin. So... some sheets have 15 lines, other ones have 50.
On submit, the user can to choose to SAVE or to SEND or to EXPORT or to PRINT the sheet.
But, if the user choice be SEND or EXPORT or PRINT, the sheet need to save itself first.
I am using something like that:
Of course I have a redundance in validating and saving the data into DB.
I tried to do something like that
and also tried changing save to a static method
None work.
Some suggestion?
I have an webapp which the user insert a specific sheet. Those sheets are predefined by the admin. So... some sheets have 15 lines, other ones have 50.
On submit, the user can to choose to SAVE or to SEND or to EXPORT or to PRINT the sheet.
But, if the user choice be SEND or EXPORT or PRINT, the sheet need to save itself first.
I am using something like that:
PHP Code:
Class Sheet {
public function save() {
// form validation run here
// save in DB
}
public function send() {
// form validation run here
// save in DB
// write the output file
}
}
Of course I have a redundance in validating and saving the data into DB.
I tried to do something like that
PHP Code:
public function send() {
$this->save();
//code to write
}
and also tried changing save to a static method
PHP Code:
public function send() {
self::save()
// code to write
}
None work.
Some suggestion?