/** * Execute specified mass action on specified records */ public function run() { if (Yii::app()->user->isGuest) { Yii::app()->controller->redirect(Yii::app()->controller->createUrl('/site/login')); } if (Yii::app()->request->getRequestType() === 'GET') { $_POST = $_GET; } if (isset($_POST['passConfirm']) && $_POST['passConfirm']) { MassAction::superMassActionPasswordConfirmation(); return; } if (!isset($_POST['massAction']) || (!isset($_POST['superCheckAll']) || !$_POST['superCheckAll']) && (!isset($_POST['gvSelection']) || !is_array($_POST['gvSelection']))) { /**/ AuxLib::debugLogR('run error'); throw new CHttpException(400, Yii::t('app', 'Bad Request')); } $massAction = $_POST['massAction']; $massActionInstance = $this->getInstanceFor($massAction); if (isset($_POST['superCheckAll']) && $_POST['superCheckAll']) { $uid = $_POST['uid']; $idChecksum = $_POST['idChecksum']; $totalItemCount = intval($_POST['totalItemCount']); $massActionInstance->superExecute($uid, $totalItemCount, $idChecksum); } else { $gvSelection = $_POST['gvSelection']; $massActionInstance->beforeExecute(); $massActionInstance->execute($gvSelection); $massActionInstance::echoFlashes(); } }
public function beforeExecute() { if ($this->getFormModel() && !$this->getFormModel()->validate()) { $that = $this; self::$responseForm = X2Widget::ajaxRender(function () use($that) { $that->renderForm(false); }, true); return false; } return true; }
/** * Display mass actions ui buttons in top bar and set up related JS */ public function renderMassActionButtons() { $auth = Yii::app()->authManager; $actionAccess = ucfirst(Yii::app()->controller->getId()) . 'Delete'; $authItem = $auth->getAuthItem($actionAccess); if (!Yii::app()->params->isAdmin && !is_null($authItem) && !Yii::app()->user->checkAccess($actionAccess)) { if (in_array('MassDelete', $this->massActions)) { $massActions = $this->massActions; unset($massActions[array_search('MassDelete', $this->massActions)]); // reindex so it's still a valid JSON array $massActions = array_values($massActions); $this->massActions = $massActions; } } if ($this->enableSelectAllOnAllPages && $this->calculateChecksum) { $idChecksum = $this->dataProvider->getIdChecksum(); } else { $idChecksum = null; } $massActionObjs = MassAction::getMassActionObjects($this->massActions, $this); $this->controller->renderPartial('application.components.views._x2GridViewMassActionButtons', array('UIType' => 'buttons', 'massActions' => $this->massActions, 'massActionObjs' => $massActionObjs, 'gridId' => $this->id, 'namespacePrefix' => $this->namespacePrefix, 'modelName' => isset($this->modelName) ? $this->modelName : null, 'gridObj' => $this, 'fixedHeader' => $this->fixedHeader, 'idChecksum' => $this->enableSelectAllOnAllPages ? $idChecksum : null)); }
/** * Default DeleteMassAction constructor * * @param boolean $confirm Show confirm message if true */ public function __construct($confirm = false) { parent::__construct('Delete', 'static::deleteAction', $confirm); }
public function getPackages() { return array_merge(parent::getPackages(), array('X2MassUncomplete' => array('baseUrl' => Yii::app()->request->baseUrl, 'js' => array('js/X2GridView/MassUncompleteAction.js'), 'depends' => array('X2MassAction')))); }
public function getPackages() { return array_merge(parent::getPackages(), array('X2MassMoveFileSysObjToFolder' => array('baseUrl' => Yii::app()->request->baseUrl, 'js' => array('js/X2GridView/MassMoveFileSysObjToFolder.js'), 'depends' => array('X2MassAction')))); }
/** * Add list id to response data so that subsequent client requests can be for add to list * mass action */ protected function generateSuperMassActionResponse($successes, $selectedRecords, $uid) { $response = parent::generateSuperMassActionResponse($successes, $selectedRecords, $uid); $response['listId'] = $this->listId; return $response; }