本文整理汇总了PHP中HTML_QuickForm::exportValue方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm::exportValue方法的具体用法?PHP HTML_QuickForm::exportValue怎么用?PHP HTML_QuickForm::exportValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_QuickForm
的用法示例。
在下文中一共展示了HTML_QuickForm::exportValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderHtml
function renderHtml()
{
$type_key = $this->context->getTypeKeys();
if (is_numeric($this->query('sletbillede'))) {
$fields = array('date_updated', 'pic_id');
$values = array('NOW()', 0);
$sth = $this->db->autoPrepare('langtkursus_tilmelding', $fields, DB_AUTOQUERY_UPDATE, 'id = ' . $this->query('id'));
$res = $this->db->execute($sth, $values);
if (PEAR::isError($res)) {
throw new Exception($res->getMessage());
}
}
$form = new HTML_QuickForm();
$form->addElement('hidden', 'id', $this->name());
$form->addElement('file', 'userfile', 'Fil');
$form->addElement('submit', null, 'Upload');
if ($form->validate()) {
$file = new VIH_FileHandler();
if ($file->upload('userfile')) {
$fields = array('date_updated', 'pic_id');
$values = array('NOW()', $file->get('id'));
$sth = $this->db->autoPrepare('langtkursus_tilmelding', $fields, DB_AUTOQUERY_UPDATE, 'id = ' . $form->exportValue('id'));
$res = $this->db->execute($sth, $values);
if (PEAR::isError($res)) {
throw new Exception($res->getMessage());
}
return new k_SeeOther($this->url('./'));
}
}
$tilmelding = new VIH_Model_LangtKursus_Tilmelding($this->name());
if ($tilmelding->get('id') == 0) {
throw new k_http_Response(404);
}
$file = new VIH_FileHandler($tilmelding->get('pic_id'));
$file->loadInstance('small');
$extra_html = $file->getImageHtml($tilmelding->get('name'), 'width="100""');
$file->loadInstance('medium');
$stor = $file->get('file_uri');
if (empty($extra_html)) {
$extra_html = $form->toHTML();
} else {
$extra_html .= ' <br /><a href="' . $stor . '">stor</a> <a href="' . url('./') . '?sletbillede=' . $this->name() . '" onclick="return confirm(\'Er du sikker\');">slet billede</a>';
}
$res = $this->db->query('SELECT *, DATE_FORMAT(date_start, "%d-%m %H:%i") AS date_start_dk, DATE_FORMAT(date_end, "%d-%m %H:%i") AS date_end_dk FROM langtkursus_tilmelding_protokol_item WHERE tilmelding_id = ' . (int) $this->name() . ' ORDER BY date_start DESC, date_end DESC');
if (PEAR::isError($res)) {
throw new Exception($res->getMessage());
}
$data = array('items' => $res, 'type_key' => $type_key, 'vis_navn' => false);
$this->document->setTitle($tilmelding->get('navn'));
$this->document->addOption('Ret', $this->url('../../../langekurser/tilmeldinger/' . $tilmelding->get('id')));
$this->document->addOption('Indtast', $this->url('indtast'));
$this->document->addOption('Tilmelding', $this->url('../../../langekurser/tilmeldinger/' . $tilmelding->get('id')));
$this->document->addOption('Fag', $this->url('../../../langekurser/tilmeldinger/' . $tilmelding->get('id') . '/fag'));
$this->document->addOption('Holdliste', $this->context->url());
$this->document->addOption('Diplom', $this->url('../../../langekurser/tilmeldinger/' . $tilmelding->get('id') . '/diplom'));
$tpl = $this->template->create('protokol/liste');
return '<div style="border: 1px solid #ccc; padding: 0.5em; float: right;">' . $extra_html . '</div>
' . $tpl->render($this, $data);
}
示例2: ksort
//Register this rule for checking user input with our function, eF_checkParameter
$form->addElement('text', 'name', _DIRECTIONNAME, 'class = "inputText"');
$form->addRule('name', _THEFIELD . ' ' . _DIRECTIONNAME . ' ' . _ISMANDATORY, 'required', null, 'client');
//$form -> addRule('name', _INVALIDFIELDDATA, 'checkParameter', 'text');
$selectOptions = $directionsPaths;
$selectOptions[0] = _ROOTDIRECTION;
ksort($selectOptions);
$form->addElement('select', 'parent_direction_ID', _PARENTDIRECTION, $selectOptions);
//$form -> addElement("advcheckbox", "active", _ACTIVEFEM, null, 'class = "inputCheckBox"', array(0, 1));
$form->setDefaults($defaults_array);
if (!$_change_) {
$form->freeze();
} else {
$form->addElement('submit', 'submit_direction', _SUBMIT, 'class = "flatButton"');
if ($form->isSubmitted() && $form->validate()) {
$direction_content = array("name" => $form->exportValue('name'), "parent_direction_ID" => $form->exportValue('parent_direction_ID'), "active" => 1);
if (isset($_GET['edit_direction'])) {
$editDirection['name'] = $direction_content['name'];
$editDirection['parent_direction_ID'] = $direction_content['parent_direction_ID'];
$editDirection['active'] = $direction_content['active'];
try {
$editDirection->persist();
eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=directions&message=" . urlencode(_SUCCESFULLYUPDATEDDIRECTION) . "&message_type=success");
} catch (Exception $e) {
$message = _SOMEPROBLEMEMERGED . ': ' . $e->getMessage() . ' (' . $e->getCode() . ')';
$message_type = 'failure';
}
} else {
try {
EfrontDirection::createDirection($direction_content);
eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=directions&message=" . urlencode(_SUCCESFULLYADDEDDIRECTION) . "&message_type=success");
示例3: mkdir
$form->freeze();
} else {
$form->addElement('submit', 'submit_certificate', _SAVE, 'class = "flatButton"');
if ($form->isSubmitted() && $form->validate()) {
$certificateDirectory = G_CERTIFICATETEMPLATEPATH;
if (!is_dir($certificateDirectory)) {
mkdir($certificateDirectory, 0755);
}
$logoid = 0;
try {
if ($_FILES['file_upload']['size'] > 0) {
$filesystem = new FileSystemTree($certificateDirectory);
$uploadedFile = $filesystem->uploadFile('file_upload', $certificateDirectory);
$certificateid = $uploadedFile['id'];
} else {
$selectedCertificate = $form->exportValue('existing_certificate');
$certificateFile = new EfrontFile(G_CERTIFICATETEMPLATEPATH . $selectedCertificate);
if ($certificateFile['id'] < 0) {
//if the file doesn't exist, then import it
$selectedCertificate = $certificateFileSystemTree->seekNode(G_CERTIFICATETEMPLATEPATH . $selectedCertificate);
$newList = FileSystemTree::importFiles($selectedCertificate['path']);
$certificateid = key($newList);
} else {
$certificateid = $certificateFile['id'];
}
}
if (G_VERSIONTYPE != 'standard') {
#cpp#ifndef STANDARD
$duration = $_POST['days'] * 24 * 60 * 60 + $_POST['months'] * 30 * 24 * 60 * 60;
$currentCourse->course['certificate_expiration'] = $duration;
$duration_reset = $form->exportValue('days_reset') * 24 * 60 * 60 + $form->exportValue('months_reset') * 30 * 24 * 60 * 60;
示例4: array
$fields_insert = array('name' => $values['name'], 'languages_NAME' => $languages_NAME, 'directions_ID' => $values['directions_ID'], 'active' => $values['active'], 'duration' => $values['duration'] ? $values['duration'] : 0, 'access_limit' => $values['access_limit'] ? $values['access_limit'] : 0, 'share_folder' => $values['share_folder'] ? $values['share_folder'] : 0, 'max_users' => $values['max_users'] ? $values['max_users'] : null, 'show_catalog' => $values['show_catalog'], 'course_only' => $values['course_only'] == '' ? 0 : $values['course_only'], 'created' => time(), 'price' => str_replace($localeSettings['decimal_point'], '.', $values['price']));
try {
//If we asked to copy properties for another lesson, initialize it and get its properties (except for recurring options, which are already defined in the same page)
if ($values['copy_properties']) {
$copyPropertiesLesson = new EfrontLesson($values['copy_properties']);
unset($copyPropertiesLesson->options['recurring']);
unset($copyPropertiesLesson->options['recurring_duration']);
$fields_insert['options'] = serialize($copyPropertiesLesson->options);
}
//Create the new lesson
$newLesson = EfrontLesson::createLesson($fields_insert);
//If a recurring payment is set, set this up to the lesson properties
if ($values['price'] && $values['recurring'] && in_array($values['recurring'], array_keys($recurringOptions))) {
$newLesson->options['recurring'] = $values['recurring'];
if ($newLesson->options['recurring']) {
$newLesson->options['recurring_duration'] = $form->exportValue($newLesson->options['recurring'] . '_duration');
}
$newLesson->persist();
}
//Import file, if any specified
if ($values['clone_lesson']) {
$cloneLesson = new EfrontLesson($values['clone_lesson']);
$file = $cloneLesson->export();
$exportedFile = $file->copy($newLesson->getDirectory() . '/' . $exportedFile['name']);
}
if (isset($exportedFile)) {
$newLesson->import($exportedFile);
} else {
//There was no file imported, then it's safe to add a default completion condition
$fields = array('lessons_ID' => $newLesson->lesson['id'], 'type' => 'all_units', 'relation' => 'and');
eF_insertTableData('lesson_conditions', $fields);
示例5: doJobCourses
private function doJobCourses()
{
$smarty = $this->getSmartyVar();
$currentUser = $this->getCurrentUser();
$result = eF_getTableData("module_hcd_job_description j left outer join module_hcd_course_to_job_description cj on cj.job_description_ID=j.job_description_ID", "j.job_description_ID,description,branch_ID,count(courses_ID) as total_courses", "", "", "j.job_description_ID");
$branchesTree = new EfrontBranchesTree();
$branchesTreePaths = $branchesTree->toPathString();
$jobs = array();
foreach ($result as $value) {
$jobsArray[$value['job_description_ID']] = $value;
$jobs[$value['job_description_ID']] = $branchesTreePaths[$value['branch_ID']] . " → " . $value['description'] . " (" . $value['total_courses'] . ")";
}
$form = new HTML_QuickForm("job_courses_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=module&op=module_administrator_tools&tab=job_courses&do=enterprise", "", null, true);
$form->addElement('select', 'job', _JOBDESCRIPTION, $jobs);
$form->addElement("submit", "submit", _MODULE_ADMINISTRATOR_TOOLS_COPYCOURSESELECTION, 'class = "flatButton"');
$form->addElement("static", "", _MODULE_ADMINISTRATOR_TOOLS_COPYCOURSESELECTIONTOALLSIMILARJOBS);
$form->setDefaults(array("idle_from_timestamp" => $_SESSION['timestamp_from']));
if ($form->isSubmitted() && $form->validate()) {
$GLOBALS['currentEmployee'] = $currentUser->aspects['hcd'];
$job = new EfrontJob($form->exportValue('job'));
$courses = $job->getJobCourses();
foreach ($sameJobs = $job->getSameDescriptions() as $value) {
eF_deleteTableData("module_hcd_course_to_job_description", "job_description_id = '" . $value . "'");
}
$job->associateCoursesToJob($courses, true);
$message = str_replace(array("%x", "%y"), array(sizeof($sameJobs), sizeof($courses)), _MODULE_ADMINISTRATOR_TOOLS_SUCCESSFULLYASSIGNEDCOURSESTOJOBS);
$message_type = 'success';
$this->setMessageVar($message, $message_type);
}
$smarty->assign("T_JOB_COURSES_FORM", $form->toArray());
}
示例6: localeconv
$smarty->assign("T_COURSE_INSTANCES", $courseInstances);
}
#cpp#endif
}
#cpp#endif
} else {
$form->setDefaults(array('active' => 1, 'show_catalog' => 1, 'price' => 0, 'languages_NAME' => $GLOBALS['configuration']['default_language']));
}
if (!$_change_) {
$form->freeze();
} else {
$form->addElement('submit', 'submit_course', _SUBMIT, 'class = "flatButton"');
if ($form->isSubmitted() && $form->validate()) {
$localeSettings = localeconv();
$values = $form->exportValues();
$fields = array('languages_NAME' => $GLOBALS['configuration']['onelanguage'] ? $GLOBALS['configuration']['default_language'] : $form->exportValue('languages_NAME'), 'show_catalog' => $form->exportValue('show_catalog'), 'directions_ID' => $form->exportValue('directions_ID'), 'name' => $form->exportValue('name'), 'active' => $form->exportValue('active'), 'max_users' => $form->exportValue('max_users') ? $form->exportValue('max_users') : null, 'price' => str_replace($localeSettings['decimal_point'], '.', $form->exportValue('price')), 'ceu' => $form->exportValue('ceu'), 'supervisor_LOGIN' => $values['supervisor_LOGIN'] ? $values['supervisor_LOGIN'] : null);
try {
if (isset($_GET['edit_course'])) {
if ($fields['directions_ID'] != $editCourse->course['directions_ID']) {
$updateCourseInstancesCategory = true;
//This means we need to update instances to match the course's new category
}
$editCourse->course = array_merge($editCourse->course, $fields);
if ($courseSk = $editCourse->getCourseSkill()) {
eF_updateTableData("module_hcd_skills", array("description" => _KNOWLEDGEOFCOURSE . " " . $form->exportValue('name')), "skill_ID = " . $courseSk['skill_ID']);
}
$message = _COURSEUPDATED;
//$redirect = basename($_SERVER['PHP_SELF']).'?ctg=courses&message='.urlencode(_COURSEUPDATED).'&message_type=success';
} else {
$editCourse = EfrontCourse::createCourse($fields);
$message = _SUCCESFULLYCREATEDCOURSE;
示例7:
}
$form->addElement('textarea', 'comments', _COMMENTS, 'class = "inputContentTextarea" style = "width:100%;height:5em;"');
$form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
//Register this rule for checking user input with our function, eF_checkParameter
$form->registerRule('checkNotExist', 'callback', 'eF_checkNotExist');
$form->registerRule('checkRule', 'callback', 'eF_checkRule');
//Register this rule for checking user input with our function, eF_checkParameter
$form->addRule('password_', str_replace("%x", $GLOBALS['configuration']['password_length'], _PASSWORDMUSTBE6CHARACTERS), 'minlength', $GLOBALS['configuration']['password_length'], 'client');
$form->addRule(array('password_', 'passrepeat'), _PASSWORDSDONOTMATCH, 'compare', null, 'client');
$form->addRule('name', _THEFIELD . ' ' . _FIRSTNAME . ' ' . _ISMANDATORY, 'required', null, 'client');
$form->addRule('surname', _THEFIELD . ' ' . _LASTNAME . ' ' . _ISMANDATORY, 'required', null, 'client');
$form->addRule('email', _THEFIELD . ' ' . _EMAILADDRESS . ' ' . _ISMANDATORY, 'required', null, 'client');
$form->addRule('email', _INVALIDFIELDDATA, 'checkParameter', 'email');
if (isset($_GET['add_user'])) {
$form->addRule('login', _INVALIDFIELDDATA, 'checkParameter', 'login');
$form->addRule('login', _THELOGIN . ' "' . $form->exportValue('login') . '" ' . _ALREADYEXISTS, 'checkNotExist', 'login');
$form->addRule('login', _THEFIELD . ' ' . _LOGIN . ' ' . _ISMANDATORY, 'required', null, 'client');
$form->addRule('password_', _THEFIELD . ' ' . _PASSWORD . ' ' . _ISMANDATORY, 'required', null, 'client');
$form->addRule('passrepeat', _THEFIELD . ' ' . _REPEATPASSWORD . ' ' . _ISMANDATORY, 'required', null, 'client');
}
$form->setMaxFileSize(FileSystemTree::getUploadMaxSize() * 1024);
//getUploadMaxSize returns size in KB
if (G_VERSIONTYPE != 'community') {
#cpp#ifndef COMMUNITY
//Add custom fields, defined in user_profile database table
if ($currentUser->user['login'] == $editedUser->user['login']) {
if (isset($_GET['add_user'])) {
$userProfile = eF_getTableData("user_profile", "*", "active=1 AND type <> 'branchinfo' AND type <> 'groupinfo'", "field_order");
//Get admin-defined form fields for user registration
} else {
$userProfile = eF_getTableData("user_profile", "*", "active=1 and visible=1 AND type <> 'branchinfo' AND type <> 'groupinfo'", "field_order");
示例8: catch
} catch (Exception $e) {
handleAjaxExceptions($e);
}
exit;
} elseif (isset($_GET['add_evaluation']) || isset($_GET['edit_evaluation']) && eF_checkParameter($_GET['edit_evaluation'], 'id') && $_change_evaluations_) {
$load_editor = true;
$form = new HTML_QuickForm("evaluations_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=personal&user=" . $editedUser->user['login'] . "&op=evaluations&" . (isset($_GET['edit_evaluation']) ? "&edit_evaluation=" . $_GET['edit_evaluation'] : "&add_evaluation=1"), "", null, true);
$form->addElement('textarea', 'specification', _EVALUATIONCOMMENT, 'class = "simpleEditor" style = "width:400px;"');
$form->addElement('submit', 'submit', _SUBMIT, 'class = "flatButton"');
if (isset($_GET['edit_evaluation'])) {
$evaluations = eF_getTableData("module_hcd_events", "*", "event_ID = '" . $_GET['edit_evaluation'] . "'");
$form->setDefaults(array('specification' => $evaluations[0]['specification']));
}
try {
if ($form->isSubmitted() && $form->validate()) {
$evaluation_content = array('specification' => $form->exportValue('specification'), 'event_code' => 10, 'users_login' => $editedUser->user['login'], 'author' => $currentUser->user['login'], 'timestamp' => time());
if (isset($_GET['add_evaluation'])) {
eF_insertTableData("module_hcd_events", $evaluation_content);
} elseif (isset($_GET['edit_evaluation'])) {
eF_updateTableData("module_hcd_events", $evaluation_content, "event_ID = '" . $_GET['edit_evaluation'] . "'");
}
$message = _OPERATIONCOMPLETEDSUCCESSFULLY;
$message_type = 'success';
}
} catch (Exception $e) {
handleNormalFlowExceptions($e);
}
$smarty->assign("T_EVALUATIONS_FORM", $form->toArray());
} else {
$evaluations = eF_getTableData("module_hcd_events", "*", "users_login = '" . $editedUser->user['login'] . "' AND event_code >=10", "timestamp");
$smarty->assign("T_EVALUATIONS", $evaluations);
示例9: mobile_login
public static function mobile_login()
{
$t = Variable::get('host_ban_time');
if ($t > 0) {
$fails = DB::GetOne('SELECT count(*) FROM user_login_ban WHERE failed_on>%d AND from_addr=%s', array(time() - $t, get_client_ip_address()));
if ($fails >= 3) {
print __('You have exceeded the number of allowed login attempts.') . '<br>';
print '<a href="' . get_epesi_url() . '">' . __('Host banned. Click here to refresh.') . '</a>';
return;
}
}
$qf = new HTML_QuickForm('login', 'post', 'mobile.php?' . http_build_query($_GET));
$qf->addElement('text', 'username', __('Login'));
$qf->addElement('password', 'password', __('Password'));
$qf->addElement('submit', 'submit_button', __('Login'));
$qf->registerRule('check_login', 'callback', 'submit_login', 'Base_User_LoginCommon');
$qf->addRule(array('username', 'password'), __('Login or password incorrect'), 'check_login');
$qf->addRule('username', __('Field required'), 'required');
$qf->addRule('password', __('Field required'), 'required');
if ($qf->validate()) {
self::set_logged($qf->exportValue('username'));
self::new_autologin_id();
return false;
}
$qf->display();
}
示例10: getModule
public function getModule()
{
// Get smarty variable
$smarty = $this->getSmartyVar();
if (isset($_GET['delete_faq']) && eF_checkParameter($_GET['delete_faq'], 'id')) {
eF_deleteTableData("module_faq", "id=" . $_GET['delete_faq']);
eF_redirect("" . $this->moduleBaseUrl . "&message=" . urlencode(_FAQ_SUCCESFULLYDELETEDFAQENTRY) . "&message_type=success");
} else {
if (isset($_GET['add_faq']) || isset($_GET['edit_faq']) && eF_checkParameter($_GET['edit_faq'], 'id')) {
$load_editor = true;
//TODO
$form = new HTML_QuickForm("faq_entry_form", "post", $_SERVER['REQUEST_URI'], "", null, true);
$form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
//Register this rule for checking user input with our function, eF_checkParameter
$form->addElement('textarea', 'question', null, 'class = "simpleEditor" style = "width:100%;height:5em;"');
$form->addElement('textarea', 'answer', null, 'class = "simpleEditor" style = "width:100%;height:25em;"');
$currentLesson = $this->getCurrentLesson();
$units = eF_getTableDataFlat("content", "id, name", "lessons_ID = " . $currentLesson->lesson['id']);
//$units['id'] = array_merge(array("0"), $units['id']);
//$units['name'] = array_merge(array(_FAQ_GENERAL_LESSON), $units['name']);
sizeof($units) > 0 ? $units = array(0 => _FAQ_GENERAL_LESSON) + array_combine($units['id'], $units['name']) : ($units = array("0" => _FAQ_GENERAL_LESSON));
$form->addElement('select', 'related_content', _CONTENT, $units, 'class = "inputSelectLong"');
$form->addElement('submit', 'submit_faq', _SUBMIT, 'class = "flatButton"');
if (isset($_GET['edit_faq'])) {
$faq_entry = eF_getTableData("module_faq", "*", "id=" . $_GET['edit_faq']);
$form->setDefaults(array('related_content' => $faq_entry[0]['unit_ID'], 'question' => $faq_entry[0]['question'], 'answer' => $faq_entry[0]['answer']));
}
if ($form->isSubmitted() && $form->validate()) {
$fields = array('lessons_ID' => $_SESSION['s_lessons_ID'], 'unit_ID' => $form->exportValue('related_content'), 'question' => $form->exportValue('question'), 'answer' => $form->exportValue('answer'));
if (isset($_GET['edit_faq'])) {
if (eF_updateTableData("module_faq", $fields, "id=" . $_GET['edit_faq'])) {
eF_redirect("" . $this->moduleBaseUrl . "&message=" . urlencode(_FAQ_SUCCESFULLYUPDATEDFAQENTRY) . "&message_type=success");
} else {
$this->setMessageVar(_FAQ_PROBLEMUPDATINGFAQENTRY, 'failure');
}
} else {
if (eF_insertTableData("module_faq", $fields)) {
eF_redirect("" . $this->moduleBaseUrl . "&message=" . urlencode(_FAQ_SUCCESFULLYINSERTEDFAQENTRY) . "&message_type=success");
} else {
$this->setMessageVar(_FAQ_PROBLEMINSERTINGFAQENTRY, 'failure');
}
}
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$form->accept($renderer);
$smarty->assign('T_FAQ_FORM', $renderer->toArray());
} else {
$currentLesson = $this->getCurrentLesson();
$faq = eF_getTableDataFlat("module_faq", "*", "lessons_ID=" . $currentLesson->lesson['id']);
$currentUser = $this->getCurrentUser();
$smarty->assign("T_FAQUSERLESSONROLE", $currentUser->getRole($currentLesson));
$smarty->assign("T_FAQ", $faq);
$smarty->assign("T_QUESTIONS_FOUND", sizeof($faq));
}
}
return true;
}
示例11: basename
$user = EfrontUserFactory::factory($_SESSION['s_login']);
$changePasswordForm = new HTML_QuickForm("change_password_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=password_change", "", "class = 'indexForm'", true);
$changePasswordForm->addElement('password', 'old_password', _OLDPASSWORD, 'class = "inputText"');
// SMS: 7/23/2014 Changed to support vLab
// $changePasswordForm -> addElement('password', 'password', _NEWPASSWORD, 'class = "inputText"');
$changePasswordForm->addElement('password', 'password', _NEWPASSWORD, 'class = "inputText"');
$changePasswordForm->addElement('password', 'passrepeat', _REPEATPASSWORD, 'class = "inputText"');
$changePasswordForm->addRule('password', _THEFIELD . ' ' . _PASSWORD . ' ' . _ISMANDATORY, 'required', null, 'client');
$changePasswordForm->addRule('passrepeat', _THEFIELD . ' ' . _REPEATPASSWORD . ' ' . _ISMANDATORY, 'required', null, 'client');
// SMS: 7/23/2014 Changed to support vLab
// $changePasswordForm -> addRule(array('password', 'passrepeat'), _PASSWORDSDONOTMATCH, 'compare', null, 'client');
$changePasswordForm->addRule(array('password', 'passrepeat'), _PASSWORDSDONOTMATCH, 'compare', null, 'client');
$changePasswordForm->addRule('passrepeat', str_replace("%x", $GLOBALS['configuration']['password_length'], _PASSWORDMUSTBE6CHARACTERS), 'minlength', $GLOBALS['configuration']['password_length'], 'client');
$changePasswordForm->addElement('submit', 'submit', _SUBMIT, 'class = "flatButton"');
if ($changePasswordForm->isSubmitted() && $changePasswordForm->validate()) {
$newPassword = $changePasswordForm->exportValue('password');
$newPassword = EfrontUser::createPassword($newPassword);
if ($user->user['password'] != EfrontUser::createPassword($changePasswordForm->exportValue('old_password'))) {
$message = _OLDPASSWORDWRONG;
$message_type = 'failure';
} else {
if ($user->user['password'] == $newPassword) {
$message = _PASSWORDISTHESAME;
$message_type = 'failure';
} 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");
示例12: foreach
foreach ($values['multiple_many'] as $key => $value) {
$form->addElement('text', 'multiple_many[' . $key . ']', 'Insert Questions', 'class = "inputText inputText_QuestionChoice"');
$form->addElement('checkbox', 'correct_multiple_many[' . $key . ']');
$form->addElement('text', 'answers_explanation[' . $key . ']', null, 'class = "inputText inputText_QuestionChoice"' . (!$values['answers_explanation'][$key] ? 'style = "display:none"' : ''));
$form->addRule('multiple_many[' . $key . ']', _THEFIELD . ' ' . _ISMANDATORY, 'required', null, 'client');
$form->setDefaults(array('multiple_many[' . $key . ']' => $value));
$form->setDefaults(array('correct_multiple_many[' . $key . ']' => $values['correct_multiple_many'][$key]));
$form->setDefaults(array('answers_explanation[' . $key . ']' => $values['answers_explanation'][$key]));
}
$form->setDefaults(array('answers_logic' => $currentQuestion->settings['answers_logic']));
if ($currentQuestion->settings['answers_or']) {
//For compatibility reasons, this used to be 'answers_or'
$form->setDefaults(array('answers_logic' => 'or'));
}
if ($form->validate()) {
$question_values = array('type' => 'multiple_many', 'options' => serialize($values['multiple_many']), 'answer' => serialize($values['correct_multiple_many']), 'settings' => serialize(array('answers_logic' => $form->exportValue('answers_logic'))));
}
} else {
//By default, only 2 options are displayed
$form->addElement('text', 'multiple_many[0]', 'Insert Multiple Questions (many)', 'class = "inputText inputText_QuestionChoice"');
$form->addElement('text', 'multiple_many[1]', null, 'class = "inputText inputText_QuestionChoice"');
$form->addElement('text', 'answers_explanation[0]', null, 'class = "inputText inputText_QuestionChoice" style = "display:none"');
$form->addElement('text', 'answers_explanation[1]', null, 'class = "inputText inputText_QuestionChoice" style = "display:none"');
$form->addElement('checkbox', 'correct_multiple_many[0]');
$form->addElement('checkbox', 'correct_multiple_many[1]');
$form->addRule('multiple_many[1]', _THEFIELD . ' ' . _ISMANDATORY, 'required', null, 'client');
$form->addRule('multiple_many[1]', _INVALIDFIELDDATA, 'checkParameter', 'text');
$form->addRule('multiple_many[0]', _THEFIELD . ' ' . _ISMANDATORY, 'required', null, 'client');
}
break;
case 'raw_text':
示例13:
if ($form->validate()) {
// først skal vi oprette en betaling - som kan fungere som id hos qp
// betalingen skal kobles til den aktuelle tilmelding
// når vi så har haft den omkring pbs skal betalingen opdateres med status for betalingen
// status sættes til 000, hvis den er godkendt hos pbs.
$eval = false;
$betaling = new VIH_Model_Betaling('elevforeningen', $order_id);
$betaling_amount_quickpay = $betaling_amount * 100;
$betaling_id = $betaling->save(array('type' => 'quickpay', 'amount' => $betaling_amount));
if ($betaling_id == 0) {
trigger_error("Kunne ikke oprette betaling", E_USER_ERROR);
}
$onlinebetaling = new VIH_Onlinebetaling('authorize');
$onlinebetaling->addCustomVar('Elevforeningsmedlem', $contact['number']);
$onlinebetaling->addCustomVar('Kontaktid', $contact['id']);
$eval = $onlinebetaling->authorize($form->exportValue('cardnumber'), $form->exportValue('yy') . $form->exportValue('mm'), $form->exportValue('cvd'), $betaling_id, $betaling_amount_quickpay);
if ($eval) {
if ($eval['qpstat'] === '000') {
// The authorization was completed
/*
echo 'Authorization: ' . $qpstatText["" . $eval['qpstat'] . ""] . '<br />';
echo "<pre>";
var_dump($eval);
echo "</pre>";
*/
$betaling->setTransactionnumber($eval['transaction']);
$betaling->setStatus('completed');
$historik = new VIH_Model_Historik($betaling->get('belong_to'), $betaling->get('belong_to_id'));
if (!$historik->save(array('type' => 'dankort', 'comment' => 'Onlinebetaling # ' . $betaling->get('transactionnumber')))) {
trigger_error('Der var en fejl med at gemme historikken.', E_USER_ERROR);
}
示例14: basename
} else {
$target = basename($_SERVER['PHP_SELF']) . '?ctg=lessons&catalog=1&checkout=1';
$cancelReturn = G_SERVERNAME . 'studentpage.php?message=' . urlencode(_YOUHAVECANCELLEDTHETRANSACTION);
}
$form = new HTML_QuickForm("my_checkout_form", "post", $target, "", 'style = "display:inline"', true);
$form->addElement('text', 'coupon', null, 'style = "display:none" id = "coupon_code"');
if (G_VERSIONTYPE != 'community') {
#cpp#ifndef COMMUNITY
if ($totalPrice > 0 && ($GLOBALS['configuration']['paypalbusiness'] || $GLOBALS['configuration']['enable_balance'] && $currentUser->user['balance'] && $currentUser->user['balance'] >= $totalPrice)) {
if ($GLOBALS['configuration']['paypalbusiness']) {
$GLOBALS['configuration']['paypalmode'] == 'sandbox' ? $paypalUrl = "www.sandbox.paypal.com" : ($paypalUrl = "www.paypal.com");
//Toggle sandbox/normal use
$GLOBALS['configuration']['paypaldebug'] ? $fieldType = 'text' : ($fieldType = 'hidden');
//$form -> addElement('submit', 'submit_checkout_paypal', _PAYPALPAYNOW, 'class = "flatButton"');
//Calculate price after discount, if any
if ($form->isSubmitted() && $form->validate() && $form->exportValue('coupon') && ($coupon = new coupons($form->exportValue('coupon'), true))) {
if (!$coupon->checkEligibility($currentUser)) {
throw new Exception(_INVALIDCOUPON);
}
$totalPrice = $totalPrice * (1 - $coupon->{$coupon->entity}['discount'] / 100);
$useCoupon = 1;
}
$productNames = $lessonIds = $courseIds = array();
foreach ($cart['lesson'] as $lesson) {
if ($lesson['recurring']) {
!$useCoupon or $lesson['price'] = $lesson['price'] * (1 - $coupon->{$coupon->entity}['discount'] / 100);
//$lesson['product_type'] = 'lesson';
$recurring = $lesson;
}
$productNames[] = $lesson['name'];
$lessonIds[] = $lesson['id'];
示例15: foreach
foreach ($items = $tree->getTree() as $item) {
$items_opts[$item['category_id']] = str_repeat(str_repeat(' ', 4), $item['depth']) . $item['category'];
}
$s = $form->createElement('select', 'item_position', 'Position:', null, array('size' => '10', 'id' => 'item_position'));
$s->loadArray($items_opts);
$form->addElement($s);
// Creates a radio buttons group
$radio[] = $form->createElement('radio', null, null, 'at top', 'new child');
if (count($items) > 0) {
$radio[] = $form->createElement('radio', null, null, 'after this item', 'after child');
}
$form->addGroup($radio, 'insert_type', 'Insert as new sub item');
$form->addElement('html', '</fieldset>');
$form->addRule('category', 'Please enter a category', 'required');
if ($form->validate()) {
$c = ucwords($form->exportValue('category'));
$ip = $form->exportValue('item_position');
$it = $form->exportValue('insert_type');
$form->freeze();
$values = $form->process(array(&$this, 'formValues'), false);
// format values.
$values['category'] = ucwords($values['category']);
$menuBar['add_category'] = '/ushop/products/action-new_category';
$menuBar['back'] = $_SESSION['referer_link'];
//check then enter the record.
if (!$this->getResult('category_id', $ushop->db_name . 'product_categories', null, array('where' => "category='" . $values['category'] . "'"))) {
$insert = array('category' => $values['category']);
$category_id = $tree->insert($values['item_position'], $insert, $values['insert_type']);
if ($category_id) {
$params['TYPE'] = 'pass';
$params['MESSAGE'] = '<h2>Category was successfully entered.</h2>';