Skip to content

Instantly share code, notes, and snippets.

View aguimaraes's full-sized avatar

Alvaro Guimaraes aguimaraes

  • The Modern Milkman
  • Manchester, UK
  • 20:22 (UTC)
View GitHub Profile
/**
* Singleton instance of Session.
*/
public static function instance()
{
if (Session::$instance == NULL)
{
// Create a new instance
new Session;
}
class IndexController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* User controller.
*
* @package wd
* @author Alvaro Guimaraes
* @copyright (c) 2009 Alvaro Guimaraes
* @license http://kohanaphp.com/license.html
*/
<?php
// user ORM factory
$orm_user = ORM::factory('user');
// change data
$orm_user->username = $username;
if($password){
$orm_user->password = $password;
}
<?php defined('SYSPATH') OR die('No direct access allowed.');
class Users_Controller extends Template_Controller {
/**
* See if method needs to have a template.
* If user is not logged in he is redirected to the login method.
*
* @return void
*/
<?php defined('SYSPATH') OR die('No direct access allowed.');
abstract class Template_Controller extends Controller {
// View to be used with template
public $template = 'template/base';
// Template will be loaded in the end of controller
public $auto_render = TRUE;
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Allows a template to be automatically loaded and displayed. Display can be
* dynamically turned off in the controller methods, and the template file
* can be overloaded.
*
* To use it, declare your controller to extend this class:
* `class Your_Controller extends Template_Controller`
*
* $Id: template.php 3769 2008-12-15 00:48:56Z zombor $
Valor mensal: 200
1=> R$ 200
2=> R$ 410
3=> R$ 630.5
4=> R$ 862.03
5=> R$ 1105.13
6=> R$ 1360.38
7=> R$ 1628.4
8=> R$ 1909.82
9=> R$ 2205.31
$("#addform").validate({
rules: {
username: {
required: true,
minLength: 3,
maxLength: 32
}
},
messages: {
username: {
<?php defined('SYSPATH') OR die('No direct access allowed.');
class Auth_User_Model extends ORM {
/**
* Validates and optionally saves a new user record from an array.
*
* @param array values to check
* @param boolean save the record when validation succeeds
* @return boolean