idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
53,200
public function getHole ( $ uuid ) { $ found = null ; foreach ( $ this -> holes as $ hole ) { if ( $ hole -> getUuid ( ) === $ uuid ) { $ found = $ hole ; break ; } } return $ found ; }
Retrieves a hole by its uuid .
53,201
public function addHole ( Hole $ hole ) { if ( ! $ this -> holes -> contains ( $ hole ) ) { $ this -> holes -> add ( $ hole ) ; $ hole -> setInteractionHole ( $ this ) ; } }
Adds a hole .
53,202
public function removeHole ( Hole $ hole ) { if ( $ this -> holes -> contains ( $ hole ) ) { $ this -> holes -> removeElement ( $ hole ) ; } }
Removes a hole .
53,203
public function sipe ( $ prop , $ setter , $ data = [ ] , $ object , $ trim = true ) { if ( $ data && is_array ( $ data ) ) { try { $ value = ArrayUtils :: get ( $ data , $ prop ) ; if ( is_string ( $ value ) && $ trim ) { $ value = trim ( $ value ) ; } $ object -> { $ setter } ( $ value ) ; } catch ( \ Exception $ e )...
SetIfPropertyExists . Sets an entity prop from an array data source .
53,204
public function findInCollection ( $ object , $ method , $ id , $ class = null ) { foreach ( $ object -> $ method ( ) as $ el ) { if ( $ el -> getId ( ) === $ id || $ el -> getUuid ( ) === $ id ) { return $ el ; } } if ( $ class ) { return $ this -> _om -> getObject ( [ 'id' => $ id ] , $ class ) ; } }
alias method .
53,205
public function createDefaultToolMaskDecoders ( Tool $ tool ) { foreach ( ToolMaskDecoder :: $ defaultActions as $ action ) { $ maskDecoder = $ this -> maskRepo -> findMaskDecoderByToolAndName ( $ tool , $ action ) ; if ( is_null ( $ maskDecoder ) ) { $ maskDecoder = new ToolMaskDecoder ( ) ; $ maskDecoder -> setTool (...
Create a mask decoder with default actions for a tool .
53,206
public function createToolMaskDecoder ( Tool $ tool , $ action , $ value , $ grantedIconClass , $ deniedIconClass ) { $ maskDecoder = new ToolMaskDecoder ( ) ; $ maskDecoder -> setTool ( $ tool ) ; $ maskDecoder -> setName ( $ action ) ; $ maskDecoder -> setValue ( $ value ) ; $ maskDecoder -> setGrantedIconClass ( $ g...
Create a specific mask decoder for a tool .
53,207
public function decodeMask ( $ mask , Tool $ tool ) { $ decoders = $ this -> maskRepo -> findMaskDecodersByTool ( $ tool ) ; $ perms = [ ] ; foreach ( $ decoders as $ decoder ) { $ perms [ $ decoder -> getName ( ) ] = ( $ mask & $ decoder -> getValue ( ) ) ? true : false ; } return $ perms ; }
Returns an array containing the permission for a mask and a tool .
53,208
public function serialize ( Theme $ theme ) { return [ 'id' => $ theme -> getUuid ( ) , 'name' => $ theme -> getName ( ) , 'normalizedName' => str_replace ( ' ' , '-' , strtolower ( $ theme -> getName ( ) ) ) , 'current' => $ theme -> getNormalizedName ( ) === str_replace ( ' ' , '-' , strtolower ( $ this -> config -> ...
Serializes a Theme entity for the JSON api .
53,209
public function deserialize ( array $ data , Theme $ theme = null ) { $ theme = $ theme ? : new Theme ( ) ; $ theme -> setName ( $ data [ 'name' ] ) ; return $ theme ; }
Deserializes JSON api data into a Theme entity .
53,210
public function updatePost ( Blog $ blog , Post $ existingPost , Post $ post , User $ user ) { $ existingPost -> setTitle ( $ post -> getTitle ( ) ) -> setContent ( $ post -> getContent ( ) ) ; if ( null !== $ post -> getPublicationDate ( ) ) { $ existingPost -> setPublicationDate ( $ post -> getPublicationDate ( ) ) ;...
Update a post .
53,211
public function updatePostViewCount ( $ post ) { $ post -> increaseViewCounter ( ) ; $ this -> om -> persist ( $ post ) ; $ this -> om -> flush ( ) ; }
Update post view count .
53,212
public function switchPublicationState ( Post $ post ) { if ( ! $ post -> isPublished ( ) ) { $ post -> publish ( ) ; } else { $ post -> unpublish ( ) ; } $ this -> om -> flush ( ) ; $ unitOfWork = $ this -> om -> getUnitOfWork ( ) ; $ unitOfWork -> computeChangeSets ( ) ; $ changeSet = $ unitOfWork -> getEntityChangeS...
Switch post state .
53,213
public function getAuthors ( $ blog ) { $ recordSet = $ this -> repo -> findAuthorsByBlog ( $ blog ) ; $ authorsIds = [ ] ; foreach ( $ recordSet as $ value ) { $ authorsIds [ ] = $ value [ 'id' ] ; } $ authors = $ this -> userRepo -> findBy ( [ 'id' => $ authorsIds ] , [ 'lastName' => 'ASC' ] ) ; $ serializedAuthors =...
Get blog post authors .
53,214
public function getArchives ( $ blog ) { $ postDatas = $ this -> repo -> findArchiveDatasByBlog ( $ blog ) ; $ archiveDatas = [ ] ; foreach ( $ postDatas as $ postData ) { $ year = $ postData [ 'year' ] ; $ month = $ postData [ 'month' ] ; $ count = $ postData [ 'count' ] ; $ archiveDatas [ $ year ] [ ] = [ 'month' => ...
Get blog posts archives .
53,215
public function serialize ( FieldFacetValue $ fieldFacetValue , array $ options = [ ] ) { if ( in_array ( Options :: PROFILE_SERIALIZE , $ options ) ) { } $ serialized = [ 'id' => $ fieldFacetValue -> getId ( ) , 'value' => $ fieldFacetValue -> getValue ( ) , 'name' => $ fieldFacetValue -> getFieldFacet ( ) -> getName ...
Serializes a FieldFacetValue entity for the JSON api .
53,216
public function deserialize ( array $ data , FieldFacetValue $ fieldFacetValue = null , array $ options = [ ] ) { $ fieldFacet = $ this -> container -> get ( 'claroline.persistence.object_manager' ) -> getRepository ( FieldFacet :: class ) -> findOneByUuid ( $ data [ 'fieldFacet' ] [ 'id' ] ) ; $ fieldFacetValue -> set...
Deserializes a FieldFacetValue entity for the JSON api .
53,217
public function commentEditAction ( Comment $ comment , Request $ request ) { $ this -> clacoFormManager -> checkCommentEditionRight ( $ comment ) ; $ decodedRequest = $ this -> decodeRequest ( $ request ) ; $ comment = $ this -> clacoFormManager -> editComment ( $ comment , $ decodedRequest [ 'message' ] ) ; return ne...
Edits a comment .
53,218
public function addGroup ( Group $ group ) { $ this -> hasGroupsProperty ( ) ; if ( ! $ this -> groups -> contains ( $ group ) ) { $ this -> groups -> add ( $ group ) ; } }
Add an group .
53,219
public function removeGroup ( Group $ group ) { $ this -> hasGroupsProperty ( ) ; if ( $ this -> groups -> contains ( $ group ) ) { $ this -> groups -> removeElement ( $ group ) ; } }
Removes an group .
53,220
public function persistUser ( User $ user ) { $ this -> objectManager -> persist ( $ user ) ; $ this -> objectManager -> flush ( ) ; return $ user ; }
Persist a user .
53,221
public function setPlatformRoles ( User $ user , $ roles ) { $ this -> roleManager -> resetRoles ( $ user ) ; $ this -> roleManager -> associateRoles ( $ user , $ roles ) ; }
Sets an array of platform role to a user .
53,222
public function setLocale ( User $ user , $ locale = 'en' ) { $ user -> setLocale ( $ locale ) ; $ this -> objectManager -> persist ( $ user ) ; $ this -> objectManager -> flush ( ) ; }
Set the user locale .
53,223
public function personalWorkspaceAllowed ( $ roles ) { $ roles [ ] = $ this -> roleManager -> getRoleByName ( 'ROLE_USER' ) ; foreach ( $ roles as $ role ) { if ( $ role -> isPersonalWorkspaceCreationEnabled ( ) ) { return true ; } } return false ; }
Checks if a user will have a personal workspace at his creation .
53,224
public function activateUser ( User $ user ) { $ user -> setIsEnabled ( true ) ; $ user -> setIsMailValidated ( true ) ; $ user -> setResetPasswordHash ( null ) ; $ user -> setInitDate ( new \ DateTime ( ) ) ; $ this -> objectManager -> persist ( $ user ) ; $ this -> objectManager -> flush ( ) ; }
Activates a User and set the init date to now .
53,225
public function logUser ( User $ user ) { $ this -> strictEventDispatcher -> dispatch ( 'log' , 'Log\LogUserLogin' , [ $ user ] ) ; $ token = new UsernamePasswordToken ( $ user , null , 'main' , $ user -> getRoles ( ) ) ; $ this -> tokenStorage -> setToken ( $ token ) ; if ( null === $ user -> getInitDate ( ) ) { $ thi...
Logs the current user .
53,226
public function transferRoles ( User $ from , User $ to ) { $ roles = $ from -> getEntityRoles ( ) ; foreach ( $ roles as $ role ) { $ to -> addRole ( $ role ) ; } $ this -> objectManager -> flush ( ) ; return count ( $ roles ) ; }
Merges two users and transfers every resource to the kept user .
53,227
public function countActiveUsers ( array $ finderParams = [ ] , $ defaultPeriod = false ) { if ( $ defaultPeriod ) { $ finderParams = $ this -> formatQueryParams ( $ finderParams ) ; } $ queryParams = FinderProvider :: parseQueryParams ( $ finderParams ) ; $ resultData = $ this -> logRepository -> countActiveUsers ( $ ...
Retrieve user who connected at least one time on the application .
53,228
public function refreshIdentifiers ( AbstractItem $ item ) { $ text = $ item -> getText ( ) ; foreach ( $ item -> getHoles ( ) as $ hole ) { $ oldId = $ hole -> getUuid ( ) ; $ hole -> refreshUuid ( ) ; $ text = str_replace ( '[[' . $ oldId . ']]' , '[[' . $ hole -> getUuid ( ) . ']]' , $ text ) ; } $ item -> setText (...
Refreshes hole UUIDs and update placeholders in text .
53,229
public function getClass ( ) { $ classMap = [ 'activity' => 'Claroline\CoreBundle\Entity\Resource\Activity' , 'claroline_scorm_12' => 'Claroline\ScormBundle\Entity\Scorm12Resource' , 'claroline_scorm_2004' => 'Claroline\ScormBundle\Entity\Scorm2004Resource' , 'icap_dropzone' => 'Icap\DropzoneBundle\Entity\Dropzone' , '...
Returns the resource class name .
53,230
public function serialize ( Entry $ entry , array $ options = [ ] ) { $ user = $ entry -> getUser ( ) ; $ serialized = [ 'id' => $ entry -> getUuid ( ) , 'autoId' => $ entry -> getId ( ) , 'title' => $ entry -> getTitle ( ) , 'status' => $ entry -> getStatus ( ) , 'locked' => $ entry -> isLocked ( ) , 'creationDate' =>...
Serializes an Entry entity for the JSON api .
53,231
public function followerResourcesToggleAction ( $ mode , User $ user , Request $ request ) { $ nodes = $ this -> decodeIdsString ( $ request , 'Claroline\CoreBundle\Entity\Resource\ResourceNode' ) ; $ this -> manager -> toggleFollowResources ( $ user , $ nodes , $ mode ) ; return new JsonResponse ( array_map ( function...
Follows or unfollows resources .
53,232
public function getStatistics ( Exercise $ exercise , $ maxScore ) { return [ 'maxScore' => $ maxScore , 'nbSteps' => $ exercise -> getSteps ( ) -> count ( ) , 'nbQuestions' => $ this -> exerciseRepository -> countExerciseQuestion ( $ exercise ) , 'nbPapers' => $ this -> paperManager -> countExercisePapers ( $ exercise...
Serializes an Exercise .
53,233
public function getMinMaxAverageScores ( Exercise $ exercise , $ scoreOn ) { $ papers = $ this -> paperRepository -> findBy ( [ 'exercise' => $ exercise , ] ) ; $ scores = $ this -> getPapersScores ( $ papers , $ scoreOn ) ; $ result = [ 'min' => 0 === count ( $ scores ) ? 0 : min ( $ scores ) , 'max' => 0 === count ( ...
Returns the max min and average score for a given exercise .
53,234
public function getPapersSuccessDistribution ( Exercise $ exercise , $ scoreOn ) { $ papers = $ this -> paperRepository -> findBy ( [ 'exercise' => $ exercise , ] ) ; $ nbSuccess = 0 ; $ nbMissed = 0 ; $ nbPartialSuccess = 0 ; $ scores = $ this -> getPapersScores ( $ papers , $ scoreOn ) ; foreach ( $ scores as $ score...
Returns the number of fully partially successfull and missed papers for a given exercise .
53,235
public function getPaperScoreDistribution ( Exercise $ exercise , $ scoreOn ) { $ papers = $ this -> paperRepository -> findBy ( [ 'exercise' => $ exercise , ] ) ; $ scores = $ this -> getPapersScores ( $ papers , $ scoreOn ) ; $ uniqueScores = array_unique ( $ scores , SORT_NUMERIC ) ; sort ( $ uniqueScores ) ; $ pape...
Returns the number of papers with a particular score for a given exercise .
53,236
private function getDiscriminationCoefficient ( Exercise $ exercise ) { $ papers = $ this -> paperRepository -> findBy ( [ 'exercise' => $ exercise , ] ) ; $ itemRepository = $ this -> om -> getRepository ( 'UJMExoBundle:Item\Item' ) ; $ reportScoreOn = 100 ; $ exerciseScores = $ this -> getPapersScores ( $ papers , $ ...
Get discrimination coefficient for an exercise .
53,237
private function getStandardDeviation ( $ array ) { $ sdSquare = function ( $ x , $ mean ) { return pow ( $ x - $ mean , 2 ) ; } ; $ nbData = count ( $ array ) > 1 ? count ( $ array ) - 1 : 1 ; $ fillNbData = count ( $ array ) > 0 ? count ( $ array ) : 1 ; return sqrt ( array_sum ( array_map ( $ sdSquare , $ array , ar...
Get standard deviation for the discrimination coefficient .
53,238
public function serialize ( GraphicQuestion $ graphicQuestion , array $ options = [ ] ) { $ serialized = [ 'image' => $ this -> serializeImage ( $ graphicQuestion ) , 'pointers' => $ graphicQuestion -> getAreas ( ) -> count ( ) , 'pointerMode' => 'pointer' , ] ; if ( in_array ( Transfer :: INCLUDE_SOLUTIONS , $ options...
Converts a Graphic question into a JSON - encodable structure .
53,239
public function deserialize ( $ data , GraphicQuestion $ graphicQuestion = null , array $ options = [ ] ) { if ( empty ( $ graphicQuestion ) ) { $ graphicQuestion = new GraphicQuestion ( ) ; } $ this -> deserializeImage ( $ graphicQuestion , $ data [ 'image' ] ) ; $ this -> deserializeAreas ( $ graphicQuestion , $ data...
Converts raw data into a Graphic question entity .
53,240
private function serializeImage ( GraphicQuestion $ graphicQuestion ) { $ questionImg = $ graphicQuestion -> getImage ( ) ; $ image = [ ] ; if ( $ questionImg ) { $ image [ 'id' ] = $ questionImg -> getUuid ( ) ; $ image [ 'type' ] = $ questionImg -> getType ( ) ; if ( 0 === strpos ( $ questionImg -> getUrl ( ) , './' ...
Serializes the Question image .
53,241
private function deserializeImage ( GraphicQuestion $ graphicQuestion , array $ imageData ) { $ image = $ graphicQuestion -> getImage ( ) ? : new Image ( ) ; $ this -> sipe ( 'id' , 'setUuid' , $ imageData , $ image ) ; $ this -> sipe ( 'type' , 'setType' , $ imageData , $ image ) ; $ this -> sipe ( 'id' , 'setTitle' ,...
Deserializes the Question image .
53,242
private function deserializeAreas ( GraphicQuestion $ graphicQuestion , array $ solutions ) { $ areaEntities = $ graphicQuestion -> getAreas ( ) -> toArray ( ) ; foreach ( $ solutions as $ solutionData ) { $ area = null ; foreach ( $ areaEntities as $ entityIndex => $ entityArea ) { if ( $ entityArea -> getUuid ( ) ===...
Deserializes Question areas .
53,243
private function serializeArea ( Area $ area ) { $ areaData = [ 'id' => $ area -> getUuid ( ) , 'color' => $ area -> getColor ( ) , ] ; $ position = explode ( ',' , $ area -> getValue ( ) ) ; switch ( $ area -> getShape ( ) ) { case 'circle' : $ areaData [ 'shape' ] = 'circle' ; $ areaData [ 'radius' ] = $ area -> getS...
Serializes an Area .
53,244
private function deserializeArea ( Area $ area , array $ data ) { if ( ! empty ( $ data [ 'color' ] ) ) { $ area -> setColor ( $ data [ 'color' ] ) ; } $ area -> setShape ( $ data [ 'shape' ] ) ; switch ( $ data [ 'shape' ] ) { case 'circle' : $ x = $ data [ 'center' ] [ 'x' ] - $ data [ 'radius' ] ; $ y = $ data [ 'ce...
Deserializes an Area .
53,245
public function serialize ( FieldFacetChoice $ choice , array $ options = [ ] ) { $ serialized = [ 'id' => $ choice -> getUuid ( ) , 'name' => $ choice -> getName ( ) , 'label' => $ choice -> getName ( ) , 'value' => $ choice -> getValue ( ) , 'position' => $ choice -> getPosition ( ) , ] ; if ( ! empty ( $ choice -> g...
Serializes a FieldFacetChoice entity for the JSON api .
53,246
private function deleteFiles ( $ dirPath ) { foreach ( glob ( $ dirPath . DIRECTORY_SEPARATOR . '{*,.[!.]*,..?*}' , GLOB_BRACE ) as $ content ) { if ( is_dir ( $ content ) ) { $ this -> deleteFiles ( $ content ) ; } else { unlink ( $ content ) ; } } rmdir ( $ dirPath ) ; }
Deletes recursively a directory and its content .
53,247
public function createAction ( AnnouncementAggregate $ aggregate , Request $ request ) { $ this -> checkPermission ( 'EDIT' , $ aggregate -> getResourceNode ( ) , [ ] , true ) ; $ data = $ this -> decodeRequest ( $ request ) ; $ data [ 'aggregate' ] = [ 'id' => $ aggregate -> getUuid ( ) ] ; $ announcement = $ this -> ...
Creates a new announce .
53,248
public function updateAction ( AnnouncementAggregate $ aggregate , Announcement $ announcement , Request $ request ) { $ this -> checkPermission ( 'EDIT' , $ aggregate -> getResourceNode ( ) , [ ] , true ) ; $ announcement = $ this -> crud -> update ( $ this -> getClass ( ) , $ this -> decodeRequest ( $ request ) , [ '...
Updates an existing announce .
53,249
public function deleteAction ( AnnouncementAggregate $ aggregate , Announcement $ announcement ) { $ this -> checkPermission ( 'EDIT' , $ aggregate -> getResourceNode ( ) , [ ] , true ) ; $ this -> crud -> delete ( $ announcement , [ 'announcement_aggregate' => $ aggregate ] ) ; return new JsonResponse ( null , 204 ) ;...
Deletes an announce .
53,250
public function serialize ( MatchQuestion $ setQuestion , array $ options = [ ] ) { $ serialized = [ 'random' => $ setQuestion -> getShuffle ( ) , 'penalty' => $ setQuestion -> getPenalty ( ) , ] ; $ items = array_map ( function ( Proposal $ proposal ) use ( $ options ) { $ setData = $ this -> contentSerializer -> seri...
Converts a Set question into a JSON - encodable structure .
53,251
public function deserialize ( $ data , MatchQuestion $ setQuestion = null , array $ options = [ ] ) { if ( empty ( $ setQuestion ) ) { $ setQuestion = new MatchQuestion ( ) ; } if ( ! empty ( $ data [ 'penalty' ] ) || 0 === $ data [ 'penalty' ] ) { $ setQuestion -> setPenalty ( $ data [ 'penalty' ] ) ; } $ this -> sipe...
Converts raw data into a Set question entity .
53,252
public function logout ( $ redirectUrl ) { if ( ! empty ( $ this -> options [ 'revoke_token_url' ] ) && $ this -> options [ 'force_login' ] === true ) { $ redirectUrl = $ this -> normalizeUrl ( $ this -> options [ 'revoke_token_url' ] , [ 'post_logout_redirect_uri' => $ redirectUrl ] ) ; } return new RedirectResponse (...
Logouts User from resource Owner .
53,253
private function unlockOrLockUsers ( Dropzone $ dropzone , $ unlock = true ) { $ this -> get ( 'icap.manager.dropzone_voter' ) -> isAllowToOpen ( $ dropzone ) ; $ this -> get ( 'icap.manager.dropzone_voter' ) -> isAllowToEdit ( $ dropzone ) ; $ dropRepo = $ this -> getDoctrine ( ) -> getManager ( ) -> getRepository ( '...
Factorised function for lock & unlock users in a dropzone .
53,254
public function listUsersAction ( $ id , $ class , Request $ request ) { return new JsonResponse ( $ this -> finder -> search ( 'Claroline\CoreBundle\Entity\User' , array_merge ( $ request -> query -> all ( ) , [ 'hiddenFilters' => [ $ this -> getName ( ) => [ $ id ] ] ] ) ) ) ; }
List users of the collection .
53,255
public function addUsersAction ( $ id , $ class , Request $ request ) { $ object = $ this -> find ( $ class , $ id ) ; $ users = $ this -> decodeIdsString ( $ request , 'Claroline\CoreBundle\Entity\User' ) ; $ this -> crud -> patch ( $ object , 'user' , Crud :: COLLECTION_ADD , $ users ) ; return new JsonResponse ( $ t...
Adds users to the collection .
53,256
public function removeUsersAction ( $ id , $ class , Request $ request ) { $ object = $ this -> find ( $ class , $ id ) ; $ users = $ this -> decodeIdsString ( $ request , 'Claroline\CoreBundle\Entity\User' ) ; $ this -> crud -> patch ( $ object , 'user' , Crud :: COLLECTION_REMOVE , $ users ) ; return new JsonResponse...
Removes users from the collection .
53,257
public function getUnpublishedComments ( $ blogId , $ filters ) { if ( ! isset ( $ filters [ 'hiddenFilters' ] ) ) { $ filters [ 'hiddenFilters' ] = [ ] ; } $ filters [ 'hiddenFilters' ] = array_merge ( $ filters [ 'hiddenFilters' ] , [ 'blog' => $ blogId , 'status' => false , ] ) ; return $ this -> finder -> search ( ...
Get unpublished comments .
53,258
public function getReportedComments ( $ blogId , $ filters ) { if ( ! isset ( $ filters [ 'hiddenFilters' ] ) ) { $ filters [ 'hiddenFilters' ] = [ ] ; } $ filters [ 'hiddenFilters' ] = array_merge ( $ filters [ 'hiddenFilters' ] , [ 'blog' => $ blogId , 'reported' => 1 , ] ) ; return $ this -> finder -> search ( 'Icap...
Get reported comments .
53,259
public function getComments ( $ blogId , $ postId , $ userId , $ filters , $ allowedToSeeOnly ) { if ( ! isset ( $ filters [ 'hiddenFilters' ] ) ) { $ filters [ 'hiddenFilters' ] = [ ] ; } $ filters [ 'hiddenFilters' ] = [ 'blog' => $ blogId , 'post' => $ postId , ] ; if ( $ allowedToSeeOnly ) { if ( null === $ userId ...
Get comments .
53,260
public function publishComment ( Blog $ blog , Comment $ existingComment ) { $ existingComment -> publish ( ) ; if ( BlogOptions :: COMMENT_MODERATION_PRIOR_ONCE === $ blog -> getOptions ( ) -> getCommentModerationMode ( ) && null !== $ existingComment -> getAuthor ( ) ) { if ( 0 === count ( $ this -> memberRepo -> get...
Publish a comment .
53,261
private function addTrustedMember ( Blog $ blog , User $ user ) { $ member = new Member ( ) ; $ member -> setBlog ( $ blog ) ; $ member -> setUser ( $ user ) ; $ member -> setTrusted ( true ) ; $ this -> om -> persist ( $ member ) ; $ this -> om -> flush ( ) ; return $ member ; }
Add a trusted member to the blog can write comment without verification from a moderator .
53,262
public function addBannedMember ( Blog $ blog , User $ user ) { $ member = new Member ( ) ; $ member -> setBlog ( blog ) ; $ member -> setUser ( $ user ) ; $ member -> setBanned ( true ) ; $ this -> om -> persist ( $ member ) ; $ this -> om -> flush ( ) ; return $ member ; }
Add a banned member to the blog cannot write comment .
53,263
public function reportComment ( Blog $ blog , Comment $ existingComment ) { $ existingComment -> setReported ( $ existingComment -> getReported ( ) + 1 ) ; $ this -> om -> flush ( ) ; return $ existingComment ; }
Report a comment .
53,264
public function unpublishComment ( Blog $ blog , Comment $ existingComment ) { $ existingComment -> unpublish ( ) ; $ this -> om -> flush ( ) ; $ this -> trackingManager -> dispatchCommentPublishEvent ( $ existingComment -> getPost ( ) , $ existingComment ) ; return $ existingComment ; }
unpublish a comment .
53,265
public function addFieldValue ( FieldValue $ fieldValue ) { if ( ! $ this -> fieldValues -> contains ( $ fieldValue ) ) { $ this -> fieldValues -> add ( $ fieldValue ) ; } }
Add a field value .
53,266
public function removeValue ( FieldValue $ fieldValue ) { if ( $ this -> fieldValues -> contains ( $ fieldValue ) ) { $ this -> fieldValues -> removeElement ( $ fieldValue ) ; } }
Remove a field value .
53,267
public function addKeyword ( Keyword $ keyword ) { if ( ! $ this -> keywords -> contains ( $ keyword ) ) { $ this -> keywords -> add ( $ keyword ) ; } }
Add keyword .
53,268
public function removeKeyword ( Keyword $ keyword ) { if ( $ this -> keywords -> contains ( $ keyword ) ) { $ this -> keywords -> removeElement ( $ keyword ) ; } }
Remove keyword .
53,269
public function format ( $ format , array $ data , $ options ) { $ adapter = $ this -> getAdapter ( $ format ) ; return $ adapter -> format ( $ data , $ options ) ; }
Format a list of data for the export .
53,270
public function explainAction ( $ actionName , $ format ) { $ adapter = $ this -> getAdapter ( $ format ) ; $ action = $ this -> getExecutor ( $ actionName ) ; if ( ! $ action -> supports ( $ format ) ) { throw new \ Exception ( 'This action is not supported for the ' . $ format . ' format.' ) ; } $ schema = $ action -...
Returns the AbstractAction object for an given action .
53,271
public function getAdapter ( $ mimeTypes ) { $ mimeTypes = explode ( ';' , $ mimeTypes ) ; foreach ( $ mimeTypes as $ mimeType ) { foreach ( $ this -> adapters as $ adapter ) { if ( in_array ( ltrim ( $ mimeType ) , $ adapter -> getMimeTypes ( ) ) ) { return $ adapter ; } } } throw new \ Exception ( 'No adapter found f...
Returns an adapter for a given mime type .
53,272
private function detectEncoding ( $ string ) { static $ enclist = [ 'UTF-8' , 'ASCII' , 'ISO-8859-1' , 'Windows-1252' ] ; if ( function_exists ( 'mb_detect_encoding' ) ) { return mb_detect_encoding ( $ string , $ enclist , true ) ; } $ result = false ; foreach ( $ enclist as $ item ) { try { $ sample = iconv ( $ item ,...
Detect if encoding is UTF - 8 ASCII ISO - 8859 - 1 or Windows - 1252 .
53,273
private function hasBreakingRepeatEvent ( SessionInterface $ session , LogGenericEvent $ event ) { $ hasBreakingRepeatEvent = false ; $ breakingSignatures = [ LogWorkspaceToolReadEvent :: ACTION , LogResourceReadEvent :: ACTION , LogDesktopToolReadEvent :: ACTION , LogAdminToolReadEvent :: ACTION , ] ; $ breakingWorksp...
Checks if a tool has been opened between 2 resources opening . If it is the case the resource opening will not be labelled as a repeat even if it is the same resource . The same is checked between 2 tools opening .
53,274
public function serialize ( Field $ field , array $ options = [ ] ) { $ serialized = [ 'id' => $ field -> getUuid ( ) , 'autoId' => $ field -> getId ( ) , 'name' => $ field -> getName ( ) , 'label' => $ field -> getName ( ) , 'type' => $ field -> getFieldType ( ) , 'required' => $ field -> isRequired ( ) , 'help' => $ ...
Serializes a Field entity for the JSON api .
53,275
public function checkCreation ( TokenInterface $ token , $ object ) { return $ this -> manager -> isAllowedBadgeManagement ( $ token , $ object -> getBadge ( ) ) ; }
ready to be overrided
53,276
public function parseOrganizationsNode ( \ DOMDocument $ dom ) { $ organizationsList = $ dom -> getElementsByTagName ( 'organizations' ) ; $ resources = $ dom -> getElementsByTagName ( 'resource' ) ; if ( $ organizationsList -> length > 0 ) { $ organizations = $ organizationsList -> item ( 0 ) ; $ organization = $ orga...
Looks for the organization to use .
53,277
private function parseItemNodes ( \ DOMNode $ source , \ DOMNodeList $ resources , Sco $ parentSco = null ) { $ item = $ source -> firstChild ; $ scos = [ ] ; while ( ! is_null ( $ item ) ) { if ( 'item' === $ item -> nodeName ) { $ sco = new Sco ( ) ; $ scos [ ] = $ sco ; $ sco -> setScoParent ( $ parentSco ) ; $ this...
Creates defined structure of SCOs .
53,278
private function findAttrParams ( Sco $ sco , \ DOMNode $ item , \ DOMNodeList $ resources ) { $ identifier = $ item -> attributes -> getNamedItem ( 'identifier' ) ; $ isVisible = $ item -> attributes -> getNamedItem ( 'isvisible' ) ; $ identifierRef = $ item -> attributes -> getNamedItem ( 'identifierref' ) ; $ parame...
Initializes parameters of the SCO defined in attributes of the node . It also look for the associated resource if it is a SCO and not a block .
53,279
private function findNodeParams ( Sco $ sco , \ DOMNode $ item ) { while ( ! is_null ( $ item ) ) { switch ( $ item -> nodeName ) { case 'title' : $ sco -> setTitle ( $ item -> nodeValue ) ; break ; case 'adlcp:masteryscore' : $ sco -> setScoreToPassInt ( $ item -> nodeValue ) ; break ; case 'adlcp:maxtimeallowed' : ca...
Initializes parameters of the SCO defined in children nodes .
53,280
public function findEntryUrl ( $ identifierref , \ DOMNodeList $ resources ) { foreach ( $ resources as $ resource ) { $ identifier = $ resource -> attributes -> getNamedItem ( 'identifier' ) ; if ( ! is_null ( $ identifier ) ) { $ identifierValue = $ identifier -> nodeValue ; if ( $ identifierValue === $ identifierref...
Searches for the resource with the given id and retrieve URL to its content .
53,281
public function setGradingCriteria ( \ Innova \ CollecticielBundle \ Entity \ GradingCriteria $ gradingCriteria ) { $ this -> gradingCriteria = $ gradingCriteria ; return $ this ; }
Set gradingCriteria .
53,282
public function setNotation ( \ Innova \ CollecticielBundle \ Entity \ Notation $ notation ) { $ this -> notation = $ notation ; return $ this ; }
Set notation .
53,283
public function findUnfinishedPapers ( Exercise $ exercise , User $ user ) { return $ this -> createQueryBuilder ( 'p' ) -> where ( 'p.user = :user' ) -> andWhere ( 'p.exercise = :exercise' ) -> andWhere ( 'p.end IS NULL' ) -> orderBy ( 'p.start' , 'DESC' ) -> setParameters ( [ 'user' => $ user , 'exercise' => $ exerci...
Returns the unfinished papers of a user for a given exercise if any .
53,284
public function countUserFinishedDayPapers ( Exercise $ exercise , User $ user ) { $ today = new \ DateTime ( ) ; $ today -> setTime ( 0 , 0 ) ; $ tomorrow = clone $ today ; $ tomorrow -> add ( new \ DateInterval ( 'P1D' ) ) ; return ( int ) $ this -> getEntityManager ( ) -> createQuery ( ' SELECT COUNT(p)...
Returns the unfinished papers of a user for a given exercise for the current day if any .
53,285
public function findScore ( Paper $ paper ) { return ( float ) $ this -> getEntityManager ( ) -> createQuery ( ' SELECT SUM(a.score) FROM UJM\ExoBundle\Entity\Attempt\Answer AS a WHERE a.paper = :paper AND a.score IS NOT NULL ' ) -> setParameters ...
Finds the score of a paper by summing the score of each answer .
53,286
public function isFullyEvaluated ( Paper $ paper ) { return 0 === ( int ) $ this -> getEntityManager ( ) -> createQuery ( ' SELECT COUNT(a) FROM UJM\ExoBundle\Entity\Attempt\Answer AS a WHERE a.paper = :paper AND a.score IS NULL ' ) -> setParamete...
Checks that all the answers of a Paper have been marked .
53,287
public function countExercisePapers ( Exercise $ exercise ) { return ( int ) $ this -> getEntityManager ( ) -> createQuery ( ' SELECT COUNT(p) FROM UJM\ExoBundle\Entity\Attempt\Paper AS p WHERE p.exercise = :exercise ' ) -> setParameters ( [ 'exercise' => $ exerci...
Returns the number of papers for an exercise .
53,288
public function countUserFinishedPapers ( Exercise $ exercise , User $ user ) { return ( int ) $ this -> getEntityManager ( ) -> createQuery ( ' SELECT COUNT(p) FROM UJM\ExoBundle\Entity\Attempt\Paper AS p WHERE p.user = :user AND p.exercise = :exercise ...
Counts the number of finished paper for a user and an exercise .
53,289
private function createAccess ( $ randomId , $ secret , $ token , FriendRequest $ request ) { $ access = $ this -> om -> getRepository ( 'Claroline\CoreBundle\Entity\Oauth\ClarolineAccess' ) -> findOneByRandomId ( $ randomId ) ; if ( $ access === null ) { $ access = new ClarolineAccess ( ) ; } $ access -> setRandomId (...
Only 1 access per client !
53,290
protected function isOrganizationManager ( TokenInterface $ token , $ object ) { $ adminOrganizations = $ token -> getUser ( ) -> getAdministratedOrganizations ( ) ; $ objectOrganizations = $ object -> getOrganizations ( ) ; foreach ( $ adminOrganizations as $ adminOrganization ) { foreach ( $ objectOrganizations as $ ...
Copied from the AbstractVoter .
53,291
public function getEntityRoles ( $ areGroupsIncluded = true ) { $ roles = [ ] ; if ( $ this -> roles ) { $ roles = $ this -> roles -> toArray ( ) ; } if ( $ areGroupsIncluded ) { foreach ( $ this -> groups as $ group ) { foreach ( $ group -> getEntityRoles ( ) as $ role ) { if ( ! in_array ( $ role , $ roles ) ) { $ ro...
Returns the user s roles as an array of entities . The roles owned by groups the user is a member are included by default .
53,292
public function getGroupRoles ( ) { $ roles = [ ] ; foreach ( $ this -> groups as $ group ) { foreach ( $ group -> getEntityRoles ( ) as $ role ) { if ( ! in_array ( $ role , $ roles ) ) { $ roles [ ] = $ role ; } } } return $ roles ; }
Returns the roles owned by groups the user is a member .
53,293
public function hasRole ( $ roleName , $ includeGroup = true ) { $ roles = $ this -> getEntityRoles ( $ includeGroup ) ; $ roleNames = array_map ( function ( Role $ role ) { return $ role -> getName ( ) ; } , $ roles ) ; return in_array ( $ roleName , $ roleNames ) ; }
Checks if the user has a given role .
53,294
public function serialize ( array $ options = [ ] ) { $ facets = $ this -> repository -> findVisibleFacets ( $ this -> tokenStorage -> getToken ( ) , in_array ( Options :: REGISTRATION , $ options ) ) ; return array_map ( function ( Facet $ facet ) { return $ this -> facetSerializer -> serialize ( $ facet , [ Options :...
Serializes the profile configuration .
53,295
public function serialize ( Plugin $ plugin , array $ options = [ ] ) { return [ 'id' => $ plugin -> getId ( ) , 'name' => $ plugin -> getShortName ( ) , 'vendor' => $ plugin -> getVendorName ( ) , 'bundle' => $ plugin -> getBundleName ( ) , ] ; }
Serializes a Plugin entity .
53,296
public function deserialize ( $ data , Plugin $ plugin , array $ options = [ ] ) { $ this -> sipe ( 'id' , 'setUuid' , $ data , $ plugin ) ; $ this -> sipe ( 'name' , 'setDisplayName' , $ data , $ plugin ) ; $ this -> sipe ( 'vendor' , 'setVendorName' , $ data , $ plugin ) ; $ this -> sipe ( 'bundle' , 'setBundleName' ...
Deserializes data into a Plugin entity .
53,297
public function deserialize ( $ data , ResourceNode $ resourceNode = null , array $ options = [ ] ) { if ( empty ( $ resourceNode ) ) { $ id = method_exists ( $ data , 'getId' ) ? $ data -> getId ( ) : $ data [ 'id' ] ; $ resourceNode = $ this -> om -> getRepository ( 'ClarolineCoreBundle:Resource\ResourceNode' ) -> fi...
Converts raw data into a ResourceNode .
53,298
public function inject ( PlatformConfigurationHandler $ config , IPWhiteListManager $ whiteListManager ) { $ this -> config = $ config ; $ this -> whiteListManager = $ whiteListManager ; }
IpAuthenticator constructor .
53,299
public function getIncludeUserIds ( ) { $ ids = [ ] ; $ id = $ this -> drop -> getUser ( ) -> getId ( ) ; array_push ( $ ids , $ id ) ; return $ ids ; }
Get includeUsers array of user ids . Reports are only reported to user witch have the manager role .