当前位置: 首页>>代码示例>>PHP>>正文


PHP error_msg函数代码示例

本文整理汇总了PHP中error_msg函数的典型用法代码示例。如果您正苦于以下问题:PHP error_msg函数的具体用法?PHP error_msg怎么用?PHP error_msg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了error_msg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 /**
  * save and cache a content
  *
  * @param string $process_name  Cached ID to save the content in
  * @param mixed $data the content to cached, can be array or string or anything
  * @param int $time the time when the cache file will axpire
  * @return void
  */
 public function save($process_name, $data, $time = 86400)
 {
     if ($this->type == 'apc') {
         return $this->apc_save($process_name, $data, $time);
     }
     if (!is_writable($this->dir_path)) {
         error_msg('<em>ERROR</em> :  <strong>"cache" folder must be writable.');
     }
     $process_path = $this->process_file($process_name);
     if (file_exists($process_path)) {
         @unlink($process_path);
     }
     $data_for_save = '<?' . 'php' . "\n";
     $data_for_save .= '//Cache file, generated at ' . gmdate('d-m-Y h:i A') . "\n\n";
     $data_for_save .= '//No direct opening' . "\n";
     $data_for_save .= '(!defined("IN_SCRIPT") ? exit("hacking attemp!") : null);' . "\n\n";
     $data_for_save .= '//return false after x time' . "\n";
     $data_for_save .= 'if(time() > ' . (time() + $time) . ') return false;' . "\n\n";
     $data_for_save .= '$data = ' . var_export($data, true) . ";\n\n//end of cache";
     if ($file = @fopen($process_path, 'wb')) {
         fwrite($file, $data_for_save);
         fclose($file);
     }
     return;
 }
开发者ID:saanina,项目名称:sdeploy,代码行数:33,代码来源:cache.php

示例2: download

function download($auth_key)
{
    $qm = get_qm();
    $filename = isset($_GET['filename']) ? $_GET['filename'] : '';
    $email = isset($_GET['email']) ? $_GET['email'] : '';
    $title = isset($_GET['title']) ? $_GET['title'] : '';
    $key = isset($_GET['key']) ? $_GET['key'] : '';
    $page = isset($_GET['refer']) ? $_GET['refer'] : '';
    $filename = urldecode($filename);
    //validate
    $wikifile = 'wiki/' . encode($page) . '.txt';
    $source = file_exists($wikifile) ? file_get_contents($wikifile) : '';
    if ($page === '' or !preg_match('/&dl(?:button|link)\\(' . preg_quote($filename, '/') . '(?:,|\\))/', $source)) {
        header('HTTP/1.1 403 Forbidden');
        error_msg('Error : Invalid reference');
        exit;
    }
    if ($key != $auth_key) {
        header('HTTP/1.1 403 Forbidden');
        error_msg('Error : Invalid access');
        exit;
    }
    if ($filename == '') {
        header('HTTP/1.1 404 Not Found');
        error_msg('Error : file does not exists');
        exit;
    } else {
        $fp = fopen($filename, 'rb');
        if ($fp == FALSE) {
            fclose($fp);
            error_msg('Error : file does not exists');
            exit;
        }
    }
    //send mail
    if ($email != '') {
        dl_sendmail($email, $filename, $title);
    }
    //get filename
    $tmparr = explode('?', basename($filename));
    $filebasename = $tmparr[0];
    header("Cache-Control: public");
    header("Pragma: public");
    header("Accept-Ranges: none");
    header("Content-Transfer-Encoding: binary");
    header("Content-Disposition: attachment; filename={$filebasename}");
    header("Content-Type: application/octet-stream; name={$filebasename}");
    fpassthru($fp);
    fclose($fp);
    exit;
}
开发者ID:big2men,项目名称:qhm,代码行数:51,代码来源:dlexec.php

示例3: driver_apply

