68 Classifieds API

Features
class tree: 68Classifieds | index: 68Classifieds | all elements

 Class Listings

Description

Listings class handles actions specific to listings.

Located in /includes/classes/kernel/Listings.php (line 16)


	
			
Method Summary
 boolean addFeatures (int $id, array $data)
 boolean addListing (array $data, [boolean $admin = FALSE])
 void addListingFields (int $id)
 boolean changeDisplay (str $status, int $id, [ $orderid = 0])
 mixed countByUser (integer $userid)
 int daysDiff (string $start_date, string $end_date)
 boolean deleteListing (int $id, [int $userid = ''], [string $cron = 'N'])
 boolean deleteUsersListings (int $userid)
 boolean editListing (array $data)
 void editListingFields (int $id)
 string extra_listing_fields (int $section)
 string extra_listing_fields_validation (int $section, [string $modify = 'N'])
 array getAllListings (array $options, integer $current_row, integer $max)
 int getCategoryForListing (int $id)
 str getCategoryNameById (int $id)
 void getExtraField (int $id, int $fieldid)
 void getListingById (int $id, [ $action = ''])
 int getListingByOrderID (int $orderid)
 array getListingFields ( $id, int $section)
 array getListingImages (int $id)
 array getListingsForMember ( $userid, integer $current_row, integer $max, array $options)
 array getListingSingleImage (int $id)
 str getStatusByValue (int $id)
 str getUserNameById (int $id)
 True isFavorite (int $id, int $userid)
 string modify_listing_fields (int $id, int $section)
 boolean removeExtraFields (int $id)
 void removeImages ( $id)
 void removeOneImage ( $id)
 void setExpiration (int $id, int $orderid, [bool $renewal = FALSE], [ $listingid = FALSE])
 boolean updateHitCount (int $id)
 boolean updateRepliedCount (int $id)
 boolean updateSearchCount (int $id)
Methods
addFeatures (line 1226)

Updates a listing with new extra options. Like bold, featured, highlighted.

  • return: Returns true or false
boolean addFeatures (int $id, array $data)
  • int $id: The listing id.
  • array $data: Array of the selected features
addListing (line 988)

Add Listing

boolean addListing (array $data, [boolean $admin = FALSE])
  • array $data: An array of listing data
  • boolean $admin: Not used.
addListingFields (line 1027)

Add extra fields to a listing

void addListingFields (int $id)
  • int $id: The id of the listing
changeDisplay (line 814)

User Change Listing Status

Available options for status is:

  • Y: Active
  • N: Inactive
  • 5: Delete

boolean changeDisplay (str $status, int $id, [ $orderid = 0])
  • str $status: The new status.
  • int $id: The listing id to get.
  • $orderid
countByUser (line 2059)

Count a specific user's listings

  • return: false on failure integer on success
  • access: public
mixed countByUser (integer $userid)
  • integer $userid
daysDiff (line 646)

Gets the number of days between two dates

  • return: Number of days between start and expiration
  • access: public
int daysDiff (string $start_date, string $end_date)
  • string $start_date: The starting date
  • string $end_date: The ending date
deleteListing (line 925)

Delete Listing

boolean deleteListing (int $id, [int $userid = ''], [string $cron = 'N'])
  • int $id: The listing id to delete.
  • int $userid: Not used if inside admin.
  • string $cron: Only used if inside cron file.
deleteUsersListings (line 961)

Delete all UsersListing

boolean deleteUsersListings (int $userid)
  • int $userid: The user id to delete.
editListing (line 1114)

Edit Listing

boolean editListing (array $data)
  • array $data: An array of listing data
editListingFields (line 1257)

Adds extra fields to a listing when modifying it.

void editListingFields (int $id)
  • int $id: The listing id.
extra_listing_fields (line 1776)

Gets extra fields when adding a listing

  • return: HTML for all the extra fields.
string extra_listing_fields (int $section)
  • int $section: The category the listing is placed in.
extra_listing_fields_validation (line 1940)

Generate javascript validation for extra fields.

  • return: HTML for all the extra fields.
string extra_listing_fields_validation (int $section, [string $modify = 'N'])
  • int $section: The category the listing is placed in.
  • string $modify: Whether the listing is being modified or added.
