本文整理汇总了PHP中Item::Delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::Delete方法的具体用法?PHP Item::Delete怎么用?PHP Item::Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Item
的用法示例。
在下文中一共展示了Item::Delete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Delete
public function Delete()
{
if (!$this->Exist()) {
return false;
}
if ($this->initParent()) {
$this->parent_obj->OnDeleteComment();
}
return parent::Delete();
}
示例2: Delete
public function Delete()
{
global $bd_names;
if (!$this->Exist()) {
return false;
}
$skin_way = $this->base_dir . $this->fname;
$preview_way = $this->base_dir . 'preview/' . $this->fname;
$result = BD("SELECT `hash` FROM `{$this->db}` WHERE `id`='" . $this->id . "'");
if (mysql_num_rows($result)) {
$line = mysql_fetch_array($result);
BD("INSERT INTO {$this->db_bad_skins} (hash) VALUES ('" . $line['hash'] . "')");
}
if (file_exists($skin_way)) {
unlink($skin_way);
}
if (file_exists($preview_way)) {
unlink($preview_way);
}
BD("DELETE FROM `{$this->db_likes}` WHERE `item_id`='" . $this->id . "' AND `item_type`='" . ItemType::Skin . "'");
BD("LOCK TABLES `{$this->db_ratio}` WRITE;");
BD("UPDATE `{$this->db_ratio}` SET `num` = num - 1 WHERE `ratio`='" . $this->ratio . "'");
BD("UNLOCK TABLES;");
return parent::Delete();
}
示例3: Delete
public function Delete()
{
global $user, $bd_names;
if (empty($user) or !$user->getPermission('add_news') or !$this->Exist()) {
return false;
}
$result = getDB()->ask("SELECT `id` FROM `{$bd_names['comments']}` " . "WHERE `item_id`='" . $this->id . "' AND `item_type` = '" . $this->type() . "'");
loadTool('comment.class.php');
while ($line = $result->fetch('num')) {
$comments_item = new Comments_Item($line[0], false);
$comments_item->Delete();
unset($comments_item);
}
getDB()->ask("DELETE FROM `{$bd_names['likes']}` " . "WHERE `item_id` = '" . $this->id . "' AND `item_type` = '" . $this->type() . "'");
return parent::Delete();
}
示例4: testFindAllItems
public function testFindAllItems()
{
$items_before = Item::GetAll();
$item = Item::CreateAsset('Test Item Name Additional', 120, 10, '', 120);
$items_after = Item::GetAll();
$this->assertTrue(count($items_after) == count($items_before) + 1);
foreach ($items_after as $itm) {
$this->assertInstanceOf('Item', $itm);
}
Item::Delete($item->id);
$post_after = Item::GetAll();
$this->assertTrue(count($post_after) == count($items_before));
}
示例5: PageContent
// id required
if ($id == "") {
header("Location:mainpage.php");
exit;
}
// if form was submitted
if ($_POST['commit'] == "Cancel") {
$objItem = new Item($id);
$category = new Category($objItem->CategoryId);
header("Location:item_list.php?cat=" . $category->Id);
exit;
}
if ($_POST['commit'] == "Delete Item") {
$objItem = new Item($id);
$category = new Category($objItem->CategoryId);
$objItem->Delete($id);
header("Location:item_list.php?cat=" . $category->Id);
exit;
}
$objItem = new Item($id);
$category = new Category($objItem->CategoryId);
include "includes/pagetemplate.php";
function PageContent()
{
global $objItem;
global $category;
global $id;
?>
<div class="layout laymidwidth">
示例6: deleteItem
public function deleteItem($id)
{
if (Item::Delete($id)) {
echo 1;
} else {
echo 0;
}
}