Constants

UPLOAD_NO_FILES

UPLOAD_NO_FILES

Constant for when attempt to handle file uploads and no files were uploaded

UPLOAD_FAILED

UPLOAD_FAILED

Constant for when attempt to handle file uploads and not all of the file upload information was present

UPLOAD_SUCCESS

UPLOAD_SUCCESS

Constant for when attempt to handle file uploads and file were successfully uploaded

Properties

$parent

$parent :object

Reference to the controller this component lives on

Type

object

Methods

__construct()

__construct(object  $parent_controller)

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

Parameters

object $parent_controller

reference to the controller this component lives on

initializeWikiEditor()

initializeWikiEditor(\seekquarry\yioop\controllers\components\array&  $data,  $id = "")

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

Parameters

\seekquarry\yioop\controllers\components\array& $data

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)

manageGroups()

manageGroups(): array

Used to handle the manage group activity.

This activity allows new groups to be created out of a set of users. It allows admin rights for the group to be transferred and it allows roles to be added to a group. One can also delete groups and roles from groups.

Returns

array —

$data information about groups in the system

socialPrivacy()

socialPrivacy(  $data)

Used to add Differential Privacy for each group

Parameters

$data

importDiscussions()

importDiscussions(integer  $group_id,integer  $user_id,string  $feed_data)

Used to import group discussion thread from another grouping or bulletin site that has the ability to show the group as rss or atom. Examples of such site are: phpBB, google groups, phorum

Parameters

integer $group_id

id of group that thread post data will be imported into

integer $user_id

id of person doing the importing (should be owner of group)

string $feed_data

an rss or atom feed containing forum/group posts

addGroup()

addGroup(\seekquarry\yioop\controllers\components\array&  $data,integer  $add_id,integer  $register)

Used to add a group to a user's list of group or to request membership in a group if the group is By Request or Public Request

Parameters

\seekquarry\yioop\controllers\components\array& $data

field variables to be drawn to view, we modify the SCRIPT component of this with a message regarding success of not of add attempt.

integer $add_id

group id to be added

integer $register

the registration type of the group

getGroupUsersData()

getGroupUsersData(\seekquarry\yioop\controllers\components\array&  $data,integer  $group_id)

