classes/php5_classes/Listing.class.php

Properties

Description

Holds the geoListing object.

Classes

geoListing

Properties

 
 
System  
No 
No 

Description

A listing object, basically a container object for particular listing.
Since there are many listings, there can be many geoListing objects. If you want to get or set information for a listing, this is the object to use. It uses the magic methods __get and __set which enable getting a field by calling $listing->field or setting a field by using $listing->field = $value. The fields are NOT automatically encoded or decoded using that, you will need to encode or decode the values as necessary depending on the field.

Methods

__get, __set, _isHidden, _loadFormatted, addDataSet, addListingData, bidCount, getAllOrderItems, getAuctionAdditionalFees, getBid, getCategories, getCheckboxes, getCostOptions, getExtraQuestions, getFullUrl, getHighBidder, getImages, getLeveledValues, getListing, getRegionTrees, getTags, getTitle, isExpired, isLocked, remove, setLocked, smartyDisplayField, smartyDisplayTag, smartyGetListingId, toArray,

__get( string   $name, ) : mixed

Description

Allows object oriented listing objects.

Arguments

Name Type Description Default
$name string

Return value

Type Description
mixed

__set( string   $name, string   $value, ) : n/a

Description

Allows object oriented listing objects. (not meant to be called directly)
Allows you to use $listing->price = 1.11 to set the price on a listing.

Arguments

Name Type Description Default
$name string
$value string

Return value

Type Description
n/a n/a

_isHidden( string   $field, ) : boolean

Description

Used internally to figure out if the given field or tag is hidden or not

Arguments

Name Type Description Default
$field string

The field or tag

Return value

Type Description
boolean

Tags

Name Description
since Version 7.1.0

_loadFormatted( ) : n/a

Description

Loads the formatted values for this listing, and assignes to e_formatted.
used internally by displayField.

Return value

Type Description
n/a n/a

addDataSet( array   $dataSet, ) : n/a

Description

If you get a set of listing's data, you can use this method to populate listing objects for each of the retrieved listings.
That way it does not have to get info for the same listing twice.

Arguments

Name Type Description Default
$dataSet array

in array form, as if $db->GetAll($sql) was used.

Return value

Type Description
n/a n/a

Tags

Name Description
since Version 5.0.0

addListingData( array   $listing, ) : n/a

Description

Add single listing's data so it doesn't have to be retrieved later.

Arguments

Name Type Description Default
$listing array

Return value

Type Description
n/a n/a

Tags

Name Description
since Version 5.1.2

bidCount( int   $listing_id, ) : int|bool

Description

Gets the count of how many bids there currently are for the given listing ID.

Arguments

Name Type Description Default
$listing_id int

Return value

Type Description
int|bool The current number of bids, or boolean false if there was a problem getting the count.

getAllOrderItems( bool   $onlyActive = false, bool   $onlyLegit = true, ) : array

Description

Gets an array of all the order item ID's for parent items that have listing or listing_id set to this listing's ID. Note that neither input vars will apply to the "original" order item for the listing.
This does NOT verify order items. It will also not get any order items if $listing->order_item_id is not set.

Arguments

Name Type Description Default
$onlyActive bool

If true, will only return order items current "active"

false
$onlyLegit bool

If true(default), will only return order items with the Order field set.

true

Return value

Type Description
array An array of order item ID's, with the first one being the "original" order item (set as $listing->order_item_id).

getAuctionAdditionalFees( int   $listing_id, ) : n/a

Description

Get the additional fees for an auction, in array format, with the total given in the index 'total' for the returned array.

Arguments

Name Type Description Default
$listing_id int

Return value

Type Description
n/a n/a

Tags

Name Description
since Version 7.2.0

getBid( int   $listing_id, int   $bidder, int   $quantity, ) : array|bool

Description

Way to easily get the bid details for a bid, given the listing ID, bidder, and quantity. If multiple bids happen to match, will return the most recent bid.

Arguments

Name Type Description Default
$listing_id int
$bidder int
$quantity int

Return value

Type Description
array|bool Return false if there is problem

Tags

Name Description
since Version 7.2.0

getCategories( int   $listing_id, ) : array

Description

Get array of categories for the given listing ID

Arguments

Name Type Description Default
$listing_id int

Return value

Type Description
array

Tags

Name Description
since Version 7.4.0

getCheckboxes( int   $listing_id, ) : array

Description

Get the checkboxes for the given listing.

Arguments

Name Type Description Default
$listing_id int

Return value

Type Description
array Array of checkboxes, in format checks[question_id]='checkbox name'

Tags

Name Description
since Version 7.2.1

getCostOptions( int   $listing_id, ) : array

Description

Get auction cost options for specified listing.

Arguments

Name Type Description Default
$listing_id int

Return value

Type Description
array

Tags

