Yioop_V9.5_Source_Code_Documentation

StoreComponent extends Component
in package

Component of the Yioop control panel used to handle activitys for managing advertisements. i.e., create advertisement, activate/ deactivate advertisement, edit advertisement.It is used by AdminController

Tags
author

Pushkar Umaranikar (enhancements Chris Pollett)

Table of Contents

AD_CREDITS_REDEEM_FEES  = 50
$parent  : object
Reference to the controller this component lives on
$PAYMENT_AGENCY_POST_FIELDS  : mixed
__construct()  : mixed
Sets up this component by storing in its parent field a reference to controller this component lives on
checkCreditServiceAccountReqs()  : mixed
Checks if the payment service account details are pending other than card details because it is collect everytime while redeeming credits
getCreditsServiceAccountUrl()  : string
Fetches the payment agency service account link for redirecting user to payment agency site
getUSDAmount()  : float
Calculate the USD amount equivalent to redeem credits amount based on last redeem transaction time
initCrawlBadges()  : mixed
Used to compute statistics for badges related for the manage crawls, mix crawls, and manage machine buttons shown typically to admin accounts
initializeAdKeywords()  : mixed
Sets up the $data['AD_KEYWORD'] as an associative array of (keyword, day) => bid_amounts based on min bid for that ad keyword on that day. Set up $data['EXPENSIVE_KEYWORD'] as the most expensive ad keyword for the dates in question and also sets up $data['AD_MIN_BID'] as the minimum bid required for the dates in question
initializeWikiEditor()  : mixed
Called to include the Javascript Wiki Editor (wiki.js) on a page and to send any localizations needed from PHP to Javascript-land It is used by both Crawl and SocialComponent
initSocialBadges()  : mixed
Used to compute the impression statistics for badges on the social controls button for $user_id. These badges display the number of unread messages, the number of unread group post and the number of groups the user belongs to
manageAdvertisements()  : array<string|int, mixed>
Used to handle the Create, Edit and Activation of Advertisements
manageCredits()  : array<string|int, mixed>
Used to manage the purchase and storage of advertising credits
trim_value()  : mixed
Trim white spaces callback for array_walk

Constants

AD_CREDITS_REDEEM_FEES

private mixed AD_CREDITS_REDEEM_FEES = 50

Properties

$parent

Reference to the controller this component lives on

public object $parent = null

$PAYMENT_AGENCY_POST_FIELDS

private mixed $PAYMENT_AGENCY_POST_FIELDS

Methods

__construct()

Sets up this component by storing in its parent field a reference to controller this component lives on

public __construct(object $parent_controller) : mixed
Parameters
$parent_controller : object

reference to the controller this component lives on

Return values
mixed —

checkCreditServiceAccountReqs()

Checks if the payment service account details are pending other than card details because it is collect everytime while redeeming credits

public checkCreditServiceAccountReqs(array<string|int, mixed> $service_account_info) : mixed
Parameters
$service_account_info : array<string|int, mixed>

details of payment service account

Return values
mixed —

getCreditsServiceAccountUrl()

Fetches the payment agency service account link for redirecting user to payment agency site

public getCreditsServiceAccountUrl(string $account_id, string $type) : string
Parameters
$account_id : string

payment service account id

$type : string

payment agency specific url type

Return values
string —

url to the payment agency site

getUSDAmount()

Calculate the USD amount equivalent to redeem credits amount based on last redeem transaction time

public getUSDAmount(int $num_credits, object $credit_model, int $user_id) : float
Parameters
$num_credits : int

redeem credits amount

$credit_model : object

credit model object

$user_id : int

user id

Return values
float —

usd amount

initCrawlBadges()

Used to compute statistics for badges related for the manage crawls, mix crawls, and manage machine buttons shown typically to admin accounts

public initCrawlBadges(int $user_id, array<string|int, mixed> &$data) : mixed
Parameters
$user_id : int

of user - used to determin the mix crawl list

$data : array<string|int, mixed>

associative array of data to send to the view. This method adds three new field NUM_MIXES, CRAWL_MANAGER, "NUM_MACHINES, CRAWLS_RUNNING, and NUM_CLOSED_CRAWLS

Return values
mixed —

initializeAdKeywords()

Sets up the $data['AD_KEYWORD'] as an associative array of (keyword, day) => bid_amounts based on min bid for that ad keyword on that day. Set up $data['EXPENSIVE_KEYWORD'] as the most expensive ad keyword for the dates in question and also sets up $data['AD_MIN_BID'] as the minimum bid required for the dates in question

public initializeAdKeywords(array<string|int, mixed> &$data, int $start_date, int $day_count) : mixed
Parameters
$data : array<string|int, mixed>

associative array of data used by the view to draw itself

$start_date : int

state date in seconds since beginning of Unix epoch

$day_count : int

number of days ad campaign will last

Return values
mixed —

initializeWikiEditor()

Called to include the Javascript Wiki Editor (wiki.js) on a page and to send any localizations needed from PHP to Javascript-land It is used by both Crawl and SocialComponent

public initializeWikiEditor(array<string|int, mixed> &$data[,  $id = "" ]) : mixed
Parameters
$data : array<string|int, mixed>

an asscoiative array of data to be used by the view and layout that the wiki editor will be drawn on This method tacks on to INCLUDE_SCRIPTS to make the layout load wiki.js.

$id : = ""

if "" then all textareas on page will get editor buttons, if -1 then sets up translations, but does not add any button, otherwise, add buttons to textarea $id will. (Can call this method multiple times, if want more than one but not all)

Return values
mixed —

initSocialBadges()

Used to compute the impression statistics for badges on the social controls button for $user_id. These badges display the number of unread messages, the number of unread group post and the number of groups the user belongs to

public initSocialBadges(int $user_id, array<string|int, mixed> &$data) : mixed
Parameters
$user_id : int

id of user to compute statistics for

$data : array<string|int, mixed>

associative array of data to send to the view. This method adds three new field NUM_GROUPS, UNREAD_POSTS, and UNREAD_MESSAGES

Return values
mixed —

manageAdvertisements()

Used to handle the Create, Edit and Activation of Advertisements

public manageAdvertisements() : array<string|int, mixed>
Return values
array<string|int, mixed> —

$data field variables necessary for display of view

manageCredits()

Used to manage the purchase and storage of advertising credits

public manageCredits() : array<string|int, mixed>
Return values
array<string|int, mixed> —

$data field variables necessary for display of view

trim_value()

Trim white spaces callback for array_walk

public trim_value(string &$value) : mixed
Parameters
$value : string

string to remove initial and trailing whitespace from

Return values
mixed —

        

Search results