class KnowledgeHelper extends CustomHelper


Located at : UKNOWVA_ROOT/components/com_custom/helpers/knowledge.php

Methods

number|boolean
indexOf(mixed $needle, array $haystack)

searches an array for a value and returns the index of the first occurance

mixed
str_getcsv(string $input, string $delimiter = ',', string $enclosure = '"', unknown $escape = null, unknown $eol = null, string $return_first_line_only = true)

this functions gets the value from comma separated string

mixed|NULL
getFieldValue(string $colname, string $tablename, string $prikeyname, mixed $prikeyval)

gets field value from database

createFile(string $opfilepath, string $seperator, array $rows)

creates a file

array
getFieldsArray(string $dest, string $seperator, number $rownum)

gets the value from file

string
forceDownload(string $filepath, string $prefix_separator = '-', string $filename = NULL)

helps this to force download a file

boolean
force_download(string $filepath, string $prefix_separator = '-', string $filename = NULL)

this function force downloads the file

string
removePrefix(string $string, string $prefix_separator)

removes the string characters till the first occurrence of prefix in the given string

uploadFile(string $file, string $allowedExt = null, string $dest = null)

uploading of file

$string
getSelectListFromArray(array $array, string $name, string $attributes = null, string $selectedval = NULL, string $select_text = null, int $id = false)

makes a HTML select list from given array

$string
getSelectListFromArrayValueCounter(array $array, string $name, string $attributes = null, string $selectedval = NULL)

makes a HTML select list from given array, but the value field would be the counter .

string
compress(string $buffer, string $stripempty = false)

compress the buffer

boolean
is_64bit()

checks for processor if its 64 bit or 32 bit

getCurrentTimeStamp()

gets current time stamp

boolean
startsWith(string $haystack, string $needle)

checks the part of string for specific string from start

boolean
endsWith(string $haystack, string $needle)

checks the part of string for specific string from end

mixed
getAllAdminGroups()

gets all the admin groups

boolean
isAdminUser(int $userid = null)

checks if the user is admin

boolean
isSuperAdminUser(int $userid = null)

checks if the user is super admin

NULL|mixed
getSuperAdminUser(string $details = false)

gets the super admin users

boolean
isAdmin(int $userid, array $admin_groups, string $group_ids_passed = false)

check if given user is admin

NULL|mixed|mixed[]
getAllAdmins($admin_groups = null, $limit)

get all admins, admin_group ids to be passed here

NULL|mixed|NULL|mixed[]
getUsersInGroups(mixed $groups, number $limit, string $include_subgroups = true)

gets all users in a specific groups

boolean|mixed
setUserParam(string $param_name, mixed $param_value, int $userid = null)

set the user param

mixed
getUserParam(string $param_name, int $userid = null)

gets the user param

string
encode_string(string $string)

encodes the string, using base64_encoder

string
decode_string(string $string)

decodes the string, using base64_decoder

mixed|NULL|array
getAllParamsOfCurrentUser(int $userid = null)

gets all params of current user

string
getToken(string $view, number $len = 16)

generates the token, eg:- for file download

string
getRandomText(number $len = 8)

generates random text

boolean
checkToken(string $token, string $view)

checks the token

deleteTokens(string $key, int $value)

deletes the token

mixed
createTree(array $list, mixed $parent, string $id_column = 'id')

creates a tree from a list and parent relationship

array
parseTree(string $node, array $options, number $level, string $id_column = 'id', string $title_column = 'title')

parses the tree, used by the uKnowvaUI::treeselect mainly

boolean|string
create_scaled_image(string $file_path, array $options, string $prefix = null)

creates scaled image

boolean
validip(string $ip)

checks for valid IP addresses

string
getIP()

gets the users IP address

mixed|boolean|unknown
getUknowvaAccountDetails(string $format = 'json', number $current_count)

Gets the Uknowva Account Details

boolean
allowUserRegistration(string $send_reminder = false)

No description

gets
getCurrentUserCount()

Gets the current user count

boolean
is_valid_email(string $email)

checks if the email is valid

string
getComponentItemId(string $component_name, string $strict = false, string $return_current = true)

Gets the component Item ID

string
getUserSnapShot(int $userid = null, string $include_thumbnail = true, string $linkprofile = true, string $open_link_in_new_window = true)

returns a user snapshot html to display in your view, returns anonymous for no user found

gives
getUserProfileLink(int $userid)

Gets the user profile link

gets
getUserDetails(int $userid)

Get user Details

array
toTokenUserFormat(mixed|array $ids)

required for jquery tokens

Gives
toTokenKnowledgeFormat(mixed|array $ids)

Get Knowledge topic details returns an object which shall be json encoded

array
getAllUserGroups(array $exclude = array())

Get All User Groups

getSystemFolder()

Get System Folder

string
getDocsFolderPath()

get Root folder path for docs

string
getAllowedHostsForCron()

returns an array of valid hosts that can run cron

string
getSizeText(int $size, string $format = 'auto')

Gets the Size in text

string
getTimeText(int $seconds, number $granularity)

function to convert seconds into human readable text like 5 days, 1 hour, 5 mins, 2 seconds, etc

string
formatDate(mixed|string $date, string $format = null)

formating date

array
getAllSuperiors(int $userid, string $includeadmins = false, array $groups = array())

Gets All the Superiors

boolean
isSuperior(int $subordinate, int $superior = null, string $checkadmins = true)

check if superior or not

boolean
isImmediateSuperior(int $subordinate, int $superior = null)

checks for immediate superiors

mixed|array
getImmediateSuperiors(int $userid = null, array $groups = array())

If groups are passed, then user's belonging to the specified groups only shall be returned

gives
getAllSubordinates(int $userid, array $groups = array(), $keyword = null)

Get All Subordinates

boolean
isSubordinate(int $superior, int $subordinate, string $checkadmins = true)

checks if subordinate or not

getImmediateSubordinates($userid = null, $groups = array())

