/**
  * @inheritDoc IElementAction::performAction()
  *
  * @param ElementCriteriaModel $criteria
  *
  * @return bool
  */
 public function performAction(ElementCriteriaModel $criteria)
 {
     $status = $this->getParams()->status;
     //False by default
     $enable = 0;
     switch ($status) {
         case SproutSeo_RedirectStatuses::ON:
             $enable = '1';
             break;
         case SproutSeo_RedirectStatuses::OFF:
             $enable = '0';
             break;
     }
     $elementIds = $criteria->ids();
     // Update their statuses
     craft()->db->createCommand()->update('elements', array('enabled' => $enable), array('in', 'id', $elementIds));
     if ($status == SproutSeo_RedirectStatuses::ON) {
         // Enable their locale as well
         craft()->db->createCommand()->update('elements_i18n', array('enabled' => $enable), array('and', array('in', 'elementId', $elementIds), 'locale = :locale'), array(':locale' => $criteria->locale));
     }
     // Clear their template caches
     craft()->templateCache->deleteCachesByElementId($elementIds);
     // Fire an 'onSetStatus' event
     $this->onSetStatus(new Event($this, array('criteria' => $criteria, 'elementIds' => $elementIds, 'status' => $status)));
     $this->setMessage(Craft::t('Statuses updated.'));
     return true;
 }
 /**
  * @param ElementCriteriaModel $criteria
  *
  * @return bool
  */
 public function performAction(ElementCriteriaModel $criteria)
 {
     $status = $this->getParams()->status;
     $archived = $enable = 0;
     switch ($status) {
         case SproutEmail_EntryModel::ENABLED:
             $enable = 1;
             break;
         case SproutEmail_EntryModel::DISABLED:
             $enable = 0;
             break;
         case SproutEmail_EntryModel::ARCHIVED:
             $archived = 1;
             break;
     }
     $elementIds = $criteria->ids();
     // Update their statuses
     craft()->db->createCommand()->update('elements', array('enabled' => $enable, 'archived' => $archived), array('in', 'id', $elementIds));
     if ($status == SproutEmail_EntryModel::ENABLED) {
         // Enable their locale as well
         craft()->db->createCommand()->update('elements_i18n', array('enabled' => $enable), array('and', array('in', 'elementId', $elementIds), 'locale = :locale'), array(':locale' => $criteria->locale));
     }
     // Clear their template caches
     craft()->templateCache->deleteCachesByElementId($elementIds);
     // Fire an 'onSetStatus' event
     $this->onSetStatus(new Event($this, array('criteria' => $criteria, 'elementIds' => $elementIds, 'status' => $status)));
     $this->setMessage(Craft::t('Statuses updated.'));
     return true;
 }
 /**
  * @inheritDoc IElementAction::performAction()
  *
  * @param ElementCriteriaModel $criteria
  *
  * @return bool
  */
 public function performAction(ElementCriteriaModel $criteria)
 {
     $elementIds = $criteria->ids();
     $response = false;
     // Call updateMethods service
     $response = sproutSeo()->redirects->updateMethods($elementIds, SproutSeo_RedirectMethods::Temporary);
     $message = sproutSeo()->redirects->getMethodUpdateResponse($response);
     $this->setMessage($message);
     return $response;
 }
 public function performAction(ElementCriteriaModel $criteria)
 {
     $status = $this->getParams()->status;
     // Figure out which element IDs we need to update
     $elementIds = $criteria->ids();
     // Update their statuses
     craft()->db->createCommand()->update('workflow_submissions', array('status' => $status), array('in', 'id', $elementIds));
     // Clear their template caches
     craft()->templateCache->deleteCachesByElementId($elementIds);
     // Fire an 'onSetStatus' event
     $this->onSetStatus(new Event($this, array('criteria' => $criteria, 'elementIds' => $elementIds, 'status' => $status)));
     $this->setMessage(Craft::t('Statuses updated.'));
     return true;
 }
 /**
  * @inheritDoc IElementAction::performAction()
  *
  * @param ElementCriteriaModel $criteria
  *
  * @return bool
  */
 public function performAction(ElementCriteriaModel $criteria)
 {
     $status = $this->getParams()->status;
     // Figure out which element IDs we need to update
     if ($status == BaseElementModel::ENABLED) {
         $sqlNewStatus = '1';
     } else {
         $sqlNewStatus = '0';
     }
     $elementIds = $criteria->ids();
     // Update their statuses
     craft()->db->createCommand()->update('elements', array('enabled' => $sqlNewStatus), array('in', 'id', $elementIds));
     if ($status == BaseElementModel::ENABLED) {
         // Enable their locale as well
         craft()->db->createCommand()->update('elements_i18n', array('enabled' => $sqlNewStatus), array('and', array('in', 'elementId', $elementIds), 'locale = :locale'), array(':locale' => $criteria->locale));
     }
     // Clear their template caches
     craft()->templateCache->deleteCachesByElementId($elementIds);
     // Fire an 'onSetStatus' event
     $this->onSetStatus(new Event($this, array('criteria' => $criteria, 'elementIds' => $elementIds, 'status' => $status)));
     $this->setMessage(Craft::t('Statuses updated.'));
     return true;
 }
 /**
  * Deletes caches that include elements that match a given criteria.
  *
  * @param ElementCriteriaModel $criteria The criteria that should be used to find elements whose caches should be
  *                                       deleted.
  *
  * @return bool
  */
 public function deleteCachesByCriteria(ElementCriteriaModel $criteria)
 {
     if ($this->_deletedAllCaches) {
         return false;
     }
     $criteria->limit = null;
     $elementIds = $criteria->ids();
     return $this->deleteCachesByElementId($elementIds);
 }
 /**
  * @inheritDoc IElementAction::performAction()
  *
  * @param ElementCriteriaModel $criteria
  *
  * @return bool
  */
 public function performAction(ElementCriteriaModel $criteria)
 {
     craft()->assets->deleteFiles($criteria->ids());
     $this->setMessage(Craft::t('Assets deleted.'));
     return true;
 }
 /**
  * @inheritDoc IElementAction::performAction()
  *
  * @param ElementCriteriaModel $criteria
  *
  * @return bool
  */
 public function performAction(ElementCriteriaModel $criteria)
 {
     craft()->elements->deleteElementById($criteria->ids());
     $this->setMessage($this->getParams()->successMessage);
     return true;
 }