コード例 #1
0
ファイル: TeaserRenderer.php プロジェクト: hlag/svs
	public function renderTeaser()
	{
		$returnvalue = "";
		if (!empty($this->teaserArray))
		{
			$lang = Language::getInstance();
			if ($this->maxcount!=0)
				$count = $this->maxcount;
			else
				$count = count($this->teaserArray);
			for ($counter=0; $counter<$count; $counter++)
			{
				if ($this->settings['Teaser']['Nummeriert']==0)
				{
					$this->teaserArray[$counter]['counter']="";
				}
				else
					$this->teaserArray[$counter]['counter']=$counter+1;
				if (!($this->teaserArray[$counter]['newsdate']=='0000-00-00' || $this->teaserArray[$counter]['newsdate']==""))
				{
					$date=explode("-",$this->teaserArray[$counter]['newsdate']);
					$this->teaserArray[$counter]['newsdate'] = '<span class="date">'.$date[2].".".$date[1].".".$date[0]."</span>";
				}
				else
					$this->teaserArray[$counter]['newsdate']="";
				$this->teaserArray[$counter]['article_url'].= ".html"; 
				$tp = new templateParser(PATH.'templates/FrontEnd/TeaserTemplate.htm');
				$tp->parseTemplate($this->teaserArray[$counter]);
				$returnvalue.=$tp->display();
			}
			
		}
		return $returnvalue;
	}
コード例 #2
0
ファイル: ModuleView.php プロジェクト: hlag/svs
	function renderTemplateAndTidy($array)
	{
		//print_r($array);
		//echo $this->templateFile;
		$tp = new templateParser($this->templateFile);
		$tp->parseTemplateAndTidy($array);	    // display generated page
		return $tp->display();
	}
コード例 #3
0
ファイル: controller.php プロジェクト: hlag/svs
 public function getSite()
 {
     if (Request::getInstance()->getGetRequests('logout')) {
         Login::getInstance()->logout();
     }
     if (Login::getInstance()->isLoggedIn()) {
         $idt = Request::getInstance()->getGetRequests('idt');
         if (!$idt) {
             $idt = 'Liste';
         }
         $this->data['navi'] = $this->getNavi();
         $this->data['content'] = $this->getContent($idt);
         $this->data['logout'] = '<p class="navbar-text"><a class="navbar-link logout" href="index.php?logout=true" aria-label="Left Align"><span class="glyphicon glyphicon-log-out" aria-hidden="true"></span> Logout</a></p>';
         $this->data['user'] = '';
     } else {
         $this->data['content'] = '';
         $this->data['user'] = '';
         $this->data['logout'] = '';
         $this->data['navi'] = '';
         if (Request::getInstance()->getPostRequests('anmelden') == 'anmelden') {
             $this->data['content'] .= '<p>Diese Emailadresse ist entweder nicht registriert oder noch nicht aktiviert.</p>';
         }
         $this->data['header'] = 'Anmelden';
         $this->data['content'] .= templateParser::getInstance()->parseTemplate(array(), 'Login/login_content_template.html');
     }
     return templateParser::getInstance()->parseTemplate($this->data, 'mainTemplate.html', false, false);
 }
コード例 #4
0
ファイル: GoogleCodeGenerator.php プロジェクト: hlag/svs
 public static function generateWebmasterTools()
 {
     $google=array();
     
     $google['webmasterTools']=Configuration::getInstance()->get('Google', 'webmasterTools');
     $theme = Configuration::getInstance()->get('Design', 'theme');
     $tp = new templateParser(PATH."FrontEnd/".$theme."/snippets/google_webmaster_tools.htm");
     if (Server::isLocalServer())
         return "";
     if (empty($google['webmasterTools']))
         return '';
     else
     {
         $tp->parseTemplate($google);
         return $tp->display();
     }
 }
