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


PHP item::set_values方法代码示例

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


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

示例1: 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

示例2: 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

示例3: item

 * You should have received a copy of the GNU Affero General Public License
 * along with allocPSA. If not, see <http://www.gnu.org/licenses/>.
*/
require_once "../alloc.php";
$current_user->check_employee();
global $db;
global $today;
$itemID = $_POST["itemID"] or $itemID = $_GET["itemID"];
$loanID = $_POST["loanID"] or $loanID = $_GET["loanID"];
$item = new item();
$loan = new loan();
$db = new db_alloc();
$db->query("select * from item where itemID=%d", $itemID);
$db->next_record();
$item->read_db_record($db);
$item->set_values();
// new crap
if ($current_user->have_role("admin") || $current_user->have_role("manage")) {
    $users = array();
    $_db = new db_alloc();
    $_db->query("SELECT * FROM person ORDER BY username");
    while ($_db->next_record()) {
        $person = new person();
        $person->read_db_record($_db);
        $users[$person->get_id()] = $person->get_value('username');
    }
    $TPL["userSelect"] = "<select name=\"userID\">" . page::select_options($users, $current_user->get_id()) . "</select><br>\n";
} else {
    $TPL["userSelect"] = "";
}
$temp = mktime(0, 0, 0, date("m") + $_POST["timePeriod"], date("d"), date("Y"));
开发者ID:cjbayliss,项目名称:alloc,代码行数:31,代码来源:item.php


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