Example #1
0
 /**
  * This function raises the error as a callback function for views.
  *
  * @access public
  * @author Kalmer Piiskop <*****@*****.**>
  * @param object $errorFromOutside
  *        	the error object
  */
 public static function raiseError($errorFromOutside)
 {
     require_once 'HTML/Template/IT.php';
     $template = new \HTML_Template_IT(ROOT_FOLDER . '../html');
     $template->loadTemplateFile('errors.html');
     $template->setCurrentBlock('html');
     $template->setVariable(array('TITLE-OF-ERROR' => \pstk\String::translate('titleOfError'), 'MESSAGE' => $errorFromOutside->getMessage(), 'DEBUG-INFO' => $errorFromOutside->getDebugInfo()));
     $template->parse('html');
     exit($template->get('html'));
 }
Example #2
0
 /**
  * This function builds the main view.
  * 
  * @access public
  * @param string $parameters['css']
  *        the CSS-part
  * @param string $parameters['js']
  *        the JS-part
  * @param string $parameters['name']
  *        the current name searched
  * @param string $parameters['target']
  *        the target in the URL
  * @return string the parsed block
  * @uses Configuration for the folder of the template
  */
 public static function buildView($parameters)
 {
     require_once 'HTML/Template/IT.php';
     $template = new \HTML_Template_IT(Configuration::ROOT_FOLDER);
     $template->loadTemplateFile('pupils.html');
     $template->setCurrentBlock('html');
     $template->setVariable(array('NAME' => $parameters['name'], 'STYLE' => $parameters['css'], 'SCRIPT' => $parameters['js'], 'TARGET' => $parameters['target']));
     $template->parse('html');
     return $template->get('html');
 }
Example #3
0
 /**
  * This function builds the Calculator
  * @access public
  * @author Eleri<*****@*****.**>
  * @param number $result tulemus(result)
  * @param number $first esimene kasutaja poolt sisestatud muutuja
  * @param number $second teine kasutaja poolt sisestatud muutuja
  */
 public static function build($result, $first, $second)
 {
     require_once 'HTML/Template/IT.php';
     $variable = new \HTML_Template_IT(ROOT_FOLDER);
     $variable->loadTemplateFile('tunnis.html');
     $variable->setCurrentBlock('html');
     $variable->setVariable(array('SAMP' => $result, 'FIRST-VALUE' => $first, 'SECOND-VALUE' => $second, 'BEGINNING-OF-URL' => BEGINNING_OF_URL));
     $variable->parse('html');
     echo $variable->get('html');
 }
Example #4
0
 /**
  * Initialize a TemplateObject
  *
  * @param string  $file     filename of the template file
  *
  * @return object Object of HTML/IT - Template - Class
  */
 function _initTemplate($file)
 {
     // Errors here can not be displayed using the UI
     PEAR::staticPushErrorHandling(PEAR_ERROR_DIE);
     $tpl_dir = $this->config->get('data_dir') . DIRECTORY_SEPARATOR . 'PEAR_Frontend_Web' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'templates';
     if (!file_exists($tpl_dir) || !is_readable($tpl_dir)) {
         PEAR::raiseError('<b>Error:</b> the template directory <i>(' . $tpl_dir . ')</i> is not a directory, or not readable. Make sure the \'data_dir\' of your config file <i>(' . $this->config->get('data_dir') . ')</i> points to the correct location !');
     }
     $tpl = new HTML_Template_IT($tpl_dir);
     $tpl->loadTemplateFile($file);
     $tpl->setVariable("InstallerURL", $_SERVER["PHP_SELF"]);
     PEAR::staticPopErrorHandling();
     // reset error handling
     return $tpl;
 }
Example #5
0
<?php

