コード例 #1
0
$addressbookNav = new moodle_url('/blocks/moodletxt/addressbooks.php', array('course' => $courseId, 'instance' => $instanceId));
$addressbookEditNav = new moodle_url('/blocks/moodletxt/addressbook_view.php', array('course' => $courseId, 'instance' => $instanceId, 'addressbook' => $addressbook->getId()));
$PAGE->navbar->add(get_string('navmoodletxt', 'block_moodletxt'), null, navigation_node::TYPE_CUSTOM, 'moodletxt');
$PAGE->navbar->add(get_string('navaddressbooks', 'block_moodletxt'), $addressbookNav, navigation_node::TYPE_CUSTOM, 'moodletxt');
$PAGE->navbar->add($addressbook->getName(), $addressbookEditNav, navigation_node::TYPE_CUSTOM, 'moodletxt');
$PAGE->navbar->add(get_string('navcontactadd', 'block_moodletxt'), null, navigation_node::TYPE_CUSTOM, 'moodletxt');
$PAGE->requires->jquery();
$PAGE->requires->js('/blocks/moodletxt/js/lib.js', true);
$PAGE->requires->js('/blocks/moodletxt/js/lib/qfamsHandler.js', true);
$PAGE->requires->js('/blocks/moodletxt/js/addressbook_groups.js', true);
// SETUP FORMS WITH INITIAL DATA
$output = $PAGE->get_renderer('block_moodletxt');
$initialFormData = array('course' => $courseId, 'instance' => $instanceId, 'addressbook' => $addressbook->getId());
$customFormData = array('existingGroups' => array(), 'potentialContacts' => array());
$groupList = $addressbookDAO->getAddressbookGroupsForUser($USER->id, $addressbook->getId());
$contactList = $addressbookDAO->getAddressbookContactsForUser($USER->id, $addressbook->getId());
foreach ($groupList as $group) {
    $customFormData['existingGroups'][$group->getId()] = $group->getName();
}
foreach ($contactList as $contact) {
    $customFormData['potentialContacts'][$contact->getContactId()] = $contact->getFullNameForDisplay();
}
$GLOBALS['_HTML_QuickForm_default_renderer'] = new QuickFormRendererWithSlides();
// Override renderer for multi-select
$notifications = '';
// POST PROCESSING FOR ADD FORM
$addForm = new MoodletxtGroupAddForm(null, $customFormData);
// Already have this data out, so pass it for inline validation
$addData = $addForm->get_data();
if ($addData != null) {
    $addData = $addForm->cleanupFormData($addData);
コード例 #2
0
ファイル: send.php プロジェクト: educacionbe/campus
// Oh, the happiness. The sheer unrelenting joy.
$PAGE->requires->css('/blocks/moodletxt/style/send.css');
// User's signature
$PAGE->requires->js_init_call('receiveUserSignature', array($userDAO->getUserConfig($USER->id)->getUserConfig('signature')));
// Set up send form and load in all our lovely data
$GLOBALS['_HTML_QuickForm_default_renderer'] = new QuickFormRendererWithSlides();
// Override renderer for slides
$output = $PAGE->get_renderer('block_moodletxt');
$potentialRecipients = array();
$initialData = array();
$customData = array('course' => $courseId, 'instance' => $instanceId, 'existingTemplates' => array(), 'potentialRecipients' => &$potentialRecipients, 'txttoolsAccounts' => array(), 'moodleUsers' => array(), 'moodleGroups' => array());
$templates = $templateDAO->getAllTemplatesForUserId($USER->id);
$accounts = $accountDAO->getAccessibleAccountsForUserId($USER->id, true, false);
$moodleUsers = $userDAO->getUsersOnCourse($courseId);
$moodleGroups = $userDAO->getUserGroupsOnCourse($courseId);
$abContacts = $addressbookDAO->getAddressbookContactsForUser($USER->id);
$abGroups = $addressbookDAO->getAddressbookGroupsForUser($USER->id);
if (count($accounts) === 0) {
    print_error('errornoaccountspresent', 'block_moodletxt');
}
foreach ($templates as $template) {
    $customData['existingTemplates'][$template->getId()] = $template->getText();
}
foreach ($accounts as $account) {
    $customData['txttoolsAccounts'][$account->getId()] = MoodletxtStringHelper::formatAccountForDisplay($account);
}
foreach ($moodleUsers as $user) {
    if ($user->hasPhoneNumber()) {
        $potentialRecipients['u#' . $user->getId()] = array($user->getFullNameForDisplay(), array('class' => 'userRecipient'));
    }
}
コード例 #3
0
        case 'company':
            $databaseOrder = 'c.company %DIR%';
            break;
    }
    if ($direction == SORT_ASC) {
        $databaseOrder = str_replace('%DIR%', 'ASC', $databaseOrder);
    } else {
        $databaseOrder = str_replace('%DIR%', 'DESC', $databaseOrder);
    }
    if ($orderBy != '') {
        $databaseOrder = ', ' . $databaseOrder;
    }
    $orderBy .= $databaseOrder;
}
// Page parameters must be sorted by this point - populating the table
$contactsToDisplay = $addressbookDAO->getAddressbookContactsForUser($USER->id, $addressbook->getId(), $orderBy, $table->get_page_start(), $table->get_page_size());
// BEGIN PAGE OUTPUT
if (!$table->is_downloading()) {
    echo $output->header();
    // Links to add contact/manage groups pages
    echo $output->box(html_writer::link(new moodle_url('addressbook_contact_add.php', array('course' => $courseId, 'instance' => $instanceId, 'addressbook' => $addressbookId)), get_string('linkaddcontact', 'block_moodletxt')) . html_writer::empty_tag('br') . html_writer::link(new moodle_url('addressbook_groups.php', array('course' => $courseId, 'instance' => $instanceId, 'addressbook' => $addressbookId)), get_string('linkmanagegroups', 'block_moodletxt')));
    $updateForm->display();
    echo html_writer::tag('p', get_string('notifydoubleclickcontact', 'block_moodletxt'), array('style' => 'font-weight:bold;'));
}
// Table outputs as it is populated, which is why this needs to be here
foreach ($contactsToDisplay as $contact) {
    if ($table->is_downloading()) {
        $firstCell = $contact->getContactId();
    } else {
        $firstCell = html_writer::checkbox('contactIds[]', $contact->getContactId(), false);
    }