コード例 #5
0
ファイル: TeaserRenderer.php プロジェクト: hlag/svs
    public function renderTeaser($teaserArray,$maxcount=0, $type)
    {
        $returnvalue=NULL;
        if (!empty($teaserArray))
        {
            $lang = Language::getInstance();

            $returnvalue.='<div class="'.Configuration::getInstance()->get($type, 'class') .'_outer">';
            $returnvalue.='<div class="'.Configuration::getInstance()->get($type, 'class') .'_inner">'; 
            if ($maxcount!=0)
                $count = $maxcount;
            else
                $count = count($teaserArray);
            if ($maxcount > count($teaserArray) )
                $count = count($teaserArray);
            for ($counter=0; $counter<$count; $counter++)
            {
                 $langArray=$lang->getLanguageArray();
                if ($teaserArray[$counter]['language_id']==$lang->getDefaultLanguage())
                    $langString="";
                else
                    $langString=$langArray[$teaserArray[$counter]['language_id']]['Name']."/";
                $tp = new templateParser(TEMPLATEPATH.Configuration::getInstance()->get("Design","theme").'/'.Configuration::getInstance()->get($type, 'template'));
                $templateArray=array();
                $templateArray['article_teaserhead']  = $teaserArray[$counter]['article_teaserhead'];
                $templateArray['article_teaser_content']  = $teaserArray[$counter]['article_teaser_content'];
                $templateArray['article_url']=($teaserArray[$counter]['article_url']=="/"?"/":$teaserArray[$counter]['article_url'].'.html"');
                $templateArray['newsdate']="";
                if ($teaserArray[$counter]['newsdate']!='' || $teaserArray[$counter]['newsdate']!='0000-00-00')
                {
                    $date=explode("-",$teaserArray[$counter]['newsdate']);
                    $templateArray['newsdate'] = $date[2].".".$date[1].".".$date[0];
                }
                $modulo= Configuration::getInstance()->get($type, 'modulo');
                if ($modulo==1)
                    $templateArray['counter']=$counter+1;
                else
                    $templateArray['counter']=$counter%Configuration::getInstance()->get($type, 'modulo');
                $tp->parseTemplate($templateArray);
                $returnvalue.= $tp->display();
            }
            $returnvalue.='</div>';
            $returnvalue.='</div>';
        }
        return $returnvalue;
    }
コード例 #6
0
 static function parse_template($string, $bean_arr)
 {
     foreach ($bean_arr as $bean_name => $bean_id) {
         $focus = BeanFactory::getBean($bean_name, $bean_id);
         $string = templateParser::parse_template_bean($string, $focus->table_name, $focus);
         foreach ($focus->field_defs as $focus_name => $focus_arr) {
             if ($focus_arr['type'] == 'relate') {
                 if (isset($focus_arr['module']) && $focus_arr['module'] != '' && $focus_arr['module'] != 'EmailAddress') {
                     $idName = $focus_arr['id_name'];
                     $relate_focus = BeanFactory::getBean($focus_arr['module'], $focus->{$idName});
                     $string = templateParser::parse_template_bean($string, $focus_arr['name'], $relate_focus);
                 }
             }
         }
     }
     return $string;
 }
コード例 #7
0
ファイル: generateDoc.php プロジェクト: sysraj86/carnivalcrm
            $obb['TransportContracts'] = $id;
            $obb['Contracts'] = $contractId;
            $text .= $sep . templateParser::parse_template($linePart, $obb);
            $sep = $leValue . $lsValue . $tdTemp[count($tdTemp) - 1];
        }
    } else {
        $tcount = strrpos($text, "<tr");
        $text = substr($text, 0, $tcount);
        $tcount = strpos($parts[1], "</tr>") + 5;
        $parts[1] = substr($parts[1], $tcount);
    }
    $text .= $parts[1];
}
$converted = templateParser::parse_template($text, $object_arr);
$header = templateParser::parse_template($header, $object_arr);
$footer = templateParser::parse_template($footer, $object_arr);
$printable = str_replace("\n", "<br />", $converted);
//$doc->setCSSFile("modules/AOS_PDF_Templates/export.css");
//$doc->newSession("WordSection1", $sugar_config['site_url'].'/modules/AOS_PDF_Templates/test_files/header.htm', $sugar_config['site_url'].'/modules/AOS_PDF_Templates/test_files/header.htm' );
//$doc->addText($printable);
//$doc->endSession();
$header_t = '<html xmlns:v="urn:schemas-microsoft-com:vml"
                xmlns:o="urn:schemas-microsoft-com:office:office"
                xmlns:w="urn:schemas-microsoft-com:office:word"
                xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
                xmlns:st1="urn:schemas-microsoft-com:office:smarttags"
                xmlns="http://www.w3.org/TR/REC-html40">

    <head>
    <meta http-equiv=Content-Type content="text/html; charset=unicode">
    <meta name=ProgId content=Word.Document>
