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


PHP DatabaseObject::tablename方法代码示例

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


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

示例1: form

	function form ($form) {
		$db =& DB::get();

		$purchasetable = DatabaseObject::tablename(Purchase::$table);
		$next = $db->query("SELECT auto_increment as id FROM information_schema.tables WHERE table_schema=database() AND table_name='$purchasetable' LIMIT 1");

		$Order = $this->Order;
		$Order->_2COcart_order_id = date('mdy').'-'.date('His').'-'.$next->id;

		// Build the transaction
		$_ = array();

		// Required
		$_['sid']				= $this->settings['sid'];
		$_['total']				= number_format($Order->Cart->Totals->total,$this->precision);
		$_['cart_order_id']		= $Order->_2COcart_order_id;
		$_['vendor_order_id']	= $this->session;
		$_['id_type']			= 1;

		// Extras
		if ($this->settings['testmode'] == "on")
			$_['demo']			= "Y";

		$_['fixed'] 			= "Y";
		$_['skip_landing'] 		= "1";

		$_['x_Receipt_Link_URL'] = $this->settings['returnurl'];

		// Line Items
		foreach($this->Order->Cart->contents as $i => $Item) {
			// $description[] = $Item->quantity."x ".$Item->name.((!empty($Item->optionlabel))?' '.$Item->optionlabel:'');
			$id = $i+1;
			$_['c_prod_'.$id]			= 'ecart_pid-'.$Item->product.','.$Item->quantity;
			$_['c_name_'.$id]			= $Item->name;
			$_['c_description_'.$id]	= !empty($Item->option->label)?$Item->$Item->option->label:'';
			$_['c_price_'.$id]			= number_format($Item->unitprice,$this->precision);

		}

		$_['card_holder_name'] 		= $Order->Customer->firstname.' '.$Order->Customer->lastname;
		$_['street_address'] 		= $Order->Billing->address;
		$_['street_address2'] 		= $Order->Billing->xaddress;
		$_['city'] 					= $Order->Billing->city;
		$_['state'] 				= $Order->Billing->state;
		$_['zip'] 					= $Order->Billing->postcode;
		$_['country'] 				= $Order->Billing->country;
		$_['email'] 				= $Order->Customer->email;
		$_['phone'] 				= $Order->Customer->phone;

		$_['ship_name'] 			= $Order->Customer->firstname.' '.$Order->Customer->lastname;
		$_['ship_street_address'] 	= $Order->Shipping->address;
		$_['ship_street_address2'] 	= $Order->Shipping->xaddress;
		$_['ship_city'] 			= $Order->Shipping->city;
		$_['ship_state'] 			= $Order->Shipping->state;
		$_['ship_zip'] 				= $Order->Shipping->postcode;
		$_['ship_country'] 			= $Order->Shipping->country;

		return $form.$this->format($_);
	}
开发者ID:robbiespire,项目名称:paQui,代码行数:59,代码来源:2Checkout.php

示例2: __construct

	/**
	 * Shopping constructor
	 *	 
	 * @todo Change table to 'shopping' and update schema
	 *
	 * @return void
	 **/
	function __construct () {
		// Set the database table to use
		$this->_table = DatabaseObject::tablename('shopping');

		// Initialize the session handlers
		parent::__construct();

		// Queue the session to start
		add_action('init',array(&$this,'init'));
	}
开发者ID:robbiespire,项目名称:paQui,代码行数:17,代码来源:Shopping.php

示例3: attach_download

 function attach_download($id)
 {
     if (!$id) {
         return false;
     }
     $db = DB::get();
     $table = DatabaseObject::tablename(Asset::$table);
     $db->query("DELETE FROM {$table} WHERE parent='{$this->id}' AND context='price' AND datatype='download'");
     $db->query("UPDATE {$table} SET parent='{$this->id}',context='price',datatype='download' WHERE id='{$id}'");
     do_action('attach_product_download', $id, $this->id);
     return true;
 }
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:12,代码来源:Price.php

示例4: categories_meta_box

