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


PHP FormValidator::addButtonSave方法代码示例

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


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

示例1: createAnswersForm

 /**
  * function which redefine Question::createAnswersForm
  * @param FormValidator $form
  */
 function createAnswersForm($form)
 {
     $form->addElement('text', 'weighting', get_lang('Weighting'), array('class' => 'span1'));
     global $text, $class;
     // setting the save button here and not in the question class.php
     $form->addButtonSave($text, 'submitQuestion');
     if (!empty($this->id)) {
         $form->setDefaults(array('weighting' => float_format($this->weighting, 1)));
     } else {
         if ($this->isContent == 1) {
             $form->setDefaults(array('weighting' => '10'));
         }
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:18,代码来源:oral_expression.class.php

示例2: edit_category_form

/**
 * Form to edit a category
 * @todo move to TestCategory.class.php
 * @param string $action
 */
function edit_category_form($action)
{
    $action = Security::remove_XSS($action);
    if (isset($_GET['category_id']) && is_numeric($_GET['category_id'])) {
        $category_id = Security::remove_XSS($_GET['category_id']);
        $objcat = new TestCategory($category_id);
        $form = new FormValidator('note', 'post', api_get_self() . '?action=' . $action . '&category_id=' . $category_id);
        // Setting the form elements
        $form->addElement('header', get_lang('EditCategory'));
        $form->addElement('hidden', 'category_id');
        $form->addElement('text', 'category_name', get_lang('CategoryName'), array('size' => '95'));
        $form->addHtmlEditor('category_description', get_lang('CategoryDescription'), false, false, array('ToolbarSet' => 'test_category', 'Height' => '200'));
        $form->addButtonSave(get_lang('ModifyCategory'), 'SubmitNote');
        // setting the defaults
        $defaults = array();
        $defaults["category_id"] = $objcat->id;
        $defaults["category_name"] = $objcat->name;
        $defaults["category_description"] = $objcat->description;
        $form->setDefaults($defaults);
        // setting the rules
        $form->addRule('category_name', get_lang('ThisFieldIsRequired'), 'required');
        // The validation or display
        if ($form->validate()) {
            $check = Security::check_token('post');
            if ($check) {
                $values = $form->exportValues();
                $v_id = Security::remove_XSS($values['category_id']);
                $v_name = Security::remove_XSS($values['category_name'], COURSEMANAGER);
                $v_description = Security::remove_XSS($values['category_description'], COURSEMANAGER);
                $objcat = new TestCategory($v_id, $v_name, $v_description);
                if ($objcat->modifyCategory()) {
                    Display::display_confirmation_message(get_lang('MofidfyCategoryDone'));
                } else {
                    Display::display_confirmation_message(get_lang('ModifyCategoryError'));
                }
            }
            Security::clear_token();
        } else {
            display_goback();
            $token = Security::get_token();
            $form->addElement('hidden', 'sec_token');
            $form->setConstants(array('sec_token' => $token));
            $form->display();
        }
    } else {
        Display::display_error_message(get_lang('CannotEditCategory'));
    }
}
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:53,代码来源:tests_category.php

示例3: settingsForm

/**
 * Returns a form displaying all options for this tool.
 * These are
 * - make all files visible / invisible
 * - set the default visibility of uploaded files
 * @param $defaults
 * @return string The HTML form
 */
function settingsForm($defaults)
{
    $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
    if (!$is_allowed_to_edit) {
        return;
    }
    $url = api_get_path(WEB_CODE_PATH) . 'work/work.php?' . api_get_cidreq() . '&action=settings';
    $form = new FormValidator('edit_settings', 'post', $url);
    $form->addElement('hidden', 'changeProperties', 1);
    $form->addElement('header', get_lang('EditToolOptions'));
    $group = array($form->createElement('radio', 'show_score', null, get_lang('NewVisible'), 0), $form->createElement('radio', 'show_score', null, get_lang('NewUnvisible'), 1));
    $form->addGroup($group, '', get_lang('DefaultUpload'));
    $group = array($form->createElement('radio', 'student_delete_own_publication', null, get_lang('Yes'), 1), $form->createElement('radio', 'student_delete_own_publication', null, get_lang('No'), 0));
    $form->addGroup($group, '', get_lang('StudentAllowedToDeleteOwnPublication'));
    $form->addButtonSave(get_lang('Save'));
    $form->setDefaults($defaults);
    return $form->returnForm();
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:26,代码来源:work.lib.php

示例4: return_form

 /**
  * Returns a Form validator Obj
  * @param   string  $url
  * @param   string  $action add, edit
  *
  * @return  FormValidator
  */
 public function return_form($url, $action)
 {
     $form = new FormValidator('career', 'post', $url);
     // Setting the form elements
     $header = get_lang('Add');
     if ($action == 'edit') {
         $header = get_lang('Modify');
     }
     $form->addElement('header', $header);
     $id = isset($_GET['id']) ? intval($_GET['id']) : '';
     $form->addElement('hidden', 'id', $id);
     $form->addElement('text', 'name', get_lang('Name'), array('size' => '70'));
     $form->addHtmlEditor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'careers', 'Width' => '100%', 'Height' => '250'));
     $status_list = $this->get_status_list();
     $form->addElement('select', 'status', get_lang('Status'), $status_list);
     if ($action == 'edit') {
         $form->addElement('text', 'created_at', get_lang('CreatedAt'));
         $form->freeze('created_at');
     }
     if ($action == 'edit') {
         $form->addButtonSave(get_lang('Modify'), 'submit');
     } else {
         $form->addButtonCreate(get_lang('Add'), 'submit');
     }
     // Setting the defaults
     $defaults = $this->get($id);
     if (!empty($defaults['created_at'])) {
         $defaults['created_at'] = api_convert_and_format_date($defaults['created_at']);
     }
     if (!empty($defaults['updated_at'])) {
         $defaults['updated_at'] = api_convert_and_format_date($defaults['updated_at']);
     }
     $form->setDefaults($defaults);
     // Setting the rules
     $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
     return $form;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:44,代码来源:event_email_template.class.php

示例5: createForm


//.........这里部分代码省略.........
         }
         $form->addText('enabletimercontroltotalminutes', get_lang('ExerciseTotalDurationInMinutes'), false, ['id' => 'enabletimercontroltotalminutes', 'cols-size' => [2, 2, 8]]);
         $form->addElement('html', '</div>');
         $form->addElement('text', 'pass_percentage', array(get_lang('PassPercentage'), null, '%'), array('id' => 'pass_percentage'));
         $form->addRule('pass_percentage', get_lang('Numeric'), 'numeric');
         // add the text_when_finished textbox
         $form->addHtmlEditor('text_when_finished', get_lang('TextWhenFinished'), false, false, $editor_config);
         $defaults = array();
         if (api_get_setting('search.search_enabled') === 'true') {
             require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
             $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument'));
             $form->addElement('select_language', 'language', get_lang('SearchFeatureDocumentLanguage'));
             $specific_fields = get_specific_field_list();
             foreach ($specific_fields as $specific_field) {
                 $form->addElement('text', $specific_field['code'], $specific_field['name']);
                 $filter = array('c_id' => "'" . api_get_course_int_id() . "'", 'field_id' => $specific_field['id'], 'ref_id' => $this->id, 'tool_id' => '\'' . TOOL_QUIZ . '\'');
                 $values = get_specific_field_values_list($filter, array('value'));
                 if (!empty($values)) {
                     $arr_str_values = array();
                     foreach ($values as $value) {
                         $arr_str_values[] = $value['value'];
                     }
                     $defaults[$specific_field['code']] = implode(', ', $arr_str_values);
                 }
             }
             //$form->addElement ('html','</div>');
         }
         $form->addElement('html', '</div>');
         //End advanced setting
         $form->addElement('html', '</div>');
     }
     // submit
     if (isset($_GET['exerciseId'])) {
         $form->addButtonSave(get_lang('ModifyExercise'), 'submitExercise');
     } else {
         $form->addButtonUpdate(get_lang('ProcedToQuestions'), 'submitExercise');
     }
     $form->addRule('exerciseTitle', get_lang('GiveExerciseName'), 'required');
     if ($type == 'full') {
         // rules
         $form->addRule('exerciseAttempts', get_lang('Numeric'), 'numeric');
         $form->addRule('start_time', get_lang('InvalidDate'), 'datetime');
         $form->addRule('end_time', get_lang('InvalidDate'), 'datetime');
     }
     // defaults
     if ($type == 'full') {
         if ($this->id > 0) {
             if ($this->random > $this->selectNbrQuestions()) {
                 $defaults['randomQuestions'] = $this->selectNbrQuestions();
             } else {
                 $defaults['randomQuestions'] = $this->random;
             }
             $defaults['randomAnswers'] = $this->selectRandomAnswers();
             $defaults['exerciseType'] = $this->selectType();
             $defaults['exerciseTitle'] = $this->get_formated_title();
             $defaults['exerciseDescription'] = $this->selectDescription();
             $defaults['exerciseAttempts'] = $this->selectAttempts();
             $defaults['exerciseFeedbackType'] = $this->selectFeedbackType();
             $defaults['results_disabled'] = $this->selectResultsDisabled();
             $defaults['propagate_neg'] = $this->selectPropagateNeg();
             $defaults['review_answers'] = $this->review_answers;
             $defaults['randomByCat'] = $this->selectRandomByCat();
             $defaults['text_when_finished'] = $this->selectTextWhenFinished();
             $defaults['display_category_name'] = $this->selectDisplayCategoryName();
             $defaults['pass_percentage'] = $this->selectPassPercentage();
             if ($this->start_time != '0000-00-00 00:00:00') {
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:67,代码来源:exercise.class.php

示例6: FormValidator

$plugin_info['title'] = 'Enable or disable logout button';
//the comments that go with the plugin
$plugin_info['comment'] = "If you use some other authentication than local Chamilo authentication, you may have to disable the Chamilo logout button and give users information about your SSO logout.";
//the plugin version
$plugin_info['version'] = '1.0';
//the plugin author
$plugin_info['author'] = 'Hubert Borderiou';
//the plugin configuration
$form = new FormValidator('eaclbb_form');
$form->addElement("html", "<div class='normal-message'>Fill the text boxes below to overwrite the default values used in this plugin</div>");
$form->addElement('text', 'eaclbb_form_link_url', 'Page to load when clicking on the logout button');
$form->addElement('text', 'eaclbb_form_link_infobulle', 'Tooltip text for the logout button (displayed on mouseover)');
$form->addElement('checkbox', 'eaclbb_form_link_image', "Display the logout button disabled (black and white)", "", array('checked' => true));
$form->addElement('checkbox', 'eaclbb_form_alert_onoff', "Display an alert when clicking on the logout button", "", array('checked' => true));
$form->addElement('text', 'eaclbb_form_alert_text', "Text displayed in the alert box when clickng on the logout button (if checkbox above has been checked).");
$form->addButtonSave(get_lang('Save'), 'submit_button');
//get default value for form
$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url');
$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle');
$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image');
$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff');
$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text');
$defaults['eaclbb_form_link_url'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url['eaclbb_form_link_url'];
$defaults['eaclbb_form_link_infobulle'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle['eaclbb_form_link_infobulle'];
$defaults['eaclbb_form_link_image'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image['eaclbb_form_link_image'];
$defaults['eaclbb_form_alert_onoff'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff['eaclbb_form_alert_onoff'];
$defaults['eaclbb_form_alert_text'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text['eaclbb_form_alert_text'];
$form->setDefaults($defaults);
//display form
$plugin_info['settings_form'] = $form;
// Set the templates that are going to be used
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:plugin.php

示例7: return_item_form

 /**
  * @param $url
  * @param $action
  * @return FormValidator
  */
 public function return_item_form($url, $action)
 {
     $form = new FormValidator('item_form', 'post', $url);
     // Setting the form elements
     $header = get_lang('Add');
     if ($action == 'edit') {
         $header = get_lang('Modify');
     }
     $form->addElement('header', $header);
     $id = isset($_GET['id']) ? intval($_GET['id']) : '';
     $parent_id = isset($_GET['parent_id']) ? intval($_GET['parent_id']) : '';
     $form->addElement('hidden', 'parent_id', $parent_id);
     $form->addElement('hidden', 'id', $id);
     $form->addElement('text', 'headline', get_lang('Name'));
     //@todo fix this
     $form->addElement('text', 'start_date', get_lang('StartDate'), array('size' => '70'));
     $form->addElement('text', 'end_date', get_lang('EndDate'), array('size' => '70'));
     $form->addElement('textarea', 'text', get_lang('TimelineItemText'));
     $form->addElement('text', 'media', get_lang('TimelineItemMedia'), array('size' => '70'));
     $form->addElement('text', 'media_caption', get_lang('TimelineItemMediaCaption'), array('size' => '70'));
     $form->addElement('text', 'media_credit', get_lang('TimelineItemMediaCredit'), array('size' => '70'));
     $form->addElement('text', 'title_slide', get_lang('TimelineItemTitleSlide'), array('size' => '70'));
     $form->addRule('headline', get_lang('ThisFieldIsRequired'), 'required');
     $form->addRule('start_date', get_lang('ThisFieldIsRequired'), 'required');
     //$form->addHtmlEditor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'Careers','Width' => '100%', 'Height' => '250'));
     if ($action == 'edit') {
         // Setting the defaults
         $defaults = $this->get($id);
         $form->addButtonSave(get_lang('Modify'), 'submit');
     } else {
         $form->addButtonCreate(get_lang('Add'), 'submit');
     }
     /*if (!empty($defaults['created_at'])) {
       	$defaults['created_at'] = api_convert_and_format_date($defaults['created_at']);
       }
       if (!empty($defaults['updated_at'])) {
       	$defaults['updated_at'] = api_convert_and_format_date($defaults['updated_at']);
       }*/
     $form->setDefaults($defaults);
     // Setting the rules
     $form->addRule('headline', get_lang('ThisFieldIsRequired'), 'required');
     return $form;
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:48,代码来源:timeline.lib.php

示例8: createAnswersForm


//.........这里部分代码省略.........
                        tabInputSize[idnum] = thewidth;
                    }
                });
            }

            function changeInputSize(inCoef, inIdNum)
            {
                var currentWidth = $("#samplesize\\\\["+inIdNum+"\\\\]").width();
                var newWidth = currentWidth + inCoef * 20;
                newWidth = Math.max(20, newWidth);
                newWidth = Math.min(newWidth, 600);
                $("#samplesize\\\\["+inIdNum+"\\\\]").width(newWidth);
                $("#sizeofinput\\\\["+inIdNum+"\\\\]").attr("value", newWidth);
            }

            function removeForbiddenChars(inTxt) {
                outTxt = inTxt;

                outTxt = outTxt.replace(/&quot;/g, ""); // remove the   char
                outTxt = outTxt.replace(/\\x22/g, ""); // remove the   char
                outTxt = outTxt.replace(/"/g, ""); // remove the   char
                outTxt = outTxt.replace(/\\\\/g, ""); // remove the \\ char
                outTxt = outTxt.replace(/&nbsp;/g, " ");
                outTxt = outTxt.replace(/^ +/, "");
                outTxt = outTxt.replace(/ +$/, "");
                return outTxt;
            }

            function changeBlankSeparator()
            {
                var separatorNumber = $("#select_separator").val();
                var tabSeparator = getSeparatorFromNumber(separatorNumber);
                blankSeparatortStart = tabSeparator[0];
                blankSeparatortEnd = tabSeparator[1];
                blankSeparatortStartRegexp = getBlankSeparatorRegexp(blankSeparatortStart);
                blankSeparatortEndRegexp = getBlankSeparatorRegexp(blankSeparatortEnd);
                updateBlanks();
            }

            // this function is the same than the PHP one
            // if modify it modify the php one escapeForRegexp
            function getBlankSeparatorRegexp(inTxt)
            {
                var tabSpecialChar = new Array(".", "+", "*", "?", "[", "^", "]", "$", "(", ")",
                    "{", "}", "=", "!", "<", ">", "|", ":", "-", ")");
                for (var i=0; i < tabSpecialChar.length; i++) {
                    if (inTxt == tabSpecialChar[i]) {
                        return "\\\\"+inTxt;
                    }
                }
                return inTxt;
            }

            // this function is the same than the PHP one
            // if modify it modify the php one getAllowedSeparator
            function getSeparatorFromNumber(innumber)
            {
                tabSeparator = new Array();
                tabSeparator[0] = new Array("[", "]");
                tabSeparator[1] = new Array("{", "}");
                tabSeparator[2] = new Array("(", ")");
                tabSeparator[3] = new Array("*", "*");
                tabSeparator[4] = new Array("#", "#");
                tabSeparator[5] = new Array("%", "%");
                tabSeparator[6] = new Array("$", "$");
                return tabSeparator[innumber];
            }

            function trimBlanksBetweenSeparator(inTxt, inSeparatorStart, inSeparatorEnd)
            {
                // blankSeparatortStartRegexp
                // blankSeparatortEndRegexp
                var result = inTxt
                result = result.replace(inSeparatorStart, "");
                result = result.replace(inSeparatorEnd, "");
                result = result.trim();
                return inSeparatorStart+result+inSeparatorEnd;
            }
        </script>';
        // answer
        $form->addElement('label', null, '<br /><br />' . get_lang('TypeTextBelow') . ', ' . get_lang('And') . ' ' . get_lang('UseTagForBlank'));
        $form->addHtmlEditor('answer', Display::return_icon('fill_field.png'), ['id' => 'answer', 'onkeyup' => "javascript: updateBlanks(this);"], array('ToolbarSet' => 'TestQuestionDescription'));
        $form->addRule('answer', get_lang('GiveText'), 'required');
        //added multiple answers
        $form->addElement('checkbox', 'multiple_answer', '', get_lang('FillInBlankSwitchable'));
        $form->addElement('select', 'select_separator', get_lang("SelectFillTheBlankSeparator"), self::getAllowedSeparatorForSelect(), ' id="select_separator"   style="width:150px" onchange="changeBlankSeparator()" ');
        $form->addElement('label', null, '<input type="button" onclick="updateBlanks()" value="' . get_lang('RefreshBlanks') . '" class="btn btn-default" />');
        $form->addElement('html', '<div id="blanks_weighting"></div>');
        global $text;
        // setting the save button here and not in the question class.php
        $form->addElement('html', '<div id="defineoneblank" style="color:#D04A66; margin-left:160px">' . get_lang('DefineBlanks') . '</div>');
        $form->addButtonSave($text, 'submitQuestion');
        if (!empty($this->id)) {
            $form->setDefaults($defaults);
        } else {
            if ($this->isContent == 1) {
                $form->setDefaults($defaults);
            }
        }
    }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:fill_blanks.class.php

示例9: header

$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
if (!$is_allowed_to_edit) {
    header('location:lp_controller.php?action=list&' . api_get_cidreq());
    exit;
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list?' . api_get_cidreq(), 'name' => get_lang('LearningPaths'));
$form = new FormValidator('lp_add_category', 'post', 'lp_controller.php?' . api_get_cidreq());
// Form title
$form->addElement('header', null, get_lang('AddLPCategory'));
// Title
$form->addElement('text', 'name', api_ucfirst(get_lang('Name')));
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('hidden', 'action', 'add_lp_category');
$form->addElement('hidden', 'c_id', api_get_course_int_id());
$form->addElement('hidden', 'id', 0);
$form->addButtonSave(get_lang('Save'));
if ($form->validate()) {
    $values = $form->getSubmitValues();
    if (!empty($values['id'])) {
        learnpath::updateCategory($values);
        $url = api_get_self() . '?action=list&' . api_get_cidreq();
        header('Location: ' . $url);
        exit;
    } else {
        learnpath::createCategory($values);
        $url = api_get_self() . '?action=list&' . api_get_cidreq();
        header('Location: ' . $url);
        exit;
    }
} else {
    $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:lp_add_category.php

示例10: getCategoryForm

 /**
  * @param int $id
  * @param string $action
  *
  * @return FormValidator
  */
 public static function getCategoryForm($id, $action)
 {
     $form = new FormValidator('category', 'post', api_get_self() . '?action=' . $action . '&' . api_get_cidreq());
     $defaults = [];
     if ($action == 'addcategory') {
         $form->addHeader(get_lang('CategoryAdd'));
         $my_cat_title = get_lang('CategoryAdd');
     } else {
         $form->addHeader(get_lang('CategoryMod'));
         $my_cat_title = get_lang('CategoryMod');
         $defaults = self::getCategory($id);
     }
     $form->addHidden('id', $id);
     $form->addText('category_title', get_lang('CategoryName'));
     $form->addTextarea('description', get_lang('Description'));
     $form->addButtonSave($my_cat_title, 'submitCategory');
     $form->setDefaults($defaults);
     return $form;
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:25,代码来源:link.lib.php

示例11: FormValidator

if (count($nosessionUsersList) == 0) {
    $friends = SocialManager::get_friends(api_get_user_id());
    if ($friends == 0) {
        $social_right_content .= get_lang('YouNeedToHaveFriendsInYourSocialNetwork');
    } else {
        $social_right_content .= get_lang('YouAlreadyInviteAllYourContacts');
    }
    $social_right_content .= '<div>';
    $social_right_content .= '<a href="search.php">' . get_lang('TryAndFindSomeFriends') . '</a>';
    $social_right_content .= '</div>';
}
$form = new FormValidator('invitation', 'post', api_get_self() . '?id=' . $group_id);
$form->addHidden('form_sent', 1);
$form->addHidden('id', $group_id);
$group_members_element = $form->addElement('advmultiselect', 'invitation', get_lang('Friends'), $nosessionUsersList, 'style="width: 280px;"');
$form->addButtonSave(get_lang('InviteUsersToGroup'));
$social_right_content .= $form->returnForm();
// Current group members
$members = $usergroup->get_users_by_group($group_id, false, array(GROUP_USER_PERMISSION_PENDING_INVITATION));
if (is_array($members) && count($members) > 0) {
    foreach ($members as &$member) {
        $image = UserManager::getUserPicture($member['user_id']);
        $member['image'] = '<img src="' . $image . '"  width="50px" height="50px"  />';
    }
    $social_right_content .= '<h3>' . get_lang('UsersAlreadyInvited') . '</h3>';
    $social_right_content .= Display::return_sortable_grid('invitation_profile', array(), $members, array('hide_navigation' => true, 'per_page' => 100), array(), false, array(true, false, true, true));
}
$tpl = \Chamilo\CoreBundle\Framework\Container::getTwig();
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'groups', $group_id);
$social_menu_block = SocialManager::show_social_menu('member_list', $group_id);
$tpl->addGlobal('social_menu_block', $social_menu_block);
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:group_invitation.php

示例12: createAnswersForm


//.........这里部分代码省略.........
                 //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];
                 $defaults['weighting[' . $i . ']'] = $weight_result;
                 $item_list = explode('@@', $answer->destination[$i]);
                 $try = $item_list[0];
                 $lp = $item_list[1];
                 $list_dest = $item_list[2];
                 $url = $item_list[3];
                 if ($try == 0) {
                     $try_result = 0;
                 } else {
                     $try_result = 1;
                 }
                 if ($url == 0) {
                     $url_result = '';
                 } else {
                     $url_result = $url;
                 }
                 $temp_scenario['url' . $i] = $url_result;
                 $temp_scenario['try' . $i] = $try_result;
                 $temp_scenario['lp' . $i] = $lp;
                 $temp_scenario['destination' . $i] = $list_dest;
             }
         }
         $defaults['scenario'] = $temp_scenario;
         $renderer =& $form->defaultRenderer();
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'correct');
         $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 . ']');
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'weighting[' . $i . ']');
         $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"');
         $answer_number->freeze();
         $form->addElement('radio', 'correct', null, null, $i, 'class="checkbox" style="margin-left: 0em;"');
         $form->addHtmlEditor('answer[' . $i . ']', null, array(), false, $editor_config);
         $form->addHtmlEditor('comment[' . $i . ']', null, array(), false, $editor_config);
         $form->addElement('text', 'weighting[' . $i . ']', null, array('style' => 'width: 60px;', 'value' => '0'));
         $form->addElement('html', '</tr>');
         $i++;
     }
     if (empty($this->id)) {
         $form->addElement('hidden', 'new_question', 1);
     }
     //Adding the "I don't know" question answer
     //if (empty($this -> id)) {
     $i = 666;
     $form->addHtml('<tr>');
     $defaults['answer[' . $i . ']'] = get_lang('DontKnow');
     $defaults['weighting[' . $i . ']'] = 0;
     $defaults['scenario'] = $temp_scenario;
     $renderer =& $form->defaultRenderer();
     $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'correct');
     $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 . ']');
     $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'weighting[' . $i . ']');
     $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="-"');
     $answer_number->freeze();
     $form->addElement('hidden', 'position[' . $i . ']', '666');
     $form->addElement('radio', 'correct', null, null, $i, 'class="checkbox" style="margin-left: 0em;"');
     $form->addHtmlEditor('answer[' . $i . ']', null, array(), false, $editor_config);
     $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
     $form->addHtmlEditor('comment[' . $i . ']', null, array(), false, $editor_config);
     //$form->addElement('select', 'destination'.$i, get_lang('SelectQuestion').' : ',$select_question,'multiple');
     $form->addText("weighting[{$i}]", null, false, ['style' => 'width: 60px;', 'value' => 0, 'readonly' => 'readonly']);
     $form->addHTml('</tr>');
     $form->addHtml('</tbody></table>');
     $buttonGroup = [];
     global $text, $class;
     //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);
         $buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true);
         $buttonGroup[] = $form->addButtonSave($text, 'submitQuestion', true);
         $form->addGroup($buttonGroup);
     }
     //We check the first radio button to be sure a radio button will be check
     if ($correct == 0) {
         $correct = 1;
     }
     $defaults['correct'] = $correct;
     if (!empty($this->id)) {
         $form->setDefaults($defaults);
     } else {
         $form->setDefaults($defaults);
     }
     $form->addElement('hidden', 'nb_answers');
     $form->setConstants(array('nb_answers' => $nb_answers));
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:unique_answer_no_option.class.php