gets the immediate subordinates of the user

mixed
makeXMLRPCcall(string $xmlrpc_server_url, string $xmlrpc_method, array $xmlrpc_parameters = array())

Make XMLRPC Call

boolean|boolean|mixed
getContentFromURL($url, $timeout = 5, $echo_errors = false)

To get content from URL, this function uses callCURL which interacts with the URL usually to get CSS as string, etc , timeout is the time (in seconds) for which the script should wait to get content

boolean|mixed
callCURL(array $parameters, string $echo_errors = false)

Calls a URL

string
convertExternalCSStoInline(string $html)

Converts External CSS to Inline

boolean
storeNotification(string|int $data)

Store Notification icon can be an image path, read = 1 if the notification is read $data['type'] should contain values like comfillcalendar.eventid

addNotification(int $user_id, string $content, string $type = null, string $link = null, string $icon = null, string $readonlyonce = true)

this function sends a notification to the user ConvHelper::markotificationRead or ConvHelper::markotificationReadForAll set this as false, when you want to keep reminding the user about a particular task untill he/she does it, example: approving/rejecting a leave

boolean|mixed
markNotificationRead(array $type, int $user_id = null, string $strict = false)

Marks Notification Read

boolean|mixed
markNotificationReadForAll(array $type, string $strict = true)

Mark Notification Read for All

boolean|mixed
markNotificationReadById(array $ids)

Mark Notification Read by ID

boolean|mixed
deleteNotifications(array $type)

Delete Notification, This is where type is important

boolean|mixed
deleteNotificationsById(array $ids)

Delete Notifications By ID, This is where type is important

mixed|NULL
getGlobalNotifications(int $user_id = null, string $return_count = false, string $startdate = null)

this function gets the global notifications of a particular user

sendMail(array|string $users, string $subject, string $body, string $templateFile = '', string $params = '', number $status, string $email_type = '')

Send Mail to users

array
key2Value(array $array = array())

Converts all keys of an array to values and vice versa

array|mixed
getComponentParam(string $component, string $param, string $default = null)

Gets Component Param

getTemplateLogo(string $template = null, int $client_id)

returns the logo of the current template uKnowva themese usually have a parameter called logo, this function simply returns the path of the logo

notifySupport(string $subject, string $message, string $to = 'support@uknowva.com')

returns the value from jomsocial custom fields notifies convergence support desk in case of any issues noticed Simple function to raise a support request instantly

boolean|string
zip(string|array $files, string $destination = null)

Zip a file

boolean
file_replace(string $find, string $replace, string $file)

replace a text in a file

array
getUserFromUsername(string $username, string $profile_fields = true, string $show_blocked = false)

Gets the details of user and his profile from username, It returns an array and not an object

array
getUserFromID(int $userid, string $profile_fields = true, string $show_blocked = false)

Gets the details of user and his profile from user id, It returns an array and not an object

boolean
findAccessLevel(array $groups)

Find the access level from the group ids passed If no such access level exists, then a new access level shall be created with front end login permission

mixed|NULL|mixed[]
getAllGroups(array $groups = array(), string $title_only = false, string $exclude_super_users = false)

gets all the groups names

mixed|mixed|NULL|unknown[]|mixed[]
getAllAccessLevels(string $include_public = false)

Get All Access Levels

gets
getUsersFromAccessLevel(int $id)

gets all users from a particular access level

mixed|boolean|mixed|NULL
getAccessLevelDetails(int $id)

gets the details of the access level

getAdminAccessLevel()

returns the access view level with the rules as admin groups

getGroupsFromACL(int $level)

Gets Groups from Access Control List

gets
getSessionToken()

For web service call from user app store, we pass tokens to uknowva website and uknowva website in turn calls checkSessionToken at our end, to authenticate the user

boolean|mixed
checkSessionToken(string $token, string $return_profile_fields = true)

Checks Session Token

string
getUknowvaStoreLink(array $params = array())

gets the store link of uKnowva app store

string
getUknowvaStoreAnchor($params = array(), $class = 'extstore', $label = 'Extensions store', $attributes = array(), $pretext = null)

Gets the uKnowva Store Anchor

string[]
getSearchAreas()

Gets the accessible search areas to the current users

array
makeAssociative(array $array)

makes an associative array associative by having same key as value

array
transposeArray(array $data)

convert rows to cols and cols to rows

getCustomizableMenuTypes()

allowed menu types to add menu items from front end

getFromCache(string $cacheid, string $group)

generic function to get and set in uKnowva cache

setInCache(string $result, string $cacheid, string $group)

function to cache data or content Make sure the result is not serialized, else it will be again serialized

reportErrorToUknowva(string $subject, string $message, string $type = 'General')

sends an error report to uKnowva server through its API

string|mixed
linkify(string $string, string $noFollow = false, string $newWindow = false)

Parses a string to check if it has any URLs and if there are any, it adds an anchor tag

string
getTimeLapsed(string $from)

gets the time lapsed text between two dates Gives text like 15 days ago, 10 seconds ago, moment ago, etc

strip_selected_tags(string $text, string $tags = 'iframe,script', string $keepcontent = false)

Strip selected tags

static 
subStrWord(string $string, number $length = 100, number $start, string $trailingWith = '', string $wordseparator = ' ')

it limits on basis of words and not characters word limited as discussed here: http://network.convergenceservices.in/forum/19-php/4118-short-description-without-stripping-words.html#4118

static 
subStrHtml(string $string, number $length = 100, number $start, string $trailingWith = '', string $wordseparator = ' ')

it limits on basis of words and not characters, plus it also make sure the HTML structure is retained For example, if the word truncation outputs a string withouth the closing tags, then this will automatically add the closing tags and return a string

boolean|string
getUserSnapShots(array $users, string $delimiter = '')

This function parses the parameter users and returns multiple users snapshots

string
getAPIItemid()

gets the item id for comcustom menu which we usually term as API This is usually used by ajax urls of Comcustom