function categories_meta_box ($Product) {
	$db =& DB::get();
	$category_table = DatabaseObject::tablename(Category::$table);
	$categories = $db->query("SELECT id,name,parent FROM $category_table ORDER BY parent,name",AS_ARRAY);
	$categories = sort_tree($categories);
	if (empty($categories)) $categories = array();

	$categories_menu = '<option value="0">'.__('Parent Category','Ecart').'&hellip;</option>';
	foreach ($categories as $category) {
		$padding = str_repeat("&nbsp;",$category->depth*3);
		$categories_menu .= '<option value="'.$category->id.'">'.$padding.esc_html($category->name).'</option>';
	}

	$selectedCategories = array();
	foreach ($Product->categories as $category) $selectedCategories[] = $category->id;
?>
<div id="category-menu" class="multiple-select short">
	<ul>
		<?php $depth = 0; foreach ($categories as $category):
		if ($category->depth > $depth) echo "<li><ul>"; ?>
		<?php if ($category->depth < $depth): ?>
			<?php for ($i = $category->depth; $i < $depth; $i++): ?>
				</ul></li>
			<?php endfor; ?>
		<?php endif; ?>
		<li id="category-element-<?php echo $category->id; ?>"><input type="checkbox" name="categories[]" value="<?php echo $category->id; ?>" id="category-<?php echo $category->id; ?>" tabindex="3"<?php if (in_array($category->id,$selectedCategories)) echo ' checked="checked"'; ?> class="category-toggle" /><label for="category-<?php echo $category->id; ?>"><?php echo esc_html($category->name); ?></label></li>
		<?php $depth = $category->depth; endforeach; ?>
		<?php for ($i = 0; $i < $depth; $i++): ?>
			</ul></li>
		<?php endfor; ?>
	</ul>
</div>
<div>
<div id="new-category" class="hidden">
<input type="text" name="new-category" value="" size="15" id="new-category-name" /><br />
<select name="new-category-parent"><?php echo $categories_menu; ?></select>
<button id="add-new-category" type="button" class="button-secondary" tabindex="2"><small><?php _e('Add','Ecart'); ?></small></button>
</div>
<button id="new-category-button" type="button" class="button-secondary" style="margin-top:10px;" tabindex="2"><?php _e('Add New Category','Ecart'); ?></button>
</div>

<?php
}
开发者ID:robbiespire,项目名称:paQui,代码行数:43,代码来源:ui.php

示例5: editor

	/**
	 * Interface processor for the customer editor
	 *
	 * Handles rendering the interface, processing updated customer details
	 * and handing saving them back to the database
	 * 
	 * @return void
	 **/
	function editor () {
		global $Ecart,$Customer;
		$db =& DB::get();

		if ( !(is_ecart_userlevel() || current_user_can('ecart_customers')) )
			wp_die(__('You do not have sufficient permissions to access this page.'));


		if ($_GET['id'] != "new") {
			$Customer = new Customer($_GET['id']);
			$Customer->Billing = new Billing($Customer->id,'customer');
			$Customer->Shipping = new Shipping($Customer->id,'customer');
			if (empty($Customer->id))
				wp_die(__('The requested customer record does not exist.','Ecart'));
		} else $Customer = new Customer();

		if (empty($Customer->info->meta)) remove_meta_box('customer-info','ecart_page_ecart-customers','normal');

		$purchase_table = DatabaseObject::tablename(Purchase::$table);
		$r = $db->query("SELECT count(id) AS purchases,SUM(total) AS total FROM $purchase_table WHERE customer='$Customer->id' LIMIT 1");

		$Customer->orders = $r->purchases;
		$Customer->total = $r->total;


		$countries = array(''=>'&nbsp;');
		$countrydata = Lookup::countries();
		foreach ($countrydata as $iso => $c) {
			if (isset($_POST['settings']) && $_POST['settings']['base_operations']['country'] == $iso)
				$base_region = $c['region'];
			$countries[$iso] = $c['name'];
		}
		$Customer->countries = $countries;

		$regions = Lookup::country_zones();
		$Customer->billing_states = array_merge(array(''=>'&nbsp;'),(array)$regions[$Customer->Billing->country]);
		$Customer->shipping_states = array_merge(array(''=>'&nbsp;'),(array)$regions[$Customer->Shipping->country]);

		include(ECART_ADMIN_PATH."/customers/editor.php");
	}
开发者ID:robbiespire,项目名称:paQui,代码行数:48,代码来源:Account.php

示例6: delete

 function delete()
 {
     $db = DB::get();
     // Delete record
     $id = $this->{$this->_key};
     // Delete related discounts
     $discount_table = DatabaseObject::tablename(Discount::$table);
     if (!empty($id)) {
         $db->query("DELETE LOW_PRIORITY FROM {$discount_table} WHERE promo='{$id}'");
     }
     if (!empty($id)) {
         $db->query("DELETE FROM {$this->_table} WHERE {$this->_key}='{$id}'");
     } else {
         return false;
     }
 }
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:16,代码来源:Promotion.php

