function login_form() { tpl_set('page_description', 'Login'); $arg1 = arg(0); $arg2 = arg(1); $arg3 = arg(2); if ($arg1[0] == "register") { if (!$arg2[0]) { // Initiate a new form. $form = new forms(array('name' => 'register_form', 'method' => 'post', 'action' => '', 'class' => 'register_form form-horizontal', 'id' => 'register-form')); $form->add_field(array('type' => 'text', 'name' => 'name', 'label' => t('Name & Surname'))); $form->add_field(array('type' => 'text', 'name' => 'email', 'label' => t('Email Address'))); $form->add_field(array('type' => 'password', 'name' => 'password', 'label' => t('Password'))); $form->add_field(array('type' => 'password', 'name' => 'password_again', 'label' => t('Password Again'))); // Add a submit button. $form->add_button(array('type' => 'submit', 'name' => 'register_button', 'value' => 'Register', 'class' => 'btn btn-primary')); // And now we deal with validations and submissions. $form->validate('permissions.validate_register_form'); $form->submit('permissions.submit_register_form'); } elseif ($arg2[0] == 2) { $node = new node($arg3); tpl_set('node', objectArray($node)); // Initiate a new form. $form = new forms(array('name' => 'register_form', 'method' => 'post', 'action' => '', 'class' => 'register_form form-horizontal', 'id' => 'register-form')); $form->add_field(array('type' => 'text', 'name' => 'activation_code', 'label' => t('Activation Code'))); // Add a submit button. $form->add_button(array('type' => 'submit', 'name' => 'register_button', 'value' => 'Activate', 'class' => 'btn btn-primary')); // And now we deal with validations and submissions. $form->validate('permissions.validate_activation_form'); $form->submit('permissions.submit_activation_form'); } elseif ($arg2[0] == 3) { header('location: ' . base_path()); } } else { if ($arg1[0] == 'lostpassword') { // Initiate a new form. $form = new forms(array('name' => 'register_form', 'method' => 'post', 'action' => '', 'class' => 'register_form form-horizontal', 'id' => 'register-form')); // Now we start to add some fields. $form->add_field(array('type' => 'text', 'name' => 'email', 'label' => t('Email Address'))); // Add a submit button. $form->add_button(array('type' => 'submit', 'name' => 'register_button', 'value' => 'Retrieve', 'class' => 'btn btn-primary')); // And now we deal with validations and submissions. $form->validate('permissions.validate_login_form'); $form->submit('permissions.submit_login_form'); } else { // Initiate a new form. $form = new forms(array('name' => 'login_form', 'method' => 'post', 'action' => '', 'class' => 'login_form form-horizontal', 'id' => 'login-form')); // Now we start to add some fields. $form->add_field(array('type' => 'text', 'name' => 'username', 'label' => t('Username'))); $form->add_field(array('type' => 'password', 'name' => 'password', 'label' => t('Password'))); // Add a submit button. $form->add_button(array('type' => 'submit', 'name' => 'login_button', 'value' => 'Login', 'class' => 'btn btn-primary')); // And now we deal with validations and submissions. $form->validate('permissions.validate_login_form'); $form->submit('permissions.submit_login_form'); } } // form testing $form->render(); }
function view_contact() { $node = new Node(arg(2)); tpl_set('page_title', $node->title); tpl_set('page_description', 'Contact Card'); tpl_set('node', objectArray($node)); tpl_set('keys', array_flip(objectArray($node))); //Get the default contact template $type = node::lookup_type_id('contacts'); $template = node::load_node_template($type); }
function objectArray($array) { if (is_object($array)) { $array = (array) $array; } if (is_array($array)) { foreach ($array as $key => $value) { $array[$key] = objectArray($value); } } return $array; }
echo createFormRowTextField('Parking Address', 'addressLine1', $flag ? 'class="bg"' : '', false, 'size=10px'); $flag = !$flag; echo createFormRowTextField('Address Line 2', 'addressLine2', $flag ? 'class="bg"' : '', false, 'size=10px'); $flag = !$flag; echo createFormRowTextField('City', 'addressCity', $flag ? 'class="bg"' : '', false, 'size=10px'); $flag = !$flag; //state echo createFormRow('State', $flag ? 'class="bg"' : '', false, createStateSelect($conexion, 'addressState')); $flag = !$flag; echo createFormRowTextField('Zip', 'addressZip', $flag ? 'class="bg"' : '', false, 'size=10px'); $flag = !$flag; echo createFormRowTextField('P.O.Box', 'addressBox', $flag ? 'class="bg"' : '', false, 'size=10px'); $flag = !$flag; echo createFormRow('Additional Information', $flag ? 'class="bg"' : '', false, createInputTextArea('truckInfo', '', 'rows="2" cols="43"')); $flag = !$flag; echo createFormRow('Feautres', $flag ? 'class="bg"' : '', false, featureArrayToCheckBoxes(objectArray($conexion, 'feature', 'featureName', 'featureId', 'featureName'), 5)); ?> </table> <table> <tr> <td><?php echo createSimpleButton('submitButton', 'Submit'); ?> </td> </tr> </table> </div> </div> <?include_once '../news.php';?> </div>
function termsArray($handler) { return objectArray($handler, 'term', 'termName asc', 'termId', 'termName'); }
echo createFormRowTextField('Tire Size', 'editTruckTireSize', $flag ? 'class="bg"' : '', false, "size='10px' value='" . $truckInfo['truckTireSize'] . "'"); $flag = !$flag; //parking address echo createFormRowTextField('Parking Address', 'editTruckAddressLine1', $flag ? 'class="bg"' : '', false, "size='10px' value='" . $truckInfo['addressLine1'] . "'"); $flag = !$flag; echo createFormRowTextField('Address Line 2', 'editTruckAddressLine2', $flag ? 'class="bg"' : '', false, "size='10px' value='" . $truckInfo['addressLine2'] . "'"); $flag = !$flag; echo createFormRowTextField('City', 'editTruckAddressCity', $flag ? 'class="bg"' : '', false, "size='10px' value='" . $truckInfo['addressCity'] . "'"); $flag = !$flag; //state echo createFormRow('State', $flag ? 'class="bg"' : '', false, createStateSelect($conexion, 'editTruckAddressState', $truckInfo['addressState'])); $flag = !$flag; echo createFormRowTextField('Zip', 'editTruckAddressZip', $flag ? 'class="bg"' : '', false, "size='10px' value='" . $truckInfo['addressZip'] . "'"); $flag = !$flag; echo createFormRowTextField('P.O.Box', 'editTruckAddressBox', $flag ? 'class="bg"' : '', false, "size='10px' value='" . $truckInfo['addressPOBox'] . "'"); $flag = !$flag; echo createFormRow('Additional Information', $flag ? 'class="bg"' : '', false, createInputTextArea('editTruckInfo', '', 'rows="2" cols="43"', $truckInfo['truckInfo'])); $flag = !$flag; echo createFormRow('Features', $flag ? 'class="bg"' : '', false, featureArrayToCheckBoxes(objectArray($conexion, 'feature', 'featureName', 'featureId', 'featureName'), 5, getTruckCheckedFeatures($conexion, $truckId))); ?> </table> <table> <tr> <td><?php echo createSimpleButton('submitEditTruckButton', 'Submit'); ?> </td> </tr> </table> </div>