/**
* My Handy Restaurant
*
* http://www.myhandyrestaurant.org
*
* My Handy Restaurant is a restaurant complete management tool.
* Visit {@link http://www.myhandyrestaurant.org} for more info.
* Copyright (C) 2003-2005 Fabio De Pascale
* 
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
* @author		Fabio 'Kilyerd' De Pascale <public@fabiolinux.com>
* @package		MyHandyRestaurant
* @copyright		Copyright 2003-2005, Fabio De Pascale
*/
function driver_apply($driver, $msg)
{
    $debug = _FUNCTION_ . ' - Applying driver ' . $driver . ' - to msgline ' . $msg . ' ' . "\n";
    debug_msg(__FILE__, __LINE__, $debug);
    $driver_function = 'driver_' . $driver;
    if (function_exists($driver_function)) {
        $msg = $driver_function($msg);
    } else {
        echo 'driver not found: ' . $driver . '<br>' . "\n";
        $debug = _FUNCTION_ . ' - driver ' . $driver . ' not found' . "\n";
        error_msg(__FILE__, __LINE__, $debug);
    }
    if (!CONF_DEBUG_PRINT_MARKUP) {
        // cleans all not used markups
        $msg = preg_replace("/{[^}]*}/", "", $msg);
    }
    return $msg;
}
开发者ID:jaimeivan,项目名称:smart-restaurant,代码行数:45,代码来源:drivers_waiter.php

示例4: process

 public function process()
 {
     if (!$this->person->isAuth()) {
         error_msg("This is an impossible condition. How did you get in here?");
         return;
     }
     $subscriber = $this->person->getSubscriber();
     if (empty($subscriber) || !$subscriber->isSubscribed()) {
         $this->tpl->assign('not_subscribed_header', $this->translateTag('l10n_not_sub_header', 'messages'));
         $this->tpl->assign('not_subscribed_1', $this->translateTag('l10n_not_sub_1', 'messages'));
         $this->tpl->assign('not_subscribed_2', $this->translateTag('l10n_not_sub_2', 'messages'));
         $this->tpl->assign('content', $this->tpl->fetch('errors/unsubscribed.tpl'));
         return;
     }
     /* test and handle flags */
     $this->processDBCert();
     try {
         $certList = $this->ca->getCertList($this->showAll);
         /* sort the revoked certificates after the active certificates */
         $revoked = array_filter($certList, array($this, 'revokedFilter'));
         $non_revoked = array_diff_assoc($certList, $revoked);
         $certList = $non_revoked + $revoked;
         $this->tpl->assign('certList', $certList);
         $this->tpl->assign('showAll', $this->showAll);
         $this->tpl->assign('defaultDays', Config::get_config('capi_default_cert_poll_days'));
     } catch (ConfusaGenException $e) {
         Framework::error_output($this->translateMessageTag('downl_err_db') . " " . $e->getMessage());
     }
     /* animate the user to install the root certificate in personal mode,
      * so Thunderbird will fully trust the certs when using them in S/MIME
      */
     if (Config::get_config('cert_product') == PRD_PERSONAL) {
         $this->tpl->assign('ca_certificate', ConfusaConstants::$CAPI_PERSONAL_ROOT_CERT);
     }
     /* coming from browser signing - hint the user to install the cert */
     $browserCertOrderNumber = CS::getSessionKey("browserCert");
     if (isset($browserCertOrderNumber)) {
         CS::deleteSessionKey('browserCert');
         $this->tpl->assign('newBrowserCert', $browserCertOrderNumber);
     }
     $this->tpl->assign('permission', $this->person->mayRequestCertificate());
     $this->tpl->assign('standalone', Config::get_config('ca_mode') === CA_STANDALONE);
     $this->tpl->assign('content', $this->tpl->fetch('download_certificate.tpl'));
 }
开发者ID:henrikau,项目名称:confusa,代码行数:44,代码来源:download_certificate.php

示例5: template_out

