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


PHP template::getOutput方法代码示例

本文整理汇总了PHP中template::getOutput方法的典型用法代码示例。如果您正苦于以下问题:PHP template::getOutput方法的具体用法?PHP template::getOutput怎么用?PHP template::getOutput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在template的用法示例。


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

示例1: getOutput

 /**
  * Returns the html output if login failed or redirects to patients if login was successful.
  *
  * @return string Html output.
  */
 public function getOutput()
 {
     $attempt = isset($_POST['username']) && isset($_POST['password']);
     $success = false;
     if ($attempt) {
         $success = $this->validateLogin();
     }
     $tpl = new \template("login/login");
     if ($attempt) {
         if ($success) {
             $_SESSION['login'] = new \DateTime();
             $_SESSION['user'] = $_POST['username'];
             $_SESSION['userId'] = \dbConn::querySingle("SELECT userId FROM :prefix:user WHERE email = :0", $_POST['username']);
             $_SESSION['isAdmin'] = $this->isAdmin();
             $_SESSION['username'] = \dbConn::querySingle("SELECT CONCAT(CONCAT(firstname, ' '), lastname) AS name \n                                                                FROM :prefix:user WHERE email = :0", $_POST['username']);
             if ($_SESSION['isAdmin']) {
                 header("location: " . ROOT . "patients");
             } else {
                 header("location: " . ROOT . "mypatients");
             }
             die;
         } else {
             $tpl->insert("result", new \template("login/failed"));
         }
     }
     return $tpl->getOutput();
 }
开发者ID:fhoner,项目名称:smartdoorbell,代码行数:32,代码来源:login.php

示例2: getOutput

 public function getOutput()
 {
     $tpl = new \template("mypatients/container");
     // user data
     $user = \dbConn::queryRow("SELECT userid, firstname, lastname, rfid, email, state \n                                    FROM :prefix:user WHERE userId = :0", $_SESSION['userId']);
     $tpl->insert("firstname", $user['firstname']);
     $tpl->insert("lastname", $user['lastname']);
     $tpl->insert("userid", $user['userid']);
     $tpl->insert("rfid", $user['rfid']);
     $tpl->insert("email", $user['email']);
     foreach (\dbConn::query("SELECT * FROM :prefix:user_state") as $r) {
         $tpl->insert("states", $r['name'] == $user['state'] ? "<option value=\"{$r['name']}\" selected>{$r['display']}</option>" : "<option value=\"{$r['name']}\">{$r['display']}</option>");
     }
     // insert patients
     $hasPatients = false;
     $visit = null;
     foreach (\dbConn::query("\n                                    SELECT firstname, lastname, patientId\n                                    FROM :prefix:visit AS v\n                                    INNER JOIN :prefix:patient AS p\n                                    ON v.patient = p.patientId\n                                    WHERE user = :0\n                                    ORDER BY firstname", $_SESSION['userId']) as $r) {
         $tpl->insert("patients", "<option value=\"{$r['patientId']}\">{$r['firstname']} {$r['lastname']}</option>");
         if (!$hasPatients) {
             $visit = \dbConn::queryRow("SELECT * FROM :prefix:visit WHERE user = :0 AND patient = :1", $_SESSION['userId'], $r['patientId']);
         }
         $hasPatients = true;
     }
     $visitTpl = new \template("visitors/edit.visit");
     // relation
     foreach (\dbConn::query("SELECT * FROM :prefix:relation ORDER BY name ASC") as $r) {
         $visitTpl->insert("relations", "<option value=\"{$r['name']}\"" . ($r['name'] == $visit['relation'] ? " selected" : "") . ">{$r['name']}</option>");
     }
     // description
     $visitTpl->insert("description", $visit['description']);
     // scent
     foreach (\dbConn::query("SELECT * FROM :prefix:scent ORDER BY name ASC") as $r) {
         $visitTpl->insert("scents", "<option value=\"{$r['name']}\"" . ($r['name'] == $visit['scent'] ? " selected" : "") . ">{$r['name']}</option>");
     }
     // images
     $imgCount = 0;
     foreach (\dbConn::query("SELECT * FROM :prefix:visit_media WHERE visitId = :0 AND type = :1", $visit['visitId'], 'Image') as $img) {
         $visitTpl->insert("image" . ($imgCount + 1), ROOT . "media/image/" . $img['path']);
         $imgCount++;
     }
     for ($i = $imgCount + 1; $i <= 3; $i++) {
         $visitTpl->insert("image" . $i, ROOT . "images/icons/image.png");
     }
     // audios
     $audioCount = 0;
     foreach (\dbConn::query("SELECT * FROM :prefix:visit_media WHERE visitId = :0 AND type = :1", $visit['visitId'], 'Audio') as $audio) {
         $visitTpl->insert("audio" . ($audioCount + 1), ROOT . "images/icons/audio.png");
         $audioCount++;
     }
     for ($i = $audioCount + 1; $i <= 3; $i++) {
         $visitTpl->insert("audio" . $i, ROOT . "images/icons/plus.png");
     }
     $tpl->insert("visit", $visitTpl->getOutput());
     return $tpl->getOutput();
 }
