本文整理汇总了PHP中item::get_id方法的典型用法代码示例。如果您正苦于以下问题:PHP item::get_id方法的具体用法?PHP item::get_id怎么用?PHP item::get_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类item
的用法示例。
在下文中一共展示了item::get_id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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> </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);
}
}
示例3: count
$index = new Zend_Search_Lucene(ATTACHMENTS_DIR . 'search/item');
$query = Zend_Search_Lucene_Search_QueryParser::parse($needle);
$hits = $index->find($needle);
$TPL["index_count"] = $index->count();
$TPL["hits_count"] = count($hits);
$p =& get_cached_table("person");
foreach ($hits as $hit) {
$d = $hit->getDocument();
$item = new item();
$item->set_id($d->getFieldValue('id'));
$item->select();
$row = array();
$row["idx"] = $hit->id;
$author = $item->get_value("itemAuthor");
$author and $author = " by " . $author;
$row["title"] = $item->get_id() . " " . $item->get_link() . $author;
$row["score"] = sprintf('%d%%', $hit->score * 100);
$row["desc"] = page::htmlentities($d->getFieldValue('desc'));
// get availability of loan
$db2 = new db_alloc();
$query = prepare("SELECT * FROM loan WHERE itemID = %d AND dateReturned='0000-00-00'", $item->get_id());
$db2->query($query);
if ($db2->next_record()) {
$loan = new loan();
$loan->read_db_record($db2);
if ($loan->have_perm(PERM_READ_WRITE)) {
// if item is overdue
if ($loan->get_value("dateToBeReturned") < $today) {
$status = "Overdue";
} else {
$status = "Due on " . $loan->get_value("dateToBeReturned");
示例4: meta
}
//so that the user can edit the item later
$TPL["personID"] = $current_user->get_id();
// item types
$itemType = new meta("itemType");
$TPL["itemTypes"] = page::select_options($itemType->get_assoc_array("itemTypeID", "itemTypeID"), $item->get_value("itemType"));
// setup item list (for removals)
$item_list = array();
$db = new db_alloc();
$db->query("SELECT * FROM item ORDER BY itemName");
while ($db->next_record()) {
$item = new item();
$item->read_db_record($db);
$item_list[$item->get_id()] = $item->get_value('itemName');
}
$TPL["item_list"] = page::select_options($item_list, "");
if ($_POST["edit_items"]) {
$item = new item();
$item->set_id($_POST["itemID"][0]);
$item->select();
if (count($_POST["itemID"]) < 1) {
alloc_error("You Must Select An Item");
} else {
if (count($_POST["itemID"]) > 1) {
alloc_error("Can Only Edit 1 Item At A Time");
}
$TPL["edit_options"] = "<table><tr>\n" . " <td>Name: </td>\n" . " <td colspan=\"2\"><input size=\"40\" type=\"text\" name=\"update_itemName\" value=\"" . $item->get_value("itemName") . "\"></td>\n" . "</tr><tr>\n" . " <td>Notes: </td>\n" . " <td colspan=\"2\"><input size=\"40\" type=\"text\" name=\"update_itemNotes\" value=\"" . $item->get_value("itemNotes") . "\"></td>\n" . "</tr><tr>\n" . " <td>Type: </td>\n" . " <td><select name=\"update_itemType\" value=\"" . $item->get_value("itemType") . "\">" . page::select_options($itemType->get_assoc_array("itemTypeID", "itemTypeID"), $item->get_value("itemType")) . " </select>" . " <input type=\"hidden\" name=\"update_itemID\" value=\"" . $item->get_id() . "\"></td>" . " <td align=\"right\">" . ' <button type="submit" name="update_item" value="1" class="save_button">Save Changes<i class="icon-ok-sign"></i></button>' . " </td>\n" . "</tr><td colspan=\"3\"><hr></td></tr>\n" . "</tr></table>\n";
}
}
$TPL["main_alloc_title"] = "Edit Items - " . APPLICATION_NAME;
include_template("templates/addItemM.tpl");