/** * Marks action items as completed * * @param string $type Item type * @param array $uids User IDs * @param string $component ITem component * @param unknown $element Parameter description (if any) ... * @return boolean True if no errors */ public function onTakeAction($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 $mids = Hubzero\Message\Action::getActionItems($type, $component, $element, $uid); // Check if the user has any action items if (count($mids) > 0) { foreach ($mids as $mid) { $xseen = Hubzero\Message\Seen::oneByMessageAndUser($mid, $uid); if ($xseen->get('whenseen') == '' || $xseen->get('whenseen') == $database->getNullDate() || $xseen->get('whenseen') == NULL) { $xseen->set('whenseen', Date::toSql()); $xseen->save(); } } } } } return true; }