jsonify(string $var)

No description

string
parseTaggable(string $string, string $tags = '@|#')

Parses a string which has tags like @username, #tag, @ugrp: @grp:, etc.

mixed
replaceTags(string $string, string $tags = null, array $replace = array('@grp:', '@ugrp:', '@', '#'), array $attributes = array())

parses the given string and replaces the @,#,@ugrp:,@grp: tags It will be a multidimensional array with keys as: , @grp: array of the com_community group ids , @ugrp: array of the the user group ids, @: array of all usernames, #: array of all hash tags

string
purifyHTML(string $html)

this function simply closes all the unclosed tags in the given html

string
getBackendAccessToken(string $component = null, int $userid = null)

From uKnowva 2.5.1 we are introducing a way using which admins can access backend of any component from front end itself through a token, these tokens can be passed in backend urls to access them, these tokens are temporary and are valid for only till the users session is valid, they are destroyed on logout this function generates a token that will be used to access the backend

string
getBackendAccessURL(string $component = null, int $userid = null)

generates a link for accessiing the backend of any component from front end

false|int
verifyBackendToken(string $token, string $component)

this function checks the provided token and validates it for the given component

destroyBackendTokens(int $userid = null)

this function destroys all the backend tokens created for this user in uKnowva

getAllowedComponentForBackendToken($token)

No description

referContact(string $email, string $name, string $contact, array $other_details = array(), int $userid = null)

This function triggers the uKnowva API to refer a new contact to us

updateUknowvaStats(string $stat, float $value)

This simply updates some statistcs in uKnowvaDB

getAllManagers($return_all = false)

this function returns all users who have some reportee with them .i.e. they are all managers

exportCSV(array $data, string $filename = null, boolean $return_file_path = false)

this function simply creates a CSV file as per the given data matrix and exports to the browser

exportExcel(array $data, string $filename = null, boolean $return_file_path = false)

this function simply creates a Excel 2007 file as per the given data matrix and exports to the browser

returns
getPluginParams($plugin_type, $plugin_name, $param_name, $default = null)

this function returns the params of plugins

hookUknowvaPlugin($type = null, $method = null, $arguments = array())

No description

loadPlugin($element, $type)

No description

isLocalInstallationURL($url)

No description

isValidRemoteInstallationURL($url)

No description

decodeInstallableFile($file)

No description

isDataValid($data, $validation_rule)

No description

getPluginGroups($cache = true)

No description

Details

in ConvHelper at line 23
number|boolean indexOf(mixed $needle, array $haystack)

searches an array for a value and returns the index of the first occurance

Parameters

mixed $needle value to be searched
array $haystack array to be searched in

Return Value

number|boolean gives index of array if value is present in array or false

in ConvHelper at line 48
mixed str_getcsv(string $input, string $delimiter = ',', string $enclosure = '"', unknown $escape = null, unknown $eol = null, string $return_first_line_only = true)

this functions gets the value from comma separated string

Parameters

string $input the comma separated string
string $delimiter ' is used for delimiter
string $enclosure " is used for enclosure
unknown $escape default = NULL
unknown $eol default, NULL
string $return_first_line_only if given true then it passes value of one row

Return Value

mixed gives the output string

in ConvHelper at line 73
mixed|NULL getFieldValue(string $colname, string $tablename, string $prikeyname, mixed $prikeyval)

gets field value from database

Parameters

string $colname column name of the table
string $tablename tablename of the database
string $prikeyname primary key name
mixed $prikeyval primary key value

Return Value

mixed|NULL gives data for a partcular column name in a table

in ConvHelper at line 91
createFile(string $opfilepath, string $seperator, array $rows)

creates a file

Parameters

string $opfilepath filepath
string $seperator data separator
array $rows array of rows to be in csv file

in ConvHelper at line 111
array getFieldsArray(string $dest, string $seperator, number $rownum)

gets the value from file

Parameters

string $dest destination of file
string $seperator data separator
number $rownum numbers of row, deafult = 0

Return Value

array gives the value of file in array

in ConvHelper at line 144
string forceDownload(string $filepath, string $prefix_separator = '-', string $filename = NULL)

helps this to force download a file

Parameters

string $filepath filepath to download
string $prefix_separator prefix separator,default = -
string $filename filename

Return Value

string calls the force_download function which downloads the file

in ConvHelper at line 158
boolean force_download(string $filepath, string $prefix_separator = '-', string $filename = NULL)

this function force downloads the file

Parameters

string $filepath filepath
string $prefix_separator prefix separator, default = -
string $filename filename, default = NULL

Return Value

boolean true|false

in ConvHelper at line 228
string removePrefix(string $string, string $prefix_separator)

removes the string characters till the first occurrence of prefix in the given string

Parameters

string $string string
string $prefix_separator prefix separator

Return Value

string gives the string

in ConvHelper at line 251
uploadFile(string $file, string $allowedExt = null, string $dest = null)

uploading of file

Parameters

string $file filename
string $allowedExt allowed extensions
string $dest destination of file, default = NULL

in ConvHelper at line 325
$string getSelectListFromArray(array $array, string $name, string $attributes = null, string $selectedval = NULL, string $select_text = null, int $id = false)

makes a HTML select list from given array

Parameters

array $array takes input of array to make its select list
string $name name of the list
string $attributes attributes of select list, default = NULL
string $selectedval select the default value, default = NUL
string $select_text select text
int $id id of the select list, default = false

Return Value

$string gives the select the list

in ConvHelper at line 363
$string getSelectListFromArrayValueCounter(array $array, string $name, string $attributes = null, string $selectedval = NULL)

makes a HTML select list from given array, but the value field would be the counter .

i.e rownum

Parameters

array $array takes input of array to make its select list
string $name name of the list
string $attributes attributes of select list, default = NULL
string $selectedval select the default value, default = NUL

Return Value

$string gives the select the list