getAllListings (line 115)

Gets all listings by the parameters. This method is used anywhere listings are shown in a grid.

Please do not mess with this file if you do not know what you are doing.

array getAllListings (array $options, integer $current_row, integer $max)
  • array $options: The search parameters
  • integer $current_row: The current page number
  • integer $max: The maximum number of rows per page
getCategoryForListing (line 1209)

Get a category based off the listing id.

  • return: The category id.
  • access: public
int getCategoryForListing (int $id)
  • int $id: The listing id.
getCategoryNameById (line 675)

Get a category name by its id.

  • return: Category name
  • access: public
str getCategoryNameById (int $id)
  • int $id: The category id.
getExtraField (line 519)

Get Single Extra Field Value. This is useful for using with getAllListings. It allows you to pull out extra fields and dislay them in showlistings.

Example: If you have an extra field with the id of 2:

  1. $row['extra']=$this->getExtraField($row['id']2);

void getExtraField (int $id, int $fieldid)
  • int $id: The listing id.
  • int $fieldid: The field id.
getListingById (line 29)

Get Listing

Gets a single listing by its ID. Then assigns it to the template class.

void getListingById (int $id, [ $action = ''])
  • int $id: The listing id to get.
  • $action
getListingByOrderID (line 1192)

Get a listing based off an order id.

  • return: The listing id.
  • access: public
int getListingByOrderID (int $orderid)
  • int $orderid: The order id.
getListingFields (line 2003)

Get Listing extra fields.

array getListingFields ( $id, int $section)
  • int $section: The category the listing is placed in.
  • $id
getListingImages (line 713)

Get a single listings images

  • return: of listing images
  • access: public
array getListingImages (int $id)
  • int $id: The listing id.
getListingsForMember (line 581)

Get listings for a member

array getListingsForMember ( $userid, integer $current_row, integer $max, array $options)
  • array $options: The search parameters
  • integer $current_row: The current page number
  • integer $max: The maximum number of rows per page
  • $userid
getListingSingleImage (line 760)

Get a single image for a listing

array getListingSingleImage (int $id)
  • int $id: The listing id.
getStatusByValue (line 544)

Gets the listings status by its ID

  • return: The status as defined in the language file.
  • access: public
str getStatusByValue (int $id)
  • int $id: The status id.
getUserNameById (line 658)

Gets a users name by their id.

  • return: username
  • access: public
str getUserNameById (int $id)
  • int $id: The user id.
isFavorite (line 693)

Find out if a listing is a favorite for a user.

  • return: or False
  • access: public
True isFavorite (int $id, int $userid)
  • int $id: The listing id.
  • int $userid: The user's id.
modify_listing_fields (line 1528)

Gets extra fields when modifying a listing

  • return: HTML for all the extra fields.
string modify_listing_fields (int $id, int $section)
  • int $id: The id of the listing
  • int $section: The category the listing is placed in.
removeExtraFields (line 1427)

Update the Search Count. Used when viewing a listing on showlistings.php or searchresults.php

boolean removeExtraFields (int $id)
  • int $id: The id of the listing
removeImages (line 1444)
void removeImages ( $id)
  • $id
removeOneImage (line 1485)
void removeOneImage ( $id)
  • $id
setExpiration (line 853)

This sets the expiration for a listing based off the order id.

void setExpiration (int $id, int $orderid, [bool $renewal = FALSE], [ $listingid = FALSE])
  • int $id: The product id to get.
  • int $orderid: The order id to get.
  • bool $renewal: True or False if it is a renewal.
  • $listingid
updateHitCount (line 1385)

Update the Hit Count. Used when viewing the viewlisting.php file.

  • return: true or false
boolean updateHitCount (int $id)
  • int $id: The id of the listing
updateRepliedCount (line 1364)

Update the replied count for a listing. Used when someone contacts the owner.

  • return: true or false
  • access: public
boolean updateRepliedCount (int $id)
  • int $id: The id of the listing
updateSearchCount (line 1406)

Update the Search Count. Used when viewing a listing on showlistings.php or searchresults.php

boolean updateSearchCount (int $id)
  • int $id: The id of the listing