function template_out($template_name, $from_modulname)
{
    global $tpl, $lang_suffix;
    $ret = is_modul_name_aktive($from_modulname);
    if ($ret == 0) {
        error_msg("Dieses Modul wurde vom Administrator deaktiviert.<br>Module has been disabled by the administrator.");
        exit;
    }
    $lang_file = LITO_LANG_PATH . $from_modulname . '/lang_' . $lang_suffix . '.php';
    $tpl->config_load($lang_file);
    $tpl->assign('LITO_NAVIGATION', get_navigation());
    $tpl->assign('LITO_GLOBAL_IMAGE_URL', LITO_GLOBAL_IMAGE_URL);
    $tpl->assign('LITO_IMG_PATH', LITO_IMG_PATH_URL . $from_modulname . "/");
    $tpl->assign('LITO_MAIN_CSS', LITO_MAIN_CSS);
    $tpl->assign('GAME_FOOTER_MSG', get_footer());
    $tpl->assign('LITO_ROOT_PATH_URL', LITO_ROOT_PATH_URL);
    $tpl->assign('LITO_MODUL_PATH_URL', LITO_MODUL_PATH_URL);
    $tpl->assign('LITO_BASE_MODUL_URL', LITO_MODUL_PATH_URL);
    $tpl->display($from_modulname . "/" . $template_name);
}
开发者ID:Wehmeyer,项目名称:Litotex-0.7,代码行数:20,代码来源:functions.php

示例6: max

$modul_name = "acp_map";
require $_SESSION['litotex_start_acp'] . 'acp/includes/perm.php';
$menu_name = "Karteneditor";
$tpl->assign('menu_name', $menu_name);
if ($action == "main") {
    $result = $db->query("SELECT max(x) as maximum FROM cc" . $n . "_crand ");
    $land = $db->fetch_array($result);
    $tpl->assign('op_map_size', $land['maximum']);
    template_out('map.html', $modul_name);
}
if ($action == "make_map") {
    $size = intval(trim($_POST['x']));
    $elemt_1 = intval(trim($_POST['elem1']));
    $elemt_2 = intval(trim($_POST['elem2']));
    if ($size <= 0) {
        error_msg("Falsche Angabe der Kartengröße (Eingabe:{$size})");
        exit;
    }
    trace_msg("Admin map change drop table", 112);
    $sql = "DROP TABLE IF EXISTS cc" . $n . "_crand";
    $update = $db->query($sql);
    trace_msg("Admin map change create table", 112);
    $sql = "CREATE TABLE cc" . $n . "_crand (crand_id INT( 11 ) NOT NULL AUTO_INCREMENT ,x INT( 5 ) NOT NULL ,y INT( 5 ) NOT NULL ,used TINYINT( 1 ) NOT NULL DEFAULT '0',element_type INT( 2 ) NOT NULL DEFAULT '0',PRIMARY KEY ( crand_id )) ";
    $update = $db->query($sql);
    for ($x = 1; $x <= $size; $x++) {
        for ($y = 1; $y <= $size; $y++) {
            $sql = "insert into cc" . $n . "_crand (x,y,used) VALUES('{$x}','{$y}','0')";
            $update = $db->query($sql);
        }
    }
    trace_msg("Admin map change create Elemet1", 112);
开发者ID:Wehmeyer,项目名称:Litotex-0.7,代码行数:31,代码来源:map.php

示例7: header

    header("LOCATION: " . LITO_MODUL_PATH_URL . "acp_news/news.php");
    exit;
}
if ($action == "edit") {
    $news_id = intval($_GET['id']);
    $result_news = $db->query("SELECT * FROM cc" . $n . "_news where news_id ='{$news_id}'");
    $row = $db->fetch_array($result_news);
    $tpl->assign('NEWS_OVER', $row['heading']);
    $tpl->assign('ACTION_SAVE', 'update&id=' . $news_id);
    $tpl->assign('NEWS_TEXT_LANG', $row['text']);
    template_out('news_new.html', $modul_name);
}
if ($action == "update") {
    $news_id = intval($_GET['id']);
    if (empty($_POST['new_news']) || empty($_POST['new_news'])) {
        error_msg($l_emptyfield_error);
    } else {
        $text = mysql_real_escape_string(trim($_POST['new_news']));
        $heading = mysql_real_escape_string(trim($_POST['heading']));
        if ($heading == "") {
            $heading = "no input";
        }
        $date = date("d.m.Y, H:i");
        $sql = "update cc" . $n . "_news set user_id='{$_SESSION['userid']}' ,heading= '{$heading}' ,date='{$date}',text='" . nl2br($text) . "' where news_id ='{$news_id}'";
        $update = $db->query($sql);
    }
    header("LOCATION: " . LITO_MODUL_PATH_URL . "acp_news/news.php");
    exit;
}
if ($action == "activate") {
    $news_id = intval($_GET['id']);
开发者ID:Wehmeyer,项目名称:Litotex-0.7,代码行数:31,代码来源:news.php

示例8: fopen

}
//Prüfen ob die TAN bereits verwendet wurde
$filename = $_SESSION["lisa_path"] . "/" . $_SESSION["settings"]["tan_used.txt"];
$handle = fopen($filename, "r");
$tan_used = false;
while (!feof($handle)) {
    $zeile = trim(fgets($handle, 1024));
    $zeile = str_replace(" ", "", $zeile);
    if ($zeile == $tan) {
        $tan_used = true;
    }
}
fclose($handle);
if ($tan_used) {
    $msg = "Fehler: TAN ist bereits verwendet worden<br>\n\t\t\t\t<form action='index.php' method='POST' >\n\t\t\t\t\t\t<input type='submit' value='zurück'>\n\t\t\t\t</form>";
    error_msg($msg);
}
$_SESSION["tan"] = $tan;
?>
			<p>
			<table>
				<tr>
					<td>
							OK: Die TAN ist korrekt und wurde noch nicht verwendet.
					</td>
				</tr>
				<tr>
					<td align='center'>&nbsp;
						<form action='picture_source.php' method='POST' >
							<input type='submit' value='weiter'>
						</form>
