コード例 #1
0
 public function testHandleString()
 {
     $expected = "test-string";
     $handler = new ViewHandler();
     $actual = $handler->handle($expected);
     $this->assertEquals($expected, $actual);
 }
コード例 #2
0
 public function __construct(Get $get, Post $post, Conf $conf, ViewHandler $view, AppMap $appMap)
 {
     $this->_get = $get;
     $this->_post = $post;
     $this->_conf = $conf;
     $this->_view = $view;
     $this->_appMap = $appMap;
     $this->_session = new Zend_Session_Namespace('Main');
     $this->_moduleData['module_name'] = get_class($this);
     $this->_moduleData['module_url_name'] = $this->_appMap->getModuleUrlName(get_class($this));
     $this->_view->assign('module_data', $this->_moduleData);
     $this->_view->assign('appMap', $this->_appMap);
 }
コード例 #3
0
    public static function getPanel() {

        if( !Authorization::isAuthorized() ) return;

        $panelStyles = API::parseStylesFile(CUSTOMPATH.DS."Global.views");
        $paneltpl = $panelStyles["VeronicaAdminPanel"][2];
        $menuItemtpl = $panelStyles["VeronicaMenuListItem"][2];
        $controllers = Api::getCustom("Controller");
        $modeles = Api::getCustom("Model");
        
        $user = Authorization::getCurrentUser();
        
        $userpanel = ViewHandler::wrap("CurrentUser", $user[0]);

        
        $paneltpl = str_replace("<? echo \$USERPANEL;?>", $userpanel, $paneltpl);
        
        $list = "";
        foreach ($controllers as $controller){
            if($controller::$inAdminPanel){
                
                $l = str_replace("<? echo \$ADDCLICKHANDLER;?>", "Controller.add('".$controller::$name."');", $menuItemtpl);
                $l = str_replace("<? echo \$CLICKHANDLER;?>", "Controller.openDashboard('".$controller::$name."');", $l);
                $l = str_replace("<? echo \$COUNT;?>", "Controller.openDashboard('".$controller::$name."');", $l);
                $list .= str_replace("<? echo \$ALIAS;?>", $controller::$alias, $l);
            }
        }
        $paneltpl = str_replace("<? echo \$MENULIST;?>", $list, $paneltpl);
        return $paneltpl;

    }
コード例 #4
0
    public static function getForm( $args ) {
        if( count($args) != 1 ) return false;
        if( $args[0] == null ){

            $item = ModelHandler::getEmptyItem("Users");
            //l($item);
        }else{
            $item = ModelHandler::get("Users", $args);
            $item = $item[0];
        }
        $form = ViewHandler::wrap("Form", $item);
        return $form;
    }
コード例 #5
0
 public static function entry($args) {
     
     if( count($args) > 1 ) echo 404;
     else{
         
         $post  = ModelHandler::get("Posts", array($args[0]));
         $post = $post[0];
         $content = ViewHandler::wrap("post", $post);            
         $tpl = new TPL();
         $tpl->assign("content",$content);
         $tpl->draw("main");
         
     }
     
 }
