classes/php5_classes/PlanItem.class.php

Properties

Description

This holds the geoPlanItem class.

Classes

geoPlanItem

Properties

 
 
System  
No 
No 

Description

A container to hold settings for a particular order item type, according to price plan ID, and optionally category ID for category specific settings.
This class is not designed to be extended (like the geoOrderItem class is), but rather to just be used to save settings for order items on a price plan by price plan basis.

Methods

__construct, __get, __set, _getCatPricePlan, copyPlanItems, deletePlanItems, get, getCategory, getDefaultPricePlan, getEnabled, getNeedAdminApproval, getOrderItem, getPlanItem, getPlanItems, getPricePlan, getProcessOrder, initRegistry, isEnabled, isValidPricePlan, isValidPricePlanFor, needAdminApproval, remove, save, serialize, set, setCategory, setEnabled, setNeedAdminApproval, setOrderItem, setPricePlan, setProcessOrder, touch, unSerialize, useCatSpecificPlan,

__construct( ) : n/a

Description

Constructor, private so that it forces using geoPlanItem::getPlanItem()

Return value

Type Description
n/a n/a

__get( string   $name, ) : mixed

Description

Magic method to allow using $planItem->var instead of $planItem->get('var')

Arguments

Name Type Description Default
$name string

Return value

Type Description
mixed

Tags

Name Description
since Version 4.1.0

__set( string   $name, mixed   $value, ) : mixed

Description

Magic method to allow using $planItem->var = 'val' instead of $planItem->set('var','val')

Arguments

Name Type Description Default
$name string
$value mixed

Return value

Type Description
mixed

Tags

Name Description
since Version 4.1.0

_getCatPricePlan( int   $pricePlanId, int   $category, ) : int

Description

Used locally to get the first category that has cat specific pricing for the given category and price plan.

Arguments

Name Type Description Default
$pricePlanId int
$category int

Return value

Type Description
int The category ID of a category with cat specific pricing, or 0 if none.

copyPlanItems( int   $price_plan, int   $from_category, int   $to_category, ) : boolean

Description

For copying plan item from one category to another.

Arguments

Name Type Description Default
$price_plan int
$from_category int
$to_category int

Return value

Type Description
boolean True if successful, false otherwise

deletePlanItems( int   $price_plan, int   $category = 0, ) : bool

Description

Used in admin, to remove all current price plan items for the given price plan and category.

Arguments

Name Type Description Default
$price_plan int
$category int 0

Return value

Type Description
bool true on success, false on error.

get( string   $item, mixed   $default = false, ) : Mixed

Description

Gets the specified item from the registry, or if item is one of the "main" items it gets that instead.

Arguments

Name Type Description Default
$item string
$default mixed

What to return if the item is not set.

false

Return value

Type Description
Mixed the specified item, or the value of $default if the setting is not set.

getCategory( ) : int

Description

Gets the category ID for this plan item, or 0 if not category specific.

Return value

Type Description
int

getDefaultPricePlan(   $userId = 0, ) : int

Description

Gets the price plan for the given user. It will also validate that the price plan is valid, if it is not valid, or if the user is not valid or set to 0, it will get the default price plan for the site.

Arguments

Name Type Description Default
$userId n/a 0

Return value

Type Description
int

getEnabled( ) : bool

Description

Whether this plan item enabled or not.
Note that this is not currently used by the system, but in a future release we plan to add the ability to enable/disable order item types, for instance to allow admin to "disallow" placing a new classified by disabling the classified plan item.

Return value

Type Description
bool

getNeedAdminApproval( ) : bool

Description

Does this plan need admin approval to activate items of this type?

Return value

Type Description
bool

getOrderItem( ) : string

Description

Gets the order item

Return value

Type Description
string

getPlanItem( string   $item_type, int   $price_plan_id, int   $category_id = 0, bool   $forceCat = false, ) : \geoPlanItem

Description

Gets a plan item to get settings and such, depending on the given item type, price plan, and category id.

Arguments

Name Type Description Default
$item_type string
$price_plan_id int
$category_id int 0
$forceCat bool

If true, will enforce using the given category ID even if no such category is already existing for cat specific pricing. (used by admin to create new cat specific pricing)

false

Return value

Type Description
\geoPlanItem

getPlanItems( int   $price_plan_id, int   $category_id = 0, ) : array|bool

Description

Gets an array of all the plan items for the given price plan and category.

Arguments

Name Type Description Default
$price_plan_id int
$category_id int 0

Return value

Type Description
array|bool an array of plan item objects, or false if failure retrieving.

getPricePlan( ) : int

Description

Gets the price plan ID currently set.

Return value

Type Description
int

getProcessOrder( ) : int

Description

Get the "process order" for the current plan item.
Note that a process order, is the "sequential" order in which things are processed.

Return value

Type Description
int

initRegistry( ) : n/a

Description

Initializes the registry, mostly used internally.

Return value

Type Description
n/a n/a

isEnabled( ) : bool

Description

