function location_form_widget($id, $name, $default = '', $width = 'span6', $options = array(), $description = '') { if (!is_object($default)) { $default = new Location($default); } if (empty($default->id)) { $user = new User(); $default->lat = $user->last_location->coords->latitude; $default->lng = $user->last_location->coords->longitude; } $widget = '<div class="control-row">'; //$widget .= template_form_item($id . '_lat', '', 'text', $default, $width, array('readonly' => true)); //$widget .= template_form_item($id . '_lng', '', 'text', $default, $width, array('readonly' => true)); $widget .= template_form_item($id . '_query', '', 'search', $default->name); $widget .= '<input id="' . $id . '_id" name="' . $id . '_id" type="hidden" value="' . $default->id . '"/>'; $widget .= '</div>'; $widget .= '<div class="row-fluid" style="position:relative;">'; $widget .= '<div class="control-row">'; $widget .= '<img src="' . 'https://ss0.4sqi.net/img/devsite/img_poweredby-181a0c7c0fe5f3576d97bcf29ce69d24.png' . '" height=20 class="pull-right" style="margin-right:-10px"/>'; $widget .= '<div class="row-fluid"><div class="span12 location_results" id="location_results"></div></div>'; $widget .= '</div>'; $widget .= '</div>'; $widget .= '<div class="row-fluid">'; $widget .= '<div class="control-row map_field span12 well" id="' . $id . '_map" data-lat="' . $default->lat . '" data-lng="' . $default->lng . '">'; $widget .= '</div>'; $widget .= '</div>'; return $widget; }
function user_login_form() { $message = ''; $user = new User(); if ($user->uid > 0) { redirect('/user/', true); } if (isset($_POST['form_id']) == 'login') { $user->login($_POST['email'], $_POST['password']); if ($user->uid == 0) { message("The username or password you entered was inccorect or your account has not been activated yet", 'error'); } else { redirect('/user/', 301, true); } } $form = '<div class="row-fluid">'; $form .= '<div class="span5">'; $form .= '<form method="post" name="login" id="login" class="form">'; $form .= '<input type="hidden" name="form_id" value="login" id="form_id"/>'; $form .= '<div class="controls controls-row">'; $form .= template_form_item('email', 'E-Mail', 'text', '', 'span6'); $form .= template_form_item('password', 'Password', 'password', '', 'span6'); $form .= '</div>'; $form .= '<div class="controls controls-row">'; $form .= template_form_item('user_login_submit', 'Submit', 'submit', '', 'span2 pull-right'); $form .= '</div>'; $form .= '</form>'; $form .= '</div>'; $form .= '</div>'; $page = new Template(); $page->title = 'Login'; $page->c('<h1>' . 'Login' . '</h1>'); $page->c('<p>' . 'Enter your username and password below to login in, if you don\'t have an account yet click ' . l('Register', '/register') . '</p>'); $page->c($form); return $page->render(); }