コード例 #6
0
require_once 'PHP/firebasephp/firebaseLib.php';
//extendedexception files, Will add more over time.
require_once 'PHP/extendedexception/errorcodeininput.php';
require_once 'PHP/extendedexception/erroremptyinput.php';
require_once 'PHP/extendedexception/errorusernameexist.php';
require_once 'PHP/extendedexception/errorpasswordnomatch.php';
require_once 'PHP/extendedexception/errorwrongcredentials.php';
require_once 'PHP/extendedexception/erroroverlayingerror.php';
require_once 'PHP/extendedexception/errorwhitespaceusername.php';
//class the firebase database
$firebase = new \firebase\FirebaseLib('https://frontpagecustom.firebaseio.com/', 'hKaHrJbh6NSCLXWjrBtqgCvepeYB6fF0dviia05D');
$DataBase = new DataBase($firebase);
$SessionModel = new SessionModel();
$LoginModel = new LoginModel($SessionModel, $DataBase);
$RegisterModel = new RegisterModel($SessionModel, $DataBase);
$OptionsModel = new OptionsModel($SessionModel, $DataBase);
$MainModel = new MainModel($SessionModel);
$MainView = new MainView();
$OptionsView = new OptionsView();
$LoginView = new LoginView();
$RegisterView = new RegisterView();
$RegisterHandler = new RegisterHandler($RegisterView, $RegisterModel);
$LoginHandler = new LoginHandler($LoginView, $LoginModel, $DataBase);
$OptionsHandler = new OptionsHandler($OptionsView, $OptionsModel);
$MainHandler = new MainHandler($MainView, $MainModel);
$ViewHandler = new ViewHandler();
$LoginToken = $LoginHandler->login();
$RegisterHandler->register();
$OptionsHandler->options();
$MainHandler->logout();
$ViewHandler->render($LoginToken, $DataBase, $RegisterView, $LoginView, $OptionsView, $MainView);
コード例 #7
0
 /**
  * display view which will be build on template
  *
  * @param string $tpl template 
  */
 public function display($tpl)
 {
     parent::display($tpl);
     $this->_view->display($tpl);
 }
コード例 #8
0
ファイル: rss.php プロジェクト: astroChasqui/open-websoccer
  License along with OpenWebSoccer-Sim.  
  If not, see <http://www.gnu.org/licenses/>.

******************************************************/
define('BASE_FOLDER', __DIR__ . '/..');
include BASE_FOLDER . '/admin/config/global.inc.php';
define('PARAM_PAGE', 'page');
// load configuration
include CONFIGCACHE_FILE_FRONTEND;
// include messages
$i18n = I18n::getInstance($website->getConfig('supported_languages'));
$lang = $website->getRequestParameter('lang');
if ($lang) {
    try {
        $i18n->setCurrentLanguage($lang);
    } catch (Exception $e) {
        // ignore and use default language
    }
}
include sprintf(CONFIGCACHE_MESSAGES, $i18n->getCurrentLanguage());
include sprintf(CONFIGCACHE_ENTITYMESSAGES, $i18n->getCurrentLanguage());
// render RSS
$pageId = $website->getRequestParameter(PARAM_PAGE);
$website->setPageId($pageId);
header('Content-type: application/rss+xml; charset=utf-8');
$viewHandler = new ViewHandler($website, $db, $i18n, $page, $block, null);
try {
    echo $viewHandler->handlePage($pageId, array());
} catch (Exception $e) {
    echo $e->getMessage();
}
コード例 #9
0
ファイル: index.php プロジェクト: astroChasqui/open-websoccer
        } catch (ValidationException $ve) {
            $validationMessages = $ve->getMessages();
            $website->addFrontMessage(new FrontMessage(MESSAGE_TYPE_ERROR, $i18n->getMessage('validation_error_box_title'), $i18n->getMessage('validation_error_box_message')));
        } catch (Exception $e) {
            $website->addFrontMessage(new FrontMessage(MESSAGE_TYPE_ERROR, $i18n->getMessage('errorpage_title'), $e->getMessage()));
        }
    }
    $website->setPageId($pageId);
    // get and set navigation items
    $navItems = NavigationBuilder::getNavigationItems($website, $i18n, $page, $pageId);
    $parameters['navItems'] = $navItems;
    // get and set breadcrumb
    $parameters['breadcrumbItems'] = BreadcrumbBuilder::getBreadcrumbItems($website, $i18n, $page, $pageId);
    // get and render target page
    header('Content-type: text/html; charset=utf-8');
    $viewHandler = new ViewHandler($website, $db, $i18n, $page, $block, $validationMessages);
    try {
        echo $viewHandler->handlePage($pageId, $parameters);
    } catch (AccessDeniedException $e) {
        // show log-in form for user
        if ($website->getUser()->getRole() == ROLE_GUEST) {
            $website->addFrontMessage(new FrontMessage(MESSAGE_TYPE_ERROR, $e->getMessage(), ''));
            echo $viewHandler->handlePage('login', $parameters);
        } else {
            renderErrorPage($website, $i18n, $viewHandler, $e->getMessage(), $parameters);
        }
    } catch (Exception $e) {
        renderErrorPage($website, $i18n, $viewHandler, $e->getMessage(), $parameters);
    }
}
function renderErrorPage($website, $i18n, $viewHandler, $message, $parameters)
コード例 #10
0
 public function execute()
 {
     $this->_view->addCss('global.css');
     $module = $this->_getProperModule();
     $module->execute();
 }
