本文整理汇总了PHP中FormValidator::addButton方法的典型用法代码示例。如果您正苦于以下问题:PHP FormValidator::addButton方法的具体用法?PHP FormValidator::addButton怎么用?PHP FormValidator::addButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormValidator
的用法示例。
在下文中一共展示了FormValidator::addButton方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_new_comment_form
/**
* Displays the form to create a new post
* @author Toon Keppens
*
* @param Integer $blog_id
*/
public static function display_new_comment_form($blog_id, $post_id, $title)
{
$form = new FormValidator('add_post', 'post', api_get_path(WEB_CODE_PATH) . "blog/blog.php?action=view_post&blog_id=" . intval($blog_id) . "&post_id=" . intval($post_id) . "&" . api_get_cidreq(), null, array('enctype' => 'multipart/form-data'));
$header = get_lang('AddNewComment');
if (isset($_GET['task_id'])) {
$header = get_lang('ExecuteThisTask');
}
$form->addHeader($header);
$form->addText('title', get_lang('Title'));
$config = array();
if (!api_is_allowed_to_edit()) {
$config['ToolbarSet'] = 'ProjectComment';
} else {
$config['ToolbarSet'] = 'ProjectCommentStudent';
}
$form->addHtmlEditor('comment', get_lang('Comment'), false, false, $config);
$form->addFile('user_upload', get_lang('AddAnAttachment'));
$form->addTextarea('post_file_comment', get_lang('FileComment'));
$form->addHidden('action', null);
$form->addHidden('comment_parent_id', 0);
if (isset($_GET['task_id'])) {
$form->addHidden('new_task_execution_submit', 'true');
$form->addHidden('task_id', intval($_GET['task_id']));
} else {
$form->addHidden('new_comment_submit', 'true');
}
$form->addButton('save', get_lang('Save'));
$form->display();
}
示例2: array
}
if ($total_resource_weight != $total_weight) {
Display::display_warning_message(get_lang('SumOfActivitiesWeightMustBeEqualToTotalWeight'));
}
}
$filter = api_get_setting('certificate_filter_by_official_code');
$userList = array();
$filterForm = null;
$certificate_list = array();
if ($filter === 'true') {
echo '<br />';
$options = UserManager::getOfficialCodeGrouped();
$options = array_merge(array('all' => get_lang('All')), $options);
$form = new FormValidator('official_code_filter', 'POST', api_get_self() . '?' . api_get_cidreq() . '&cat_id=' . $cat_id);
$form->addElement('select', 'filter', get_lang('OfficialCode'), $options);
$form->addButton('submit', get_lang('Submit'));
$filterForm = '<br />' . $form->return_form();
if ($form->validate()) {
$officialCode = $form->getSubmitValue('filter');
if ($officialCode == 'all') {
$certificate_list = GradebookUtils::get_list_users_certificates($cat_id);
} else {
$userList = UserManager::getUsersByOfficialCode($officialCode);
if (!empty($userList)) {
$certificate_list = GradebookUtils::get_list_users_certificates($cat_id, $userList);
}
}
} else {
$certificate_list = GradebookUtils::get_list_users_certificates($cat_id);
}
} else {
示例3: displayLoginForm
/**
* @return string
*/
public function displayLoginForm()
{
$form = new FormValidator('formLogin', 'POST', null, null, null, FormValidator::LAYOUT_BOX_NO_LABEL);
$form->addText('login', get_lang('UserName'), true, array('id' => 'login', 'autofocus' => 'autofocus', 'icon' => 'user fa-fw', 'placeholder' => get_lang('UserName')));
$form->addElement('password', 'password', get_lang('Pass'), array('id' => 'password', 'icon' => 'lock fa-fw', 'placeholder' => get_lang('Pass')));
// Captcha
$captcha = api_get_setting('allow_captcha');
$allowCaptcha = $captcha == 'true';
if ($allowCaptcha) {
$useCaptcha = isset($_SESSION['loginFailed']) ? $_SESSION['loginFailed'] : null;
if ($useCaptcha) {
$ajax = api_get_path(WEB_AJAX_PATH) . 'form.ajax.php?a=get_captcha';
$options = array('width' => 250, 'height' => 90, 'callback' => $ajax . '&var=' . basename(__FILE__, '.php'), 'sessionVar' => basename(__FILE__, '.php'), 'imageOptions' => array('font_size' => 20, 'font_path' => api_get_path(SYS_FONTS_PATH) . 'opensans/', 'font_file' => 'OpenSans-Regular.ttf'));
// Minimum options using all defaults (including defaults for Image_Text):
//$options = array('callback' => 'qfcaptcha_image.php');
$captcha_question = $form->addElement('CAPTCHA_Image', 'captcha_question', '', $options);
$form->addHtml(get_lang('ClickOnTheImageForANewOne'));
$form->addElement('text', 'captcha', get_lang('EnterTheLettersYouSee'));
$form->addRule('captcha', get_lang('EnterTheCharactersYouReadInTheImage'), 'required', null, 'client');
$form->addRule('captcha', get_lang('TheTextYouEnteredDoesNotMatchThePicture'), 'CAPTCHA', $captcha_question);
}
}
$form->addButton('submitAuth', get_lang('LoginEnter'), null, 'primary', null, 'btn-block');
$html = $form->returnForm();
if (api_get_setting('openid_authentication') == 'true') {
include_once 'main/auth/openid/login.php';
$html .= '<div>' . openid_form() . '</div>';
}
return $html;
}
示例4: subscribe_user
/**
* Subscribe the user to a given course
* @param string Course code
* @return string Message about results
*/
public function subscribe_user($course_code)
{
$user_id = api_get_user_id();
$all_course_information = CourseManager::get_course_information($course_code);
if ($all_course_information['registration_code'] == '' || $_POST['course_registration_code'] == $all_course_information['registration_code']) {
if (api_is_platform_admin()) {
$status_user_in_new_course = COURSEMANAGER;
} else {
$status_user_in_new_course = null;
}
if (CourseManager::add_user_to_course($user_id, $course_code, $status_user_in_new_course)) {
$send = api_get_course_setting('email_alert_to_teacher_on_new_user_in_course', $course_code);
if ($send == 1) {
CourseManager::email_to_tutor($user_id, $course_code, $send_to_tutor_also = false);
} else {
if ($send == 2) {
CourseManager::email_to_tutor($user_id, $course_code, $send_to_tutor_also = true);
}
}
$url = Display::url($all_course_information['title'], api_get_course_url($course_code));
$message = sprintf(get_lang('EnrollToCourseXSuccessful'), $url);
} else {
$message = get_lang('ErrorContactPlatformAdmin');
}
return array('message' => $message);
} else {
if (isset($_POST['course_registration_code']) && $_POST['course_registration_code'] != $all_course_information['registration_code']) {
return false;
}
$message = get_lang('CourseRequiresPassword') . '<br />';
$message .= $all_course_information['title'] . ' (' . $all_course_information['visual_code'] . ') ';
$action = api_get_path(WEB_CODE_PATH) . "auth/courses.php?action=subscribe_user_with_password&sec_token=" . $_SESSION['sec_token'];
$form = new FormValidator('subscribe_user_with_password', 'post', $action);
$form->addElement('hidden', 'sec_token', $_SESSION['sec_token']);
$form->addElement('hidden', 'subscribe_user_with_password', $all_course_information['code']);
$form->addElement('text', 'course_registration_code');
$form->addButton(get_lang('SubmitRegistrationCode'));
$content = $form->returnForm();
return array('message' => $message, 'content' => $content);
}
}
示例5: getAttendanceBaseInLogin
/**
* Gets attendance base in the table:
* TABLE_STATISTIC_TRACK_E_COURSE_ACCESS
* @param bool $showForm
* @throws ViewException
*/
public function getAttendanceBaseInLogin($showForm = false, $exportToPdf = true)
{
$table = null;
$formToDisplay = null;
$startDate = null;
$endDate = null;
$sessionId = api_get_session_id();
if ($showForm) {
$form = new FormValidator('search', 'post', api_get_self() . '?' . api_get_cidreq() . '&action=calendar_logins');
$form->addDateRangePicker('range', get_lang('DateRange'));
$form->addButton('submit', get_lang('Submit'));
if ($form->validate()) {
$values = $form->getSubmitValues();
$startDate = api_get_utc_datetime($values['range_start']);
$endDate = api_get_utc_datetime($values['range_end']);
}
$formToDisplay = $form->returnForm();
} else {
if (!empty($sessionId)) {
$sessionInfo = api_get_session_info($sessionId);
$startDate = $sessionInfo['access_start_date'];
$endDate = $sessionInfo['access_end_date'];
}
}
$attendance = new Attendance();
if ($exportToPdf) {
$result = $attendance->exportAttendanceLogin($startDate, $endDate);
if (empty($result)) {
api_not_allowed(true, get_lang('NoDataAvailable'));
}
}
$table = $attendance->getAttendanceLoginTable($startDate, $endDate);
$data = array('form' => $formToDisplay, 'table' => $table);
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('calendar_logins');
$this->view->render();
}
示例6: unset
$plugin->cancelSale($sale['id']);
unset($_SESSION['bc_sale_id']);
header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/index.php');
exit;
}
$messageTemplate = new Template();
$messageTemplate->assign('user', $userInfo);
$messageTemplate->assign('sale', ['date' => api_format_date($sale['date'], DATE_FORMAT_LONG_NO_DAY), 'product' => $sale['product_name'], 'currency' => $currency['iso_code'], 'price' => $sale['price'], 'reference' => $sale['reference']]);
$messageTemplate->assign('transfer_accounts', $transferAccounts);
api_mail_html($userInfo['complete_name'], $userInfo['email'], $plugin->get_lang('bc_subject'), $messageTemplate->fetch('buycourses/view/message_transfer.tpl'));
Display::addFlash(Display::return_message(sprintf($plugin->get_lang('PurchaseStatusX'), $plugin->get_lang('PendingReasonByTransfer')), 'success', false));
unset($_SESSION['bc_sale_id']);
header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/course_catalog.php');
exit;
}
$form->addButton('confirm', $plugin->get_lang('ConfirmOrder'), 'check', 'success');
$form->addButtonCancel($plugin->get_lang('CancelOrder'), 'cancel');
$template = new Template();
if ($buyingCourse) {
$template->assign('course', $course);
} elseif ($buyingSession) {
$template->assign('session', $session);
}
$template->assign('buying_course', $buyingCourse);
$template->assign('buying_session', $buyingSession);
$template->assign('title', $sale['product_name']);
$template->assign('price', $sale['price']);
$template->assign('currency', $sale['currency_id']);
$template->assign('user', $userInfo);
$template->assign('transfer_accounts', $transferAccounts);
$template->assign('form', $form->returnForm());
示例7: Sequence
$sequence = new Sequence();
$sequence->setName($values['name']);
$em->persist($sequence);
$em->flush();
header('Location: ' . api_get_self());
exit;
}
$selectSequence = new FormValidator('');
$selectSequence->addHidden('sequence_type', 'session');
$em = Database::getManager();
$sequenceList = $em->getRepository('ChamiloCoreBundle:Sequence')->findAll();
$selectSequence->addSelect('sequence', get_lang('Sequence'), $sequenceList, ['id' => 'sequence_id', 'cols-size' => [3, 7, 2]]);
$form = new FormValidator('');
$form->addHtml("<div class='col-md-6'>");
$form->addHidden('sequence_type', 'session');
$form->addSelect('sessions', get_lang('Sessions'), $sessionList, ['id' => 'item', 'cols-size' => [4, 7, 1]]);
$form->addButtonNext(get_lang('UseAsReference'), 'use_as_reference', ['cols-size' => [4, 7, 1]]);
$form->addHtml("</div>");
$form->addHtml("<div class='col-md-6'>");
$form->addSelect('requirements', get_lang('Requirements'), $sessionList, ['id' => 'requirements', 'cols-size' => [3, 7, 2]]);
$form->addButtonCreate(get_lang('SetAsRequirement'), 'set_requirement', false, ['cols-size' => [3, 7, 2]]);
$form->addHtml("</div>");
$formSave = new FormValidator('');
$formSave->addHidden('sequence_type', 'session');
$formSave->addButton('save_resource', get_lang('SaveSettings'), 'floppy-o', 'success', null, null, ['cols-size' => [1, 10, 1]]);
$tpl->assign('create_sequence', $formSequence->returnForm());
$tpl->assign('select_sequence', $selectSequence->returnForm());
$tpl->assign('configure_sequence', $form->returnForm());
$tpl->assign('save_sequence', $formSave->returnForm());
$layout = $tpl->get_template('admin/resource_sequence.tpl');
$tpl->display($layout);
示例8: api_not_allowed
/**
* Displays message "You are not allowed here..." and exits the entire script.
* @param bool $print_headers Whether or not to print headers (default = false -> does not print them)
* @param string $message
*/
function api_not_allowed($print_headers = false, $message = null)
{
$message = get_lang('NotAllowed');
throw new Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException($message);
if (api_get_setting('sso_authentication') === 'true') {
global $osso;
if ($osso) {
$osso->logout();
}
}
$home_url = api_get_path(WEB_PATH);
$user_id = api_get_user_id();
$course = api_get_course_id();
global $this_section;
if (CustomPages::enabled() && !isset($user_id)) {
if (empty($user_id)) {
// Why the CustomPages::enabled() need to be to set the request_uri
$_SESSION['request_uri'] = $_SERVER['REQUEST_URI'];
}
CustomPages::display(CustomPages::INDEX_UNLOGGED);
}
$origin = isset($_GET['origin']) ? $_GET['origin'] : '';
$msg = null;
if (isset($message)) {
$msg = $message;
} else {
$msg = Display::return_message(get_lang('NotAllowedClickBack') . '<br/><br/><a href="' . $home_url . '">' . get_lang('ReturnToCourseHomepage') . '</a>', 'error', false);
}
$msg = Display::div($msg, array('align' => 'center'));
$show_headers = 0;
if ($print_headers && $origin != 'learnpath') {
$show_headers = 1;
}
$tpl = new Template(null, $show_headers, $show_headers);
$tpl->assign('hide_login_link', 1);
$tpl->assign('content', $msg);
if ($user_id != 0 && !api_is_anonymous() && (!isset($course) || $course == -1) && empty($_GET['cidReq'])) {
// if the access is not authorized and there is some login information
// but the cidReq is not found, assume we are missing course data and send the user
// to the user_portal
$tpl->display_one_col_template();
exit;
}
if (!empty($_SERVER['REQUEST_URI']) && (!empty($_GET['cidReq']) || $this_section == SECTION_MYPROFILE || $this_section == SECTION_PLATFORM_ADMIN)) {
$courseCode = api_get_course_id();
// Only display form and return to the previous URL if there was a course ID included
if ($user_id != 0 && !api_is_anonymous()) {
//if there is a user ID, then the user is not allowed but the session is still there. Say so and exit
$tpl->assign('content', $msg);
$tpl->display_one_col_template();
exit;
}
if (!is_null($courseCode)) {
api_set_firstpage_parameter($courseCode);
}
// If the user has no user ID, then his session has expired
$action = api_get_self() . '?' . Security::remove_XSS($_SERVER['QUERY_STRING']);
$action = str_replace('&', '&', $action);
$form = new FormValidator('formLogin', 'post', $action, null, array(), FormValidator::LAYOUT_BOX_NO_LABEL);
$form->addElement('text', 'login', null, array('placeholder' => get_lang('UserName'), 'class' => 'autocapitalize_off'));
$form->addElement('password', 'password', null, array('placeholder' => get_lang('Password')));
$form->addButton('submitAuth', get_lang('LoginEnter'), '', 'primary');
// see same text in auth/gotocourse.php and main_api.lib.php function api_not_allowed (above)
$content = Display::return_message(get_lang('NotAllowed'), 'error', false);
if (!empty($courseCode)) {
$content .= '<h4>' . get_lang('LoginToGoToThisCourse') . '</h4>';
}
if (api_is_cas_activated()) {
$content .= Display::return_message(sprintf(get_lang('YouHaveAnInstitutionalAccount'), api_get_setting("Institution")), '', false);
$content .= Display::div("<br/><a href='" . get_cas_direct_URL(api_get_course_id()) . "'>" . sprintf(get_lang('LoginWithYourAccount'), api_get_setting("Institution")) . "</a><br/><br/>", array('align' => 'center'));
$content .= Display::return_message(get_lang('YouDontHaveAnInstitutionAccount'));
$content .= "<p style='text-align:center'><a href='#' onclick='\$(this).parent().next().toggle()'>" . get_lang('LoginWithExternalAccount') . "</a></p>";
$content .= "<div style='display:none;'>";
}
$content .= '<div class="well_login">';
$content .= $form->return_form();
$content .= '</div>';
if (api_is_cas_activated()) {
$content .= "</div>";
}
if (!empty($courseCode)) {
$content .= '<hr/><p style="text-align:center"><a href="' . $home_url . '">' . get_lang('ReturnToCourseHomepage') . '</a></p>';
} else {
$content .= '<hr/><p style="text-align:center"><a href="' . $home_url . '">' . get_lang('CampusHomepage') . '</a></p>';
}
$tpl->setLoginBodyClass();
$tpl->assign('content', $content);
$tpl->display_one_col_template();
exit;
}
if ($user_id != 0 && !api_is_anonymous()) {
$tpl->display_one_col_template();
exit;
}
$msg = null;
//.........这里部分代码省略.........
示例9: displayTrackingAccessOverView
public static function displayTrackingAccessOverView($courseId, $sessionId, $studentId)
{
$courseId = intval($courseId);
$sessionId = intval($sessionId);
$studentId = intval($studentId);
$em = Database::getManager();
$sessionRepo = $em->getRepository('ChamiloCoreBundle:Session');
$courseList = [];
$sessionList = [];
$studentList = [];
if (!empty($courseId)) {
$course = $em->find('ChamiloCoreBundle:Course', $courseId);
$courseList[$course->getId()] = $course->getTitle();
}
if (!empty($sessionId)) {
$session = $em->find('ChamiloCoreBundle:Session', $sessionId);
$sessionList[$session->getId()] = $session->getName();
}
if (!empty($studentId)) {
$student = $em->find('ChamiloUserBundle:User', $studentId);
$studentList[$student->getId()] = $student->getCompleteName();
}
$form = new FormValidator('access_overview', 'GET');
$form->addElement('select_ajax', 'course_id', get_lang('SearchCourse'), $courseList, ['url' => api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?' . http_build_query(['a' => 'search_course_by_session_all', 'session_id' => $sessionId])]);
$form->addElement('select_ajax', 'session_id', get_lang('SearchSession'), $sessionList, ['url_function' => "\n function () {\n var params = \$.param({\n a: 'search_session_by_course',\n course_id: \$('#course_id').val() || 0\n });\n\n return '" . api_get_path(WEB_AJAX_PATH) . "session.ajax.php?' + params;\n }\n "]);
$form->addSelect('profile', get_lang('Profile'), ['' => get_lang('Select'), STUDENT => get_lang('Student'), COURSEMANAGER => get_lang('CourseManager'), DRH => get_lang('Drh')], ['id' => 'profile']);
$form->addElement('select_ajax', 'student_id', get_lang('SearchUsers'), $studentList, ['placeholder' => get_lang('All'), 'url_function' => "\n function () {\n var params = \$.param({\n a: 'search_user_by_course',\n session_id: \$('#session_id').val(),\n course_id: \$('#course_id').val()\n });\n\n return '" . api_get_path(WEB_AJAX_PATH) . "course.ajax.php?' + params;\n }\n "]);
$form->addDateRangePicker('date', get_lang('DateRange'), true, ['id' => 'date_range', 'format' => 'YYYY-MM-DD', 'timePicker' => 'false', 'validate_format' => 'Y-m-d']);
$form->addHidden('display', 'accessoverview');
$form->addRule('course_id', get_lang('Required'), 'required');
$form->addRule('profile', get_lang('Required'), 'required');
$form->addButton('submit', get_lang('Generate'), 'gear', 'primary');
$table = null;
if ($form->validate()) {
$table = new SortableTable('tracking_access_overview', ['MySpace', 'getNumberOfRrackingAccessOverview'], ['MySpace', 'getUserDataAccessTrackingOverview'], 0);
$table->additional_parameters = $form->exportValues();
$table->set_header(0, get_lang('LoginDate'), true);
$table->set_header(1, get_lang('Username'), true);
if (api_is_western_name_order()) {
$table->set_header(2, get_lang('FirstName'), true);
$table->set_header(3, get_lang('LastName'), true);
} else {
$table->set_header(2, get_lang('LastName'), true);
$table->set_header(3, get_lang('FirstName'), true);
}
$table->set_header(4, get_lang('Clicks'), false);
$table->set_header(5, get_lang('IP'), false);
$table->set_header(6, get_lang('TimeLoggedIn'), false);
}
$template = new Template(null, false, false, false, false, false, false);
$template->assign('form', $form->returnForm());
$template->assign('table', $table ? $table->return_table() : null);
echo $template->fetch($template->get_template('my_space/accessoverview.tpl'));
}
示例10: FormValidator
$form->addButtonCreate(get_lang('CreateGroup'), 'submit');
$form->display();
}
} else {
/*
* Show form to generate new groups
*/
$create_groups_form = new FormValidator('create_groups', 'post', api_get_self() . '?' . api_get_cidreq());
$create_groups_form->addElement('header', $nameTools);
/* $group_el = array ();
$group_el[] = $create_groups_form->createElement('text', 'number_of_groups', array(get_lang('Create'), '1'));
$group_el[] = $create_groups_form->addButtonCreate(get_lang('ProceedToCreateGroup'), 'submit', true);
$create_groups_form->addGroup($group_el, 'create_groups', get_lang('NumberOfGroupsToCreate'), ' ', false);
*/
$create_groups_form->addText('number_of_groups', get_lang('NumberOfGroupsToCreate'), null, array('value' => '1'));
$create_groups_form->addButton('submit', get_lang('ProceedToCreateGroup'), 'plus', 'primary');
$defaults = array();
$defaults['number_of_groups'] = 1;
$create_groups_form->setDefaults($defaults);
$create_groups_form->display();
/*
* Show form to generate subgroups
*/
if (api_get_setting('allow_group_categories') == 'true' && count(GroupManager::get_group_list()) > 0) {
$base_group_options = array();
$groups = GroupManager::get_group_list();
foreach ($groups as $index => $group) {
$number_of_students = GroupManager::number_of_students($group['id']);
if ($number_of_students > 0) {
$base_group_options[$group['id']] = $group['name'] . ' (' . $number_of_students . ' ' . get_lang('Users') . ')';
}
示例11: createForm
/**
* Creates the form to create / edit a question
* A subclass can redefine this function to add fields...
* @param FormValidator $form
*/
public function createForm(&$form)
{
echo '<style>
.media { display:none;}
</style>';
echo '<script>
// hack to hide http://cksource.com/forums/viewtopic.php?f=6&t=8700
function FCKeditor_OnComplete( editorInstance ) {
if (document.getElementById ( \'HiddenFCK\' + editorInstance.Name)) {
HideFCKEditorByInstanceName (editorInstance.Name);
}
}
function HideFCKEditorByInstanceName ( editorInstanceName ) {
if (document.getElementById ( \'HiddenFCK\' + editorInstanceName ).className == "HideFCKEditor" ) {
document.getElementById ( \'HiddenFCK\' + editorInstanceName ).className = "media";
}
}
</script>';
// question name
$form->addElement('text', 'questionName', get_lang('Question'));
$form->addRule('questionName', get_lang('GiveQuestion'), 'required');
// default content
$isContent = isset($_REQUEST['isContent']) ? intval($_REQUEST['isContent']) : null;
// Question type
$answerType = isset($_REQUEST['answerType']) ? intval($_REQUEST['answerType']) : null;
$form->addElement('hidden', 'answerType', $answerType);
// html editor
$editorConfig = array('ToolbarSet' => 'TestQuestionDescription', 'Height' => '150');
if (!api_is_allowed_to_edit(null, true)) {
$editorConfig['UserStatus'] = 'student';
}
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
$form->addHtmlEditor('questionDescription', get_lang('QuestionDescription'), false, false, $editorConfig);
// hidden values
$my_id = isset($_REQUEST['myid']) ? intval($_REQUEST['myid']) : null;
$form->addElement('hidden', 'myid', $my_id);
if ($this->type != MEDIA_QUESTION) {
// Advanced parameters
$select_level = Question::get_default_levels();
$form->addElement('select', 'questionLevel', get_lang('Difficulty'), $select_level);
// Categories
$tabCat = TestCategory::getCategoriesIdAndName();
$form->addElement('select', 'questionCategory', get_lang('Category'), $tabCat);
switch ($this->type) {
case UNIQUE_ANSWER:
$form->addButton('convertAnswer', get_lang('ConvertToMultipleAnswer'), 'dot-circle-o', 'info');
break;
case MULTIPLE_ANSWER:
$form->addButton('convertAnswer', get_lang('ConvertToUniqueAnswer'), 'check-square-o', 'info');
break;
}
//Medias
//$course_medias = Question::prepare_course_media_select(api_get_course_int_id());
//$form->addElement('select', 'parent_id', get_lang('AttachToMedia'), $course_medias);
}
$form->addElement('html', '</div>');
if (!isset($_GET['fromExercise'])) {
switch ($answerType) {
case 1:
$this->question = get_lang('DefaultUniqueQuestion');
break;
case 2:
$this->question = get_lang('DefaultMultipleQuestion');
break;
case 3:
$this->question = get_lang('DefaultFillBlankQuestion');
break;
case 4:
$this->question = get_lang('DefaultMathingQuestion');
break;
case 5:
$this->question = get_lang('DefaultOpenQuestion');
break;
case 9:
$this->question = get_lang('DefaultMultipleQuestion');
break;
}
}
// default values
$defaults = array();
$defaults['questionName'] = $this->question;
$defaults['questionDescription'] = $this->description;
$defaults['questionLevel'] = $this->level;
$defaults['questionCategory'] = $this->category;
// Came from he question pool
if (isset($_GET['fromExercise'])) {
$form->setDefaults($defaults);
}
if (!empty($_REQUEST['myid'])) {
$form->setDefaults($defaults);
} else {
if ($isContent == 1) {
$form->setDefaults($defaults);
//.........这里部分代码省略.........