SNIPPET_TITLE_LENGTH
SNIPPET_TITLE_LENGTH
This is class is used to handle db results related to Group Administration. Groups are collections of users who might access a common blog/news feed and set of pages. This method also controls adding and deleting entries to a group feed and does limited access control checks of these operations.
__construct(string $db_name = \seekquarry\yioop\configs\DB_NAME,boolean $connect = true, $web_site = null)
Sets up the database manager that will be used and name of the search engine database
string | $db_name | the name of the database for the search engine |
boolean | $connect | whether to connect to the database by default after making the datasource class |
$web_site |
fileGetContents(string $filename,boolean $force_read = false): string
Either a wrapper for file_get_contents, or if a WebSite object is being used to serve pages, it reads it in using blocking I/O file_get_contents() and caches it before return its string contents.
Note this function assumes that only the web server is performing I/O with this file. filemtime() can be used to see if a file on disk has been changed and then you can use $force_read = true below to force re- reading the file into the cache
string | $filename | name of file to get contents of |
boolean | $force_read | whether to force the file to be read from presistent storage rather than the cache |
contents of the file given by $filename
filePutContents(string $filename,string $data)
Either a wrapper for file_put_contents, or if a WebSite object is being used to serve pages, writes $data to the persistent file with name $filename. Saves a copy in the RAM cache if there is a copy already there.
string | $filename | name of file to write to persistent storages |
string | $data | string of data to store in file |
formatSinglePageResult(array $page,array $words = null,integer $description_length = self::DEFAULT_DESCRIPTION_LENGTH): array
Given a page summary, extracts snippets which are related to a set of search words. For each snippet, bold faces the search terms, and then creates a new summary array.
array | $page | a single search result summary |
array | $words | keywords (typically what was searched on) |
integer | $description_length | length of the description |
$page which has been snippified and bold faced
getSnippets(string $text,array $words,string $description_length): string
Given a string, extracts a snippets of text related to a given set of key words. For a given word a snippet is a window of characters to its left and right that is less than a maximum total number of characters.
There is also a rule that a snippet should avoid ending in the middle of a word
string | $text | haystack to extract snippet from |
array | $words | keywords used to make look in haystack |
string | $description_length | length of the description desired |
a concatenation of the extracted snippets of each word
boldKeywords(string $text,array $words): string
Given a string, wraps in bold html tags a set of key words it contains.
string | $text | haystack string to look for the key words |
array | $words | an array of words to bold face |
the resulting string after boldfacing has been applied
isSingleLocalhost(array $machine_urls,string $index_timestamp = -1): boolean
Used to determine if an action involves just one yioop instance on the current local machine or not
array | $machine_urls | urls of yioop instances to which the action applies |
string | $index_timestamp | if timestamp exists checks if the index has declared itself to be a no network index. |
whether it involves a single local yioop instance (true) or not (false)
searchArrayToWhereOrderClauses(array $search_array,array $any_fields = array('status')): array
Creates the WHERE and ORDER BY clauses for a query of a Yioop table such as USERS, ROLE, GROUP, which have associated search web forms. Searches are case insensitive
array | $search_array | each element of this is a quadruple name of a field, what comparison to perform, a value to check, and an order (ascending/descending) to sort by |
array | $any_fields | these fields if present in search array but with value "-1" will be skipped as part of the where clause but will be used for order by clause |
string for where clause, string for order by clause
getRows(integer $limit,integer $num,\seekquarry\yioop\models\int& $total,array $search_array = array(),array $args = null): array
Gets a range of rows which match the provided search criteria from $th provided table
integer | $limit | starting row from the potential results to return |
integer | $num | number of rows after start row to return |
\seekquarry\yioop\models\int& | $total | gets set with the total number of rows that can be returned by the given database query |
array | $search_array | each element of this is a quadruple name of a field, what comparison to perform, a value to check, and an order (ascending/descending) to sort by |
array | $args | additional values which may be used to get rows (what these are will typically depend on the subclass implementation) |
selectCallback(mixed $args = null): string
Used to determine the select clause for GROUPS table when do query to marshal group objects for the controller mainly in mangeGroups
This defaults to *, but in general will be overriden in subclasses of Model
mixed | $args | We use $args[1] to say whether in browse mode or not. browse mode is for groups a user could join rather than ones already joined |
a comma separated list of columns suitable for a SQL query
fromCallback(mixed $args = null): string
Controls which tables and the names of tables underlie the given model and should be used in a getRows call This defaults to the single table whose name is whatever is before Model in the name of the model. For example, by default on FooModel this method would return "FOO". If a different behavior, this can be overriden in subclasses of Model
mixed | $args | any additional arguments which should be used to determine these tables (in this case none) |
a comma separated list of tables suitable for a SQL query
whereCallback(array $args = null): string
Used to restrict getRows in which rows it returns. Rows in this case corresponding to Yioop groups. The restrictions added are to restrict to those group available to a given user_id and whether or not the user wants groups subscribed to, or groups that could be subscribed to
This defaults to an empty WHERE clause.
array | $args | first two elements are the $user_id of the user and the $browse flag which says whether or not user is browing through all groups to which he could subscribe and read or just those groups to which he is alrady subscribed. |
a SQL WHERE clause suitable to perform the above restrictions
rowCallback(array $row,mixed $args): array
Called after as row is retrieved by getRows from the database to perform some manipulation that would be useful for this model.
For example, in CrawlModel, after a row representing a crawl mix has been gotten, this is used to perform an additional query to marshal its components. By default this method just returns this row unchanged.
array | $row | row as retrieved from database query |
mixed | $args | additional arguments that might be used by this callback |
$row after callback manipulation
postQueryCallback(array $rows): array
Called after getRows has retrieved all the rows that it would retrieve but before they are returned to give one last place where they could be further manipulated. For example, in MachineModel this callback is used to make parallel network calls to get the status of each machine returned by getRows. The default for this method is to leave the rows that would be returned unchanged
array | $rows | that have been calculated so far by getRows |
$rows after this final manipulation
getGroupUsers(string $group_id,string $filter = "",array $sorts = array(),integer $limit = "",integer $num = \seekquarry\yioop\configs\NUM_RESULTS_PER_PAGE): array
Get an array of users that belong to a group
string | $group_id | the group_id to get users for |
string | $filter | to LIKE filter users |
array | $sorts | directions on how to sort the columns of the results format is column_name => direction |
integer | $limit | first user to get |
integer | $num | number of users to return |
of USERS rows
countGroupUsers(integer $group_id,string $filter = ""): integer
Get the number of users which belong to a group and whose user_name matches a filter
integer | $group_id | id of the group to get a count of |
string | $filter | to filter usernames by |
count of matching users
addGroup(string $group_name,integer $user_id,integer $register = \seekquarry\yioop\configs\REQUEST_JOIN,integer $member = \seekquarry\yioop\configs\GROUP_READ,integer $voting = \seekquarry\yioop\configs\NON_VOTING_GROUP,integer $post_lifetime = \seekquarry\yioop\configs\FOREVER,integer $encryption): integer
Add a groupname to the database using provided string
string | $group_name | the groupname to be added |
integer | $user_id | user identifier of who owns the group |
integer | $register | flag that says what kinds of registration are allowed for this group NO_JOIN, REQUEST_JOIN, PUBLIC_JOIN, or some group fee amount in credits 100, 200, 500, 1000, 2000 |
integer | $member | flag that says how members other than the owner can access this group GROUP_READ, GROUP_READ_COMMENT (can comment on threads but not start. i.e., a blog), GROUP_READ_WRITE, (can read, comment, start threads), GROUP_READ_WIKI, (can read, comment, start threads, and edit the wiki) |
integer | $voting | flag that says how members can vote on each others posts: NON_VOTING_GROUP, UP_VOTING_GROUP, UP_DOWN_VOTING_GROUP |
integer | $post_lifetime | specifies the time in seconds that posts should live before they expire and are deleted |
integer | $encryption | 0 means don't encrypt group, 1 means encrypt group |
id of group added
checkUserGroup(integer $user_id,integer $group_id,integer $status = -1): boolean
Check is a user given by $user_id belongs to a group given by $group_id. If the field $status is sent then check if belongs to the group with $status access (active, invited, request, banned)
integer | $user_id | user to look up |
integer | $group_id | group to check if member of |
integer | $status | membership type |
whether or not is a member
getRegisterType(integer $group_id): integer
Return the type of the registration for a group given by $group_id This says who is allowed to register for the group (i.e., is it by invitation only, by request, or anyone can join)
integer | $group_id | which group to find the type of |
the numeric code for the registration type
getGroupById(integer $group_id,integer $user_id,boolean $require_root_or_member = false): array
Returns information about the group with id $group_id provided that the requesting user $user_id has access to it
integer | $group_id | id of group to look up |
integer | $user_id | user asking for group info |
boolean | $require_root_or_member | require the $user_id to be in the group or root |
row from group table or false (if no access or doesn't exists)
getUserGroups(integer $user_id,string $filter,array $sorts,integer $limit,integer $num = \seekquarry\yioop\configs\NUM_RESULTS_PER_PAGE): array
Get a list of all groups which user_id belongs to. Group names are not localized since these are created by end user admins of the search engine
integer | $user_id | to get groups for |
string | $filter | to LIKE filter groups |
array | $sorts | directions on how to sort the columns of the results format is column_name => direction |
integer | $limit | first user to get |
integer | $num | number of users to return |
an array of group_id, group_name pairs
addUserGroup(string $user_id,string $group_id,integer $status = \seekquarry\yioop\configs\ACTIVE_STATUS)
Add an allowed user to an existing group
string | $user_id | the id of the user to add |
string | $group_id | the group id of the group to add the user to |
integer | $status | what should be the membership status of the added user. Should be one of ACTIVE_STATUS, INACTIVE_STATUS, SUSPENDED_STATUS, INVITED_STATUS |
deletableUser(integer $user_id,integer $group_id): boolean
Checks if a user belongs to a group but is not the owner of that group Such a user could be deleted from the group
integer | $user_id | which user to look up |
integer | $group_id | which group to look up for |
where user is deletable
getRelationshipId(string $relationship_type): array
Returns the id of the relationship between wiki pages with the given name
string | $relationship_type | the relationship type to get id about |
row from PAGE_RELATIONSHIP table or false (if no access or doesn't exist)
getThreadFollowers(integer $thread_id,integer $owner_id,integer $exclude_id = -1): array
Returns an array of user information about users who have contributed to a thread or own the group a thread belongs to
integer | $thread_id | the id of the thread that want users for |
integer | $owner_id | owner of group thread belongs to |
integer | $exclude_id | an id of a user to exclude from the array returned |
user information of users following the thread
addGroupItem(integer $parent_id,integer $group_id,integer $user_id,string $title,string $description,integer $type = \seekquarry\yioop\configs\STANDARD_GROUP_ITEM,integer $post_time,string $url = ""): integer
Creates a new group item
integer | $parent_id | thread id to use for the item |
integer | $group_id | what group the item should be added to |
integer | $user_id | of user making the post |
string | $title | title of the group feed item |
string | $description | actual content of the post |
integer | $type | flag saying what kind of group item this is. One of STANDARD_GROUP_ITEM, WIKI_GROUP_ITEM (used for threads discussing a wiki page) |
integer | $post_time | timstamp for when this group item was created default to the current time |
string | $url | a url associated with this group item (mainly for search group) |
$id of item added
encrypt(string $data,string $key,string $cipher_method = 'aes-256-cbc'): string
Encrypts data based on provided key.
string | $data | what data to encrypt |
string | $key | what key to use to encrypt |
string | $cipher_method | a cipher encrypt/decrypt method supported by OpenSSL |
$out_data the encrypted string
decrypt(string $data,string $key,string $cipher_method = 'aes-256-cbc'): string
Decrypts data based on provided key.
string | $data | what data to decrypt |
string | $key | what key to use to decrypt |
string | $cipher_method | a cipher encrypt/decrypt method supported by OpenSSL |
$out_data the decrypted string
deleteGroupItem(integer $post_id,integer $user_id)
Removes a group feed item from the GROUP_ITEM table.
integer | $post_id | of item to remove |
integer | $user_id | the id of the person trying to perform the removal. If not root, or the original creator of the item, the item won't be removed |
getGroupItems(integer $limit,integer $num = 100,array $search_array = array(),integer $user_id = \seekquarry\yioop\configs\ROOT_ID,integer $for_group = -1): array
Gets the group feed items visible to a user with $user_id and which match the supplied search criteria found in $search_array, starting from the $limit'th matching item to the $limit+$num item.
integer | $limit | starting offset group item to display |
integer | $num | number of items from offset to display |
array | $search_array | each element of this is a quadruple name of a field, what comparison to perform, a value to check, and an order (ascending/descending) to sort by |
integer | $user_id | who is making this request to determine which |
integer | $for_group | if this value is set it is a assumed that group_items are being returned for only one group and that they should be grouped by thread |
elements of which represent one group feed item
getGroupItemCount(array $search_array = array(),integer $user_id = \seekquarry\yioop\configs\ROOT_ID,integer $for_group = -1): integer
Gets the number of group feed items visible to a user with $user_id and which match the supplied search criteria found in $search_array
array | $search_array | each element of this is a quadruple name of a field, what comparison to perform, a value to check, and an order (ascending/descending) to sort by |
integer | $user_id | who is making this request to determine which |
integer | $for_group | if this value is set it is a assumed that group_items are being returned for only one group and that the count desired is over the number of threads in that group |
number of items matching the search criteria for the given user_id
alreadyVoted(integer $user_id,integer $post_id): boolean
Returns true or false depending on whether a given user has voted on a given post or not
integer | $user_id | id of user to check if voted |
integer | $post_id | id of GROUP_ITEM to see if voted on |
whether or not the user has voted on that item
setPageName(integer $user_id,integer $group_id,string $page_name,string $page,string $locale_tag,string $edit_comment,string $thread_title,string $thread_description,string $base_address = "",array $additional_substitutions = array()): integer
Used to add a wiki page revision by a given user to a wiki page of a given name in a given group viewing the group under a given language. If the page does not exist yet it, and its corresponding discussion thread is created. Two pages are used for storage GROUP_PAGE which contains a parsed to html version of the most recent revision of a wiki page and GROUP_PAGE_HISTORY which contains non-parsed versions of all revisions
integer | $user_id | identifier of who is adding this revision |
integer | $group_id | which group the wiki page revision if being done in |
string | $page_name | title of page being revised |
string | $page | wiki page with potential wiki mark up containing the revision |
string | $locale_tag | locale we are adding the revision to |
string | $edit_comment | user's reason for making the revision |
string | $thread_title | if this is the first revision, then this should contain the title for the discussion thread about the revision |
string | $thread_description | if this is the first revision, then this should be the body of the first post in discussion thread |
string | $base_address | default url to be used in links on wiki page that use short syntax |
array | $additional_substitutions | list of pairs additional wiki page rewrites to do when parsing wiki pages |
$page_id id of added or updated page
getTemplateMap(integer $group_id,string $locale_tag): array
Returns an array page_id => page_name of all templates for a given Group for a given language
integer | $group_id | id of group to produce template map for |
string | $locale_tag | of language to produce template map for |
page_id => page_name for each template for the given group in the provided language
getPageId(integer $group_id,string $page_name,string $locale_tag): mixed
Looks up the page_id of a wiki page based on the group it belongs to, its title, and the language it is in (these three things together should uniquely fix a page).
integer | $group_id | group identifier of group wiki page belongs to |
string | $page_name | title of wiki page to look up |
string | $locale_tag | IANA language tag of page to lookup |
$page_id of page if exists, false otherwise
pagesLinkedWithRelationship(integer $page_id,integer $group_id,string $page_name,string $relationship,string $limit,string $num): \seekquarry\yioop\models\two
Gets all the pages that are linked to a particular wiki page by providing a particular relationship type.
integer | $page_id | identifier for the current page |
integer | $group_id | group that wiki page belongs |
string | $page_name | name of the current page (in case page didn't exist before) |
string | $relationship | the type of relationship linking the wiki pages |
string | $limit | first row we want from the result set |
string | $num | number of rows we want starting from the first row in the result set |
arrays of elements which represent all pages linked to and from the given wiki page with a particular relationship
getRelationshipsToFromPage(integer $page_id,string $limit,string $num): array
Gets all the relationship types between this particular wiki page and all other pages that it is linked to.
integer | $page_id | identifier for the current page |
string | $limit | first row we want from the result set |
string | $num | number of rows we want starting from the first row in the result set |
of relationship types which represent all relationships between the given wiki page and all other linked wiki pages
getPageInfoByName(integer $group_id,string $name,string $locale_tag,string $mode): array
Return the page id, page string, and discussion thread id of the most recent revision of a wiki page
integer | $group_id | group identifier of group wiki page belongs to |
string | $name | title of wiki page to look up |
string | $locale_tag | IANA language tag of page to lookup |
string | $mode | if "edit" we assume we are looking up the page so that it can be edited and so we return the most recent non-parsed revision of the page. Otherwise, we assume the page is meant to be read and so we return the variant of the page where wiki markup has already been replaced with HTML |
(page_id, page, discussion_id) of desired wiki page
getPageInfoByThread(integer $page_thread_id): array
Returns the group_id, language, and page name of a wiki page corresponding to a page discussion thread with id $page_thread_id
integer | $page_thread_id | the id of a wiki page discussion thread to look up page info for |
(group_id, language, and page name) of that wiki page
getHistoryPage(integer $page_id,integer $pubdate): array
Returns an historical revision of a wiki page
integer | $page_id | identifier of wiki page want revision for |
integer | $pubdate | timestamp of revision desired |
(id, non-parsed wiki page, page_name, group id, locale_tag, discussion thread id) of page revision
getPageHistoryList(integer $page_id,integer $limit,integer $num): array
Returns a list of revision history info for a wiki page.
integer | $page_id | identifier for page want revision history of |
integer | $limit | first row we want from the result set |
integer | $num | number of rows we want starting from the first row in the result set |
elements of which are array with the revision date (PUBDATE), user name, page length, edit reason for the wiki pages revision
getGroupIdPageIdSubPathFromName(string $complete_group_page_name,string $locale_tag = \seekquarry\yioop\configs\DEFAULT_LOCALE): array
Given the Wiki name in the format GroupName@PageName/sub_path/some_file returns array [group_id, page_id, sub_path, some_file] for the given resource. If one of the components is missing in the above, does its best guess for the value
string | $complete_group_page_name | formated as described in summary |
string | $locale_tag | language of wiki page |
[group_id, page_id, sub_path, some_file]
getGroupPageResourcesFolders(integer $group_id,integer $page_id,string $sub_path = "",boolean $create = false,boolean $check_redirect = true): array
Returns the folder and thumb folder associated with the resources of a wiki page. Also returns base folders of these which may be different if there is a sub_path.
integer | $group_id | group identifier of group wiki page belongs to |
integer | $page_id | identifier for page want folder paths for |
string | $sub_path | file system path within the resource folder to get the folder name for |
boolean | $create | if folder doesn't exist whether to create it or not |
boolean | $check_redirect | whether to check the default group page folder for a redirect to a different folder |
(page_folder, thumb_folder, base_page_folder, base_thumb_folder)
insertResourcesParsePage(integer $group_id,integer $page_id,string $locale_tag,string $parsed_page,string $csrf_token = "",string $controller = 'admin',string $include_charts_and_spreadsheets = false): string
Given a wiki page that has been parsed to html except for wiki syntax related to resources, this method adds the html to include these resources
integer | $group_id | group identifier of group wiki page belongs to |
integer | $page_id | identifier for page want to parse resources for |
string | $locale_tag | the locale of the parsed page. |
string | $parsed_page | the parsed wiki page before resources added |
string | $csrf_token | to prevent cross-site request forgery |
string | $controller | name of controller (admin or group) that inserted urls should be for |
string | $include_charts_and_spreadsheets |
resulting html page
insertVideoImageResourceParsePage(string $mime_type,string $parsed_page,boolean $thumb_resource,string $resource_name,string $resource_url,string $resource_description,string $autoplay,string $current_folder,string $data_resource,string $match_string,string $locale_tag,string $csrf_token,integer $group_id,integer $current_page_id,string $sub_path): string
Auxiliary method for @see insertResourcesParsePage used to insert video and image resources into an otherwise parsed to HTML wiki page.
string | $mime_type | of resource to insert |
string | $parsed_page | partiall parsed wiki page to insert resources into |
boolean | $thumb_resource | whether this is a thumbnail image resource. |
string | $resource_name | name of resource that is being inserted |
string | $resource_url | url of resource that's being inserted |
string | $resource_description | human description of resource to be inserted |
string | $autoplay | html code for attribute saying whether or not this is an autoplay resource |
string | $current_folder | folder in which resource lives, so can check if there is an associated vtt transscript of audio |
string | $data_resource | if the Video or Image resource is a data url, then the string of that data url. If this case we use this only to know if should pother with auxiliary source or track tags |
string | $match_string | code string that was used to make the portion of the partially parsed wiki page to be replaced with htm for the resource to be inserted |
string | $locale_tag | tag name language of wiki page |
string | $csrf_token | cross site request forgery token to be used in links |
integer | $group_id | group of page into which resources are being inserted |
integer | $current_page_id | of page within group |
string | $sub_path | of folder structure of wiki page from which resource comes |
the page with resources inserted
convertSpreadsheetRectangle(array $spreadsheet_coords): array
Used to convert a pair of spreadsheet coordinates into a pair of integer rectangular coordinates. For example [A3, B4] into [[0,2], [1, 3]]
array | $spreadsheet_coords | a pair of spreadsheet cell coordinates |
rectangular integer pair corresponding to these coordinates
spreadsheetRectangleData(array $rectangle, $data): array
Given a pair of coordinates [top-left, bottom-right] in a spreadsheet returns the rectangular portion of the data in the spreadsheet corresponding to these coordinates.
array | $rectangle | coordinates to use when getting data out of spreadsheet |
$data |
2D array corresponding to the portion of the spreadsheet defined by the rectangle given.
evaluateCell( $cell_expression, $location, $data, $operator_pos): array
Used to evaluate a cell of a CSV spreadsheet. This code runs on the server. In scripts folder there is almost identical Javascript code in spreadsheet.js that runs on the client.
$cell_expression | ||
$location | ||
$data | ||
$operator_pos |
[new_loc, the value of the cell or the String 'NaN' if the expression was not evaluatable]
evaluateFactor(string $cell_expression,integer $location,array $data): array
Used to evaluate the left hand factor of a binary operator appearing in a CSV spreadsheet cell
string | $cell_expression | cell formula to evaluate |
integer | $location | start offset in cell expression of factor protion that this method needs to evaluate |
array | $data | array of spreadsheet data to be used for evaluation |
[new_loc, the value of sub-expression]
evalFunctionInvocation(string $cell_expression,integer $location,array $data): array
Used to evaluate a function call appearing in a CSV spreadsheet cell formula
string | $cell_expression | cell formula to evaluate |
integer | $location | start offset in cell expression of function call that this method needs to evaluate |
array | $data | array of spreadsheet data to be used for evaluation |
[new_loc, the value of sub-expression]
evalParenthesizedExpression(string $cell_expression,integer $location,array $data): array
Used to evaluate a spreadsheet expression surrounded by parentheses appearing in a CSV spreadsheet cell formula
string | $cell_expression | cell formula to evaluate |
integer | $location | start offset in cell expression of parentheses expression that this method needs to evaluate |
array | $data | array of spreadsheet data to be used for evaluation |
[new_loc, the value of sub-expression]
evaluateArgListExpression(string $cell_expression,integer $location,array $data): array
Used to evaluate the expressions in a list of arguments to a function call appearing in a CSV spreadsheet cell formula
string | $cell_expression | cell formula to evaluate |
integer | $location | start offset in cell expression of argument list that this method needs to evaluate |
array | $data | array of spreadsheet data to be used for evaluation |
[new_loc, array of arg-list]
evalRangeExpression(string $cell_expression,integer $location,array $data): array
Used to convert range expressions, cell_name1:cell_name2 into a sequence of cells, cell_name1, .
.., cell_name2 so that it may be used as part of an argument list to a function call appearing in a CSV spreadsheet cell formula
string | $cell_expression | cell formula to evaluate |
integer | $location | start offset in cell expression of range expression that this method needs to evaluate |
array | $data | array of spreadsheet data to be used for evaluation |
[new_loc, array of range cells]
evalNegatedExpression(string $cell_expression,integer $location,array $data): array
Used to parse expression of the form: -expr appearing in a CSV spreadsheet cell formula
string | $cell_expression | cell formula to evaluate |
integer | $location | start offset in cell expression of negated expression that this method needs to evaluate |
array | $data | array of spreadsheet data to be used for evaluation |
[new_loc, the value of sub-expression]
evalNumericExpression(string $cell_expression,integer $location,array $data): array
Used to parse a integer or float expression appearing in a CSV spreadsheet cell formula
string | $cell_expression | cell formula to evaluate |
integer | $location | start offset in cell expression of integer or float expression that this method needs to evaluate |
array | $data | array of spreadsheet data to be used for evaluation |
[new_loc, the value of sub-expression]
evalCellNameExpression(string $cell_expression,integer $location,array $data): array
Used to parse an expression of the form letter sequence followed by number sequence corresponding to the name of a spreadsheet cell appearing in a CSV spreadsheet cell formula
string | $cell_expression | cell formula to evaluate |
integer | $location | start offset in cell expression of cell name expression that this method needs to evaluate |
array | $data | array of spreadsheet data to be used for evaluation |
[new_loc, the value of sub-expression]
evalStringExpression(string $cell_expression,integer $location,array $data): array
Used to parse a string expression, "some string" or 'some string', appearing in a CSV spreadsheet cell formula
string | $cell_expression | cell formula to evaluate |
integer | $location | start offset in cell expression of string expression that this method needs to evaluate |
array | $data | array of spreadsheet data to be used for evaluation |
[new_loc, the value of sub-expression]
skipWhiteSpace(string $cell_expression,integer $location): integer
Finds the next non-whitespace location in the provided spreadsheet $cell_expression after position $location
string | $cell_expression | cell formula to search in |
integer | $location | start offset to bbegin search at |
location of non-whitespace character or the length of the cell expression
cellNameAsRowColumn(string $cell_name): array
Converts a string of the form letter sequence followed by number sequence to an array of int's of the form [row, column]
string | $cell_name | name of spreadsheet cell to convert |
[row, column] name corresponds to
versionGroupPage(integer $user_id,integer $page_id, $version_reason)
Creates a new version of a wiki page in the GROUP_PAGE_HISTORY without changing the page contents, but with an edit reason. This function might be called when a resource has been added to the page so that one can restore to a variant of the page with earlier resource lists.
integer | $user_id | of user responsible for version being created |
integer | $page_id | of page that new version is being made for |
$version_reason |
revertResources(integer $page_id,integer $group_id,integer $timestamp)
Called to revert a wiki pages resources to those that existed for the wiki page at a give time
integer | $page_id | of page that new version is being made for |
integer | $group_id | of group wiki page belongs to |
integer | $timestamp | of when to revert resources back to |
deleteResource(string $resource_name,integer $group_id,integer $page_id,string $sub_path = ""): boolean
Deletes a resource (image, video, etc) associated with a wiki page or group feed post belong to a group
string | $resource_name | name of resource to delete |
integer | $group_id | group identifier of group wiki page belongs to |
integer | $page_id | identifier for page want to delete resource from |
string | $sub_path | path to a subfolder of default resource folder if desired |
whether the deletion was successful
extractResource(string $resource_name,integer $group_id,integer $page_id,string $sub_path = ""): boolean
Uncompresses a compressed resource associated with a wiki page or group feed post belong to a group
string | $resource_name | name of resource to delete |
integer | $group_id | group identifier of group wiki page belongs to |
integer | $page_id | identifier for page want to delete resource from |
string | $sub_path | path to a subfolder of default resource folder if desired |
whether the deletion was successful
deleteResources(integer $group_id,integer $page_id,string $sub_path = ""): boolean
Deletes all resources (image, video, etc) associated with a wiki page belonging to a group.
integer | $group_id | group identifier of group wiki page belongs to |
integer | $page_id | identifier for page want to delete resource from |
string | $sub_path | path to a subfolder of default resource folder if desired |
whether the deletion was successful
newResource(string $resource_type,integer $group_id,integer $page_id,string $sub_path = ""): boolean
Create a new resource in the given group and page's resource folder/sub_path of the type requests.
string | $resource_type | either new-file or new-folder |
integer | $group_id | group identifier of group wiki page belongs to |
integer | $page_id | identifier for page want to delete resource from |
string | $sub_path | path to a subfolder of default resource folder if desired |
whether the deletion was successful
renameResource(string $old_resource_name,string $new_resource_name,integer $group_id,integer $page_id,string $sub_path = ""): boolean
Renames a resource (image, video, etc) associated with a wiki page belonging to a group.
string | $old_resource_name | name of resource before renaming |
string | $new_resource_name | name of resource after renaming |
integer | $group_id | group identifier of group wiki page belongs to |
integer | $page_id | identifier for page want to delete resource from |
string | $sub_path | path to a subfolder of default resource folder if desired |
whether the deletion was successful
copyFileToGroupPageResource(string $tmp_name,string $file_name,string $mime_type,integer $group_id,integer $page_id,string $sub_path = "",string $data = "")
Moves a file that has been uploaded via a wiki pages resource form to its correct position in the resources folder so it shows up for that page. For images and video (if FFMPEG configued) thumbs are generated. For video if FFMPEG is configured then a schedule is added to the media_convert folder so that the media_updater can produce mp4 and webm files corresponding to the video file.
string | $tmp_name | tmp location that uploaded file initially stored at |
string | $file_name | file name of file that has been uploaded |
string | $mime_type | mime type of uploaded file |
integer | $group_id | group identifier of group wiki page belongs to |
integer | $page_id | identifier for page want copy a page resource for |
string | $sub_path | used to specify sub-folder of default resource folder to copy to |
string | $data | string data for file to use instead of filename (only used in case run non-empty) |
getPageResource(string $file_name,integer $group_id,integer $page_id,string $sub_path = ""): string
Reads in and returns as a string the contents of a resource that has been associated to a page.
string | $file_name | file name of page resource desired |
integer | $group_id | group identifier of group wiki page belongs to |
integer | $page_id | identifier for page want copy a page resource for |
string | $sub_path | subpath with the resource folder that should be used to look up filename in |
desired page resource
setPageResource(string $file_name,string $resource_data,integer $group_id,integer $page_id,string $sub_path = "")
Saves the string for an page resource that has been updated to the appropriate folder for that wiki page.
string | $file_name | file name of page resource desired |
string | $resource_data | the data to be saved |
integer | $group_id | group identifier of group wiki page belongs to |
integer | $page_id | identifier for page want copy a page resource for |
string | $sub_path | subpath with the resource folder that should be add to resource path and filename |
makeThumbStripExif(string $file_name,string $folder,string $thumb_folder,string $mime_type = ""): boolean
Makes a thumbnail for files of a type that thumbs can be generated for and strips exif data on jpegs images (only if PHP has exif functions enabled).
string | $file_name | name of file to create thumb for |
string | $folder | the folder in which the file lives |
string | $thumb_folder | the folder in which to save thumbs |
string | $mime_type | the mime type of the file |
whether a thumb was made or not
copyResourceToClipFolder(array $clip_folder,string $resource_name,integer $group_id,integer $page_id,string $sub_path = "")
Used to copy from a resource in the provided folder to the current clip folder
array | $clip_folder | data about the folder to make a hard link of file resource in |
string | $resource_name | what to link |
integer | $group_id | id of group the file resource belongs to |
integer | $page_id | id of page the file resource belongs to |
string | $sub_path | path within the page resource folder to the folder that contains the resource to link |
getGroupPageResourceUrls(integer $group_id,integer $page_id,string $sub_path = "",boolean $create = false): array
Gets all the urls of resources belonging to a particular groups wiki page.
integer | $group_id | group identifier of group wiki page belongs to |
integer | $page_id | identifier for page want to get page resources for |
string | $sub_path | additional path beneath the default folder used for the resource folder |
boolean | $create | if folder doesn't exist whether to create it or not |
(url_prefix - prefix to apply to all urls, thum_prefix prefix to apply to a resource name to get its thumb, list of resources). Each resource is an pair (name - string file name of the resource, has_thumb a boolean as to whether the resource has a thumb)
getGroupPageResourceUrl(string $csrf_token,integer $group_id,integer $page_id,string $resource_name,string $sub_path = ""): string
Return the url needed to get a resource of a given resource name that belongs to the provided group and page.
string | $csrf_token | a token used to prevent CSRF attacks |
integer | $group_id | group identifier of group wiki page belongs to |
integer | $page_id | identifier for page want to get page resources for |
string | $resource_name | file name of resource |
string | $sub_path | additional path beneath the default folder used for the resource folder |
relative url to get resource
getPageList(integer $group_id,string $locale_tag,string $filter,string $limit,string $num): array
Returns a list of applicable wiki pages of a group
integer | $group_id | of group want list of wiki pages for |
string | $locale_tag | language want wiki page list for |
string | $filter | string we want to filter wiki page title by |
string | $limit | first row we want from the result set |
string | $num | number of rows we want starting from the first row in the result set |
a pair ($total, $pages) where $total is the total number of rows that could be returned if $limit and $num not present $pages is an array each of whose elements is an array corresponding to one TITLE and the first 100 chars out of a wiki page.