예제 #1
0
        $token->set($ht);
        $idSess = new sessionVar('id');
        $idSess->set($id);
        // tenemos un plan asignado?
        if ($usuario->plan_usuario > 0) {
            // class _date is from the framework.
            $date = new _date();
            if ($usuario->fecha_pago_usuario >= $date->count()) {
                // redirect using force header('location: '.$param1);
                _::redirect('/' . $ht . '/home.html', false);
            } else {
                // sin pagar
                _::redirect('/' . $ht . '/pagar.html', false);
            }
        } else {
            _::redirect('/' . $ht . '/new_plan.html', false);
        }
    } catch (exception $e) {
        _::$view->assign('error', $e->getMessage());
        _::$view->show('login');
    }
});
_::define_controller('registro', function () {
    define('EXTERA_PAGE', true);
    _::$view->assign('error', false);
    _::$view->show('registro');
});
_::define_controller('registro2', function () {
    // todo: codigo promocional; seleccion de servidor
    define('EXTERA_PAGE', true);
    $nick = _::$post['username'];
예제 #2
0
        // if you need clear format use ->clear()
        // if you need use other timestamp and not current time, use:
        $otherExample = new _date('TIMESTAMP HERE');
    }
});
// massive managment records, and redirects
// we recommend you see the example model before see this controller
_::define_controller('example_4', function () {
    // if you need redirect te code to other controller
    // isn't necessary redirect the client, you can redirect the code using
    // _::redirect('new controller');
    // this line call new controller, and stop execution of current.
    _::redirect('example_3');
    // from here it doesn't execute.
    // if you like redirect client web browser, use:
    _::redirect('http://google.com', false);
    // this stop execution of current code.
    // if you need make all records of a table, you can use:
    $records = model::getAll();
    // this is SELECT * FROM TABLE;
    // if you like add limit, you can use second parammeter:
    $records = model::getAll('LIMIT 1');
    // in the second parammeter you can use WHERE clausule, ORDER BY and LIMIT.
    // getAll is a magic function of ORM, you don't need define it in the model.
    // now, $records get an Array of ids, you need make one object at each.
    // you can use foreach:
    /**
     $objects = array();
     foreach($records as $one_record)
     {
       $objects[] = new model($one_record['primary_key']);