private function _ConfModal($mode, $icon, $type, $action, $auth = false, $conf = false, $prompt = '', $cust = false) { $mod_id = substr(crc32(microtime()), 1, 6); if ($prompt == '') { $prompt = '<p>Are you sure you want to ' . $mode . ' the following ' . $type . ':</p>'; } $mod_content = $prompt . PHP_EOL; $mod_content .= '<ul id="' . $mode . '_' . $type . '"></ul>' . PHP_EOL; $mod_form = new Form($mode . '_f', $action, 'post', 'application/x-www-form-urlencoded', $mode . '_' . $type . '(); return false;'); $mod_form->setColumns(4, 8); $mod_form->addHiddenField($type, '', $type . '_to_' . $mode); if ($auth) { $mod_form->addPasswordField('Your Password', 'pwd', '', array('t' => 'Your password to confirm the operation', 'p' => 'Your Password'), array('t' => 'password', 'r' => true)); } if ($conf) { $mod_form->addButtonGroup('Are you sure?', 'conf', array(array('i' => 'confY' . $mod_id, 's' => B_T_SUCCESS, 'v' => 1, 'l' => 'Yes', 'c' => false), array('i' => 'confN' . $mod_id, 's' => B_T_FAIL, 'v' => 0, 'l' => 'No', 'c' => true)), array('t' => 'Are you sure you wish to perform this action?')); } $mod_form->build(); $mod_content .= $mod_form->getForm(); $mod = new Modal(); $mod->setID($mode); $mod->setTitle(ucfirst($mode) . ' ' . ucfirst($type) . '?'); $mod->setBody($mod_content); $mod->setLeft('default', 'Cancel', 'remove-sign', 'button', '$(\'#' . $mode . '\').modal(\'hide\')'); $mod->setRight('danger', 'OK', $icon, 'button', $mode . '_' . $type . '(this)'); $mod->create(); $this->comps[] = $mod->getModal(); $this->_addConfModalScript($mode, $type, $cust); }
$mForm->openPart('agreement'); $mForm->addElement(new InputCheckBox(), true)->setName('agree')->setId('agree')->setLabel(new Label('I accept the terms and conditions')); $mForm->addElement(new InputSubmit())->setValue('Sent'); $mForm->closePart(); // create from $mForm->create(); echo '<h2>Address</h2>'; //render 'address' $mForm->renderPart('address'); echo '<h2>Customer</h2>'; //render 'customer' $mForm->renderPart('customer'); echo '<h2>Agreement</h2>'; $mForm->renderPart('agreement'); // processing form submission if ($_SERVER['REQUEST_METHOD'] == 'POST') { $sendForm = Form::getForm('mForm'); // Checking if form with this name exist if ($sendForm instanceof Form) { echo '<h2>Data from Form:</h2>'; // validation form elements if ($sendForm->isValid()) { $data = $sendForm->getData(); foreach ($data as $k => $v) { echo $k . ': ' . $v . '<br>'; } } else { echo 'Form is not valid.'; } } }
{ $formHTML = $this->_formHeader; foreach ($this->_form as $inputItem) { $formHTML .= $inputItem . '<br />'; } $formHTML .= '</form>'; return $formHTML; } } $inputField2 = Input::newInput('text', 'lname', 'Last Name'); $inputField3 = Input::newInput('password', 'pass', 'Password'); $form = new Form('index4.php', 'POST'); $form->addNewInput($inputField); $form->addNewInput($inputField2); $form->addNewInput($inputField3); echo $form->getForm(); // Table Class class Table { } // Improved Menu class with id and class attributes class MenuWithAttributes { private $_id; private $_class; private $_menu; private $_menuHeader; public function __construct($id = "", $class = "") { $this->_id = $id; $this->_class = $class;
$checked_note = ""; } if (!isset($checked_all)) { $checked_all = ""; } // vito, 10 june 2009 if ($checked_standard == "" && $checked_note == "" && $checked_all == "") { $checked_all = 'checked'; } $form_dataHa = array(array('label' => translateFN('Nome') . "<br>", 'type' => 'text', 'name' => 's_node_name', 'size' => '20', 'maxlength' => '40', 'value' => $s_node_name), array('label' => translateFN('Keywords') . "<br>", 'type' => 'text', 'name' => 's_node_title', 'size' => '20', 'maxlength' => '40', 'value' => $s_node_title), array('label' => translateFN('Testo') . "<br>", 'type' => 'textarea', 'name' => 's_node_text', 'size' => '40', 'maxlength' => '80', 'value' => $s_node_text), array('label' => '', 'type' => 'submit', 'name' => 'submit', 'value' => translateFN('Cerca'))); $fObj = new Form(); $action = whoami() . ".php"; /*set get method to prevent the confirmation data on back button's browser*/ $fObj->initForm($action, 'GET'); $fObj->setForm($form_dataHa); $search_form = $fObj->getForm(); $Simple_searchLink = "<a href='search.php'>Ricerca semplice</a>"; /* 6. recupero informazioni aggiornate relative all'utente ymdhms: giorno e ora attuali */ /* if ((is_object($userObj)) && (!AMA_dataHandler::isError($userObj))) { if (empty($userObj->error_msg)){ $user_messages = $userObj->get_messagesFN($sess_id_user); $user_agenda = $userObj->get_agendaFN($sess_id_user); } else { $user_messages = $userObj->error_msg; $user_agenda = translateFN("Nessun'informazione");
<?php require_once dirname(__FILE__) . '/classes/FormInput.class.php'; require_once dirname(__FILE__) . '/classes/Form.class.php'; $fi = new FormInput(); $form = new Form($id); if ($form->hasInstance()) { $form_head['form_id'] = array('type' => 'hidden', 'value' => $form->getForm('id')); } else { $form_head['form_id'] = array('type' => 'hidden', 'value' => $form->getNextFormId()); } wp_enqueue_script('global', plugins_url('/js/global.js', __FILE__), array('jquery')); wp_enqueue_script('form_submission', plugins_url('/js/form_submission.js', __FILE__)); wp_enqueue_style('form_buildercss', plugins_url('/css/form_builder.css', __FILE__)); wp_enqueue_style('form_buildercss', plugins_url('/css/form_viewer.css', __FILE__)); ?> <div id="notify"></div> <div id="open_form_viewer"> <? $form->insertInput($form_head);?> <? $form->display(null,true);?> </div>
function add_tag($existing_tagsAr) { $dh = $GLOBALS['dh']; $error = $GLOBALS['error']; $sess_id_course = $GLOBALS['sess_id_course']; $sess_id_node = $GLOBALS['sess_id_node']; $sess_id_user = $GLOBALS['sess_id_user']; $debug = $GLOBALS['debug']; $existing_tagAr = array('bello', 'interessante', 'confuso', 'dubbio'); /* array( 'label'=>'Tag', 'type'=>'text', 'name'=>'description', 'value'=>translateFN('Descrizione del nodo') ), */ $data = array(array('label' => '', 'type' => 'hidden', 'name' => 'id_node', 'value' => $sess_id_node), array('label' => '', 'type' => 'submit', 'name' => 'Submit', 'value' => translateFN('Salva')), array('label' => '', 'type' => 'hidden', 'name' => 'id_user', 'value' => $sess_id_user), array('label' => '', 'type' => 'hidden', 'name' => 'op', 'value' => 'update')); // versione con select $select_field = array('label' => 'Tag', 'type' => 'select', 'name' => 'booomark_title', 'value' => $existing_tagsAr); // versione con input $input_field = array('label' => 'Tag', 'type' => 'text', 'name' => 'booomark_title', 'value' => translateFN("Tag")); if (!is_array($existing_tagsAr)) { array_unshift($data, $input_field); } else { array_unshift($data, $select_field); } $f = new Form(); $f->initForm("tags.php", "POST", "Edit"); $f->setForm($data); $formatted_data .= $f->getForm(); //."</td></tr>"; return $formatted_data; }
$locationScript .= ' $("#event_edit\\\\:\\\\:loc_t").val("%"+jQloc_s.val()+"%");' . PHP_EOL; $locationScript .= ' }' . PHP_EOL; $locationScript .= '});' . PHP_EOL; $form = new Form('event_edit', $action, 'post'); $form->setIndent(' '); $form->addScript($allDayBtns); $form->addScript($locationScript); $form->addBtnLine(array('close' => $closeBtn, 'save' => $saveBtn, 'apply' => $applyBtn)); $form->addTextField('ID', 'id', $ID, array('t' => 'ID of Event'), array('ro' => true)); $form->addTextField('Title', 'title', $title, array('t' => 'Title of Event (Unique)', 'p' => 'Event Title'), array('r' => true, 'v' => true, 'vm' => array('textfieldRequiredMsg' => array('m' => 'An Event Title is required.', 's' => B_T_FAIL), 'textfieldMinCharsMsg' => array('m' => 'An Event Title is required.', 's' => B_T_FAIL), 'textfieldMaxCharsMsg' => array('m' => 'Event title is limited to 100 chars.', 's' => B_T_FAIL)), 'vo' => 'minChars: 0, maxChars: 100, validateOn:["blur"]')); $form->addButtonGroup('Published', 'enable', array(array('i' => 'enabledY', 's' => B_T_SUCCESS, 'v' => 1, 'l' => 'Yes <span class="' . B_ICON . ' ' . B_ICON . '-eye-open"></span>', 'c' => $enabled), array('i' => 'enabledN', 's' => B_T_FAIL, 'v' => 0, 'l' => 'No <span class="' . B_ICON . ' ' . B_ICON . '-eye-close"></span>', 'c' => not($enabled))), array('t' => 'Publish an event to view it on the site.')); $form->addTextField('Start Date', 'start_d', substr($starts, 0, 10), array('t' => 'Date event starts', 'p' => 'Start Date'), array('r' => true, 'v' => true, 't' => 'date', 'vm' => array('textfieldRequiredMsg' => array('m' => 'An Event Start Date is required.', 's' => B_T_FAIL), 'textfieldInvalidFormatMsg' => array('m' => 'Incorrect date format.', 's' => B_T_FAIL)), 'vo' => 'validateOn:["blur"], format: "yyyy-mm-dd"')); $form->addTextField('Start Time', 'start_t', substr($starts, 11), array('t' => 'Time event starts', 'p' => 'Start Time'), array('r' => true, 'v' => true, 't' => 'time', 'vm' => array('textfieldRequiredMsg' => array('m' => 'An Event Start Time is required.', 's' => B_T_FAIL), 'textfieldInvalidFormatMsg' => array('m' => 'Incorrect time format.', 's' => B_T_FAIL)), 'vo' => 'validateOn:["blur"], format: "HH:mm:ss"')); $form->addTextField('Finish Date', 'finish_d', substr($finish, 0, 10), array('t' => 'Date event finishes', 'p' => 'Finish Date'), array('r' => true, 'v' => true, 't' => 'date', 'vm' => array('textfieldRequiredMsg' => array('m' => 'An Event Finish Date is required.', 's' => B_T_FAIL), 'textfieldInvalidFormatMsg' => array('m' => 'Incorrect date format.', 's' => B_T_FAIL)), 'vo' => 'validateOn:["blur"], format: "yyyy-mm-dd"')); $form->addTextField('Finish Time', 'finish_t', substr($finish, 11), array('t' => 'Time event finishes', 'p' => 'Finishes Time'), array('r' => true, 'v' => true, 't' => 'time', 'vm' => array('textfieldRequiredMsg' => array('m' => 'An Event Finish Time is required.', 's' => B_T_FAIL), 'textfieldInvalidFormatMsg' => array('m' => 'Incorrect time format.', 's' => B_T_FAIL)), 'vo' => 'validateOn:["blur"], format: "HH:mm:ss"')); $form->addButtonGroup('All Day', 'allday', array(array('i' => 'alldayY', 's' => B_T_SUCCESS, 'v' => 1, 'l' => 'Yes', 'c' => $allDay), array('i' => 'alldayN', 's' => B_T_FAIL, 'v' => 0, 'l' => 'No', 'c' => not($allDay))), array('t' => 'Is the event all day?')); $form->addSelect('Location', 'loc_s', $locations, array('t' => 'The location of the event. Select a stored event, or use an \'other\' location.'), array('r' => true, 'v' => true, 'vo' => 'validateOn:["blur"]', 'vm' => array())); $form->addTextField('Other Location', 'loc_t', $location, array('t' => 'Enter an \'Other\' location here'), array('classes' => array('hidden'))); $form->addTextArea('Details', 'details', $details, 6, array('t' => 'Details for the event (Recommended unless linking event)', 'p' => 'Details to follow here...'), array('vm' => array('textareaMaxCharsMsg' => array('m' => 'Event details are limited to 500 chars.', 's' => B_T_FAIL)), 'vo' => 'maxChars: 500, useCharacterMasking:false, validateOn:["blur", "change"]', 'c' => true, 'v' => true, 'c' => true)); $form->addTextField('Link', 'link', $link, array('t' => 'Link to event details when user clicks on event in calendar', 'p' => 'http(s)://www.example.com'), array('r' => false, 'v' => true, 't' => 'url', 'vm' => array('textfieldInvalidFormatMsg' => array('m' => 'Incorrect link format.', 's' => B_T_FAIL)), 'vo' => 'validateOn:["blur", "change"]')); $form->addBtnLine(array('close' => $closeBtn, 'save' => $saveBtn, 'apply' => $applyBtn)); $form->build(); ?> <div class="row pane"> <div class="col-sm-12 col-md-11 col-lg-11 col-lg-offset-1 col-md-offset-1"> <?php print $form->getForm(); ?> </div> </div>
<?php require_once dirname(__FILE__) . '/classes/FormInput.class.php'; require_once dirname(__FILE__) . '/classes/Form.class.php'; $fi = new FormInput(); $form = new Form($_GET['id']); $inputtypes = $fi->getInputTypes(); //get the page info foreach (get_pages() as $wp_page) { $pages[] = array($wp_page->ID => $wp_page->post_title); } $db_succ_msg = $form->getForm('success_msg'); $succ_msg_def = "if the page is empty the success message here will display instead."; $succ_msg = empty($db_succ_msg) ? $succ_msg_def : $db_succ_msg; $input_types['input_type'] = array('type' => 'select', 'label' => 'Input Type', 'choices' => $inputtypes, 'add_empty' => true); $form_head['form_name'] = array('type' => 'text', 'label' => 'Form Name', 'value' => $form->getForm('name')); $form_head['wp_post_id'] = array('type' => 'select', 'label' => 'Success Page', 'value' => $form->getForm('wp_post_id'), 'choices' => $pages, 'add_empty' => true); $success_msg['success_msg'] = array('type' => 'textarea', 'label' => 'Success Message', 'value' => $succ_msg, 'attr' => array('rows' => 3, 'cols' => 45)); if ($form->hasInstance()) { $form_head['form_id'] = array('type' => 'hidden', 'value' => $form->getForm('id')); } else { $form_head['form_id'] = array('type' => 'hidden', 'value' => $form->getNextFormId()); $form->clearSession(); } $build_tools['add_input'] = array('type' => 'submit', 'value' => 'Add Input'); $build_tools['update_input'] = array('type' => 'submit', 'value' => 'Update Input'); $build_tools['clear_form'] = array('type' => 'submit', 'value' => 'Clear Form'); $build_tools['save_form'] = array('type' => 'submit', 'value' => 'Save Form'); $input_attr['add_attr'] = array('type' => 'submit', 'value' => 'Add Attribute'); $input_attr['rem_attr'] = array('type' => 'submit', 'value' => 'Remove Attribute'); $input_radio['add_radio'] = array('type' => 'submit', 'value' => 'Add Radio');
header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // HTTP/1.0 //header("Content-Type: text/plain"); header("Content-Type: text/html"); //header("Content-Length: ".filesize($name)); header("Content-Disposition: attachment; filename={$name_tmp}"); echo $log_text; exit; } else { $date = today_dateFN() . " " . today_timeFN() . "\n"; $log_form = new Form(); $log_data = array(array('label' => "", 'type' => 'textarea', 'name' => 'log_today', 'rows' => '10', 'cols' => '80', 'wrap' => 'virtual', 'value' => $date), array('label' => "", 'type' => 'hidden', 'name' => 'log_text', 'value' => $log_text), array('label' => '', 'type' => 'submit', 'name' => 'Submit', 'value' => 'Salva')); $log_form->initForm("{$http_root_dir}/browsing/mylog.php", "POST", "multipart/form-data"); $log_form->setForm($log_data); $log_data = $log_form->getForm(); $log_data .= $log_text; } $export_log_link = "<a href={$http_root_dir}/browsing/mylog.php?op=export>" . translateFN("Esporta") . "</a><br/>"; // Who's online // $online_users_listing_mode = 0 (default) : only total numer of users online // $online_users_listing_mode = 1 : username of users // $online_users_listing_mode = 2 : username and email of users $online_users_listing_mode = 2; $online_users = ADALoggableUser::get_online_usersFN($sess_id_course_instance, $online_users_listing_mode); /* $online_users_listing_mode = 0; // vito 19 gennaio 2009 //$online_users = User::get_online_usersFN($id_course_instance,$online_users_listing_mode); if(isset($sess_id_course_instance) && !empty($sess_id_course_instance)) {