00001 <?php
00002
00017 define('INDEX_FILE_LOCATION', dirname(dirname(__FILE__)) . '/index.php');
00018 chdir(dirname(INDEX_FILE_LOCATION));
00019 require('lib/pkp/includes/bootstrap.inc.php');
00020
00021 $application =& PKPApplication::getApplication();
00022 $request =& $application->getRequest();
00023
00024
00025 import('classes.core.PageRouter');
00026 $router = new PageRouter();
00027 $router->setApplication($application);
00028 $request->setRouter($router);
00029
00030 import('classes.template.TemplateManager');
00031 import('lib.pkp.classes.form.Form');
00032
00033
00034
00035
00036
00037
00038
00039 class FBVTemplateManager extends TemplateManager {
00040
00041 function FBVTemplateManager() {
00042 parent::TemplateManager();
00043
00044 $this->caching = 0;
00045
00046
00047 $baseDir = Core::getBaseDir();
00048 $test_template_dir = $baseDir . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'pkp' . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'ui' . DIRECTORY_SEPARATOR . 'fbv';
00049 $this->template_dir[] = $test_template_dir;
00050
00051
00052 $baseUrl = '';
00053 $uriComponents = explode('/', $_SERVER['REQUEST_URI']);
00054
00055 for ($i=0, $count=count($uriComponents); $i<$count; $i++) {
00056 if ($uriComponents[$i] == 'tools' && $uriComponents[$i+1] == 'fbvVisualResults.php') break;
00057 else if (empty($uriComponents[$i])) continue;
00058 else $baseUrl .= '/' . $uriComponents[$i];
00059 }
00060
00061 $this->assign('baseUrl', $baseUrl);
00062 }
00063
00065 function initialize() {
00066 $this->initialized = true;
00067 }
00068
00070 function &getManager($request = null) {
00071 $instance =& Registry::get('templateManager', true, null);
00072
00073 if ($instance === null) {
00074 $instance = new FBVTemplateManager($request);
00075 }
00076 return $instance;
00077 }
00078
00080 function smartyUrl($params, &$smarty) {
00081 return null;
00082 }
00083 }
00084
00085
00086 class fbvVisualResults {
00087
00088 function fbvVisualResults() {
00089 FBVTemplateManager::getManager();
00090 }
00091
00092
00093 function execute() {
00094 if (isset($_GET['display'])) {
00095 switch ($_GET['display']) {
00096 case 'modal':
00097 $testForm = new Form('fbvTestForm.tpl');
00098 break;
00099 default:
00100 $testForm = new Form('fbvTestFormWrapper.tpl');
00101 }
00102 } else {
00103 $testForm = new Form('fbvTestFormWrapper.tpl');
00104 }
00105
00106 $testForm->display();
00107 }
00108
00109 }
00110
00111 $tool = new fbvVisualResults();
00112 $tool->execute();
00113
00114 ?>