in ConvHelper at line 387
string compress(string $buffer, string $stripempty = false)

compress the buffer

Parameters

string $buffer buffer for compression
string $stripempty if string empty, default = false

Return Value

string compressed string

in ConvHelper at line 418
boolean is_64bit()

checks for processor if its 64 bit or 32 bit

Return Value

boolean

in ConvHelper at line 438
JDate getCurrentTimeStamp()

gets current time stamp

Return Value

JDate current timestamp

in ConvHelper at line 450
boolean startsWith(string $haystack, string $needle)

checks the part of string for specific string from start

Parameters

string $haystack string to be searched in
string $needle string to search for

Return Value

boolean

in ConvHelper at line 463
boolean endsWith(string $haystack, string $needle)

checks the part of string for specific string from end

Parameters

string $haystack string to be searched in
string $needle string to search for

Return Value

boolean

in ConvHelper at line 473
mixed getAllAdminGroups()

gets all the admin groups

Return Value

mixed gives admin groups

in ConvHelper at line 489
boolean isAdminUser(int $userid = null)

checks if the user is admin

Parameters

int $userid by default gets the current user id automatically or else give the id

Return Value

boolean

in ConvHelper at line 503
boolean isSuperAdminUser(int $userid = null)

checks if the user is super admin

Parameters

int $userid by default gets the current user id automatically or else give a id

Return Value

boolean

in ConvHelper at line 516
NULL|mixed getSuperAdminUser(string $details = false)

gets the super admin users

Parameters

string $details if details is set to true, the users details shall also be sent,defaul, = false

Return Value

NULL|mixed gives detail

in ConvHelper at line 531
boolean isAdmin(int $userid, array $admin_groups, string $group_ids_passed = false)

check if given user is admin

Parameters

int $userid userid
array $admin_groups admin groups id's
string $group_ids_passed if groupidspassed = true then the admin_groups is an array of groupids and not their names,default = false

Return Value

boolean

in ConvHelper at line 568
NULL|mixed|mixed[] getAllAdmins($admin_groups = null, $limit)

get all admins, admin_group ids to be passed here

Parameters

$admin_groups
$limit

Return Value

NULL|mixed|mixed[] passes the values to ConvHelper::getUsersInGroups function

in ConvHelper at line 587
NULL|mixed|NULL|mixed[] getUsersInGroups(mixed $groups, number $limit, string $include_subgroups = true)

gets all users in a specific groups

Parameters

mixed $groups provide the group id or name
number $limit limits the output, default = 0
string $include_subgroups $include_subgroups = true, then the subgroups of the specified groups shall also be considered

Return Value

NULL|mixed|NULL|mixed[] gives the array of the users in group

in ConvHelper at line 628
boolean|mixed setUserParam(string $param_name, mixed $param_value, int $userid = null)

set the user param

Parameters

string $param_name user param name to be set
mixed $param_value user param value to be set
int $userid user id

Return Value

boolean|mixed returns true if set or else false if some problem

in ConvHelper at line 669
mixed getUserParam(string $param_name, int $userid = null)

gets the user param

Parameters

string $param_name param name
int $userid user id, default = NULL

Return Value

mixed gets the user param

in ConvHelper at line 705
string encode_string(string $string)

encodes the string, using base64_encoder

Parameters

string $string provide a string to encode

Return Value

string returns the encoded string

in ConvHelper at line 715
string decode_string(string $string)

decodes the string, using base64_decoder

Parameters

string $string provide a string to decode

Return Value

string returns the decoded string

in ConvHelper at line 725
mixed|NULL|array getAllParamsOfCurrentUser(int $userid = null)

gets all params of current user

Parameters

int $userid provide user id or it gets the current user id automatocally, default = NULL

Return Value

mixed|NULL|array give the user params of the user

in ConvHelper at line 763
string getToken(string $view, number $len = 16)

generates the token, eg:- for file download

Parameters

string $view name of the view
number $len length of token, default = 16

Return Value

string gives the token

in ConvHelper at line 782
string getRandomText(number $len = 8)

generates random text

Parameters

number $len length of random text to generate

Return Value

string $token gives the random, text

in ConvHelper at line 872
boolean checkToken(string $token, string $view)

checks the token

Parameters

string $token value of token
string $view name of view

Return Value

boolean true if present or else falses

in ConvHelper at line 898
deleteTokens(string $key, int $value)

deletes the token

Parameters

string $key value of key
int $value value will actually be userid

in ConvHelper at line 915
mixed createTree(array $list, mixed $parent, string $id_column = 'id')

creates a tree from a list and parent relationship

Parameters

array $list array of values
mixed $parent array of parent values
string $id_column column id, default = id

Return Value

mixed returns tree

in ConvHelper at line 940
array parseTree(string $node, array $options, number $level, string $id_column = 'id', string $title_column = 'title')

parses the tree, used by the uKnowvaUI::treeselect mainly

Parameters

string $node node of the tree
array $options takes an array
number $level limits the output level
string $id_column id of the column
string $title_column title of the column

Return Value

array $options returns array which is dropdown list

in ConvHelper at line 969
boolean|string create_scaled_image(string $file_path, array $options, string $prefix = null)

creates scaled image

Parameters

string $file_path filepath of the image
array $options options should be an array with key as maxwidth and maxheight
string $prefix if prefix provide value, default = NULL

Return Value

boolean|string path of the created scaled image file

in ConvHelper at line 1022
boolean validip(string $ip)

checks for valid IP addresses

Parameters

string $ip IP address

Return Value

boolean true if valid address or false

in ConvHelper at line 1077
string getIP()

gets the users IP address

Return Value

string IP address

in ConvHelper at line 1112
mixed|boolean|unknown getUknowvaAccountDetails(string $format = 'json', number $current_count)

Gets the Uknowva Account Details

Parameters

string $format to get the ouput in json decoded value or json encoded value, default = json decoded
number $current_count count of total users on this instance of uknowva

Return Value

