本文整理汇总了PHP中FormValidator::addHidden方法的典型用法代码示例。如果您正苦于以下问题:PHP FormValidator::addHidden方法的具体用法?PHP FormValidator::addHidden怎么用?PHP FormValidator::addHidden使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormValidator
的用法示例。
在下文中一共展示了FormValidator::addHidden方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
$skillUserRepo = $entityManager->getRepository('ChamiloCoreBundle:SkillRelUser');
$user = $entityManager->find('ChamiloUserBundle:User', $_REQUEST['user']);
if (!$user) {
Display::addFlash(Display::return_message(get_lang('NoUser'), 'error'));
header('Location: ' . api_get_path(WEB_PATH));
exit;
}
$skills = $skillRepo->findBy(['status' => Skill::STATUS_ENABLED]);
$skillsOptions = [];
foreach ($skills as $skill) {
$skillsOptions[$skill->getId()] = $skill->getName();
}
$form = new FormValidator('assign_skill');
$form->addText('user_name', get_lang('UserName'), false);
$form->addSelect('skill', get_lang('Skill'), $skillsOptions);
$form->addHidden('user', $user->getId());
$form->addRule('skill', get_lang('ThisFieldIsRequired'), 'required');
$form->addTextarea('argumentation', get_lang('Argumentation'), ['rows' => 6]);
$form->applyFilter('argumentation', 'trim');
$form->addRule('argumentation', get_lang('ThisFieldIsRequired'), 'required');
$form->addButtonSave(get_lang('Save'));
if ($form->validate()) {
$values = $form->exportValues();
$skill = $skillRepo->find($values['skill']);
if (!$skill) {
Display::addFlash(Display::return_message(get_lang('SkillNotFound'), 'error'));
header('Location: ' . api_get_self() . '?' . http_build_query(['user' => $user->getId()]));
exit;
}
if ($user->hasSkill($skill)) {
Display::addFlash(Display::return_message(sprintf(get_lang('TheUserXHasAlreadyAchievedTheSkillY'), $user->getCompleteName(), $skill->getName()), 'warning'));
示例2: getSearchForm
/**
* Returns the search form
* @return string
*/
public static function getSearchForm()
{
$url = api_get_path(WEB_CODE_PATH) . 'group/group_overview.php?' . api_get_cidreq();
$form = new FormValidator('search_groups', 'get', $url, null, array('class' => 'form-search'), FormValidator::LAYOUT_INLINE);
$form->addHidden('cidReq', api_get_course_id());
$form->addHidden('id_session', api_get_session_id());
$form->addElement('text', 'keyword');
$form->addButtonSearch();
return $form->toHtml();
}
示例3: FormValidator
}
$social_left_content = SocialManager::show_social_menu('invite_friends', $group_id);
$social_right_content = '<h2>' . Security::remove_XSS($group_info['name'], STUDENT, true) . '</h2>';
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();
示例4: isset
break;
case 'set_status':
$status = isset($_REQUEST['status']) ? intval($_REQUEST['status']) : 0;
$chat->setUserStatus($status);
break;
case 'start_video':
$room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id);
if ($room !== false) {
$videoChatLink = Display::url(Display::tag('i', null, ['class' => 'fa fa-video-camera']) . " " . get_lang('StartVideoChat'), api_get_path(WEB_LIBRARY_JS_PATH) . "chat/video.php?room={$room['room_name']}");
$chat->send(api_get_user_id(), $to_user_id, $videoChatLink, false);
echo Display::tag('p', $videoChatLink, ['class' => 'lead']);
break;
}
$form = new FormValidator('start_video_chat');
$form->addText('chat_room_name', get_lang('ChatRoomName'), false);
$form->addHidden('to', $to_user_id);
$form->addButtonSend(get_lang('Create'));
$template = new Template();
$template->assign('form', $form->returnForm());
echo $template->fetch('default/javascript/chat/start_video.tpl');
break;
case 'create_room':
$room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id);
$createdRoom = false;
if ($room === false) {
$roomName = isset($_REQUEST['room_name']) ? Security::remove_XSS($_REQUEST['room_name']) : null;
if (VideoChat::nameExists($roomName)) {
echo Display::return_message(get_lang('TheVideoChatRoomXNameAlreadyExists'), 'error');
break;
}
$createdRoom = VideoChat::createRoom($roomName, api_get_user_id(), $to_user_id);
示例5: displayActions
/**
* @param int $filter
* @param string $view
* @return string
*/
public function displayActions($view, $filter = 0)
{
$courseInfo = api_get_course_info();
$actionsLeft = '';
$actionsLeft .= "<a href='" . api_get_path(WEB_CODE_PATH) . "calendar/agenda_js.php?type={$this->type}'>" . Display::return_icon('calendar.png', get_lang('Calendar'), '', ICON_SIZE_MEDIUM) . "</a>";
$courseCondition = '';
if (!empty($courseInfo)) {
$courseCondition = api_get_cidreq();
}
$actionsLeft .= "<a href='" . api_get_path(WEB_CODE_PATH) . "calendar/agenda_list.php?type={$this->type}&" . $courseCondition . "'>" . Display::return_icon('week.png', get_lang('AgendaList'), '', ICON_SIZE_MEDIUM) . "</a>";
$form = '';
if (api_is_allowed_to_edit(false, true) || api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous() && api_is_allowed_to_session_edit(false, true) || GroupManager::user_has_access(api_get_user_id(), api_get_group_id(), GroupManager::GROUP_TOOL_CALENDAR) && GroupManager::is_tutor_of_group(api_get_user_id(), api_get_group_id())) {
$actionsLeft .= Display::url(Display::return_icon('new_event.png', get_lang('AgendaAdd'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . "calendar/agenda.php?" . api_get_cidreq() . "&action=add&type=" . $this->type);
$actionsLeft .= Display::url(Display::return_icon('import_calendar.png', get_lang('ICalFileImport'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . "calendar/agenda.php?" . api_get_cidreq() . "&action=importical&type=" . $this->type);
if ($this->type == 'course') {
if (!isset($_GET['action'])) {
$form = new FormValidator('form-search', 'post', '', '', array(), FormValidator::LAYOUT_INLINE);
$attributes = array('multiple' => false, 'id' => 'select_form_id_search');
$selectedValues = $this->parseAgendaFilter($filter);
$this->showToForm($form, $selectedValues, $attributes);
$form = $form->returnForm();
}
}
}
if (api_is_platform_admin() || api_is_teacher() || api_is_student_boss() || api_is_drh() || api_is_session_admin() || api_is_coach()) {
if ($this->type == 'personal') {
$form = null;
if (!isset($_GET['action'])) {
$form = new FormValidator('form-search', 'get', api_get_self() . '?type=personal&', '', array(), FormValidator::LAYOUT_INLINE);
$sessions = SessionManager::get_sessions_by_user(api_get_user_id());
$form->addHidden('type', 'personal');
$sessions = array_column($sessions, 'session_name', 'session_id');
$sessions = ['0' => get_lang('SelectAnOption')] + $sessions;
$form->addSelect('session_id', get_lang('Session'), $sessions, ['id' => 'session_id', 'onchange' => 'submit();']);
//$form->addButtonFilter(get_lang('Filter'));
//$renderer = $form->defaultRenderer();
//$renderer->setCustomElementTemplate('<div class="col-md-6">{element}</div>');
$form->addButtonReset(get_lang('Reset'));
$form = $form->returnForm();
}
}
}
$actionsRight = '';
if ($view == 'calendar') {
$actionsRight .= $form;
}
$toolbar = Display::toolbarAction('toolbar-agenda', array(0 => $actionsLeft, 1 => $actionsRight), 2, false);
return $toolbar;
}
示例6: array
}
$form->applyFilter('openid', 'trim');
}*/
// PHONE
$form->addElement('text', 'phone', get_lang('Phone'), array('size' => 20));
if (api_get_setting('profile', 'phone') !== 'true') {
$form->freeze('phone');
}
$form->applyFilter('phone', 'stripslashes');
$form->applyFilter('phone', 'trim');
$form->applyFilter('phone', 'html_filter');
// PICTURE
if (is_profile_editable() && api_get_setting('profile', 'picture') == 'true') {
$form->addElement('file', 'picture', $user_data['picture_uri'] != '' ? get_lang('UpdateImage') : get_lang('AddImage'), array('id' => 'picture_form', 'class' => 'picture-form'));
$form->addHtml('' . '<div class="form-group">' . '<label for="cropImage" id="labelCropImage" class="col-sm-2 control-label"></label>' . '<div class="col-sm-8">' . '<div id="cropImage" class="cropCanvas">' . '<img id="previewImage" >' . '</div>' . '<div>' . '<button class="btn btn-primary hidden" name="cropButton" id="cropButton"><em class="fa fa-crop"></em> ' . get_lang('CropYourPicture') . '</button>' . '</div>' . '</div>' . '</div>' . '');
$form->addHidden('cropResult', '');
$form->add_progress_bar();
if (!empty($user_data['picture_uri'])) {
$form->addElement('checkbox', 'remove_picture', null, get_lang('DelImage'));
}
$allowed_picture_types = api_get_supported_image_extensions();
$form->addRule('picture', get_lang('OnlyImagesAllowed') . ' (' . implode(', ', $allowed_picture_types) . ')', 'filetype', $allowed_picture_types);
}
// LANGUAGE
$form->addElement('select_language', 'language', get_lang('Language'));
if (api_get_setting('profile', 'language') !== 'true') {
$form->freeze('language');
}
//THEME
if (is_profile_editable() && api_get_setting('profile.user_selected_theme') == 'true') {
$form->addElement('SelectTheme', 'theme', get_lang('Theme'));
示例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: FormValidator
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'));
}
Header::location(api_get_path(WEB_CODE_PATH) . 'admin/skill_list.php');
}
/* view */
$tpl = new Template(get_lang('SkillEdit'));
$tpl->assign('content', $editForm->returnForm());
$tpl->display_one_col_template();
示例9: getWallForm
/**
* @return string
*/
public static function getWallForm()
{
$form = new FormValidator('social_wall_main', 'post', api_get_path(WEB_CODE_PATH) . 'social/profile.php', null, array('enctype' => 'multipart/form-data'), FormValidator::LAYOUT_HORIZONTAL);
$form->addTextarea('social_wall_new_msg_main', null, ['placeholder' => get_lang('SocialWallWhatAreYouThinkingAbout'), 'cols-size' => [1, 10, 1]]);
$form->addHidden('url_content', '');
$form->addButtonSend(get_lang('Post'), 'wall_post_button', false, ['cols-size' => [1, 10, 1]]);
$html = Display::panel($form->returnForm(), get_lang('SocialWall'));
return $html;
}
示例10: display_student_publication_form
//.........这里部分代码省略.........
}
$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') {
$s_selected_position = 0;
}
$arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
}
}
}
if ($action == 'add') {
$form->addButtonCreate(get_lang('AddAssignmentToCourse'), 'submit_button');
} else {
$form->addButtonCreate(get_lang('EditCurrentStudentPublication'), 'submit_button');
}
if ($action == 'move') {
$form->addHidden('title', $item_title);
$form->addHidden('description', $item_description);
}
if (is_numeric($extra_info)) {
$form->addHidden('path', $extra_info);
} elseif (is_array($extra_info)) {
$form->addHidden('path', $extra_info['path']);
}
$form->addHidden('type', TOOL_STUDENTPUBLICATION);
$form->addHidden('post_time', time());
$form->setDefaults(['title' => $item_title]);
$return = '<div class="sectioncomment">';
$return .= $form->returnForm();
$return .= '</div>';
return $return;
}
示例11: FormValidator
$currentUser = $entityManager->find('ChamiloUserBundle:User', $currentUserId);
$allowExport = $currentUser ? $currentUser->getId() === $skillIssue->getUser()->getId() : false;
$allowComment = $currentUser ? Skill::userCanAddFeedbackToUser($currentUser, $skillIssue->getUser()) : false;
$skillIssueDate = api_get_local_time($skillIssue->getAcquiredSkillAt());
$skillIssueInfo = ['id' => $skillIssue->getId(), 'datetime' => api_format_date($skillIssueDate, DATE_TIME_FORMAT_SHORT), 'argumentation' => $skillIssue->getArgumentation(), 'source_name' => $skillIssue->getSourceName(), 'user_id' => $skillIssue->getUser()->getId(), 'user_complete_name' => $skillIssue->getUser()->getCompleteName(), 'skill_badge_image' => $skillIssue->getSkill()->getWebIconPath(), 'skill_name' => $skillIssue->getSkill()->getName(), 'skill_short_code' => $skillIssue->getSkill()->getShortCode(), 'skill_description' => $skillIssue->getSkill()->getDescription(), 'skill_criteria' => $skillIssue->getSkill()->getCriteria(), 'badge_asserion' => [$skillIssue->getAssertionUrl()], 'comments' => [], 'feedback_average' => $skillIssue->getAverage()];
$skillIssueComments = $skillIssue->getComments(true);
foreach ($skillIssueComments as $comment) {
$commentDate = api_get_local_time($comment->getFeedbackDateTime());
$skillIssueInfo['comments'][] = ['text' => $comment->getFeedbackText(), 'value' => $comment->getFeedbackValue(), 'giver_complete_name' => $comment->getFeedbackGiver()->getCompleteName(), 'datetime' => api_format_date($commentDate, DATE_TIME_FORMAT_SHORT)];
}
$form = new FormValidator('comment');
$form->addTextarea('comment', get_lang('NewComment'), ['rows' => 4]);
$form->applyFilter('comment', 'trim');
$form->addRule('comment', get_lang('ThisFieldIsRequired'), 'required');
$form->addSelect('value', [get_lang('Value'), get_lang('RateTheSkillInPractice')], ['-', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
$form->addHidden('user', $skillIssue->getUser()->getId());
$form->addHidden('issue', $skillIssue->getId());
$form->addButtonSend(get_lang('Send'));
if ($form->validate() && $allowComment) {
$values = $form->exportValues();
$skillUserComment = new Chamilo\CoreBundle\Entity\SkillRelUserComment();
$skillUserComment->setFeedbackDateTime(new DateTime())->setFeedbackGiver($currentUser)->setFeedbackText($values['comment'])->setFeedbackValue($values['value'] ? $values['value'] : null)->setSkillRelUser($skillIssue);
$entityManager->persist($skillUserComment);
$entityManager->flush();
header("Location: " . $skillIssue->getIssueUrl());
exit;
}
if ($allowExport) {
$backpack = 'https://backpack.openbadges.org/';
$configBackpack = api_get_setting('openbadges_backpack');
if (strcmp($backpack, $configBackpack) !== 0) {
示例12: isset
}
// Displaying the form with the questions
if (isset($_POST['personality'])) {
$personality = (int) $_POST['personality'] + 1;
} else {
$personality = 0;
}
// Displaying the form with the questions
$g_c = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : '';
$g_ic = isset($_GET['invitationcode']) ? Security::remove_XSS($_GET['invitationcode']) : '';
$g_cr = isset($_GET['cidReq']) ? Security::remove_XSS($_GET['cidReq']) : '';
$p_l = isset($_POST['language']) ? Security::remove_XSS($_POST['language']) : '';
$add_parameters = isset($_GET['user_id']) ? 'user_id=' . $_GET['user_id'] . '&' : '';
$url = api_get_self() . '?' . $add_parameters . 'course=' . $g_c . '&invitationcode=' . $g_ic . '&show=' . $show . '&cidReq=' . $g_cr;
$form = new FormValidator('question', 'post', $url);
$form->addHidden('language', $p_l);
if (isset($questions) && is_array($questions)) {
foreach ($questions as $key => &$question) {
$ch_type = 'ch_' . $question['type'];
$display = new $ch_type();
// @todo move this in a function.
$form->addHtml('<div class="survey_question_wrapper"><div class="survey_question">');
$form->addHtml($question['survey_question']);
$display->render($form, $question);
$form->addHtml('</div></div>');
}
}
if ($survey_data['survey_type'] === '0') {
if ($survey_data['show_form_profile'] == 0) {
// The normal survey as always
if ($show < $numberofpages || !$_GET['show']) {
示例13: getWallForm
/**
* @return string
*/
public static function getWallForm()
{
$form = new FormValidator('social_wall_main', 'post', api_get_path(WEB_CODE_PATH) . 'social/profile.php', null, array('enctype' => 'multipart/form-data'));
$form->addTextarea('social_wall_new_msg_main', null, ['placeholder' => get_lang('SocialWallWhatAreYouThinkingAbout'), 'style' => 'width : 100%']);
$form->addHtml('<div class="form-group "><div class="url_preview col-md-9 panel-body"></div></div>');
$form->addButtonSend(get_lang('Post'));
$form->addHidden('url_content', '');
$html = Display::panel($form->returnForm(), get_lang('SocialWall'));
return $html;
}
示例14: 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();
}
示例15: FormValidator
echo '<div class="row">';
echo '<div class="col-md-6">';
echo $icon;
$actions .= '<a href="user.php?' . api_get_cidreq() . '&action=export&format=csv&type=' . $type . '">' . Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM) . '</a> ';
$actions .= '<a href="user.php?' . api_get_cidreq() . '&action=export&format=xls&type=' . $type . '">' . Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM) . '</a> ';
if (api_get_setting('course.allow_user_course_subscription_by_course_admin') == 'true' || api_is_platform_admin()) {
$actions .= '<a href="user_import.php?' . api_get_cidreq() . '&action=import">' . Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'), '', ICON_SIZE_MEDIUM) . '</a> ';
}
$actions .= '<a href="user.php?' . api_get_cidreq() . '&action=export&format=pdf&type=' . $type . '">' . Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM) . '</a> ';
echo $actions;
echo '</div>';
echo '<div class="col-md-6">';
echo '<div class="pull-right">';
// Build search-form
$form = new FormValidator('search_user', 'get', api_get_self() . '?' . api_get_cidreq(), '', null, FormValidator::LAYOUT_INLINE);
$form->addHidden('cidReq', api_get_course_id());
$form->addHidden('id_session', api_get_session_id());
$form->addText('keyword', '', false);
$form->addButtonSearch(get_lang('SearchButton'));
$form->display();
echo '</div>';
echo '</div>';
echo '</div>';
$allowTutors = api_get_setting('session.allow_tutors_to_assign_students_to_session');
if (api_is_allowed_to_edit() && $allowTutors == 'true') {
$actions .= ' <a class="btn btn-default" href="session_list.php?' . api_get_cidreq() . '">' . get_lang('Sessions') . '</a>';
}
echo '</div>';
}
echo UserManager::getUserSubscriptionTab($selectedTab);
$table->display();