示例7: unstock

 function unstock()
 {
     if (!$this->inventory) {
         return;
     }
     global $Shopp;
     $db = DB::get();
     // Update stock in the database
     $table = DatabaseObject::tablename(Price::$table);
     $db->query("UPDATE {$table} SET stock=stock-{$this->quantity} WHERE id='{$this->price}' AND stock > 0");
     // Update stock in the model
     $this->option->stock -= $this->quantity;
     // Handle notifications
     $product = $this->name . ' (' . $this->option->label . ')';
     if ($this->option->stock == 0) {
         return new ShoppError(sprintf(__('%s is now out-of-stock!', 'Shopp'), $product), 'outofstock_warning', SHOPP_STOCK_ERR);
     }
     if ($this->option->stock <= $Shopp->Settings->get('lowstock_level')) {
         return new ShoppError(sprintf(__('%s has low stock levels and should be re-ordered soon.', 'Shopp'), $product), 'lowstock_warning', SHOPP_STOCK_ERR);
     }
 }
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:21,代码来源:Item.php

示例8: images_meta_box

function images_meta_box($Category)
{
    $db =& DB::get();
    $Images = array();
    if (!empty($Category->id)) {
        $asset_table = DatabaseObject::tablename(Asset::$table);
        $Images = $db->query("SELECT id,src,properties FROM {$asset_table} WHERE context='category' AND parent={$Category->id} AND datatype='thumbnail' ORDER BY sortorder", AS_ARRAY);
    }
    ?>
	<ul id="lightbox">
		<?php 
    foreach ($Images as $i => $thumbnail) {
        $thumbnail->properties = unserialize($thumbnail->properties);
        ?>
			<li id="image-<?php 
        echo $thumbnail->src;
        ?>
"><input type="hidden" name="images[]" value="<?php 
        echo $thumbnail->src;
        ?>
" />
				<div id="image-<?php 
        echo $thumbnail->src;
        ?>
-details">
				<img src="?shopp_image=<?php 
        echo $thumbnail->id;
        ?>
" width="96" height="96" />
					<div class="details">
						<input type="hidden" name="imagedetails[<?php 
        echo $i;
        ?>
][id]" value="<?php 
        echo $thumbnail->id;
        ?>
" />
						<p><label>Title: </label><input type="text" name="imagedetails[<?php 
        echo $i;
        ?>
][title]" value="<?php 
        echo $thumbnail->properties['title'];
        ?>
" /></p>
						<p><label>Alt: </label><input type="text" name="imagedetails[<?php 
        echo $i;
        ?>
][alt]" value="<?php 
        echo $thumbnail->properties['alt'];
        ?>
" /></p>
						<p class="submit"><input type="button" name="close" value="Close" class="button close" /></p>
					</div>
				</div>
				<button type="button" name="deleteImage" value="<?php 
        echo $thumbnail->src;
        ?>
" title="Delete category image&hellip;" class="deleteButton"><img src="<?php 
        echo SHOPP_PLUGINURI;
        ?>
/core/ui/icons/delete.png" alt="-" width="16" height="16" /></button></li>
		<?php 
    }
    ?>
	</ul>
	<div class="clear"></div>
	<input type="hidden" name="category" value="<?php 
    echo $_GET['id'];
    ?>
" id="image-category-id" />
	<input type="hidden" name="deleteImages" id="deleteImages" value="" />
	<div id="swf-uploader-button"></div>
	<div id="swf-uploader">
	<button type="button" class="button-secondary" name="add-image" id="add-image" tabindex="10"><small><?php 
    _e('Add New Image', 'Shopp');
    ?>
</small></button></div>
	<div id="browser-uploader">
		<button type="button" name="image_upload" id="image-upload" class="button-secondary"><small><?php 
    _e('Add New Image', 'Shopp');
    ?>
</small></button><br class="clear"/>
	</div>
	<p><?php 
    _e('The first image will be the default image. These thumbnails are out of proportion, but will be correctly sized for shoppers.', 'Shopp');
    ?>
</p>
<?php 
}
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:89,代码来源:ui.php