mixed|boolean|unknown gives the values of the Uknowva account

in ConvHelper at line 1139
boolean allowUserRegistration(string $send_reminder = false)

Parameters

string $send_reminder default = false

Return Value

boolean returns true if limit has been reached and returns false if not. This also sends out email to admins if the limit is going to be reached if send_reminder is true

in ConvHelper at line 1211
gets getCurrentUserCount()

Gets the current user count

Return Value

gets the array of all the result

in ConvHelper at line 1229
boolean is_valid_email(string $email)

checks if the email is valid

Parameters

string $email provide a email to check is valid or not

Return Value

boolean true if valid or else false

in ConvHelper at line 1248
string getComponentItemId(string $component_name, string $strict = false, string $return_current = true)

Gets the component Item ID

Parameters

string $component_name name of the component
string $strict true means an exact match would be attempted
string $return_current false means do not return the current itemid if nothing found

Return Value

string gives the id of the compoenents

in ConvHelper at line 1297
string getUserSnapShot(int $userid = null, string $include_thumbnail = true, string $linkprofile = true, string $open_link_in_new_window = true)

returns a user snapshot html to display in your view, returns anonymous for no user found

Parameters

int $userid user id
string $include_thumbnail to include thumbnail, default = true
string $linkprofile to link profile in html or not ,default = true
string $open_link_in_new_window to open link in new window, default = true

Return Value

string HTML output

Gets the user profile link

Parameters

int $userid ID of the user

Return Value

gives out the user profile link in html

in ConvHelper at line 1340
gets getUserDetails(int $userid)

Get user Details

Parameters

int $userid ID of the user

Return Value

gets the user details

in ConvHelper at line 1380
array toTokenUserFormat(mixed|array $ids)

required for jquery tokens

Parameters

mixed|array $ids user ids

Return Value

array gives the array of user id details in array

in ConvHelper at line 1406
Gives toTokenKnowledgeFormat(mixed|array $ids)

Get Knowledge topic details returns an object which shall be json encoded

Parameters

mixed|array $ids user ids

Return Value

Gives the Knowledge Topic Details of the ID's

in ConvHelper at line 1420
array getAllUserGroups(array $exclude = array())

Get All User Groups

Parameters

array $exclude exclude groups

Return Value

array gives all the group values in array

in ConvHelper at line 1436
getSystemFolder()

Get System Folder

in ConvHelper at line 1485
string getDocsFolderPath()

get Root folder path for docs

Return Value

string gives the root path for docs

in ConvHelper at line 1495
string getAllowedHostsForCron()

returns an array of valid hosts that can run cron

Return Value

string server IP's

in ConvHelper at line 1538
string getSizeText(int $size, string $format = 'auto')

Gets the Size in text

Parameters

int $size give the size
string $format size formats like KB,MB and GB, default = auto

Return Value

string text of the size

in ConvHelper at line 1577
string getTimeText(int $seconds, number $granularity)

function to convert seconds into human readable text like 5 days, 1 hour, 5 mins, 2 seconds, etc

Parameters

int $seconds the time in seconds
number $granularity if granularity = 1, seconds will be skipped 2, mins will be skipped 3, hours will be skipped

Return Value

string time in human readable format

in ConvHelper at line 1630
string formatDate(mixed|string $date, string $format = null)

formating date

Parameters

mixed|string $date input date
string $format format of date default = NULL

Return Value

string gives the formated date

in ConvHelper at line 1653
array getAllSuperiors(int $userid, string $includeadmins = false, array $groups = array())

Gets All the Superiors

Parameters

int $userid User ID
string $includeadmins to include admin or not ,Default = false
array $groups array of group ID's

Return Value

array give all the superior

in ConvHelper at line 1706
boolean isSuperior(int $subordinate, int $superior = null, string $checkadmins = true)

check if superior or not

Parameters

int $subordinate subordinate ID
int $superior superior ID or it takes automatically current user in superior variable
string $checkadmins default = true

Return Value

boolean true is yes or else false

in ConvHelper at line 1726
boolean isImmediateSuperior(int $subordinate, int $superior = null)

checks for immediate superiors

Parameters

int $subordinate subordinate ID
int $superior superior ID or else takes current user's id, Default = null

Return Value

boolean true if in array or else false

in ConvHelper at line 1738
mixed|array getImmediateSuperiors(int $userid = null, array $groups = array())

If groups are passed, then user's belonging to the specified groups only shall be returned

Parameters

int $userid user id or else takes current user automatically default = NULL
array $groups array of groups ID's

Return Value

mixed|array gives superiors

in ConvHelper at line 1780
gives getAllSubordinates(int $userid, array $groups = array(), $keyword = null)

Get All Subordinates

Parameters

int $userid User ID
array $groups are the user groups which should be considered
$keyword checks of similar name, username, email

Return Value

gives all suboridnates

in ConvHelper at line 1845
boolean isSubordinate(int $superior, int $subordinate, string $checkadmins = true)

checks if subordinate or not

Parameters

int $superior superior ID
int $subordinate subordinate ID
string $checkadmins to check with admins or not, default = true

Return Value

boolean true if is subordinate or else false

in ConvHelper at line 1863
getImmediateSubordinates($userid = null, $groups = array())

gets the immediate subordinates of the user

Parameters

$userid
$groups

in ConvHelper at line 1905
mixed makeXMLRPCcall(string $xmlrpc_server_url, string $xmlrpc_method, array $xmlrpc_parameters = array())

Make XMLRPC Call

Parameters

string $xmlrpc_server_url XMLRPC Server URL
string $xmlrpc_method Method to use with XMLRPC Server
array $xmlrpc_parameters array of parameter to pass to XMLRPC Server

Return Value

mixed return xmlrpc decoded data

in ConvHelper at line 1935
boolean|boolean|mixed getContentFromURL($url, $timeout = 5, $echo_errors = false)

