Exemplo n.º 1
0
 /**
  * Returns the item values as associative list.
  *
  * @return array Associative list of item properties and their values
  */
 public function toArray()
 {
     $list = parent::toArray();
     $list['order.base.product.baseid'] = $this->getBaseId();
     $list['order.base.product.ordprodid'] = $this->getOrderProductId();
     $list['order.base.product.type'] = $this->getType();
     $list['order.base.product.suppliercode'] = $this->getSupplierCode();
     $list['order.base.product.productid'] = $this->getProductId();
     $list['order.base.product.prodcode'] = $this->getProductCode();
     $list['order.base.product.name'] = $this->getName();
     $list['order.base.product.mediaurl'] = $this->getMediaUrl();
     $list['order.base.product.position'] = $this->getPosition();
     $list['order.base.product.price'] = $this->price->getValue();
     $list['order.base.product.costs'] = $this->price->getCosts();
     $list['order.base.product.rebate'] = $this->price->getRebate();
     $list['order.base.product.taxrate'] = $this->price->getTaxRate();
     $list['order.base.product.quantity'] = $this->getQuantity();
     $list['order.base.product.status'] = $this->getStatus();
     $list['order.base.product.flags'] = $this->getFlags();
     return $list;
 }
Exemplo n.º 2
0
 public function toArray($columns = NULL)
 {
     //Include basic category data (id, created_at, updated_at)
     $output = parent::toArray();
     //Include category translations
     $output['category_translations'] = $this->getTranslations()->toArray();
     return $output;
 }
Exemplo n.º 3
0
 /**
  * Returns the array representation of this class 
  *
  * @param  string $name
  * @return array
  */
 public function toArray($name = 'id')
 {
     return parent::toArray($name);
 }
Exemplo n.º 4
0
 /**
  * Returns the item values as array.
  *
  * @return array Associative list of item properties and their values
  */
 public function toArray()
 {
     $list = parent::toArray();
     $list['price.typeid'] = $this->getTypeId();
     $list['price.type'] = $this->getType();
     $list['price.typename'] = $this->getTypeName();
     $list['price.currencyid'] = $this->getCurrencyId();
     $list['price.domain'] = $this->getDomain();
     $list['price.quantity'] = $this->getQuantity();
     $list['price.value'] = $this->getValue();
     $list['price.costs'] = $this->getCosts();
     $list['price.rebate'] = $this->getRebate();
     $list['price.taxvalue'] = $this->getTaxValue();
     $list['price.taxrate'] = $this->getTaxRate();
     $list['price.taxflag'] = $this->getTaxFlag();
     $list['price.status'] = $this->getStatus();
     $list['price.label'] = $this->getLabel();
     return $list;
 }
Exemplo n.º 5
0
 /**
  * Returns the item values as array.
  *
  * @return array Associative list of item properties and their values
  */
 public function toArray()
 {
     $list = parent::toArray();
     $list['customer.label'] = $this->getLabel();
     $list['customer.code'] = $this->getCode();
     $list['customer.birthday'] = $this->getBirthday();
     $list['customer.status'] = $this->getStatus();
     $list['customer.password'] = $this->getPassword();
     $list['customer.dateverified'] = $this->getDateVerified();
     return $list;
 }
Exemplo n.º 6
0
 /**
  * Returns the array representation of this class 
  *
  * @param  string $name
  * @return array
  */
 public function toArray($name = 'cursor')
 {
     return parent::toArray($name);
 }
Exemplo n.º 7
0
 public function toArray($columns = null)
 {
     $output = parent::toArray($columns);
     //Add the columns from 'article' table to the output
     $output['article_translations'] = $this->getTranslations()->toArray();
     //We can pass ['columns'=>[...]] to specify which columns to include
     $output['article_categories'] = $this->getCategories()->filter(function ($category) {
         //Pass each category through a filter and call it's toArray() function
         return $category->toArray();
     });
     $output['article_author'] = $this->getUser(array('columns' => array('user_first_name', 'user_last_name', 'user_email')))->toArray();
     $output['article_hashtags'] = $this->getHashtags()->filter(function ($hashtag) {
         return $hashtag->toArray();
     });
     return $output;
 }
