idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
17,600
public function getTargets ( $ force = false ) : CNabuSiteTargetList { if ( ! $ this -> isBuiltIn ( ) && ( $ this -> nb_site_target_list -> isEmpty ( ) || $ force ) ) { $ this -> nb_site_target_list -> clear ( ) ; $ this -> nb_site_target_list -> merge ( CNabuSiteTarget :: getAllSiteTargets ( $ this ) ) ; $ this -> nb_site_target_list -> iterate ( function ( $ key , $ nb_site_target ) { $ nb_site_target -> setSite ( $ this ) ; return true ; } ) ; } return $ this -> nb_site_target_list ; }
Gets the Target list associated with this instance .
17,601
public function addStaticContent ( CNabuSiteStaticContent $ nb_site_static_content ) { $ nb_site_static_content -> setSite ( $ this ) ; return $ this -> nb_site_static_content_list -> addItem ( $ nb_site_static_content ) ; }
Add a static content to a site .
17,602
public function getStaticContent ( $ nb_site_static_content ) { $ nb_site_static_content_id = nb_getMixedValue ( $ nb_site_static_content , 'nb_site_static_content_id' ) ; return ( is_numeric ( $ nb_site_static_content_id ) || nb_isValidGUID ( $ nb_site_static_content_id ) ) ? $ this -> nb_site_static_content_list -> getItem ( $ nb_site_static_content_id ) : null ; }
Gets a Static Content item from the list of static contents loaded in the Site .
17,603
public function getStaticContents ( $ force = false ) : CNabuSiteStaticContentList { if ( ! $ this -> isBuiltIn ( ) && ( $ this -> nb_site_static_content_list -> isEmpty ( ) || $ force ) ) { $ this -> nb_site_static_content_list = CNabuSiteStaticContent :: getStaticContentsForSite ( $ this ) ; $ this -> nb_site_static_content_list -> sort ( ) ; } return $ this -> nb_site_static_content_list ; }
Gets the Static Content list associated with this instance .
17,604
public function isDefaultTargetUsingTarget ( ) { return $ this -> getDefaultTargetUseURI ( ) === CNabuSiteTargetLink :: USE_URI_TRANSLATED && $ this -> nb_site_target_list -> containsKey ( $ this -> getDefaultTargetId ( ) ) ; }
Check if Default Target uses a Site Target object .
17,605
public function setDefaultTarget ( CNabuDataObject $ nb_site_target ) { $ this -> setDefaultTargetUseURI ( CNabuSiteTargetLink :: USE_URI_TRANSLATED ) ; $ this -> transferValue ( $ nb_site_target , 'nb_site_target_id' , 'nb_site_default_target_id' ) ; return $ this ; }
Sets the default Site Target .
17,606
public function setLoginTarget ( CNabuDataObject $ nb_site_target ) { $ this -> setLoginTargetUseURI ( CNabuSiteTargetLink :: USE_URI_TRANSLATED ) ; $ this -> transferValue ( $ nb_site_target , 'nb_site_target_id' , 'nb_site_login_target_id' ) ; return $ this ; }
Sets the login Site Target .
17,607
public function getSiteMap ( $ nb_site_map , $ cascade = false ) { $ retval = null ; $ nb_site_map_id = nb_getMixedValue ( $ nb_site_map , 'nb_site_map_id' ) ; if ( is_numeric ( $ nb_site_map_id ) || nb_isValidGUID ( $ nb_site_map_id ) ) { $ retval = $ this -> nb_site_map_tree -> getItem ( $ nb_site_map_id ) ; } return $ retval ; }
Gets a Site Map instance optionally looking for it in nested levels .
17,608
public function addSiteMap ( CNabuSiteMap $ nb_site_map ) { $ nb_site_map -> transferValue ( $ this , 'nb_site_id' ) ; return $ this -> nb_site_map_tree -> addItem ( $ nb_site_map ) ; }
Add a map to a site
17,609
public function getNaturalLanguages ( bool $ force = false ) : CNabuLanguageList { $ nb_natural = new CNabuLanguageList ( ) ; $ this -> getLanguages ( $ force ) -> iterate ( function ( $ key , CNabuLanguage $ nb_language ) use ( $ nb_natural ) { if ( $ nb_language -> isNaturalLanguage ( ) ) { $ nb_natural -> addItem ( $ nb_language ) ; } return true ; } ) ; return $ nb_natural ; }
Get the list of all Natural Languages setted for this site .
17,610
public function getAPILanguages ( bool $ force = false ) : CNabuLanguageList { $ nb_api = new CNabuLanguageList ( ) ; $ this -> getLanguages ( $ force ) -> iterate ( function ( $ key , CNabuLanguage $ nb_language ) use ( $ nb_api ) { if ( $ nb_language -> isAPILanguage ( ) ) { $ nb_api -> addItem ( $ nb_language ) ; } return true ; } ) ; return $ nb_api ; }
Get the list of all API Languages setted for this site .
17,611
public function getRoles ( bool $ force = false ) : CNabuRoleList { if ( $ this -> nb_role_list -> isEmpty ( ) || $ force ) { $ this -> nb_role_list -> fillFromSite ( $ this ) ; } return $ this -> nb_role_list ; }
Gets a list of all Roles availables in this Site .
17,612
public function getSiteRoles ( bool $ force = false ) : CNabuSiteRoleList { if ( $ this -> nb_site_role_list -> isEmpty ( ) || $ force ) { $ this -> nb_site_role_list -> clear ( ) ; $ this -> nb_site_role_list -> merge ( CNabuSiteRole :: getSiteRolesForSite ( $ this ) ) ; } return $ this -> nb_site_role_list ; }
Gets a list of all Site Roles availables in this Site .
17,613
public function getSiteRole ( $ nb_site_role ) { if ( is_numeric ( $ nb_role_id = nb_getMixedValue ( $ nb_site_role , NABU_ROLE_FIELD_ID ) ) ) { $ retval = $ this -> getSiteRoles ( ) -> getItem ( $ nb_role_id ) ; } else { $ retval = false ; } return $ retval ; }
Gets a Site Role by his Id .
17,614
public function sendNewUserNotification ( CNabuUser $ nb_user , array $ params = null ) : bool { $ retval = false ; $ nb_engine = CNabuEngine :: getEngine ( ) ; if ( ( $ nb_profile = $ this -> getUserProfile ( $ nb_user ) ) instanceof CNabuSiteUser && ( $ nb_language_id = $ nb_profile -> getLanguageId ( ) ) ) { if ( count ( $ params ) === 0 ) { $ params = array ( ) ; } foreach ( $ nb_user -> getTreeData ( $ nb_language_id , true ) as $ key => $ item ) { if ( is_scalar ( $ item ) ) { $ params [ "target_user_$key" ] = $ item ; } } $ nb_site_role = $ this -> getSiteRole ( $ nb_profile ) ; $ nb_template_id = $ nb_site_role instanceof CNabuSiteRole && $ nb_site_role -> isValueNumeric ( 'nb_messaging_template_new_user' ) ? $ nb_template_id = $ nb_site_role -> getMessagingTemplateNewUser ( ) : $ this -> getMessagingTemplateNewUser ( ) ; return is_numeric ( $ nb_template_id ) && ( $ nb_messaging = $ this -> getMessaging ( $ this -> getCustomer ( ) ) ) instanceof CNabuMessaging && ( $ nb_messaging_factory = $ nb_messaging -> getFactory ( ) ) instanceof CNabuMessagingFactory && $ nb_messaging_factory -> postTemplateMessage ( $ nb_template_id , $ nb_language_id , $ nb_user , null , null , $ params ) ; } else { throw new ENabuSecurityException ( ENabuSecurityException :: ERROR_USER_NOT_ALLOWED , array ( $ nb_user -> getId ( ) ) ) ; } }
Send a New User double opt - in message to validate the account or communitate something to him .
17,615
public function withAuthority ( Actor $ authority = null ) : self { $ statement = clone $ this ; $ statement -> authority = $ authority ; return $ statement ; }
Creates a new Statement based on the current one containing an Authority that asserts the Statement true .
17,616
public function getVoidStatement ( Actor $ actor ) : self { return new Statement ( null , $ actor , Verb :: createVoidVerb ( ) , $ this -> getStatementReference ( ) ) ; }
Returns a Statement that voids the current Statement .
17,617
public function equals ( Statement $ statement ) : bool { if ( null !== $ this -> id xor null !== $ statement -> id ) { return false ; } if ( null !== $ this -> id && null !== $ statement -> id && ! $ this -> id -> equals ( $ statement -> id ) ) { return false ; } if ( ! $ this -> actor -> equals ( $ statement -> actor ) ) { return false ; } if ( ! $ this -> verb -> equals ( $ statement -> verb ) ) { return false ; } if ( ! $ this -> object -> equals ( $ statement -> object ) ) { return false ; } if ( null === $ this -> result && null !== $ statement -> result ) { return false ; } if ( null !== $ this -> result && null === $ statement -> result ) { return false ; } if ( null !== $ this -> result && ! $ this -> result -> equals ( $ statement -> result ) ) { return false ; } if ( null === $ this -> authority && null !== $ statement -> authority ) { return false ; } if ( null !== $ this -> authority && null === $ statement -> authority ) { return false ; } if ( null !== $ this -> authority && ! $ this -> authority -> equals ( $ statement -> authority ) ) { return false ; } if ( $ this -> created != $ statement -> created ) { return false ; } if ( null !== $ this -> context xor null !== $ statement -> context ) { return false ; } if ( null !== $ this -> context && null !== $ statement -> context && ! $ this -> context -> equals ( $ statement -> context ) ) { return false ; } if ( null !== $ this -> attachments xor null !== $ statement -> attachments ) { return false ; } if ( null !== $ this -> attachments && null !== $ statement -> attachments ) { if ( count ( $ this -> attachments ) !== count ( $ statement -> attachments ) ) { return false ; } foreach ( $ this -> attachments as $ key => $ attachment ) { if ( ! $ attachment -> equals ( $ statement -> attachments [ $ key ] ) ) { return false ; } } } return true ; }
Checks if another statement is equal .
17,618
public static function hydrateCollection ( array $ queues ) { $ hydrated = [ ] ; foreach ( $ queues as $ queue ) { $ hydrated [ ] = self :: hydrate ( $ queue ) ; } return $ hydrated ; }
Hydrate a collection of queue objects into a collection of QueueEntity objects
17,619
public static function hydrate ( stdClass $ queue ) { $ hydrated = new QueueEntity ( ) ; if ( isset ( $ queue -> id ) ) { $ hydrated -> setId ( $ queue -> id ) ; } if ( isset ( $ queue -> started_at ) ) { $ hydrated -> setStartedAt ( new DateTime ( $ queue -> started_at ) ) ; } if ( isset ( $ queue -> finished_at ) ) { $ hydrated -> setFinishedAt ( new DateTime ( $ queue -> finished_at ) ) ; } return $ hydrated ; }
Hydrate a java object into a QueueEntity object
17,620
public function getIContact ( $ force = false ) { if ( $ this -> nb_icontact === null || $ force ) { $ this -> nb_icontact = null ; if ( $ this instanceof CNabuDataObject && ! $ this -> isBuiltIn ( ) && $ this -> isValueNumeric ( NABU_ICONTACT_FIELD_ID ) ) { $ nb_icontact = new CNabuIContact ( $ this -> getValue ( NABU_ICONTACT_FIELD_ID ) ) ; if ( $ nb_icontact -> isFetched ( ) ) { $ this -> nb_icontact = $ nb_icontact ; } } } return $ this -> nb_icontact ; }
Gets the iContact instance that owns this object .
17,621
public function setIContact ( CNabuIContact $ nb_icontact ) { $ this -> nb_icontact = $ nb_icontact ; if ( $ this instanceof CNabuDataObject && $ nb_icontact -> contains ( NABU_ICONTACT_FIELD_ID ) ) { $ this -> transferValue ( $ nb_icontact , NABU_ICONTACT_FIELD_ID ) ; } return $ this ; }
Sets the iContact instance that onws this object .
17,622
public function getMembers ( $ force = false ) { if ( $ this -> nb_user_group_member_list -> isEmpty ( ) || $ force ) { $ this -> nb_user_group_member_list -> clear ( ) ; if ( $ this -> isValueNumeric ( 'nb_user_group_id' ) ) { $ this -> nb_user_group_member_list -> merge ( CNabuUserGroupMember :: getMembersOfGroup ( $ this ) ) ; } } return $ this -> nb_user_group_member_list ; }
Returns the full list of members in the group .
17,623
public function getAdminMembers ( $ force = false ) : CNabuUserGroupMemberList { $ this -> getMembers ( $ force ) ; $ nb_admin_list = new CNabuUserGroupMemberList ( ) ; $ this -> nb_user_group_member_list -> iterate ( function ( $ key , CNabuUserGroupMember $ nb_user_group_member ) use ( $ nb_admin_list ) { if ( $ nb_user_group_member -> getAdmin ( ) === 'T' && $ nb_user_group_member -> getStatus ( ) === 'E' ) { $ nb_admin_list -> addItem ( $ nb_user_group_member ) ; } return true ; } ) ; return $ nb_admin_list ; }
Returns the full list of admin members in the group .
17,624
public static function hydrateCollection ( array $ applications ) { $ hydrated = [ ] ; foreach ( $ applications as $ application ) { $ hydrated [ ] = self :: hydrate ( $ application ) ; } return $ hydrated ; }
Hydrate a collection of application objects into a collection of ApplicationEntity objects
17,625
public static function hydrate ( stdClass $ application ) { $ hydrated = new ApplicationEntity ( ) ; if ( isset ( $ application -> id ) ) { $ hydrated -> setId ( $ application -> id ) ; } if ( isset ( $ application -> name ) ) { $ hydrated -> setName ( $ application -> name ) ; } if ( isset ( $ application -> current_scan ) ) { $ hydrated -> setCurrentScan ( $ application -> current_scan ) ; } if ( isset ( $ application -> created_by ) ) { $ hydrated -> setCreatedBy ( UserHydrator :: hydrate ( $ application -> created_by ) ) ; } if ( isset ( $ application -> charged_quota ) ) { $ hydrated -> setChargedQuota ( QuotaHydrator :: hydrate ( $ application -> charged_quota ) ) ; } if ( isset ( $ application -> created_at ) ) { $ hydrated -> setCreatedAt ( new DateTime ( $ application -> created_at ) ) ; } if ( isset ( $ application -> organization ) ) { $ hydrated -> setOrganization ( OrgHydrator :: hydrate ( $ application -> organization ) ) ; } if ( isset ( $ application -> auto_renew ) ) { $ hydrated -> setAutoRenew ( $ application -> auto_renew ) ; } return $ hydrated ; }
Hydrate a application object into a ApplicationEntity object
17,626
public function validateZone ( CNabuSiteTarget $ nb_site_target ) { $ nb_engine = CNabuEngine :: getEngine ( ) ; if ( ! ( ( $ nb_site = $ nb_site_target -> getSite ( ) ) instanceof CNabuSite ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_SITE_NOT_FOUND ) ; } $ this -> zone = ( $ this -> nb_user !== null ? 'P' : 'O' ) ; $ nb_engine -> traceLog ( "Request Zone" , ( $ this -> zone === 'P' ? 'Private' : 'Public' ) ) ; $ site_target_zone = $ nb_site_target -> getZone ( ) ; $ nb_engine -> traceLog ( "Page Zone" , ( $ site_target_zone === 'P' ? 'Private' : ( $ site_target_zone === 'O' ? 'Public' : 'Both' ) ) ) ; $ retval = ( $ site_target_zone === 'B' ) || ( $ site_target_zone !== null && $ site_target_zone === $ this -> zone ) ; if ( $ retval && $ this -> zone === 'P' && $ nb_site -> getRequirePoliciesAfterLogin ( ) === 'T' ) { if ( $ this -> nb_user -> getPoliciesAccepted ( ) === 'T' ) { $ nb_engine -> traceLog ( 'Policies' , 'Accepted' ) ; } else { $ nb_engine -> traceLog ( 'Policies' , 'Not accepted' ) ; if ( $ nb_site_target -> getIgnorePolicies ( ) === 'F' && ( $ link = $ nb_site -> getPoliciesTargetLink ( ) ) -> isLinkable ( ) && ! ( $ link -> matchTarget ( $ nb_site_target ) ) ) { throw new ENabuRedirectionException ( 428 , new CNabuHTTPRedirection ( 428 , $ link -> getBestQualifiedURL ( ) ) ) ; } } } return $ retval ; }
Validates if the zone is allowed for current user .
17,627
public function isSignInLocked ( ) { $ nb_session = $ this -> nb_application -> getSession ( ) ; if ( $ nb_session === null || ! ( $ nb_session instanceof CNabuHTTPSession ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_SESSION_NOT_FOUND ) ; } $ nb_site = $ this -> nb_application -> getHTTPServer ( ) -> getSite ( ) ; if ( $ nb_site === null || ! ( $ nb_site instanceof CNabuSite ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_SITE_NOT_FOUND ) ; } $ max_signin_retries = $ nb_site -> getMaxSignInRetries ( ) ; $ signin_locked_delay = $ nb_site -> getSignInLockDelay ( ) ; $ signin_retries = $ nb_session -> getVariable ( 'signin_retries' , 0 ) ; $ signin_last_fail_timestamp = $ nb_session -> getVariable ( 'signin_last_fail_timestamp' , 0 ) ; $ now = time ( ) - $ signin_last_fail_timestamp ; if ( $ now > $ signin_locked_delay ) { $ this -> resetSignInLock ( ) ; $ retval = false ; } else { $ retval = $ max_signin_retries > 0 && $ signin_retries >= $ max_signin_retries && $ now < $ signin_locked_delay ; } return $ retval ; }
Check if the Sign - in is enabled or locked by an excess of retries .
17,628
public function resetSignInLock ( ) { $ nb_session = $ this -> nb_application -> getSession ( ) ; if ( $ nb_session === null || ! ( $ nb_session instanceof CNabuHTTPSession ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_SESSION_NOT_FOUND ) ; } $ nb_session -> unsetVariable ( 'signin_retries' ) ; $ nb_session -> unsetVariable ( 'signin_last_fail_timestamp' ) ; }
Reset sign - in counters to 0
17,629
public function lockSignIn ( ) { $ retval = false ; $ nb_session = $ this -> nb_application -> getSession ( ) ; if ( $ nb_session === null || ! ( $ nb_session instanceof CNabuHTTPSession ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_SESSION_NOT_FOUND ) ; } $ nb_response = $ this -> nb_application -> getResponse ( ) ; if ( $ nb_response === null || ! ( $ nb_response instanceof CNabuHTTPResponse ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_RESPONSE_NOT_FOUND ) ; } $ nb_site = $ this -> nb_application -> getHTTPServer ( ) -> getSite ( ) ; if ( $ nb_site === null || ! ( $ nb_site instanceof CNabuSite ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_SITE_NOT_FOUND ) ; } try { $ lang = $ this -> nb_application -> getRequest ( ) -> getLanguage ( ) -> getId ( ) ; } catch ( Exception $ e ) { $ lang = null ; } if ( $ lang === null ) { $ lang = $ nb_site -> getDefaultLanguageId ( ) ; } $ max_signin_retries = $ nb_site -> getMaxSignInRetries ( ) ; $ signin_locked_delay = $ nb_site -> getSignInLockDelay ( ) ; $ signin_retries = $ nb_session -> getVariable ( 'signin_retries' , 0 ) ; $ signin_last_fail_timestamp = $ nb_session -> getVariable ( 'signin_last_fail_timestamp' , 0 ) ; $ now = time ( ) - $ signin_last_fail_timestamp ; if ( $ max_signin_retries > 0 ) { if ( $ this -> isSignInLocked ( ) ) { } else { $ nb_session -> setVariable ( 'signin_retries' , $ signin_retries < $ max_signin_retries ? ++ $ signin_retries : $ max_signin_retries ) ; $ nb_session -> setVariable ( 'signin_last_fail_timestamp' , time ( ) ) ; } if ( $ this -> isSignInLocked ( ) ) { if ( is_string ( $ link = $ nb_site -> getLoginMaxFailsTargetLink ( ) -> getBestQualifiedURL ( array ( $ lang => $ lang ) ) ) ) { $ nb_response -> redirect ( $ nb_site -> getLoginMaxFailsErrorCode ( ) , $ link ) ; } else { $ retval = true ; } } } return $ retval ; }
Tries to lock the sign - in . If counter is less than the max then increases the counter . If elapsed time between now and last retry failed is great than the max lock delay then resets the counter .
17,630
public function isUserLogged ( ) { return ( $ this -> nb_user !== null && $ this -> nb_role !== null && $ this -> nb_site_user !== null ) ; }
Check if the user is logged .
17,631
public function revalidatePassword ( CNabuSite $ nb_site , CNabuUser $ nb_user , string $ passwd ) : bool { if ( ! ( $ nb_site instanceof CNabuSite ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_METHOD_PARAMETER_NOT_VALID , array ( '$nb_site' ) ) ; } if ( ! ( $ nb_user instanceof CNabuUser ) || ! $ nb_user -> isFetched ( ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_METHOD_PARAMETER_NOT_VALID , array ( '$nb_user' ) ) ; } if ( ! is_string ( $ passwd ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_VALUE , array ( '$passwd' , print_r ( $ passwd , true ) ) ) ; } $ nb_log_user = CNabuUser :: findBySiteLogin ( $ nb_site , $ nb_user -> getLogin ( ) , $ passwd ) ; return $ nb_user -> getId ( ) == $ nb_log_user -> getId ( ) ; }
Revalidates a password to ensure that the user can continue in the private zone .
17,632
public function applyRoleMask ( INabuRoleMask $ object , array $ params = null ) : bool { return $ object -> applyRoleMask ( $ this -> nb_role , array ( self :: ROLE_MASK_USER_SIGNED => $ this -> isUserLogged ( ) , self :: ROLE_MASK_WORK_CUSTOMER => $ this -> hasWorkCustomer ( ) ) ) ; }
Applies a Role to an object forcing to clean all related entities that does not share the same role .
17,633
public function acceptPolicies ( bool $ save = true ) { $ nb_site = $ this -> nb_application -> getHTTPServer ( ) -> getSite ( ) ; if ( $ nb_site === null || ! ( $ nb_site instanceof CNabuSite ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_SITE_NOT_FOUND ) ; } if ( $ this -> isUserLogged ( ) ) { $ this -> nb_user -> setPoliciesAccepted ( 'T' ) ; $ this -> nb_user -> setPoliciesDatetime ( date ( 'Y-m-d H:i:s' , time ( ) ) ) ; if ( $ nb_site -> getEnableSessionStrictPolicies ( ) === 'T' ) { session_regenerate_id ( true ) ; } if ( $ save && $ this -> nb_user -> save ( ) && strlen ( $ url = $ nb_site -> getLoginRedirectionTargetLink ( $ this -> nb_site_role ) -> getBestQualifiedURL ( ) ) > 0 ) { $ after_login = $ url . "?logged" ; throw new ENabuRedirectionException ( 301 , new CNabuHTTPRedirection ( 301 , $ url ) ) ; } } }
Call this method when a User accept the Policies of the Site . In consequence the lock for policies in all Targets is ignored .
17,634
public function getAll ( $ appId , $ scanId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> classes ( ) -> getAll ( $ appId , $ scanId , $ queryParams ) ; return new CustomClassesResponse ( $ response ) ; }
Get all custom classes for a scan
17,635
public function getById ( $ appId , $ scanId , $ classId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> classes ( ) -> getById ( $ appId , $ scanId , $ classId , $ queryParams ) ; return new CustomClassResponse ( $ response ) ; }
Get custom class for scan by id
17,636
public function create ( $ appId , $ scanId , $ input , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> classes ( ) -> create ( $ appId , $ scanId , $ input -> toArray ( ) , $ queryParams ) ; return new CustomClassResponse ( $ response ) ; }
Create custom class for a scan
17,637
public function getAll ( $ appId , $ scanId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> files ( ) -> getAll ( $ appId , $ scanId , $ queryParams ) ; return new FilesResponse ( $ response ) ; }
Get all files for a scan
17,638
public function getById ( $ appId , $ scanId , $ fileId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> files ( ) -> getById ( $ appId , $ scanId , $ fileId , $ queryParams ) ; return new FileResponse ( $ response ) ; }
Get file for scan by id
17,639
public function delete ( $ appId , $ scanId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> files ( ) -> delete ( $ appId , $ scanId , $ queryParams ) ; return new BaseResponse ( $ response ) ; }
Delete the source code of a scan
17,640
public static function getAlliContacts ( CNabuCustomer $ nb_customer ) { $ nb_customer_id = nb_getMixedValue ( $ nb_customer , 'nb_customer_id' ) ; if ( is_numeric ( $ nb_customer_id ) ) { $ retval = forward_static_call ( array ( get_called_class ( ) , 'buildObjectListFromSQL' ) , 'nb_icontact_id' , 'select * ' . 'from nb_icontact ' . 'where nb_customer_id=%cust_id$d' , array ( 'cust_id' => $ nb_customer_id ) , $ nb_customer ) ; } else { $ retval = new CNabuIContactList ( ) ; } return $ retval ; }
Get all items in the storage as an associative array where the field nb_icontact_id is the index and each value is an instance of class CNabuIContactBase .
17,641
private function getProvidersConfig ( ) { $ config = [ ] ; foreach ( self :: PROVIDERS as $ provider ) { $ config [ ucfirst ( $ provider ) ] = [ 'enabled' => ( bool ) $ this -> scopeConfig -> getValue ( sprintf ( self :: CONFIG_PATH_SOCIAL_LOGIN_PROVIDER_ENABLED , $ provider ) , ScopeInterface :: SCOPE_STORE ) , 'keys' => [ 'key' => $ this -> scopeConfig -> getValue ( sprintf ( self :: CONFIG_PATH_SOCIAL_LOGIN_PROVIDER_KEY , $ provider ) , ScopeInterface :: SCOPE_STORE ) , 'secret' => $ this -> scopeConfig -> getValue ( sprintf ( self :: CONFIG_PATH_SOCIAL_LOGIN_PROVIDER_SECRET , $ provider ) , ScopeInterface :: SCOPE_STORE ) , ] ] ; } return $ config ; }
Gets providers from Magento configuration .
17,642
private function getCustomerData ( UserProfile $ profile ) { $ customerData = [ ] ; foreach ( [ 'firstName' , 'lastName' , 'email' ] as $ field ) { $ data = $ profile -> { $ field } ; $ customerData [ strtolower ( $ field ) ] = $ data !== null ? $ data : '-' ; } return $ customerData ; }
Gets customer data for a hybrid auth profile .
17,643
private function handleProviderQuirks ( $ provider , $ customer ) { switch ( $ provider ) { case 'Twitter' : if ( $ customer -> getData ( 'lastname' ) === '-' ) { $ nameParts = explode ( ' ' , $ customer -> getData ( 'firstname' ) ) ; if ( count ( $ nameParts ) > 1 ) { $ customer -> setData ( 'firstname' , $ nameParts [ 0 ] ) ; $ lastName = implode ( ' ' , array_slice ( $ nameParts , 1 ) ) ; $ customer -> setData ( 'lastname' , $ lastName ) ; } } break ; } }
Some providers don t really put data in the right fields .
17,644
private function getCustomerForProfile ( $ provider , UserProfile $ profile ) { $ customer = $ this -> customerFactory -> create ( ) ; $ customer -> setWebsiteId ( $ this -> getCurrentWebsiteId ( ) ) ; $ customer -> loadByEmail ( $ profile -> emailVerified ) ; if ( ! $ customer -> getId ( ) ) { $ customer -> setData ( 'email' , $ profile -> emailVerified ) ; $ customer -> addData ( $ this -> getCustomerData ( $ profile ) ) ; $ this -> handleProviderQuirks ( $ provider , $ customer ) ; $ this -> customerResource -> save ( $ customer ) ; } return $ customer ; }
Loads or creates a customer for a hybridauth profile .
17,645
private function isProviderEnabled ( $ provider ) { return ( bool ) $ this -> scopeConfig -> getValue ( sprintf ( SocialLoginService :: CONFIG_PATH_SOCIAL_LOGIN_PROVIDER_ENABLED , $ provider ) , ScopeInterface :: SCOPE_STORE ) ; }
Checks if social login provider is enabled in config .
17,646
public function setClusterGroupId ( int $ nb_cluster_group_id ) : CNabuDataObject { if ( $ nb_cluster_group_id === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$nb_cluster_group_id" ) ) ; } $ this -> setValue ( 'nb_cluster_group_id' , $ nb_cluster_group_id ) ; return $ this ; }
Sets the Cluster Group Id attribute value .
17,647
public function setOSId ( int $ os_id ) : CNabuDataObject { if ( $ os_id === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$os_id" ) ) ; } $ this -> setValue ( 'nb_cluster_user_group_os_id' , $ os_id ) ; return $ this ; }
Sets the Cluster User Group OS Id attribute value .
17,648
public static function hydrateCollection ( array $ entrypoints ) { $ hydrated = [ ] ; foreach ( $ entrypoints as $ entrypoint ) { $ hydrated [ ] = self :: hydrate ( $ entrypoint ) ; } return $ hydrated ; }
Hydrate a collection of entrypoint objects into a collection of EntrypointEntity objects
17,649
public static function hydrate ( stdClass $ entrypoint ) { $ hydrated = new EntrypointEntity ( ) ; if ( isset ( $ entrypoint -> id ) ) { $ hydrated -> setId ( $ entrypoint -> id ) ; } if ( isset ( $ entrypoint -> line ) ) { $ hydrated -> setLine ( $ entrypoint -> line ) ; } if ( isset ( $ entrypoint -> file ) ) { $ hydrated -> setFile ( FileHydrator :: hydrate ( $ entrypoint -> file ) ) ; } if ( isset ( $ entrypoint -> function ) ) { $ hydrated -> setFunction ( CustomFunctionHydrator :: hydrate ( $ entrypoint -> function ) ) ; } if ( isset ( $ entrypoint -> class ) ) { $ hydrated -> setClass ( CustomClassHydrator :: hydrate ( $ entrypoint -> class ) ) ; } return $ hydrated ; }
Hydrate a entrypoint object into a EntrypointEntity object
17,650
public static function hydrateCollection ( array $ customClasses ) { $ hydrated = [ ] ; foreach ( $ customClasses as $ customClass ) { $ hydrated [ ] = self :: hydrate ( $ customClass ) ; } return $ hydrated ; }
Hydrate a collection of customClass objects into a collection of CustomClassEntity objects
17,651
public static function hydrate ( stdClass $ customClass ) { $ hydrated = new CustomClassEntity ( ) ; if ( isset ( $ customClass -> id ) ) { $ hydrated -> setId ( $ customClass -> id ) ; } if ( isset ( $ customClass -> start_line ) ) { $ hydrated -> setStartLine ( $ customClass -> start_line ) ; } if ( isset ( $ customClass -> end_line ) ) { $ hydrated -> setEndLine ( $ customClass -> end_line ) ; } if ( isset ( $ customClass -> start_column ) ) { $ hydrated -> setStartColumn ( $ customClass -> start_column ) ; } if ( isset ( $ customClass -> end_column ) ) { $ hydrated -> setEndColumn ( $ customClass -> end_column ) ; } if ( isset ( $ customClass -> name ) ) { $ hydrated -> setName ( $ customClass -> name ) ; } if ( isset ( $ customClass -> file ) ) { $ hydrated -> setFile ( FileHydrator :: hydrate ( $ customClass -> file ) ) ; } if ( isset ( $ customClass -> package ) ) { $ hydrated -> setPackage ( $ customClass -> package ) ; } return $ hydrated ; }
Hydrate a customClass object into a CustomClassEntity object
17,652
public function setEncoding ( $ encoding ) { if ( ! is_string ( $ encoding ) || ! in_array ( $ encoding , mb_list_encodings ( ) ) ) { throw new \ InvalidArgumentException ( __METHOD__ . "() expects parameter one, encoding, to be a valid " . "character encoding name" ) ; } $ this -> encoding = $ encoding ; return $ this ; }
Sets the chunker s character encoding
17,653
public function setIndex ( $ index ) { if ( ! is_numeric ( $ index ) || ! is_int ( + $ index ) || $ index < 0 ) { throw new \ InvalidArgumentException ( __METHOD__ . "() expects parameter one, index, to be a positive " . "integer or zero" ) ; } $ this -> index = $ index ; return $ this ; }
Sets the chunker s chunk index
17,654
public function setSize ( $ size ) { if ( ! is_numeric ( $ size ) || ! is_int ( + $ size ) || $ size < 1 ) { throw new \ InvalidArgumentException ( __METHOD__ . "() expects parameter one, size, to be a positive integer" ) ; } $ this -> size = $ size ; return $ this ; }
Sets the chunker s chunk size
17,655
public function getPreviousChunk ( ) { $ offset = -- $ this -> index * $ this -> size ; if ( $ offset >= 0 ) { $ chunk = $ this -> getChunk ( $ offset ) ; } else { $ chunk = false ; } return $ chunk ; }
Returns the previous chunk and updates the chunker s internal pointer
17,656
public function compile ( $ stub , $ modelName , $ modelData , stdClass $ scaffolderConfig , $ hash , ScaffolderThemeExtensionInterface $ themeExtension , array $ extensions , $ extra = null ) { $ this -> stub = $ stub ; return $ this -> setPageTitle ( $ scaffolderConfig ) -> setAppName ( $ scaffolderConfig ) -> setLinks ( $ extra [ 'links' ] , $ scaffolderConfig ) -> replaceRoutePrefix ( $ scaffolderConfig -> routing -> prefix ) -> store ( $ modelName , $ scaffolderConfig , $ themeExtension -> runAfterPageLayoutIsCompiled ( $ this -> stub , $ scaffolderConfig ) , new FileToCompile ( null , null ) ) ; }
Compiles the page layout .
17,657
private function setPageTitle ( stdClass $ scaffolderConfig ) { $ this -> stub = str_replace ( '{{page_title}}' , $ scaffolderConfig -> userInterface -> pageTitle , $ this -> stub ) ; return $ this ; }
Replace the page title .
17,658
private function setAppName ( stdClass $ scaffolderConfig ) { $ this -> stub = str_replace ( '{{app_name}}' , $ scaffolderConfig -> name , $ this -> stub ) ; return $ this ; }
Replace the app name .
17,659
private function setLinks ( $ links , stdClass $ scaffolderConfig ) { $ navLinks = '' ; foreach ( $ links as $ link ) { $ navLinks .= sprintf ( " <li> <a href='/%s' class='waves-effect'> %s </a> </li>" , $ scaffolderConfig -> routing -> prefix . '/' . strtolower ( $ link [ 'modelName' ] ) , $ link [ 'modelLabel' ] ) ; } $ this -> stub = str_replace ( '{{links}}' , $ navLinks , $ this -> stub ) ; return $ this ; }
Add links to the nav .
17,660
public function getAll ( $ appId , $ profileId , array $ queryParams ) { $ response = $ this -> api -> applications ( ) -> profiles ( ) -> sanitizers ( ) -> getAll ( $ appId , $ profileId , $ queryParams ) ; return new SanitizersResponse ( $ response ) ; }
Get all sanitizers for a profile profile
17,661
public function getById ( $ appId , $ profileId , $ sanitizerId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> profiles ( ) -> sanitizers ( ) -> getById ( $ appId , $ profileId , $ sanitizerId , $ queryParams ) ; return new SanitizerResponse ( $ response ) ; }
Get sanitizer for profile profile by id
17,662
public function create ( $ appId , $ profileId , SanitizerBuilder $ input , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> profiles ( ) -> sanitizers ( ) -> create ( $ appId , $ profileId , $ input -> toArray ( ) , $ queryParams ) ; return new SanitizerResponse ( $ response ) ; }
Create sanitizer for profile profile
17,663
public static function hydrateCollection ( array $ ignores ) { $ hydrated = [ ] ; foreach ( $ ignores as $ ignore ) { $ hydrated [ ] = self :: hydrate ( $ ignore ) ; } return $ hydrated ; }
Hydrate a collection of ignore objects into a collection of IgnoredLocationEntity objects
17,664
public static function hydrate ( stdClass $ ignore ) { $ hydrated = new IgnoredLocationEntity ( ) ; if ( isset ( $ ignore -> id ) ) { $ hydrated -> setId ( $ ignore -> id ) ; } if ( isset ( $ ignore -> path ) ) { $ hydrated -> setPath ( $ ignore -> path ) ; } if ( isset ( $ ignore -> match ) ) { $ hydrated -> setMatch ( $ ignore -> match ) ; } if ( isset ( $ ignore -> exclude ) ) { $ hydrated -> setExclude ( $ ignore -> exclude ) ; } return $ hydrated ; }
Hydrate a ignore object into a IgnoredLocationEntity object
17,665
public static function hydrateCollection ( array $ customFunctions ) { $ hydrated = [ ] ; foreach ( $ customFunctions as $ customFunction ) { $ hydrated [ ] = self :: hydrate ( $ customFunction ) ; } return $ hydrated ; }
Hydrate a collection of custom - function objects into a collection of CustomFunctionEntity objects
17,666
public static function hydrate ( stdClass $ customFunction ) { $ hydrated = new CustomFunctionEntity ( ) ; if ( isset ( $ customFunction -> id ) ) { $ hydrated -> setId ( $ customFunction -> id ) ; } if ( isset ( $ customFunction -> start_line ) ) { $ hydrated -> setStartLine ( $ customFunction -> start_line ) ; } if ( isset ( $ customFunction -> end_line ) ) { $ hydrated -> setEndLine ( $ customFunction -> end_line ) ; } if ( isset ( $ customFunction -> start_column ) ) { $ hydrated -> setStartColumn ( $ customFunction -> start_column ) ; } if ( isset ( $ customFunction -> end_column ) ) { $ hydrated -> setEndColumn ( $ customFunction -> end_column ) ; } if ( isset ( $ customFunction -> name ) ) { $ hydrated -> setName ( $ customFunction -> name ) ; } if ( isset ( $ customFunction -> file ) ) { $ hydrated -> setFile ( FileHydrator :: hydrate ( $ customFunction -> file ) ) ; } if ( isset ( $ customFunction -> class ) ) { $ hydrated -> setClass ( CustomClassHydrator :: hydrate ( $ customFunction -> class ) ) ; } if ( isset ( $ customFunction -> parameters ) ) { $ hydrated -> setParameters ( $ customFunction -> parameters ) ; } return $ hydrated ; }
Hydrate a custom - function object into a CustomFunctionEntity object
17,667
public function compile ( $ stub , $ modelName , $ modelData , stdClass $ scaffolderConfig , $ hash , ScaffolderThemeExtensionInterface $ themeExtension , array $ extensions , $ extra = null ) { if ( File :: exists ( base_path ( 'scaffolder-config/cache/view_index_' . $ hash . self :: CACHE_EXT ) ) ) { return $ this -> store ( $ modelName , $ scaffolderConfig , '' , new FileToCompile ( true , $ hash ) ) ; } else { $ this -> stub = $ stub ; $ this -> replaceClassName ( $ modelName ) -> replaceBreadcrumb ( $ modelName , $ modelData -> modelLabel ) -> addDatatableFields ( $ modelName , $ modelData ) -> setTableHeaders ( $ modelData ) -> replaceRoutePrefix ( $ scaffolderConfig -> routing -> prefix ) ; $ this -> stub = $ themeExtension -> runAfterIndexViewIsCompiled ( $ this -> stub , $ modelData , $ scaffolderConfig ) ; foreach ( $ extensions as $ extension ) { $ this -> stub = $ extension -> runAfterIndexViewIsCompiled ( $ this -> stub , $ modelData , $ scaffolderConfig ) ; } return $ this -> store ( $ modelName , $ scaffolderConfig , $ this -> stub , new FileToCompile ( false , $ hash ) ) ; } }
Compiles the index view .
17,668
private function addDatatableFields ( $ modelName , $ modelData ) { $ fields = '' ; $ firstIteration = true ; foreach ( $ modelData -> fields as $ field ) { if ( $ field -> hideInListings === false ) { if ( $ firstIteration ) { $ fields .= sprintf ( "{ data: '%s', name: '%s' }," . PHP_EOL , $ field -> name , $ field -> name ) ; $ firstIteration = false ; } else { $ fields .= sprintf ( $ this -> tab ( 4 ) . "{ data: '%s', name: '%s' }," . PHP_EOL , $ field -> name , $ field -> name ) ; } } } $ this -> stub = str_replace ( '{{datatable_fields}}' , $ fields , $ this -> stub ) ; $ this -> stub = str_replace ( '{{datatable_url}}' , ucfirst ( $ modelName ) , $ this -> stub ) ; return $ this ; }
Datatable fields .
17,669
protected function getVersionedResourceClassName ( $ group , $ name ) { $ class = \ str_replace ( '.' , '\\' , $ name ) ; $ version = $ this -> getVersionNamespace ( ) ; return \ sprintf ( '%s\%s\%s\%s' , $ this -> namespace , $ group , $ version , $ class ) ; }
Get versioned resource class name .
17,670
protected function getVersionNamespace ( ) { $ version = $ this -> api ( ) -> getVersion ( ) ; $ supported = $ this -> getSupportedVersionNamespace ( ) ; if ( isset ( $ supported [ $ version ] ) ) { return $ supported [ $ version ] ; } return 'Base' ; }
Get the version namespace .
17,671
static public function getItemsForCatalog ( $ nb_catalog , int $ level ) { $ nb_catalog_id = nb_getMixedValue ( $ nb_catalog , NABU_CATALOG_FIELD_ID ) ; if ( is_numeric ( $ nb_catalog_id ) ) { $ retval = CNabuCatalogItem :: buildObjectListFromSQL ( NABU_CATALOG_ITEM_FIELD_ID , 'SELECT * FROM nb_catalog_item WHERE nb_catalog_id=%catalog_id$d ' . ( $ level > 0 ? 'AND nb_catalog_item_level<=%level$d ' : '' ) . 'ORDER BY nb_catalog_item_order ASC' , array ( 'catalog_id' => $ nb_catalog_id , 'level' => $ level ) , ( $ nb_catalog instanceof CNabuCatalog ? $ nb_catalog : null ) ) ; if ( $ nb_catalog instanceof CNabuCatalog ) { $ retval -> setCatalog ( $ nb_catalog ) ; } } else { if ( $ nb_catalog instanceof CNabuCatalog ) { $ retval = new CNabuCatalogItemList ( $ nb_catalog ) ; $ retval -> setOwner ( $ nb_catalog ) ; } else { $ retval = new CNabuCatalogItemList ( ) ; } } return $ retval ; }
Gets the list of items of a catalog from the storage .
17,672
static public function getItemTranslationsForCatalog ( $ nb_catalog , int $ level ) { $ nb_catalog_id = nb_getMixedValue ( $ nb_catalog , NABU_CATALOG_FIELD_ID ) ; if ( is_numeric ( $ nb_catalog_id ) ) { $ retval = CNabuCatalogItemLanguage :: buildObjectListFromSQL ( null , 'SELECT cil.* FROM nb_catalog_item ci, nb_catalog_item_lang cil WHERE ci.nb_catalog_item_id=cil.nb_catalog_item_id AND ci.nb_catalog_id=%catalog_id$d ' . ( $ level > 0 ? 'and ci.nb_catalog_item_level<=%level$d ' : '' ) . 'ORDER BY ci.nb_catalog_item_order, cil.nb_language_id' , array ( 'catalog_id' => $ nb_catalog_id , 'level' => $ level ) ) ; } else { $ retval = new CNabuCatalogItemLanguageList ( ) ; } return $ retval ; }
Gets the list of translations associated to all items of a catalog from the storage .
17,673
public function getItems ( bool $ force = false ) : CNabuCatalogItemList { if ( $ this -> nb_tree_child_list -> isEmpty ( ) || $ force ) { $ this -> nb_tree_child_list -> merge ( CNabuCatalogItem :: buildObjectListFromSQL ( 'nb_catalog_item_id' , 'SELECT * FROM nb_catalog_item WHERE nb_catalog_id=%catalog_id$d AND nb_catalog_item_parent_id=%parent_id$d ORDER BY nb_catalog_item_order ASC' , array ( 'catalog_id' => $ this -> getCatalogId ( ) , 'parent_id' => $ this -> getId ( ) ) , $ this -> getCatalog ( ) ) ) ; } return $ this -> nb_tree_child_list ; }
Get children items of this Item .
17,674
public static function getAllCatalogTaxonomies ( CNabuCatalog $ nb_catalog ) { $ nb_catalog_id = nb_getMixedValue ( $ nb_catalog , 'nb_catalog_id' ) ; if ( is_numeric ( $ nb_catalog_id ) ) { $ retval = forward_static_call ( array ( get_called_class ( ) , 'buildObjectListFromSQL' ) , 'nb_catalog_taxonomy_id' , 'select * ' . 'from nb_catalog_taxonomy ' . 'where nb_catalog_id=%catalog_id$d' , array ( 'catalog_id' => $ nb_catalog_id ) , $ nb_catalog ) ; } else { $ retval = new CNabuCatalogTaxonomyList ( ) ; } return $ retval ; }
Get all items in the storage as an associative array where the field nb_catalog_taxonomy_id is the index and each value is an instance of class CNabuCatalogTaxonomyBase .
17,675
public function setScope ( string $ scope = "O" ) : CNabuDataObject { if ( $ scope === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$scope" ) ) ; } $ this -> setValue ( 'nb_catalog_taxonomy_scope' , $ scope ) ; return $ this ; }
Sets the Catalog Taxonomy Scope attribute value .
17,676
public function setNew ( string $ new = "T" ) : CNabuDataObject { if ( $ new === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$new" ) ) ; } $ this -> setValue ( 'nb_user_group_member_new' , $ new ) ; return $ this ; }
Sets the User Group Member New attribute value .
17,677
public function setAdmin ( string $ admin = "F" ) : CNabuDataObject { if ( $ admin === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$admin" ) ) ; } $ this -> setValue ( 'nb_user_group_member_admin' , $ admin ) ; return $ this ; }
Sets the User Group Member Admin attribute value .
17,678
public function setVendorKey ( string $ vendor_key ) { if ( ! nb_isValidKey ( $ vendor_key ) ) { throw new ENabuProviderException ( ENabuProviderException :: ERROR_VENDOR_KEY_NOT_VALID , array ( $ vendor_key ) ) ; } $ this -> setValue ( self :: VENDOR_KEY , $ vendor_key ) ; try { $ this -> getComplexKey ( ) ; } catch ( ENabuProviderException $ ex ) { } return $ this ; }
Sets the vendor key
17,679
public function setModuleKey ( string $ module_key ) { if ( ! nb_isValidKey ( $ module_key ) ) { throw new ENabuProviderException ( ENabuProviderException :: ERROR_MODULE_KEY_NOT_VALID , array ( $ module_key ) ) ; } $ this -> setValue ( self :: MODULE_KEY , $ module_key ) ; try { $ this -> getComplexKey ( ) ; } catch ( ENabuProviderException $ ex ) { } return $ this ; }
Sets the module key
17,680
public static function getAllUserGroupTypes ( CNabuCustomer $ nb_customer ) { $ nb_customer_id = nb_getMixedValue ( $ nb_customer , 'nb_customer_id' ) ; if ( is_numeric ( $ nb_customer_id ) ) { $ retval = forward_static_call ( array ( get_called_class ( ) , 'buildObjectListFromSQL' ) , 'nb_user_group_type_id' , 'select * ' . 'from nb_user_group_type ' . 'where nb_customer_id=%cust_id$d' , array ( 'cust_id' => $ nb_customer_id ) , $ nb_customer ) ; } else { $ retval = new CNabuUserGroupTypeList ( ) ; } return $ retval ; }
Get all items in the storage as an associative array where the field nb_user_group_type_id is the index and each value is an instance of class CNabuUserGroupTypeBase .
17,681
public function setExclusive ( string $ exclusive = "F" ) : CNabuDataObject { if ( $ exclusive === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$exclusive" ) ) ; } $ this -> setValue ( 'nb_user_group_type_exclusive' , $ exclusive ) ; return $ this ; }
Sets the User Group Type Exclusive attribute value .
17,682
public function setCreatorOwner ( string $ creator_owner = "T" ) : CNabuDataObject { if ( $ creator_owner === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$creator_owner" ) ) ; } $ this -> setValue ( 'nb_user_group_type_creator_owner' , $ creator_owner ) ; return $ this ; }
Sets the User Group Type Creator Owner attribute value .
17,683
protected function addElementTableAttributes ( ) { $ segments = Craft :: $ app -> getRequest ( ) -> getSegments ( ) ; $ actionSegment = $ segments [ count ( $ segments ) - 1 ] ?? null ; $ classes = [ Entry :: class , Category :: class ] ; foreach ( $ classes as $ class ) { Event :: on ( $ class , Element :: EVENT_REGISTER_TABLE_ATTRIBUTES , function ( RegisterElementTableAttributesEvent $ event ) use ( $ actionSegment ) { $ event -> tableAttributes [ '_childme_addChild' ] = $ actionSegment !== 'get-elements' ? Craft :: t ( 'child-me' , 'Add child' ) : '' ; } ) ; Event :: on ( $ class , Element :: EVENT_SET_TABLE_ATTRIBUTE_HTML , function ( SetElementTableAttributeHtmlEvent $ event ) use ( $ class ) { if ( $ event -> attribute === '_childme_addChild' ) { $ html = '' ; switch ( $ class ) { case 'craft\elements\Entry' : $ entry = $ event -> sender ; if ( $ entry -> section -> type !== 'structure' ) { break ; } $ maxLevels = $ entry -> section -> maxLevels ; $ visible = ! $ maxLevels || $ entry -> level < $ maxLevels ; $ newUrl = UrlHelper :: cpUrl ( implode ( '/' , [ 'entries' , $ entry -> section -> handle , 'new' ] ) , [ 'typeId' => $ entry -> type -> id , 'parentId' => $ entry -> id , ] ) ; $ html = $ this -> getElementTableAttributeHtml ( $ newUrl , $ visible , [ 'data-section="' . $ entry -> section -> handle . '"' , 'data-id="' . $ entry -> id . '"' ] ) ; break ; case 'craft\elements\Category' : $ category = $ event -> sender ; $ maxLevels = $ category -> group -> maxLevels ; $ visible = ! $ maxLevels || $ category -> level < $ maxLevels ; $ newUrl = UrlHelper :: cpUrl ( implode ( '/' , [ 'categories' , $ category -> group -> handle , 'new' ] ) , [ 'parentId' => $ category -> id , ] ) ; $ html = $ this -> getElementTableAttributeHtml ( $ newUrl , $ visible ) ; break ; } $ event -> html = $ html ; $ event -> handled = true ; } } ) ; } }
Add element table attributes
17,684
public function setCommerceProductCategoryId ( int $ nb_commerce_product_category_id ) : CNabuDataObject { if ( $ nb_commerce_product_category_id === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$nb_commerce_product_category_id" ) ) ; } $ this -> setValue ( 'nb_commerce_product_category_id' , $ nb_commerce_product_category_id ) ; return $ this ; }
Sets the Commerce Product Category Id attribute value .
17,685
public static function getAllUserGroups ( CNabuCustomer $ nb_customer ) { $ nb_customer_id = nb_getMixedValue ( $ nb_customer , 'nb_customer_id' ) ; if ( is_numeric ( $ nb_customer_id ) ) { $ retval = forward_static_call ( array ( get_called_class ( ) , 'buildObjectListFromSQL' ) , 'nb_user_group_id' , 'select * ' . 'from nb_user_group ' . 'where nb_customer_id=%cust_id$d' , array ( 'cust_id' => $ nb_customer_id ) , $ nb_customer ) ; } else { $ retval = new CNabuUserGroupList ( ) ; } return $ retval ; }
Get all items in the storage as an associative array where the field nb_user_group_id is the index and each value is an instance of class CNabuUserGroupBase .
17,686
public function setStatus ( string $ status = "E" ) : CNabuDataObject { if ( $ status === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$status" ) ) ; } $ this -> setValue ( 'nb_user_group_status' , $ status ) ; return $ this ; }
Sets the User Group Status attribute value .
17,687
public function newProductCategory ( string $ key = null , int $ order = 1 ) : CNabuCommerceProductCategory { $ nb_commerce_product_category = $ this -> isBuiltIn ( ) ? new CNabuBuiltInCommerceProductCategory ( ) : new CNabuCommerceProductCategory ( ) ; $ nb_commerce_product_category -> setKey ( $ key ) ; $ nb_commerce_product_category -> setOrder ( $ order ) ; return $ this -> addProductCategoryObject ( $ nb_commerce_product_category ) ; }
Creates a new Product Category instance .
17,688
public function addProductCategoryObject ( CNabuCommerceProductCategory $ nb_commerce_product_category ) { $ nb_commerce_product_category -> setCommerce ( $ this ) ; return $ this -> nb_commerce_product_category_list -> addItem ( $ nb_commerce_product_category ) ; }
Adds a Product Category object to this Commerce .
17,689
public function getProductCategory ( $ nb_commerce_product_category ) { $ nb_category = false ; $ nb_category_id = nb_getMixedValue ( $ nb_commerce_product_category , NABU_COMMERCE_PRODUCT_CATEGORY_FIELD_ID ) ; if ( is_numeric ( $ nb_category_id ) ) { $ nb_category = $ this -> nb_commerce_product_category_list -> getItem ( $ nb_category_id ) ; } return $ nb_category ; }
Gets a Product Category by Id .
17,690
public function getProductCategories ( bool $ force = false ) : CNabuCommerceProductCategoryList { if ( $ this -> nb_commerce_product_category_list -> isEmpty ( ) || $ force ) { $ this -> nb_commerce_product_category_list -> clear ( ) ; $ this -> nb_commerce_product_category_list -> merge ( CNabuCommerceProductCategory :: getCategoriesForCommerce ( $ this ) ) ; } return $ this -> nb_commerce_product_category_list ; }
Gets the full list of all Product Categories in this Commerce instance .
17,691
public function getProducts ( bool $ force = false ) : CNabuCommerceProductList { if ( $ this -> nb_commerce_product_list -> isEmpty ( ) || $ force ) { $ this -> nb_commerce_product_list -> clear ( ) ; $ this -> nb_commerce_product_list -> merge ( CNabuCommerceProduct :: getProductsForCommerce ( $ this ) ) ; } return $ this -> nb_commerce_product_list ; }
Gets the full list of all Products in this Commerce instance .
17,692
public function getProduct ( $ nb_commerce_product ) { $ nb_product = false ; $ nb_product_id = nb_getMixedValue ( $ nb_commerce_product , NABU_COMMERCE_PRODUCT_FIELD_ID ) ; if ( is_numeric ( $ nb_product_id ) ) { $ nb_product = $ this -> nb_commerce_product_list -> getItem ( $ nb_product_id ) ; } return $ nb_product ; }
Gets a Product by Id .
17,693
public function findProductBySlug ( string $ slug , $ nb_language = null ) { $ retval = false ; $ nb_language_id = nb_getMixedValue ( $ nb_language , NABU_LANG_FIELD_ID ) ; $ this -> getProducts ( ) -> iterate ( function ( $ key , CNabuCommerceProduct $ nb_product ) use ( & $ retval , $ slug , $ nb_language_id ) { if ( is_numeric ( $ nb_language_id ) && ( $ nb_translation = $ nb_product -> getTranslation ( $ nb_language_id ) ) instanceof CNabuCommerceProductLanguage && $ nb_translation -> getSlug ( ) === $ slug ) { $ retval = $ nb_product ; } else { $ nb_product -> getTranslations ( ) -> iterate ( function ( $ key , CNabuCommerceProductLanguage $ nb_translation ) use ( & $ retval , $ nb_product , $ slug ) { if ( $ nb_translation -> getSlug ( ) === $ slug ) { $ retval = $ nb_product ; } return ! $ retval ; } ) ; } return ! $ retval ; } ) ; return $ retval ; }
Find a Product using their slug .
17,694
public function refresh ( bool $ force = false , bool $ cascade = false ) : bool { return parent :: refresh ( $ force , $ cascade ) && ( ! $ cascade || ( $ this -> getProductCategories ( $ force ) && $ this -> getProducts ( $ force ) ) ) ; }
Overrides refresh method to allow commerce subentities to be refreshed .
17,695
public function isServerValid ( ) { return ( $ this -> nb_server !== null && ( $ this -> nb_server -> isBuiltIn ( ) || $ this -> nb_server -> isFetched ( ) ) ) ; }
Checks if a server is valid . Valid servers are Built - in instances or fetched servers .
17,696
public function setMessagingServiceStackId ( int $ nb_messaging_service_stack_id ) : CNabuDataObject { if ( $ nb_messaging_service_stack_id === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$nb_messaging_service_stack_id" ) ) ; } $ this -> setValue ( 'nb_messaging_service_stack_id' , $ nb_messaging_service_stack_id ) ; return $ this ; }
Sets the Messaging Service Stack Id attribute value .
17,697
public function transform ( $ source ) { if ( $ this -> discoverInterface ( ) ) { $ this -> nb_interface -> transform ( $ source ) ; } else { throw new ENabuRenderException ( ENabuRenderException :: ERROR_RENDER_TRANSFORM_NOT_FOUND , array ( $ this -> nb_descriptor -> getKey ( ) ) ) ; } }
This method transform the content passed as parameter and exposes the result in the default output stream .
17,698
public function getSite ( CNabuCustomer $ nb_customer = null , $ force = false ) { if ( $ nb_customer !== null && ( $ this -> nb_site === null || $ force ) ) { $ this -> nb_site = null ; if ( $ this instanceof CNabuDataObject && $ this -> contains ( NABU_SITE_FIELD_ID ) ) { $ this -> nb_site = $ nb_customer -> getSite ( $ this ) ; } } return $ this -> nb_site ; }
Gets the Site instance .
17,699
public function setSite ( CNabuSite $ nb_site = null , $ field = NABU_SITE_FIELD_ID ) { $ this -> nb_site = $ nb_site ; if ( $ this instanceof CNabuDataObject ) { $ this -> transferValue ( $ nb_site , $ field ) ; } return $ this ; }
Sets the Site instance that owns this object and sets the field containing the site id .