public function publish($param) { $department_id = $param['department_id']; $departmentAvailable = $this->tools->departmentAvailable($department_id); $article = WebArticlePeer::retrieveByPK($param['id']); if (!$article) { $this->jsonwrapper->show_json_error('article', 'Article tidak ditemukan'); } if (!in_array($article->getDepartmentId(), $departmentAvailable)) { $this->jsonwrapper->show_json_error('forbidden', 'Maaf, anda tidak dapat menghapus article ini.'); } if ($article->getPublished() == 1) { $article->setPublished(0); } else { $article->setPublished(1); } $article->save(); $output = array('success' => 1, 'message' => 'Success', 'data' => $article->toArray()); $this->jsonwrapper->print_json($output); }