示例9: delete

 /**
  * Deletes the record associated with this object */
 function delete()
 {
     $db = DB::get();
     $id = $this->{$this->_key};
     if (empty($id)) {
         return false;
     }
     // Delete from categories
     $table = DatabaseObject::tablename(Catalog::$table);
     $db->query("DELETE LOW_PRIORITY FROM {$table} WHERE product='{$id}'");
     // Delete prices
     $table = DatabaseObject::tablename(Price::$table);
     $db->query("DELETE LOW_PRIORITY FROM {$table} WHERE product='{$id}'");
     // Delete specs
     $table = DatabaseObject::tablename(Spec::$table);
     $db->query("DELETE LOW_PRIORITY FROM {$table} WHERE product='{$id}'");
     // Delete images/files
     $table = DatabaseObject::tablename(Asset::$table);
     // Delete images
     $images = array();
     $src = $db->query("SELECT id FROM {$table} WHERE parent='{$id}' AND context='product' AND datatype='image'", AS_ARRAY);
     foreach ($src as $img) {
         $images[] = $img->id;
     }
     $this->delete_images($images);
     // Delete product downloads (but keep the file if on file system)
     $db->query("DELETE LOW_PRIORITY FROM {$table} WHERE parent='{$id}' AND context='product'");
     // Delete record
     $db->query("DELETE FROM {$this->_table} WHERE {$this->_key}='{$id}'");
 }
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:32,代码来源:Product.php

示例10: lookups


//.........这里部分代码省略.........
             }
             echo "</body></html>";
             exit;
             break;
         case "zones":
             $zones = $this->Settings->get('zones');
             if (isset($_GET['country'])) {
                 echo json_encode($zones[$_GET['country']]);
             }
             exit;
             break;
         case "shipcost":
             @session_start();
             $this->ShipCalcs = new ShipCalcs($this->path);
             if (isset($_GET['method'])) {
                 $this->Cart->data->Order->Shipping->method = $_GET['method'];
                 $this->Cart->retotal = true;
                 $this->Cart->updated();
                 $this->Cart->totals();
                 echo json_encode($this->Cart->data->Totals);
             }
             exit;
             break;
         case "category-menu":
             echo $this->Flow->category_menu();
             exit;
             break;
         case "category-products-menu":
             echo $this->Flow->category_products();
             exit;
             break;
         case "spectemplate":
             $db = DB::get();
             $table = DatabaseObject::tablename(Category::$table);
             $result = $db->query("SELECT specs FROM {$table} WHERE id='{$_GET['cat']}' AND spectemplate='on'");
             echo json_encode(unserialize($result->specs));
             exit;
             break;
         case "optionstemplate":
             $db = DB::get();
             $table = DatabaseObject::tablename(Category::$table);
             $result = $db->query("SELECT options,prices FROM {$table} WHERE id='{$_GET['cat']}' AND variations='on'");
             if (empty($result)) {
                 exit;
             }
             $result->options = unserialize($result->options);
             $result->prices = unserialize($result->prices);
             foreach ($result->options as &$menu) {
                 foreach ($menu['options'] as &$option) {
                     $option['id'] += $_GET['cat'];
                 }
             }
             foreach ($result->prices as &$price) {
                 $optionids = explode(",", $price['options']);
                 foreach ($optionids as &$id) {
                     $id += $_GET['cat'];
                 }
                 $price['options'] = join(",", $optionids);
                 $price['optionkey'] = "";
             }
             echo json_encode($result);
             exit;
             break;
         case "newproducts-rss":
             $NewProducts = new NewProducts(array('show' => 5000));
             header("Content-type: application/rss+xml; charset=utf-8");
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:67,代码来源:Shopp.php