To get content from URL, this function uses callCURL which interacts with the URL usually to get CSS as string, etc , timeout is the time (in seconds) for which the script should wait to get content

Parameters

$url
$timeout
$echo_errors

Return Value

boolean|boolean|mixed gets the content from the URL

in ConvHelper at line 1957
boolean|mixed callCURL(array $parameters, string $echo_errors = false)

Calls a URL

Parameters

array $parameters parameter to pass with the URL
string $echo_errors if $echo errors is true, errors would be echoed, else they would be logged

Return Value

boolean|mixed gives the data returned from the CURL call

in ConvHelper at line 2002
string convertExternalCSStoInline(string $html)

Converts External CSS to Inline

Parameters

string $html provide HTML input

Return Value

string return the converted Inline CSS

in ConvHelper at line 2015
boolean storeNotification(string|int $data)

Store Notification icon can be an image path, read = 1 if the notification is read $data['type'] should contain values like comfillcalendar.eventid

Parameters

string|int $data data to store

Return Value

boolean True is succeed or else false

in ConvHelper at line 2077
addNotification(int $user_id, string $content, string $type = null, string $link = null, string $icon = null, string $readonlyonce = true)

this function sends a notification to the user ConvHelper::markotificationRead or ConvHelper::markotificationReadForAll set this as false, when you want to keep reminding the user about a particular task untill he/she does it, example: approving/rejecting a leave

Parameters

int $user_id is the user to whom the notification needs to be sent....it can be a single id or array of userids
string $content is the notification content
string $type is the type, make sure this is unique as uKnowva groups the notifications based on this param so if two notifications have same type, they will be grouped into 1
string $link is the link to which the user will be taken when he/she clicks on the notification's icon
string $icon is the image url which will be shown, you can set it to thumbAvatars of sending use using this function uKnowvaFactory::getUser($userid)->getThumbAvatar()
string $readonlyonce if kept false, the notification will never go off unless the user manually marks it as read or it is marked as read from code using the functions like

in ConvHelper at line 2111
boolean|mixed markNotificationRead(array $type, int $user_id = null, string $strict = false)

Marks Notification Read

Parameters

array $type anything unique depends on developer
int $user_id User ID or else takes Current User ID Automatically,default = NULL
string $strict if passed true it will only pop once, default = false

Return Value

boolean|mixed true if succeed or else false

in ConvHelper at line 2137
boolean|mixed markNotificationReadForAll(array $type, string $strict = true)

Mark Notification Read for All

Parameters

array $type anything unique depends on developer
string $strict if passed true it will only pop once, default = false

Return Value

boolean|mixed true if succeed or else false

in ConvHelper at line 2154
boolean|mixed markNotificationReadById(array $ids)

Mark Notification Read by ID

Parameters

array $ids ID's in array to be marked read

Return Value

boolean|mixed true if succeed or else false

in ConvHelper at line 2170
boolean|mixed deleteNotifications(array $type)

Delete Notification, This is where type is important

Parameters

array $type delete the type which you provided earlier

Return Value

boolean|mixed true if succeed or else false

in ConvHelper at line 2186
boolean|mixed deleteNotificationsById(array $ids)

Delete Notifications By ID, This is where type is important

Parameters

array $ids User ID's to delete their Notification

Return Value

boolean|mixed true if succeed or else false

in ConvHelper at line 2208
mixed|NULL getGlobalNotifications(int $user_id = null, string $return_count = false, string $startdate = null)

this function gets the global notifications of a particular user

Parameters

int $user_id provide User ID or else gets current User ID automatically
string $return_count If return_count=true, then it will just return the count of notifications, default = false
string $startdate is the date from when we should look for notification

Return Value

mixed|NULL gives the object list of data

in ConvHelper at line 2244
sendMail(array|string $users, string $subject, string $body, string $templateFile = '', string $params = '', number $status, string $email_type = '')

Send Mail to users

Parameters

array|string $users array of users
string $subject subject of the mail
string $body body of the mail
string $templateFile any template file, default templateFile = ''
string $params params , default params = ''
number $status status, default status = 0
string $email_type email type, default email_type = ''

in ConvHelper at line 2279
array key2Value(array $array = array())

Converts all keys of an array to values and vice versa

Parameters

array $array array of keys

Return Value

array gives array of values

in ConvHelper at line 2299
array|mixed getComponentParam(string $component, string $param, string $default = null)

Gets Component Param

Parameters

string $component Component Name
string $param params to pass
string $default defaults of the component, default default = NULL

Return Value

array|mixed gives params of the component

returns the logo of the current template uKnowva themese usually have a parameter called logo, this function simply returns the path of the logo

Parameters

string $template name of the template, if not then the system will get the current template
int $client_id if 0 means site, else admin section

in ConvHelper at line 2348
notifySupport(string $subject, string $message, string $to = 'support@uknowva.com')

returns the value from jomsocial custom fields notifies convergence support desk in case of any issues noticed Simple function to raise a support request instantly

Parameters

string $subject subject of the email
string $message message in the email
string $to to send the email to, default sends the email to support@uknowva.com for help

in ConvHelper at line 2367
boolean|string zip(string|array $files, string $destination = null)

Zip a file

Parameters

string|array $files array of files or single file
string $destination destination of the files

Return Value

boolean|string returns the destination of the made zip file

in ConvHelper at line 2402
boolean file_replace(string $find, string $replace, string $file)

replace a text in a file

Parameters

string $find string to find
string $replace string to replace
string $file file path

Return Value

boolean returns true if succeed or else error message

in ConvHelper at line 2429
array getUserFromUsername(string $username, string $profile_fields = true, string $show_blocked = false)

Gets the details of user and his profile from username, It returns an array and not an object

Parameters

string $username username
string $profile_fields if profile fields is set to false, it will not return any profile fields
string $show_blocked if Show blocked is true, it will return the user object even if the user is blocked

Return Value

array returns the array of data