开发者ID:reimht,项目名称:lisa,代码行数:31,代码来源:check_tan.php

示例9: array

    }
    $tpl->assign('countries', $countries);
    $grp_av_q = $db->query("SELECT `id`, `name` FROM `cc" . $n . "_user_groups`");
    $grps_av = array();
    $i = 0;
    while ($grp_av = $db->fetch_array($grp_av_q)) {
        $grps_av[$i]['id'] = $grp_av['id'];
        $grps_av[$i]['name'] = $grp_av['name'];
        $i++;
    }
    $tpl->assign('grps', $grps_av);
    template_out('edit.html', $modul_name);
}
if ($action == 'res') {
    if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
        error_msg('ID nicht &uuml;bergeben!');
        exit;
    }
    $countries_q = $db->query("SELECT `islandid`, `name`, `res1`, `res2`, `res3`, `res4` FROM `cc" . $n . "_countries` WHERE `islandid` = '" . $_GET['id'] . "'");
    $countries = array();
    $i = 0;
    $countrie = $db->fetch_array($countries_q);
    $countries[$i]['id'] = $countrie['islandid'];
    $countries[$i]['name'] = $countrie['name'];
    $countries[$i]['res1'] = $countrie['res1'];
    $countries[$i]['res2'] = $countrie['res2'];
    $countries[$i]['res3'] = $countrie['res3'];
    $countries[$i]['res4'] = $countrie['res4'];
    $i++;
    $tpl->assign('countrie', $countries[0]);
    template_out('res.html', $modul_name);
开发者ID:Wehmeyer,项目名称:Litotex-0.7,代码行数:31,代码来源:usermgr.php

示例10: _get_file_media_id

 function _get_file_media_id($file_id, $type = 'voice', $title = '', $introduction = '')
 {
     $fileInfo = M('file')->find($file_id);
     if ($fileInfo) {
         $path = '/Uploads/Download/' . $fileInfo['savepath'] . $fileInfo['savename'];
         if (!$path) {
             $this->error('获取素材失败');
             exit;
         }
         $param['type'] = $type;
         $param['media'] = '@' . realpath(SITE_PATH . $path);
         if ($type == 'video') {
             $param['description']['title'] = $title;
             $param['description']['introduction'] = $introduction;
         }
         $url = 'https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=' . get_access_token();
         $res = post_data($url, $param);
         if (!$res) {
             $this->error('同步失败');
         }
         if (isset($res['errcode']) && $res['errcode'] != 0) {
             $this->error(error_msg($res, '素材上传'));
             exit;
         }
     }
     return $res['media_id'];
 }