Name Description
since Version 7.4.0

getExtraQuestions( int   $listing_id, ) : array

Description

Get the extra questions for the given listing.

Arguments

Name Type Description Default
$listing_id int

Return value

Type Description
array Array of extra questions, each entry is an associative array using index's of "question", "value" (for answer), and "link" which is the URL for questions with type of "url" or false otherwise. Question and value are both going to be pre-formatted, and the index of each one is the question ID

Tags

Name Description
since Version 7.2.1

getFullUrl( ) : String

Description

Get the full URL for this listing, including any subdomains and all that fun stuff

Return value

Type Description
String

Tags

Name Description
since 7.1.0

getHighBidder( int   $listing_id, ) : boolean|array

Description

Get the high bidder result for the current high bidder of the given listing.
Note that if the auction is a reverse auction, it will actually be returning the lowest bidder...

Arguments

Name Type Description Default
$listing_id int

Return value

Type Description
boolean|array Boolean false if no high bidder found, array result from the geodesic_auctions_bids table otherwise

Tags

Name Description
since Version 7.1.0

getImages( int   $listing_id, Object   $result_set = null, ) : array

Description

Gets an array of images for the listing specified, and sets a few things like what the scaled sizes should be.

Arguments

Name Type Description Default
$listing_id int
$result_set Object

Can pass in a database result set for a set of images. This allows listing preview to work as it can be made to get images that may not be "live" yet along with using an alternate display order. {@since Version 7.1.3}

null

Return value

Type Description
array

Tags

Name Description
since Version 7.1.0

getLeveledValues( int   $listing_id, ) : array

Description

Get array of multi-level field values.

Arguments

Name Type Description Default
$listing_id int

Return value

Type Description
array

getListing( int   $listing_id, bool   $get_all = true, bool   $try_expired = false, bool   $force_refresh = false, ) : \geoListing|null

Description

Gets a listing according to the listing id specified, this is the main way to get yourself a listing object.

Arguments

Name Type Description Default
$listing_id int
$get_all bool

If true, when fetching the listing, it gets all the data for the listing all at once. Handy to set to false if you know you will only be using 1 or 2 columns so that it will be more efficient to only retrieve those columns.

true
$try_expired bool

if true, will see if listing exists expired if it can't be found in active

false
$force_refresh bool

forces the system to get a fresh copy of the listing data, even if it's already been done this pageload. Useful for places in the admin that update the listing directly but rely on this class for display after the fact

false

Return value

Type Description
\geoListing|null If listing not found, will return null.

getRegionTrees( int   $listing_id, ) : array

Description

Gets array of regions, including "additional" regions if there are any set.

Arguments

Name Type Description Default
$listing_id int

Return value

Type Description
array

Tags

Name Description
since Version 7.1.0

getTags( int   $listing_id, ) : array

Description

Gets array of tags for the given listing ID

Arguments

Name Type Description Default
$listing_id int

Return value

Type Description
array

Tags

Name Description
since Version 5.1.0

getTitle( int   $listing_id = 0, ) : string

Description

Convienience function, gets the title for the specified listing. It decodes the title for you using fromDB.
If you know you will be needing more info that just the title, just get the whole listing instead, and decode it yourself. This is kind of like calling geoString::fromDB(geoListing::getListing($listing_id)->title)

Arguments

Name Type Description Default
$listing_id int 0

Return value

Type Description
string The title (already decoded from the db), or the listing ID if the listing could not be found.

isExpired( ) : bool

Description

Whether or not this listing is from the expired table or not.

Return value

Type Description
bool

isLocked( ) : int

Description

Finds out if this listing is locked for editing

Return value

Type Description
int 1 if locked, 0 otherwise

remove( int   $listingId, bool   $isArchived = false, ) : bool

Description

Remove the specified listing. This is meant to be used in a mass-deletion so the category count is not updated, and removes it directly, not move it to the archive table. All attached images, questions, and bids are also removed.

Arguments

Name Type Description Default
$listingId int
$isArchived bool

If true, will behave as it should when a listing is merely being archived. Note that it still does NOT add the listing to the archived table, that should be done prior to calling this method. This param added in version 5.2.0.

false

Return value

Type Description
bool Whether removal was a success or not.

Tags

Name Description
since Version 5.0.0

setLocked( boolean|int   $state = true, ) : boolean

Description

Locks a listing, preventing other processes from modifying it until the lock is released Also can reverse that process by passing it 0 or false

Arguments

Name Type Description Default
$state boolean|int

true|1 to lock, false|0 to unlock

true

Return value

Type Description
boolean true on success, false on failure

smartyDisplayField( string   $field, array   $params, \Smarty_Internal_Template   $smarty, ) : string

Description

Used to display the specified field for the listing, used by the custom smarty function {listing .
..} when the "field" is specified.

Arguments