/* vim: set expandtab tabstop=4 shiftwidth=4: */
//
// +----------------------------------------------------------------------+
// | MoleCMS                                                              |
// +----------------------------------------------------------------------+
// | Copyright (c) 2000-2002 MoleManMedia Tim Franz                       |
// +----------------------------------------------------------------------+
// | Authors: Tim Franz <*****@*****.**>                               |
// +----------------------------------------------------------------------+
//
// $Id: details.php,v 1.1 2002/08/07 09:25:41 moleman Exp $
$query = "SELECT rc_jobs.*,\n\t\t            rc_jobs_category.category_" . LC_LANG . " as bereichsname,\n\t\t            rc_firma.name as firmaname, rc_firma.url_logo\n\t\t        FROM rc_firma LEFT JOIN rc_jobs ON(id=firma) LEFT JOIN rc_jobs_category ON (bereich=id_jobcat)\n\n\t\t        WHERE rc_jobs.id_job = {$id}";
// Wertzuweisungen Informationsfelder
$row = $db_con->getRow($query, DB_FETCHMODE_OBJECT);
$tpl2 = new HTML_Template_IT();
$tpl2->loadTemplateFile('modules/jobs/details.tpl.html');
$tpl2->setVariable(array("LC_FIRMA" => $lang->translate("Firma"), "LC_BEREICH" => $lang->translate("Bereich"), "LC_BRANCHE" => $lang->translate("Branche"), "LC_REGION" => $lang->translate("Region"), "LC_AUFTRAGGEBER" => $lang->translate("Der Auftraggeber"), "LC_AUFGABEN_ZIELE" => $lang->translate("Ihre neuen Aufgaben"), "LC_WIRBIETEN" => $lang->translate("Wir bieten"), "LC_KONTAKT" => $lang->translate("Kontakt")));
$tpl2->setVariable(array("FIRMA" => '<a href="' . url(array('module' => 'company', 'action' => 'details', 'id' => $row->firma)) . '">' . $row->firmaname . '</a>', "BEREICH" => $row->bereichsname, "BRANCHE" => $row->branche, "REGION" => $row->region, "STELLENNAME" => $row->ueberschrift, "AUFTRAGGEBER" => $row->auftraggeber, "AUFGABEN" => $row->aufgaben, "PROFIL" => $row->profil, "WIRBIETEN" => $row->wirbieten, "KONTAKT" => $row->kontakt));
if ($row->url_logo) {
    $tpl2->setVariable("COMPANY_LOGO", "<img src=\"" . $cfg['path']['logo'] . $row->url_logo . "\">");
}
$content['CONTENT'] .= $tpl2->get();
Example #6
0
 /**
  * Initialize a TemplateObject
  *
  * @param string  $file     filename of the template file
  *
  * @return object Object of HTML/IT - Template - Class
  */
 function _initTemplate($file)
 {
     // Errors here can not be displayed using the UI
     PEAR::staticPushErrorHandling(PEAR_ERROR_PRINT);
     $tpl = new HTML_Template_IT(dirname(__FILE__) . "/Web");
     $tpl->loadTemplateFile($file);
     $tpl->setVariable("InstallerURL", $_SERVER["PHP_SELF"]);
     PEAR::staticPopErrorHandling();
     // reset error handling
     return $tpl;
 }
Example #7
0
<?php

require_once "HTML/Template/IT.php";
$listitems = array('Computer Science', 'Nuclear Physics', 'Rocket Science');
$tplfile = 'tpl0.tpl';
$tpl = new HTML_Template_IT('./');
$tpl->loadTemplateFile($tplfile);
$tpl->setVariable('title', 'IT List Examples');
foreach ($listitems as $item) {
    $tpl->setCurrentBlock('listentry');
    $tpl->setVariable('entry_text', $item);
    $tpl->parseCurrentBlock('cell');
}
$tpl->show();
Example #8
0
 /**
  * Initialize a TemplateObject
  *
  * @param string  $file     filename of the template file
  *
  * @return object Object of HTML/IT - Template - Class
  */
 function _initTemplate($file)
 {
     // Errors here can not be displayed using the UI
     PEAR::staticPushErrorHandling(PEAR_ERROR_PRINT);
     $tpl = new HTML_Template_IT($this->config->get('data_dir') . '/PEAR_Frontend_Web/data/templates');
     $tpl->loadTemplateFile($file);
     $tpl->setVariable("InstallerURL", $_SERVER["PHP_SELF"]);
     PEAR::staticPopErrorHandling();
     // reset error handling
     return $tpl;
 }