开发者ID:yxz1025,项目名称:weiphp3.0,代码行数:27,代码来源:MaterialController.class.php

示例11: intval

    $required = intval($_POST['required']);
    $b_option = trim($_POST['build_option']);
    $description = trim($_POST['descr']);
    $kurz = get_explore_tabless_name($b_option);
    if ($kurz == "") {
        error_msg("Bitte einen Kurznamen eintragen!");
        exit;
    }
    $ret = if_spalte_exist($kurz, "cc" . $n . "_countries");
    if ($ret == 0) {
        $update = $db->query("ALTER TABLE cc" . $n . "_countries ADD " . $kurz . " INT( 10 ) NOT NULL DEFAULT '0'");
    }
    $update = $db->query("UPDATE cc" . $n . "_explore set tabless='' and race='' where tabless='{$b_option}' and race='{$race}'");
    $update = $db->query("Insert Into cc" . $n . "_explore (description,name,race,tabless,res1,res2,res3,res4,time,points,required,explorePic)VALUES ('{$description}','{$name}','{$race}','{$kurz}','{$gold}','{$stone}','{$oil}','{$exp}','{$buildtime}','{$points}','{$required}','{$explorepic}') ");
    header("LOCATION: edit_explore.php");
}
if ($action == "del") {
    $del_id = intval($_GET['del_id']);
    if ($del_id <= 0) {
        error_msg("Vorgang kann nicht ausgef&uuml;hrt werden!");
        exit;
    }
    // search for old
    $result = $db->query("SELECT tabless,eid FROM cc" . $n . "_explore WHERE eid='" . $del_id . "'");
    $row = $db->fetch_array($result);
    $old_kurz = $row['tabless'];
    if ($old_kurz != '') {
        $update = $db->query("delete from cc" . $n . "_explore where eid='" . $del_id . "'");
    }
    header("LOCATION: edit_explore.php");
}
开发者ID:Wehmeyer,项目名称:Litotex-0.7,代码行数:31,代码来源:edit_explore.php

示例12: _send_by_openid

 function _send_by_openid($openids)
 {
     $openids = wp_explode($openids);
     if (empty($openids)) {
         $this->error('要发送的OpenID值不能为空');
     }
     if (count($openids) < 2) {
         $this->error('OpenID至少需要2个或者2个以上');
     }
     $url = 'https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token=' . get_access_token();
     $info = $this->_sucai_media_info();
     $param['touser'] = $openids;
     if ($info['msgtype'] == 'text') {
         $param['text']['content'] = $info['media_id'];
         $param['msgtype'] = $info['msgtype'];
     } else {
         if ($info['msgtype'] == 'mpnews') {
             $param['mpnews']['media_id'] = $info['media_id'];
             $param['msgtype'] = $info['msgtype'];
         } else {
             if ($info['msgtype'] == 'voice') {
                 $param['voice']['media_id'] = $info['media_id'];
                 $param['msgtype'] = $info['msgtype'];
             } else {
                 if ($info['msgtype'] == 'mpvideo') {
                     $param['video']['media_id'] = $info['media_id'];
                     $param['msgtype'] = $info['video'];
                 }
             }
         }
     }
     $param = JSON($param);
     $res = post_data($url, $param);
     if ($res['errcode'] != 0) {
         $this->error(error_msg($res));
     } else {
         return $res['msg_id'];
     }
 }
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:39,代码来源:MessageController.class.php

