public function actionDeleteExLink() { if (isset($_POST['exLink_id'])) { $exLink = ExternalLink::model()->findByPk($_POST['exLink_id']); if ($exLink->delete()) { Util::returnJSON(array("success" => true)); } Util::returnJSON(array("success" => false, "message" => Yii::t("app", "Delete Error."))); } }
public function actionExLinkManagement() { 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"); } $exLinks = ExternalLink::model()->findAllByAttributes(array('dataset_id' => $dataset->id), array('order' => 'id asc')); $this->render('exLinkManagement', array('model' => $dataset, 'exLinks' => $exLinks)); } }