PHP Class Account, generatedata

Inheritance: extends apiModel
显示文件 Open project: benkeen/generatedata Class Usage Examples

Public Methods

Method Description
__construct ( mixed $accountID ) Instantiates a user account. This is passed either "anonymous" or the Account ID as the constructor parameter. User account login is done via the login method below.
checkAccountExists ( $email ) : boolean Helper function to determine if a user account exists, as determined by their email address.
copyConfiguration ( $data )
createAccount ( $accountInfo, boolean $isCurrentUser = false ) : integer Used (currently) in the installation script. Note: this function relies on the settings file having been defined, along with an arbitrary encryption salt.
deleteAccount ( $accountID )
deleteConfigurations ( $configurationIDs )
getAccount ( )
getAccountID ( )
getAccountType ( )
getConfigurations ( ) As of 3.2.1, configurations are now backed up for every time the user clicks save. This method continues to work the same, but only returns the most recent configuration version from the history table.
getCountryPlugins ( ) Returns the subset of Country plugins selected by this user.
getDataSetHistory ( $configurationID )
getDataTypePlugins ( ) Returns the subset of Data Type plugins selected by this user.
getDefaultExportType ( ) With 3.2.2, users can now customize the plugins they want to use, so Core::getDefaultExportType() is no longer sufficient to figure out what tab should be selected in the UI on page load. This is now used instead.
getExportTypePlugins ( ) Returns the subset of Export Type plugins selected by this user.
getPublicDataSet ( $configurationID ) Loads ANY public data set.
getSelectedCountries ( )
getSelectedDataTypes ( )
getSelectedExportTypes ( )
getUsers ( )
isAdmin ( )
isAnonymousAdmin ( )
login ( $email, $password ) Attempts to log a user in. If successful, it updates sessions and returns a success message; otherwise, just returns the appropriate error
logout ( )
resetPassword ( $email )
saveConfiguration ( $data )
saveDataSetVisibilityStatus ( $configurationID, $status, $time ) Time is currently passed but not used. It's going to be used to ensure that only NEWEST requests actually update the record
updateAccount ( $accountID, $info )
updateAccountByAdmin ( $info ) called by administrators to update a user's account
updateRowsGeneratedCount ( $configurationID, $rowsGenerated )
updateSelectedPlugins ( $accountID, $dataTypes, $exportTypes, $countries )

Private Methods

Method Description
getCurrentUser ( $accountID ) Called by the constructor and any time the user updates his/her user account.
truncateDataSetHistory ( $configurationID ) Called after every save. This ensures the size of the history is truncated to whatever value is set (see the $maxDataSetHistorySize setting in Core.

Method Details

__construct() public method

Instantiates a user account. This is passed either "anonymous" or the Account ID as the constructor parameter. User account login is done via the login method below.
public __construct ( mixed $accountID )
$accountID mixed

checkAccountExists() public static method

Helper function to determine if a user account exists, as determined by their email address.
public static checkAccountExists ( $email ) : boolean
$email
return boolean

copyConfiguration() public method

public copyConfiguration ( $data )

createAccount() public static method

Used (currently) in the installation script. Note: this function relies on the settings file having been defined, along with an arbitrary encryption salt.
public static createAccount ( $accountInfo, boolean $isCurrentUser = false ) : integer
$accountInfo
$isCurrentUser boolean
return integer

deleteAccount() public method

public deleteAccount ( $accountID )

deleteConfigurations() public method

public deleteConfigurations ( $configurationIDs )

getAccount() public method

public getAccount ( )

getAccountID() public method

public getAccountID ( )

getAccountType() public method

public getAccountType ( )

getConfigurations() public method

As of 3.2.1, configurations are now backed up for every time the user clicks save. This method continues to work the same, but only returns the most recent configuration version from the history table.
public getConfigurations ( )

getCountryPlugins() public method

Returns the subset of Country plugins selected by this user.
public getCountryPlugins ( )

getDataSetHistory() public method

public getDataSetHistory ( $configurationID )

getDataTypePlugins() public method

Returns the subset of Data Type plugins selected by this user.
public getDataTypePlugins ( )

getDefaultExportType() public method

With 3.2.2, users can now customize the plugins they want to use, so Core::getDefaultExportType() is no longer sufficient to figure out what tab should be selected in the UI on page load. This is now used instead.

getExportTypePlugins() public method

Returns the subset of Export Type plugins selected by this user.

getPublicDataSet() public method

Loads ANY public data set.
public getPublicDataSet ( $configurationID )

getSelectedCountries() public method

getSelectedDataTypes() public method

getSelectedExportTypes() public method

getUsers() public method

public getUsers ( )

isAdmin() public method

public isAdmin ( )

isAnonymousAdmin() public method

public isAnonymousAdmin ( )

login() public static method

Attempts to log a user in. If successful, it updates sessions and returns a success message; otherwise, just returns the appropriate error
public static login ( $email, $password )

logout() public static method

public static logout ( )

resetPassword() public static method

public static resetPassword ( $email )

saveConfiguration() public method

public saveConfiguration ( $data )

saveDataSetVisibilityStatus() public method

Time is currently passed but not used. It's going to be used to ensure that only NEWEST requests actually update the record
public saveDataSetVisibilityStatus ( $configurationID, $status, $time )

updateAccount() public method

public updateAccount ( $accountID, $info )

updateAccountByAdmin() public method

called by administrators to update a user's account
public updateAccountByAdmin ( $info )

updateRowsGeneratedCount() public method

public updateRowsGeneratedCount ( $configurationID, $rowsGenerated )

updateSelectedPlugins() public static method

public static updateSelectedPlugins ( $accountID, $dataTypes, $exportTypes, $countries )