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


PHP item::read_db_record方法代码示例

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


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

示例1: show_overdue

function show_overdue($template_name)
{
    global $db;
    global $TPL;
    $current_user =& singleton("current_user");
    $db = new db_alloc();
    $temp = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
    $today = date("Y", $temp) . "-" . date("m", $temp) . "-" . date("d", $temp);
    $q = prepare("SELECT itemName,itemType,item.itemID,dateBorrowed,dateToBeReturned,loan.personID \n                  FROM loan,item \n                 WHERE dateToBeReturned < '%s' \n\t\t\t\t\t         AND dateReturned = '0000-00-00' \n\t\t\t\t\t         AND item.itemID = loan.itemID\n               ", $today);
    if (!have_entity_perm("loan", PERM_READ, $current_user, false)) {
        $q .= prepare("AND loan.personID = %d", $current_user->get_id());
    }
    $db->query($q);
    while ($db->next_record()) {
        $i++;
        $item = new item();
        $loan = new loan();
        $item->read_db_record($db);
        $loan->read_db_record($db);
        $item->set_values();
        $loan->set_values();
        $person = new person();
        $person->set_id($loan->get_value("personID"));
        $person->select();
        $TPL["person"] = $person->get_name();
        $TPL["overdue"] = "<a href=\"" . $TPL["url_alloc_item"] . "itemID=" . $item->get_id() . "&return=true\">Overdue!</a>";
        include_template($template_name);
    }
}
开发者ID:cjbayliss,项目名称:alloc,代码行数:29,代码来源:itemLoan.php

示例2: show_items

function show_items($template_name)
{
    global $TPL;
    global $db;
    global $db2;
    $current_user =& singleton("current_user");
    $today = date("Y") . "-" . date("m") . "-" . date("d");
    $dbUsername = new db_alloc();
    $db = new db_alloc();
    $db2 = new db_alloc();
    $db->query("select * from item order by itemName");
    while ($db->next_record()) {
        $i++;
        $item = new item();
        $item->read_db_record($db);
        $db2->query("select * from loan where itemID=" . $item->get_id() . " and dateReturned='0000-00-00'");
        $db2->next_record();
        $loan = new loan();
        $loan->read_db_record($db2);
        $item->set_values();
        // you need to have this repeated here for the a href bit below.
        if ($loan->get_value("dateReturned") == "0000-00-00") {
            if ($loan->have_perm(PERM_READ_WRITE)) {
                // if item is overdue
                if ($loan->get_value("dateToBeReturned") < $today) {
                    $ret = "Return Now!";
                } else {
                    $ret = "Return";
                }
                $TPL["itemAction"] = "<td><a href=\"" . $TPL["url_alloc_item"] . "itemID=" . $TPL["itemID"] . "&return=true\">{$ret}</a></td>";
            } else {
                // if you don't have permission to borrow or return item.
                $TPL["itemAction"] = "<td>&nbsp;</td>";
            }
            $TPL["status"] = "Due " . $loan->get_value("dateToBeReturned");
            $dbUsername->query("select username from person where personID=" . $loan->get_value("personID"));
            $dbUsername->next_record();
            $TPL["person"] = "from " . $dbUsername->f("username");
        } else {
            // if the item is available
            $TPL["status"] = "Available";
            $TPL["person"] = "";
            $TPL["itemAction"] = "<td><a href=\"" . $TPL["url_alloc_item"] . "itemID=" . $TPL["itemID"] . "&borrow=true\">Borrow</a></td>";
            $TPL["dueBack"] = "";
        }
        $loan->set_values();
        $item->set_values();
        include_template($template_name);
    }
}
开发者ID:cjbayliss,项目名称:alloc,代码行数:50,代码来源:loanAndReturn.php

示例3: prepare

<?php

// Create a search index for Items. This patch may take a long time to apply.
ini_set('max_execution_time', 180000);
ini_set('memory_limit', "256M");
$index = Zend_Search_Lucene::create(ATTACHMENTS_DIR . 'search/item');
$db = new db_alloc();
$q = prepare("SELECT * FROM item");
$db->query($q);
while ($db->row()) {
    $item = new item();
    $item->read_db_record($db);
    $item->update_search_index_doc($index);
}
$index->commit();
开发者ID:cjbayliss,项目名称:alloc,代码行数:15,代码来源:patch-00159-alla.php


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