Name Type Description Default
$field string

The field to display.

$params array

The params as passed into the smarty function

$smarty \Smarty_Internal_Template

The smarty object as passed into the smarty function.

Return value

Type Description
string The value as it should be returned by a smarty function. Note that if "assign" is one of the params, it will instead assign the output to the variable specified in the smarty object, and will return Empty string.

Tags

Name Description
since Version 7.1.0

smartyDisplayTag( string   $tag, array   $params, \Smarty_Internal_Template   $smarty, ) : string

Description

Used by custom smarty function {listing} to display some block of info related specifically to listing. Note that this uses {@see geoTemplate::geoTemplate::loadInternalTemplate()} which in turn, applies the following common abilities:
- assign : if this parameter is set, it will assign the output to the specified variable in smarty instead of just displaying the output. - file, g_type, g_resource : these can be over-written with parameters, which would make it use the specified values. This would allow to force it to use a different template than normal to display the contents.

Arguments

Name Type Description Default
$tag string

The tag to display

$params array

The params as passed into the smarty function

$smarty \Smarty_Internal_Template

The smarty object as passed into the smarty function.

Return value

Type Description
string The value as it should be returned by a smarty function. Note that if "assign" is one of the params, it will instead assign the output to the variable specified in the smarty object, and will return Empty string.

Tags

Name Description
since Version 7.1.0

smartyGetListingId( array   $params, \Smarty_Internal_Template   $smarty, ) : int

Description

For use in smarty plugins, tags, or anything really within a smarty environment, to try to get a listing ID based on the smarty params / environment. Most commonly used by {listing} plugin.

Arguments

Name Type Description Default
$params array

The params as passed into the smarty function

$smarty \Smarty_Internal_Template

The smarty object as passed into the smarty function.

Return value

Type Description
int The listing ID or 0 if could not determine

Tags

Name Description
since Version 7.4.0

toArray( ) : array

Description

Converts the listing's data into an array and returns it.

Return value

Type Description
array

Properties

$_all, $_extra, $_hidden, $_isExpired, $_listing_data, $_listings,

bool  private  $_all =

Whether or not all the fields are retrieved, or just some of them.


array  private  $_extra =

The listing data, un-encoded and everything.


array  private  static $_hidden =

Array of fields that are hidden when user not logged in


bool  private  $_isExpired =

Whether or not the current listing is in the expired table or not.


array  private  $_listing_data =

The listing data, un-encoded and everything.


\geoListing  private  static $_listings =

Array of listing objects

array




Documentation was generated by phpDocumentor 2.2.0 .