示例11: smart

	function smart ($options=array()) {
		$this->slug = self::$_slug;

		global $Ecart;
		$Cart = $Ecart->Order->Cart;
		$tagtable = DatabaseObject::tablename(Tag::$table);
		$catalogtable = DatabaseObject::tablename(Catalog::$table);

		// Use the current product if available
		if (!empty($Ecart->Product->id))
			$this->product = $Ecart->Product;

		// Or load a product specified
		if (isset($options['product'])) {
			if ($options['product'] == "recent-cartitem") 			// Use most recently added item in the cart
				$this->product = new Product($Cart->Added->product);
			elseif (preg_match('/^[\d+]$/',$options['product']) !== false) 	// Load by specified id
				$this->product = new Product($options['product']);
			else
				$this->product = new Product($options['product'],'slug'); // Load by specified slug
		}

		if (empty($this->product->id)) return false;

		// Load the product's tags if they are not available
		if (empty($this->product->tags))
			$this->product->load_data(array('tags'));

		if (empty($this->product->tags)) return false;

		$tagscope = "";
		if (isset($options['tagged'])) {
			$tagged = new Tag($options['tagged'],'name');

			if (!empty($tagged->id)) {
				$tagscope .= (empty($tagscope)?"":" OR ")."catalog.parent=$tagged->id";
			}

		}

		foreach ($this->product->tags as $tag)
			if (!empty($tag->id))
				$tagscope .= (empty($tagscope)?"":" OR ")."catalog.parent=$tag->id";

		if (!empty($tagscope)) $tagscope = "($tagscope) AND catalog.type='tag'";

		$this->tag = "product-".$this->product->id;
		$this->name = __("Products related to","Ecart")." &quot;".stripslashes($this->product->name)."&quot;";
		$this->uri = urlencode($this->tag);
		$this->controls = false;

		$exclude = "";
		if (!empty($this->product->id)) $exclude = " AND p.id != {$this->product->id}";

		$this->loading = array(
			'columns'=>'count(DISTINCT catalog.id)+SUM(IF('.$tagscope.',100,0)) AS score',
			'joins'=>"LEFT JOIN $catalogtable AS catalog ON catalog.product=p.id LEFT JOIN $tagtable AS t ON t.id=catalog.parent AND catalog.product=p.id",
			'where'=>"($tagscope) $exclude",
			'orderby'=>'score DESC'
			);
		if (isset($options['order'])) $this->loading['order'] = $options['order'];
		if (isset($options['controls']) && value_is_true($options['controls']))
			unset($this->controls);
	}
开发者ID:robbiespire,项目名称:paQui,代码行数:64,代码来源:Category.php

示例12: query

	function query ($request=array()) {
		$db =& DB::get();
		if (empty($request)) $request = $_GET;

		if (!empty($request['start'])) {
			list($month,$day,$year) = explode("/",$request['start']);
			$starts = mktime(0,0,0,$month,$day,$year);
		}

		if (!empty($request['end'])) {
			list($month,$day,$year) = explode("/",$request['end']);
			$ends = mktime(0,0,0,$month,$day,$year);
		}

		$where = "WHERE o.id IS NOT NULL AND p.id IS NOT NULL ";
		if (isset($request['status']) && !empty($request['status'])) $where .= "AND status='{$request['status']}'";
		if (isset($request['s']) && !empty($request['s'])) $where .= " AND (id='{$request['s']}' OR firstname LIKE '%{$request['s']}%' OR lastname LIKE '%{$request['s']}%' OR CONCAT(firstname,' ',lastname) LIKE '%{$request['s']}%' OR transactionid LIKE '%{$request['s']}%')";
		if (!empty($request['start']) && !empty($request['end'])) $where .= " AND  (UNIX_TIMESTAMP(o.created) >= $starts AND UNIX_TIMESTAMP(o.created) <= $ends)";

		$purchasetable = DatabaseObject::tablename(Purchase::$table);
		$purchasedtable = DatabaseObject::tablename(Purchased::$table);
		$offset = ($this->set*$this->limit);

		$c = 0; $columns = array();
		foreach ($this->selected as $column) $columns[] = "$column AS col".$c++;
		$query = "SELECT ".join(",",$columns)." FROM $purchasedtable AS p LEFT JOIN $purchasetable AS o ON o.id=p.purchase $where ORDER BY o.created ASC LIMIT $offset,$this->limit";
		$this->data = $db->query($query,AS_ARRAY);
	}
开发者ID:robbiespire,项目名称:paQui,代码行数:28,代码来源:Purchase.php

