idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
54,500
public function addClass ( $ className ) { $ existingClasses = ! empty ( $ this -> attributes [ 'class' ] ) ? explode ( ' ' , $ this -> attributes [ 'class' ] ) : array ( ) ; $ existingClasses [ ] = $ className ; $ this -> attributes [ 'class' ] = implode ( ' ' , array_unique ( $ existingClasses ) ) ; }
Add a CSS class jQuery style
54,501
public function removeClass ( $ className ) { $ existingClasses = ! empty ( $ this -> attributes [ 'class' ] ) ? explode ( ' ' , $ this -> attributes [ 'class' ] ) : array ( ) ; unset ( $ existingClasses [ array_search ( $ className , $ existingClasses ) ] ) ; $ this -> attributes [ 'class' ] = implode ( ' ' , $ existi...
Remove a CSS class jQuery style
54,502
public function getDescription ( ) { if ( empty ( $ this -> description ) ) { $ returnValue = ucfirst ( strtolower ( $ this -> name ) ) ; } else { $ returnValue = $ this -> description ; } return ( string ) $ returnValue ; }
Short description of method getDescription
54,503
public function addValidator ( ValidatorInterface $ validator ) { if ( $ validator instanceof tao_helpers_form_validators_NotEmpty ) { $ this -> addAttribute ( 'required' , true ) ; } $ this -> validators [ ] = $ validator ; }
Short description of method addValidator
54,504
public function removeValidator ( $ name ) { $ returnValue = false ; $ name = ( string ) $ name ; if ( strpos ( $ name , 'tao_helpers_form_validators_' ) === 0 ) { $ name = str_replace ( 'tao_helpers_form_validators_' , '' , $ name ) ; } if ( isset ( $ this -> validators [ $ name ] ) ) { unset ( $ this -> validators [ ...
Short description of method removeValidator
54,505
public function feed ( ) { if ( isset ( $ _POST [ $ this -> name ] ) && $ this -> name !== 'uri' && $ this -> name !== 'classUri' ) { $ this -> setValue ( tao_helpers_Uri :: decode ( $ _POST [ $ this -> name ] ) ) ; } }
Reads the submitted data into the form element
54,506
public static function buildObject ( $ var , $ format = false ) { if ( is_array ( $ var ) ) { $ returnValue = '{' ; $ i = 1 ; foreach ( $ var as $ k => $ v ) { $ k = is_int ( $ k ) ? '"' . json_encode ( $ k ) . '"' : json_encode ( $ k ) ; $ returnValue .= $ k . ':' . self :: buildObject ( $ v , $ format ) ; $ returnVal...
converts a php array or string into a javascript format
54,507
public function sasSelect ( ) { $ context = Context :: getInstance ( ) ; $ module = $ context -> getModuleName ( ) ; $ this -> setData ( 'treeName' , __ ( 'Select' ) ) ; $ this -> setData ( 'dataUrl' , _url ( 'sasGetOntologyData' ) ) ; $ this -> setData ( 'editClassUrl' , tao_helpers_Uri :: url ( 'sasSet' , $ module ) ...
Service of class or instance selection with a tree .
54,508
public function sasSet ( ) { $ message = __ ( 'Error' ) ; if ( $ this -> hasRequestParameter ( 'classUri' ) ) { $ clazz = $ this -> getCurrentClass ( ) ; if ( ! is_null ( $ clazz ) ) { $ this -> setVariables ( array ( $ this -> getDataKind ( ) . 'ClassUri' => $ clazz -> getUri ( ) ) ) ; $ message = $ clazz -> getLabel ...
Save the uri or the classUri in parameter into the workflow engine by using the dedicated seervice
54,509
public function sasDeleteInstance ( ) { $ clazz = $ this -> getCurrentClass ( ) ; $ instance = $ this -> getCurrentInstance ( ) ; $ this -> setData ( 'label' , $ instance -> getLabel ( ) ) ; $ this -> setData ( 'uri' , tao_helpers_Uri :: encode ( $ instance -> getUri ( ) ) ) ; $ this -> setData ( 'classUri' , tao_helpe...
Delete an instance
54,510
protected function getCurrentClass ( ) { $ classUri = tao_helpers_Uri :: decode ( $ this -> getRequestParameter ( 'classUri' ) ) ; if ( $ this -> isStandAlone ( ) && ( is_null ( $ classUri ) || empty ( $ classUri ) ) ) { return $ this -> getRootClass ( ) ; } else { return parent :: getCurrentClass ( ) ; } }
get the current item class regarding the classUri request parameter prevent exception by returning the root class if no class is selected
54,511
public function sasGetOntologyData ( ) { if ( ! $ this -> isXmlHttpRequest ( ) ) { throw new common_exception_IsAjaxAction ( __FUNCTION__ ) ; } $ showInstances = $ this -> hasRequestParameter ( 'hideInstances' ) ? ! ( bool ) $ this -> getRequestParameter ( 'hideInstances' ) : true ; $ hideNode = $ this -> hasRequestPar...
simplified Version of TaoModule function
54,512
protected function isStandalone ( ) { if ( is_null ( $ this -> isStandAlone ) ) { if ( $ this -> hasRequestParameter ( 'standalone' ) && $ this -> getRequestParameter ( 'standalone' ) ) { tao_helpers_Context :: load ( 'STANDALONE_MODE' ) ; $ this -> isStandAlone = true ; $ this -> setData ( 'client_config_url' , $ this...
Get the standAlone state
54,513
public function write ( ) { $ path = $ this -> getFilePath ( ) ; $ strings = array ( ) ; foreach ( $ this -> getTranslationFile ( ) -> getTranslationUnits ( ) as $ tu ) { if ( $ tu -> getTarget ( ) !== '' ) { $ strings [ $ tu -> getSource ( ) ] = $ tu -> getTarget ( ) ; } } $ buffer = json_encode ( $ strings , JSON_HEX...
Write a javascript AMD module that provides translations for the target languages .
54,514
private function getPersistence ( ) { if ( $ this -> persistence === null ) { $ this -> persistence = common_persistence_KeyValuePersistence :: getPersistence ( $ this -> getOption ( self :: OPTION_PERSISTENCE ) ) ; } return $ this -> persistence ; }
Get the persistence
54,515
public function requestAsync ( $ method , $ uri , array $ options = [ ] ) { return $ this -> getClient ( ) -> requestAsync ( $ method , $ uri , $ options ) ; }
Create and send an asynchronous HTTP request .
54,516
protected function getClientOptions ( ) { $ options = $ this -> getOptions ( ) ; if ( ! isset ( $ options [ 'headers' ] ) || ! isset ( $ options [ 'headers' ] [ 'Content-Type' ] ) ) { $ options [ 'headers' ] [ 'Content-Type' ] = [ 'application/json' ] ; } else { if ( ! in_array ( 'application/json' , $ options [ 'heade...
Get the options as client options
54,517
public function hasPrivileges ( User $ user , array $ required ) { foreach ( $ required as $ resourceId => $ right ) { if ( $ right === 'WRITE' && ! $ this -> hasWritePrivilege ( $ user , $ resourceId ) ) { common_Logger :: d ( 'User \'' . $ user -> getIdentifier ( ) . '\' does not have lock for resource \'' . $ resour...
Whenever or not the user has the required rights
54,518
protected function getLockout ( ) { if ( ! $ this -> lockout || ! $ this -> lockout instanceof LockoutStorage ) { $ lockout = $ this -> getOption ( self :: OPTION_LOCKOUT_STORAGE ) ; $ this -> lockout = ( $ lockout and class_exists ( $ lockout ) ) ? new $ lockout : new RdfLockoutStorage ( ) ; } return $ this -> lockout...
Returns proper lockout implementation
54,519
public function getFilePath ( User $ receiver ) { $ basePath = $ this -> getOption ( self :: CONFIG_FILEPATH ) ; if ( is_null ( $ basePath ) || ! file_exists ( $ basePath ) ) { throw new \ common_exception_InconsistentData ( 'Missing path ' . self :: CONFIG_FILEPATH . ' for ' . __CLASS__ ) ; } $ path = $ basePath . \ t...
Get file path to save message
54,520
public function password ( ) { $ this -> setData ( 'formTitle' , __ ( "Change password" ) ) ; if ( $ this -> getServiceLocator ( ) -> get ( ApplicationService :: SERVICE_ID ) -> isDemo ( ) ) { $ this -> setData ( 'myForm' , __ ( 'Unable to change passwords in demo mode' ) ) ; } else { $ myFormContainer = new tao_action...
Action dedicated to change the password of the user currently connected .
54,521
public function write ( ) { $ buffer = '' ; $ file = $ this -> getTranslationFile ( ) ; $ buffer .= 'msgid ""' . "\n" ; $ buffer .= 'msgstr ""' . "\n" ; if ( get_class ( $ this -> getTranslationFile ( ) ) == 'tao_helpers_translation_POFile' ) { foreach ( $ file -> getHeaders ( ) as $ name => $ value ) { $ buffer .= '"'...
Short description of method write
54,522
public static function getControllers ( $ extensionId ) { try { $ controllerClasses = ServiceManager :: getServiceManager ( ) -> get ( 'generis/cache' ) -> get ( self :: EXTENSION_PREFIX . $ extensionId ) ; } catch ( \ common_cache_NotFoundException $ e ) { $ factory = new Factory ( ) ; $ controllerClasses = array ( ) ...
Returns al lthe controllers of an extension
54,523
public static function getActions ( $ controllerClassName ) { try { $ actions = ServiceManager :: getServiceManager ( ) -> get ( 'generis/cache' ) -> get ( self :: CONTROLLER_PREFIX . $ controllerClassName ) ; } catch ( \ common_cache_NotFoundException $ e ) { $ factory = new Factory ( ) ; $ desc = $ factory -> getCont...
Get the list of actions for a controller
54,524
public static function getRequiredRights ( $ controllerClassName , $ actionName ) { try { $ rights = ServiceManager :: getServiceManager ( ) -> get ( 'generis/cache' ) -> get ( self :: ACTION_PREFIX . $ controllerClassName . '@' . $ actionName ) ; } catch ( \ common_cache_NotFoundException $ e ) { $ factory = new Facto...
Get the required rights for the execution of an action
54,525
public function pop ( ) { if ( ! $ this -> count ( ) ) { return null ; } $ task = $ this -> getQueue ( ) -> dequeue ( ) ; return $ this -> unserializeTask ( $ task , '' ) ; }
Overwriting the parent totally because in this case we need a much simpler logic for popping messages .
54,526
public static function getClientConfigUrl ( $ extraParameters = array ( ) ) { $ context = \ Context :: getInstance ( ) ; $ clientConfigParams = [ 'extension' => $ context -> getExtensionName ( ) , 'module' => $ context -> getModuleName ( ) , 'action' => $ context -> getActionName ( ) ] ; return _url ( 'config' , 'Clien...
Helps you to add the URL of the client side config file
54,527
public function __toPhpCode ( ) { $ source = '' ; if ( ! empty ( $ this -> readers ) ) { foreach ( $ this -> readers as $ reader ) { $ source .= \ common_Utils :: toHumanReadablePhpString ( $ reader , 2 ) . PHP_EOL ; } } $ destination = '' ; if ( ! empty ( $ this -> writers ) ) { foreach ( $ this -> writers as $ writer...
To configuration serialization
54,528
public function overrideEntryPoint ( $ id , Entrypoint $ e ) { $ entryPoints = $ this -> getOption ( self :: OPTION_ENTRYPOINTS ) ; $ entryPoints [ $ id ] = $ e ; $ this -> setOption ( self :: OPTION_ENTRYPOINTS , $ entryPoints ) ; }
Replace the entrypoint with the id provided
54,529
public function activateEntryPoint ( $ entryId , $ target ) { $ success = false ; $ entryPoints = $ this -> getOption ( self :: OPTION_ENTRYPOINTS ) ; if ( ! isset ( $ entryPoints [ $ entryId ] ) ) { throw new \ common_exception_InconsistentData ( 'Unknown entrypoint ' . $ entryId ) ; } $ actives = $ this -> hasOption ...
Activate an existing entry point for a specific target
54,530
public function deactivateEntryPoint ( $ entryId , $ target = self :: OPTION_POSTLOGIN ) { $ success = false ; $ entryPoints = $ this -> getOption ( self :: OPTION_ENTRYPOINTS ) ; if ( ! isset ( $ entryPoints [ $ entryId ] ) ) { throw new \ common_exception_InconsistentData ( 'Unknown entrypoint ' . $ entryId ) ; } $ a...
Dectivate an existing entry point for a specific target
54,531
public function addEntryPoint ( Entrypoint $ e , $ target = null ) { $ entryPoints = $ this -> getOption ( self :: OPTION_ENTRYPOINTS ) ; $ entryPoints [ $ e -> getId ( ) ] = $ e ; $ this -> setOption ( self :: OPTION_ENTRYPOINTS , $ entryPoints ) ; if ( ! is_null ( $ target ) ) { $ this -> activateEntryPoint ( $ e -> ...
Add an Entrypoint and activate it if a target is specified
54,532
public function getEntryPoints ( $ target = self :: OPTION_POSTLOGIN ) { $ ids = $ this -> hasOption ( $ target ) ? $ this -> getOption ( $ target ) : array ( ) ; $ existing = $ this -> getOption ( self :: OPTION_ENTRYPOINTS ) ; if ( $ target === self :: OPTION_ENTRYPOINTS ) { return $ existing ; } $ entryPoints = arra...
Get all entrypoints for a designated target
54,533
public function registerEntryPoint ( Entrypoint $ e ) { $ this -> addEntryPoint ( $ e , self :: OPTION_POSTLOGIN ) ; $ this -> getServiceManager ( ) -> register ( self :: SERVICE_ID , $ this ) ; }
Legacy function for backward compatibilitiy
54,534
public function getPlatformState ( ) { try { return $ this -> getStorage ( ) -> getCurrentPlatformState ( ) ; } catch ( \ common_exception_NotFound $ e ) { $ this -> enablePlatform ( ) ; return new MaintenanceState ( array ( MaintenanceState :: STATUS => MaintenanceState :: LIVE_MODE ) ) ; } }
Get the current maintenance state of the platform
54,535
protected function setPlatformState ( $ status ) { $ state = new MaintenanceState ( array ( MaintenanceState :: STATUS => $ status ) ) ; $ this -> getStorage ( ) -> setPlatformState ( $ state ) ; }
Update platform state
54,536
public function getStorage ( ) { if ( ! $ this -> storage ) { if ( ! $ this -> hasOption ( self :: OPTION_PERSISTENCE ) ) { throw new InconsistencyConfigException ( __ ( 'Maintenance service must have a persistence option.' ) ) ; } $ this -> storage = new MaintenanceStorage ( \ common_persistence_Manager :: getPersiste...
Get the maintenance storage
54,537
protected function getGroupTitle ( $ property ) { if ( $ this -> isParentProperty ( ) ) { foreach ( $ property -> getDomain ( ) -> getIterator ( ) as $ domain ) { $ domainLabel [ ] = $ domain -> getLabel ( ) ; } $ groupTitle = '<span class="property-heading-label">' . _dh ( $ property -> getLabel ( ) ) . '</span>' . '<...
Returns html for property
54,538
public static function hasAccess ( $ action , $ controller , $ extension , $ parameters = array ( ) ) { $ user = common_session_SessionManager :: getSession ( ) -> getUser ( ) ; try { $ resolver = ActionResolver :: getByControllerName ( $ controller , $ extension ) ; $ className = $ resolver -> getController ( ) ; } ca...
Returns whenever or not the current user has access to a specified link
54,539
public static function hasAccessUrl ( $ url ) { $ user = common_session_SessionManager :: getSession ( ) -> getUser ( ) ; try { $ resolver = new ActionResolver ( $ url ) ; return AclProxy :: hasAccess ( $ user , $ resolver -> getController ( ) , $ resolver -> getAction ( ) , array ( ) ) ; $ className = $ resolver -> ge...
Does not respect params
54,540
public static function render ( common_report_Report $ report ) { $ stack = new SplStack ( ) ; $ renderingStack = new SplStack ( ) ; $ traversed = array ( ) ; $ stack -> push ( $ report ) ; $ nesting = 0 ; while ( $ stack -> count ( ) > 0 ) { $ current = $ stack -> pop ( ) ; if ( in_array ( $ current , $ traversed , tr...
Render a common_report_Report object into an HTML string output .
54,541
private static function renderReport ( common_report_Report $ report , array $ childRenderedReports = array ( ) , $ nesting = 0 , $ leaf = false ) { switch ( $ report -> getType ( ) ) { case common_report_Report :: TYPE_SUCCESS : $ typeClass = 'success' ; break ; case common_report_Report :: TYPE_WARNING : $ typeClass ...
Contains the logic to render a report and its children .
54,542
public function getRole ( $ uri ) { $ returnValue = null ; if ( ! empty ( $ uri ) ) { $ returnValue = new core_kernel_classes_Resource ( $ uri ) ; } return $ returnValue ; }
Get the Role matching the uri
54,543
public function setRoleToUsers ( core_kernel_classes_Resource $ role , $ users = array ( ) ) { $ returnValue = ( bool ) false ; $ userService = tao_models_classes_UserService :: singleton ( ) ; $ rolesProperty = new core_kernel_classes_Property ( GenerisRdf :: PROPERTY_USER_ROLES ) ; foreach ( $ users as $ u ) { $ u = ...
assign a role to a set of users
54,544
public function getUsers ( core_kernel_classes_Resource $ role ) { $ returnValue = array ( ) ; $ filters = array ( GenerisRdf :: PROPERTY_USER_ROLES => $ role -> getUri ( ) ) ; $ options = array ( 'like' => false , 'recursive' => true ) ; $ userClass = new core_kernel_classes_Class ( GenerisRdf :: CLASS_GENERIS_USER ) ...
get the users who have the role in parameter
54,545
public function addRole ( $ label , $ includedRoles = null , core_kernel_classes_Class $ class = null ) { return $ this -> generisUserService -> addRole ( $ label , $ includedRoles , $ class ) ; }
Creates a new Role in persistent memory .
54,546
public function removeRole ( core_kernel_classes_Resource $ role ) { $ this -> getEventManager ( ) -> trigger ( new RoleRemovedEvent ( $ role -> getUri ( ) ) ) ; return $ this -> generisUserService -> removeRole ( $ role ) ; }
Remove a given Role from persistent memory . References to this role will also be removed from the persistent memory .
54,547
public function unincludeRole ( core_kernel_classes_Resource $ role , core_kernel_classes_Resource $ roleToUninclude ) { $ this -> generisUserService -> unincludeRole ( $ role , $ roleToUninclude ) ; $ this -> getEventManager ( ) -> trigger ( new RoleChangedEvent ( $ role -> getUri ( ) , 'excluded role' , $ roleToUninc...
Uninclude a Role from another Role .
54,548
public static function parseFloat ( $ value ) { $ returnValue = ( float ) 0.0 ; $ returnValue = str_replace ( ',' , '.' , $ value ) ; $ returnValue = preg_replace ( '/[^\-\d.]/' , '' , $ returnValue ) ; return ( float ) $ returnValue ; }
Converts a string to a float in order to support negative values .
54,549
public function entry ( ) { $ this -> defaultData ( ) ; $ entries = array ( ) ; foreach ( EntryPointService :: getRegistry ( ) -> getEntryPoints ( ) as $ entry ) { if ( tao_models_classes_accessControl_AclProxy :: hasAccessUrl ( $ entry -> getUrl ( ) ) ) { $ entries [ ] = $ entry ; } } if ( empty ( $ entries ) ) { if (...
First page when arriving on a system to choose front or back office
54,550
public function logout ( ) { $ this -> defaultData ( ) ; $ eventManager = $ this -> getServiceLocator ( ) -> get ( EventManager :: SERVICE_ID ) ; $ logins = $ this -> getSession ( ) -> getUser ( ) -> getPropertyValues ( UserRdf :: PROPERTY_LOGIN ) ; $ eventManager -> trigger ( new LogoutSucceedEvent ( current ( $ login...
Logout destroy the session and back to the login page
54,551
private function getNavigationElementsByGroup ( $ groupId ) { $ entries = array ( ) ; foreach ( MenuService :: getPerspectivesByGroup ( $ groupId ) as $ i => $ perspective ) { $ binding = $ perspective -> getBinding ( ) ; $ children = $ this -> getMenuElementChildren ( $ perspective ) ; if ( ! empty ( $ binding ) || ! ...
Get perspective data depending on the group set in structure . xml
54,552
private function getMenuElementChildren ( Perspective $ menuElement ) { $ user = $ this -> getSession ( ) -> getUser ( ) ; $ children = array ( ) ; foreach ( $ menuElement -> getChildren ( ) as $ section ) { try { $ resolver = new ActionResolver ( $ section -> getUrl ( ) ) ; if ( FuncProxy :: accessPossible ( $ user , ...
Get nested menu elements depending on user rights .
54,553
private function getSections ( $ shownExtension , $ shownStructure ) { $ sections = array ( ) ; $ user = $ this -> getSession ( ) -> getUser ( ) ; $ structure = MenuService :: getPerspective ( $ shownExtension , $ shownStructure ) ; if ( ! is_null ( $ structure ) ) { foreach ( $ structure -> getChildren ( ) as $ sectio...
Get the sections of the current extension s structure
54,554
public function load ( $ source ) { if ( $ source instanceof File ) { $ resource = $ source -> readStream ( ) ; } else { if ( ! is_file ( $ source ) ) { throw new InvalidArgumentException ( "Expected CSV file '" . $ source . "' could not be open." ) ; } if ( ! is_readable ( $ source ) ) { throw new InvalidArgumentExcep...
Load the file and parse csv lines
54,555
public function hasSameTranslationUnitSource ( tao_helpers_translation_TranslationUnit $ translationUnit ) { $ returnValue = ( bool ) false ; $ returnValue = $ this -> getSource ( ) == $ translationUnit -> getSource ( ) ; return ( bool ) $ returnValue ; }
Short description of method hasSameTranslationUnitSource
54,556
public function hasSameTranslationUnitTarget ( tao_helpers_translation_TranslationUnit $ translationUnit ) { $ returnValue = ( bool ) false ; $ returnValue = $ this -> getTarget ( ) == $ translationUnit -> getTarget ( ) ; return ( bool ) $ returnValue ; }
Short description of method hasSameTranslationUnitTarget
54,557
public function hasSameTranslationUnitSourceLanguage ( tao_helpers_translation_TranslationUnit $ translationUnit ) { $ returnValue = ( bool ) false ; $ returnValue = $ this -> getSourceLanguage ( ) == $ translationUnit -> getSourceLanguage ( ) ; return ( bool ) $ returnValue ; }
Checks whether or not a given TranslationUnit has the same source than the current instance .
54,558
public function hasSameTranslationUnitTargetLanguage ( tao_helpers_translation_TranslationUnit $ translationUnit ) { $ returnValue = ( bool ) false ; $ returnValue = $ this -> getTargetLanguage ( ) == $ translationUnit -> getTargetLanguage ( ) ; return ( bool ) $ returnValue ; }
Checks whether or not a given TranslationUnit has the same target than the current instance .
54,559
public static function getReleaseMsgData ( ) { $ params = array ( 'version-type' => '' , 'is-unstable' => self :: isUnstable ( ) , 'is-sandbox' => false , 'logo' => self :: getLogoUrl ( ) , 'link' => self :: getLinkUrl ( ) , 'msg' => self :: getMessage ( ) ) ; switch ( TAO_RELEASE_STATUS ) { case 'alpha' : case 'demoA'...
Compute the parameters for the release message
54,560
public static function getSandboxExpiration ( ) { $ datetime = new \ DateTime ( ) ; $ d = new \ DateTime ( $ datetime -> format ( 'Y-m-d' ) ) ; $ weekday = $ d -> format ( 'w' ) ; $ weekNumber = $ d -> format ( 'W' ) ; $ diff = $ weekNumber % 2 ? 7 : 6 - $ weekday ; $ d -> modify ( sprintf ( '+ %d day' , $ diff ) ) ; r...
Compute the expiration time for the sandbox version
54,561
public static function getAmdLoader ( $ bundle = null , $ controller = null , $ params = null , $ allowAnonymous = false ) { $ bundleMode = \ tao_helpers_Mode :: is ( 'production' ) ; $ configUrl = get_data ( 'client_config_url' ) ; $ requireJsUrl = Template :: js ( 'lib/require.js' , 'tao' ) ; $ bootstrapUrl = Templat...
Create the AMD loader for the current context . It will load login s modules for anonymous session . Loads the bundle mode in production and the dynamic mode in debug .
54,562
public static function getContentTemplate ( ) { $ templateData = ( array ) get_data ( 'content-template' ) ; $ contentExtension = get_data ( 'content-extension' ) ; $ contentTemplate [ 'path' ] = $ templateData [ 0 ] ; $ contentTemplate [ 'ext' ] = isset ( $ templateData [ 1 ] ) ? $ templateData [ 1 ] : ( $ contentExte...
Retrieve the template with the actual content
54,563
public static function getLogoUrl ( ) { $ theme = self :: getCurrentTheme ( ) ; if ( $ theme instanceof ConfigurableTheme || $ theme instanceof ConfigurablePlatformTheme ) { $ logoFile = $ theme -> getLogoUrl ( ) ; if ( ! empty ( $ logoFile ) ) { return $ logoFile ; } } return static :: getDefaultLogoUrl ( ) ; }
Get the logo URL .
54,564
public static function getLinkUrl ( ) { $ theme = self :: getCurrentTheme ( ) ; if ( $ theme instanceof ConfigurableTheme || $ theme instanceof ConfigurablePlatformTheme ) { $ link = $ theme -> getLink ( ) ; if ( ! empty ( $ link ) ) { return $ link ; } } switch ( TAO_RELEASE_STATUS ) { case 'alpha' : case 'demoA' : ca...
Get the url link of current theme Url is used into header to provide link to logo Url is used into footer to provide link to footer message
54,565
public static function getMessage ( ) { $ theme = self :: getCurrentTheme ( ) ; if ( $ theme instanceof ConfigurableTheme || $ theme instanceof ConfigurablePlatformTheme ) { $ message = $ theme -> getMessage ( ) ; if ( ! empty ( $ message ) ) { return $ message ; } } switch ( TAO_RELEASE_STATUS ) { case 'alpha' : case ...
Get the message of current theme Message is used into header to provide title to logo Message is used into footer as footer message
54,566
public static function getOperatedByData ( ) { $ name = '' ; $ email = '' ; $ theme = self :: getCurrentTheme ( ) ; if ( $ theme instanceof ConfigurablePlatformTheme ) { $ operatedBy = $ theme -> getOperatedBy ( ) ; $ name = $ operatedBy [ 'name' ] ; $ email = $ operatedBy [ 'email' ] ; } if ( ! $ name && ! $ email ) {...
Get the currently registered OperatedBy data
54,567
public static function getVerboseVersionName ( ) { preg_match ( '~(?<revision>([\d\.]+))([\W_]?(?<specifics>(.*)?))~' , trim ( TAO_VERSION ) , $ components ) ; if ( empty ( $ components [ 'revision' ] ) ) { return TAO_VERSION ; } $ version = '' ; if ( ! empty ( $ components [ 'specifics' ] ) ) { $ version .= ucwords ( ...
Turn TAO_VERSION in a more verbose form . If TAO_VERSION diverges too much from the usual patterns TAO_VERSION will be returned unaltered .
54,568
public static function renderThemeTemplate ( $ target , $ templateId , $ data = array ( ) ) { $ tpl = self :: getThemeTemplate ( $ target , $ templateId ) ; $ theme = self :: getCurrentTheme ( ) ; if ( ! is_null ( $ tpl ) ) { if ( $ theme instanceof ConfigurablePlatformTheme ) { $ data [ 'themeObj' ] = $ theme ; } $ re...
Render a themable template identified by its id
54,569
protected function doFiltration ( QueryBuilderInterface $ queryBuilder ) { $ search = $ this -> getSearchService ( ) ; $ filters = $ this -> map ( $ this -> getFilters ( ) , true ) ; $ query = $ search -> searchType ( $ queryBuilder , $ this -> getType ( ) , true ) ; foreach ( $ filters as $ filterProp => $ filterVal )...
Apply filters to search query
54,570
protected function fetchPropertyValues ( $ payload ) { $ propertyMap = $ this -> getPropertiesMap ( ) ; $ data = [ ] ; foreach ( $ payload [ 'data' ] as $ resource ) { $ resource = ( object ) $ resource ; $ resource = new \ core_kernel_classes_Resource ( $ resource -> subject ) ; $ resourceData = $ resource -> getPrope...
Fetch all the values of properties listed in properties map
54,571
public static function installRecursively ( $ extensionIDs , $ installData = array ( ) ) { try { return parent :: installRecursively ( $ extensionIDs , $ installData ) ; } catch ( \ common_ext_ExtensionException $ e ) { static :: log ( 'w' , 'Exception(' . $ e -> getMessage ( ) . ') during install for extension "' . $ ...
Override of original install helper to throw install exception on errors
54,572
protected function initGrid ( ) { $ returnValue = ( bool ) false ; $ returnValue = $ this -> grid -> setData ( $ this -> data ) ; return ( bool ) $ returnValue ; }
Short description of method initGrid
54,573
public function initOptions ( $ options = array ( ) ) { $ returnValue = ( bool ) false ; $ columns = $ this -> grid -> getColumns ( ) ; if ( isset ( $ options [ 'columns' ] ) ) { foreach ( $ options [ 'columns' ] as $ columnId => $ columnOptions ) { if ( isset ( $ columns [ $ columnId ] ) ) { foreach ( $ columnOptions ...
Short description of method initOptions
54,574
private function recursiveSearch ( $ directory ) { if ( is_dir ( $ directory ) ) { if ( ( $ files = scandir ( $ directory ) ) !== false ) { foreach ( $ files as $ fd ) { if ( ! preg_match ( "/^\./" , $ fd ) && $ fd != "ext" ) { if ( is_dir ( $ directory . $ fd . "/" ) ) { $ this -> recursiveSearch ( $ directory . $ fd ...
Short description of method recursiveSearch
54,575
private function getTranslationsInFile ( $ filePath ) { $ extOk = in_array ( \ Jig \ Utils \ FsUtils :: getFileExtension ( $ filePath ) , $ this -> getFileTypes ( ) ) ; if ( $ extOk ) { foreach ( $ this -> getBannedFileType ( ) as $ bannedExt ) { $ extOk &= substr_compare ( $ filePath , $ bannedExt , strlen ( $ filePat...
Short description of method getTranslationsInFile
54,576
public function bind ( $ data ) { $ returnValue = null ; try { $ instance = parent :: bind ( $ data ) ; foreach ( $ data as $ p => $ d ) { $ property = new core_kernel_classes_Property ( $ p ) ; if ( $ d instanceof tao_helpers_form_data_UploadFileDescription ) { $ this -> bindUploadFileDescription ( $ property , $ d ) ...
Simply bind data from a Generis Instance Form to a specific generis class
54,577
protected function bindUploadFileDescription ( core_kernel_classes_Property $ property , tao_helpers_form_data_UploadFileDescription $ desc ) { $ instance = $ this -> getTargetInstance ( ) ; if ( $ desc -> getAction ( ) == tao_helpers_form_data_UploadFileDescription :: FORM_ACTION_DELETE ) { $ this -> removeFile ( $ pr...
Binds an UploadFileDescription with the target instance .
54,578
public function import ( $ source , core_kernel_classes_Class $ destination = null , $ namespace = null ) { $ uploadService = ServiceManager :: getServiceManager ( ) -> get ( UploadService :: SERVICE_ID ) ; if ( ! $ source instanceof File ) { $ file = $ uploadService -> getUploadedFlyFile ( $ source ) ; } else { $ file...
Import a XML file as is into the ontology
54,579
public function export ( core_kernel_classes_Class $ source = null ) { if ( $ source === null ) { return core_kernel_api_ModelExporter :: exportAll ( ) ; } $ graph = new EasyRdf_Graph ( ) ; if ( $ source -> isClass ( ) ) { $ this -> addClass ( $ graph , $ source ) ; } else { $ this -> addResource ( $ graph , $ source )...
Export to xml - rdf the ontology of the Class in parameter . All the ontologies are exported if the class is not set
54,580
private function addClass ( EasyRdf_Graph $ graph , core_kernel_classes_Class $ resource ) { $ this -> addResource ( $ graph , $ resource ) ; foreach ( $ resource -> getInstances ( ) as $ instance ) { $ this -> addResource ( $ graph , $ instance ) ; } foreach ( $ resource -> getSubClasses ( ) as $ subclass ) { $ this -...
Add a class to the graph
54,581
private function addResource ( EasyRdf_Graph $ graph , core_kernel_classes_Resource $ resource ) { foreach ( $ resource -> getRdfTriples ( ) as $ triple ) { $ language = ! empty ( $ triple -> lg ) ? $ triple -> lg : null ; if ( common_Utils :: isUri ( $ triple -> object ) ) { if ( $ triple -> predicate !== OntologyRdf ...
Add a resource to the graph
54,582
private function isSerializedFile ( $ object ) { $ isFile = false ; $ type = substr ( $ object , 0 , strpos ( $ object , ':' ) ) ; if ( in_array ( $ type , [ 'file' , 'dir' ] ) ) { $ isFile = true ; } return $ isFile ; }
Check if the given object is a serialized file reference
54,583
public function getValue ( $ name ) { return isset ( $ this -> metaData [ $ name ] ) ? $ this -> metaData [ $ name ] : null ; }
Gets a particular value from compiled metadata of a Resource .
54,584
public function unserialize ( $ data ) { if ( ! is_string ( $ data ) ) { throw new \ common_exception_InconsistentData ( 'The encoded resource metadata should be provided as a string' ) ; } $ metaData = json_decode ( $ data , true ) ; if ( ! is_array ( $ metaData ) ) { throw new \ common_exception_InconsistentData ( 'T...
Unpacks resource metadata from a string .
54,585
public function loginUser ( $ login , $ password ) { $ returnValue = ( bool ) false ; try { $ returnValue = LoginService :: login ( $ login , $ password ) ; } catch ( core_kernel_users_Exception $ ue ) { common_Logger :: e ( "A fatal error occured at user login time: " . $ ue -> getMessage ( ) ) ; } return ( bool ) $ r...
authenticate a user
54,586
public function getCurrentUser ( ) { $ returnValue = null ; if ( ! common_session_SessionManager :: isAnonymous ( ) ) { $ userUri = \ common_session_SessionManager :: getSession ( ) -> getUser ( ) -> getIdentifier ( ) ; if ( ! empty ( $ userUri ) ) { $ returnValue = new core_kernel_classes_Resource ( $ userUri ) ; } el...
retrieve the logged in user
54,587
public function loginExists ( $ login , core_kernel_classes_Class $ class = null ) { $ returnValue = ( bool ) false ; $ returnValue = $ this -> generisUserService -> loginExists ( $ login , $ class ) ; return ( bool ) $ returnValue ; }
Check if the login is already used
54,588
public function getOneUser ( $ login , core_kernel_classes_Class $ class = null ) { $ returnValue = null ; if ( empty ( $ login ) ) { throw new common_exception_InvalidArgumentType ( 'Missing login for ' . __FUNCTION__ ) ; } $ class = ( ! empty ( $ class ) ) ? $ class : $ this -> getRootClass ( ) ; $ user = $ this -> g...
Get a user that has a given login .
54,589
public function removeUser ( core_kernel_classes_Resource $ user ) { $ returnValue = ( bool ) false ; if ( ! is_null ( $ user ) ) { $ this -> checkCurrentUserAccess ( $ this -> getUserRoles ( $ user ) ) ; $ returnValue = $ this -> generisUserService -> removeUser ( $ user ) ; $ this -> getEventManager ( ) -> trigger ( ...
Remove a user
54,590
public function logout ( ) { $ returnValue = ( bool ) false ; $ returnValue = $ this -> generisUserService -> logout ( ) ; return ( bool ) $ returnValue ; }
Short description of method logout
54,591
public function getAllUsers ( $ options = [ ] , $ filters = [ GenerisRdf :: PROPERTY_USER_LOGIN => '*' ] ) { $ userClass = new core_kernel_classes_Class ( TaoOntology :: CLASS_URI_TAO_USER ) ; $ options = array_merge ( [ 'recursive' => true , 'like' => true ] , $ options ) ; return ( array ) $ userClass -> searchInstan...
Short description of method getAllUsers
54,592
public function getCountUsers ( $ options = [ ] , $ filters = [ ] ) { $ userClass = new core_kernel_classes_Class ( TaoOntology :: CLASS_URI_TAO_USER ) ; return $ userClass -> countInstances ( $ filters , $ options ) ; }
Returns count of instances that match conditions in options and filters
54,593
public function toTree ( core_kernel_classes_Class $ clazz , array $ options = array ( ) ) { $ returnValue = array ( ) ; $ users = $ this -> getAllUsers ( array ( 'order' => GenerisRdf :: PROPERTY_USER_LOGIN ) ) ; foreach ( $ users as $ user ) { $ login = ( string ) $ user -> getOnePropertyValue ( new core_kernel_class...
Short description of method toTree
54,594
public function addUser ( $ login , $ password , core_kernel_classes_Resource $ role = null , core_kernel_classes_Class $ class = null ) { $ this -> checkCurrentUserAccess ( $ role ) ; if ( empty ( $ class ) ) { $ class = $ this -> getRootClass ( ) ; } $ user = $ this -> generisUserService -> addUser ( $ login , $ pass...
Add a new user .
54,595
public function attachRole ( core_kernel_classes_Resource $ user , core_kernel_classes_Resource $ role ) { $ this -> checkCurrentUserAccess ( $ role ) ; $ this -> generisUserService -> attachRole ( $ user , $ role ) ; }
Attach a Generis Role to a given TAO User . A UserException will be if an error occurs . If the User already has the role nothing happens .
54,596
public function unnatachRole ( core_kernel_classes_Resource $ user , core_kernel_classes_Resource $ role ) { try { $ this -> checkCurrentUserAccess ( $ role ) ; $ this -> generisUserService -> unnatachRole ( $ user , $ role ) ; } catch ( common_exception_Error $ e ) { } }
Unnatach a Role from a given TAO User .
54,597
public function getPermittedRoles ( core_kernel_classes_Resource $ user , array $ roles , $ encoded = true ) { $ exclude = [ ] ; if ( ! $ this -> userHasRoles ( $ user , TaoRoles :: SYSTEM_ADMINISTRATOR ) ) { $ exclude [ ] = $ encoded ? tao_helpers_Uri :: encode ( TaoRoles :: SYSTEM_ADMINISTRATOR ) : TaoRoles :: SYSTEM...
Filter roles to leave only permitted roles
54,598
public function checkCurrentUserAccess ( $ roles ) { if ( $ this -> getCurrentUser ( ) === null ) { return ; } if ( $ roles instanceof core_kernel_classes_Resource ) { $ roles = [ $ roles -> getUri ( ) ] ; } if ( is_array ( $ roles ) ) { $ roles = array_map ( function ( $ role ) { return $ role instanceof core_kernel_c...
Thrown an exception if user doesn t have permissions
54,599
public function initForm ( ) { $ this -> form = tao_helpers_form_FormFactory :: getForm ( 'passwordRecoveryForm' ) ; $ connectElt = tao_helpers_form_FormFactory :: getElement ( 'recovery' , 'Submit' ) ; $ connectElt -> setValue ( __ ( 'Email' ) ) ; $ connectElt -> setAttribute ( 'class' , 'btn-success small' ) ; $ this...
Initialize password recovery form