/** * Marks action items as completed * * @param string $type Item type * @param array $uids User IDs * @param string $component Item component * @param string $element Element * @return boolean True if no errors */ public function takeAction($type, $uids = array(), $component = '', $element = null) { // Do we have the proper bits? if (!$element || !$component || !$type) { return false; } // Do we have any user IDs? if (count($uids) > 0) { $database = \App::get('db'); // Loop through each ID foreach ($uids as $uid) { // Find any actions the user needs to take for this $component and $element $action = new Action($database); $mids = $action->getActionItems($component, $element, $uid, $type); // Check if the user has any action items if (count($mids) > 0) { $recipient = new Recipient($database); if (!$recipient->setState(1, $mids)) { $this->setError(Lang::txt('Unable to update recipient records %s for user %s', implode(',', $mids), $uid)); } } } } return true; }