当前位置: 首页>>代码示例>>PHP>>正文


PHP Kernel::import方法代码示例

本文整理汇总了PHP中Kernel::import方法的典型用法代码示例。如果您正苦于以下问题:PHP Kernel::import方法的具体用法?PHP Kernel::import怎么用?PHP Kernel::import使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kernel的用法示例。


在下文中一共展示了Kernel::import方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __call

 public function __call($name, $arguments)
 {
     $reflex = new ReflectionClass($this->model->get_called_class());
     $properts = $reflex->getProperties();
     foreach ($properts as $propert) {
         $pname = $propert->getName();
         if ($name == "get" . ucfirst($pname)) {
             $value = $this->model->{$name}();
             if ($value instanceof Constrain && $value->getType() == Constrain::FORAIN_KEY) {
                 $refer_package = $value->getReferPackage();
                 $refer_model = $value->getReferModel();
                 Kernel::import($refer_package . "." . ucfirst($refer_model));
                 $refer_object = new $refer_model();
                 $clone = clone $this;
                 $clone->model = $refer_object;
                 $clone->prefix($pname);
                 return $clone;
             } else {
                 if ($value instanceof Input || $value instanceof Constrain && $value->getType() == Constrain::PRIMARY_KEY) {
                     if (isset($this->value[($this->prefx != null ? $this->prefx . "__" : "") . $pname])) {
                         return $this->value[($this->prefx != null ? $this->prefx . "__" : "") . $pname];
                     } else {
                         return null;
                     }
                 }
             }
         } else {
             if ($name == "set" . ucfirst($pname)) {
                 $value = $this->model->{"get" . ucfirst($pname)}();
                 if ($value instanceof Input) {
                     $value->set($arguments[0]);
                     $this->value[$pname] = $arguments[0];
                 } else {
                     if ($value instanceof Constrain) {
                         $value->set($arguments[0]);
                         $this->value[$pname] = $arguments[0];
                     }
                 }
             }
         }
     }
     return null;
 }
开发者ID:exildev,项目名称:q-stad,代码行数:43,代码来源:PModel.php

示例2: by_model

 /**
  * 
  * @param Model $model
  * @param Objects $object
  * @return Objects
  */
 public static function by_model(Model $model, Objects &$object = null, $prefix = null)
 {
     if ($object == null) {
         $object = Objects::objects($model);
     }
     $reflex = new ReflectionClass($model->get_called_class());
     $properts = $reflex->getProperties();
     $fullname = $model->get_fullname();
     foreach ($properts as $propert) {
         $name = $propert->getName();
         $value = $model->{"get" . $name}();
         if ($value instanceof Constrain && $value->getType() == Constrain::FORAIN_KEY) {
             $refer_package = $value->getReferPackage();
             $refer_model = $value->getReferModel();
             Kernel::import($refer_package . "." . ucfirst($refer_model));
             $fullrefer = $value->getFullRefer();
             $refer_object = new $refer_model();
             $pk = $refer_object->get_pk();
             $pk_name = $pk->name();
             $class = strtolower($refer_object->get_called_class());
             if ($class == "user") {
                 $fullclass = $class;
                 $fullon = "{$fullname}.{$name} = {$class}.{$pk_name}";
             } else {
                 $fullclass = $refer_package . '_' . $class;
                 $fullon = "{$fullname}.{$name} = {$fullrefer}.{$pk_name}";
             }
             $object->join($fullclass, "{$fullon}");
             if ($prefix != null) {
                 $object->refer($fullclass, "{$fullon}");
             } else {
                 $object->refers[0] = $fullclass;
                 array_push($object->basest, "{$name} = {$name}" . "__" . "pk");
             }
             $object = self::by_model($refer_object, $object, ($prefix != null ? $prefix . "__" : "") . $name);
         }
         if ($value instanceof Constrain || $value instanceof Input) {
             if ($value instanceof Constrain && $value->getType() == Constrain::PRIMARY_KEY) {
                 $col = "pk";
             } else {
                 $col = $name;
             }
             $object->select($fullname . "." . $name . " AS " . ($prefix != null ? $prefix . "__" : "") . $col);
             if ($prefix != null) {
                 //var_dump($prefix . "---" . $name . "<br>");
                 $object->others($fullname . "." . $name . " AS " . ($prefix != null ? $prefix . "__" : "") . $col);
             }
         }
     }
     return $object;
 }
开发者ID:exildev,项目名称:q-stad,代码行数:57,代码来源:Objects.php

示例3: update

 public function update(Model $model, $array, $update)
 {
     foreach ($array as $key => $value) {
         $colsn = explode(" = ", $value);
         $cols = explode("__", $colsn[0]);
         $object = $model;
         foreach ($cols as $col) {
             $const = $object->{"get" . ucfirst($col)}();
             if ($const instanceof Constrain) {
                 $refer = $const->getRefer();
                 Kernel::import($refer);
                 $class = $const->getReferModel();
                 $fulln = $const->getFullRefer();
                 $name = $const->name();
                 if ($object == $model) {
                     $this->where("{$col} = {$refer}.{$name}");
                 } else {
                     $this->join($object->get_fullname(), null, $fulln, null, "{$col} = {$refer}.{$name}");
                 }
                 $object = new $class();
             } else {
                 return false;
             }
         }
     }
     return $this->get_sql_update($model->get_fullname(), $update);
 }
开发者ID:exildev,项目名称:q-stad,代码行数:27,代码来源:Colection.php

示例4: __construct

 * and open the template in the editor.
 */
/**
 * Description of Package1
 *
 * @author luism
 */
Kernel::import('package1.Formulario');
Kernel::import('package1.Usuario');
Kernel::import('package1.Pregunta');
Kernel::import('package1.Respuesta_cerrada');
Kernel::import('package1.Respuesta_abierta');
Kernel::import('package1.Pregunta_cerrada');
Kernel::import('package1.Pregunta_abierta');
Kernel::import('package1.Responde');
Kernel::import('package1.Encuestador');
require_once realpath(dirname(__FILE__)) . "/Service.php";
require_once realpath(dirname(__FILE__)) . "/Upload.class.php";
class Package1 extends View
{
    public function __construct()
    {
        parent::__construct(realpath(dirname(__FILE__)) . "/../templ/");
    }
    public function main()
    {
        $user = Session::get_user();
        if ($user != null && $user->getVerified()) {
            return parent::render('menu.html', array());
        } else {
            header("Location: ?ID=login");
开发者ID:exildev,项目名称:q-stad,代码行数:31,代码来源:Package1.php


注:本文中的Kernel::import方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。