<tr> <th>Teacher</th> <th>Grade</th> <th>Num of Lesson</th> <th>Fee</th> <th>Paid or not</th> <th></th> </tr> </thead> <tbody> <?php foreach ($teachers as $teacher) { ?> <?php if ($teacher->fee == null) { $teacher->fee = Model_Fee::forge(); $teacher->fee->user_id = $teacher->id; $teacher->fee->year = $year; $teacher->fee->month = $month; $teacher->fee->save(); } ?> <tr> <td><?php echo $teacher->firstname; ?> <?php echo $teacher->middlename; ?> <?php echo $teacher->lastname;
public function post_changefee() { $code = 0; $message = "ok"; if ($this->auth_status) { $fee = Model_Fee::find("first", ["where" => [["id", Input::post("id")]]]); if ($fee != null) { $fee->is_paid = Input::post("is_paid", 0); $fee->fulltime = (int) Input::post("fulltime", 0); $fee->grade = Input::post("grade", 0); $fee->save(); } else { $code = 404; $message = "Fee not found."; } } else { $code = 500; $message = "Auth error."; } $this->response(array('code' => $code, 'message' => $message)); }