in ConvHelper at line 2471
array getUserFromID(int $userid, string $profile_fields = true, string $show_blocked = false)

Gets the details of user and his profile from user id, It returns an array and not an object

Parameters

int $userid User ID
string $profile_fields if profile fields is set to false, it will not return any profile fields
string $show_blocked if Show blocked is true, it will return the user object even if the user is blocked

Return Value

array details of user and his profile in array

in ConvHelper at line 2511
boolean findAccessLevel(array $groups)

Find the access level from the group ids passed If no such access level exists, then a new access level shall be created with front end login permission

Parameters

array $groups groups should be an array of group ids

Return Value

boolean returns false if there is sme issue with the groups array

in ConvHelper at line 2566
mixed|NULL|mixed[] getAllGroups(array $groups = array(), string $title_only = false, string $exclude_super_users = false)

gets all the groups names

Parameters

array $groups If grousp array is passed then only those groups which are passed in the array are returned
string $title_only to select title only from database, default = false
string $exclude_super_users to exclude super users or not, default = false

Return Value

mixed|NULL|mixed[] It returns an associative array with key as id and value as row

in ConvHelper at line 2596
mixed|mixed|NULL|unknown[]|mixed[] getAllAccessLevels(string $include_public = false)

Get All Access Levels

Parameters

string $include_public , default = false

Return Value

mixed|mixed|NULL|unknown[]|mixed[]

in ConvHelper at line 2633
gets getUsersFromAccessLevel(int $id)

gets all users from a particular access level

Parameters

int $id User ID

Return Value

gets user from a particular access level

in ConvHelper at line 2645
mixed|boolean|mixed|NULL getAccessLevelDetails(int $id)

gets the details of the access level

Parameters

int $id User ID

Return Value

mixed|boolean|mixed|NULL gives the details of the access level

in ConvHelper at line 2677
getAdminAccessLevel()

returns the access view level with the rules as admin groups

in ConvHelper at line 2685
getGroupsFromACL(int $level)

Gets Groups from Access Control List

Parameters

int $level user ID

in ConvHelper at line 2696
gets getSessionToken()

For web service call from user app store, we pass tokens to uknowva website and uknowva website in turn calls checkSessionToken at our end, to authenticate the user

Return Value

gets session token

in ConvHelper at line 2709
boolean|mixed checkSessionToken(string $token, string $return_profile_fields = true)

Checks Session Token

Parameters

string $token takes users token
string $return_profile_fields is true, the users profile fields will also be returned

Return Value

boolean|mixed returns false or else return array of user

gets the store link of uKnowva app store

Parameters

array $params Params is an array of request variables you would like to pass

Return Value

string URL of the uknowva extension store

in ConvHelper at line 2782
string getUknowvaStoreAnchor($params = array(), $class = 'extstore', $label = 'Extensions store', $attributes = array(), $pretext = null)

Gets the uKnowva Store Anchor

Parameters

$params
$class
$label
$attributes
$pretext

Return Value

string return anchor tag with extension store link will open in iframe

in ConvHelper at line 2808
string[] getSearchAreas()

Gets the accessible search areas to the current users

Return Value

string[] Returns an associative array

in ConvHelper at line 2825
array makeAssociative(array $array)

makes an associative array associative by having same key as value

Parameters

array $array array of keys

Return Value

array makes an associative array

in ConvHelper at line 2845
array transposeArray(array $data)

convert rows to cols and cols to rows

Parameters

array $data array of data

Return Value

array column would be row or else vice-versa

in CustomHelper at line 121
getCustomizableMenuTypes()

allowed menu types to add menu items from front end

in ConvHelper at line 2876
getFromCache(string $cacheid, string $group)

generic function to get and set in uKnowva cache

Parameters

string $cacheid cache ID
string $group group name

in ConvHelper at line 2896
setInCache(string $result, string $cacheid, string $group)

function to cache data or content Make sure the result is not serialized, else it will be again serialized

Parameters

string $result content to be cached
string $cacheid cache ID
string $group Group name

in ConvHelper at line 2917
reportErrorToUknowva(string $subject, string $message, string $type = 'General')

sends an error report to uKnowva server through its API

Parameters

string $subject is the subject of the error
string $message is the error description in detail
string $type Could be DB, Execution, Rendering, etc.

in ConvHelper at line 2948
string|mixed linkify(string $string, string $noFollow = false, string $newWindow = false)

Parses a string to check if it has any URLs and if there are any, it adds an anchor tag

Parameters

string $string string to parse
string $noFollow to tell crawlers not to crawl ,default = false
string $newWindow to open it in new windows, default = false

Return Value

string|mixed URL with anchor tag

in ConvHelper at line 2961
string getTimeLapsed(string $from)

gets the time lapsed text between two dates Gives text like 15 days ago, 10 seconds ago, moment ago, etc

Parameters

string $from date

Return Value

string return the lapsed time text

in ConvHelper at line 2981
strip_selected_tags(string $text, string $tags = 'iframe,script', string $keepcontent = false)

Strip selected tags

Parameters

string $text is the text with tags, strip selected tags only unline PHP's strip tags which simply strips all tags excluding a few
string $tags could be an array or a comma separated list
string $keepcontent if this is true, then only the tag shall be removed, the content in the tag will remain as it is

in ConvHelper at line 3016
static subStrWord(string $string, number $length = 100, number $start, string $trailingWith = '', string $wordseparator = ' ')

it limits on basis of words and not characters word limited as discussed here: http://network.convergenceservices.in/forum/19-php/4118-short-description-without-stripping-words.html#4118

Parameters

string $string is your string to be limited
number $length is the number of characters to limit
number $start is the place to start with in the string
string $trailingWith will add a text at the end like a ...
string $wordseparator is the character which separates the words

in ConvHelper at line 3035
static subStrHtml(string $string, number $length = 100, number $start, string $trailingWith = '', string $wordseparator = ' ')

