当前位置: 首页>>代码示例>>PHP>>正文


PHP FormValidator::addHeader方法代码示例

本文整理汇总了PHP中FormValidator::addHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP FormValidator::addHeader方法的具体用法?PHP FormValidator::addHeader怎么用?PHP FormValidator::addHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FormValidator的用法示例。


在下文中一共展示了FormValidator::addHeader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: FormValidator

$form = new FormValidator('confirm_sale');
if ($form->validate()) {
    $formValues = $form->getSubmitValues();
    if (!$formValues['payment_type']) {
        Display::addFlash(Display::return_message($plugin->get_lang('NeedToSelectPaymentType'), 'error', false));
        header('Location:' . api_get_self() . '?' . $queryString);
        exit;
    }
    $saleId = $plugin->registerSale($item['id'], $formValues['payment_type']);
    if ($saleId !== false) {
        $_SESSION['bc_sale_id'] = $saleId;
        header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/process_confirm.php');
    }
    exit;
}
$form->addHeader($plugin->get_lang('UserInformation'));
$form->addText('name', get_lang('Name'), false, ['cols-size' => [5, 7, 0]]);
$form->addText('username', get_lang('Username'), false, ['cols-size' => [5, 7, 0]]);
$form->addText('email', get_lang('EmailAddress'), false, ['cols-size' => [5, 7, 0]]);
$form->addHeader($plugin->get_lang('PaymentMethods'));
$paymentTypesOptions = $plugin->getPaymentTypes();
if (!$paypalEnabled) {
    unset($paymentTypesOptions[BuyCoursesPlugin::PAYMENT_TYPE_PAYPAL]);
}
if (!$transferEnabled) {
    unset($paymentTypesOptions[BuyCoursesPlugin::PAYMENT_TYPE_TRANSFER]);
}
$form->addRadio('payment_type', null, $paymentTypesOptions);
$form->addHidden('t', intval($_GET['t']));
$form->addHidden('i', intval($_GET['i']));
$form->freeze(['name', 'username', 'email']);
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:process.php

示例2: createAnswersForm

 /**
  * function which redefines Question::createAnswersForm
  * @param FormValidator $form
  */
 function createAnswersForm($form)
 {
     $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 2;
     $nb_answers += isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0);
     $obj_ex = Session::read('objExercise');
     $html = '<table class="table table-striped table-hover">';
     $html .= '<thead>';
     $html .= '<tr>';
     $html .= '<th width="10">' . get_lang('Number') . '</th>';
     $html .= '<th width="10">' . get_lang('True') . '</th>';
     $html .= '<th width="50%">' . get_lang('Comment') . '</th>';
     $html .= '<th width="50%">' . get_lang('Answer') . '</th>';
     $html .= '</tr>';
     $html .= '</thead>';
     $html .= '<tbody>';
     $form->addHeader(get_lang('Answers'));
     $form->addHtml($html);
     $defaults = array();
     $correct = 0;
     $answer = false;
     if (!empty($this->id)) {
         $answer = new Answer($this->id);
         $answer->read();
         if (count($answer->nbrAnswers) > 0 && !$form->isSubmitted()) {
             $nb_answers = $answer->nbrAnswers;
         }
     }
     $form->addElement('hidden', 'nb_answers');
     $boxes_names = array();
     if ($nb_answers < 1) {
         $nb_answers = 1;
         Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer'));
     }
     for ($i = 1; $i <= $nb_answers; ++$i) {
         $form->addHtml('<tr>');
         if (is_object($answer)) {
             $defaults['answer[' . $i . ']'] = $answer->answer[$i];
             $defaults['comment[' . $i . ']'] = $answer->comment[$i];
             $defaults['weighting[' . $i . ']'] = float_format($answer->weighting[$i], 1);
             $defaults['correct[' . $i . ']'] = $answer->correct[$i];
         } else {
             $defaults['answer[1]'] = get_lang('DefaultMultipleAnswer2');
             $defaults['comment[1]'] = get_lang('DefaultMultipleComment2');
             $defaults['correct[1]'] = true;
             $defaults['weighting[1]'] = 10;
             $defaults['answer[2]'] = get_lang('DefaultMultipleAnswer1');
             $defaults['comment[2]'] = get_lang('DefaultMultipleComment1');
             $defaults['correct[2]'] = false;
         }
         $renderer =& $form->defaultRenderer();
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'correct[' . $i . ']');
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'counter[' . $i . ']');
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'answer[' . $i . ']');
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'comment[' . $i . ']');
         $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"');
         $answer_number->freeze();
         $form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox" style="margin-left: 0em;"');
         $boxes_names[] = 'correct[' . $i . ']';
         $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
         $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
         $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
         $form->addHtml('</tr>');
     }
     $form->addElement('html', '</tbody></table>');
     $form->add_multiple_required_rule($boxes_names, get_lang('ChooseAtLeastOneCheckbox'), 'multiple_required');
     //only 1 answer the all deal ...
     $form->addText('weighting[1]', get_lang('Score'), false, ['value' => 10]);
     global $text;
     //ie6 fix
     if ($obj_ex->edit_exercise_in_lp == true) {
         // setting the save button here and not in the question class.php
         $buttonGroup = [$form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true), $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true), $form->addButtonSave($text, 'submitQuestion', true)];
         $form->addGroup($buttonGroup);
     }
     $defaults['correct'] = $correct;
     if (!empty($this->id)) {
         $form->setDefaults($defaults);
     } else {
         if ($this->isContent == 1) {
             $form->setDefaults($defaults);
         }
     }
     $form->setConstants(array('nb_answers' => $nb_answers));
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:88,代码来源:multiple_answer_combination.class.php

