Example #1
0
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide mtxtCentredCells');
// Set structure
$tablecolumns = array("user", "account", "message", "time");
$tableheaders = array(get_string('tableheaderuser', 'block_moodletxt'), get_string('tableheadertxttoolsaccount', 'block_moodletxt'), get_string('tableheadermessagetext', 'block_moodletxt'), get_string('tableheadertimesent', 'block_moodletxt'));
// ;)
if ($includeEvents == TxttoolsSentMessageDAO::$EVENT_QUERY_INCLUDE || $includeEvents == TxttoolsSentMessageDAO::$EVENT_QUERY_EXCLUSIVE) {
    array_push($tablecolumns, "generation");
    array_push($tableheaders, get_string('tableheadergeneration', 'block_moodletxt'));
}
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->sortable(true, 'time', SORT_DESC);
$table->no_sorting('message');
$table->collapsible(true);
$table->pageable(true);
$table->pagesize($MESSAGES_PER_PAGE, $sentMessagesDAO->countMessagesSent(0, $USER->id));
if ($download != '') {
    $table->is_downloading($download, get_string('exportsheetsent', 'block_moodletxt'), get_string('exporttitlesent', 'block_moodletxt'));
}
$table->is_downloadable(true);
$table->show_download_buttons_at(array(TABLE_P_BOTTOM));
$table->setup();
// BEGIN PAGE OUTPUT
if (!$table->is_downloading()) {
    // Drop in page header
    echo $output->header();
    echo $output->box($sentMessagesDAO->countMessagesSent() . get_string('sentnoticefrag1', 'block_moodletxt') . $sentMessagesDAO->countMessageRecipients() . get_string('sentnoticefrag2', 'block_moodletxt') . html_writer::empty_tag('br') . $sentMessagesDAO->countMessagesSent(0, $userToView) . get_string('sentnoticefrag3', 'block_moodletxt'));
    // Show select box allow user to show/hide event-generated messages
    $eventSelect = new single_select(new moodle_url('sent.php', array('course' => $courseId, 'instance' => $instanceId, 'user' => $userToView)), 'events', array(TxttoolsSentMessageDAO::$EVENT_QUERY_DISCARD => get_string('optioneventhide', 'block_moodletxt'), TxttoolsSentMessageDAO::$EVENT_QUERY_INCLUDE => get_string('optioneventshow', 'block_moodletxt'), TxttoolsSentMessageDAO::$EVENT_QUERY_EXCLUSIVE => get_string('optioneventonly', 'block_moodletxt')), $includeEvents, false);
    $eventSelect->set_label(get_string('labelshowmessagebygenerator', 'block_moodletxt'));
    echo $output->render($eventSelect);
Example #2
0
$outboundImage = new moodletxt_icon(moodletxt_icon::$ICON_ALLOW_OUTBOUND, get_string('altaccessoutbound', 'block_moodletxt'), array('class' => 'mdltxtClickableIcon'));
$inboundImage = new moodletxt_icon(moodletxt_icon::$ICON_ALLOW_INBOUND, get_string('altaccessinbound', 'block_moodletxt'), array('class' => 'mdltxtClickableIcon'));
echo $output->header();
// Page intro
echo $output->box($output->heading(get_string('adminheaderaccountslist', 'block_moodletxt')) . html_writer::tag('p', get_string('adminaccountintropara1', 'block_moodletxt')) . html_writer::tag('p', get_string('adminaccountintropara2', 'block_moodletxt')) . html_writer::tag('p', html_writer::tag('a', get_string('linkaddaccount', 'block_moodletxt'), array('href' => $CFG->wwwroot . '/blocks/moodletxt/settings_accounts_new.php'))));
// Update button and progress bar
echo html_writer::tag('button', get_string('adminaccountbutupdateall', 'block_moodletxt'), array('id' => 'mdltxtUpdateAllAccounts'));
echo $output->render(new moodletxt_ui_progress_bar('accountProgressBar', 'accountProgressTextValue'));
// Populate table
foreach ($accountList as $account) {
    if ($account->getLastUpdate() > 0) {
        $lastUpdate = userdate($account->getLastUpdate(), "%H:%M:%S,  %d %B %Y");
    } else {
        $lastUpdate = get_string('adminaccountfragneverupdated', 'block_moodletxt');
    }
    $outboundEnabled = $account->isOutboundEnabled() ? $outboundImage : $deniedImage;
    $inboundEnabled = $account->isInboundEnabled() ? $inboundImage : $deniedImage;
    $creditsRemaining = $account->getBillingType() == TxttoolsAccount::$BILLING_TYPE_INVOICED ? "∞" : $account->getCreditsRemaining();
    $accountTypeString = $account->getBillingType() == TxttoolsAccount::$BILLING_TYPE_PREPAID ? get_string('billingtypeprepaid', 'block_moodletxt') : get_string('billingtypeinvoiced', 'block_moodletxt');
    $table->add_data(array($output->render($editImage) . $account->getUsername(), $account->getDescription(), $account->getUrl() . ' - ' . $account->getLocation(), $sentMessageDAO->countMessagesSent($account->getId()), $output->render($accessImage), $output->render($outboundEnabled), $output->render($inboundEnabled), $account->getCreditsUsed(), $creditsRemaining, $accountTypeString, $lastUpdate));
}
$table->finish_output();
// Dialog box used for account editing form
$editForm = new TxttoolsAccountEditForm();
$editDialog = new moodletxt_ui_dialog('accountEditDialog', $editForm->toHtml(), get_string('titleaccountedit', 'block_moodletxt'), '', array('style' => 'display:none;'));
// Dialog box used for outbound access restrictions
$restrictionsForm = new TxttoolsAccountRestrictionsForm();
$dialog = new moodletxt_ui_dialog('mdltxtAccountRestrictionsDialog', $restrictionsForm->toHtml(), get_string('titleaccountrestrictions', 'block_moodletxt'), '', array('style' => 'display:none;'));
echo $output->render($editDialog);
echo $output->render($dialog);
echo $output->footer();