/**
  * 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);
     }
 }
Example #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();
     }
 }
Example #6
0
<?php

/***
 * Name:       TinyMVC
 * About:      An MVC application framework for PHP
 * Copyright:  (C) 2007, New Digital Group Inc.
 * Author:     Monte Ohrt, monte [at] ohrt [dot] com
 * License:    LGPL, see included license file  
 ***/
/* PHP error reporting level, if different from default */
error_reporting(E_ALL);
/* if the /tinymvc/ dir is not up one directory, uncomment and set here */
//define('TMVC_BASEDIR','../tinymvc/');
/* if the /myapp/ dir is not inside the /tinymvc/ dir, uncomment and set here */
//define('TMVC_MYAPPDIR','/path/to/myapp/');
/* define to 0 if you want errors/exceptions handled externally */
define('TMVC_ERROR_HANDLING', 1);
/* directory separator alias */
if (!defined('DS')) {
    define('DS', DIRECTORY_SEPARATOR);
}
/* set the base directory */
if (!defined('TMVC_BASEDIR')) {
    define('TMVC_BASEDIR', dirname(__FILE__) . DS . '..' . DS . 'tinymvc' . DS);
}
/* include main tmvc class */
require TMVC_BASEDIR . 'sysfiles' . DS . 'TinyMVC.php';
/* instantiate */
$tmvc = new tmvc();
/* tally-ho! */
$tmvc->main();
Example #7
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;
 }
Example #9
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;
 }
Example #10
0
 function index()
 {
     $tmvc = tmvc::instance();
     $tmvc->smarty->assign('content', $tmvc->smarty->fetch('ende.tpl'));
     $tmvc->smarty->display();
 }
Example #11
0
 public function index()
 {
     $tmvc = tmvc::instance();
     $tmvc->smarty->assign('controller_name', ERROR_404_WANTED_PAGE);
     $tmvc->smarty->display('error_404.tpl');
 }
 function loadDB($poolname = null)
 {
     $this->db = tmvc::instance()->controller->load->database($poolname);
 }
 function __construct()
 {
     $this->path = tmvc::instance()->url_segments;
 }