예제 #1
0
파일: Db.php 프로젝트: romartyn/cogear
 /**
  * Constructor
  *
  * @param string $name
  */
 public function __construct($name)
 {
     $this->name = $name;
     $path = Gear::preparePath($name, 'templates') . EXT;
     $this->path = $path;
     $this->getTemplate();
 }
예제 #2
0
파일: Object.php 프로젝트: brussens/cogear2
 /**
  * Конструктор
  *
  * @param string $name
  */
 public function __construct($name)
 {
     $this->name = $name;
     event('template', $this);
     event('template.' . $name, $this);
     $path = Gear::preparePath($this->name);
     if (file_exists($path)) {
         $this->path = $path;
     } else {
         $message = t('Шаблон <b>%s</b> не найден по пути <u>%s</u>.', $name, $path);
         exit($message);
     }
 }
예제 #3
0
파일: Object.php 프로젝트: romartyn/cogear
 /**
  * Constructor
  * 
  * @param string|array $options
  */
 public function __construct($options)
 {
     if (is_string($options)) {
         if (!($config = Config::read(Gear::preparePath($options, 'forms') . EXT))) {
             return error(t('Cannot read form config <b>%s</b>.', '', $options));
         } else {
             $options = $config;
         }
     } else {
         $options = Core_ArrayObject::transform($options);
     }
     parent::__construct($options, Options::SELF);
 }
예제 #4
0
파일: File.php 프로젝트: romartyn/cogear
 /**
  * Constructor
  * 
  * @param string $name
  */
 public function __construct($name)
 {
     parent::__construct($name);
     $path = Gear::preparePath($this->name, 'templates') . EXT;
     if (file_exists($path)) {
         $this->path = $path;
         //$this->code = file_get_contents($this->path);
         ini_get('short_open_tag') or $this->code = str_replace('<?=', '<?php echo', $this->code);
     } else {
         /**
          * There we have an option → render as normal error or with just simple exit.
          * If we try to render any Messages (success, notify or error template) we can be easliy catched by looping error throwing us into nowhere.
          * That's why we use such a hint there.
          */
         $message = t('Template <b>%s</b> is not found by path <u>%s</u>.', 'Errors', $this->name, $this->path);
         exit($message);
         //            strpos($this->name, 'Messages') !== FALSE ? exit($message) : error($message);
     }
 }
예제 #5
0
파일: Object.php 프로젝트: brussens/cogear2
 /**
  * Конструктор
  *
  * @param string|array $options
  */
 public function __construct($options)
 {
     $this->elements = new Core_ArrayObject();
     if (is_string($options)) {
         $path = Gear::preparePath($options);
         if (!($config = Config::read($path))) {
             error(t('Не могу прочитать файл конфигурации формы по адресу <b>%s</b>.', $path));
             $options = $this->options;
         } else {
             $options = $config;
         }
     } else {
         $options = Core_ArrayObject::transform($options);
     }
     parent::__construct(Form::filterOptions($options));
     $this->defaults = new Config(cogear()->form->dir . DS . 'defaults' . EXT);
     $this->init();
     event('form.load', $this);
     event('form.load.' . $this->options->name, $this);
 }
예제 #6
0
파일: Widgets.php 프로젝트: romartyn/cogear
 public static function factory($name, $options)
 {
     $path = Gear::preparePath('*' . EXT, 'Widgets');
 }