Esempio n. 1
0
 public static function update($id)
 {
     if (self::get_user_admin() == null) {
         Redirect::to('/home');
     }
     $params = $_POST;
     $institution = new Institution(array('id' => $id, 'name' => $params['name'], 'picture' => $params['picture']));
     $errors = $institution->errors();
     if (count($errors) == 0) {
         $institution->update();
         Redirect::to('/institutions', array('message' => 'Changes saved!'));
     } else {
         View::make('admin/edit_institution.html', array('errors' => $errors, 'institution' => $institution));
     }
 }