$item = $game->read("*", $id); if (!empty($item['publish_time'])) { $item['publish_date'] = @date("Y-m-d", $item['publish_time']); } if (!empty($item['force_time'])) { $item['force_date'] = @date("Y-m-d", $item['force_time']); } if (!empty($item['attachment_id'])) { $item['attach'] = $attachment_model->getAttachLink($item['attachment_id']); } setvar("item", $item); } setvar("StandardTypes", $_PB_CACHE['standardtype']); $tpl_file = "game.edit"; template($tpl_file, true); } } if (isset($_GET['pid'])) { $pid = $_GET['pid']; } if (!empty($pid)) { $conditions = "product_id = " . $pid; } else { flash("Hãy chọn sản phẩm cần thêm file game!", "product.php"); } $amount = $game->findCount(null, $conditions); $page->setPagenav($amount); $result = $game->findAll("Game.*,t.name AS typename", array("LEFT JOIN {$tb_prefix}gametypes t ON Game.type_id=t.id"), $conditions, "Game.id DESC", $page->firstcount, $page->displaypg); setvar("Items", $result); setvar("ByPages", $page->pagenav); template($tpl_file);