コード例 #11
0
ファイル: php.php プロジェクト: noccy80/lepton-ng
{
    private $path;
    function loadView($view)
    {
        $path = base::expand($view, '/views');
        Console::debugEx(LOG_BASIC, __CLASS__, "Attempting to invoke view from %s", $path);
        if (file_exists($path)) {
            Console::debugEx(LOG_BASIC, __CLASS__, "Invoking as Pure PHP View");
            $this->path = $path;
        } else {
            throw new ViewNotFoundException("The view " . $view . " could not be found");
        }
    }
    function display()
    {
        // TODO: Investigate the consequences of forcing HTTP/1.1 here as just "200" triggers a fatal error on some systems
        if (!headers_sent()) {
            header('HTTP/1.1 200 Content Follows', true);
        }
        $data = $this->getViewData();
        extract($this->_data, EXTR_SKIP);
        include $this->path;
    }
    function import($view)
    {
        $path = base::appPath() . '/views/' . $view;
        include $path;
    }
}
ViewHandler::register('PlainViewHandler', '.*\\.php$');
コード例 #12
0
ファイル: smarty.php プロジェクト: noccy80/lepton-ng
            $this->set('LEPTON_PLATFORM_ID', LEPTON_PLATFORM_ID);
        } else {
            throw new BaseException("Smarty view invoked but Smarty not found");
        }
    }
    function loadView($template)
    {
        $this->template = $template;
        if ($this->smarty) {
            $def = get_defined_constants(true);
            foreach ($def['user'] as $key => $value) {
                $this->smarty->assign($key, $value);
            }
            $data = $this->getViewData();
            foreach ($data as $key => $value) {
                $this->smarty->assign($key, $value);
            }
        } else {
            throw new BaseException("Smarty view loaded but Smarty not found");
        }
    }
    function display()
    {
        if (!headers_sent()) {
            header('HTTP/1.1 200 Content Follows', true);
        }
        $this->smarty->display($this->template);
    }
}
ViewHandler::register('SmartyViewHandler', '.*\\.tpl$');
コード例 #13
0
ファイル: ajax.php プロジェクト: astroChasqui/open-websoccer
if ($website->getConfig('offline') !== 'offline') {
    $parameters = array();
    $validationMessages = null;
    // handle action
    $actionId = $website->getRequestParameter(PARAM_ACTION);
    if ($actionId !== NULL) {
        try {
            ActionHandler::handleAction($website, $db, $i18n, $actionId);
        } catch (ValidationException $ve) {
            $validationMessages = $ve->getMessages();
            $website->addFrontMessage(new FrontMessage(MESSAGE_TYPE_ERROR, $i18n->getMessage('validation_error_box_title'), $i18n->getMessage('validation_error_box_message')));
        } catch (Exception $e) {
            $website->addFrontMessage(new FrontMessage(MESSAGE_TYPE_ERROR, $i18n->getMessage('errorpage_title'), $e->getMessage()));
        }
    }
    $viewHandler = new ViewHandler($website, $db, $i18n, $page, $block, $validationMessages);
    try {
        // get and render target block
        $blockId = $website->getRequestParameter(PARAM_BLOCK);
        if (strlen($blockId) && isset($block[$blockId])) {
            $output['content'] = $viewHandler->renderBlock($blockId, json_decode($block[$blockId], TRUE), $parameters);
        } else {
            // get and render page
            $pageId = $website->getRequestParameter(PARAM_PAGE);
            if ($pageId != null) {
                $website->setPageId($pageId);
                $output['content'] = $viewHandler->handlePage($pageId, $parameters);
            }
        }
    } catch (Exception $e) {
        $website->addFrontMessage(new FrontMessage(MESSAGE_TYPE_ERROR, $i18n->getMessage('errorpage_title'), $e->getMessage()));