开发者ID:fhoner,项目名称:smartdoorbell,代码行数:55,代码来源:mypatients.php

示例3: getHistory

function getHistory($limit)
{
    if (!isset($limit) || $limit == 0 || $limit == null || !is_numeric($limit)) {
        $limit = 9999999;
    }
    $changes = new template("admin/lastchanges.container");
    foreach (dbConn::query("SELECT\n                                action, \n                                nameBefore, \n                                nameAfter, \n                                emailBefore, \n                                emailAfter, \n                                production, \n                                fromDate,\n                                toDate,\n                                mvoe_plan.name AS plan, \n                                mvoe_worker_history.created\n                            FROM :prefix:worker_history \n                            INNER JOIN :prefix:shift ON :prefix:shift.shiftId = :prefix:worker_history.shift\n                            INNER JOIN :prefix:plan ON :prefix:shift.plan = :prefix:plan.name\n                            ORDER BY :prefix:worker_history.created DESC LIMIT 0, " . $limit) as $r) {
        $change = new template("admin/lastchanges.entry");
        switch ($r['action']) {
            case "insert":
                $change->insert("action", "<span style=\"color:green;\"><small>\n                                            <i class=\"fa fa-plus-square\"></i>\n                                           </small></span>&nbsp;&nbsp;Hinzugefügt");
                break;
            case "update":
                $change->insert("action", "<span style=\"color:orange;\"><small>\n                                            <i class=\"fa fa-minus-square\"></i>\n                                           </small></span>&nbsp;&nbsp;Bearbeitet");
                break;
            case "delete":
                $change->insert("action", "<span style=\"color:red;\">\n                                            <small><i class=\"fa fa-trash\"></i>\n                                           </small></span>&nbsp;&nbsp;Gelöscht");
                break;
            default:
                $change->insert("action", "Unbekannt");
                break;
        }
        $change->insert("shift", "<small>{$r['plan']}, {$r['production']}</small><br />" . substr($r['fromDate'], 0, 5) . " - " . substr($r['toDate'], 0, 5));
        if ($r['nameBefore'] == $r['nameAfter']) {
            $change->insert("user", $r['nameAfter']);
        } else {
            $change->insert("user", "<small><span style=\"text-decoration:line-through;\">{$r['nameBefore']}</span></small>\n            <br /><strong>{$r['nameAfter']}</strong>");
        }
        if ($r['emailBefore'] == $r['emailAfter']) {
            $change->insert("email", $r['emailAfter']);
        } else {
            $change->insert("email", "<small><span style=\"text-decoration:line-through;\">{$r['emailBefore']}</span></small>\n            <br /><strong>{$r['emailAfter']}</strong>");
        }
        $change->insert("date", (new DateTime($r['created']))->format("d.m.y H:i"));
        $changes->insert("content", $change->getOutput());
    }
    $changes->removeVariables();
    return $changes->getOutput();
}
开发者ID:fhoner,项目名称:Schichtplaner,代码行数:39,代码来源:functions.php

示例4: getOutput

 public static function getOutput($par)
 {
     $nav = new template("navigation/container");
     $public = !isset($_SESSION['user']);
     foreach (dbConn::query("SELECT * FROM :prefix:navigation WHERE parent IS NULL AND public = :0 ORDER BY position", $public) as $r) {
         if ($r['admin'] && !$_SESSION['isAdmin']) {
             continue;
         }
         $link = new template("navigation/layer1");
         $link->insert("caption", htmlspecialchars($r['caption']));
         $link->insert("destination", ROOT . $r['destination'] . "/");
         $requestUri = $_SERVER['REQUEST_URI'];
         if (navigation::startsWith($_SERVER['REQUEST_URI'], ROOT)) {
             $requestUri = urldecode(substr($_SERVER['REQUEST_URI'], strlen(ROOT)));
         }
         // check active
         //$link->insert("active", $requestUri == $r['destination'] ? "active" : "");
         $link->insert("active", navigation::startsWith($requestUri, $r['destination']) ? "active" : "");
         foreach (dbConn::query("SELECT * FROM :prefix:navigation WHERE parent = :0 ORDER BY position", $r['linkId']) as $s) {
             $sublink = new template("navigation/layer2");
             $sublink->insert("caption", htmlspecialchars($s['caption']));
             $sublink->insert("destination", ROOT . $s['destination'] . "/");
             $requestUri = $_SERVER['REQUEST_URI'];
             if ($requestUri[strlen($requestUri) - 1] == "/") {
                 $requestUri = substr($requestUri, 0, strlen($requestUri) - 1);
             }
             if (navigation::startsWith($requestUri, ROOT)) {
                 $requestUri = substr($requestUri, strlen(ROOT), strlen($requestUri) - strlen(ROOT));
             }
             $sublink->insert("active", $requestUri == $s['destination'] ? "active" : "");
             $link->insert("links", $sublink->getOutput());
         }
         $nav->insert("links", $link->getOutput());
     }
     return $nav->getOutput();
 }
