Open Journal Systems  3.3.0
PKP\Services\PKPContextService Class Reference
Inheritance diagram for PKP\Services\PKPContextService:
APP\Services\ContextService

Public Member Functions

 add ($context, $request)
 
 delete ($context)
 
 edit ($context, $params, $request)
 
 get ($contextId)
 
 getCount ($args=[])
 
 getFullProperties ($context, $args=null)
 
 getIds ($args=[])
 
 getMany ($args=array())
 
 getManySummary ($args=[])
 
 getMax ($args=array())
 
 getProperties ($context, $props, $args=null)
 
 getQueryBuilder ($args=array())
 
 getSummaryProperties ($context, $args=null)
 
 moveTemporaryFile ($context, $temporaryFile, $fileNameBase, $userId, $localeKey='')
 
 restoreLocaleDefaults ($context, $request, $locale)
 
 validate ($action, $props, $allowedLocales, $primaryLocale)
 

Data Fields

 $contextsFileDirName
 
 $installFileDirs
 

Protected Member Functions

 _saveFileParam ($context, $value, $settingName, $userId, $localeKey='', $isImage=false)
 

Detailed Description

Definition at line 30 of file PKPContextService.inc.php.

Member Function Documentation

◆ _saveFileParam()

PKP\Services\PKPContextService::_saveFileParam (   $context,
  $value,
  $settingName,
  $userId,
  $localeKey = '',
  $isImage = false 
)
protected

Handle a context setting for an uploaded file

  • Moves the temporary file to the public directory
  • Resets the param value to what is expected to be stored in the db
  • If a null value is passed, deletes any existing file

This method is protected because all operations which edit contexts should go through the add and edit methods in order to ensure that the appropriate hooks are fired.

Parameters
$contextContext The context being edited
$valuemixed The param value to be saved. Contains the temporary file ID if a new file has been uploaded.
$settingNamestring The name of the setting to save, typically used in the filename.
$userIdinteger ID of the user who owns the temporary file
$localeKeystring Optional. Used in the filename for multilingual properties.
$isImageboolean Optional. For image files which return alt text, width, height, etc in the param value.
Returns
string|array|null New param value or null on failure

Definition at line 614 of file PKPContextService.inc.php.

References Core\getCurrentDate().

Referenced by APP\Services\ContextService\afterEditContext().

◆ add()

PKP\Services\PKPContextService::add (   $context,
  $request 
)

◆ delete()

PKP\Services\PKPContextService::delete (   $context)

◆ edit()

PKP\Services\PKPContextService::edit (   $context,
  $params,
  $request 
)

Definition at line 424 of file PKPContextService.inc.php.

References HookRegistry\call().

◆ get()

PKP\Services\PKPContextService::get (   $contextId)

Definition at line 53 of file PKPContextService.inc.php.

References Application\getContextDAO().

◆ getCount()

PKP\Services\PKPContextService::getCount (   $args = [])

◆ getFullProperties()

PKP\Services\PKPContextService::getFullProperties (   $context,
  $args = null 
)

◆ getIds()

PKP\Services\PKPContextService::getIds (   $args = [])

◆ getMany()

PKP\Services\PKPContextService::getMany (   $args = array())

Get a collection of Context objects limited, filtered and sorted by $args

Parameters
array$args{ @option bool isEnabled @option int userId @option string searchPhrase @option int count @option int offset }
Returns
Iterator

Definition at line 100 of file PKPContextService.inc.php.

References Application\getContextDAO(), and PKP\Services\PKPContextService\getQueryBuilder().

◆ getManySummary()

PKP\Services\PKPContextService::getManySummary (   $args = [])

Get a summary of context information limited, filtered and sorted by $args.

This is faster than getMany if you don't need to retrieve all the context settings. It returns the data from the main table and the name of the context in its primary locale.

See also
self::getMany()
Returns
array

Definition at line 83 of file PKPContextService.inc.php.

References PKP\Services\PKPContextService\getQueryBuilder().

◆ getMax()

PKP\Services\PKPContextService::getMax (   $args = array())

◆ getProperties()

PKP\Services\PKPContextService::getProperties (   $context,
  $props,
  $args = null 
)

◆ getQueryBuilder()

◆ getSummaryProperties()

PKP\Services\PKPContextService::getSummaryProperties (   $context,
  $args = null 
)

◆ moveTemporaryFile()

PKP\Services\PKPContextService::moveTemporaryFile (   $context,
  $temporaryFile,
  $fileNameBase,
  $userId,
  $localeKey = '' 
)

Move a temporary file to the context's public directory

Parameters
$contextContext
$temporaryFileTemporaryFile
$fileNameBasestring Unique identifier to use for the filename. The Extension and locale will be appended.
$userIdint ID of the user who uploaded the temporary file
$localeKeystring Example: en_US. Leave empty for a file that is not localized.
Returns
string|boolean The new filename or false on failure

Definition at line 559 of file PKPContextService.inc.php.

◆ restoreLocaleDefaults()

PKP\Services\PKPContextService::restoreLocaleDefaults (   $context,
  $request,
  $locale 
)

Restore default values for context settings in a specific local

Updates multilingual values of a context, restoring default values in a specific context. This may be useful when a new language has been added after a context has been created, or when translations change and a journal wants to take advantage of the new values.

Parameters
$contextContext The context to restore default values for
$requestRequest
$localestring Locale key to restore defaults for. Example: en__US

Definition at line 513 of file PKPContextService.inc.php.

References HookRegistry\call(), PKPServices\get(), PKPLocale\reloadLocale(), AppLocale\requireComponents(), and PKP\Services\SCHEMA_CONTEXT.

◆ validate()

PKP\Services\PKPContextService::validate (   $action,
  $props,
  $allowedLocales,
  $primaryLocale 
)

Field Documentation

◆ $contextsFileDirName

array PKPContextService::$contextsFileDirName

The file directory where context files are stored. Expects journals or presses.

Definition at line 48 of file PKPContextService.inc.php.

◆ $installFileDirs

array PKPContextService::$installFileDirs

List of file directories to create on installation. Use d to use the context ID in a file path.

Definition at line 39 of file PKPContextService.inc.php.


The documentation for this class was generated from the following file: