コード例 #1
0
 public static function update($id)
 {
     self::check_logged_in();
     $params = $_POST;
     $attributes = array('id' => $id, 'name' => $row['name'], 'laatija_id' => $row['laatija_id'], 'hero1' => $row['hero1'], 'hero2' => $row['hero2'], 'hero3' => $row['hero3'], 'hero4' => $row['hero4'], 'hero5' => $row['hero5'], 'vaikeus' => $row['vaikeus'], 'suunnitelma' => $row['suunnitelma']);
     $draft = new Draft($attributes);
     $errors = $draft->errors();
     if (count($errors) == 0) {
         $draft->update();
         Redirect::to('/drafts' . $draft->id, array('message' => 'Drafti on lisätty arkistoon!'));
     } else {
         View::make('drafts/new.html', array('errors' => $errors, 'attributes' => $attributes));
     }
 }