开发者ID:fhoner,项目名称:smartdoorbell,代码行数:36,代码来源:navigation.php

示例5: getOutput

 /**
  * Gets the html output and handles form inputs.
  *
  * @return string Html output.
  */
 public function getOutput()
 {
     switch ($this->viewpoint) {
         // ######################################################################################################
         case "overview":
             $tpl = new \template("patients/container");
             $query = "";
             if ($_SESSION['isAdmin']) {
                 $query = "SELECT \n                                patientId,\n                                firstname, \n                                lastname,\n                                room\n                            FROM :prefix:patient\n                            ORDER BY lastname ASC";
             } else {
                 $query = "SELECT \n                                patientId,\n                                firstname, \n                                lastname,\n                                room\n                            FROM :prefix:patient\n                            WHERE patientId IN (SELECT patientId FROM :prefix:visit WHERE user = " . $_SESSION['userId'] . ")\n                            ORDER BY lastname ASC";
             }
             foreach (\dbConn::query($query) as $r) {
                 $p = new \template("patients/patient");
                 $p->insert("id", $r['patientId']);
                 $p->insert("firstname", $r['firstname']);
                 $p->insert("lastname", $r['lastname']);
                 $p->insert("room", $r['room']);
                 $p->insert("visitorcount", \dbConn::querySingle("SELECT COUNT(*) FROM :prefix:visit WHERE patient = :0", $r['patientId']));
                 $p->insert("destination", ROOT . "patients" . "/" . $r['patientId']);
                 $tpl->insert("patients", $p);
             }
             return $tpl->getOutput();
             break;
             // ######################################################################################################
         // ######################################################################################################
         case "edit":
             $result = null;
             $tpl = new \template("patients/edit");
             $tpl->insert("id", $_GET['par2']);
             if (isset($_POST['save'])) {
                 $error = "";
                 if (!$this->saveChanges($error)) {
                     $result = new \template("alerts/danger");
                     $result->insert("caption", "Fehler");
                     $result->insert("text", $error);
                     $tpl->insert("firstname", $_POST['firstname']);
                     $tpl->insert("lastname", $_POST['lastname']);
                     $tpl->insert("room", $_POST['room']);
                     $tpl->insert("birthday", (new \DateTime($_POST['birthday']))->format("d.m.Y"));
                 } else {
                     $result = new \template("alerts/success");
                     $result->insert("caption", "Erfolgreich");
                     $result->insert("text", "Änderungen wurden erfolgreich gespeichert.");
                 }
             }
             $data = \dbConn::queryRow("SELECT * FROM :prefix:patient WHERE patientId = :0", $_GET['par2']);
             if (isset($result)) {
                 $tpl->insert("result", $result);
                 if ($error == "") {
                     $tpl->insert("firstname", $data['firstname']);
                     $tpl->insert("lastname", $data['lastname']);
                     $tpl->insert("room", $data['room']);
                     $tpl->insert("birthday", (new \DateTime($data['birth']))->format("d.m.Y"));
                 }
             } else {
                 $tpl->insert("firstname", $data['firstname']);
                 $tpl->insert("lastname", $data['lastname']);
                 $tpl->insert("room", $data['room']);
                 $tpl->insert("birthday", (new \DateTime($data['birth']))->format("d.m.Y"));
             }
             foreach (\dbConn::query("\n                    SELECT firstname, lastname\n                    FROM :prefix:visit AS v\n                    INNER JOIN :prefix:user AS u\n                    ON v.user = u.userId\n                    WHERE v.patient = :0\n                ", $_GET['par2']) as $r) {
                 $tpl->insert("visitors", "<option>" . $r['firstname'] . " " . $r['lastname'] . "</option>");
             }
             return $tpl->getOutput();
             break;
             // ######################################################################################################
         // ######################################################################################################
         case "new":
             if (!$_SESSION['isAdmin']) {
                 return "<h1>Zugriff verweigert</h1>";
             }
             $tpl = new \template("patients/new");
             return $tpl->getOutput();
             break;
     }
 }
开发者ID:fhoner,项目名称:smartdoorbell,代码行数:82,代码来源:patients.php

示例6: validateDate

<?php

