Revision #4 has been created by StErMi on Apr 30, 2009, 8:17:21 AM with the memo:
Added save(false) and CUploadedFile::getIstance()
« previous (#3) next (#5) »
Changes
Title
unchanged
How to create/save more Model inputs and make them repeatable with jQuery
Category
unchanged
Tutorials
Yii version
unchanged
Tags
unchanged
Content
changed
[...]
// This is the crappy part of the script that I need to improve and make it more elegance
// I've to add to the photoEvent array a new PhotoEvent for every istance in $_POST['PhotoEvent']
foreach ( $_POST['PhotoEvent'] as $i => $photo ) {
$photosEvent[$i] = new PhotoEvent;
if ( isset( $_POST['PhotoEvent'][$i] ) )
$photosEvent[$i]->attributes = $_POST['PphotoUrl = CUploadedFile::getIstance($photo
sEvent
'][$i]
; , "photoUrl[$i]" );
$valid = $valid && $photosEvent[$i]->validate();
}
if( $valid && $event->save(
false) ) {
Yii::import('application.extensions.image.Image');
// Saving each period ( i've to change the date format couse in Italy we use dd/mm/yyyy[...]
$image->save();
*/
$photo->save(false);
}
$this->redirect(array('show','id'=>$lastminute->id));[...]