public function login() { $this->authenticated = moojon_security::authenticate(); if ($this->authenticated && moojon_server::is_post()) { moojon_flash::set('notification', moojon_config::get('security_login_message')); $this->redirect(moojon_server::get('PHP_SELF')); } }
function boolean_form_for(moojon_base_model $model, moojon_base_column $column, $attributes = array()) { $column_name = $column->get_name(); $id_property = get_primary_key_id_property($model); $id = 'boolean_form_for_' . model_control_name($model, $column_name) . $model->{$id_property}; $attributes = try_set_attribute($attributes, 'id', $id); $attributes = try_set_attribute($attributes, 'method', 'post'); $attributes = try_set_action_attribute($model, $attributes); $src = '/' . moojon_config::get('images_directory') . '/button_boolean' . $column->get_value() . '.' . moojon_config::get('default_image_ext'); $value = $column->get_value() ? '0' : '1'; $children[] = hidden_input_tag(array('name' => model_control_name($model, $column_name), 'value' => $value)); $children[] = method_tag('put'); $children[] = redirection_tag(moojon_server::get('REQUEST_URI') . "#{$id}"); $children[] = hidden_input_tag(array('name' => model_control_name($model, $id_property), 'value' => $model->{$id_property})); $children[] = image_input_tag($src, array('value' => "Set {$column_name} to {$value}", 'alt' => "Set {$column_name} to {$value}", 'value' => "Set {$column_name} to {$value}", 'class' => 'button_boolean')); return form_tag($children, $attributes); }
function back_button($value = 'Back', $attributes = array()) { if (moojon_server::has('HTTP_REFERER')) { $attributes = try_set_attribute($attributes, 'class', 'cancel'); return a_tag($value, array('href' => moojon_server::get('HTTP_REFERER'))); } }