示例13: upgrade_110

	/**
	 * Ecart 1.1.0 upgrades
	 * 
	 * @since 1.1
	 *
	 * @return void
	 **/
	function upgrade_110 () {
		$db =& DB::get();
		$meta_table = DatabaseObject::tablename('meta');
		$db->query("DELETE FROM $meta_table"); // Clear out previous meta

		// Update product status from the 'published' column
		$product_table = DatabaseObject::tablename('product');
		$db->query("UPDATE $product_table SET status=CAST(published AS unsigned)");

		// Set product publish date based on the 'created' date column
		$db->query("UPDATE $product_table SET publish=created WHERE status='publish'");

		// Update Catalog
		$catalog_table = DatabaseObject::tablename('catalog');
		$db->query("UPDATE $catalog_table set parent=IF(category!=0,category,tag),type=IF(category!=0,'category','tag')");

		// Update specs
		$meta_table = DatabaseObject::tablename('meta');
		$spec_table = DatabaseObject::tablename('spec');
		$db->query("INSERT INTO $meta_table (parent,context,type,name,value,numeral,sortorder,created,modified)
					SELECT product,'product','spec',name,content,numeral,sortorder,now(),now() FROM $spec_table");

		// Update purchase table
		$purchase_table = DatabaseObject::tablename('purchase');
		$db->query("UPDATE $purchase_table SET txnid=transactionid,txnstatus=transtatus");

		// Update image assets
		$meta_table = DatabaseObject::tablename('meta');
		$asset_table = DatabaseObject::tablename('asset');
		$db->query("INSERT INTO $meta_table (parent,context,type,name,value,numeral,sortorder,created,modified)
							SELECT parent,context,'image','processing',CONCAT_WS('::',id,name,value,size,properties,LENGTH(data)),'0',sortorder,created,modified FROM $asset_table WHERE datatype='image'");
		$records = $db->query("SELECT id,value FROM $meta_table WHERE type='image' AND name='processing'",AS_ARRAY);
		foreach ($records as $r) {
			list($src,$name,$value,$size,$properties,$datasize) = explode("::",$r->value);
			$p = unserialize($properties);
			$value = new StdClass();
			if (isset($p['width'])) $value->width = $p['width'];
			if (isset($p['height'])) $value->height = $p['height'];
			if (isset($p['alt'])) $value->alt = $p['alt'];
			if (isset($p['title'])) $value->title = $p['title'];
			$value->filename = $name;
			if (isset($p['mimetype'])) $value->mime = $p['mimetype'];
			$value->size = $size;
			error_log(serialize($value));
			if ($datasize > 0) {
				$value->storage = "DBStorage";
				$value->uri = $src;
			} else {
				$value->storage = "FSStorage";
				$value->uri = $name;
			}
			$value = mysql_real_escape_string(serialize($value));
			$db->query("UPDATE $meta_table set name='original',value='$value' WHERE id=$r->id");
		}

		// Update product downloads
		$meta_table = DatabaseObject::tablename('meta');
		$asset_table = DatabaseObject::tablename('asset');
		$query = "INSERT INTO $meta_table (parent,context,type,name,value,numeral,sortorder,created,modified)
					SELECT parent,context,'download','processing',CONCAT_WS('::',id,name,value,size,properties,LENGTH(data)),'0',sortorder,created,modified FROM $asset_table WHERE datatype='download' AND parent != 0";
		$db->query($query);
		$records = $db->query("SELECT id,value FROM $meta_table WHERE type='download' AND name='processing'",AS_ARRAY);
		foreach ($records as $r) {
			list($src,$name,$value,$size,$properties,$datasize) = explode("::",$r->value);
			$p = unserialize($properties);
			$value = new StdClass();
			$value->filename = $name;
			$value->mime = $p['mimetype'];
			$value->size = $size;
			if ($datasize > 0) {
				$value->storage = "DBStorage";
				$value->uri = $src;
			} else {
				$value->storage = "FSStorage";
				$value->uri = $name;
			}
			$value = mysql_real_escape_string(serialize($value));
			$db->query("UPDATE $meta_table set name='$name',value='$value' WHERE id=$r->id");
		}

		// Update promotions
		$promo_table = DatabaseObject::tablename('promo');
		$records = $db->query("UPDATE $promo_table SET target='Cart' WHERE scope='Order'",AS_ARRAY);

		$FSStorage = array('path' => array());
		// Migrate Asset storage settings
		$image_storage = $this->Settings->get('image_storage_pref');
		if ($image_storage == "fs") {
			$image_storage = "FSStorage";
			$FSStorage['path']['image'] = $this->Settings->get('image_path');
		} else $image_storage = "DBStorage";
		$this->Settings->save('image_storage',$image_storage);

//.........这里部分代码省略.........
开发者ID:robbiespire,项目名称:paQui,代码行数:101,代码来源:Install.php

示例14: query

	function query ($request=array()) {
		$db =& DB::get();
		if (empty($request)) $request = $_GET;

		if (!empty($request['start'])) {
			list($month,$day,$year) = explode("/",$request['start']);
			$starts = mktime(0,0,0,$month,$day,$year);
		}

		if (!empty($request['end'])) {
			list($month,$day,$year) = explode("/",$request['end']);
			$ends = mktime(0,0,0,$month,$day,$year);
		}

		$where = "WHERE c.id IS NOT NULL ";
		if (isset($request['s']) && !empty($request['s'])) $where .= " AND (id='{$request['s']}' OR firstname LIKE '%{$request['s']}%' OR lastname LIKE '%{$request['s']}%' OR CONCAT(firstname,' ',lastname) LIKE '%{$request['s']}%' OR transactionid LIKE '%{$request['s']}%')";
		if (!empty($request['start']) && !empty($request['end'])) $where .= " AND  (UNIX_TIMESTAMP(c.created) >= $starts AND UNIX_TIMESTAMP(c.created) <= $ends)";

		$customer_table = DatabaseObject::tablename(Customer::$table);
		$billing_table = DatabaseObject::tablename(Billing::$table);
		$shipping_table = DatabaseObject::tablename(Shipping::$table);
		$offset = $this->set*$this->limit;

		$c = 0; $columns = array();
		foreach ($this->selected as $column) $columns[] = "$column AS col".$c++;
		$query = "SELECT ".join(",",$columns)." FROM $customer_table AS c LEFT JOIN $billing_table AS b ON c.id=b.customer LEFT JOIN $shipping_table AS s ON c.id=s.customer $where ORDER BY c.created ASC LIMIT $offset,$this->limit";
		$this->data = $db->query($query,AS_ARRAY);
	}
开发者ID:robbiespire,项目名称:paQui,代码行数:28,代码来源:Customer.php

示例15: orders_widget

	/**
	 * Renders the recent orders dashboard widget
	 * 
	 * @since 1.0
	 *
	 * @return void
	 **/
	function orders_widget ($args=null) {
		global $Ecart;
		$db = DB::get();
		$defaults = array(
			'before_widget' => '',
			'before_title' => '',
			'widget_name' => '',
			'after_title' => '',
			'after_widget' => ''
		);
		if (!$args) $args = array();
		$args = array_merge($defaults,$args);
		if (!empty($args)) extract( $args, EXTR_SKIP );
		$statusLabels = $this->Settings->get('order_status');

		echo $before_widget;

		echo $before_title;
		echo $widget_name;
		echo $after_title;

		$purchasetable = DatabaseObject::tablename(Purchase::$table);
		$purchasedtable = DatabaseObject::tablename(Purchased::$table);

		$Orders = $db->query("SELECT p.*,count(i.id) as items FROM $purchasetable AS p LEFT JOIN $purchasedtable AS i ON i.purchase=p.id GROUP BY i.purchase ORDER BY created DESC LIMIT 6",AS_ARRAY);

		if (!empty($Orders)) {
		echo '<table class="widefat">';
		echo '<tr><th scope="col">'.__('Name','Ecart').'</th><th scope="col">'.__('Date','Ecart').'</th><th scope="col" class="num">'.__('Items','Ecart').'</th><th scope="col" class="num">'.__('Total','Ecart').'</th><th scope="col" class="num">'.__('Status','Ecart').'</th></tr>';
		echo '<tbody id="orders" class="list orders">';
		$even = false;
		foreach ($Orders as $Order) {
			echo '<tr'.((!$even)?' class="alternate"':'').'>';
			$even = !$even;
			echo '<td><a class="row-title" href="'.add_query_arg(array('page'=>$this->pagename('orders'),'id'=>$Order->id),admin_url('admin.php')).'" title="View &quot;Order '.$Order->id.'&quot;">'.((empty($Order->firstname) && empty($Order->lastname))?'(no contact name)':$Order->firstname.' '.$Order->lastname).'</a></td>';
			echo '<td>'.date("Y/m/d",mktimestamp($Order->created)).'</td>';
			echo '<td class="num">'.$Order->items.'</td>';
			echo '<td class="num">'.money($Order->total).'</td>';
			echo '<td class="num">'.$statusLabels[$Order->status].'</td>';
			echo '</tr>';
		}
		echo '</tbody></table>';
		} else {
			echo '<p>'.__('No orders, yet.','Ecart').'</p>';
		}

		echo $after_widget;

	}
开发者ID:robbiespire,项目名称:paQui,代码行数:56,代码来源:Admin.php


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