Ejemplo n.º 1
0
 /**
  * class constructor
  *
  * @access	public
  */
 function __construct()
 {
     /* save controller instance */
     tmvc::instance($this, 'controller');
     /* instantiate load library */
     $this->load = new TinyMVC_Load();
     /* instantiate view library */
     $this->view = new TinyMVC_View();
 }
 /**
  * class constructor
  *
  * @access	public
  */
 function __construct()
 {
     /* set the class instance */
     tmvc::instance($this);
     /* instantiate load library */
     $this->load = new TinyMVC_Load();
     /* instantiate view library */
     $this->view = new TinyMVC_View();
 }
 public function __construct()
 {
     parent::__construct();
     header("Content-Type: text/html; charset=utf-8");
     $this->load->library("URI");
     $this->load->library('Smarty_Wrapper', 'smarty');
     $tmvc = tmvc::instance();
     $tmvc->smarty = $this->smarty;
     $tmvc->smarty->assign('base_url', APP_BASE_URL);
 }
 /**
  * trigger_error
  *
  * the error handler method used for all triggerable errors
  *
  * @access	public
  */
 function trigger_error($errno, $errstr, $errfile, $errline)
 {
     /* get instance of tmvc object */
     $tmvc = tmvc::instance();
     /* set error messages */
     $errors['errno'] = $errno;
     $errors['errstr'] = $errstr;
     $errors['errfile'] = $errfile;
     $errors['errline'] = $errline;
     $tmvc->view->view_vars['errors'] = $errors;
     /* display the error view */
     $tmvc->view->sysview('error_view');
     /* exit if not a notice */
     if ($errno == E_USER_ERROR) {
         exit(1);
     }
 }
Ejemplo n.º 5
0
 public function abschliessen()
 {
     for ($i = 0; $i < count($this->questionCollection->questionPages); $i++) {
         if (!$_SESSION['pages_filled'][$i + 1]) {
             header("Location: " . APP_BASE_URL . "fragen/seite/" . ($i + 1));
         }
     }
     $tmvc = tmvc::instance();
     $form = new MyQuickForm('form_finish', 'post', APP_BASE_URL . 'fragen/abschliessen', '', '', true);
     if ($form->validate()) {
         DBfunctions::getInstance()->doSingleCall("DELETE FROM t_person_properties WHERE person_id=?", "i", $_SESSION['person_id']);
         foreach ($_SESSION['properties'] as $prop => $val) {
             DBfunctions::getInstance()->doSingleCall("INSERT INTO t_person_properties(person_id, property, value) VALUES (?, ?, ?)", "iss", $_SESSION['person_id'], $prop, $val);
         }
         DBfunctions::getInstance()->doSingleCall("UPDATE t_persons SET submitted_at=NOW() WHERE id=?", "i", $_SESSION['person_id']);
         $form->resetToken();
         header("Location: " . APP_BASE_URL . "ende");
     } else {
         $form->addReloadLock();
         $form->assignToSmarty($tmvc->smarty);
         $tmvc->smarty->assign('content', $this->questionCollection->buildOutput($tmvc->smarty));
         $tmvc->smarty->display();
     }
 }
Ejemplo n.º 6
0
 public function change_data()
 {
     $tmvc = tmvc::instance();
     $tmvc->smarty->assign('content', 'Daten aendern');
     $tmvc->smarty->display();
 }
 /**
  * library
  *
  * load a library plugin
  *
  * @access	public
  * @param   string $class_name the class name
  * @param   string $alias the property name alias
  * @param   string $filename the filename
  * @return  boolean
  */
 public function library($class_name, $alias = null, $filename = null)
 {
     /* if no alias, use the class name */
     if (!isset($alias)) {
         $alias = $class_name;
     }
     if (empty($alias)) {
         trigger_error("Library name cannot be empty", E_USER_ERROR);
     }
     if (!preg_match('!^[a-zA-Z][a-zA-Z_]+$!', $alias)) {
         trigger_error("Library name '{$alias}' is an invalid syntax", E_USER_ERROR);
     }
     if (method_exists($this, $alias)) {
         trigger_error("Library name '{$alias}' is an invalid (reserved) name", E_USER_ERROR);
     }
     /* library already loaded? silently skip */
     if (isset($this->{$alias})) {
         return true;
     }
     /* if no class exists, attempt to load plugin */
     if (!class_exists($class_name)) {
         /* if no filename, use the class name */
         if (!isset($filename)) {
             $filename = 'library.' . $class_name . '.php';
         }
         /* look in myapps/myfiles/sysfiles plugins dirs */
         $filepath = TMVC_MYAPPDIR . 'plugins' . DS . $filename;
         if (!file_exists($filepath)) {
             $filepath = TMVC_BASEDIR . 'myfiles' . DS . 'plugins' . DS . $filename;
         }
         if (!file_exists($filepath)) {
             $filepath = TMVC_BASEDIR . 'sysfiles' . DS . 'plugins' . DS . $filename;
         }
         if (!file_exists($filepath)) {
             trigger_error("Unknown library '{$class_name}'", E_USER_ERROR);
         }
         require_once $filepath;
         if (!class_exists($class_name)) {
             trigger_error("Unknown classname '{$class_name}'", E_USER_ERROR);
         }
     }
     /* get instance of tmvc object */
     $tmvc = tmvc::instance();
     /* instantiate the object as a property */
     $tmvc->{$alias} = new $class_name();
     return true;
 }
Ejemplo n.º 8
0
 /**
  * library
  *
  * load a library plugin
  *
  * @access	public
  * @param   string $class_name the class name
  * @param   string $alias the property name alias
  * @param   string $filename the filename
  * @return  boolean
  */
 public function library($lib_name, $alias = null, $filename = null)
 {
     /* if no alias, use the class name */
     if (!isset($alias)) {
         $alias = $lib_name;
     }
     if (empty($alias)) {
         throw new Exception("Library name cannot be empty");
     }
     if (!preg_match('!^[a-zA-Z][a-zA-Z_]+$!', $alias)) {
         throw new Exception("Library name '{$alias}' is an invalid syntax");
     }
     if (method_exists($this, $alias)) {
         throw new Exception("Library name '{$alias}' is an invalid (reserved) name");
     }
     /* get instance of tmvc object */
     $controller = tmvc::instance(null, 'controller');
     /* library already loaded? silently skip */
     if (isset($controller->{$alias})) {
         return true;
     }
     $class_name = "TinyMVC_Library_{$lib_name}";
     /* instantiate the object as a property */
     $controller->{$alias} = new $class_name();
     return true;
 }
Ejemplo n.º 9
0
 function index()
 {
     $tmvc = tmvc::instance();
     $tmvc->smarty->assign('content', $tmvc->smarty->fetch('ende.tpl'));
     $tmvc->smarty->display();
 }
Ejemplo n.º 10
0
 public function index()
 {
     $tmvc = tmvc::instance();
     $tmvc->smarty->assign('controller_name', ERROR_404_WANTED_PAGE);
     $tmvc->smarty->display('error_404.tpl');
 }
Ejemplo n.º 11
0
 function loadDB($poolname = null)
 {
     $this->db = tmvc::instance()->controller->load->database($poolname);
 }
Ejemplo n.º 12
0
 function __construct()
 {
     $this->path = tmvc::instance()->url_segments;
 }