Example #1
0
File: Crud.php Project: hisaboh/w2t
<?php

Rhaco::import("core.Flow");
Rhaco::import("db.Dao");
Rhaco::import("db.ActiveMapper");
Rhaco::module("CrudTools");
/**
 * @author Kazutaka Tokushima
 * @license New BSD License
 */
class Crud extends Flow
{
    private function get_class($name)
    {
        $this->search_model();
        if (class_exists($name)) {
            return new $name($this->to_dict("primary"));
        }
        return ACTIVE_TABLE($name, null, $this->to_dict("primary"));
    }
    public function do_find($name)
    {
        if ($this->login()) {
            $class = $this->get_class($name);
            $order = $this->inVars("order");
            $paginator = new Paginator(10, $this->inVars("page"));
            $this->vars("object_list", $class->find_page($this->inVars("query"), $paginator, $order, $this->inVars("porder")));
            $this->vars("paginator", $paginator->cp(array("query" => $this->inVars("query"), "porder" => $order)));
            $this->vars("porder", $order);
            $this->vars("model", $class);
            $this->vars("f", new CrudTools($name));
Example #2
0
File: Dao.php Project: hisaboh/w2t
<?php

Rhaco::import("core.Paginator");
Rhaco::import("core.Text");
Rhaco::import("core.Model");
Rhaco::import("db.Db");
Rhaco::import("db.Column");
Rhaco::import("db.Q");
Rhaco::module("StatementIterator");
/**
 * @author Kazutaka Tokushima
 * @license New BSD License
 */
abstract class Dao extends Object implements Model
{
    private static $CONNECTION;
    private static $DAO;
    protected $_database_;
    protected $_table_;
    protected $_has_hierarchy_ = 1;
    private $_columns_ = array();
    private $_self_columns_ = array();
    private $_conds_ = array();
    private $_alias_ = array();
    protected $_class_id_;
    protected $_has_many_conds_ = array();
    protected $_hierarchy_;
    protected function __new__()
    {
        if (func_num_args() == 1) {
            $this->dict(func_get_arg(0));
Example #3
0
/**
 * 呼び出しもとのパッケージを起点としてimportする
 * @param string $path
 * @return string
 */
function module($path)
{
    return Rhaco::module($path, true);
}