Exemplo n.º 8
0
 /**
  * Returns the array representation of this class 
  *
  * @param  string $name
  * @return array
  */
 public function toArray($name = 'grantee')
 {
     return parent::toArray($name);
 }
Exemplo n.º 9
0
		public function compare($one, $two)
		{
			if( !($one instanceof Item) )
			{
				if( is_integer($one) )
				{
					$one = Item::getByID($one);
				}
				else
				{
					return false;
				}
			}
			
			if( !($two instanceof Item) )
			{
				if( is_integer($two) )
				{
					$two = Item::getByID($two);
				}
				else
				{
					return false;
				}
			}
			
			$ratings[0] = Rating::getByUserForItem($this->user->userid, $one->itemid);
			$ratings[1] = Rating::getByUserForItem($this->user->userid, $two->itemid);
			$views[0] = View::getByUserForItem($this->user->userid, $one->itemid);
			$views[1] = View::getByUserForItem($this->user->userid, $two->itemid);
			
			$willTheyLikeTwoComparedToOne = 0;
			
			//first, try to compare ratings
			if( $ratings[0] || $ratings[1] )
			{
				if( $ratings[0] && $ratings[1] )
				{
					//only use the first rating because if there's more than one that's bullshit.
					$oneRate = Base::toArray($ratings[0]);
					$oneRate = $oneRate[0];
					$twoRate = Base::toArray($ratings[1]);
					$twoRate = $twoRate[0];
					
					if( $oneRate == 0 )
					{
						$oneRate = .0000000000000001;
					}
					if( $twoRate == 0 )
					{
						$twoRate = .0000000000000001;
					}
					
					$oneRate = 1 / $oneRate->rating;
					$twoRate = 1 / $twoRate->rating;
					
					$diff = $oneRate - $twoRate;
				}
				else
				{
					//one item doesn't have ratings
					//don't do anything right now.
				}
				
				$willTheyLikeTwoComparedToOne += $diff * .1;
			}
			else
			{
				//no ratings for either item
			}
			
			//try to compare number of views
			//people are more likely to view something if they want it (even subconsciously)
			//so the comparison of views could offer a rough estimate
			if( $views[0] || $views[1] )
			{
				if( $views[0] && $views[1] )
				{
					//get counts
					$vwOne = count(Base::toArray($views[0]));
					$vwTwo = count(Base::toArray($views[1])); // ah, vwTwo, the most difficult Pokemon to catch.
					
					//close or equal
					if( ( $vwTwo - 1 < $vwOne ) && ( $vwTwo < $vwTwo + 1 ) )
					{
						//bump up the likelihood
						$willTheyLikeTwoComparedToOne += .05;
					}
					elseif( $vwTwo < $vwOne )
					{
						//maybe not
						$willTheyLikeTwoComparedToOne -= .05;
					}
					else
					{
						//very likely
						$willTheyLikeTwoComparedToOne += .1;
					}
				}
				else
				{
					//one of the items hasn't been viewed
					//don't do anything right now.
				}
			}
			else
			{
				//The user has no views for either item
			}
			
			return $willTheyLikeTwoComparedToOne;
		}
Exemplo n.º 10
0
 /**
  * Returns the item values as array.
  *
  * @return array Associative list of item properties and their values.
  */
 public function toArray()
 {
     $list = parent::toArray();
     $price = $this->price;
     $list['order.base.service.baseid'] = $this->getBaseId();
     $list['order.base.service.code'] = $this->getCode();
     $list['order.base.service.serviceid'] = $this->getServiceId();
     $list['order.base.service.name'] = $this->getName();
     $list['order.base.service.mediaurl'] = $this->getMediaUrl();
     $list['order.base.service.type'] = $this->getType();
     $list['order.base.service.price'] = $price->getValue();
     $list['order.base.service.costs'] = $price->getCosts();
     $list['order.base.service.rebate'] = $price->getRebate();
     $list['order.base.service.taxrate'] = $price->getTaxRate();
     return $list;
 }
Exemplo n.º 11
0
 public function toArray($columns = null)
 {
     $output = parent::toArray($columns);
     unset($output['user_password']);
     $output['user_profile'] = $this->profile->toArray();
     return $output;
 }