Namespaces

  • global

    Packages

    • Default
      • ExampleAddon
        • addon_example_admin
          In charge of doing stuff on the admin side, this is optional.
        • addon_example_info
          Required class for addons, this is the Addon information class, used by the addon system to determine what the addon can do. Also contains info about the addon that can be viewed in the addon management page in the admin.
        • addon_example_pages
          Addon page class, used by the addon system to display pages on the client side.
        • addon_example_setup
          This class is not required. If it, and the function for a particular routine exist, then that function will be called IN ADDITION TO the automated routines of the addon framework.
        • addon_example_tags
          Expects one function for each tag. Function name should be the same as the tag name. Can also have a constructor if anything needs to be constructed.
        • addon_example_util
          This is where to put functions that the main part of the addon will use.
        • eWidgetOrderItem
          This order item is designed to allow users on your site to purchase an eWidget.
      • System
        • DataAccess
          This is the main Database access object.
        • Singleton
          Singleton method class
        • _templateOrderItem
          Developers: use this file as a template to create a new order item.
        • _templatePaymentGateway
          This is the "developer template" payment gateway handler, a developer could use this file as a starting point for creating a new payment gateway in the system.
        • geoAPI
          The main system class for receiving and handling remote API calls, this acts as a translation layer between the communication with the "outside" and each API call.
        • geoAddon
          This is the class that handles anything and everything to do with addons.
        • geoArrayTools
          Utility functions for manipulating arrays
        • geoBrowse
          Contains functions common to browsing listings
        • geoBrowsingFilter
          System for activating, storing, and deactivating browsing filters.
        • geoCJAX
          Class that wraps the CJAX_FRAMEWORK, used to get the CJAX class.
        • geoCache
          This is the main part of the Geo cache system, it does all the "low level" stuff like writing files and escaping cache data.
        • geoCacheModule
          Part of Geo Cache system, specifically tuned to work best with cacheing module data (which will be an array).
        • geoCachePage
          Cache system specifically tuned to work best with cacheing output of pages and modules
        • geoCacheSetting
          Part of Geo Cache system, specifically tuned to work best with cacheing site-wide key=value type settings.
        • geoCacheText
          Part of Geo Cache system, this part specifically tuned to work best with cacheing language specific messages.
        • geoCalendar
          Holds utility method(s) for manipulating stuff dealing with calendar selector.
        • geoCart
          This class is behind the cart, loading all the order items and such and displaying, and processing all the different pages.
        • geoCategory
          Utility class that holds various methods to do stuff with categories in the system.
        • geoCombineResources
          This class helps to combine CSS and JS files, minify them, and optionally compress them.
        • geoCron
          This is the cron job backend, it handles all the communication and security and all that.
        • geoCrypt
          Class to use for encrypting information that needs to be able to be retrieved later.
        • geoDate
          Holds utility method(s) for manipulating stuff dealing with dates.
        • geoEmail
          Class that sends out e-mails.
        • geoFields
          Class that holds settings information for fields to use.
        • geoFieldsField
          A mini object to hold data about a specific field.
        • geoFile
          As the name implies, this is used for file-based utility methods.
        • geoFilter
          A few utility methods, good for filtering stuff.
        • geoFormatString
          Used to display a message nice and pretty, we'll probably be getting rid of this class though so don't go crazy using it.
        • geoHTML
          Class to generate chunks of HTML that are very common, used the most in the admin panel.
        • geoImage
          This class is responsible for a lot of the image processing, along with other aspects like generating the image tag for thumbnails.
        • geoInvoice
          This is the invoice object representing an invoice in the system.
        • geoLeveledField
          Class for doing common things with leveled fields.
        • geoListing
          A listing object, basically a container object for particular listing.
        • geoListingDisplay
          This is basically a container that is responsible for helping to display {listing .
        • geoListingFeed
          Class that helps to render RSS or other types of feeds based on list of listings.
        • geoMaster
          This is dedicated class for getting the value of, and setting, the various "master switches" within the software. Since this is meant as an easy way to get the values of master switches, most of the methods are static.
        • geoNumber
          Utility functions relating to number conversion/manipulation/validation ect.
        • geoOrder
          The geoOrder object, an object representation of an order in the system.
        • geoOrderItem
          The class that all order items must extend.
        • geoPC
          Used for login credential validation, password hashing, etc. along with software licensing.
        • geoPagination
          Utility functions useful for generating pagination of a results page such as when browing ads or searching
        • geoPaymentGateway
          This class should be extended by each different payment gateway, this will have some default functions that each gateway will inherit, and also has a few final static methods used by the system to affect all order items.
        • geoPlanItem
          A container to hold settings for a particular order item type, according to price plan ID, and optionally category ID for category specific settings.
        • geoRecurringBilling
          The geoRecurringBilling object, an object representation of a recurring billing in the system.
        • geoRegion
          Stuff for regions and sub-regions.
        • geoRegistry
          Handy little object, can be used to set registry type settings.
        • geoSearchUtils
          Class for search utilities.
        • geoSellerBuyer
          Handles back-end for the seller/buyer payment gateways, to allow the buyer to more easily pay the seller for a won auction. This handles the underlying system, but the actual work is done by individual seller/buyer gateways, for instance the Paypal buy-now functionality.
        • geoSession
          Manages session storage and session cookies for user sessions.
        • geoString
          Utility functions relating to languages and string manipulation.
        • geoStringData
          This class is to store accented chars, to be used by {@link geoString::removeAccents()}, mainly to keep the String.class.php file un-cluttered.
        • geoTable
          NOT FULLY IMPLEMENTED! Do not use this class yet as it is not finished and may change drastically before we are done with it, or may even be removed.
        • geoTableRow
          NOT FULLY IMPLEMENTED! Do not use this class yet as it is not finished and may change drastically before we are done with it, or may even be removed.
        • geoTableRowset
          NOT FULLY IMPLEMENTED! Do not use this class yet as it is not finished and may change drastically before we are done with it, or may even be removed.
        • geoTableSelect
          Class used to generate a select query, useful when multiple areas want to affect a single query, for instance when generating a search query and there are addons involved.
        • geoTables
          Used to hold database table names, used throughout the code.
        • geoTemplate
          Template object that extends the Smarty class (a 3rd party library) to enable using templates to display things.
        • geoTransaction
          This is the object used for a transaction in the order and invoice system.
        • geoUser
          An object representative of a certain user in the system.
        • geoUserRating
          Store, retrieve, and display inter-user ratings
        • geoUtil
          Misc utility functions
        • geoView
          As the name implies, this is used for creating the page view. It does take a little setup (like any class), the setup is normally done in the display_page method in geoSite, or display_page in geoAdmin if displaying a page in the admin.
        • iApiTransport
          Interface for API Transports, a transport must implement this interface for the system to use it.
        • iOrderItem
          You cannot have abstract static functions, so instead need to have an interface to force the given static functions to be defined.
        • metaDbTables
          Used so that old locations that use the old name geoTables will still work.