Example #1
0
 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function deleteAction($id)
 {
     $class = MovieDistrictModel::inst()->getDistrictById($id);
     $this->db->update('{{movie_districts}}', array('district_status' => MovieDistrictModel::STAT_STATUS_DELETED), 'district_id=:district_id', array(':district_id' => $id));
     MovieDistrictModel::inst()->updateCache();
     //记录操作日志
     $message = '{user_name}删除了电影地区{district_name}';
     $data = array('district_name' => $class['district_name'], 'data' => array('district_id' => $id, 'data' => $class));
     UserLogsModel::add('Movie/District', $id, 'Delete', 'success', $message, $data);
     if (!isset($_GET['ajax'])) {
         $this->redirect('/movie/district/index');
     }
 }