本文整理汇总了PHP中template_open函数的典型用法代码示例。如果您正苦于以下问题:PHP template_open函数的具体用法?PHP template_open怎么用?PHP template_open使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了template_open函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: template_add_head_foot
function template_add_head_foot($temp, $header, $footer)
{
global $role_id;
global $ROLE_ADMIN, $ROLE_LEADER, $ROLE_EMPLOYED, $ROLE_ZALEC, $unit;
$header = $header . ".tpl";
$footer = $footer . ".tpl";
$head = template_open($header);
$foot = template_open($footer);
if ($role_id) {
switch ($role_id) {
case $role_id >= $ROLE_ADMIN:
$foot = str_replace("##IF_ADMIN##", "", $foot);
$foot = str_replace("##IF_LEADER##", "", $foot);
break;
case $role_id <= $ROLE_ADMIN and $role_id >= $ROLE_LEADER:
$foot = template_clean_up_tags($foot, "##IF_ADMIN##", 1);
break;
case $role_id <= $ROLE_LEADER and $role_id >= $ROLE_EMPLOYED:
$foot = template_clean_up_tags($foot, "##IF_ADMIN##", 1);
$foot = template_clean_up_tags($foot, "##IF_LEADER##", 1);
break;
default:
$foot = template_clean_up_tags($foot, "##IF_ADMIN##", 1);
$foot = template_clean_up_tags($foot, "##IF_LEADER##", 1);
$foot = template_clean_up_tags($foot, "##IF_EMPLOYED##", 1);
// $foot = template_clean_up_tags($foot,"##IF_ZALEC##",1);
}
} else {
$foot = template_clean_up_tags($foot, "##IF_ZALEC##", 1);
$head = template_clean_up_tags($head, "##IF_USER##", 1);
$foot = template_clean_up_tags($foot, "##IF_ADMIN##", 1);
$foot = template_clean_up_tags($foot, "##IF_LEADER##", 1);
$foot = template_clean_up_tags($foot, "##IF_EMPLOYED##", 1);
}
//pogoj za zacasno blokado-vizualno zalcu
if ($unit == $ROLE_ZALEC) {
$foot = template_clean_up_tags($foot, "##IF_ZALEC##", 1);
}
/////////////////
return $head . "\n\n" . '<!-- end head -->' . $temp . "\n\n" . '<!-- end main template -->' . "\n\n" . ' <!-- start foot -->' . "\n\n" . $foot;
}
示例2: str_replace
$rtable =str_replace("##PLACE##",$x,$rtable);
$rtable =str_replace("##TIME##",$res->f("end_time"),$rtable);
$rtable =str_replace("##TIME2##",substr($micro,0,2),$rtable);
$x++;
}
$table = str_replace("##RESULTS##",$rtable,$table);
$rtable = '';
}
//create db object//
$db = new DB_Sql();
//open template//
$tem = template_open("user_group_list.tpl");
//add header footer//
$tem = template_add_head_foot($tem,head,foot);
$tmp = template_get_repeat_text("##START_EN##","##STOP_EN##","##RESULTS##",$tem);
$row = $tmp[1];
$tem = $tmp[0];
$tmp = template_get_repeat_text("##START_ALL##","##STOP_ALL##","##RESULTS_LIST##",$tem);
$row_category = $tmp[1];
$tem = $tmp[0];
//echo $row_category . "<hr>". $row;
示例3: check_role
<?php
require_once "inc/config.php";
check_role($ROLE_ADMIN);
$tem = template_open("add_address.tpl");
$tem = template_add_head_foot($tem, head, foot);
$username = ereg_replace("[^[A-z]]", "", $_REQUEST['username']);
$password = ereg_replace("[^[A-z]]", "", $_REQUEST['password']);
$first = ereg_replace("[^[:alnum:] ]", "", $_REQUEST['first']);
$last = ereg_replace("[^[:alnum:] ]", "", $_REQUEST['last']);
echo "do sem";
$sql = "SELECT * FROM roles";
//TitleGroup";
$result = $db->fetchAll($sql);
foreach ($result as $res) {
$names[] .= $res["name"];
$values[] .= $res["id_role"];
}
$role_dropdown = html_drop_down_arrays("role_drop", $names, $values, "");
if ($_REQUEST['add'] == "Dodaj") {
//echo $username."-".$password."-".$first."-".$last."-".$role_drop;
if ($username and $password and $first and $last) {
//pogledamo kaj imamo in ce je ze tak notr slucajn...
$sql = "SELECT first FROM persons where first='{$first}' and last='{$last}'";
$result = $db->fetchOne($sql);
if ($result) {
$message .= "Uporabnik ze obstaja";
} else {
// dejansko vnesemo
$data = array('username' => $username, 'passwd' => $password, 'first' => $first, 'last' => $last, 'id_role' => $role_drop);
$db->insert('persons', $data);
示例4: template_open
<?php
require_once "inc/config.php";
$tem = template_open("ocenjevanje.tpl");
$sql = "SELECT * FROM persons";
/*$result = $db->fetchAll($sql);
foreach ($result as $res) {
if (!is_array($names)) {
$names[] ="izberi ime...";
$values[]="";
}
$names[] .= $res["first"]." ".$res["last"];
$values[] .= $res["first"]." ".$res["last"];
}
$name_dropdown = html_drop_down_arrays("entry.1.single",$names,$values,$name_drop);
*/
$sql = "SELECT * FROM applic";
$result = $db->fetchAll($sql);
foreach ($result as $res) {
if (!is_array($aname)) {
$aname[] = "izberi program...";
$avalue[] = "";
}
$aname[] .= $res["name"];
$avalue[] .= $res["name"];
}
$appl_dropdown = html_drop_down_arrays("entry.4.single", $aname, $avalue, $appl_drop);
$sql = "SELECT * FROM work WHERE {$ROLE_USER}>=`group` order by applic";
$result = $db->fetchAll($sql);
foreach ($result as $res) {
示例5: header
<?php
require_once "inc/config.php";
header("refresh:120;url=view_notice.php");
check_role($ROLE_EMPLOYED);
$TITLE = "Glavna stran";
$tem = template_open("view_notice.tpl");
$tem = template_add_head_foot($tem, head, foot);
$tmp = template_get_repeat_text("##START_LOG##", "##STOP_LOG##", "##LOGS##", $tem);
$row = $tmp[1];
$tem = $tmp[0];
/**
* Obdelava feedback
*/
$sql = "SELECT * FROM `feedback` WHERE `modified_by`={$person_id} and `status` in (0, 1) order by id desc";
$result = $db->fetchAll($sql);
foreach ($result as $res) {
$table .= $row;
$table = str_replace("##FEEDBTIME##", $res[timestamp], $table);
$table = str_replace("##FEEDBNOTE##", substr($res["note"], 0, 120) . '...', $table);
}
/**
*Izpis končanih v feedback
*/
$tmp = template_get_repeat_text("##START END##", "##STOP_END##", "##LOGS2##", $tem);
$row = $tmp[1];
$tem = $tmp[0];
unset($result);
$sql = "SELECT * FROM `feedback` WHERE `modified_by`={$person_id} and `status` =2 order by id desc LIMIT 0 , 4";
$result = $db->fetchAll($sql);
foreach ($result as $res) {
示例6: check_role
<?php
require_once "inc/config.php";
check_role($ROLE_ADMIN);
$tem = template_open("add_role.tpl");
$tem = template_add_head_foot($tem, head, foot);
$name = $_REQUEST['name'];
if ($_REQUEST['add'] == "Dodaj") {
if ($name) {
//pogledamo kaj imamo in ce je ze tak notr slucajn..
$sql = "SELECT id_role FROM TitleGroup where name='{$name}'";
$result = $db->fetchOne($sql);
if ($result) {
$message .= "Role ze obstaja";
} else {
//dejansko vnesemo
$data = array('name' => $name);
$db->insert('TitleGroup', $data);
$message .= "Role je dodano..";
}
} else {
$message .= "Izpolni vsa polja!";
}
}
$tem = str_replace("##MESSAGE##", $message, $tem);
$tem = template_clean_up_tags($tem, "##");
echo $tem;
示例7: check_role
<?php
//*$DO_NOT_REDIRECT="true";*/
require_once "inc/config.php";
check_role($ROLE_LEADER);
$tem = template_open("add_log_admin.tpl");
$tem = template_add_head_foot($tem, head, foot);
$TITLE = "Evidenca OE";
//pogoj, da lahko vsi ki imajo nad 80 role_id vidijo vse in dopisujejo vse
if ($role_id < 80) {
$sql = "SELECT * FROM persons where unit={$role_id} and id_role>30 order by last ASC";
} else {
$sql = "SELECT * FROM persons where id_role>30 order by first ASC";
}
$result = $db->fetchAll($sql);
foreach ($result as $res) {
if (!is_array($names)) {
$names[] = "ime in priimek zaposlenega...";
$values[] = "";
}
$names[] .= $res["first"] . " " . $res["last"];
$values[] .= $res["id_person"];
}
$name_dropdown = html_drop_down_arrays("name_drop", $names, $values, $name_drop);
//pogoj, da lahko vsi ki imajo nad 80 role_id vpisujejo vse JOBTYPE, ostali pa ne
//if ($role_id<80){
// $sql = "SELECT * FROM jobtype where role between 30 and 79 order by name ASC";
// }
//else {
// $sql = "SELECT * FROM jobtype where role > 79 order by name ASC";
//}
示例8: check_role
<?php
require_once "inc/config.php";
check_role($ROLE_USER);
$TITLE = "Šifrant aktivnosti uporabnikov";
$tem = template_open("help_client_activity.tpl");
$tem = template_add_head_foot($tem, head, foot);
$tmp = template_get_repeat_text("##START_LOG##", "##STOP_LOG##", "##LOGS##", $tem);
$row = $tmp[1];
$tem = $tmp[0];
$sql = 'SELECT `applic`.`name` aname,`work`.`name` wname,`work`.`opis` wopis FROM work,applic where 10>=`work`.`group` and `work`.`applic_id`=`applic`.`applic_id` order by `applic`.`name` ';
$result = $db->fetchAll($sql);
//log_id timestamp person_id jobtype_id start end note job_id name description
foreach ($result as $res) {
$table .= $row;
$table = str_replace("##APP_NAME##", $res["aname"], $table);
$table = str_replace("##NAME_WORK##", $res["wname"], $table);
$table = str_replace("##DESC_WORK##", $res["wopis"], $table);
//echo "<br>".$res['timestamp']." - ".date("H:i",$res['start'])." - ".date("H:i",$res['stop'])." - ".$res['name']." - ".$res['description'];
}
$tem = str_replace('##TITLE##', $TITLE, $tem);
$tem = str_replace('##USER##', $identity, $tem);
$tem = str_replace("##LOGS##", $table, $tem);
$tem = str_replace("##MESSAGE##", $message, $tem);
$tem = template_clean_up_tags($tem, "##");
echo $tem;
示例9: check_role
<?php
require_once "inc/config.php";
check_role($ROLE_USER);
$TITLE = "Šifrant aktivnosti zaposlenih";
$tem = template_open("help_client_employe.tpl");
$tem = template_add_head_foot($tem, head, foot);
$tmp = template_get_repeat_text("##START_LOG##", "##STOP_LOG##", "##LOGS##", $tem);
$row = $tmp[1];
$tem = $tmp[0];
$sql = "SELECT `work`.`applic_id` applic_id,`work`.`subcat_id` subcat_id,`applic`.`name` aname,`work`.`name` wname,`work`.`opis` wopis FROM work,applic where `work`.`applic_id`=`applic`.`applic_id` and `work`.`group`>{$ROLE_USER} and {$role_id}>=`group` order by `work`.`applic_id`,`work`.`subcat_id`";
$result = $db->fetchAll($sql);
//log_id timestamp person_id jobtype_id start end note job_id name description
foreach ($result as $res) {
$table .= $row;
$table = str_replace("##APP_ID##", $res["applic_id"], $table);
$table = str_replace("##WORK_ID##", $res["subcat_id"], $table);
$table = str_replace("##APP_NAME##", $res["aname"], $table);
$table = str_replace("##NAME_WORK##", $res["wname"], $table);
$table = str_replace("##DESC_WORK##", $res["wopis"], $table);
//echo "<br>".$res['timestamp']." - ".date("H:i",$res['start'])." - ".date("H:i",$res['stop'])." - ".$res['name']." - ".$res['description'];
}
$tem = str_replace('##TITLE##', $TITLE, $tem);
$tem = str_replace('##USER##', $identity, $tem);
$tem = str_replace("##LOGS##", $table, $tem);
$tem = str_replace("##MESSAGE##", $message, $tem);
$tem = template_clean_up_tags($tem, "##");
echo $tem;
示例10: template_open
<?php
require_once "inc/config.php";
$tem = template_open("add_plan.tpl");
$tem = template_add_head_foot($tem);
$work_values = array();
$work_names = array();
//get out different types of work
$sql = "SELECT id,naziv FROM delo";
$result = $db->fetchAll($sql);
foreach ($result as $row) {
$work_values[] = $row['id'];
$work_names[] = $row['naziv'];
}
//create a dropdown
$work_drop = html_drop_down_arrays("work_id", $work_names, $work_values, '');
//get user id
$sql = "SELECT id FROM users where username='{$identity}'";
$user_id = $db->fetchOne($sql);
///form submit
$title = $_REQUEST['title'];
$desc = $_REQUEST['desctiption'];
$price = $_REQUEST['price'];
if ($_REQUEST['form_submit'] == "true") {
if ($title and $desc and $price) {
//pogledamo kaj imamo in ce je ze tak notr slucajn..
//dejansko vnesemo
$data = array('naziv' => $title, 'id_user' => $user_id, 'id_delo' => $work_id);
$db->insert('main', $data);
$message .= "Delo je dodano..";
} else {
示例11: DB_Sql
<?
include "../inc/config.php";
//create db object//
$db = new DB_Sql();
//open template//
$tem = template_open("tekma_add.tpl");
//add header footer//
$tem = template_add_head_foot($tem,head,foot);
if ($_REQUEST["submit"]!='') {
//then we need to insert a new one//
$e_name = trim($_REQUEST['name']);
$sql = "select * from tekma where name='$e_name'";
$db->query($sql);
if ($db->affected_rows()>0) {
$message = "Tekma ze obstaja";
} else {
$sql = "INSERT INTO `timming`.`tekma` (
`tekma_id` ,
`name`
)
VALUES (
NULL , '$e_name')
";
$db->query($sql);
$message = "Tekma uspesno vnesena";
}
示例12: check_role
<?php
require_once "inc/config.php";
check_role($ROLE_LEADER);
$TITLE = "Letno poročilo";
$tem = template_open("view_year_report.tpl");
$tem = template_add_head_foot($tem, head, foot);
$tmp = template_get_repeat_text("##START_LOG##", "##STOP_LOG##", "##LOGS##", $tem);
$row = $tmp[1];
$tem = $tmp[0];
//spremenljivki za mesec ine leto//
if ($mon < 1 or $mon > 12) {
$mon = '';
}
if (!$mon) {
$mon = date("m", time());
}
if (!$year) {
$year = date("Y", time());
}
// instanciate a new DAL
$dal = new DAL();
//enota
$age_min = 18;
$age_max = 36;
$unitarray = array(75, 77, 78);
$disorderarray = array(1, 2, 3, 4, 5);
function query1($disorder)
{
echo "jaz sem funkcija";
$dal = new DAL();
示例13: check_role
<?php
require_once "inc/config.php";
check_role($ROLE_LEADER);
$TITLE = "Mesečna evidenca prisotnosti uporabnikov za";
$tem = template_open("view_presence.tpl");
$tem = template_add_head_foot($tem, head, foot);
$tmp = template_get_repeat_text("##START_LOG_NOT##", "##STOP_LOG_NOT##", "##LOGS_NOT##", $tem);
$rownot = $tmp[1];
$tem = $tmp[0];
$tmp = template_get_repeat_text("##START_LOG##", "##STOP_LOG##", "##LOGS##", $tem);
$row = $tmp[1];
$tem = $tmp[0];
//zacetek in konec meseca//
if ($mon < 1 or $mon > 12) {
$mon = '';
}
if (!$mon) {
$mon = date("m", time());
}
if (!$year) {
$year = date("Y", time());
}
$mesec_start = mktime(0, 0, 0, $mon, 1, $year);
$last_day = date("t", $mesec_start);
$mesec_end = mktime(0, 0, 0, $mon, $last_day, $year);
//////////////////////////
$ts = "{$year}" . " " . $mon . "%";
//pogoj, da lahko vsi ki imajo nad 80 role_id vidijo vse in dopisujejo vse
if ($role_id < 80) {
$sql = "SELECT DATE( FROM_UNIXTIME( `end` ) ) datum, \r\n DATE_FORMAT( FROM_UNIXTIME( `end` ) ,\r\n '%d' ) dan,\r\n `persons`.`first` ime,\r\n `persons`.`last` priimek,\r\n\t person_id\r\n FROM `work_log` , `persons`\r\n\t WHERE `persons`.`id_person` = `work_log`.`person_id`\r\n and id_role<20\r\n and unit={$role_id}\r\n AND DATE_FORMAT( FROM_UNIXTIME( `end` ) , '%Y %m' ) LIKE '{$ts}'\r\n GROUP BY dan, person_id order by letter ASC";
示例14: DB_Sql
<?
include "../inc/config.php";
$event_id = $_REQUEST["event_id"];
$tekma_id = $_REQUEST["tekma"];
if (!$event_id or !$tekma_id)
die("event tekma .. nic ni");
//create db object//
$db = new DB_Sql();
//open template//
$tem = template_open("run.tpl");
//add header footer//
$tem = template_add_head_foot($tem,head,foot);
$tmp = template_get_repeat_text("##START##","##STOP##","##RUNNERS##",$tem);
$row = $tmp[1];
$tem = $tmp[0];
//get out the event title//
$sql = "Select events.name as ename, tekma.name as tname from events,tekma where event_id='$event_id' and tekma_id='$tekma_id'";
$db->query($sql);
if ($db->next_record()) {
$tem = str_replace("##TITLE##",$db->f("ename"). " - ". $db->f("tname"),$tem);
}
///now the runners//
$sql = "SELECT *
示例15: check_role
<?php
require_once "inc/config.php";
check_role($ROLE_USER);
$TITLE = "Inventura";
$tem = template_open("scan_inventory.tpl") . ($tem = template_open("scan_last_insert.tpl") . ($tem = template_open("scan_not_yet.tpl") . ($tem = template_open("scan_last_insert_no_valid.tpl"))));
$tem = template_add_head_foot($tem, head, foot);
if ($role_id) {
switch ($role_id) {
case $role_id >= $ROLE_ADMIN:
$tem = template_clean_up_tags($tem, "##IF_BUT_ADMIN##", 1);
$tem = str_replace("##IF_ADMIN##", "", $tem);
$tem = str_replace("##IF_LEADER##", "", $tem);
break;
case $role_id <= $ROLE_ADMIN and $role_id >= $ROLE_LEADER:
$tem = template_clean_up_tags($tem, "##IF_ADMIN##", 1);
$tem = str_replace("##IF_BUT_LEADER##", "", $tem);
break;
case $role_id <= $ROLE_LEADER and $role_id >= $ROLE_EMPLOYED:
$tem = template_clean_up_tags($tem, "##IF_ADMIN##", 1);
$tem = template_clean_up_tags($tem, "##IF_LEADER##", 1);
$tem = str_replace("##IF_BUT_LEADER##", "", $tem);
break;
default:
$tem = template_clean_up_tags($tem, "##IF_ADMIN##", 1);
$tem = template_clean_up_tags($tem, "##IF_LEADER##", 1);
$tem = template_clean_up_tags($tem, "##IF_EMPLOYED##", 1);
//$tem = template_clean_up_tags($tem,"##IF_ZALEC##",1);
}
} else {
$tem = template_clean_up_tags($tem, "##IF_ZALEC##", 1);