コード例 #8
0
 function parse_template($string, &$bean_arr)
 {
     global $beanFiles, $beanList;
     foreach ($bean_arr as $bean_name => $bean_id) {
         require_once $beanFiles[$beanList[$bean_name]];
         $focus = new $beanList[$bean_name]();
         $focus->retrieve($bean_id);
         $string = templateParser::parse_template_bean($string, $focus->table_name, $focus);
         foreach ($focus->field_defs as $focus_name => $focus_arr) {
             if ($focus_arr['type'] == 'relate') {
                 if (isset($focus_arr['module']) && $focus_arr['module'] != '' && $focus_arr['module'] != 'EmailAddress') {
                     //$relate_focus_name = $beanList[$focus_arr['module']];
                     $relate_focus = new $beanList[$focus_arr['module']]();
                     $relate_focus->retrieve($focus->{$focus_arr}['id_name']);
                     //$object_arr[$relate_focus->module_dir] = $focus->$focus_arr['id_name'];
                     $string = templateParser::parse_template_bean($string, $focus_arr['name'], $relate_focus);
                 }
             }
         }
     }
     return $string;
 }
コード例 #9
0
ファイル: generatePdf.php プロジェクト: omusico/windcrm
function populate_service_lines($text, $lineItems, $element = 'tr')
{
    $firstValue = '';
    $firstNum = 0;
    $lastValue = '';
    $lastNum = 0;
    $startElement = '<' . $element;
    $endElement = '</' . $element . '>';
    $text = str_replace("\$aos_services_quotes_service", "\$aos_services_quotes_product", $text);
    //Find first and last valid line values
    $product_quote = new AOS_Products_Quotes();
    foreach ($product_quote->field_defs as $name => $arr) {
        if (!(isset($arr['dbType']) && strtolower($arr['dbType']) == 'id' || $arr['type'] == 'id' || $arr['type'] == 'link')) {
            $curNum = strpos($text, '$aos_services_quotes_' . $name);
            if ($curNum) {
                if ($curNum < $firstNum || $firstNum == 0) {
                    $firstValue = '$aos_products_quotes_' . $name;
                    $firstNum = $curNum;
                }
                if ($curNum > $lastNum) {
                    $lastValue = '$aos_products_quotes_' . $name;
                    $lastNum = $curNum;
                }
            }
        }
    }
    if ($firstValue !== '' && $lastValue !== '') {
        $text = str_replace("\$aos_products", "\$aos_null", $text);
        $text = str_replace("\$aos_services", "\$aos_products", $text);
        //Converting Text
        $tparts = explode($firstValue, $text);
        $temp = $tparts[0];
        //check if there is only one line item
        if ($firstNum == $lastNum) {
            $linePart = $firstValue;
        } else {
            $tparts = explode($lastValue, $tparts[1]);
            $linePart = $firstValue . $tparts[0] . $lastValue;
        }
        $tcount = strrpos($temp, $startElement);
        $lsValue = substr($temp, $tcount);
        $tcount = strpos($lsValue, ">") + 1;
        $lsValue = substr($lsValue, 0, $tcount);
        //Read line end values
        $tcount = strpos($tparts[1], $endElement) + strlen($endElement);
        $leValue = substr($tparts[1], 0, $tcount);
        $tdTemp = explode($lsValue, $temp);
        $linePart = $lsValue . $tdTemp[count($tdTemp) - 1] . $linePart . $leValue;
        $parts = explode($linePart, $text);
        $text = $parts[0];
        //Converting Line Items
        if (count($lineItems) != 0) {
            foreach ($lineItems as $id => $productId) {
                if ($productId == null || $productId == '0') {
                    $obb['AOS_Products_Quotes'] = $id;
                    $text .= templateParser::parse_template($linePart, $obb);
                }
            }
        }
        $text .= $parts[1];
    }
    return $text;
}
コード例 #10
0
ファイル: Language.php プロジェクト: hlag/svs
 public function renderLangTabContent($counter,$pathToTemplate)
 {
     $tags=array('Langshort'=> $this->languageArray[$counter]['short'],
                 'LangID'=> $counter
                 );
     $tp=new templateParser(PATH.$pathToTemplate);
     $tp->parseTemplate($tags);
     return $tp->display();
 }