示例13: elseif

    Display::display_confirmation_message(get_lang('RecycleFinished'));
} elseif (Security::check_token('post') && (isset($_POST['recycle_option']) && $_POST['recycle_option'] == 'select_items')) {
    // Clear token
    Security::clear_token();
    $cb = new CourseBuilder();
    $course = $cb->build();
    // Add token to Course select form
    $hiddenFields['sec_token'] = Security::get_token();
    CourseSelectForm::display_form($course, $hiddenFields);
} else {
    $cb = new CourseBuilder();
    $course = $cb->build();
    if (!$course->has_resources()) {
        echo get_lang('NoResourcesToRecycle');
    } else {
        Display::display_warning_message(get_lang('RecycleWarning'), false);
        $form = new FormValidator('recycle_course', 'post', api_get_self() . '?' . api_get_cidreq());
        $form->addElement('header', get_lang('SelectOptionForBackup'));
        $form->addElement('radio', 'recycle_option', null, get_lang('FullRecycle'), 'full_backup');
        $form->addElement('radio', 'recycle_option', null, get_lang('LetMeSelectItems'), 'select_items');
        $form->addButtonSave(get_lang('RecycleCourse'));
        $form->setDefaults(array('recycle_option' => 'select_items'));
        // Add Security token
        $token = Security::get_token();
        $form->addElement('hidden', 'sec_token');
        $form->setConstants(array('sec_token' => $token));
        $form->display();
    }
}
// Display the footer
Display::display_footer();
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:recycle_course.php

