本文整理汇总了PHP中DataSource::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP DataSource::getInstance方法的具体用法?PHP DataSource::getInstance怎么用?PHP DataSource::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataSource
的用法示例。
在下文中一共展示了DataSource::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
private function handle($col)
{
$globalDAO = new GlobalDAO(DataSource::getInstance());
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$content = trim(remove_slashes($_POST['content']));
if ($globalDAO->update($col, $content)) {
$message = array('type' => 'info', 'value' => 'Lưu thành công.');
} else {
$message = array('type' => 'error', 'value' => 'Có lỗi xảy ra!');
}
$this->registry->template->message = $message;
$this->registry->template->content = $content;
$tmp = $globalDAO->select($col);
$this->registry->template->content_backup = $tmp;
} else {
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
$tmp = $globalDAO->select($col);
$this->registry->template->content = $tmp;
$this->registry->template->content_backup = $tmp;
}
}
if ($col == 'about') {
$s = '“Giới thiệu”';
} else {
if ($col == 'contact') {
$s = '“Liên hệ”';
}
}
$this->registry->template->tile_title = 'Soạn thảo trang ' . $s;
$this->registry->template->tile_content = 'admin/compose.php';
$this->registry->template->show('admin/layout/admin.php');
}
示例2: index
public function index()
{
if (empty($_GET['seo_url'])) {
$this->notFound();
return;
}
$promoDAO = new PromoDAO(DataSource::getInstance());
$promo = $promoDAO->findBySeoUrl($_GET['seo_url']);
if (!$promo) {
$this->notFound();
return;
}
$categoryDAO = new CatDAO(DataSource::getInstance());
$categories_list = $categoryDAO->findByAll_Navigation();
$cart = getCart();
$this->registry->template->categories_list = $categories_list;
$this->registry->template->cart = $cart;
$this->registry->template->promo_seo_url_newest = $promoDAO->findNewestSeoUrl();
$this->registry->template->is_promo_active = TRUE;
$this->registry->template->promo = $promo;
$this->registry->template->related_promos = $promoDAO->findNewestList();
$this->registry->template->tile_title = $promo['subject'];
$this->registry->template->tile_content = 'promo.php';
$this->registry->template->tile_footer = 'footer.php';
$this->registry->template->show('layout/user.php');
}
示例3: index
public function index()
{
$globalDAO = new GlobalDAO(DataSource::getInstance());
$this->registry->template->count_stats = $globalDAO->getStats();
$this->registry->template->tile_title = 'Trang quản trị';
$this->registry->template->tile_content = 'admin/dashboard.php';
$this->registry->template->show('admin/layout/admin.php');
}
示例4: cleanup
public function cleanup()
{
$productDAO = new ProductDAO(DataSource::getInstance());
$file_names = $productDAO->findAllPics();
$c = clean_upload_images($file_names);
$this->registry->template->deleted_files = $c;
$this->registry->template->tile_title = 'Dọn dẹp thư mục upload';
$this->registry->template->tile_content = 'admin/upload-cleanup.php';
$this->registry->template->show('admin/layout/admin.php');
}
示例5: delete
public function delete()
{
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
echo '0';
return;
}
$id = (int) $_POST['id'];
$catDAO = new CatDAO(DataSource::getInstance());
$catDAO->delete($id);
echo '1';
}
示例6: init
/**
* load predefined SQL commands into DataSource class
*
* @param int $id_game
* @return void
*/
public static function init($id_game = null)
{
if (self::$DataSource === null) {
self::$DataSource = DataSource::getInstance();
self::LoadUserQueries();
self::LoadGameQueries();
}
// clear all prepared statements (reset PDO object) if a new game_id is given
if ($id_game !== null && $id_game !== self::$id_game && is_int($id_game)) {
DataSource::getInstance()->reset_game_specific_queries();
self::$id_game = $id_game;
self::LoadGameSpecificQueries(self::$id_game);
}
}
示例7: showError777
public function showError777()
{
$categoryDAO = new CatDAO(DataSource::getInstance());
$categories_list = $categoryDAO->findByAll_Navigation();
$promoDAO = new PromoDAO(DataSource::getInstance());
$this->registry->template->promo_seo_url_newest = $promoDAO->findNewestSeoUrl();
$cart = getCart();
$this->registry->template->categories_list = $categories_list;
$this->registry->template->cart = $cart;
$this->registry->template->tile_title = 'Không có quyền truy cập';
$this->registry->template->tile_content = 'error777.php';
$this->registry->template->tile_footer = 'footer.php';
$this->registry->template->show('layout/user.php');
}
示例8: delete
public function delete()
{
if (!isset($_POST['id'])) {
echo '2';
return;
}
$id = (int) $_POST['id'];
if ($id <= 0) {
echo '2';
return;
}
$stockDAO = new StockDAO(DataSource::getInstance());
$ret = $stockDAO->delete($id);
echo (string) $ret;
}
示例9: index
public function index()
{
$categoryDAO = new CatDAO(DataSource::getInstance());
$categories_list = $categoryDAO->findByAll_Navigation();
$promoDAO = new PromoDAO(DataSource::getInstance());
$this->registry->template->promo_seo_url_newest = $promoDAO->findNewestSeoUrl();
$this->registry->template->promo_subject_newest = $promoDAO->findNewestSubject();
$cart = getCart();
$this->registry->template->categories_list = $categories_list;
$this->registry->template->cart = $cart;
$this->registry->template->tile_title = __SITE_SLOGAN;
$this->registry->template->body_class = 'index-template';
$this->registry->template->body_id = 'index-page';
$this->registry->template->tile_content = 'index.php';
$this->registry->template->show('layout/user.php');
}
示例10: index
public function index()
{
$categoryDAO = new CatDAO(DataSource::getInstance());
$globalDAO = new GlobalDAO(DataSource::getInstance());
$categories_list = $categoryDAO->findByAll_Navigation();
$content = $globalDAO->select('help');
$cart = getCart();
$this->registry->template->categories_list = $categories_list;
$this->registry->template->content = $content;
$this->registry->template->cart = $cart;
$this->registry->template->is_help_active = TRUE;
$this->registry->template->tile_title = 'Trợ Giúp';
$this->registry->template->tile_content = 'help.php';
$this->registry->template->tile_footer = 'footer.php';
$this->registry->template->show('layout/user.php');
}
示例11: index
public function index()
{
$categoryDAO = new CatDAO(DataSource::getInstance());
$globalDAO = new GlobalDAO(DataSource::getInstance());
$categories_list = $categoryDAO->findByAll_Navigation();
$content = $globalDAO->select('contact');
$promoDAO = new PromoDAO(DataSource::getInstance());
$this->registry->template->promo_seo_url_newest = $promoDAO->findNewestSeoUrl();
$cart = getCart();
$this->registry->template->categories_list = $categories_list;
$this->registry->template->content = $content;
$this->registry->template->cart = $cart;
$this->registry->template->is_contact_active = TRUE;
$this->registry->template->facebook_description = 'Ms. Phương Thanh - 0987918796 - pttran87@gmail.com | Ms. Thùy Linh - 0983871412 - ptlinh1412@yahoo.com.vn';
$this->registry->template->tile_title = 'Liên Hệ';
$this->registry->template->tile_content = 'contact.php';
$this->registry->template->tile_footer = 'footer.php';
$this->registry->template->show('layout/user.php');
}
示例12: index
public function index()
{
$categoryDAO = new CatDAO(DataSource::getInstance());
$globalDAO = new GlobalDAO(DataSource::getInstance());
$categories_list = $categoryDAO->findByAll_Navigation();
$content = $globalDAO->select('about');
$promoDAO = new PromoDAO(DataSource::getInstance());
$this->registry->template->promo_seo_url_newest = $promoDAO->findNewestSeoUrl();
$cart = getCart();
$this->registry->template->categories_list = $categories_list;
$this->registry->template->content = $content;
$this->registry->template->cart = $cart;
$this->registry->template->is_about_active = TRUE;
$this->registry->template->tile_title = 'Giới Thiệu';
$this->registry->template->body_class = 'page-template';
$this->registry->template->tile_content = 'about.php';
$this->registry->template->tile_footer = 'footer.php';
$this->registry->template->show('layout/user.php');
}
示例13: index
public function index()
{
if (empty($_GET['seo_url'])) {
$this->notFound();
return;
}
$productDAO = new ProductDAO(DataSource::getInstance());
$product = $productDAO->findBySeoUrl($_GET['seo_url']);
if (!$product) {
$this->notFound();
return;
}
$categoryDAO = new CatDAO(DataSource::getInstance());
$brandDAO = new BrandDAO(DataSource::getInstance());
$cat_id = $product['category_id'];
$brand_id = $product['brand_id'];
$categories_list = $categoryDAO->findByAll_Navigation();
$brands_list = $brandDAO->findByAll();
$products_list_in_cat = $productDAO->findByCatId($cat_id);
$products_list_in_brand = $productDAO->findByBrandId($brand_id);
$promoDAO = new PromoDAO(DataSource::getInstance());
$this->registry->template->promo_seo_url_newest = $promoDAO->findNewestSeoUrl();
$this->registry->template->cart = getCart();
$this->registry->template->categories_list = $categories_list;
$this->registry->template->brands_list = $brands_list;
$this->registry->template->current_cat_id = $cat_id;
$this->registry->template->current_brand_id = $brand_id;
$this->registry->template->products_list_in_cat = $products_list_in_cat;
$this->registry->template->products_list_in_brand = $products_list_in_brand;
$this->registry->template->product = $product;
$this->registry->template->product_pics = explode_pics($product['pics']);
$this->registry->template->tile_title = $categories_list[$cat_id]['name'] . ' / ' . $brands_list[$brand_id] . ' / ' . $product['code'];
$this->registry->template->facebook_description = $product['description'];
$this->registry->template->facebook_image = __SITE_CONTEXT . __UPLOAD_DIR . get_pic_at($product['pics'], 1);
$this->registry->template->body_class = 'product-template';
$this->registry->template->tile_content = 'product.php';
$this->registry->template->tile_footer = 'footer.php';
$this->registry->template->show('layout/user.php');
}
示例14: index
public function index()
{
echo 'zzzzzzzzzzz 1';
if ($this->findGroupId() > 0) {
header('Location: ' . __SITE_CONTEXT . 'admin/dashboard/');
return;
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$username = remove_slashes($_POST['username']);
$password = remove_slashes($_POST['password']);
$memberDAO = new MemberDAO(DataSource::getInstance());
$group_id = $memberDAO->checkLogin($username, $password);
if ($group_id == 0) {
// login failed
$message = 'Sai username hoặc password!';
$this->registry->template->message = $message;
$this->registry->template->username = $username;
} else {
$_SESSION['member'] = array('group_id' => $group_id);
header('Location: ' . __SITE_CONTEXT . 'admin/dashboard/');
return;
}
}
$categoryDAO = new CatDAO(DataSource::getInstance());
$categories_list = $categoryDAO->findByAll_Navigation();
$promoDAO = new PromoDAO(DataSource::getInstance());
$this->registry->template->promo_seo_url_newest = $promoDAO->findNewestSeoUrl();
$cart = getCart();
$this->registry->template->categories_list = $categories_list;
$this->registry->template->cart = $cart;
$this->registry->template->tile_title = 'Login';
$this->registry->template->body_class = 'page-template';
$this->registry->template->tile_content = 'login.php';
$this->registry->template->tile_footer = 'footer.php';
$this->registry->template->show('layout/user.php');
}
示例15: delete
public function delete()
{
$customerDAO = new CustomerDAO(DataSource::getInstance());
$customerDAO->delete((int) $_POST['del_cust_id']);
echo '1';
}