} $errorText .= html_writer::tag('ul', $errorSet); } else { $errorText = get_string('errorconndefault', 'block_moodletxt'); } echo $errorText; } // Populate table foreach ($messageObject->getSentSMSMessages() as $message) { $recipient = $message->getRecipientObject(); // Save on making this call // Create contact name string for display if ($recipient instanceof MoodletxtBiteSizedUser && !$table->is_downloading()) { $displayName = $recipient->getFullNameForDisplay(true); } else { $displayName = $recipient->getFullNameForDisplay(); } $latestStatus = array_pop($message->getStatusUpdates()); if ($table->is_downloading()) { $statusCell = $latestStatus->getStatus() . ' - ' . MoodletxtStringHelper::getLanguageStringForStatusCode($latestStatus->getStatus()); } else { $statusCell = $output->render(MoodletxtStatusIconFactory::generateStatusIconForCode($latestStatus->getStatus())); } // Add data set to the table $table->add_data(array($displayName, $recipient->getRecipientNumber()->getPhoneNumber(), userdate($latestStatus->getUpdateTime(), "%H:%M:%S, %d %B %Y"), $statusCell)); } // Finally, output everything! $table->finish_output(); if (!$table->is_downloading()) { echo $output->footer(); }