示例14: move_post_form

/**
 * This function displays the form for moving a post message to a different (already existing) or a new thread.
 * @return void HTML
 *
 * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
 * @version february 2006, dokeos 1.8
 */
function move_post_form()
{
    // initiate the object
    $form = new FormValidator('movepost', 'post', api_get_self() . '?' . api_get_cidreq() . '&forum=' . intval($_GET['forum']) . '&thread=' . intval($_GET['thread']) . '&post=' . intval($_GET['post']) . '&action=' . Security::remove_XSS($_GET['action']) . '&post=' . intval($_GET['post']));
    // The header for the form
    $form->addElement('header', '', get_lang('MovePost'));
    // Invisible form: the post_id
    $form->addElement('hidden', 'post_id', intval($_GET['post']));
    // Dropdown list: Threads of this forum
    $threads = get_threads($_GET['forum']);
    //my_print_r($threads);
    $threads_list[0] = get_lang('ANewThread');
    foreach ($threads as $key => $value) {
        $threads_list[$value['thread_id']] = $value['thread_title'];
    }
    $form->addElement('select', 'thread', get_lang('MoveToThread'), $threads_list);
    $form->applyFilter('thread', 'html_filter');
    // The OK button
    $form->addButtonSave(get_lang('MovePost'), 'submit');
    // Setting the rules
    $form->addRule('thread', get_lang('ThisFieldIsRequired'), 'required');
    // Validation or display
    if ($form->validate()) {
        $values = $form->exportValues();
        store_move_post($values);
    } else {
        $form->display();
    }
}
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:36,代码来源:forumfunction.inc.php

