本文整理汇总了PHP中HTML_QuickForm::setJsWarnings方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm::setJsWarnings方法的具体用法?PHP HTML_QuickForm::setJsWarnings怎么用?PHP HTML_QuickForm::setJsWarnings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_QuickForm
的用法示例。
在下文中一共展示了HTML_QuickForm::setJsWarnings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
</head>
<body>
<?php
set_include_path(get_include_path() . ";c:\\php\\pear");
require_once "HTML/QuickForm.php";
$form = new HTML_QuickForm('frmTest', 'post');
$form->addElement('text', 'Pseudo', 'Votre pseudo : ');
$form->addElement('text', 'Nom', 'Votre nom : ');
$form->addElement('text', 'Email', 'Votre adresse email : ');
$options = array('language' => 'fr', 'format' => 'dMY', 'minYear' => 2001, 'maxYear' => 2005);
$form->addElement('date', 'date', 'votre date de naissance : ', $options);
$form->addRule('Pseudo', 'Vous devez saisir un pseudo', 'required', '', 'client');
$form->addRule('Nom', 'Vous devez saisir un nom', 'required', '', 'client');
$form->addRule('Email', 'Vous devez saisir une adresse Email', 'required', '', 'client');
$form->addRule('Pseudo', 'Votre pseudo doit avoir entre 6 caractères et 10 caractères', 'rangelength', array(6, 10), 'client');
$form->addRule('Email', 'Vous devez saisir une adresse email valide', 'email', '', 'client');
$form->applyFilter('Nom', 'trim');
$form->applyFilter('Pseudo', 'trim');
$form->setRequiredNote('<span style="color: #ff0000">*</span> = champs obligatoires');
$form->setJsWarnings('Erreur de saisie', 'Veuillez corriger');
$form->addElement('reset', 'bouton_clear', 'Effacer');
$form->addElement('submit', 'bouton_effacer', 'Envoyer');
if ($form->validate()) {
echo "Toutes les règles sont respectées<br>";
} else {
$form->display();
}
?>
</body>
</html>
示例2: getSmartyTpl
public function getSmartyTpl()
{
$smarty = $this->getSmartyVar();
$smarty->assign('T_CHAT_ERROR_RATE', "");
$smarty->assign('T_CHAT_ERROR2_RATE', "");
if (isset($_POST['rate']) && isset($_POST['rate2'])) {
$ok = true;
if ($_POST['rate'] < 1) {
$smarty->assign('T_CHAT_ERROR_RATE', " New Rate must be greater or equal to 1.");
$ok = false;
}
if ($_POST['rate2'] < 1) {
$smarty->assign('T_CHAT_ERROR2_RATE', " New Rate must be greater or equal to 1.");
$ok = false;
}
if ($ok) {
$this->setChatHeartbeat($_POST['rate'] * 1000);
$this->setRefresh_rate($_POST['rate2'] * 1000);
}
}
$r = $this->getChatHeartbeat();
$r2 = $this->getRefresh_rate();
$smarty->assign('T_CHAT_CURRENT_RATE', $r / 1000);
$form = new HTML_QuickForm("change_chatheartbeat_form", "post", $this->moduleBaseUrl . "&setChatHeartBeat=1", "", null, true);
$form->addElement('text', 'rate', "rate", 'class="inputText" value="' . $r / 1000 . '" style="width:100px;"');
$form->addRule('rate', _THEFIELD . ' "Rate" ' . _ISMANDATORY, 'required', null, 'client');
$form->addRule('rate', "Non numeric Value", 'numeric', null, 'client');
$form->addRule('rate', "Rate must be greater than 1", 'callback', create_function('$rate', 'return ($rate >= 1);'));
$form->addElement('text', 'rate2', "rate2", 'class="inputText" value="' . $r2 / 1000 . '" style="width:100px;"');
$form->addRule('rate2', _THEFIELD . ' "Rate" ' . _ISMANDATORY, 'required', null, 'client');
$form->addRule('rate2', "Non numeric Value", 'numeric', null, 'client');
$form->addElement('submit', 'submit1', _SUBMIT, 'class="flatButton"');
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
$form->setRequiredNote("mesh");
$form->accept($renderer);
$smarty->assign('T_CHAT_CHANGE_CHATHEARTBEAT_FORM', $renderer->toArray());
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*$smarty->assign('T_CHAT_ERROR2_RATE', "");
if (isset($_POST['rate2'])){
if ($_POST['rate2'] >= 1)
$this -> setRefresh_rate($_POST['rate2']*1000);
else
$smarty->assign('T_CHAT_ERROR2_RATE', " New Rate must be greater or equal to 1.");
}
$r2 = $this->getRefresh_rate();
$smarty->assign('T_CHAT_CURRENT_REFRESH_RATE', $r2/1000);
$form = new HTML_QuickForm("change_refreshrate_form", "post", $this->moduleBaseUrl."&setRefresh_rate=1", "", null, true);
$form->addElement('text', 'rate2', "rate2", 'class="inputText" value="'.($r2/1000).'" style="width:100px;"');
$form->addRule('rate2', _THEFIELD.' "New Rate" '._ISMANDATORY, 'required', null, 'client');
$form->addRule('rate2', "Non numeric Value", 'numeric', null, 'client');
$form->addElement('submit', 'submit2', _SUBMIT, 'class="flatButton"');
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
$form->setRequiredNote("mesh");
$form->accept($renderer);
$smarty->assign('T_CHAT_CHANGE_REFRESHRATE_FORM', $renderer->toArray());*/
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//$lessons = $this -> getLessonsCatalogue();
//$smarty->assign('T_CHAT_LESSONS', $lessons);
$textfieldcontent = "";
if (isset($_POST['lessontitle'])) {
$textfieldcontent = $_POST['lessontitle'];
//$l = strip_tags($_POST['lessontitle']);
//$l2 = substr($l, strpos($l, '→')+5);
$log = $this->createLessonHistory($_POST['lessontitle'], $_POST['from']['Y'] . '-' . $_POST['from']['M'] . '-' . $_POST['from']['d'] . ' ' . "00:00:00", $_POST['until']['Y'] . '-' . $_POST['until']['M'] . '-' . $_POST['until']['d'] . ' ' . "23:59:59");
$smarty->assign('T_LOG', $log);
$smarty->assign('T_CHAT_LESSON_TITLE', $l2);
}
$form = new HTML_QuickForm("create_log_form", "post", $this->moduleBaseUrl . "&createLog=1", "", null, true);
$date_from = $form->addElement('date', 'from', 'From Date:', array('format' => 'dMY', 'minYear' => 2010, 'maxYear' => date('Y')));
$date_until = $form->addElement('date', 'until', 'Until Date:', array('format' => 'dMY', 'minYear' => 2010, 'maxYear' => date('Y')));
$form->addElement('text', 'lessontitle', "lessontitle", 'maxlength="100" size="100" class="autoCompleteTextBox" id="autocomplete" value="' . $textfieldcontent . '"');
$form->addRule('lessontitle', _THEFIELD . ' "Lesson Title" ' . _ISMANDATORY, 'required', null, 'client');
$week_ago = $this->subtractDaysFromToday(7);
$form->setDefaults(array('until' => array('d' => date('d'), 'M' => date('m'), 'Y' => date('Y')), 'from' => $week_ago));
$form->addElement('submit', 'submit', "Create Log", 'class="flatButton"');
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
$form->setRequiredNote("mesh");
$form->accept($renderer);
$smarty->assign('T_CHAT_CREATE_LOG_FORM', $renderer->toArray());
////////
return $this->moduleBaseDir . "control_panel.tpl";
}
示例3: getSmartyTpl
public function getSmartyTpl()
{
$smarty = $this->getSmartyVar();
$currentUser = $this->getCurrentUser();
$currentLesson = $this->getCurrentLesson();
$currentLessonID = $currentLesson->lesson['id'];
if ($currentUser->getRole($this->getCurrentLesson()) == 'professor' || $currentUser->getRole($this->getCurrentLesson()) == 'student') {
// XXX
$workbookLessonName = _WORKBOOK_NAME . ' [' . $this->getWorkbookLessonName($currentLessonID) . ']';
$smarty->assign("T_WORKBOOK_LESSON_NAME", $workbookLessonName);
$lessonQuestions = $this->getLessonQuestions($currentLessonID);
$workbookLessons = $this->isWorkbookInstalledByUser($currentUser, $currentUser->getRole($this->getCurrentLesson()), $currentLessonID);
$workbookItems = $this->getWorkbookItems($currentLessonID);
$nonOptionalQuestionsNr = $this->getNonOptionalQuestionsNr($workbookItems);
if ($nonOptionalQuestionsNr != 0) {
$questionPercentage = (double) (100 / $nonOptionalQuestionsNr);
$questionPercentage = round($questionPercentage, 2);
}
$isWorkbookPublished = $this->isWorkbookPublished($currentLessonID);
}
if ($currentUser->getRole($this->getCurrentLesson()) == 'student') {
$workbookSettings = $this->getWorkbookSettings($currentLessonID);
$smarty->assign("T_WORKBOOK_SETTINGS", $workbookSettings);
}
$smarty->assign("T_WORKBOOK_BASEURL", $this->moduleBaseUrl);
$smarty->assign("T_WORKBOOK_BASELINK", $this->moduleBaseLink);
global $popup;
isset($popup) && $popup == 1 ? $popup_ = '&popup=1' : ($popup_ = '');
if (isset($_REQUEST['question_preview']) && $_REQUEST['question_preview'] == '1' && isset($_REQUEST['question_id']) && eF_checkParameter($_REQUEST['question_id'], 'id')) {
$id = $_REQUEST['question_id'];
if (!in_array($id, array_keys($lessonQuestions))) {
// reused item
$reusedQuestion = $this->getReusedQuestionDetails($id);
$type = $reusedQuestion['type'];
} else {
$type = $lessonQuestions[$id]['type'];
}
echo $this->questionToHtml($id, $type);
exit;
}
if (isset($_REQUEST['get_progress']) && $_REQUEST['get_progress'] == '1') {
$isWorkbookCompleted = $this->isWorkbookCompleted($currentUser->user['login'], $currentLessonID, array_keys($workbookItems), $nonOptionalQuestionsNr);
$studentProgress = $this->getStudentProgress($currentUser->user['login'], $currentLessonID);
if ($isWorkbookCompleted['is_completed'] == 1) {
$unitToComplete = $workbookSettings['unit_to_complete'];
$result = eF_updateTableData('module_workbook_progress', array('completion_date' => time()), "lessons_ID='" . $currentLessonID . "' AND users_LOGIN='" . $currentUser->user['login'] . "'");
if ($unitToComplete != -1) {
$currentUser->setSeenUnit($unitToComplete, $currentLessonID, true);
}
}
echo $studentProgress . '-' . $isWorkbookCompleted['id'];
exit;
}
if (isset($_GET['edit_settings']) && $_GET['edit_settings'] == '1') {
if ($_SESSION['s_type'] != 'professor') {
$message = _WORKBOOK_NOACCESS;
$message_type = 'failure';
$this->setMessageVar(urlencode($message), $message_type);
}
$content = new EfrontContentTree($currentLessonID);
$iterator = new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($content->tree), RecursiveIteratorIterator::SELF_FIRST), array('ctg_type' => 'theory'));
$contentOptions = $content->toHTMLSelectOptions($iterator);
$contentOptions = array(-1 => '-------------') + $contentOptions;
$workbookSettings = $this->getWorkbookSettings($currentLessonID);
if ($isWorkbookPublished == 1) {
$contentOptions[$workbookSettings['unit_to_complete']] = str_replace(' ', '', $contentOptions[$workbookSettings['unit_to_complete']]);
$contentOptions[$workbookSettings['unit_to_complete']] = str_replace('»', '', $contentOptions[$workbookSettings['unit_to_complete']]);
}
$form = new HTML_QuickForm("edit_settings_form", "post", $this->moduleBaseUrl . "&edit_settings=1", "", null, true);
$form->addElement('text', 'lesson_name', _WORKBOOK_LESSON_NAME, 'class="inputText"');
$form->addRule('lesson_name', _THEFIELD . ' "' . _WORKBOOK_LESSON_NAME . '" ' . _ISMANDATORY, 'required', null, 'client');
$form->addElement('advcheckbox', 'allow_print', _WORKBOOK_ALLOW_PRINT, null, 'class="inputCheckBox"', array(0, 1));
$form->addElement('advcheckbox', 'allow_export', _WORKBOOK_ALLOW_EXPORT, null, 'class="inputCheckBox"', array(0, 1));
$form->addElement('advcheckbox', 'edit_answers', _WORKBOOK_EDIT_ANSWERS, null, 'class="inputCheckBox"', array(0, 1));
$form->addElement('select', 'unit_to_complete', _WORKBOOK_UNIT_TO_COMPLETE, $contentOptions);
$form->addElement('submit', 'submit', _UPDATE, 'class="flatButton"');
if ($isWorkbookPublished == 1) {
$form->freeze('unit_to_complete');
}
$form->setDefaults($workbookSettings);
if ($form->isSubmitted() && $form->validate()) {
$values = $form->exportValues();
$fields = array("lesson_name" => $values['lesson_name'], "allow_print" => $values['allow_print'], "allow_export" => $values['allow_export'], "edit_answers" => $values['edit_answers'], "unit_to_complete" => $values['unit_to_complete']);
if (eF_updateTableData("module_workbook_settings", $fields, "id=" . $workbookSettings['id'])) {
$smarty->assign("T_WORKBOOK_MESSAGE", _WORKBOOK_SETTINGS_SUCCESSFULLY_EDITED);
$smarty->assign("T_WORKBOOK_MESSAGE_TYPE", 'success');
} else {
$smarty->assign("T_WORKBOOK_MESSAGE", _WORKBOOK_SETTINGS_EDIT_PROBLEM);
$smarty->assign("T_WORKBOOK_MESSAGE_TYPE", 'failure');
}
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$renderer->setRequiredTemplate('{$html}{if $required} <span class="formRequired">*</span>{/if}');
$form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
$form->setRequiredNote(_REQUIREDNOTE);
$form->accept($renderer);
$smarty->assign('T_WORKBOOK_EDIT_SETTINGS_FORM', $renderer->toArray());
}
if (isset($_GET['reuse_item']) && $_GET['reuse_item'] == '1') {
if ($_SESSION['s_type'] != 'professor') {
//.........这里部分代码省略.........
示例4: getModule
public function getModule()
{
$smarty = $this->getSmartyVar();
global $load_editor;
$load_editor = true;
$current_user = $this->getCurrentUser();
$smarty->assign("T_MODULE_CURRENT_USER", $current_user->getType());
$form = new HTML_QuickForm("module_mail_form", "post", $this->moduleBaseUrl, "", "id = 'module_mail_form'");
$form->addElement('hidden', 'recipients', $_GET['rec']);
$form->addElement('text', 'subject', _SUBJECT, 'class = "inputText" style = "width:400px"');
$form->addElement('textarea', 'body', _BODY, 'class = "simpleEditor" style = "width:100%;height:200px"');
$form->addElement('checkbox', 'email', _SENDASEMAILALSO, null, 'id = "send_as_email" class = "inputCheckBox"');
$form->addRule('subject', _THEFIELD . ' "' . _SUBJECT . '" ' . _ISMANDATORY, 'required', null, 'client');
$form->addRule('recipients', _THEFIELD . ' "' . _RECIPIENTS . '" ' . _ISMANDATORY, 'required', null, 'client');
$form->addElement('file', 'attachment[0]', _ATTACHMENT, null, 'class = "inputText"');
$form->addElement('submit', 'submit_mail', _SEND, 'class = "flatButton"');
if ($form->isSubmitted() && $form->validate()) {
$values = $form->exportValues();
switch ($values['recipients']) {
case "lesson_students":
$lesson = new EfrontLesson($_SESSION['s_lessons_ID']);
$lessonUsers = $lesson->getUsers("student");
foreach ($lessonUsers as $value) {
$mail_recipients[] = $value['login'];
}
//pr($mail_recipients);return;
break;
case "lesson_professors":
$lesson = new EfrontLesson($_SESSION['s_lessons_ID']);
$lessonUsers = $lesson->getUsers("professor");
if (isset($_SESSION['s_courses_ID'])) {
$course = new EfrontCourse($_SESSION['s_courses_ID']);
$course_users = $course->getCourseUsers();
foreach ($lessonUsers as $key => $value) {
if (!isset($course_users[$key])) {
unset($lessonUsers[$key]);
}
}
}
foreach ($lessonUsers as $value) {
$mail_recipients[] = $value['login'];
}
break;
case "admin":
$result = eF_getTableData("users", "*", "user_type='administrator' and user_types_ID=0 and archive = 0");
//not
foreach ($result as $value) {
$mail_recipients[] = $value['login'];
}
break;
}
//$list = implode(",",$mail_recipients);
$pm = new eF_PersonalMessage($_SESSION['s_login'], $mail_recipients, $values['subject'], $values['body']);
if ($_FILES['attachment']['name'][0] != "") {
$maxFileSize = FileSystemTree::getUploadMaxSize();
if ($_FILES['attachment']['size'][0] == 0 || $_FILES['attachment']['size'][0] > $maxFileSize * 1024) {
// G_MAXFILESIZE is deprecated
$message = _EACHFILESIZEMUSTBESMALLERTHAN . " " . G_MAXFILESIZE . " Bytes";
$message_type = 'failure';
}
//Upload user avatar file
$pm->sender_attachment_timestamp = time();
$user_dir = G_UPLOADPATH . $_SESSION['s_login'] . '/message_attachments/Sent/' . $pm->sender_attachment_timestamp . '/';
mkdir($user_dir, 0755);
$filesystem = new FileSystemTree($user_dir);
$uploadedFile = $filesystem->uploadFile('attachment', $user_dir, 0);
$pm->sender_attachment_fileId = $uploadedFile['id'];
$pm->setAttachment($uploadedFile['path']);
}
if ($pm->send($values['email'], $values)) {
$message = _MESSAGEWASSENT;
$message_type = 'success';
} else {
$message = $pm->errorMessage;
$message_type = 'failure';
}
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
//Create a smarty renderer
$renderer->setRequiredTemplate('{$html}{if $required}
<span class = "formRequired">*</span>
{/if}');
$form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
//Set javascript error messages
$form->setRequiredNote(_REQUIREDNOTE);
$form->accept($renderer);
//Assign this form to the renderer, so that corresponding template code is created
$smarty->assign('T_MODULE_MAIL_FORM', $renderer->toArray());
$smarty->assign("T_MESSAGE_MAIL", $message);
$smarty->assign("T_MESSAGE_MAIL_TYPE", $message_type);
//pr($renderer -> toArray());
return true;
}
示例5: baz_formulaire_des_formulaires
/** baz_formulaire_des_formulaires() retourne le formulaire de saisie des formulaires
* @return Object le code HTML
*/
function baz_formulaire_des_formulaires($mode, $valeursformulaire = '')
{
$GLOBALS['_BAZAR_']['url']->addQueryString('action_formulaire', $mode);
//contruction du squelette du formulaire
$formtemplate = new HTML_QuickForm('formulaire', 'post', preg_replace('/&/', '&', $GLOBALS['_BAZAR_']['url']->getURL()));
$GLOBALS['_BAZAR_']['url']->removeQueryString('action_formulaire');
$squelette =& $formtemplate->defaultRenderer();
$squelette->setFormTemplate('<form {attributes} class="form-horizontal">' . "\n" . '{content}' . "\n" . '</form>' . "\n");
$squelette->setElementTemplate('<div class="control-group form-group">' . "\n" . '<label class="control-label col-sm-3">' . "\n" . '{label}' . '<!-- BEGIN required --><span class="symbole_obligatoire"> *</span><!-- END required -->' . "\n" . ' </label>' . "\n" . '<div class="controls col-sm-9"> ' . "\n" . '{element}' . "\n" . '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->' . "\n" . '</div>' . "\n" . '</div>' . "\n");
$squelette->setElementTemplate('<div class="form-actions form-group">' . "\n" . '<div class="col-sm-9 col-sm-offset-3">{label}{element}</div></div>' . "\n", 'groupe_boutons');
$squelette->setRequiredNoteTemplate("\n" . '<div class="col-sm-9 col-sm-offset-3 symbole_obligatoire">* {requiredNote}</div>' . "\n");
//traduction de champs requis
$formtemplate->setRequiredNote(_t('BAZ_CHAMPS_REQUIS'));
$formtemplate->setJsWarnings(_t('BAZ_ERREUR_SAISIE'), _t('BAZ_VEUILLEZ_CORRIGER'));
//champs du formulaire
if (isset($_GET['idformulaire'])) {
$formtemplate->addElement('hidden', 'bn_id_nature', $_GET['idformulaire']);
}
$formtemplate->addElement('text', 'bn_label_nature', _t('BAZ_NOM_FORMULAIRE'), array('class' => 'form-control input-xxlarge'));
$formtemplate->addElement('text', 'bn_type_fiche', _t('BAZ_CATEGORIE_FORMULAIRE'), array('class' => 'form-control input-xxlarge'));
$formtemplate->addElement('textarea', 'bn_description', _t('BAZ_DESCRIPTION'), array('class' => 'form-control input-xxlarge', 'cols' => '20', 'rows' => '3'));
$formtemplate->addElement('textarea', 'bn_condition', _t('BAZ_CONDITION'), array('class' => 'form-control input-xxlarge', 'cols' => '20', 'rows' => '3'));
$formtemplate->addElement('text', 'bn_label_class', _t('BAZ_NOM_CLASSE_CSS'), array('class' => 'form-control input-xxlarge'));
$formtemplate->addElement('textarea', 'bn_template', _t('BAZ_TEMPLATE'), array('class' => 'form-control input-xxlarge', 'cols' => '20', 'rows' => '15'));
//champs obligatoires
$formtemplate->addRule('bn_label_nature', _t('BAZ_CHAMPS_REQUIS') . ' : ' . _t('BAZ_FORMULAIRE'), 'required', '', 'client');
$formtemplate->addRule('bn_template', _t('BAZ_CHAMPS_REQUIS') . ' : ' . _t('BAZ_TEMPLATE'), 'required', '', 'client');
// Nettoyage de l'url avant les return
$GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION);
$HTML_QuickForm = new HTML_QuickForm();
$buttons[] = $HTML_QuickForm->createElement('submit', 'valider', _t('BAZ_VALIDER'), array('class' => 'btn btn-success'));
$buttons[] = $HTML_QuickForm->createElement('link', 'annuler', _t('BAZ_ANNULER'), str_replace('&', '&', $GLOBALS['_BAZAR_']['url']->getURL()), _t('BAZ_ANNULER'), array('class' => 'btn btn-mini btn-xs btn-danger'));
$formtemplate->addGroup($buttons, 'groupe_boutons', null, ' ', 0);
return $formtemplate;
}
示例6: getModule
//.........这里部分代码省略.........
//If the form is submitted and validated
$values = $form->exportValues();
$fields = array("name" => $values['title'], "lessons_ID" => $values['lessons_ID'] ? $values['lessons_ID'] : $_SESSION['s_lessons_ID'], "description" => $values['description'], "registered" => $values['registered']);
if (isset($_GET['edit_blog'])) {
if (eF_updateTableData("module_blogs", $fields, "id=" . $_GET['edit_blog'])) {
$message = _BLOGS_BLOGUPDATEDSUCCESSFULLY;
$message_type = 'success';
} else {
$message = _BLOGS_BLOGNOTUPDATED;
$message_type = 'failure';
}
eF_redirect("" . $this->moduleBaseUrl . "&message=" . urlencode($message) . "&message_type=" . $message_type);
} else {
$fields['users_LOGIN'] = $_SESSION['s_login'];
$fields['timestamp'] = time();
//pr($fields);
$new_id = eF_insertTableData("module_blogs", $fields);
if ($new_id) {
$message = _BLOGS_BLOGADDEDSUCCESSFULLY;
$message_type = 'success';
eF_redirect("" . $this->moduleBaseUrl . "&message=" . urlencode($message) . "&message_type=" . $message_type . "&edit_blog=" . $new_id . "&tab=blog_creators");
} else {
$message = _BLOGS_BLOGNOTADDED;
$message_type = 'failure';
eF_redirect("" . $this->moduleBaseUrl . "&message=" . urlencode($message) . "&message_type=" . $message_type);
}
}
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
//Create a smarty renderer
$renderer->setRequiredTemplate('{$html}{if $required}
<span class = "formRequired">*</span>
{/if}');
$form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
//Set javascript error messages
$form->setRequiredNote(_REQUIREDNOTE);
$form->accept($renderer);
//Assign this form to the renderer, so that corresponding template code is created
$smarty->assign('T_BLOG_ADD_FORM', $renderer->toArray());
//Assign the form to the template
try {
$lessonUsers = $currentLesson->getUsers();
//Get all users that have this lesson
unset($lessonUsers[$currentUser->login]);
//Remove the current user from the list, he can't set parameters for his self!
$users = $lessonUsers;
$blogsCreators = eF_getTableDataFlat("module_blogs_users", "*", "blogs_ID=" . $_GET['edit_blog']);
$creatorsAssoc = array_combine(array_values($blogsCreators['users_LOGIN']), array_values($blogsCreators['users_LOGIN']));
$nonBlogsCreators = array_diff_key($users, $creatorsAssoc);
$blogsCreatorsTemp = array_diff_key($users, $nonBlogsCreators);
foreach ($users as $key => $user) {
in_array($key, array_values($blogsCreators['users_LOGIN'])) ? $users[$key]['blog_creator'] = true : ($users[$key]['blog_creator'] = false);
}
//pr($users);
$roles = eF_getTableDataFlat("user_types", "name", "active=1 AND basic_user_type!='administrator'");
//Get available roles
if (sizeof($roles) > 0) {
$roles = array_combine($roles['name'], $roles['name']);
//Match keys with values, it's more practical this way
}
$roles = array_merge(array('student' => _STUDENT, 'professor' => _PROFESSOR), $roles);
//Append basic user types to the beginning of the array
//pr($roles);
if (isset($_GET['ajax']) && $_GET['ajax'] == 'usersTable') {
isset($_GET['limit']) && eF_checkParameter($_GET['limit'], 'uint') ? $limit = $_GET['limit'] : ($limit = G_DEFAULT_TABLE_SIZE);
if (isset($_GET['sort']) && eF_checkParameter($_GET['sort'], 'text')) {
示例7: getModule
public function getModule()
{
$smarty = $this->getSmartyVar();
// Always show the preview of the data
if ($_POST['preview'] || $_POST['submit']) {
if ($_POST['questions_format'] == "gift") {
$questions = $this->scanGIFT($_POST['imported_data']);
} else {
$questions = $this->scanAIKEN(str_replace('\\"', '"', str_replace("\\'", "'", $_POST['imported_data'])));
}
if (sizeof($questions)) {
$smarty->assign("T_PREVIEW_DIV", $this->createPreviewHTML($questions));
}
}
// Submit the data the data
if ($_POST['submit']) {
if ($_POST['select_unit'] == -1 || $_POST['select_unit'] == -2) {
$content_ID = 0;
} else {
$content_ID = $_POST['select_unit'];
}
$currentLesson = $this->getCurrentLesson();
$lessons_ID = $currentLesson->lesson['id'];
$count = 0;
foreach ($questions as $key => $question) {
if ($question['type'] != "same" && $question['type'] != "error" && $question['type'] != "no_answer_error") {
$question['content_ID'] = $content_ID;
$question['lessons_ID'] = $lessons_ID;
$question['difficulty'] = "medium";
if (sizeof($question['options'])) {
$question['options'] = serialize($question['options']);
//$question['options'] = str_replace("'", "'", $question['options']);
//$question['options'] = str_replace("\r", "", $question['options']);
}
if (sizeof($question['answer'])) {
// Different accounting for answers of multiple many type
if ($question['type'] == "multiple_many") {
$answers = array();
foreach ($question['answer'] as $answer) {
$answers[$answer] = "1";
}
$question['answer'] = $answers;
}
$question['answer'] = serialize($question['answer']);
//$question['answer'] = str_replace("'", "'", $question['answer']);
//$question['answer'] = str_replace("\r", "", $question['answer']);
}
//$question['text'] = str_replace("'", "'", $question['text']);
if (isset($question['explanation'])) {
//$question['explanation'] = str_replace("'", "'", $question['explanation']);
//$question['explanation'] = str_replace("\r", "", $question['explanation']);
}
if (Question::createQuestion($question)) {
$count++;
}
}
}
if ($count) {
$this->setMessageVar($count . " " . _GIFTAIKEN_QUESTIONSIMPORTEDSUCCESSFULLY, "success");
} else {
$this->setMessageVar(_GIFTAIKEN_NOQUESTIONCOULDBEIMPORTED, "failure");
}
}
$pos = strpos($_SERVER['REQUEST_URI'], "&message");
if ($pos) {
$postUrl = substr($_SERVER['REQUEST_URI'], 0, $pos);
} else {
$postUrl = $_SERVER['REQUEST_URI'];
}
$importForm = new HTML_QuickForm("import_users_form", "post", $postUrl, "", null, true);
$importForm->registerRule('checkParameter', 'callback', 'eF_checkParameter');
//Register this rule for checking user input with our function, eF_checkParameter
$importForm->addElement('radio', 'questions_format', _GIFTAIKEN_GIFT, null, 'gift', 'id="gift_selection"');
$importForm->addElement('radio', 'questions_format', _GIFTAIKEN_AIKEN, null, 'aiken', 'id="aiken_selection"');
$currentLesson = $this->getCurrentLesson();
$currentContent = new EfrontContentTree($currentLesson->lesson['id']);
$smarty->assign("T_UNITS", $currentContent->toHTMLSelectOptions());
$importForm->addElement('textarea', 'imported_data', _GIFTAIKEN_QUESTIONDATATOIMPORT, 'class = "inputProjectTextarea" id="imported_data"');
$importForm->addElement('submit', 'preview', _PREVIEW, 'class=flatButton onclick="$(\'import_users_form\').action += \'&preview=1\'"');
$importForm->addElement('submit', 'submit', _SUBMIT, 'class=flatButton');
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$importForm->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
$importForm->setRequiredNote(_REQUIREDNOTE);
$importForm->accept($renderer);
$smarty->assign('T_GIFTAIKENQUESTIONS_FORM', $renderer->toArray());
return true;
}
示例8: getSmartyTpl
//.........这里部分代码省略.........
$editRule = $rules[$_GET['edit_rule']];
$form->setDefaults($editRule);
}
if ($form->isSubmitted() && $form->validate()) {
$values = $form->exportValues();
$fields = array("title" => $values['title'], "description" => $values['description']);
if ($values['description'] == '') {
$message = _JOURNAL_EMPTY_RULE_DESCRIPTION;
if (isset($_GET['add_rule'])) {
eF_redirect($this->moduleBaseUrl . "&message=" . $message . "&message_type=failure&add_rule=1");
} else {
eF_redirect($this->moduleBaseUrl . "&message=" . $message . "&message_type=failure&edit_rule=" . $_GET['edit_rule']);
}
}
if (isset($_GET['add_rule'])) {
if (eF_insertTableData("module_journal_rules", $fields)) {
$message = _JOURNAL_RULE_SUCCESSFULLY_ADDED;
eF_redirect($this->moduleBaseUrl . "&message=" . $message . "&message_type=success");
} else {
$message = _JOURNAL_RULE_ADD_PROBLEM;
eF_redirect($this->moduleBaseUrl . "&message=" . $message . "&message_type=failure");
}
} else {
if (eF_updateTableData("module_journal_rules", $fields, "id=" . $_GET['edit_rule'])) {
$message = _JOURNAL_RULE_SUCCESSFULLY_EDITED;
eF_redirect($this->moduleBaseUrl . "&message=" . $message . "&message_type=success");
} else {
$message = _JOURNAL_RULE_EDIT_PROBLEM;
eF_redirect($this->moduleBaseUrl . "&message=" . $message . "&message_type=failure");
}
}
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
$form->setRequiredNote(_REQUIREDNOTE);
$form->accept($renderer);
$smarty->assign('T_JOURNAL_ADD_EDIT_RULE_FORM', $renderer->toArray());
} else {
$rules = $this->getRules();
$smarty->assign("T_JOURNAL_RULES", $rules);
$object = eF_getTableData("module_journal_settings", "value", "name='export'");
$smarty->assign("T_JOURNAL_ALLOW_EXPORT", $object[0]['value']);
$object = eF_getTableData("module_journal_settings", "value", "name='preview'");
$smarty->assign("T_JOURNAL_ALLOW_PROFESSOR_PREVIEW", $object[0]['value']);
if ($currentUser->getRole($this->getCurrentLesson()) == 'professor' || $currentUser->getRole($this->getCurrentLesson()) == 'student') {
$activeRules = $this->getRules(true);
$smarty->assign("T_JOURNAL_ACTIVE_RULES", $activeRules);
$entries = $this->getEntries($currentUser->user['login'], $_SESSION['module_journal_entries_from']);
$smarty->assign("T_JOURNAL_ENTRIES", $entries);
$journalLessons = $this->getJournalLessons($currentUser->user['login']);
$smarty->assign("T_JOURNAL_LESSONS", $journalLessons);
/* */
global $load_editor;
$load_editor = true;
if (isset($_GET['edit_entry']) && $_GET['edit_entry'] != '-1') {
$postTarget = "&edit_entry=" . $_GET['edit_entry'];
} else {
$postTarget = "&add_entry=1";
}
if (isset($_GET['hide_right']) && $_GET['hide_right'] == '1') {
$editorStyle = array('small' => 'width:588px; height:320px;', 'medium' => 'width:673px; height:375px;', 'large' => 'width:759px; height:430px;');
} else {
$editorStyle = array('small' => 'width:300px; height:320px;', 'medium' => 'width:344px; height:375px;', 'large' => 'width:388px; height:430px;');
}
$form = new HTML_QuickForm("add_edit_entry_form", "post", $this->moduleBaseUrl . $postTarget, "", null, true);
$form->addElement('textarea', 'entry_body', _DESCRIPTION, 'class="inputContentTextarea simpleEditor" style="' . $editorStyle[$_SESSION['module_journal_dimension']] . '"');
示例9: unset
} else {
$user->user['password'] = $newPassword;
$user->user['need_pwd_change'] = 0;
$user->persist();
unset($_SESSION['s_index_comply']);
if ($GLOBALS['configuration']['show_license_note'] && $user->user['viewed_license'] == 0) {
eF_redirect("index.php?ctg=agreement");
} else {
EfrontEvent::triggerEvent(array("type" => EfrontEvent::SYSTEM_VISITED, "users_LOGIN" => $user->user['login'], "users_name" => $user->user['name'], "users_surname" => $user->user['surname']));
loginRedirect($user->user['user_type']);
}
}
}
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$changePasswordForm->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
$changePasswordForm->setRequiredNote(_REQUIREDNOTE);
$changePasswordForm->accept($renderer);
$smarty->assign('T_CHANGE_PASSWORD_FORM', $changePasswordForm->toArray());
} catch (Exception $e) {
eF_redirect("index.php?message=" . urlencode($e->getMessage() . " (" . $e->getCode() . ")") . "&message_type=failure");
}
}
}
/* ---------------------------------------------------------Activation by email part--------------------------------------------------------- */
if (isset($_GET['account']) && isset($_GET['key']) && eF_checkParameter($_GET['account'], 'login') && eF_checkParameter($_GET['key'], 'timestamp')) {
if ($configuration['activation'] == 0 && $configuration['mail_activation'] == 1 || $configuration['supervisor_mail_activation'] == 1) {
$result = eF_getTableData("users", "timestamp, active", "login='" . $_GET['account'] . "'");
if ($result[0]['active'] == 0 && $result[0]['timestamp'] == $_GET['key']) {
try {
$user = EfrontUserFactory::factory($_GET['account']);
示例10: _factory
/**
* ファクトリー
*
* HTML_QuickFormインスタンス生成
*
* @param mixed $formName フォーム名 | フォーム名配列
* @param array $options オプション
*
* @return HTML_QuickForm
* @access private
*/
private function _factory($formName, array $options)
{
// QuickForm作成
$form = new HTML_QuickForm($formName, $options['method'], $options['action'], $options['target'], $options['attributes'], $options['trackSubmit']);
// 必須項目メッセージ日本語化
$form->setRequiredNote(self::$requireNotes);
// JSメッセージ日本語化
$form->setJsWarnings(self::$jsWarning, '');
// BEAR使用hidden項目
$token = $this->_formToken->getToken();
$form->addElement('hidden', '_token', $token);
$log = $options;
$log['formNames'] = $formName;
$log['token'] = $token;
$this->_log->log('Form', $log);
return $form;
}
示例11: slash
$form->addElement('text', 'height', _("Map Height"), $attrsTextHeight);
$form->addElement('text', 'zoomLevel', _("Zoom Level"), $attrsZoom);
$form->addElement('hidden', 'id');
$redirect = $form->addElement('hidden', 'o');
$redirect->setValue($o);
/*
* Form Rules
*/
function slash($elem = NULL)
{
if ($elem) {
return rtrim($elem, "/") . "/";
}
}
$form->addRule('height', _("You need to fix a map height"), 'required', '', 'client');
$form->setJsWarnings(_("Input Error"), "");
$form->applyFilter('_ALL_', 'trim');
$form->setDefaults($sopt);
$form->addElement('submit', 'submitC', _("Save"));
/*
* Smarty template Init
*/
$tpl = new Smarty();
$tpl = initSmartyTpl($path, $tpl);
if ($form->validate()) {
updateGmapCFG($form->getSubmitValue("id"));
$o = "w";
$valid = true;
$sopt = readConfigOptions($pearDB, $oreon);
}
/*
示例12: getModule
public function getModule()
{
$smarty = $this->getSmartyVar();
$currentLesson = $this->getCurrentLesson();
$currentUser = $this->getCurrentUser();
try {
$currentContent = new EfrontContentTree($_SESSION['s_lessons_ID']);
//Initialize content
} catch (Exception $e) {
$smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
$message = _ERRORLOADINGCONTENT . ": " . $_SESSION['s_lessons_ID'] . ": " . $e->getMessage() . ' (' . $e->getCode() . ') <a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
}
//pr($currentUser);exit;
$roles = EfrontUser::getRoles();
//pr($roles);
if ($roles[$currentUser->lessons[$_SESSION['s_lessons_ID']]] == "professor") {
if (isset($_GET['view_deck']) && eF_checkParameter($_GET['view_deck'], 'id')) {
$deck = $currentContent->seekNode($_GET['view_deck']);
$questions = $deck->getQuestions(true);
$cards = array();
$possibleCardsIds = array();
foreach ($questions as $key => $value) {
if ($value->question['type'] == 'empty_spaces') {
$cards[] = $value;
$possibleCardsIds[] = $value->question['id'];
}
}
$questions = $cards;
//pr($questions);
foreach ($questions as $qid => $question) {
$questions[$qid]->question['text'] = strip_tags($question->question['text']);
//If we ommit this line, then the questions list is html formatted, images are displayed etc, which is *not* the intended behaviour
//$questions[$qid]->question['answer'] = unserialize($question->question['answer']);
}
$res = eF_getTableData("module_flashcards_decks", "cards,options", "content_ID=" . $_GET['view_deck']);
$resCards = unserialize($res[0]['cards']);
$smarty->assign("T_FLASHCARDS_DECK_CARDS", $resCards);
$post_target = $this->moduleBaseUrl . '&view_deck=' . $_GET['view_deck'] . "&tab=options";
//Create form elements
$form = new HTML_QuickForm("deck_options", "post", $post_target, "", null, true);
$form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
$form->addElement('advcheckbox', 'active', _FLASHCARDS_ACTIVE, null, 'class = "inputCheckbox"', array(0, 1));
$form->addElement("text", "low", _LOW, 'size = "5"');
$form->addElement("text", "medium", _MEDIUM, 'size = "5"');
$form->addElement("text", "hard", _HIGH, 'size = "5"');
$form->addElement("text", "very_hard", _VERYHIGH, 'size = "5"');
$form->addRule('low', _INVALIDFIELDDATA . ":" . _LOW, 'checkParameter', 'id');
$form->addRule('medium', _INVALIDFIELDDATA . ":" . _MEDIUM, 'checkParameter', 'id');
$form->addRule('hard', _INVALIDFIELDDATA . ":" . _HIGH, 'checkParameter', 'id');
$form->addRule('very_hard', _INVALIDFIELDDATA . ":" . _VERYHIGH, 'checkParameter', 'id');
$form->addElement('advcheckbox', 'answer_first', _FLASHCARDS_SHOWANSWERFIRST, null, 'class = "inputCheckbox"', array(0, 1));
$form->addElement('advcheckbox', 'shuffle', _FLASHCARDS_SHUFFLECARDS, null, 'class = "inputCheckbox"', array(0, 1));
$form->addElement('advcheckbox', 'display_mastery', _FLASHCARDS_DISPLAYMASTERY, null, 'class = "inputCheckbox"', array(0, 1));
$form->addElement('advcheckbox', 'wrong', _FLASHCARDS_WRONGREDUCES, null, 'class = "inputCheckbox"', array(0, 1));
$form->addElement('advcheckbox', 'show_count', _FLASHCARDS_SHOWSUCCESSCOUNT, null, 'class = "inputCheckbox"', array(0, 1));
$form->addElement('advcheckbox', 'show_explanation', _FLASHCARDS_SHOWEXPLANATION, null, 'class = "inputCheckbox"', array(0, 1));
$form->addElement('submit', 'submit_options', _SAVECHANGES, 'class = "flatButton"');
//The submit content button
$options = unserialize($res[0]['options']);
$form->setDefaults(array('active' => $options['active'], 'answer_first' => $options['answer_first'], 'shuffle' => $options['shuffle'], 'display_mastery' => $options['display_mastery'], 'wrong' => $options['wrong'], 'show_count' => $options['show_count'], 'show_explanation' => $options['show_explanation'], 'low' => $options['low'] == "" ? 1 : $options['low'], 'medium' => $options['medium'] == "" ? 2 : $options['medium'], 'hard' => $options['hard'] == "" ? 4 : $options['hard'], 'very_hard' => $options['very_hard'] == "" ? 6 : $options['very_hard']));
if ($form->isSubmitted() && $form->validate()) {
//If the form is submitted and validated
$values = $form->exportValues();
unset($values['submit_options']);
$options = serialize($values);
if (sizeof($res) != 0) {
$ok = eF_updateTableData("module_flashcards_decks", array('options' => $options), "content_ID=" . $_GET['view_deck']);
} else {
$fields = array('content_ID' => $_GET['view_deck'], 'options' => $options);
$ok = eF_insertTableData("module_flashcards_decks", $fields);
}
if ($ok !== false) {
$message = _FLASHCARDS_SUCCESSFULLY;
$message_type = 'success';
} else {
$message = _FLASHCARDS_PROBLEMOCCURED;
$message_type = 'failure';
}
eF_redirect("" . $this->moduleBaseUrl . "&view_deck=" . $_GET['view_deck'] . "&tab=options&message=" . $message . "&message_type=" . $message_type);
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
//Create a smarty renderer
$form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
//Set javascript error messages
$form->setRequiredNote(_REQUIREDNOTE);
$form->accept($renderer);
//Assign this form to the renderer, so that corresponding template code is created
$smarty->assign('T_FLASHCARDS_OPTIONS', $renderer->toArray());
//Assign the form to the template
if (isset($_GET['postAjaxRequest'])) {
try {
$result = eF_getTableData("module_flashcards_decks", "cards", "content_ID=" . $_GET['view_deck']);
//pr($result);exit;
$cardsArray = unserialize($result[0]['cards']);
if (isset($_GET['id']) && eF_checkParameter($_GET['id'], 'id')) {
if (!in_array($_GET['id'], array_values($cardsArray))) {
$cardsArray[] = $_GET['id'];
$cards = serialize($cardsArray);
if (sizeof($result) != 0) {
$fields = array('cards' => $cards);
//.........这里部分代码省略.........
示例13: elseif
echo $res;
} elseif ($type == 'form') {
// template d'un formulaire bazar
$url = $this->href('json', $this->GetPageTag(), 'demand=save_entry');
//contruction du squelette du formulaire
$formtemplate = new HTML_QuickForm('formulaire', 'post', preg_replace('/&/', '&', $url));
$squelette =& $formtemplate->defaultRenderer();
$squelette->setFormTemplate('<form {attributes} class="form-horizontal content-padded list-spacer" ' . 'novalidate="novalidate">' . "\n" . '{content}' . "\n" . '</form>');
$squelette->setElementTemplate('<div class="control-group form-group">' . "\n" . '<div class="control-label col-xs-3">' . "\n" . '<!-- BEGIN required --><span class="symbole_obligatoire">*</span> <!-- END required -->' . "\n" . '{label} :</div>' . "\n" . '<div class="controls col-xs-8"> ' . "\n" . '{element}' . "\n" . '<!-- BEGIN error -->' . '<span class="alert alert-error alert-danger">{error}</span>' . '<!-- END error -->' . "\n" . '</div>' . "\n" . '</div>' . "\n");
$squelette->setElementTemplate('<div class="control-group form-group">' . "\n" . '<div class="liste_a_cocher"><strong>{label} {element}</strong>' . "\n" . '<!-- BEGIN required -->' . '<span class="symbole_obligatoire"> *</span>' . '<!-- END required -->' . "\n" . '</div>' . "\n" . '</div>' . "\n", 'accept_condition');
$squelette->setElementTemplate('<div class="form-actions">{label}{element}</div>' . "\n", 'groupe_boutons');
$squelette->setElementTemplate('<div class="control-group form-group">' . "\n" . '<div class="control-label col-xs-3">' . "\n" . '{label} :</div>' . "\n" . '<div class="controls col-xs-8"> ' . "\n" . '{element}' . "\n" . '</div>' . "\n" . '</div>', 'select');
$squelette->setRequiredNoteTemplate("<div class=\"symbole_obligatoire\">* {requiredNote}</div>\n");
//Traduction de champs requis
$formtemplate->setRequiredNote(_t('BAZ_CHAMPS_REQUIS'));
$formtemplate->setJsWarnings(_t('BAZ_ERREUR_SAISIE'), _t('BAZ_VEUILLEZ_CORRIGER'));
//antispam
$formtemplate->addElement('hidden', 'antispam', 1);
// generation du formulaire
$form = baz_afficher_formulaire_fiche('saisie', $formtemplate, $url, '', true);
$form = preg_replace('~<div class="form-actions">.*</div>~Ui', "\n" . '<a href="#" class="btn btn-block btn-positive btn-save">' . _t('BAZ_SAVE') . '</a>', $form);
$form = preg_replace('~<div id="map".*>~Ui', "\n" . '<div id="map">', $form);
echo json_encode(array('html' => $form));
}
}
break;
case "forms":
// les formulaires bazar
$formval = baz_valeurs_formulaire($form);
// si un seul formulaire, on cree un tableau à une entrée
if (!empty($form)) {
示例14: header
}
EfrontStats::createViews();
if (!isset($_GET['unattended'])) {
header("location:" . $_SERVER['PHP_SELF'] . "?finish=1");
exit;
}
}
} catch (Exception $e) {
Installation::handleInstallationExceptions($e);
}
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$renderer->setRequiredTemplate('{$html}{if $required}
<span class = "formRequired">*</span>
{/if}');
$form->setJsWarnings('The following errors occured:', 'Please correct the above errors');
$form->setRequiredNote('* Denotes mandatory fields');
$form->accept($renderer);
$smarty->assign('T_DATABASE_FORM', $renderer->toArray());
}
if (isset($_GET['finish']) || isset($_GET['unattended'])) {
if (isset($_GET['unattended'])) {
if ($_GET['ajax']) {
echo json_encode(array('status' => 1, 'message' => 'Successfully completed Unattended upgrade'));
EfrontSystem::unlockSystem();
} else {
header("location:" . G_SERVERNAME . "index.php?delete_install=1");
}
} else {
session_destroy();
unset($_SESSION);
示例15: getModule
//.........这里部分代码省略.........
}
}
$branchCourses = array();
foreach ($result as $value) {
$branchCourses[$value['courses_ID']] = $value['courses_ID'];
}
foreach ($events as $key => $value) {
if (!isset($branchCourses[$key]) && !isset($userCourses[$key])) {
unset($events[$key]);
}
}
} else {
foreach ($events as $key => $value) {
if (!isset($userCourses[$key])) {
unset($events[$key]);
}
}
}
}
if (!isset($_GET['course'])) {
$dataSource = $events;
$tableName = 'outlookInvitationsTable';
isset($_GET['limit']) && eF_checkParameter($_GET['limit'], 'uint') ? $limit = $_GET['limit'] : ($limit = G_DEFAULT_TABLE_SIZE);
if (isset($_GET['sort']) && eF_checkParameter($_GET['sort'], 'text')) {
$sort = $_GET['sort'];
isset($_GET['order']) && $_GET['order'] == 'desc' ? $order = 'desc' : ($order = 'asc');
} else {
$sort = 'login';
}
$dataSource = eF_multiSort($dataSource, $sort, $order);
$smarty->assign("T_TABLE_SIZE", sizeof($dataSource));
if (isset($_GET['filter'])) {
$dataSource = eF_filterData($dataSource, $_GET['filter']);
}
if (isset($_GET['limit']) && eF_checkParameter($_GET['limit'], 'int')) {
isset($_GET['offset']) && eF_checkParameter($_GET['offset'], 'int') ? $offset = $_GET['offset'] : ($offset = 0);
$dataSource = array_slice($dataSource, $offset, $limit);
}
$smarty->assign("T_DATA_SOURCE", $dataSource);
} else {
$course = new EfrontCourse($_GET['course']);
$form = new HTML_QuickForm("import_outlook_invitation_form", "post", $this->moduleBaseUrl . "&course={$course->course['id']}&add_event=1" . (isset($_GET['popup']) ? '&popup=1' : ''), "", null, true);
$form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
//Register this rule for checking user input with our function, eF_checkParameter
$form->addElement('text', 'email', _SENDER, 'class = "inputText"');
$form->addElement('text', 'location', _LOCATION, 'class = "inputText"');
$form->addElement('text', 'subject', _SUBJECT, 'class = "inputText"');
$form->addElement('textarea', 'description', _DESCRIPTION, 'class = "inputTestTextarea" style = "width:80%;height:6em;"');
//$form -> addElement('checkbox', 'calendar', _MODULE_OUTLOOK_INVITATION_CREATE_CALENDAR);
//$form -> addElement('static', 'static', _MODULE_OUTLOOK_INVITATION_INFO);
$form->addElement('submit', 'submit_event_all', _MODULE_OUTLOOK_INVITATION_SENDALL, 'class=flatButton');
$form->addElement('submit', 'submit_event_new', _MODULE_OUTLOOK_INVITATION_SENDNEW, 'class=flatButton');
if (empty($events[$course->course['id']])) {
//new invitation
$currentEvent = null;
$form->setDefaults(array('email' => $currentUser->user['email'], 'subject' => 'Invitation to attend training: ' . $course->course['name']));
} else {
//existing invitation
$currentEvent = $events[$course->course['id']];
$form->setDefaults(array('email' => $currentEvent['email'], 'description' => $currentEvent['description'], 'subject' => $currentEvent['subject'], 'location' => $currentEvent['location']));
}
if ($form->isSubmitted() && $form->validate()) {
try {
$message = "";
// Set info to store into database
$permanent_info = array("courses_ID" => $course->course['id'], "email" => $form->exportValue('email') ? $form->exportValue('email') : $GLOBALS['configuration']['system_email'], "location" => $form->exportValue('location'), "subject" => $form->exportValue('subject'), "description" => $form->exportValue('description'));
if ($currentEvent) {
$permanent_info['sequence'] = $currentEvent['sequence'] + 1;
eF_updateTableData("module_outlook_invitation", $permanent_info, "courses_ID={$course->course['id']}");
} else {
eF_insertTableData("module_outlook_invitation", $permanent_info);
}
if ($form->exportValue('submit_event_all')) {
$users = $course->getCourseUsers(array('active' => true, archive => false, 'return_objects' => false));
$recipients = array();
foreach ($users as $value) {
$recipients[] = $value['email'];
}
$this->sendInvitation($course->course['id'], $recipients);
}
// $smarty->assign('T_RELOAD', true);
if (isset($_GET['popup'])) {
$this->setMessageVar(_OPERATIONCOMPLETEDSUCCESSFULLY, 'success');
} else {
eF_redirect($this->moduleBaseUrl . "&message=" . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . "&message_type=success");
}
} catch (Exception $e) {
$smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
$this->setMessageVar($e->getMessage() . ' (' . $e->getCode() . ') <a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>', 'failure');
}
}
$form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
$form->setRequiredNote(_REQUIREDNOTE);
$smarty->assign('T_MODULE_OUTLOOK_INVITATION_FORM', $form->toArray());
}
$smarty->assign("T_MODULE_BASEDIR", $this->moduleBaseDir);
$smarty->assign("T_MODULE_BASELINK", $this->moduleBaseLink);
$smarty->assign("T_MODULE_BASEURL", $this->moduleBaseUrl);
return true;
}