it limits on basis of words and not characters, plus it also make sure the HTML structure is retained For example, if the word truncation outputs a string withouth the closing tags, then this will automatically add the closing tags and return a string

Parameters

string $string is your string to be limited
number $length is the number of characters to limit
number $start is the place to start with in the string
string $trailingWith will add a text at the end like a ...
string $wordseparator is the character which separates the words

in ConvHelper at line 3048
boolean|string getUserSnapShots(array $users, string $delimiter = '')

This function parses the parameter users and returns multiple users snapshots

Parameters

array $users is the array of users or the comma separated and ' encoded string
string $delimiter is the final delimiter between each snapshot, could be , | ar an html string too

Return Value

boolean|string returns multiple users snapshots

in ConvHelper at line 3066
string getAPIItemid()

gets the item id for comcustom menu which we usually term as API This is usually used by ajax urls of Comcustom

Return Value

string returns the API item id

in ConvHelper at line 3078
jsonify(string $var)

Parameters

string $var

in ConvHelper at line 3101
string parseTaggable(string $string, string $tags = '@|#')

Parses a string which has tags like @username, #tag, @ugrp: @grp:, etc.

Parameters

string $string is the string that needs to be parses
string $tags which needs to be parses @ tags or # tags or both

Return Value

string returns an multidimensional array with keys as: @grp:, array of the com_community group ids @ugrp:, array of the the user group ids @: array of all usernames, #: array of all hash tags

in ConvHelper at line 3131
mixed replaceTags(string $string, string $tags = null, array $replace = array('@grp:', '@ugrp:', '@', '#'), array $attributes = array())

parses the given string and replaces the @,#,@ugrp:,@grp: tags It will be a multidimensional array with keys as: , @grp: array of the com_community group ids , @ugrp: array of the the user group ids, @: array of all usernames, #: array of all hash tags

Parameters

string $string is the string that needs to be parses
string $tags (passed by reference so that u can use its value in calling script too after callign this function) this will have the list of tags which the calling script an use for further processing like sending notifications to users, groups, etc
array $replace is the types of tags u want to replace, @, @grp: @ugrp: # or all
array $attributes is the attributes that will be added the the anchor tags

Return Value

mixed returns the tags replaced string with the required links

in ConvHelper at line 3142
string purifyHTML(string $html)

this function simply closes all the unclosed tags in the given html

Parameters

string $html is the impure html

Return Value

string returns the purified html

in ConvHelper at line 3159
string getBackendAccessToken(string $component = null, int $userid = null)

From uKnowva 2.5.1 we are introducing a way using which admins can access backend of any component from front end itself through a token, these tokens can be passed in backend urls to access them, these tokens are temporary and are valid for only till the users session is valid, they are destroyed on logout this function generates a token that will be used to access the backend

Parameters

string $component name of the component
int $userid the user id for which the token needs to be generated

Return Value

string the token or false in case of error

in ConvHelper at line 3218
string getBackendAccessURL(string $component = null, int $userid = null)

generates a link for accessiing the backend of any component from front end

Parameters

string $component name of the component
int $userid the user id for which the token needs to be generated

Return Value

string the URL or false in case of error

in ConvHelper at line 3232
false|int verifyBackendToken(string $token, string $component)

this function checks the provided token and validates it for the given component

Parameters

string $token the token to be validated
string $component the component for which the token needs to be validated

Return Value

false|int false in case of failure and userid of the corresponding token in case of success

in ConvHelper at line 3264
destroyBackendTokens(int $userid = null)

this function destroys all the backend tokens created for this user in uKnowva

Parameters

int $userid the useris of which the tokens need to be destroyed

in ConvHelper at line 3270
getAllowedComponentForBackendToken($token)

Parameters

$token

in ConvHelper at line 3290
referContact(string $email, string $name, string $contact, array $other_details = array(), int $userid = null)

This function triggers the uKnowva API to refer a new contact to us

Parameters

string $email email id of the reference
string $name name of the reference
string $contact contact number of the reference
array $other_details any other information u wish to send
int $userid the id of the user .i.e. referer

in ConvHelper at line 3317
updateUknowvaStats(string $stat, float $value)

This simply updates some statistcs in uKnowvaDB

Parameters

string $stat your statistic value like invoices created, leaves managed, etc
float $value the value of the statistic

in ConvHelper at line 3335
getAllManagers($return_all = false)

this function returns all users who have some reportee with them .i.e. they are all managers

Parameters

$return_all

in ConvHelper at line 3372
exportCSV(array $data, string $filename = null, boolean $return_file_path = false)

this function simply creates a CSV file as per the given data matrix and exports to the browser

Parameters

array $data data
string $filename name of the file
boolean $return_file_path if true, then this function will return the path of the file, else it will just output the file and exit

in ConvHelper at line 3381
exportExcel(array $data, string $filename = null, boolean $return_file_path = false)

this function simply creates a Excel 2007 file as per the given data matrix and exports to the browser

Parameters

array $data data
string $filename name of the file
boolean $return_file_path if true, then this function will return the path of the file, else it will just output the file and exit

in ConvHelper at line 3389
returns getPluginParams($plugin_type, $plugin_name, $param_name, $default = null)

this function returns the params of plugins

Parameters

$plugin_type
$plugin_name
$param_name
$default

Return Value

returns the value of params

in CustomHelper at line 16
hookUknowvaPlugin($type = null, $method = null, $arguments = array())

Parameters

$type
$method
$arguments

in CustomHelper at line 54
loadPlugin($element, $type)

Parameters

$element
$type

in CustomHelper at line 92
isLocalInstallationURL($url)

Parameters

$url

in CustomHelper at line 95
isValidRemoteInstallationURL($url)

Parameters

$url

in CustomHelper at line 103
decodeInstallableFile($file)

Parameters

$file

in CustomHelper at line 127
isDataValid($data, $validation_rule)

Parameters

$data
$validation_rule

in CustomHelper at line 144
getPluginGroups($cache = true)

Parameters

$cache