require "../config.php";
function validateDate($date)
{
    $d = DateTime::createFromFormat('d.m.Y', $date);
    return $d && $d->format('d.m.Y') == $date;
}
if (!isset($_POST['name']) || strlen($_POST['name']) < 1) {
    die("Bitte geben Sie einen gültigen Namen ein.");
}
if (dbConn::querySingle("SELECT COUNT(*) FROM :prefix:plan WHERE name = :0", $_POST['name']) > 0) {
    die("Der eingegebene Name ist schon vergeben.");
}
if (!isset($_POST['public']) || !validateDate($_POST['public']) || !isset($_POST['editable']) || !validateDate($_POST['editable'])) {
    die("Bitte geben Sie ein gültiges Datum ein.");
}
dbConn::execute("INSERT INTO :prefix:plan (name, public, editable) VALUES (:0, :1, :2);", htmlspecialchars($_POST['name']), $_POST['public'], $_POST['editable']);
$tpl = new template("admin/nav.plan");
$tpl->insert("active", "");
$tpl->insert("name", htmlspecialchars($_POST['name']));
echo "SUCCESS" . $tpl->getOutput();
开发者ID:fhoner,项目名称:Schichtplaner,代码行数:22,代码来源:ajax.createPlan.php

示例7: print_orders

function print_orders($sourceid)
{
    /*
    name:
    print_orders($sourceid)
    returns:
    0 - no error
    1 - no orders to be printed
    2 - template parsing error
    3 - error setting orders printed
    other - mysql error number
    */
    $sourceid = $_SESSION['sourceid'];
    debug_msg(__FILE__, __LINE__, "BEGIN PRINTING");
    $query = "SELECT * FROM `orders` WHERE `sourceid`='{$sourceid}' AND `printed` IS NULL AND `suspend`='0' ORDER BY dest_id ASC, priority ASC, associated_id ASC, id ASC";
    $res = common_query($query, __FILE__, __LINE__);
    if (!$res) {
        return mysql_errno();
    }
    if (!mysql_num_rows($res)) {
        return ERR_ORDER_NOT_FOUND;
    }
    $newassociated_id = "";
    $tablenum = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'sources', "name", $sourceid);
    $tpl_print = new template();
    $output['orders'] = '';
    $msg = "";
    while ($arr = mysql_fetch_array($res)) {
        $oldassociated_id = $newassociated_id;
        $newassociated_id = $arr['associated_id'];
        if (isset($priority)) {
            $oldpriority = $priority;
        } else {
            $oldpriority = 0;
        }
        $priority = $arr['priority'];
        if ($oldassociated_id != "") {
            $olddestid = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dishes', "destid", get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'orders', 'dishid', $oldassociated_id));
            $olddest = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "dest", $olddestid);
            $olddestname = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "name", $olddestid);
        } else {
            $olddestid = 0;
        }
        $destid = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dishes', "destid", get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'orders', 'dishid', $newassociated_id));
        $dest = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "dest", $destid);
        $destname = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "name", $destid);
        $dest_language = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "language", $destid);
        if ($destid != $olddestid || $priority != $oldpriority) {
            if ($destid != $olddestid && $olddestid != "") {
                $tpl_print->assign("date", printer_print_date());
                $tpl_print->assign("gonow", printer_print_gonow($oldpriority, $dest_language));
                $tpl_print->assign("page_cut", printer_print_cut());
                // strips the last newline that has been put
                $output['orders'] = substr($output['orders'], 0, strlen($output['orders']) - 1);
                if (table_is_takeaway($sourceid)) {
                    $print_tpl_file = 'ticket_takeaway';
                } else {
                    $print_tpl_file = 'ticket';
                }
                if ($err = $tpl_print->set_print_template_file($olddestid, $print_tpl_file)) {
                    return $err;
                }
                if ($err = $tpl_print->parse()) {
                    $msg = "Error in " . __FUNCTION__ . " - ";
                    $msg .= 'error: ' . $err . "\n";
                    echo nl2br($msg) . "\n";
                    error_msg(__FILE__, __LINE__, $msg);
                    return ERR_PARSING_TEMPLATE;
                }
                $tpl_print->restore_curly();
                $msg = $tpl_print->getOutput();
                $tpl_print->reset_vars();
                $output['orders'] = '';
                $msg = str_replace("'", "", $msg);
                if ($outerr = print_line($olddestid, $msg)) {
                    return $outerr;
                }
            } elseif ($priority != $oldpriority && $oldpriority != "") {
                $tpl_print->assign("date", printer_print_date());
                $tpl_print->assign("gonow", printer_print_gonow($oldpriority, $dest_language));
                $tpl_print->assign("page_cut", printer_print_cut());
                // strips the last newline that has been put
                $output['orders'] = substr($output['orders'], 0, strlen($output['orders']) - 1);
                if (table_is_takeaway($sourceid)) {
                    $print_tpl_file = 'ticket_takeaway';
                } else {
                    $print_tpl_file = 'ticket';
                }
                if ($err = $tpl_print->set_print_template_file($destid, $print_tpl_file)) {
                    return $err;
                }
                if ($err = $tpl_print->parse()) {
                    $msg = "Error in " . __FUNCTION__ . " - ";
                    $msg .= 'error: ' . $err . "\n";
                    error_msg(__FILE__, __LINE__, $msg);
                    echo nl2br($msg) . "\n";
                    return ERR_PARSING_TEMPLATE;
                }
                $tpl_print->restore_curly();
                $msg = $tpl_print->getOutput();
//.........这里部分代码省略.........
开发者ID:jaimeivan,项目名称:smart-restaurant,代码行数:101,代码来源:printing_waiter.php

示例8: template

                    $has = true;
                }
                $prodShift = new template("production_shift");
                $prodShift->insert("shiftId", $shiftId);
                $prodShift->insert("disabled", $has ? "" : "shift-disabled");
                $prodShift->insert("unique", seoUrl("{$plan}-{$prod}-" . substr(str_replace(":00-", " - ", $sh), 0, 13)));
                if ($has) {
                    // fill required number of workers, name
                    $prodShift->insert("required", $required);
                    $prodShift->insert("name", $prod);
                    // get workers of one shift in one production
                    foreach (dbConn::query("SELECT * FROM :prefix:worker WHERE production = :0 AND shift = :1", $prod, $shiftId) as $r) {
                        $worker = new template("worker");
                        $worker->insert("name", $r['name']);
                        $worker->insert("email", $r['email']);
                        $prodShift->insert("workers", $worker->getOutput());
                    }
                }
                $t->insert("shift_productions", $prodShift->getOutput());
            }
            $planTpl->insert("shifts", $t->getOutput());
        }
        $tabContent->insert("desktop", $planTpl->getOutput());
    }
    $tpl->insert("plansContent", $tabContent->getOutput());
}
// insert page request duration
$diff = microtime() - $start;
$diff = round($diff * 1000);
$tpl->insert("creationTime", $diff > 0 ? $diff : "unknown");
$tpl->removeVariables();
开发者ID:fhoner,项目名称:Schichtplaner,代码行数:31,代码来源:index.php