示例15: createAnswersForm


//.........这里部分代码省略.........
        $highestValue = "20.00";
        // javascript //
        echo '<script>
            function parseTextNumber(textNumber, floatValue) {
                if (textNumber.indexOf(".") > -1) {
                    textNumber = parseFloat(textNumber);
                    floatValue.exists = "true";
                } else {
                    textNumber = parseInt(textNumber);
                }
                return textNumber;
            }

            function updateRandomValue(element) {
                // "floatValue" helps to distinguish between an integer (10) and a float with all 0 decimals (10.00)
                var floatValue = { exists: "false" };
                var index = (element.name).match(/\\[[^\\]]*\\]/g);
                var lowestValue = parseTextNumber(document.getElementById("lowestValue"+index).value, floatValue);
                var highestValue = parseTextNumber(document.getElementById("highestValue"+index).value, floatValue);
                var result = Math.random() * (highestValue - lowestValue) + lowestValue;
                if (floatValue.exists == "true") {
                    result = parseFloat(result).toFixed(2);
                } else {
                    result = parseInt(result);
                }
                document.getElementById("randomValue"+index).innerHTML = "' . get_lang("ExampleValue") . ': " + result;
           }

            CKEDITOR.on("instanceCreated", function(e) {
                if (e.editor.name === "answer") {
                    e.editor.on("change", updateBlanks);
                }
            });

            var firstTime = true;

            function updateBlanks(e) {
                if (firstTime) {
                    field = document.getElementById("answer");
                    var answer = field.value;
                } else {
                    var answer = e.editor.getData();
                }
                var blanks = answer.match(/\\[[^\\]]*\\]/g);
                var fields = "<div class=\\"form-group\\"><label class=\\"col-sm-2\\">' . get_lang('VariableRanges') . '</label><div class=\\"col-sm-8\\"><table>";
                if (blanks!=null) {
                    if (typeof updateBlanks.randomValues === "undefined") {
                        updateBlanks.randomValues = [];
                    }
                    for (i=0 ; i<blanks.length ; i++){
                        if (document.getElementById("lowestValue["+i+"]") && document.getElementById("highestValue["+i+"]")) {
                            lowestValue = document.getElementById("lowestValue["+i+"]").value;
                            highestValue = document.getElementById("highestValue["+i+"]").value;
                        } else {
                            lowestValue = ' . $lowestValue . '.toFixed(2);
                            highestValue = ' . $highestValue . '.toFixed(2);
                            for (j=0; j<blanks.length; j++) {
                                updateBlanks.randomValues[j] = parseFloat(Math.random() * (highestValue - lowestValue) + lowestValue).toFixed(2);
                            }
                        }
                        fields += "<tr><td><label>"+blanks[i]+"</label></td><td><input class=\\"span1\\" style=\\"margin-left: 0em;\\" size=\\"5\\" value=\\""+lowestValue+"\\" type=\\"text\\" id=\\"lowestValue["+i+"]\\" name=\\"lowestValue["+i+"]\\" onblur=\\"updateRandomValue(this)\\"/></td><td><input class=\\"span1\\" style=\\"margin-left: 0em; width:80px;\\" size=\\"5\\" value=\\""+highestValue+"\\" type=\\"text\\" id=\\"highestValue["+i+"]\\" name=\\"highestValue["+i+"]\\" onblur=\\"updateRandomValue(this)\\"/></td><td><label class=\\"span3\\" id=\\"randomValue["+i+"]\\"/>' . get_lang('ExampleValue') . ': "+updateBlanks.randomValues[i]+"</label></td></tr>";
                    }
                }
                document.getElementById("blanks_weighting").innerHTML = fields + "</table></div></div>";
                if (firstTime) {
                    firstTime = false;
                }
            }

            window.onload = updateBlanks;

        </script>';
        // answer
        $form->addElement('label', null, '<br /><br />' . get_lang('TypeTextBelow') . ', ' . get_lang('And') . ' ' . get_lang('UseTagForBlank'));
        $form->addHtmlEditor('answer', Display::return_icon('fill_field.png'), false, array('id' => 'answer', 'onkeyup' => 'javascript: updateBlanks(this);'), array('ToolbarSet' => 'TestQuestionDescription', 'Width' => '100%', 'Height' => '350'));
        $form->addRule('answer', get_lang('GiveText'), 'required');
        $form->addRule('answer', get_lang('DefineBlanks'), 'regex', '/\\[.*\\]/');
        $form->addElement('label', null, get_lang('IfYouWantOnlyIntegerValuesWriteBothLimitsWithoutDecimals'));
        $form->addElement('html', '<div id="blanks_weighting"></div>');
        $notationListButton = Display::url(get_lang('NotationList'), api_get_path(WEB_PATH) . 'main/exercice/evalmathnotation.php', array('class' => 'btn ajax', 'data-title' => get_lang('NotationList'), '_target' => '_blank'));
        $form->addElement('label', null, $notationListButton);
        $form->addElement('label', null, get_lang('FormulaExample'));
        $form->addElement('text', 'formula', get_lang('Formula'), array('id' => 'formula'));
        $form->addRule('formula', get_lang('GiveFormula'), 'required');
        $form->addElement('text', 'weighting', get_lang('Weighting'), array('id' => 'weighting'));
        $form->setDefaults(array('weighting' => '10'));
        $form->addElement('text', 'answerVariations', get_lang('AnswerVariations'));
        $form->addRule('answerVariations', get_lang('GiveAnswerVariations'), 'required');
        $form->setDefaults(array('answerVariations' => '1'));
        global $text;
        // setting the save button here and not in the question class.php
        $form->addButtonSave($text, 'submitQuestion');
        if (!empty($this->id)) {
            $form->setDefaults($defaults);
        } else {
            if ($this->isContent == 1) {
                $form->setDefaults($defaults);
            }
        }
    }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:calculated_answer.class.php


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