public function actionPublish() { $this->validateToken(); $this->validatePermission('smartslider_edit'); $ids = array_map('intval', array_filter((array) N2Request::getVar('slides'), 'is_numeric')); $this->validateVariable(count($ids), 'Slides'); $slidesModel = new N2SmartsliderSlidesModel(); foreach ($ids as $id) { if ($id > 0) { $slidesModel->publish($id); } } N2Message::success(n2_('Slide published.')); $this->response->respond(); }
public function actionPublish() { if ($this->validateToken() && $this->validatePermission('smartslider_edit')) { if ($slideId = N2Request::getInt('slideid')) { $slidesModel = new N2SmartsliderSlidesModel(); $slidesModel->publish($slideId); $this->redirect(N2Request::getUrlReferrer()); } $this->redirect(array("sliders/index")); } }