示例13: info_msg

    function info_msg($message, $type = 'INFO')
    {
        error_log("DB ERROR {$type}: {$message}", 0);
    }
    function debug_msg($message, $type = 'DEBUG')
    {
        error_log("DB ERROR {$type}: {$message}", 0);
    }
}
// Allow better debugging if this is run from command line
if (defined('WP_CLI')) {
    error_msg('Error establishing a database connection');
    if (defined('DB_HOST')) {
        debug_connection();
    } else {
        error_msg('DB_HOST is not defined');
    }
    // Also show errors if WP_DEBUG is enabled
} else {
    send_db_error_headers();
    if (defined('WP_DEBUG') && WP_DEBUG) {
        ?>
        <!DOCTYPE html>
        <html xmlns="http://www.w3.org/1999/xhtml"<?php 
        if (is_rtl()) {
            echo ' dir="rtl"';
        }
        ?>
>
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
开发者ID:devgeniem,项目名称:better-wp-db-error,代码行数:31,代码来源:db-error.php

示例14: mysql_list_tables

 TODO: link to db installation page in the error msg
 */
 $tableslist = mysql_list_tables($db_common, $link);
 $numtables = mysql_num_rows($tableslist);
 if ($numtables == 0) {
     die(GLOBALMSG_DB_NO_TABLES_ERROR);
 }
 $_SESSION['common_db'] = $db_common;
 start_language();
 $found_accounting_db = true;
 if (!$found_accounting_db) {
     $error_msg = common_header('No accounting db has been found');
     $error_msg .= GLOBALMSG_NO_ACCOUNTING_DB_FOUND . "\n";
     $error_msg .= GLOBALMSG_CONFIGURE_DATABASES . "\n";
     $error_msg .= common_bottom();
     error_msg(__FILE__, __LINE__, 'No accounting db has been found');
     die($error_msg);
 }
 $_SESSION['common_db'] = common_find_first_db($_SESSION['common_db']);
 // unsets all the waiters' _SESSION vars
 unset($_SESSION['catprinted']);
 if ($_SERVER['PHP_SELF'] != $_SESSION['page']) {
     $_SESSION['page'] = $_SERVER['PHP_SELF'];
     unset($_SESSION['orderby']);
     unset($_SESSION['ordersort']);
 }
 if (isset($_GET['mgmt_db_number'])) {
     $_SESSION['common_db'] = $_GET['mgmt_db_number'];
 } elseif (isset($_POST['mgmt_db_number'])) {
     $_SESSION['common_db'] = $_POST['mgmt_db_number'];
 }
开发者ID:jaimeivan,项目名称:smart-restaurant,代码行数:31,代码来源:mgmt_start.php

示例15: timecard_html


//.........这里部分代码省略.........
        if ($tc->in_or_out == 1 || $timecard_list_punch_outs == 'yes') {
            $h_color = htmlentities($tc->row['color']);
            $h_inout = htmlentities($tc->row['inout']);
            $h_time = date($timefmt, $tc->start_time);
            $h_date = date($datefmt, $tc->start_time);
            if ($timecard_display_hours_minutes == "yes") {
                $h_hours = hrs_min($timecard_hours_include_overtime == "yes" ? $tc->hours + $tc->overtime : $tc->hours);
                $h_overtime = hrs_min($tc->overtime);
                $h_total = hrs_min($tc->week_hours + $tc->overtime_hours);
            } else {
                $h_hours = sprintf("%01.02f", $timecard_hours_include_overtime == "yes" ? $tc->hours + $tc->overtime : $tc->hours);
                $h_overtime = sprintf("%01.02f", $tc->overtime);
                $h_total = sprintf("%01.02f", $tc->week_hours + $tc->overtime_hours);
            }
            $h_notes = htmlentities($tc->row['notes']);
            if ($tc->in_or_out != 1) {
                // Don't display hours on "out" records.
                $h_hours = $h_overtime = $h_total = '';
            }
            $row_class = ++$print_count % 2 ? 'odd' : 'even';
            $overtime_col = $overtime_week_limit > 0 ? "\n    <td align=\"right\" class=\"ovt\">{$h_overtime}</td>" : '';
            $total_col = $timecard_display_running_total == "yes" ? "\n    <td align=\"right\" class=\"total\">{$h_total}</td>" : '';
            print <<<End_Of_HTML

  <tr class="display_row {$row_class}">
    <td align="left" style="color:{$h_color}">{$h_inout}</td>
    <td align="right">{$h_time}</td>
    <td align="right">{$h_date}</td>
    <td align="right" class="hrs">{$h_hours}</td>{$overtime_col}{$total_col}
    <td align="left" class="notes">{$h_notes}</td>
  </tr>
End_Of_HTML;
        }
    }
    function print_footer($tc)
    {
        global $timecard_display_running_total, $timecard_hours_include_overtime;
        global $timecard_display_hours_minutes, $overtime_week_limit;
        // Set flag to print paragraph of totals if they're not already obvious.
        $print_totals = $timecard_display_running_total == "yes" || $timecard_hours_include_overtime != "yes" ? true : false;
        $h_total_hours = sprintf("%01.02f", $tc->week_hours + $tc->overtime_hours);
        $h_totals = $print_totals ? "\n<p>Total for week: " . hrs_min($tc->week_hours + $tc->overtime_hours) . " ({$h_total_hours} hours)</p>" : '';
        $h_ovt_total_hours = sprintf("%01.02f", $tc->overtime_hours);
        $h_overtime_totals = $print_totals && $tc->overtime_hours > 0 ? "\n<p>Total overtime: " . hrs_min($tc->overtime_hours) . " ({$h_ovt_total_hours} hours)</p>" : '';
        $h_day_total_hours = sprintf("%01.02f", $tc->today_hours);
        $h_today_hours = $tc->today_hours !== null ? "<p>Total today: " . hrs_min($tc->today_hours) . " ({$h_day_total_hours} hours)</p>" : '';
        if ($timecard_display_running_total != "yes") {
            // Print row of totals
            $total_hours = $timecard_hours_include_overtime == "yes" ? $tc->week_hours + $tc->overtime_hours : $tc->week_hours;
            $h_hours = $timecard_display_hours_minutes == "yes" ? hrs_min($total_hours) : $h_total_hours;
            $overtime_col = $overtime_week_limit > 0 ? "\n    <td align=\"right\" class=\"ovt\">" . ($timecard_display_hours_minutes == "yes" ? hrs_min($tc->overtime_hours) : $h_ovt_total_hours) . "</td>" : '';
            $total_col = $timecard_display_running_total == "yes" ? "\n    <td align=\"right\" class=\"total\">" . ($timecard_display_hours_minutes == "yes" ? hrs_min($tc->week_hours + $tc->overtime_hours) : $h_total_hours) . "</td>" : '';
            print <<<End_Of_HTML
  <tr class="total_row">
    <td align="left"></td>
    <td align="right"></td>
    <td align="right"></td>
    <td align="right" class="hrs">{$h_hours}</td>{$overtime_col}{$total_col}
    <td align="left" class="notes"></td>
  </tr>
End_Of_HTML;
        }
        print <<<End_Of_HTML
  </tbody>
</table>
End_Of_HTML;
        if ($timecard_display_running_total == "yes" || $timecard_hours_include_overtime != "yes" || $h_today_hours) {
            // Add totals text if totals are not already displayed or if summing the hours column is confusing.
            print <<<End_Of_HTML

<div class="totals">
{$h_today_hours}{$h_totals}{$h_overtime_totals}
</div>

End_Of_HTML;
        }
    }
    // End of helper function definitions.
    // Print timecard page header.
    $h_name_header = htmlentities($show_display_name == 'yes' ? get_employee_name($empfullname) : $empfullname);
    $begin_date = date('l F j, Y', $begin_local_timestamp);
    print <<<End_Of_HTML

<div class="timecard">
<h2>Timecard</h2>
<h3>{$h_name_header}</h3>
<h4>Week beginning {$begin_date}</h4>
End_Of_HTML;
    // Print timecard.
    $tc = new Timecard($empfullname, $begin_local_timestamp, $end_local_timestamp);
    list($row_count, $total_hours, $overtime_hours, $today_hours) = $tc->walk(print_header, print_row, print_footer);
    if ($row_count <= 0) {
        print error_msg("No records were found.");
    }
    // Print timecard page footer.
    print <<<End_Of_HTML
</div> <!-- timecard -->

End_Of_HTML;
}
开发者ID:benscanfiles,项目名称:timeclock,代码行数:101,代码来源:lib.timecard.php


注:本文中的error_msg函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。