Esempio n. 1
0
 public function __construct()
 {
     if (!class_exists('Sighhat\\Config')) {
         throw new \InvalidArgumentException('Cannot locate Config class');
     }
     if (!class_exists('Sighhat\\Controller\\Request')) {
         throw new \InvalidArgumentException('Cannot locate Request class');
     }
     if (!class_exists('Sighhat\\Controller\\Response')) {
         throw new \InvalidArgumentException('Cannot locate Response class');
     }
     if (!class_exists('Sighhat\\View\\Base')) {
         throw new \InvalidArgumentException('Cannot locate View class');
     }
     $this->request = $this->asShared(function ($this) {
         return Request::Instance();
     });
     $this->response = $this->asShared(function ($this) {
         return Response::Instance();
     });
     $this->config = $this->asShared(function ($this) {
         return Config::Instance();
     });
     $this->view = $this->asShared(function ($this) {
         return new View(new DIView());
     });
     $this->cache = $this->asShared(function ($this) {
         return Cache::Instance();
     });
     $this->router = $this->asShared(function ($this) {
         return Router::Instance();
     });
 }
Esempio n. 2
0
 public function __construct($name)
 {
     if ($name instanceof \Sighhat\Form\Element\Base) {
         $name = $name->getName();
     }
     $this->_name = $name;
     $this->_request = \Sighhat\Controller\Request::Instance();
 }
Esempio n. 3
0
 public function __construct()
 {
     if (!class_exists('Sighhat\\Controller\\Request')) {
         throw new \InvalidArgumentException('Cannot locate Request class');
     }
     $this->request = \Sighhat\Controller\Request::Instance();
     $this->router = \Sighhat\Controller\Router::Instance(new DIRouter());
 }
Esempio n. 4
0
 public function render()
 {
     $req = \Sighhat\Controller\Request::Instance();
     $checked = isset($req->{$this->_name}) ? ' checked="checked"' : ($this->_value ? ' checked="checked"' : '');
     $tag = sprintf('<input type="checkbox" name="%s" value="ON" %s', $this->_name, $checked);
     foreach ($this->_attrs as $name => $value) {
         $tag .= sprintf('%s="%s"', $name, $value);
     }
     return $tag . '/>';
 }
Esempio n. 5
0
 public function __construct()
 {
     if (!class_exists('Sighhat\\Config')) {
         throw new \Exception('Cannot locate Config class');
     }
     if (!class_exists('Sighhat\\Controller\\Request')) {
         throw new \Exception('Cannot locate Request class');
     }
     $this->request = $this->asShared(function ($this) {
         return Request::Instance();
     });
     $this->config = $this->asShared(function ($this) {
         return Config::Instance();
     });
 }