示例9: bill_print


//.........这里部分代码省略.........
            if (in_array($clientip, $ippart)) {
                $destid = $row['id'];
                break;
            }
            $dest_language = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "language", $destid);
        } else {
            return ERR_PRINTER_NOT_FOUND_FOR_SELECTED_TYPE;
        }
    }
    if ($err = $tpl_print->set_print_template_file($destid, $template_type)) {
        return $err;
    }
    // reset the counter and the message to be sent to the printer
    $total = 0;
    $msg = "";
    $tablenum = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'sources', "name", $_SESSION['sourceid']);
    $output['table'] = ucfirst(lang_get($dest_language, 'PRINTS_TABLE')) . " {$tablenum} \n";
    $tpl_print->assign("table", $output['table']);
    // writes the table num to video
    $output_page .= ucfirst(phr('TABLE_NUMBER')) . ": {$tablenum}     ";
    $table = new table($_SESSION['sourceid']);
    $table->fetch_data(true);
    if ($cust_id = $table->data['customer']) {
        $cust = new customer($cust_id);
        $output['customer'] = ucfirst(lang_get($dest_language, 'CUSTOMER')) . ": " . $cust->data['surname'] . ' ' . $cust->data['name'];
        $tpl_print->assign("customer_name", $output['customer']);
        $output['customer'] = $cust->data['address'];
        $tpl_print->assign("customer_address", $output['customer']);
        $output['customer'] = $cust->data['zip'];
        $tpl_print->assign("customer_zip_code", $output['customer']);
        $output['customer'] = $cust->data['city'];
        $tpl_print->assign("customer_city", $output['customer']);
        $output['customer'] = ucfirst(lang_get($dest_language, 'VAT_ACCOUNT')) . ": " . $cust->data['vat_account'];
        $tpl_print->assign("customer_vat_account", $output['customer']);
    }
    if (bill_check_empty()) {
        return ERR_NO_ORDER_SELECTED;
    }
    //mizuko : swap qty with name
    $output_page .= "<table bgcolor=\"" . COLOR_TABLE_GENERAL . "\">\r\n\t<thead>\r\n\t<tr>\r\n\t<th scope=col>" . ucfirst(phr('NAME')) . "</th>\r\n\t<th scope=col>" . ucfirst(phr('QUANTITY_ABBR')) . "</th>\r\n\t<th scope=col>" . ucfirst(phr('PRICE')) . "</th>\r\n\t</tr>\r\n\t</thead>\r\n\t<tbody>";
    $class = COLOR_ORDER_PRINTED;
    ksort($_SESSION['separated']);
    // the next for prints the list and the chosen dishes
    for (reset($_SESSION['separated']); list($key, $value) = each($_SESSION['separated']);) {
        $output['orders'] .= bill_print_row($key, $value, $destid);
    }
    $tpl_print->assign("orders", $output['orders']);
    if ($_SESSION['discount']['type'] == "amount" || $_SESSION['discount']['type'] == "percent") {
        $output['discount'] = bill_print_discount($receipt_id, $destid);
        $tpl_print->assign("discount", $output['discount']);
    }
    $total = bill_calc_vat();
    $total_discounted = bill_calc_discount($total);
    // updates the receipt value, has to be before print totals!
    receipt_update_amounts($_SESSION['account'], $total_discounted, $receipt_id);
    $output['total'] = bill_print_total($receipt_id, $destid);
    $tpl_print->assign("total", $output['total']);
    if (SHOW_CHANGE == 1) {
        $output['change'] = bill_print_change($total_discounted['total']);
        $tpl_print->assign("change", $output['change']);
    }
    //mizuko
    $user = new user($_SESSION['userid']);
    $output['waiter'] = ucfirst(lang_get($dest_language, 'PRINTS_WAITER')) . ": " . $user->data['name'];
    $tpl_print->assign("waiter", $output['waiter']);
    $tpl_print->assign("date", printer_print_date());
    //end mizuko
    $output_page .= "\r\n\t</tbody>\r\n\t</table>";
    $output['receipt_id'] = bill_print_receipt_id($receipt_id, $destid);
    $tpl_print->assign("receipt_id", $output['receipt_id']);
    $output['taxes'] = bill_print_taxes($receipt_id, $destid);
    $tpl_print->assign("taxes", $output['taxes']);
    if ($err = $tpl_print->parse()) {
        $msg = "Error in " . __FUNCTION__ . " - ";
        $msg .= 'error: ' . $err . "\n";
        error_msg(__FILE__, __LINE__, $msg);
        echo nl2br($msg) . "\n";
        return ERR_PARSING_TEMPLATE;
    }
    $tpl_print->restore_curly();
    $msg = $tpl_print->getOutput();
    $msg = str_replace("'", "", $msg);
    if ($printing_enabled) {
        if ($err = print_line($arr['id'], $msg)) {
            // the process is stopped so we delete the created receipt
            receipt_delete($_SESSION['account'], $receipt_id);
            return $err;
        }
    }
    ksort($_SESSION['separated']);
    // sets the log
    for (reset($_SESSION['separated']); list($key, $value) = each($_SESSION['separated']);) {
        if ($err_logger = bill_logger($key, $receipt_id)) {
            debug_msg(__FILE__, __LINE__, __FUNCTION__ . ' - receipt_id: ' . $receipt_id . ' - logger return code: ' . $err_logger);
        } else {
            debug_msg(__FILE__, __LINE__, __FUNCTION__ . ' - receipt_id: ' . $receipt_id . ' - logged');
        }
    }
    return 0;
}
开发者ID:jaimeivan,项目名称:smart-restaurant,代码行数:101,代码来源:bills_waiter.php