示例3: createAnswersForm

 /**
  * function which redefines Question::createAnswersForm
  * @param FormValidator $form
  */
 public function createAnswersForm($form)
 {
     $defaults = array();
     $nb_matches = $nb_options = 2;
     $matches = array();
     $answer = null;
     $counter = 1;
     if (isset($this->id)) {
         $answer = new Answer($this->id);
         $answer->read();
         if (count($answer->nbrAnswers) > 0) {
             for ($i = 1; $i <= $answer->nbrAnswers; $i++) {
                 $correct = $answer->isCorrect($i);
                 if (empty($correct)) {
                     $matches[$answer->selectAutoId($i)] = chr(64 + $counter);
                     $counter++;
                 }
             }
         }
     }
     if ($form->isSubmitted()) {
         $nb_matches = $form->getSubmitValue('nb_matches');
         $nb_options = $form->getSubmitValue('nb_options');
         if (isset($_POST['lessOptions'])) {
             $nb_matches--;
             $nb_options--;
         }
         if (isset($_POST['moreOptions'])) {
             $nb_matches++;
             $nb_options++;
         }
     } else {
         if (!empty($this->id)) {
             if (count($answer->nbrAnswers) > 0) {
                 $nb_matches = $nb_options = 0;
                 for ($i = 1; $i <= $answer->nbrAnswers; $i++) {
                     if ($answer->isCorrect($i)) {
                         $nb_matches++;
                         $defaults['answer[' . $nb_matches . ']'] = $answer->selectAnswer($i);
                         $defaults['weighting[' . $nb_matches . ']'] = float_format($answer->selectWeighting($i), 1);
                         $defaults['matches[' . $nb_matches . ']'] = $answer->correct[$i];
                     } else {
                         $nb_options++;
                         $defaults['option[' . $nb_options . ']'] = $answer->selectAnswer($i);
                     }
                 }
             }
         } else {
             $defaults['answer[1]'] = get_lang('DefaultMakeCorrespond1');
             $defaults['answer[2]'] = get_lang('DefaultMakeCorrespond2');
             $defaults['matches[2]'] = '2';
             $defaults['option[1]'] = get_lang('DefaultMatchingOptA');
             $defaults['option[2]'] = get_lang('DefaultMatchingOptB');
         }
     }
     if (empty($matches)) {
         for ($i = 1; $i <= $nb_options; ++$i) {
             // fill the array with A, B, C.....
             $matches[$i] = chr(64 + $i);
         }
     } else {
         for ($i = $counter; $i <= $nb_options; ++$i) {
             // fill the array with A, B, C.....
             $matches[$i] = chr(64 + $i);
         }
     }
     $form->addElement('hidden', 'nb_matches', $nb_matches);
     $form->addElement('hidden', 'nb_options', $nb_options);
     // DISPLAY MATCHES
     $html = '<table class="table table-striped table-hover">
         <thead>
             <tr>
                 <th width="5%">' . get_lang('Number') . '</th>
                 <th width="70%">' . get_lang('Answer') . '</th>
                 <th width="15%">' . get_lang('MatchesTo') . '</th>
                 <th width="10%">' . get_lang('Weighting') . '</th>
             </tr>
         </thead>
         <tbody>';
     $form->addHeader(get_lang('MakeCorrespond'));
     $form->addHtml($html);
     if ($nb_matches < 1) {
         $nb_matches = 1;
         Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer'));
     }
     for ($i = 1; $i <= $nb_matches; ++$i) {
         $renderer =& $form->defaultRenderer();
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->{element}</td>', "answer[{$i}]");
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->{element}</td>', "matches[{$i}]");
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->{element}</td>', "weighting[{$i}]");
         $form->addHtml('<tr>');
         $form->addHtml("<td>{$i}</td>");
         $form->addText("answer[{$i}]", null);
         $form->addSelect("matches[{$i}]", null, $matches);
         $form->addText("weighting[{$i}]", null, true, ['value' => 10]);
         $form->addHtml('</tr>');
//.........这里部分代码省略.........
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:matching.class.php

示例4: createAnswersForm

 /**
  * function which redefines Question::createAnswersForm
  * @param FormValidator $form
  */
 public function createAnswersForm($form)
 {
     // Getting the exercise list
     $obj_ex = Session::read('objExercise');
     $editor_config = array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '125');
     //this line defines how many questions by default appear when creating a choice question
     // The previous default value was 2. See task #1759.
     $nb_answers = isset($_POST['nb_answers']) ? (int) $_POST['nb_answers'] : 4;
     $nb_answers += isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0);
     /*
      Types of Feedback
      $feedback_option[0]=get_lang('Feedback');
      $feedback_option[1]=get_lang('DirectFeedback');
      $feedback_option[2]=get_lang('NoFeedback');
     */
     $feedback_title = '';
     if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
         //Scenario
         $comment_title = '<th width="20%">' . get_lang('Comment') . '</th>';
         $feedback_title = '<th width="20%">' . get_lang('Scenario') . '</th>';
     } else {
         $comment_title = '<th width="40%">' . get_lang('Comment') . '</th>';
     }
     $html = '<table class="table table-striped table-hover">
         <thead>
             <tr style="text-align: center;">
                 <th width="5%">' . get_lang('Number') . '</th>
                 <th width="5%"> ' . get_lang('True') . '</th>
                 <th width="40%">' . get_lang('Answer') . '</th>
                     ' . $comment_title . '
                     ' . $feedback_title . '
                 <th width="10%">' . get_lang('Weighting') . '</th>
             </tr>
         </thead>
         <tbody>';
     $form->addHeader(get_lang('Answers'));
     $form->addHtml($html);
     $defaults = array();
     $correct = 0;
     if (!empty($this->id)) {
         $answer = new Answer($this->id);
         $answer->read();
         if (count($answer->nbrAnswers) > 0 && !$form->isSubmitted()) {
             $nb_answers = $answer->nbrAnswers;
         }
     }
     $form->addElement('hidden', 'nb_answers');
     //Feedback SELECT
     $question_list = $obj_ex->selectQuestionList();
     $select_question = array();
     $select_question[0] = get_lang('SelectTargetQuestion');
     if (is_array($question_list)) {
         foreach ($question_list as $key => $questionid) {
             //To avoid warning messages
             if (!is_numeric($questionid)) {
                 continue;
             }
             $question = Question::read($questionid);
             $select_question[$questionid] = 'Q' . $key . ' :' . cut($question->selectTitle(), 20);
         }
     }
     $select_question[-1] = get_lang('ExitTest');
     $list = new LearnpathList(api_get_user_id());
     $flat_list = $list->get_flat_list();
     $select_lp_id = array();
     $select_lp_id[0] = get_lang('SelectTargetLP');
     foreach ($flat_list as $id => $details) {
         $select_lp_id[$id] = cut($details['lp_name'], 20);
     }
     $temp_scenario = array();
     if ($nb_answers < 1) {
         $nb_answers = 1;
         Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer'));
     }
     for ($i = 1; $i <= $nb_answers; ++$i) {
         $form->addHtml('<tr>');
         if (isset($answer) && is_object($answer)) {
             if ($answer->correct[$i]) {
                 $correct = $i;
             }
             $defaults['answer[' . $i . ']'] = $answer->answer[$i];
             $defaults['comment[' . $i . ']'] = $answer->comment[$i];
             $defaults['weighting[' . $i . ']'] = float_format($answer->weighting[$i], 1);
             $item_list = explode('@@', $answer->destination[$i]);
             $try = isset($item_list[0]) ? $item_list[0] : '';
             $lp = isset($item_list[1]) ? $item_list[1] : '';
             $list_dest = isset($item_list[2]) ? $item_list[2] : '';
             $url = isset($item_list[3]) ? $item_list[3] : '';
             if ($try == 0) {
                 $try_result = 0;
             } else {
                 $try_result = 1;
             }
             if ($url == 0) {
                 $url_result = '';
             } else {
//.........这里部分代码省略.........
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:101,代码来源:unique_answer.class.php

示例5: array

if (isset($_POST['form_sent']) && $_POST['form_sent']) {
    $form_sent = $_POST['form_sent'];
    $elements_posted = $_POST['elements_in_name'];
    if (!is_array($elements_posted)) {
        $elements_posted = array();
    }
    if ($form_sent == 1) {
        $usergroup->subscribe_courses_to_usergroup($id, $elements_posted);
        header('Location: usergroups.php');
        exit;
    }
}
// Filters
$filters = array(array('type' => 'text', 'name' => 'code', 'label' => get_lang('CourseCode')), array('type' => 'text', 'name' => 'title', 'label' => get_lang('Title')));
$searchForm = new FormValidator('search', 'get', api_get_self() . '?id=' . $id);
$searchForm->addHeader(get_lang('AdvancedSearch'));
$renderer =& $searchForm->defaultRenderer();
$searchForm->addElement('hidden', 'id', $id);
foreach ($filters as $param) {
    $searchForm->addElement($param['type'], $param['name'], $param['label']);
}
$searchForm->addButtonSearch();
$filterData = array();
if ($searchForm->validate()) {
    $filterData = $searchForm->getSubmitValues();
}
$conditions = array();
if (!empty($filters) && !empty($filterData)) {
    foreach ($filters as $filter) {
        if (isset($filter['name']) && isset($filterData[$filter['name']])) {
            $value = $filterData[$filter['name']];
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:add_courses_to_usergroup.php

示例6: build_work_move_to_selector

/**
 * Builds the form thats enables the user to
 * move a document from one directory to another
 * This function has been copied from the document/document.inc.php library
 *
 * @param array $folders
 * @param string $curdirpath
 * @param string $move_file
 * @param string $group_dir
 * @return string html form
 */
function build_work_move_to_selector($folders, $curdirpath, $move_file, $group_dir = '')
{
    $course_id = api_get_course_int_id();
    $move_file = intval($move_file);
    $tbl_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
    $sql = "SELECT title, url FROM {$tbl_work}\n            WHERE c_id = {$course_id} AND id ='" . $move_file . "'";
    $result = Database::query($sql);
    $row = Database::fetch_array($result, 'ASSOC');
    $title = empty($row['title']) ? basename($row['url']) : $row['title'];
    $form = new FormValidator('move_to_form', 'post', api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . Security::remove_XSS($curdirpath));
    $form->addHeader(get_lang('MoveFile') . ' - ' . Security::remove_XSS($title));
    $form->addHidden('item_id', $move_file);
    $form->addHidden('action', 'move_to');
    //group documents cannot be uploaded in the root
    if ($group_dir == '') {
        if ($curdirpath != '/') {
            //$form .= '<option value="0">/ ('.get_lang('Root').')</option>';
        }
        if (is_array($folders)) {
            foreach ($folders as $fid => $folder) {
                //you cannot move a file to:
                //1. current directory
                //2. inside the folder you want to move
                //3. inside a subfolder of the folder you want to move
                if ($curdirpath != $folder && $folder != $move_file && substr($folder, 0, strlen($move_file) + 1) != $move_file . '/') {
                    //$form .= '<option value="'.$fid.'">'.$folder.'</option>';
                    $options[$fid] = $folder;
                }
            }
        }
    } else {
        if ($curdirpath != '/') {
            $form .= '<option value="0">/ (' . get_lang('Root') . ')</option>';
        }
        foreach ($folders as $fid => $folder) {
            if ($curdirpath != $folder && $folder != $move_file && substr($folder, 0, strlen($move_file) + 1) != $move_file . '/') {
                //cannot copy dir into his own subdir
                $display_folder = substr($folder, strlen($group_dir));
                $display_folder = $display_folder == '' ? '/ (' . get_lang('Root') . ')' : $display_folder;
                //$form .= '<option value="'.$fid.'">'.$display_folder.'</option>'."\n";
                $options[$fid] = $display_folder;
            }
        }
    }
    $form->addSelect('move_to_id', get_lang('Select'), $options);
    $form->addButtonSend(get_lang('MoveFile'), 'move_file_submit');
    return $form->returnForm();
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:59,代码来源:work.lib.php

示例7: FormValidator

 */
$cidReset = true;
require_once '../../../main/inc/global.inc.php';
$plugin = BuyCoursesPlugin::create();
$includeSessions = $plugin->get('include_sessions') === 'true';
$nameFilter = null;
$minFilter = 0;
$maxFilter = 0;
$form = new FormValidator('search_filter_form', 'get', null, null, [], FormValidator::LAYOUT_INLINE);
if ($form->validate()) {
    $formValues = $form->getSubmitValues();
    $nameFilter = isset($formValues['name']) ? $formValues['name'] : null;
    $minFilter = isset($formValues['min']) ? $formValues['min'] : 0;
    $maxFilter = isset($formValues['max']) ? $formValues['max'] : 0;
}
$form->addHeader($plugin->get_lang('SearchFilter'));
$form->addText('name', get_lang('SessionName'), false);
$form->addElement('number', 'min', $plugin->get_lang('MinimumPrice'), ['step' => '0.01', 'min' => '0']);
$form->addElement('number', 'max', $plugin->get_lang('MaximumPrice'), ['step' => '0.01', 'min' => '0']);
$form->addHtml('<hr>');
$form->addButtonFilter(get_lang('Search'));
$courseList = $plugin->getCatalogCourseList($nameFilter, $minFilter, $maxFilter);
//View
if (api_is_platform_admin()) {
    $interbreadcrumb[] = ['url' => 'configuration.php', 'name' => $plugin->get_lang('AvailableCoursesConfiguration')];
    $interbreadcrumb[] = ['url' => 'paymentsetup.php', 'name' => $plugin->get_lang('PaymentsConfiguration')];
} else {
    $interbreadcrumb[] = ['url' => 'course_panel.php', 'name' => get_lang('TabsDashboard')];
}
$templateName = $plugin->get_lang('CourseListOnSale');
$tpl = new Template($templateName);
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:course_catalog.php

示例8: 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();
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:35,代码来源:blog.lib.php

示例9: createAnswersForm

 /**
  * Function which redefines Question::createAnswersForm
  * @param FormValidator $form
  */
 public function createAnswersForm($form)
 {
     $defaults = array();
     $nb_matches = $nb_options = 2;
     $matches = array();
     $answer = null;
     if ($form->isSubmitted()) {
         $nb_matches = $form->getSubmitValue('nb_matches');
         $nb_options = $form->getSubmitValue('nb_options');
         if (isset($_POST['lessMatches'])) {
             $nb_matches--;
         }
         if (isset($_POST['moreMatches'])) {
             $nb_matches++;
         }
         if (isset($_POST['lessOptions'])) {
             $nb_options--;
         }
         if (isset($_POST['moreOptions'])) {
             $nb_options++;
         }
     } else {
         if (!empty($this->id)) {
             $answer = new Answer($this->id);
             $answer->read();
             if (count($answer->nbrAnswers) > 0) {
                 $nb_matches = $nb_options = 0;
                 for ($i = 1; $i <= $answer->nbrAnswers; $i++) {
                     if ($answer->isCorrect($i)) {
                         $nb_matches++;
                         $defaults['answer[' . $nb_matches . ']'] = $answer->selectAnswer($i);
                         $defaults['weighting[' . $nb_matches . ']'] = float_format($answer->selectWeighting($i), 1);
                         $answerInfo = $answer->getAnswerByAutoId($answer->correct[$i]);
                         $defaults['matches[' . $nb_matches . ']'] = isset($answerInfo['answer']) ? $answerInfo['answer'] : '';
                     } else {
                         $nb_options++;
                         $defaults['option[' . $nb_options . ']'] = $answer->selectAnswer($i);
                     }
                 }
             }
         } else {
             $defaults['answer[1]'] = get_lang('DefaultMakeCorrespond1');
             $defaults['answer[2]'] = get_lang('DefaultMakeCorrespond2');
             $defaults['matches[2]'] = '2';
             $defaults['option[1]'] = get_lang('DefaultMatchingOptA');
             $defaults['option[2]'] = get_lang('DefaultMatchingOptB');
         }
     }
     for ($i = 1; $i <= $nb_matches; ++$i) {
         $matches[$i] = $i;
     }
     $form->addElement('hidden', 'nb_matches', $nb_matches);
     $form->addElement('hidden', 'nb_options', $nb_options);
     // DISPLAY MATCHES
     $html = '<table class="table table-striped table-hover">
         <thead>
             <tr>
                 <th width="85%">' . get_lang('Answer') . '</th>
                 <th width="15%">' . get_lang('MatchesTo') . '</th>
                 <th width="10">' . get_lang('Weighting') . '</th>
             </tr>
         </thead>
         <tbody>';
     $form->addHeader(get_lang('MakeCorrespond'));
     $form->addHtml($html);
     if ($nb_matches < 1) {
         $nb_matches = 1;
         Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer'));
     }
     for ($i = 1; $i <= $nb_matches; ++$i) {
         $renderer =& $form->defaultRenderer();
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->{element}</td>', "answer[{$i}]");
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->{element}</td>', "matches[{$i}]");
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->{element}</td>', "weighting[{$i}]");
         $form->addHtml('<tr>');
         $form->addText("answer[{$i}]", null);
         $form->addSelect("matches[{$i}]", null, $matches);
         $form->addText("weighting[{$i}]", null, true, ['value' => 10, 'style' => 'width: 60px;']);
         $form->addHtml('</tr>');
     }
     $form->addHtml('</tbody></table>');
     $renderer->setElementTemplate('<div class="form-group"><div class="col-sm-offset-2">{element}', 'lessMatches');
     $renderer->setElementTemplate('{element}</div></div>', 'moreMatches');
     global $text;
     $group = [$form->addButtonDelete(get_lang('DelElem'), 'lessMatches', true), $form->addButtonCreate(get_lang('AddElem'), 'moreMatches', true), $form->addButtonSave($text, 'submitQuestion', true)];
     $form->addGroup($group);
     if (!empty($this->id)) {
         $form->setDefaults($defaults);
     } else {
         if ($this->isContent == 1) {
             $form->setDefaults($defaults);
         }
     }
     $form->setConstants(['nb_matches' => $nb_matches, 'nb_options' => $nb_options]);
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:99,代码来源:Draggable.php

示例10: FormValidator

    $skillDefaultInfo['gradebook_id'][] = $gradebook['id'];
}
$skillList = [0 => get_lang('None')];
$gradebookList = [];
foreach ($allSkills as $skill) {
    if ($skill['id'] == $skillInfo['id']) {
        continue;
    }
    $skillList[$skill['id']] = $skill['name'];
}
foreach ($allGradebooks as $gradebook) {
    $gradebookList[$gradebook['id']] = $gradebook['name'];
}
/* Form */
$editForm = new FormValidator('skill_edit');
$editForm->addHeader(get_lang('SkillEdit'));
$editForm->addText('name', get_lang('Name'), true, ['id' => 'name']);
$editForm->addText('short_code', get_lang('ShortCode'), false, ['id' => 'short_code']);
$editForm->addSelect('parent_id', get_lang('Parent'), $skillList, ['id' => 'parent_id']);
$editForm->addSelect('gradebook_id', [get_lang('Gradebook'), get_lang('WithCertificate')], $gradebookList, ['id' => 'gradebook_id', 'multiple' => 'multiple', 'size' => 10]);
$editForm->addTextarea('description', get_lang('Description'), ['id' => 'description', 'rows' => 7]);
$editForm->addButtonSave(get_lang('Save'));
$editForm->addHidden('id', null);
$editForm->setDefaults($skillDefaultInfo);
if ($editForm->validate()) {
    $updated = $objSkill->edit($editForm->getSubmitValues());
    if ($updated) {
        Session::write('message', Display::return_message(get_lang('TheSkillHasBeenUpdated'), 'success'));
    } else {
        Session::write('message', Display::return_message(get_lang('CannotUpdateSkill'), 'error'));
    }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:skill_edit.php

示例11: header

     $currentUrl = api_get_self() . '?' . api_get_cidreq();
     Display::addFlash(Display::return_message(get_lang('Updated')));
     CourseHome::deleteIcon($id);
     header('Location: ' . $currentUrl);
     exit;
     break;
 case 'edit_icon':
     $tool = CourseHome::getTool($id);
     if (empty($tool)) {
         api_not_allowed(true);
     }
     $interbreadcrumb[] = array('url' => api_get_self() . '?' . api_get_cidreq(), 'name' => get_lang('CustomizeIcons'));
     $toolName = $tool['name'];
     $currentUrl = api_get_self() . '?action=edit_icon&id=' . $id . '&' . api_get_cidreq();
     $form = new FormValidator('icon_edit', 'post', $currentUrl);
     $form->addHeader(get_lang('EditIcon'));
     $form->addHtml('<div class="col-md-7">');
     $form->addText('name', get_lang('Name'));
     $form->addText('link', get_lang('Links'));
     $allowed_picture_types = array('jpg', 'jpeg', 'png');
     $form->addFile('icon', get_lang('CustomIcon'));
     $form->addRule('icon', get_lang('OnlyImagesAllowed') . ' (' . implode(',', $allowed_picture_types) . ')', 'filetype', $allowed_picture_types);
     $form->addSelect('target', get_lang('LinkTarget'), ['_self' => get_lang('LinkOpenSelf'), '_blank' => get_lang('LinkOpenBlank')]);
     $form->addSelect('visibility', get_lang('Visibility'), array(1 => get_lang('Visible'), 0 => get_lang('Invisible')));
     $form->addTextarea('description', get_lang('Description'), array('rows' => '3', 'cols' => '40'));
     $form->addButtonUpdate(get_lang('Update'));
     $form->addHtml('</div>');
     $form->addHtml('<div class="col-md-5">');
     if (isset($tool['custom_icon']) && !empty($tool['custom_icon'])) {
         $form->addLabel(get_lang('CurrentIcon'), Display::img(CourseHome::getCustomWebIconPath() . $tool['custom_icon']));
         $form->addCheckBox('delete_icon', null, get_lang('DeletePicture'));
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:tools.php

示例12: display_student_publication_form

 /**
  * Return HTML form to add/edit a student publication (work)
  * @param	string	Action (add/edit)
  * @param	integer	Item ID if already exists
  * @param	mixed	Extra info (work ID if integer)
  * @return	string	HTML form
  */
 public function display_student_publication_form($action = 'add', $id = 0, $extra_info = '')
 {
     $course_id = api_get_course_int_id();
     $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
     $tbl_publication = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
     if ($id != 0 && is_array($extra_info)) {
         $item_title = stripslashes($extra_info['title']);
         $item_description = stripslashes($extra_info['description']);
     } elseif (is_numeric($extra_info)) {
         $extra_info = intval($extra_info);
         $sql = "SELECT title, description\n                    FROM " . $tbl_publication . "\n                    WHERE c_id = " . $course_id . " AND id = " . $extra_info;
         $result = Database::query($sql);
         $row = Database::fetch_array($result);
         $item_title = $row['title'];
     } else {
         $item_title = get_lang('Student_publication');
     }
     if ($id != 0 && is_array($extra_info)) {
         $parent = $extra_info['parent_item_id'];
     } else {
         $parent = 0;
     }
     $sql = "SELECT * FROM " . $tbl_lp_item . "\n                WHERE c_id = " . $course_id . " AND lp_id = " . $this->lp_id;
     $result = Database::query($sql);
     $arrLP = array();
     while ($row = Database::fetch_array($result)) {
         $arrLP[] = array('id' => $row['id'], 'item_type' => $row['item_type'], 'title' => $row['title'], 'path' => $row['path'], 'description' => $row['description'], 'parent_item_id' => $row['parent_item_id'], 'previous_item_id' => $row['previous_item_id'], 'next_item_id' => $row['next_item_id'], 'display_order' => $row['display_order'], 'max_score' => $row['max_score'], 'min_score' => $row['min_score'], 'mastery_score' => $row['mastery_score'], 'prerequisite' => $row['prerequisite']);
     }
     $this->tree_array($arrLP);
     $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
     unset($this->arrMenu);
     $form = new FormValidator('frm_student_publication', 'post', '#');
     if ($action == 'add') {
         $form->addHeader(get_lang('Student_publication'));
     } elseif ($action == 'move') {
         $form->addHeader(get_lang('MoveCurrentStudentPublication'));
     } else {
         $form->addHeader(get_lang('EditCurrentStudentPublication'));
     }
     if ($action != 'move') {
         $form->addText('title', get_lang('Title'), true, ['class' => 'learnpath_item_form', 'id' => 'idTitle']);
     }
     $parentSelect = $form->addSelect('parent', get_lang('Parent'), ['0' => $this->name], ['onchange' => 'javascript: load_cbo(this.value);', 'class' => 'learnpath_item_form', 'id' => 'idParent']);
     $arrHide = array($id);
     for ($i = 0; $i < count($arrLP); $i++) {
         if ($action != 'add') {
             if (($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) {
                 $parentSelect->addOption($arrLP[$i]['title'], $arrLP[$i]['id'], ['style' => 'padding-left: ' . ($arrLP[$i]['depth'] * 10 + 20) . 'px;']);
                 if ($parent == $arrLP[$i]['id']) {
                     $parentSelect->setSelected($arrLP[$i]['id']);
                 }
             } else {
                 $arrHide[] = $arrLP[$i]['id'];
             }
         } else {
             if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
                 $parentSelect->addOption($arrLP[$i]['title'], $arrLP[$i]['id'], ['style' => 'padding-left: ' . ($arrLP[$i]['depth'] * 10 + 20) . 'px;']);
                 if ($parent == $arrLP[$i]['id']) {
                     $parentSelect->setSelected($arrLP[$i]['id']);
                 }
             }
         }
     }
     if (is_array($arrLP)) {
         reset($arrLP);
     }
     $previousSelect = $form->addSelect('previous', get_lang('Position'), ['0' => get_lang('FirstPosition')], ['id' => 'previous', 'class' => 'learnpath_item_form']);
     for ($i = 0; $i < count($arrLP); $i++) {
         if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
             $previousSelect->addOption(get_lang('After') . ' "' . $arrLP[$i]['title'] . '"', $arrLP[$i]['id']);
             if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
                 $previousSelect->setSelected($arrLP[$i]['id']);
             } elseif ($action == 'add') {
                 $previousSelect->setSelected($arrLP[$i]['id']);
             }
         }
     }
     if ($action != 'move') {
         $id_prerequisite = 0;
         if (is_array($arrLP)) {
             foreach ($arrLP as $key => $value) {
                 if ($value['id'] == $id) {
                     $id_prerequisite = $value['prerequisite'];
                     break;
                 }
             }
         }
         $arrHide = array();
         for ($i = 0; $i < count($arrLP); $i++) {
             if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
                     $s_selected_position = $arrLP[$i]['id'];
                 } elseif ($action == 'add') {
//.........这里部分代码省略.........
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:101,代码来源:learnpath.class.php

示例13: createAnswersForm

 /**
  * function which redefines Question::createAnswersForm
  * @param FormValidator $form
  */
 public function createAnswersForm($form)
 {
     $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4;
     // The previous default value was 2. See task #1759.
     $nb_answers += isset($_POST['lessAnswers']) ? -1 : isset($_POST['moreAnswers']) ? 1 : 0;
     $course_id = api_get_course_int_id();
     $obj_ex = $_SESSION['objExercise'];
     $renderer =& $form->defaultRenderer();
     $defaults = array();
     $html = '<table class="table table-striped table-hover">';
     $html .= '<thead>';
     $html .= '<tr>';
     $html .= '<th>' . get_lang('Number') . '</th>';
     $html .= '<th>' . get_lang('True') . '</th>';
     $html .= '<th>' . get_lang('False') . '</th>';
     $html .= '<th>' . get_lang('Answer') . '</th>';
     // show column comment when feedback is enable
     if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
         $html .= '<th>' . get_lang('Comment') . '</th>';
     }
     $html .= '</tr>';
     $html .= '</thead>';
     $html .= '<tbody>';
     $form->addHeader(get_lang('Answers'));
     $form->addHtml($html);
     $correct = 0;
     $answer = null;
     if (!empty($this->id)) {
         $answer = new Answer($this->id);
         $answer->read();
         if (count($answer->nbrAnswers) > 0 && !$form->isSubmitted()) {
             $nb_answers = $answer->nbrAnswers;
         }
     }
     $form->addElement('hidden', 'nb_answers');
     $boxes_names = array();
     if ($nb_answers < 1) {
         $nb_answers = 1;
         Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer'));
     }
     // Can be more options
     $option_data = Question::readQuestionOption($this->id, $course_id);
     for ($i = 1; $i <= $nb_answers; ++$i) {
         $form->addHtml('<tr>');
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'correct[' . $i . ']');
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'counter[' . $i . ']');
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'answer[' . $i . ']');
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'comment[' . $i . ']');
         $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"');
         $answer_number->freeze();
         if (is_object($answer)) {
             $defaults['answer[' . $i . ']'] = $answer->answer[$i];
             $defaults['comment[' . $i . ']'] = $answer->comment[$i];
             $correct = $answer->correct[$i];
             $defaults['correct[' . $i . ']'] = $correct;
             $j = 1;
             if (!empty($option_data)) {
                 foreach ($option_data as $id => $data) {
                     $form->addElement('radio', 'correct[' . $i . ']', null, null, $id);
                     $j++;
                     if ($j == 3) {
                         break;
                     }
                 }
             }
         } else {
             $form->addElement('radio', 'correct[' . $i . ']', null, null, 1);
             $form->addElement('radio', 'correct[' . $i . ']', null, null, 2);
             $defaults['answer[' . $i . ']'] = '';
             $defaults['comment[' . $i . ']'] = '';
             $defaults['correct[' . $i . ']'] = '';
         }
         $boxes_names[] = 'correct[' . $i . ']';
         $form->addHtmlEditor("answer[{$i}]", get_lang('ThisFieldIsRequired'), true, true, ['ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100']);
         // show comment when feedback is enable
         if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
             $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
         }
         $form->addHtml('</tr>');
     }
     $form->addHtml('</tbody></table>');
     $correctInputTemplate = '<div class="form-group">';
     $correctInputTemplate .= '<label class="col-sm-2 control-label">';
     $correctInputTemplate .= '<span class="form_required">*</span>' . get_lang('Score');
     $correctInputTemplate .= '</label>';
     $correctInputTemplate .= '<div class="col-sm-8">';
     $correctInputTemplate .= '<table>';
     $correctInputTemplate .= '<tr>';
     $correctInputTemplate .= '<td>';
     $correctInputTemplate .= get_lang('Correct') . '{element}';
     $correctInputTemplate .= '<!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->';
     $correctInputTemplate .= '</td>';
     $wrongInputTemplate = '<td>';
     $wrongInputTemplate .= get_lang('Wrong') . '{element}';
     $wrongInputTemplate .= '<!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->';
     $wrongInputTemplate .= '</td>';
//.........这里部分代码省略.........
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:101,代码来源:multiple_answer_true_false.class.php

示例14: createAnswersForm

 /**
  * function which redifines Question::createAnswersForm
  * @param FormValidator $form
  * @param the answers number to display
  */
 function createAnswersForm($form)
 {
     // getting the exercise list
     $obj_ex = Session::read('objExercise');
     $editor_config = array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '125');
     //this line define how many question by default appear when creating a choice question
     $nb_answers = isset($_POST['nb_answers']) ? (int) $_POST['nb_answers'] : 3;
     // The previous default value was 2. See task #1759.
     $nb_answers += isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0);
     /*
      Types of Feedback
      $feedback_option[0]=get_lang('Feedback');
      $feedback_option[1]=get_lang('DirectFeedback');
      $feedback_option[2]=get_lang('NoFeedback');
     */
     $feedback_title = '';
     $comment_title = '';
     if ($obj_ex->selectFeedbackType() == 1) {
         $editor_config['Width'] = '250';
         $editor_config['Height'] = '110';
         $comment_title = '<th width="50%" >' . get_lang('Comment') . '</th>';
         $feedback_title = '<th width="50%" >' . get_lang('Scenario') . '</th>';
     } else {
         $comment_title = '<th width="50%">' . get_lang('Comment') . '</th>';
     }
     $html = '<table class="table table-striped table-hover">';
     $html .= '<thead>';
     $html .= '<tr>';
     $html .= '<th>' . get_lang('Number') . '</th>';
     $html .= '<th>' . get_lang('True') . '</th>';
     $html .= '<th width="50%">' . get_lang('Answer') . '</th>';
     $html .= $comment_title . $feedback_title;
     $html .= '<th>' . get_lang('Weighting') . '</th>';
     $html .= '</tr>';
     $html .= '</thead>';
     $html .= '<tbody>';
     $form->addHeader(get_lang('Answers'));
     $form->addHtml($html);
     $defaults = array();
     $correct = 0;
     $answer = false;
     if (!empty($this->id)) {
         $answer = new Answer($this->id);
         $answer->read();
         if (count($answer->nbrAnswers) > 0 && !$form->isSubmitted()) {
             $nb_answers = $answer->nbrAnswers;
         }
     }
     $temp_scenario = array();
     if ($nb_answers < 1) {
         $nb_answers = 1;
         Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer'));
     }
     $editQuestion = isset($_GET['editQuestion']) ? $_GET['editQuestion'] : false;
     if ($editQuestion) {
         //fixing $nb_answers
         $new_list = array();
         $count = 1;
         if (isset($_POST['lessAnswers'])) {
             $lessFromSession = Session::read('less_answer');
             if (!isset($lessFromSession)) {
                 Session::write('less_answer', $this->id);
                 $nb_answers--;
             }
         }
         for ($k = 1; $k <= $nb_answers; ++$k) {
             if ($answer->position[$k] != '666') {
                 $new_list[$count] = $count;
                 $count++;
             }
         }
     } else {
         for ($k = 1; $k <= $nb_answers; ++$k) {
             $new_list[$k] = $k;
         }
     }
     $i = 1;
     //for ($k = 1 ; $k <= $real_nb_answers; $k++) {
     foreach ($new_list as $key) {
         $i = $key;
         $form->addElement('html', '<tr>');
         if (is_object($answer)) {
             if ($answer->position[$i] == 666) {
                 //we set nothing
             } else {
                 if ($answer->correct[$i]) {
                     $correct = $i;
                 }
                 $answer_result = $answer->answer[$i];
                 $weight_result = float_format($answer->weighting[$i], 1);
                 if ($nb_answers == $i) {
                     $weight_result = '0';
                 }
                 $defaults['answer[' . $i . ']'] = $answer_result;
                 $defaults['comment[' . $i . ']'] = $answer->comment[$i];
//.........这里部分代码省略.........
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:unique_answer_no_option.class.php

示例15: saveThreadScore

     Display::display_error_message(get_lang('QualificationCanNotBeGreaterThanMaxScore'), false);
 }
 if (!empty($score)) {
     $saveResult = saveThreadScore($currentThread, $userIdToQualify, $threadId, $score, api_get_utc_datetime(), api_get_session_id());
 }
 // show qualifications history
 $type = isset($_GET['type']) ? $_GET['type'] : '';
 $historyList = getThreadScoreHistory($userIdToQualify, $threadId, $type);
 $counter = count($historyList);
 // Show current qualify in my form
 $qualify = current_qualify_of_thread($threadId, api_get_session_id(), $_GET['user']);
 $result = get_statistical_information($threadId, $_GET['user_id'], api_get_course_int_id());
 $url = api_get_path(WEB_CODE_PATH) . 'forum/forumqualify.php?' . api_get_cidreq() . '&forum=' . intval($_GET['forum']) . '&thread=' . $threadId . '&user=' . intval($_GET['user']) . '&user_id=' . intval($_GET['user']);
 $userToQualifyInfo = api_get_user_info($userIdToQualify);
 $form = new FormValidator('forum-thread-qualify', 'post', $url);
 $form->addHeader($userToQualifyInfo['complete_name']);
 $form->addLabel(get_lang('Thread'), $currentThread['thread_title']);
 $form->addLabel(get_lang('CourseUsers'), $result['user_course']);
 $form->addLabel(get_lang('PostsNumber'), $result['post']);
 $form->addLabel(get_lang('NumberOfPostsForThisUser'), $result['user_post']);
 $form->addLabel(get_lang('AveragePostPerUser'), round($result['user_post'] / $result['post'], 2));
 $form->addText('idtextqualify', array(get_lang('Qualification'), get_lang('MaxScore') . ' ' . $maxQualify), $qualify);
 include 'viewpost.inc.php';
 $form->addButtonSave(get_lang('QualifyThisThread'));
 $form->setDefaults(array('idtextqualify' => $qualify));
 $form->display();
 // Show past data
 if (api_is_allowed_to_edit() && $counter > 0) {
     if (isset($_GET['gradebook'])) {
         $view_gradebook = '&gradebook=view';
     }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:forumqualify.php


注:本文中的FormValidator::addHeader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。