Alias of {@link geoPlanItem::getEnabled()}

Return value

Type Description
bool

isValidPricePlan( int   $pricePlanId, ) : bool

Description

Sees if the given price plan ID is a valid one.

Arguments

Name Type Description Default
$pricePlanId int

Return value

Type Description
bool

isValidPricePlanFor( int   $userId, int   $pricePlanId, ) : bool

Description

Checks to see if the given price plan is valid for the specified user, valid meaning either the default price plan, or one of the alternate "attached" price plans, for the user.

Arguments

Name Type Description Default
$userId int
$pricePlanId int

Return value

Type Description
bool

Tags

Name Description
since Version 4.1.0

needAdminApproval( ) : bool

Description

Alias of {@link geoPlanItem::getNeedAdminApproval()}

Return value

Type Description
bool

remove( int|null   $pricePlan = null, int|null   $categoryId = null, ) : bool

Description

Remove plan items, being careful with resources. Designed to be used when something like category is removed or price plan is removed.
Use default of "null" value for price plan or category if desired, to specify to remove all plan items in any category or price plan. Either category or price plan must be specified, cannot call this with no inputs to remove all plan items, it just won't allow that. Price plan id of 0 is considered "invalid" but category ID of 0 IS valid.

Arguments

Name Type Description Default
$pricePlan int|null null
$categoryId int|null null

Return value

Type Description
bool

Tags

Name Description
since Version 5.0.0

save( ) : n/a

Description

Alias of geoPlanItem::serialize() - see that method for details.

Return value

Type Description
n/a n/a

serialize( ) : n/a

Description

Serializes the current plan item (saves the settings in the DB).
Also automatically serializes any objects attached to it that are not already serialized, like the plan item's registry.

Return value

Type Description
n/a n/a

set( string   $item, mixed   $value, ) : n/a

Description

Sets the given item to the given value. If item is one of built-in items, it sets that instead of something from the registry.

Arguments

Name Type Description Default
$item string
$value mixed

Return value

Type Description
n/a n/a

setCategory( int   $category_id, ) : n/a

Description

Sets the category ID for this plan item.

Arguments

Name Type Description Default
$category_id int

Return value

Type Description
n/a n/a

setEnabled( bool   $enabled, ) : n/a

Description

Sets whether this plan item is enabled or not.
Note that the enabled setting "works" as in you can enable/disable a plan item in the code, but the setting is not currently used for anything. In a future release we plan to add the ability to enable/disable each plan item as an easy way to turn on/off the ability for users to use that order item type.

Arguments

Name Type Description Default
$enabled bool

Whether it is enabled or not.

Return value

Type Description
n/a n/a

setNeedAdminApproval( bool   $need_admin_approval, ) : n/a

Description

Sets whether or not the plan item needs admin approval.

Arguments

Name Type Description Default
$need_admin_approval bool

Return value

Type Description
n/a n/a

setOrderItem( string   $item, ) : n/a

Description

Sets the order item type for this plan item, for instance 'classified'.

Arguments

Name Type Description Default
$item string

The item type to set.

Return value

Type Description
n/a n/a

setPricePlan( int   $price_plan_id, ) : n/a

Description

Sets the price plan id for the plan item. Does NOT validate the price plan ID, so that needs to be done prior to calling this.

Arguments

Name Type Description Default
$price_plan_id int

Return value

Type Description
n/a n/a

setProcessOrder( int   $process_order, ) : n/a

Description

Sets the "process order" for the current plan item.
Note that a process order, is the "sequential" order in which things are processed.

Arguments

Name Type Description Default
$process_order int

Return value

Type Description
n/a n/a

touch( ) : n/a

Description

Use when this object, or one of it's child objects, has been changed, so that when it is serialized, it will know there are changes that need to be serialized.
This also recursevly touches all "parent" objects that this one is attached to. Note that this is automatically called internally when any of the set functions are used.

Return value

Type Description
n/a n/a

unSerialize( string   $order_item_type = '', int   $price_plan = 0, int   $category_id = 0, bool   $force_category = false, ) : n/a

Description

Unserializes the plan item, either using vars if they are passed in, or using already set object params if variables are not passed.

Arguments

Name Type Description Default
$order_item_type string ''
$price_plan int 0
$category_id int 0
$force_category bool

If true, will force it to get the category specific setting for the plan item. Otherwise, it will only get the category specific settings if there are any category specific settings for the category specified, if there are no cat specific settings then the category in the plan item will be set to 0.

false

Return value

Type Description
n/a n/a

useCatSpecificPlan( int   $pricePlanId, int   $category, ) : bool

Description

Used in admin panel to determine if the given price plan has category specific pricing for the given category.

Arguments

Name Type Description Default
$pricePlanId int
$category int

Return value

Type Description
bool

Tags

Name Description
since Version 5.0.0

Properties

$_catPricePlans,

array  private  static $_catPricePlans = array()

Local cache for this page load, of values already retrieved by _getCatPricePlan()


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.