public function actionDeleteProject() { if (isset($_POST['dp_id'])) { $dp = DatasetProject::model()->findByPk($_POST['dp_id']); if ($dp->delete()) { Util::returnJSON(array("success" => true)); } Util::returnJSON(array("success" => false, "message" => Yii::t("app", "Delete Error."))); } }
public function actionProjectManagement() { if (!isset($_GET['id'])) { $this->redirect("/user/view_profile"); } else { $dataset = Dataset::model()->findByPk($_GET['id']); if (!$dataset) { $this->redirect("/user/view_profile"); } if ($dataset->submitter_id != Yii::app()->user->id) { Yii::app()->user->setFlash('keyword', "You are not the owner of dataset"); $this->redirect("/user/view_profile"); } $dps = DatasetProject::model()->findAllByAttributes(array('dataset_id' => $dataset->id), array('order' => 'id asc')); $this->render('projectManagement', array('model' => $dataset, 'dps' => $dps)); } }