/** * attachments_mass_update * * @param void * @return null */ function attachments_mass_update() { if (!$this->active_object->canEdit($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN, null, true, $this->request->isApiCall()); } // if if ($this->request->isSubmitted()) { $action = $this->request->post('action'); if (!in_array($action, array('move_to_trash'))) { $this->httpError(HTTP_ERR_BAD_REQUEST, 'Invalid action'); } // if $objects = ProjectObjects::findByIds($this->request->post('objects')); $operations_performed = 0; foreach ($objects as $object) { if ($action == 'move_to_trash') { $operation = $object->moveToTrash(); } // if if ($operation && !is_error($operation)) { $operations_performed++; } // if } // foreach db_commit(); if ($action == 'move_to_trash') { $message = lang(':count objects moved to trash', array('count' => $operations_performed)); } // if flash_success($message, null, true); $this->redirectToUrl($this->active_object->getAttachmentsUrl()); } // if }