Example #1
0
 function edit($document_id, $section)
 {
     //        return __METHOD__." $document_id  $section ";
     $dataManager = new \DataManager();
     $doc = $dataManager->getDocument($document_id);
     $template = new \PHPTemplate();
     $template->assign("document", $doc);
     $template_name = "form_" . $section;
     return $template->fetch($template_name);
 }
Example #2
0
 function show($name)
 {
     $dataManager = new \DataManager();
     $doc = $dataManager->getDocument($name);
     if ($doc === null) {
         $resp = new \Symfony\Component\HttpFoundation\Response("", 404);
         return $resp;
     }
     $template = new \PHPTemplate();
     $template->assign("document", $doc);
     return $template->fetch('show');
 }
 static function setTemplateDir($dir_array)
 {
     if (!is_array($dir_array)) {
         throw new Exception("parameter should be array is of class " . gettype($dir_array));
     }
     if (!isset(self::$template_dir)) {
         self::$template_dir = [];
     }
     self::$template_dir = array_merge(self::$template_dir, $dir_array);
 }
Example #4
0
** This is the front controller for silk route group membership form
**
**/
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

require_once __DIR__.'/api/vendor/autoload.php'; 
require_once __DIR__."/api/src/functions/link_to.php";
require_once __DIR__."/api/src/functions/LinkTo.php";
require_once __DIR__."/api/src/functions/Format.php";
//xdebug_disable();
error_reporting(0);



	PHPTemplate::setTemplateDir([ __DIR__."/api/src/templates"  ]);


	$app = new Silex\Application();
	$app['debug'] = true;
	\Symfony\Component\Debug\ErrorHandler::register();
	\Symfony\Component\Debug\ExceptionHandler::register();

	/**
	 ** Load the front end that contains the JS app via app/index.php
	 */
	$app->get('/', function () use ($app) {
		$text = file_get_contents(__DIR__ . "/app/index.php");
		return $text;
	});
 /**
  * Get PHPTemplate singleton objec
  * @access public
  * @static
  * @return PHPTemplate
  */
 public static function getInstance()
 {
     self::$mSingleton = self::$mSingleton ?: new PHPTemplate();
     return self::$mSingleton;
 }
Example #6
0
 function render($name)
 {
     $dataManager = new \DataManager();
     $doc = $dataManager->getDocument($name);
     if ($doc === null) {
         $resp = new \Symfony\Component\HttpFoundation\Response("", 404);
         return $resp;
     }
     $url1 = $doc->member_one->photo_url;
     $data1 = $dataManager->getPhotoDataBase64($url1);
     $url2 = $doc->member_two->photo_url;
     $data2 = $dataManager->getPhotoDataBase64($url2);
     $url3 = $doc->vehicle->photo_url;
     $data3 = $dataManager->getPhotoDataBase64($url3);
     $imageData = base64_encode($imageContent);
     $template = new \PHPTemplate();
     $template->assign("document", $doc);
     $template->assign("member_one", $doc->member_one);
     $template->assign("member_one_photo_data_base64", $data1);
     $template->assign("member_two", $doc->member_two);
     $template->assign("member_two_photo_data_base64", $data2);
     $template->assign("home_base", $doc->home_base);
     $template->assign("completed_journeys", $doc->completed_journeys);
     $template->assign("planned_journeys", $doc->planned_journeys);
     $template->assign("wish_list_journeys", $doc->wish_list_journeys);
     $template->assign("vehicle", $doc->vehicle);
     $template->assign("vehicle_photo_data_base64", $data3);
     $h = $template->fetch('html');
     file_put_contents($name . "_html_." . "html", $h);
     return $h;
 }
Example #7
0
 /**
  * Template show
  * @access public
  * @static
  * @param string $pTemplateName
  */
 public static function display($pTemplateName = null)
 {
     $template_file = ProjectConfiguration::getConfig('template_dir');
     $template_file .= ($pTemplateName ?: self::getDefaultTemplate()) . '.php';
     self::$mTemplateObj->display($template_file);
 }