Esempio n. 1
0
 * Check to see if inbound messages should be fetched at this point.
 * This should only be used on-demand, or if the user cannot
 * set up XML Push
 */
$fetchErrors = array();
if ($update == 1 || get_config('moodletxt', 'Get_Inbound_On_View') == '1') {
    try {
        $connector = MoodletxtOutboundControllerFactory::getOutboundController(MoodletxtOutboundControllerFactory::$CONTROLLER_TYPE_XML);
        $inboundAccounts = $txttoolsAccountDAO->getAllTxttoolsAccounts(false, false, false, true);
        $inboundMessages = $connector->getInboundMessages($inboundAccounts);
        if (count($inboundMessages) > 0) {
            $inboundMessages = $inboundFilterManager->filterMessages($inboundMessages);
            $receivedMessagesDAO->saveInboundMessages($inboundMessages);
        }
    } catch (MoodletxtRemoteProcessingException $ex) {
        $fetchErrors[$ex->getCode()] = MoodletxtStringHelper::getLanguageStringForRemoteProcessingException($ex);
    }
}
/*
 * Set up page
 */
$PAGE->set_url('/blocks/moodletxt/received.php');
$PAGE->set_title(get_string('titlereceivedmessages', 'block_moodletxt') . ' ' . $USER->lastname . ', ' . $USER->firstname);
$PAGE->set_heading(get_string('headerreceivedmessages', 'block_moodletxt'));
$PAGE->set_pagelayout('incourse');
$PAGE->set_button('');
// Clear editing button
$PAGE->navbar->add(get_string('navmoodletxt', 'block_moodletxt'), null, navigation_node::TYPE_CUSTOM, 'moodletxt');
$PAGE->navbar->add(get_string('navreceivedmessages', 'block_moodletxt'), null, navigation_node::TYPE_CUSTOM, 'moodletxt');
$PAGE->requires->strings_for_js(array('alertconfirmdeletemessages', 'alertnomessagesselected', 'fragloading'), 'block_moodletxt');
// JS/CSS includes and language requirements