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; }
$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;
<?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);
<?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) {
<?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) {
<?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;
<?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"; //}
<?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;
<?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;
<?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='******'"; $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 {
<? 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"; }
<?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();
<?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";
<? 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 *
<?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);
<?php require_once "inc/config.php"; check_role($ROLE_USER); $TITLE = "Aktivnosti"; //$tem = template_open("NEWadd_work_emplo.tpl"). $tem = template_open("drekstos.tpl") . ($tem = template_open("NEWview_last_insert_client_diary.tpl") . ($tem = template_open("NEWview_client_diary.tpl"))); //$tem = template_add_head_foot($tem,head,blank); $tem = template_add_head_foot($tem, head, foot); //Za izpis tistih katere hočem - to moram prestavit v funkcijo!!!!!!! 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);
<?php //*$DO_NOT_REDIRECT="true";*/ require_once "inc/config.php"; check_role($ROLE__EMPLOYED, "login.php"); $TITLE = "Evidenca prisotnosti"; $tem = template_open("index.tpl"); $tem = template_add_head_foot($tem, head, foot); ///////test za izpis /*$drek=GetHostByName($REMOTE_ADDR); echo $drek; $cvek=gethostbyaddr($_SERVER['REMOTE_ADDR']); echo " ".$cvek; $box=php_uname('n'); echo "uname".$box;*/ ///////// /*$sql = "SELECT * FROM persons"; //za izbiro person - vendar trenutno ne rabim $result = $db->fetchAll($sql); foreach ($result as $res) { $names[] .= $res["first"]." ".$res["last"]; $values[] .= $res["id_person"]; } $name_dropdown = html_drop_down_arrays("name_drop",$names,$values,$name_drop); */ /* ########## #Za zaposlene naj bo dostopen samo vpis slu�be, torej tega en rabijo #$sql = "SELECT * FROM jobtype order by name ASC"; #
<? $DO_NOT_REDIRECT="false"; require_once("inc/config.php"); check_role($ROLE_EMPLOYED, "login.php"); $TITLE = "Evidenca prisotnosti"; $tem = template_open("add_log_manualy.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); $conditionUnit="";//to be in that unit 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); $conditionUnit="and unit=$unit";//to be in that unit break; case ($role_id < $ROLE_LEADER and $role_id >= $ROLE_EMPLOYED):
function template_add_head_foot($temp) { $head=template_open("head.tpl"); $foot=template_open("foot.tpl"); return $head."\n\n".'<!-- end head -->'.$temp."\n\n".'<!-- end main template -->'."\n\n".' <!-- start foot -->'."\n\n".$foot; }
<? include "../inc/config.php"; //create db object// $db = new DB_Sql(); //open template// $tem = template_open("print_user.tpl"); //add header footer// ///$tem = template_add_head_foot($tem,head,foot); $tmp = template_get_repeat_text("##START##","##STOP##","##USER_LIST##",$tem); $row = $tmp[1]; $tem = $tmp[0]; //get out the events// $sql = "SELECT * FROM users, events WHERE users.event_id=events.event_id and id_user=$id_user ORDER BY events.event_id, users.number ASC"; $db->query($sql); while ($db->next_record()) { $table.=$row; $table = str_replace("##USER_ID##",$db->f("id_user"),$table); $table = str_replace("##NAME##",$db->f("full_name"),$table); $table = str_replace("##EVENT##",$db->f("name"),$table); $table = str_replace("##NUMBER##",$db->f("number"),$table); } //replace template variables// $tem = str_replace("##USER_LIST##",$table,$tem); $tem = str_replace("##MESSAGE##",$message,$tem); ///clean up//
<?php require_once "inc/config.php"; check_role($ROLE_USER); $tem = template_open("help.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 `work`.`applic_id`=`applic`.`applic_id` and `work`.`group`<=86 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("##MONTH##", " " . $mon . "/" . $year, $tem); //v header sem dal zraven naslova izpis meseca za katerega je izpis $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;
<? $DO_NOT_REDIRECT="true"; require_once("inc/config.php"); $user = $_REQUEST["user"]; $pass = $_REQUEST["pass"]; $tem = template_open("login.tpl"); $tem = template_add_head_foot($tem); if ($user and $pass) { // Set up the authentication adapter $authAdapter = new Zend_Auth_Adapter_DbTable($db); $authAdapter ->setTableName('persons') ->setIdentityColumn('username') ->setCredentialColumn('passwd'); $authAdapter ->setIdentity($user) ->setCredential($pass); // Attempt authentication, saving the result $result = $auth->authenticate($authAdapter); if (!$result->isValid()) { // Authentication failed; print the reasons why foreach ($result->getMessages() as $message) { $m.=$message; } $tem=str_replace("##MESSAGE##",$m,$tem); $tem=template_clean_up_tags($tem,"##");
<? require_once("inc/config.php"); $tem = template_open("user_add.tpl"); $tem = template_add_head_foot($tem); $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']); $sql = "SELECT * FROM roles"; $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);
<?php $time = time(); require_once "inc/config.php"; check_role($ROLE_EMPLOYED); $TITLE = "Pregled vpisanih aktivnosti za"; $tem = template_open("view_client_diary.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]; if (!$id) { $id = "<>0"; } else { $id = "={$id}"; $role_id = 80; } //spremenljivki za mesec ine leto if ($mon < 1 or $mon > 12) { $mon = ''; } if (!$mon) { $mon = date("m", time()); } if (!$year) { $year = date("Y", time()); } //Za izpis tistih katere hočem - to moram prestavit v funkcijo!!!!!!! //pogoj, da lahko vsi ki imajo nad 80 role_id vidijo vse in dopisujejo vse if ($role_id < $ROLE_LEADER) { $sql = "SELECT id as log_id, \r\n date_format(from_unixtime(`end`),'%d.%m.%Y') \r\n datum,\r\n `persons`.`first` ime_varov,\r\n `persons`.`last` priim_varov,\r\n `work`.`name`,\r\n time(from_unixtime(`start`)) zacetek, \r\n time(from_unixtime(`end`)) konec,\r\n `work_log`.`assessor_id` ,\r\n `work_log`.`comm` from `work_log`,\r\n `work`,\r\n `persons` \r\n WHERE id{$id}\r\n and `work`.`work_id`=`work_log`.`work_id` \r\n and `persons`.`id_person`=`work_log`.`person_id` \r\n and `unit`={$unit} \r\n and `assessor_id`>0 \r\n and `assessor_id`={$person_id}\r\n and month(from_unixtime(`end`))={$mon}\r\n and year(from_unixtime(`end`))={$year} \r\n ORDER BY datum desc,\r\n letter, \r\n ime_varov, \r\n zacetek ";
<? require_once("inc/config.php"); $tem = template_open("work_add.tpl"); $tem = template_add_head_foot($tem,head,foot); $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.. $sql = "SELECT naziv FROM delo where naziv='$title'"; $result = $db->fetchOne($sql); if ( $result ) { $message.="Delo ze obstaja"; } else { //dejansko vnesemo $data = array( 'naziv' => $title, 'opis' => $desc, 'cena' => $price ); $db->insert('delo', $data); $message .= "Delo je dodano.."; }
<?php $DO_NOT_REDIRECT = "true"; require_once "inc/config.php"; $tem = template_open("eval.tpl"); $tem = template_add_head_foot($tem); $sql = "SELECT * FROM persons"; $result = $db->fetchAll($sql); foreach ($result as $res) { $names[] .= $res["first"] . " " . $res["last"]; $values[] .= $res["id_person"]; } $name_dropdown = html_drop_down_arrays("name_drop", $names, $values, $name_drop); $sql = "SELECT * FROM jobtype"; $result = $db->fetchAll($sql); foreach ($result as $res) { $names_job[] .= $res["name"]; $values_job[] .= $res["job_id"]; } $job_dropdown = html_drop_down_arrays("job_drop", $names_job, $values_job, $job_drop); $name = $_REQUEST['name']; if ($_REQUEST['add'] == "Dodaj") { $start_time = mktime($HOUR_START, $MIN_START, 0, date("n", time()), date("j", time()), $year = date("Y", time())); $stop_time = mktime($HOUR_STOP, $MIN_STOP, 0, date("n", time()), date("j", time()), $year = date("Y", time())); if ($name_drop and $job_drop and $start_time and $stop_time) { $sql = "SELECT timestamp FROM log where person_id = '{$name_drop}' and start='{$start_time}' and end='{$stop_time}'"; $result = $db->fetchOne($sql); if (!$result) { //dejansko vnesemo $data = array('person_id' => $name_drop, 'jobtype_id' => $job_drop, 'start' => $start_time, 'end' => $stop_time, 'note' => $note); $db->insert('log', $data);
<?php //*$DO_NOT_REDIRECT="true";*/ require_once "inc/config.php"; check_role($ROLE_EMPLOYED, "login.php"); $TITLE = "Evidenca zaposlenih"; $tem = template_open("NEWaktivnosti_employe.tpl"); $tem = template_add_head_foot($tem, head, foot); $sql = "SELECT `work_id`,`work`.`applic_id`,`subcat_id`, `applic`.`name` Program, `work`.`name` name, `opis` FROM `work`,`applic` WHERE '{$role_id}'>=`group` and `group`>'{$ROLE_USER}' and `work`.`applic_id`=`applic`.`applic_id` ORDER BY `work`.`applic_id`,`subcat_id`"; $qhour_start_time = range(0, 23); //$qhour_start_time_dropdown = html_drop_down_arrays("hour_start_time_drop",$qhour_start_time,$qhour_start_time,"8");//date("H",time())); $qhour_start_time_dropdown = html_drop_down_arrays("hour_start_time_drop", $qhour_start_time, $qhour_start_time, $hour_start_time_drop); //date("H",time())); $qmin_start_time = range(0, 59); $qmin_start_time_dropdown = html_drop_down_arrays("min_start_time_drop", $qmin_start_time, $qmin_start_time, $min_start_time_drop); //date("H",time())); $qhour_stop_time = range(0, 23); $qhour_stop_time_dropdown = html_drop_down_arrays("hour_stop_time_drop", $qhour_stop_time, $qhour_stop_time, $hour_stop_time_drop); //date("H",time())); $qmin_stop_time = range(0, 59); $qmin_stop_time_dropdown = html_drop_down_arrays("min_stop_time_drop", $qmin_stop_time, $qmin_stop_time, $min_stop_time_drop); //date("H",time())); $qday = range(1, 31); $day_dropdown = html_drop_down_arrays("day_drop", $qday, $qday, date("j", time())); $qmonth = range(1, 12); $month_dropdown = html_drop_down_arrays("month_drop", $qmonth, $qmonth, date("n", time())); $qyear = range(2009, date("Y", time()) + 1); $year_dropdown = html_drop_down_arrays("year_drop", $qyear, $qyear, date("Y", time())); //$sql = 'SELECT * FROM `work` WHERE $role_id>=`group` and `group`>$ROLE_USER ORDER BY `work`.`applic_id`,`subcat_id`"; $result = $db->fetchAll($sql); foreach ($result as $res) {
<?php //*$DO_NOT_REDIRECT="true";*/ require_once "inc/config.php"; check_role($ROLE_USER); $tem = template_open("feedback.tpl"); $tem = template_add_head_foot($tem, head, foot); $TITLE = "Vaša vprašanja, pripombe..."; $name = $_REQUEST['name']; if ($_REQUEST['add'] == " Naprej ") { //if ( $tip and $note) { //$sql = "SELECT timestamp FROM feedback where $tip=type_id and note = '$note'"; // $result = $db->fetchOne($sql); // if (!$result) { //dejansko vnesemo $data = array('type_id' => $tip, 'note' => $note, 'modified_by' => $person_id); //// SEND MAIL to admin //pridobi ime pošiljatelja $sql_temp = "SELECT first, last FROM persons where id_person='{$person_id}'"; $name = $db->fetchOne($sql_temp); echo $note; /////// $to = '*****@*****.**'; $subject = '[Feedback]' . '[uporabnik:' . $name . ']'; $mailmessage = ' <html> <p>Opis: <br> </html> <html>' . $note . '</html><br> <br> <br>' . $name; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n";
<?php $time = time(); require_once "inc/config.php"; check_role($ROLE_USER); $TITLE = "pregled aktivnosti"; $tem = template_open("view_client_work.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]; $mon = $_REQUEST["mon"]; $year = (int) $_REQUEST["year"]; $name_drop = (int) $_REQUEST["name_drop"]; ////month dropdown// for ($x = 1; $x < 13; $x++) { if ($x < 10) { $names[] .= "0" . $x; } else { $names[] .= $x; } } if (!$id) { $id = "<>0"; } else { $id = "={$id}"; $role_id = $ROLE_LIST; } $values = $names; $month_dropdown = html_drop_down_arrays("mon", $names, $values, date("m", time())); ///year dropdown//
<?php require_once "inc/config.php"; //Role id protection// check_role($ROLE_USER); $tem = template_open("feedback_accepted.tpl"); $tem = template_add_head_foot($tem, head, foot); $tem = str_replace('##USER##', $identity, $tem); $tem = template_clean_up_tags($tem, "##"); echo $tem;