本文整理汇总了PHP中GradebookUtils::load_gradebook_select_in_tool方法的典型用法代码示例。如果您正苦于以下问题:PHP GradebookUtils::load_gradebook_select_in_tool方法的具体用法?PHP GradebookUtils::load_gradebook_select_in_tool怎么用?PHP GradebookUtils::load_gradebook_select_in_tool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GradebookUtils
的用法示例。
在下文中一共展示了GradebookUtils::load_gradebook_select_in_tool方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_edit_post_form
/**
* This function displays the form that is used to edit a post. This can be a new thread or a reply.
* @param array contains all the information about the current post
* @param array contains all the information about the current thread
* @param array contains all info about the current forum (to check if attachments are allowed)
* @param array contains the default values to fill the form
* @return void
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version february 2006, dokeos 1.8
*/
function show_edit_post_form($forum_setting, $current_post, $current_thread, $current_forum, $form_values = '', $id_attach = 0)
{
// Initialize the object.
$form = new FormValidator('edit_post', 'post', api_get_self() . '?' . api_get_cidreq() . '&forum=' . Security::remove_XSS($_GET['forum']) . '&thread=' . Security::remove_XSS($_GET['thread']) . '&post=' . Security::remove_XSS($_GET['post']));
$form->addElement('header', get_lang('EditPost'));
// Setting the form elements.
$form->addElement('hidden', 'post_id', $current_post['post_id']);
$form->addElement('hidden', 'thread_id', $current_thread['thread_id']);
$form->addElement('hidden', 'id_attach', $id_attach);
if ($current_post['post_parent_id'] == 0) {
$form->addElement('hidden', 'is_first_post_of_thread', '1');
}
$form->addElement('text', 'post_title', get_lang('Title'));
$form->applyFilter('post_title', 'html_filter');
$form->addHtmlEditor('post_text', get_lang('Text'), null, null, api_is_allowed_to_edit(null, true) ? array('ToolbarSet' => 'Forum', 'Width' => '100%', 'Height' => '400') : array('ToolbarSet' => 'ForumStudent', 'Width' => '100%', 'Height' => '400', 'UserStatus' => 'student'));
$form->addRule('post_text', get_lang('ThisFieldIsRequired'), 'required');
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
if (!isset($_GET['edit'])) {
if (Gradebook::is_active()) {
$form->addElement('label', '<strong>' . get_lang('AlterQualifyThread') . '</strong>');
$form->addElement('checkbox', 'thread_qualify_gradebook', '', get_lang('QualifyThreadGradebook'), 'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
$link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 5, $_GET['thread'], api_get_session_id());
if (!empty($link_info)) {
$defaults['thread_qualify_gradebook'] = true;
$defaults['category_id'] = $link_info['category_id'];
} else {
$defaults['thread_qualify_gradebook'] = false;
$defaults['category_id'] = '';
}
} else {
$form->addElement('hidden', 'thread_qualify_gradebook', false);
$defaults['thread_qualify_gradebook'] = false;
}
if (!empty($defaults['thread_qualify_gradebook'])) {
$form->addElement('html', '<div id="options_field" style="display:block">');
} else {
$form->addElement('html', '<div id="options_field" style="display:none">');
}
// Loading gradebook select
GradebookUtils::load_gradebook_select_in_tool($form);
$form->addElement('text', 'numeric_calification', get_lang('QualificationNumeric'), array('value' => $current_thread['thread_qualify_max'], 'style' => 'width:40px'));
$form->applyFilter('numeric_calification', 'html_filter');
$form->addElement('text', 'calification_notebook_title', get_lang('TitleColumnGradebook'), array('value' => $current_thread['thread_title_qualify']));
$form->applyFilter('calification_notebook_title', 'html_filter');
$form->addElement('text', 'weight_calification', array(get_lang('QualifyWeight'), null, ''), array('value' => $current_thread['thread_weight'], 'style' => 'width:40px'));
$form->applyFilter('weight_calification', 'html_filter');
$group = array();
$group[] = $form->createElement('radio', 'thread_peer_qualify', null, get_lang('Yes'), 1);
$group[] = $form->createElement('radio', 'thread_peer_qualify', null, get_lang('No'), 0);
$form->addGroup($group, '', [get_lang('ForumThreadPeerScoring'), get_lang('ForumThreadPeerScoringComment')], ' ');
$form->addElement('html', '</div>');
}
if ($forum_setting['allow_post_notification']) {
$form->addElement('checkbox', 'post_notification', '', get_lang('NotifyByEmail') . ' (' . $current_post['email'] . ')');
}
if ($forum_setting['allow_sticky'] && api_is_allowed_to_edit(null, true) && $current_post['post_parent_id'] == 0) {
// The sticky checkbox only appears when it is the first post of a thread.
$form->addElement('checkbox', 'thread_sticky', '', get_lang('StickyPost'));
if ($current_thread['thread_sticky'] == 1) {
$defaults['thread_sticky'] = true;
}
}
if ($current_forum['allow_attachments'] == '1' || api_is_allowed_to_edit(null, true)) {
if (empty($form_values) && !isset($_POST['SubmitPost'])) {
//edit_added_resources('forum_post', $current_post['post_id']);
}
}
$form->addElement('html', '</div>');
$form->addFile('user_upload[]', get_lang('Attachment'));
$form->addButton('add_attachment', get_lang('AddAttachment'), 'paperclip', 'default', 'default', null, ['id' => 'reply-add-attachment']);
$form->addButtonUpdate(get_lang('ModifyThread'), 'SubmitPost');
// Setting the default values for the form elements.
$defaults['post_title'] = $current_post['post_title'];
$defaults['post_text'] = $current_post['post_text'];
if ($current_post['post_notification'] == 1) {
$defaults['post_notification'] = true;
}
if (!empty($form_values)) {
$defaults['post_notification'] = Security::remove_XSS($form_values['post_notification']);
$defaults['thread_sticky'] = Security::remove_XSS($form_values['thread_sticky']);
}
$defaults['thread_peer_qualify'] = intval($current_thread['thread_peer_qualify']);
$form->setDefaults($defaults);
// The course admin can make a thread sticky (=appears with special icon and always on top).
$form->addRule('post_title', get_lang('ThisFieldIsRequired'), 'required');
// Validation or display
if ($form->validate()) {
$values = $form->exportValues();
//.........这里部分代码省略.........
示例2: get_lang
$form->applyFilter('title', 'html_filter');
$form->addHtmlEditor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '200'));
// Adavanced Parameters
if (Gradebook::is_active()) {
if (!empty($attendance_qualify_title) || !empty($attendance_weight)) {
$form->addButtonAdvancedSettings('id_qualify');
$form->addElement('html', '<div id="id_qualify_options" style="display:block">');
$form->addElement('checkbox', 'attendance_qualify_gradebook', '', get_lang('QualifyAttendanceGradebook'), array('checked' => 'true', 'onclick' => 'javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}'));
$form->addElement('html', '<div id="options_field" style="display:block">');
} else {
$form->addButtonAdvancedSettings('id_qualify');
$form->addElement('html', '<div id="id_qualify_options" style="display:none">');
$form->addElement('checkbox', 'attendance_qualify_gradebook', '', get_lang('QualifyAttendanceGradebook'), 'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
$form->addElement('html', '<div id="options_field" style="display:none">');
}
GradebookUtils::load_gradebook_select_in_tool($form);
$form->addElement('text', 'attendance_qualify_title', get_lang('TitleColumnGradebook'));
$form->applyFilter('attendance_qualify_title', 'html_filter');
$form->addElement('text', 'attendance_weight', get_lang('QualifyWeight'), 'value="0.00" Style="width:40px" onfocus="javascript: this.select();"');
$form->applyFilter('attendance_weight', 'html_filter');
$form->addElement('html', '</div>');
$form->addElement('html', '</div>');
}
$form->addButtonUpdate(get_lang('Save'));
// set default values
$default['title'] = Security::remove_XSS($title);
$default['description'] = Security::remove_XSS($description, STUDENT);
$default['attendance_qualify_title'] = $attendance_qualify_title;
$default['attendance_weight'] = $attendance_weight;
$link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 7, $attendance_id, api_get_session_id());
$default['category_id'] = $link_info->getCategoryId();
示例3: getFormWork
/**
* @param FormValidator $form
* @param array $defaults
* @return FormValidator
*/
function getFormWork($form, $defaults = array())
{
if (!empty($defaults)) {
if (isset($defaults['submit'])) {
unset($defaults['submit']);
}
}
// Create the form that asks for the directory name
$form->addElement('text', 'new_dir', get_lang('AssignmentName'));
$form->addRule('new_dir', get_lang('ThisFieldIsRequired'), 'required');
$form->addHtmlEditor('description', get_lang('Description'), false, false, getWorkDescriptionToolbar());
$form->addButtonAdvancedSettings('advanced_params', get_lang('AdvancedParameters'));
if (!empty($defaults) && (isset($defaults['enableEndDate']) || isset($defaults['enableExpiryDate']))) {
$form->addElement('html', '<div id="advanced_params_options" style="display:block">');
} else {
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
}
// QualificationOfAssignment
$form->addElement('text', 'qualification', get_lang('QualificationNumeric'));
if (api_get_session_id() != 0 && Gradebook::is_active() || api_get_session_id() == 0) {
$form->addElement('checkbox', 'make_calification', null, get_lang('MakeQualifiable'), array('id' => 'make_calification_id', 'onclick' => "javascript: if(this.checked) { document.getElementById('option1').style.display='block';}else{document.getElementById('option1').style.display='none';}"));
} else {
// QualificationOfAssignment
$form->addElement('hidden', 'make_calification', false);
}
if (!empty($defaults) && isset($defaults['category_id'])) {
$form->addElement('html', '<div id=\'option1\' style="display:block">');
} else {
$form->addElement('html', '<div id=\'option1\' style="display:none">');
}
// Loading Gradebook select
GradebookUtils::load_gradebook_select_in_tool($form);
$form->addElement('text', 'weight', get_lang('WeightInTheGradebook'));
$form->addElement('html', '</div>');
$form->addElement('checkbox', 'enableExpiryDate', null, get_lang('EnableExpiryDate'), 'id="expiry_date"');
if (isset($defaults['enableExpiryDate']) && $defaults['enableExpiryDate']) {
$form->addElement('html', '<div id="option2" style="display: block;">');
} else {
$form->addElement('html', '<div id="option2" style="display: none;">');
}
$currentDate = substr(api_get_local_time(), 0, 10);
if (!isset($defaults['expires_on'])) {
$date = substr($currentDate, 0, 10);
$defaults['expires_on'] = $date . ' 23:59';
}
if (!isset($defaults['ends_on'])) {
$date = substr($currentDate, 0, 10);
$defaults['ends_on'] = $date . ' 23:59';
}
$form->addElement('date_time_picker', 'expires_on', get_lang('ExpiresAt'));
$form->addElement('html', '</div>');
$form->addElement('checkbox', 'enableEndDate', null, get_lang('EnableEndDate'), 'id="end_date"');
if (isset($defaults['enableEndDate']) && $defaults['enableEndDate']) {
$form->addElement('html', '<div id="option3" style="display: block;">');
} else {
$form->addElement('html', '<div id="option3" style="display: none;">');
}
$form->addElement('date_time_picker', 'ends_on', get_lang('EndsAt'));
$form->addElement('html', '</div>');
$form->addElement('checkbox', 'add_to_calendar', null, get_lang('AddToCalendar'));
$form->addElement('select', 'allow_text_assignment', get_lang('DocumentType'), getUploadDocumentType());
$form->addElement('html', '</div>');
if (isset($defaults['enableExpiryDate']) && isset($defaults['enableEndDate'])) {
$form->addRule(array('expires_on', 'ends_on'), get_lang('DateExpiredNotBeLessDeadLine'), 'comparedate');
}
if (!empty($defaults)) {
$form->setDefaults($defaults);
}
return $form;
}