Uses $_REQUEST and $user_id to look up all the users that a group has to subject to $_REQUEST['user_limit'] and $_REQUEST['user_filter']. Information about these roles is added as fields to $data[NUM_USERS_GROUP'] and $data['GROUP_USERS']

Parameters

\seekquarry\yioop\controllers\components\array& $data

data for the manageGroups view.

integer $group_id

group to look up users for

updateGroup()

updateGroup(\seekquarry\yioop\controllers\components\array&  $data,\seekquarry\yioop\controllers\components\array&  $group,array  $update_fields)

Used by $this->manageGroups to check and clean $_REQUEST variables related to groups, to check that a user has the correct permissions if the current group is to be modfied, and if so, to call model to handle the update

Parameters

\seekquarry\yioop\controllers\components\array& $data

used to add any information messages for the view about changes or non-changes to the model

\seekquarry\yioop\controllers\components\array& $group

current group which might be altered

array $update_fields

which fields in the current group might be changed. Elements of this array are triples, the name of the group field, name of the request field to use for data, and an array of allowed values for the field

groupFeeds()

groupFeeds(): array

Used to support requests related to posting, editing, modifying, and deleting group feed items.

Returns

array —

$data fields to be used by GroupfeedElement

calculateRecentFeedsAndThread()

calculateRecentFeedsAndThread(  $data,integer  $user_id)

Used to add to $data information about the most recently view threads and groups of the current user. This will be used to populate the navigation dropdown in WikiView or WikiElement

Parameters

$data
integer $user_id

id of user requesting thread info

handleResourceUploads()

handleResourceUploads(string  $group_id,string  $store_id,string  $sub_path = "")

Used to handle file uploads either to message posts or wiki pages

Parameters

string $group_id

the group the message or wiki page is associated with

string $store_id

the id of the message post or wiki page

string $sub_path

used to specify sub-folder of default resource folder to copy to

calculateGroupedFeeds()

calculateGroupedFeeds(integer  $user_id,integer  $limit,integer  $results_per_page,string  $controller_name,array  $data)

Used to set up GroupfeedView to draw a users group feeds grouped by group names as opposed to as a linear list of thread and post titles

Parameters

integer $user_id

id of current user

integer $limit

lower bound on the groups to display feed data for

integer $results_per_page

number of groups to display feed data for

string $controller_name

name of controller on which this this component lives (either admin or group). Used by view to draw expand or collapse link

array $data

field data for view to draw itself

wiki()

wiki(): \seekquarry\yioop\controllers\components\$data

Handles requests to reading, editing, viewing history, reverting, etc wiki pages

Returns

\seekquarry\yioop\controllers\components\$data —

an associative array of form variables used to draw the appropriate wiki page

sortWikiResources()

sortWikiResources(\seekquarry\yioop\controllers\components\array&  $data)

Used to sort the resources on a wiki pages either for display in case of reading a media list or to help find resources in the case of a user using edit mode

Parameters

\seekquarry\yioop\controllers\components\array& $data

data to be sent to the view. The $data["RESOURCES_INFO"]['resources'] array of resources will be sorted according to the wiki page's settings as given in $data["HEAD"]['sort']

mediaWiki()

mediaWiki(\seekquarry\yioop\controllers\components\array&  $data,integer  $group_id,integer  $page_id,string  $sub_path = "")

Used to set up the partially processed wiki page, before media inserted, needed to display a single media item on a media list. The name of the media item to be display is expected to come from $_REQUEST['n'].

Parameters

\seekquarry\yioop\controllers\components\array& $data

array of field variables for view will be modified by this function

integer $group_id

id of group wiki page belongs to

integer $page_id

id of wiki page

string $sub_path

sub-resource folder that is being used, if any, to get resources from

getRequestedBots()

getRequestedBots(integer  $group_id,string  $description): array

Determines a list of posts that might need to reply to a post in a group

Parameters

integer $group_id

get chat bots following this group

string $description

post message to see if called any bots by using a phrase like: @bot_name some request

Returns

array —

[array of bots referred to in post, array of post portions for each robot]

addAnyBotResponses()

addAnyBotResponses(integer  $thread_id,integer  $group_id,array  $bots,string  $title,array  $posts)

This follows up to the thread post $thread_id to $group_id any response that $bots following this group might have

Parameters

integer $thread_id

id of the thread post to follow up

integer $group_id

of group thread post was posted to

array $bots

list of chat bot users following group

string $title

title of thread post to follow up

array $posts

for each bot the contents of message applicable to that bot

computeBotPattern()

computeBotPattern(integer  $bot_id,string  $post): array

Determines which, if any, chat bot patterns of chat bot $bot_id are applicable to the post $post given the current state of the chat bot for the user who made $post.

Parameters

integer $bot_id

of chat bot to look for applicable pattern

string $post

messages to compare against pattern request expressions

Returns

array —

$pattern first pattern that matches. Its ['VARS'] field will contain any binding values that were made to make the match

interpolateBotVariables()

interpolateBotVariables(string  $to_interpolate,array  $bot_variables): string

Given a string $to_interpolate with variables in it (strings of word characters beginning with a $) and given an array of variable => value, replaces the variables in $to_inpolate with their corresponding value, returning the resulting string

Parameters

string $to_interpolate

string to replace variables in

array $bot_variables

sequence of variable => value pairs to replace in string.

Returns

string —

$to_interpolate after substitutions have been made

initializeFeedItems()

initializeFeedItems(  $data,array  $pages,integer  $user_id,array  $search_array,integer  $for_group,string  $sort,integer  $limit,integer  $results_per_page)

Used to compute set up a list of feed items to be displayed by the groupFeeds activity

Parameters

$data
array $pages

contains feed items corresponding to first join dates to various groups. Other feed items will be added to this array

integer $user_id

id of user requesting thread info

array $search_array

associative array used to determine where clause of what threads, groups, or user posts to get feed items for

integer $for_group
string $sort

either ksort or krsort to specify final sort direction of feed items

integer $limit

index of first feed item out of all applicable items to display

integer $results_per_page

number of feed items to display feed data for

initializeReadMode()

initializeReadMode(  $data,integer  $user_id,integer  $group_id,string  $sub_path)

Sets up view variables for wiki pages when in read mode. If a user send a command to indicate a media resource on a media list is not viewed, then also update session accordingly

Parameters

$data
integer $user_id

id of user requesting a wiki page

integer $group_id

group in which wiki page belongs

string $sub_path

any path within wiki page folder for resources

updateGetWikiImpressionInfo()

updateGetWikiImpressionInfo(\seekquarry\yioop\controllers\components\array&  $data,integer  $user_id,integer  $group_id)

Used to populate recent page and group activity dropdowns for a wiki page and to update the recent page impressions so that this can be calculated

Parameters

\seekquarry\yioop\controllers\components\array& $data

$data data to be sent to the view, will be modified according to impression info.

integer $user_id

id of the user requesting to change the given wiki page

integer $group_id

id of the group the wiki page belongs to

editWiki()

editWiki(\seekquarry\yioop\controllers\components\array&  $data,integer  $user_id,integer  $group_id,array  $group,integer  $page_id,string  $page_name,string  $page,array  $page_defaults,string  $sub_path,string  $edit_reason,array  $missing_fields,string  $read_address,array  $additional_substitutions)

Used to handle edit settings and resources actions for the wiki() activity

This method was pulled out of the giant switch case in wiki() and the refactoring still needs some work. Hence, the awkward parameter list below.

Parameters

\seekquarry\yioop\controllers\components\array& $data

$data data to be sent to the view, will be modified according to the edit action.

integer $user_id

id of the user requesting to change the given wiki page

integer $group_id

id of the group the wiki page belongs to

array $group

associative array of info about the group wiki page belongs to

integer $page_id

if of wiki page being edited

string $page_name

string name of wiki page being edited

string $page

cleaned wiki page that came from $_REQUEST, if any

array $page_defaults

associative aray system-wide defaults for page settings of any wiki page

string $sub_path

sub resource folder being edited of wiki page, if any

string $edit_reason

reason for performing update on wiki page

array $missing_fields

fields missing from the request that might be needed to perform edit

string $read_address

url base addressed to use in performing some wiki substitutions to generate a html page from a wiki page.

array $additional_substitutions

additional preg_replace substitutions to make in going from wiki page to html

addEpubMediaScripts()

addEpubMediaScripts(string  $file_name,  $data)

Adds Javascript used to display epub files to $data view variables fo display when in media gallery mode

Parameters

string $file_name

name of epub file

$data

addPdfMediaScripts()

addPdfMediaScripts(string  $file_name,  $data)

Adds Javascript used to display PDF files to $data view variables fo display when in media gallery mode

Parameters

string $file_name

name of epub file

$data

initCommonWikiArrays()

initCommonWikiArrays(string  $controller_name,string  $base_url)

Used to initialize arrays for dropdowns in WikiElement as well as various arrays for cleaning request variables

Parameters

string $controller_name

used to set up variables for view elements should be either admin, api, or group depending on which controller is being used to handle wiki interaction

string $base_url

to use in creating link targets

initializeWikiPageToggle()

initializeWikiPageToggle(\seekquarry\yioop\controllers\components\array&  $data)

Used to create Javascript used to toggle a wiki page's settings control

Parameters

\seekquarry\yioop\controllers\components\array& $data

will contain in SCRIPT field neccessary Javascript to pass to view.