示例10: getHistory

        $tpl->removeVariables();
        echo $tpl->getOutput();
        break;
    case "history":
        echo getHistory(0);
        break;
    case "newplan":
        $tpl = new template("admin/plan.create");
        echo $tpl->getOutput();
        break;
    case "email":
        $tpl = new template("admin/mail.container");
        foreach (dbConn::query("SELECT * FROM :prefix:plan ORDER BY created DESC") as $r) {
            $tpl->insert("plans", template::create("admin/mail.plan", array("name" => $r['name'])));
        }
        foreach (dbConn::query("SELECT DISTINCT name, email FROM :prefix:worker ORDER BY name ASC") as $r) {
            $rec = new template("admin/mail.recipient");
            $rec->insert("name", $r['name']);
            $rec->insert("address", $r['email']);
            foreach (dbConn::query("SELECT DISTINCT name FROM :prefix:plan", $r['name'], $r['email']) as $s) {
                $rec->insert("plans", template::create("admin/mail.recipient.plan", array("name" => $s['name'], "checked" => dbConn::querySingle("SELECT COUNT(*) FROM :prefix:worker \n                                                      WHERE name = :0 AND email = :1 AND plan = :2", $r['name'], $r['email'], $s['name']) > 0 ? "checked" : "")));
            }
            $tpl->insert("recipients", $rec);
        }
        $tpl->removeVariables();
        echo $tpl->getOutput();
        break;
    default:
        echo "\n        <div class='alert alert-danger' role='alert'>\n          <span class='sr-only'>Fehler:</span>\n          Funktion nicht implementiert\n        </div>";
        break;
}
开发者ID:fhoner,项目名称:Schichtplaner,代码行数:31,代码来源:ajax.getContent.php

