/** * Call this function to retrieve the item/message viewer * @param JTable $stream the current StreamTable * @param int $item_id the owner of the item (for example: id of the file or id of a message contains a link) * @param String $type type of the item (since tracking is done by id, being specific is safer. eg: file_220, link_220) */ function whoMakesAction($stream, $item_id = 0, $type = NULL) { // get list of avatar who viewed the stream $whoMakesAction = $stream->whoMakesAction($item_id, $type); $avatarListWhoMakeAction = ''; if ($whoMakesAction && count($whoMakesAction) > 0) { // Do rename the variable if its too long or easily mistyped $avatarListWhoMakeAction .= '<div class="user-horizontal-list message-reader-list">'; if ($type == 'video') { // change language from READ to SEEN if its a video $avatarListWhoMakeAction .= '<span class="small">' . JText::_('COM_STREAM_LABEL_SEEN_BY') . ' '; } else { $avatarListWhoMakeAction .= '<span class="small">' . JText::_('COM_STREAM_LABEL_READ_BY') . ' '; } /* $avatarListWhoMakeAction .= count($whoMakesAction) . ' reader'; */ $avatarListWhoMakeAction .= '<a href="#showReaders" data-content="<ul>'; foreach ($whoMakesAction as $user_id) { // there will be 0 as user which in return will load current user if ($user_id != 0 && $user_id != NULL) { $user = JXFactory::getUser($user_id); $avatarListWhoMakeAction .= StreamTemplate::escape('<li><a href="' . $user->getURL() . '">' . $user->name . '</a></li>'); } } $avatarListWhoMakeAction .= '</ul>">'; $label = count($whoMakesAction) > 1 ? JText::_('COM_STREAM_LABEL_USERS') : JText::_('COM_STREAM_LABEL_USER'); $avatarListWhoMakeAction .= count($whoMakesAction) . " {$label}</a>"; $avatarListWhoMakeAction .= '</span></div>'; } return $avatarListWhoMakeAction; }