コード例 #11
0
 function parse_template($string, &$bean_arr)
 {
     global $beanFiles, $beanList;
     foreach ($bean_arr as $bean_name => $bean_id) {
         require_once $beanFiles[$beanList[$bean_name]];
         $focus = new $beanList[$bean_name]();
         $focus->retrieve($bean_id);
         $string = templateParser::parse_template_bean($string, $bean_name, $focus);
     }
     return $string;
 }
コード例 #12
0
require_once "db_layer.php";
require_once 'templateParser.php';
require_once 'settings.php';
require_once "verhuur_settings.php";
require_once 'kostenberekening.php';
session_start();
date_default_timezone_set(TIME_ZONE);
//get verhuringID from provided key
$key = trim(strip_tags($_GET["key"]), " \n");
$verhuring = getVerhuringFromConfirm($key);
$verhuring_id = $verhuring[0];
// if there is a verhuring for this key, continue
if ($verhuring_id != -1) {
    //make template parser initilize
    $template = new templateParser(HUUROVEREENKOMST_TEMPLATE_URL);
    // Load all data into huurovereenkomst.
    $tags = array('verhuurder_naam' => HV_VERHUURDER_NAME, 'verhuurder_vertegenwoordiger' => HV_VERHUURDER_REP, 'verhuurder_adres' => HV_VERHUURDER_ADDRESS, 'verhuurder_plaats' => HV_VERHUURDER_POSTAL, 'verhuurder_telefoon' => HV_VERHUURDER_PHONE, 'verhuurder_beheerder' => HV_BEHEERDER, 'verhuurder_beheerder_telefoon' => HV_BEHEERDER_PHONE, 'verhuurder_rekeningnummer' => HV_VERHUURDER_ACCOUNT);
    //Get data to fill template from DB
    $data_array = getHuurovereenkomstData($verhuring_id);
    if (!empty($data_array)) {
        $tags = array_merge($tags, $data_array);
        $tags['verhuring_kenmerk_borg'] = 'WVB/' . $verhuring_id;
        $tags['verhuring_kenmerk_huur'] = 'WVH/' . $verhuring_id;
        $tags['verhuring_borg'] = '<strong>' . getBorg(getDifferenceInDays($tags['begindatum'], $tags['einddatum'])) . '</strong>';
        $tags['verhuring_prijs'] = '<strong>' . (getKostenByDate($tags['begindatum'], $tags['einddatum'], $tags['verhuring_aantal_personen']) - getBorg(getDifferenceInDays($tags['begindatum'], $tags['einddatum']))) . '</strong>';
        //parse template and show result
        $template->parseTemplate($tags);
        echo $template->display();
        //echo the print button
        echo "<p class='print_ignore'><input class='button' id='print' value='Print' type='button' onclick='printPage()'></p>";