示例11: createMessage

 /**
  * Creates a new message box based on the default message template.
  *
  * @param   string $type      Name of the message template name.
  * @param   string $message   Body text of the message.
  * @return  string Html code of the message box.
  * @since   Version 1.0
  */
 public static function createMessage($type, $message)
 {
     $tpl = new template("core/msg.{$type}");
     $tpl->insert("message", $message);
     return $tpl->getOutput();
 }
开发者ID:fhoner,项目名称:smartdoorbell,代码行数:14,代码来源:backend.php

示例12: getSidebar

 /**
  * Generates the sidebar as html of this page.
  *
  * @return string Sidebar as html that matches the current page.
  * @since Version 1.5
  */
 public function getSidebar()
 {
     $parent = \dbConn::querySingle("SELECT caption FROM :prefix:content WHERE caption = :0", $_GET['par1']);
     $parentUrl = \dbConn::querySingle("SELECT url FROM :prefix:content WHERE caption = :0", $parent);
     $children = array();
     $sitemap = new \template("sitemap/sitemap");
     // title
     if ($this->parentId == null) {
         $sitemap->insert("title", \dbConn::querySingle("SELECT caption FROM :prefix:content WHERE url = :0", end($_GET)));
     } else {
         $sitemap->insert("title", \dbConn::querySingle("SELECT caption FROM :prefix:content WHERE contentId = :0", $this->parentId));
     }
     // children
     $hasChildren = false;
     if (\dbConn::querySingle("SELECT contentId FROM :prefix:content WHERE caption = :0", $parent)) {
         foreach (\dbConn::query("SELECT url, caption FROM :prefix:content WHERE parentId = :0", \dbConn::querySingle("SELECT contentId FROM :prefix:content WHERE caption = :0", $parent)) as $r) {
             $child = new \template("sitemap/sitemap.child");
             $child->insert("caption", $r['caption']);
             $child->insert("destination", ROOT . $parentUrl . "/" . $r['url'] . "/");
             if (isset($_GET['par2'])) {
                 $child->insert("active", $_GET['par2'] == $r['url'] ? "active" : "");
             }
             $sitemap->insert("children", $child->getOutput());
             $hasChildren = true;
         }
     }
     return $hasChildren ? $sitemap->getOutput() : "";
 }
开发者ID:fhoner,项目名称:smartdoorbell,代码行数:34,代码来源:content.php

