public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new Kernel();
     }
     return self::$instance;
 }
Exemplo n.º 2
0
 public function get()
 {
     if ($this->type == self::FORAIN_KEY) {
         $model = Kernel::instance($this->refer);
         $pk = $model->get_pk();
         $models = $model->filter(array($pk->name() => parent::get()));
         return isset($models[0]) ? $models[0] : '---';
     } else {
         if ($this->type == self::PRIMARY_KEY) {
             return parent::get();
         }
     }
 }
Exemplo n.º 3
0
 public function do_del()
 {
     $user = Session::get_user();
     if ($user instanceof AdminUser && $user != null && $user->getVerified()) {
         $model = $_GET['model'];
         $object = Kernel::instance($model);
         $object->setArray($_POST);
         $r = $object->delete();
         //var_dump($r);
         if ($r) {
             header('HTTP/1.0 200 OK');
             header("Location: ?ID=show&model={$model}");
             exit(0);
         }
         header('HTTP/1.0 406 Not Acceptable');
         $pk = $object->get_pk()->val();
         header("Location: ?ID=del&model={$model}&pk=" . $pk);
     } else {
         header("Location: ?ID=login");
     }
 }
Exemplo n.º 4
0
 protected function getJobService()
 {
     return Kernel::instance()->service('JobService');
 }