Example #9
0
 /**
  * Initialize a TemplateObject, add a title, and icon and add JS and CSS for DHTML 
  *
  * @param string  $file     filename of the template file
  * @param string  $title    (optional) title of the page
  * @param string  $icon     (optional) iconhandle for this page
  * @param boolean $useDHTML (optional) add JS and CSS for DHTML-features
  *
  * @access private
  *
  * @return object Object of HTML/IT - Template - Class
  */
 function _initTemplate($file, $title = '', $icon = '', $useDHTML = true)
 {
     $tpl = new HTML_Template_IT(dirname(__FILE__) . "/Web");
     $tpl->loadTemplateFile($file);
     $tpl->setVariable("InstallerURL", $_SERVER["PHP_SELF"]);
     $tpl->setVariable("ImgPEAR", $_SERVER["PHP_SELF"] . '?img=pear');
     if ($title) {
         $tpl->setVariable("Title", $title);
     }
     if ($icon) {
         $tpl->setCurrentBlock("TitleBlock");
         $tpl->setVariable("_InstallerURL", $_SERVER["PHP_SELF"]);
         $tpl->setVariable("_Title", $title);
         $tpl->setVariable("_Icon", $icon);
         $tpl->parseCurrentBlock();
     }
     $tpl->setCurrentBlock();
     if ($useDHTML && Net_UserAgent_Detect::getBrowser('ie5up') == 'ie5up') {
         $dhtml = true;
     } else {
         $dhtml = false;
     }
     if ($dhtml) {
         $tpl->setVariable("JS", 'dhtml');
         $css = '<link rel="stylesheet" href="' . $_SERVER['PHP_SELF'] . '?css=dhtml" />';
         $tpl->setVariable("DHTMLcss", $css);
     } else {
         $tpl->setVariable("JS", 'nodhtml');
     }
     if (!isset($_SESSION['_PEAR_Frontend_Web_js']) || $_SESSION['_PEAR_Frontend_Web_js'] == false) {
         $tpl->setCurrentBlock('JSEnable');
         $tpl->setVariable('RedirectURL', $_SERVER['REQUEST_URI'] . (!empty($_GET) ? '&' : '?') . 'enableJS=1');
         $tpl->parseCurrentBlock();
         $tpl->setCurrentBlock();
     }
     return $tpl;
 }
Example #10
0
<?php

$lastpage = 0;
$totalPages_inst = 0;
$totalPages_inst = 0;
$pageNum_inst = 0;
$pageNum_inst = 0;
// set template directory
$template = new HTML_Template_IT("./include/templates");
// load template
$template->loadTemplateFile("skin_header.tpl");
// parse header block
//$template->setCurrentBlock("head");
//$template->setVariable("LOGINNAME", $_SESSION['loginName']);
//$template->parseCurrentBlock();
//$template->parse("head");
//$template->parse("start");
//die("still here");
$sql = "SELECT DISTINCT sectionpage, sectionname, icon FROM `functions` \nINNER JOIN cha_rights ON (functions.id = cha_rights.functionid)\nINNER JOIN sectionsName ON (functions.sectionpage = sectionsName.id)\nWHERE cha_rights.RegNo = '{$RegNo}'";
$result = mysql_query($sql) or die("query errorcontrller<br>");
$noFound = mysql_num_rows($result);
$template->setCurrentBlock("sections");
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    $sectionname = $line["sectionname"];
    $sectionpage = $line["sectionpage"];
    $icon = $line["icon"];
    if ($noFound != 0) {
        $sql2 = "SELECT functionName FROM `functions`\n\t\t\t   \tINNER JOIN functionName ON (functions.function = functionName.id)\n\t\t\t   \tWHERE functions.sectionpage = '{$sectionpage}'";
        $result2 = mysql_query($sql2) or die("query error functionname controller<br>" . $sql2);
        $noFound2 = mysql_num_rows($result2);
        $template->setCurrentBlock("loop");
Example #11
0
<?php

//this code uses a PEAR module called  HTML_Template_IT used to centralize and reuse html templates as Modular templates
// Developer
//charlie maere
// july 2014
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
    $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
// set template directory
$template = new HTML_Template_IT("./include/templates");
// load template
$template->loadTemplateFile("main.tpl");
// parse header block
$template->setCurrentBlock("header");
$template->setVariable("TITLE", "Student Record Information System");
if ($page == "Register") {
    $template->setVariable("URL", "./");
    $template->setVariable("LINK-TITLE", "LogIn");
    $template->parseCurrentBlock();
    $template->show();
    // load template
    $template->loadTemplateFile("register.tpl");
    $template->setCurrentBlock("register");
    $template->setVariable("TITLE", "Register Now");
    $template->parseCurrentBlock();
    $template->show();
} else {
    $template->setVariable("URL", "./?page=Register");
    $template->setVariable("LINK-TITLE", "New User");