示例13: substr

                 $change->insert("action", "Unbekannt");
                 break;
         }
         $change->insert("shift", "<small>{$r['plan']}, {$r['production']}</small><br />" . substr($r['fromDate'], 0, 5) . " - " . substr($r['toDate'], 0, 5));
         if ($r['nameBefore'] == $r['nameAfter']) {
             $change->insert("user", $r['nameAfter']);
         } else {
             $change->insert("user", "<small><span style=\"text-decoration:line-through;\">{$r['nameBefore']}</span></small>\n                <br /><strong>{$r['nameAfter']}</strong>");
         }
         if ($r['emailBefore'] == $r['emailAfter']) {
             $change->insert("email", $r['emailAfter']);
         } else {
             $change->insert("email", "<small><span style=\"text-decoration:line-through;\">{$r['emailBefore']}</span></small>\n                <br /><strong>{$r['emailAfter']}</strong>");
         }
         $change->insert("hidden", "hidden");
         $email->insert("content", $change->getOutput());
         dbConn::execute("DELETE FROM :prefix:email_pending WHERE historyId = :0", $r['historyId']);
     }
 }
 if ($emailRequired) {
     $emailError = "";
     $arr = array();
     foreach (dbConn::query("SELECT email FROM :prefix:email_subscriber \n                                        WHERE plan = :0", $_POST['plan']) as $r) {
         $arr[] = $r['email'];
     }
     if (count($arr) > 0 && trim($arr[0]) != "") {
         emailSettings::send($arr, "Änderungen am Schichtplan " . $_POST['plan'], $email->getOutput(), $emailError);
         if ($emailError != "") {
             throw new Exception($emailError);
         }
     }
开发者ID:fhoner,项目名称:Schichtplaner,代码行数:31,代码来源:ajax.updateProductionShift.php

示例14: create

 /**
  * Creates a new template and directly fills in the given values.
  *
  * <code>
  * template::create("index", array(
  *      "var1" => "hello world"
  * ));
  * </code>
  *
  * @param string    $template   Name of the template.
  * @param array     $content    Content for the variables.
  * @static
  * @since Version 1.7
  */
 public static function create($template, $content)
 {
     $tpl = new template($template);
     foreach ($content as $key => $value) {
         $tpl->insert($key, $value);
     }
     return $tpl->getOutput();
 }
开发者ID:fhoner,项目名称:Schichtplaner,代码行数:22,代码来源:template.php

示例15: getOutput

 public function getOutput()
 {
     switch ($this->viewpoint) {
         case "overview":
             $tpl = new \template("visitors/container");
             foreach (\dbConn::query("SELECT * FROM :prefix:user ORDER BY lastname ASC") as $r) {
                 $v = new \template("visitors/visitor");
                 $v->insert("firstname", $r['firstname']);
                 $v->insert("id", $r['userId']);
                 $v->insert("lastname", $r['lastname']);
                 $v->insert("rfid", $r['rfid']);
                 $v->insert("patients", \dbConn::querySingle("SELECT COUNT(*) FROM :prefix:visit WHERE user = :0", $r['userId']));
                 $v->insert("lastvisit", \dbConn::querySingle("\n                                                                    SELECT DATE_FORMAT(MAX(h.created), '%d.%m.%y %H:%i')\n                                                                    FROM :prefix:visit AS v\n                                                                    INNER JOIN :prefix:visit_history AS h\n                                                                    ON v.visitId = h.visitId\n                                                                    WHERE v.user = :0\n                                                                ", $r['userId']));
                 $v->insert("destination", ROOT . "visitors/" . $r['userId']);
                 $tpl->insert("visitors", $v);
             }
             return $tpl->getOutput();
             break;
             // ######################################################################################################
         // ######################################################################################################
         case "new":
             $tpl = new \template("visitors/new");
             return $tpl;
             break;
             // ######################################################################################################
         // ######################################################################################################
         case "edit":
             $hasPatients = false;
             $visit = null;
             $tpl = new \template("visitors/edit.container");
             // user data
             $user = \dbConn::queryRow("SELECT userid, firstname, lastname, rfid, email, state \n                                            FROM :prefix:user WHERE userId = :0", $_GET['par2']);
             $tpl->insert("firstname", $user['firstname']);
             $tpl->insert("lastname", $user['lastname']);
             $tpl->insert("userid", $user['userid']);
             $tpl->insert("rfid", $user['rfid']);
             $tpl->insert("email", $user['email']);
             foreach (\dbConn::query("SELECT * FROM :prefix:user_state") as $r) {
                 $tpl->insert("states", $r['name'] == $user['state'] ? "<option value=\"{$r['name']}\" selected>{$r['display']}</option>" : "<option value=\"{$r['name']}\">{$r['display']}</option>");
             }
             // insert patients
             foreach (\dbConn::query("\n                                            SELECT firstname, lastname, patientId\n                                            FROM :prefix:visit AS v\n                                            INNER JOIN :prefix:patient AS p\n                                            ON v.patient = p.patientId\n                                            WHERE user = :0\n                                            ORDER BY firstname", $_GET['par2']) as $r) {
                 $tpl->insert("patients", "<option value=\"{$r['patientId']}\">{$r['firstname']} {$r['lastname']}</option>");
                 if (!$hasPatients) {
                     $visit = \dbConn::queryRow("SELECT * FROM :prefix:visit WHERE user = :0 AND patient = :1", $_GET['par2'], $r['patientId']);
                 }
                 $hasPatients = true;
             }
             $visitTpl = new \template("visitors/edit.visit");
             // relation
             foreach (\dbConn::query("SELECT * FROM :prefix:relation ORDER BY name ASC") as $r) {
                 $visitTpl->insert("relations", "<option value=\"{$r['name']}\"" . ($r['name'] == $visit['relation'] ? " selected" : "") . ">{$r['name']}</option>");
             }
             // description
             $visitTpl->insert("description", $visit['description']);
             // scent
             foreach (\dbConn::query("SELECT * FROM :prefix:scent ORDER BY name ASC") as $r) {
                 $visitTpl->insert("scents", "<option value=\"{$r['name']}\"" . ($r['name'] == $visit['scent'] ? " selected" : "") . ">{$r['name']}</option>");
             }
             // images
             $imgCount = 0;
             foreach (\dbConn::query("SELECT * FROM :prefix:visit_media WHERE visitId = :0 AND type = :1", $visit['visitId'], 'Image') as $img) {
                 $visitTpl->insert("image" . ($imgCount + 1), ROOT . "media/image/" . $img['path']);
                 $imgCount++;
             }
             for ($i = $imgCount + 1; $i <= 3; $i++) {
                 $visitTpl->insert("image" . $i, ROOT . "images/icons/image.png");
             }
             // audios
             $audioCount = 0;
             foreach (\dbConn::query("SELECT * FROM :prefix:visit_media WHERE visitId = :0 AND type = :1", $visit['visitId'], 'Audio') as $audio) {
                 $visitTpl->insert("audio" . ($audioCount + 1), ROOT . "images/icons/audio.png");
                 $audioCount++;
             }
             for ($i = $audioCount + 1; $i <= 3; $i++) {
                 $visitTpl->insert("audio" . $i, ROOT . "images/icons/plus.png");
             }
             $tpl->insert("visit", $visitTpl->getOutput());
             return $tpl->getOutput();
             break;
     }
 }
开发者ID:fhoner,项目名称:smartdoorbell,代码行数:82,代码来源:visitors.php


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