idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
53,400 | private function getEntitySetter ( $ entity , $ property ) { $ setter = 'set' . ucfirst ( $ property ) ; if ( ! method_exists ( $ entity , $ setter ) ) { throw new \ LogicException ( "Entity has no setter for property `{$property}`." ) ; } return $ setter ; } | Gets the correct setter name for an entity property . |
53,401 | public function getStep ( $ uuid ) { foreach ( $ this -> steps as $ step ) { if ( $ step -> getUuid ( ) === $ uuid ) { return $ step ; } } return null ; } | Gets a step by its UUID . |
53,402 | public function getQuestion ( $ uuid ) { foreach ( $ this -> steps as $ step ) { $ questions = $ step -> getQuestions ( ) ; foreach ( $ questions as $ question ) { if ( $ question -> getUuid ( ) === $ uuid ) { return $ question ; } } } return null ; } | Gets a question by its UUID . |
53,403 | public function addStep ( Step $ step ) { if ( ! $ this -> steps -> contains ( $ step ) ) { $ step -> setOrder ( $ this -> steps -> count ( ) ) ; $ this -> steps -> add ( $ step ) ; $ step -> setExercise ( $ this ) ; } return $ this ; } | Adds a step to the Exercise . |
53,404 | public function removeStep ( Step $ step ) { if ( $ this -> steps -> contains ( $ step ) ) { $ this -> steps -> removeElement ( $ step ) ; } return $ this ; } | Removes a Step from the Exercise . |
53,405 | public function deserialize ( $ data , Resource $ resource = null ) { if ( empty ( $ resource ) ) { $ resource = new Resource ( ) ; } if ( isset ( $ data [ 'resourceType' ] ) && isset ( $ data [ 'resourceType' ] [ 'name' ] ) ) { $ resourceType = $ this -> resourceTypeRepo -> findOneBy ( [ 'name' => $ data [ 'resourceTy... | Deserializes data into a Resource entity . |
53,406 | private function copy ( $ source , $ target ) { $ files = $ this -> listFiles ( $ source , $ target ) ; foreach ( $ files as $ newPath => $ oldPath ) { if ( ! file_exists ( $ newPath ) ) { if ( is_dir ( $ oldPath ) ) { mkdir ( $ newPath , 0755 , true ) ; } else { copy ( $ oldPath , $ newPath ) ; } } } } | sf2 doesn t handle directory copies ... so we copy the directory content here |
53,407 | public function persistObjective ( Objective $ objective ) { $ this -> om -> persist ( $ objective ) ; $ this -> om -> flush ( ) ; return $ objective ; } | Persists a learning objective . |
53,408 | public function loadUserObjectiveCompetencies ( Objective $ objective , User $ user ) { $ competencies = $ this -> doLoadObjectiveCompetencies ( $ objective , false ) ; $ competenciesWithProgress = [ ] ; $ competencyIds = [ ] ; $ this -> competencyManager -> walkCollection ( $ competencies , function ( $ competency ) u... | Returns an array representation of all the competencies associated with a user objective including sub - competencies and progress data at each level . |
53,409 | public function deleteObjective ( Objective $ objective ) { $ this -> om -> remove ( $ objective ) ; $ this -> om -> flush ( ) ; } | Deletes an objective . |
53,410 | public function linkCompetency ( Objective $ objective , Competency $ competency , Level $ level ) { $ link = $ this -> objectiveCompetencyRepo -> findOneBy ( [ 'competency' => $ competency , 'objective' => $ objective , ] ) ; if ( $ link ) { return false ; } $ framework = $ this -> competencyRepo -> findOneBy ( [ 'roo... | Creates an association between an objective and a competency with an expected level . Returns a full array representation of the newly associated competency if the link doesn t already exist . Otherwise returns false . |
53,411 | public function deleteCompetencyLink ( ObjectiveCompetency $ link ) { $ this -> om -> remove ( $ link ) ; $ this -> om -> flush ( ) ; $ this -> progressManager -> recomputeObjectiveProgress ( $ link -> getObjective ( ) ) ; } | Deletes a link between an objective and a competency . |
53,412 | public function assignObjective ( Objective $ objective , $ subject ) { $ target = $ this -> getSubjectType ( $ subject ) ; $ hasMethod = "has{$target}" ; $ addMethod = "add{$target}" ; if ( $ objective -> { $ hasMethod } ( $ subject ) ) { return false ; } $ objective -> { $ addMethod } ( $ subject ) ; $ this -> om -> ... | Assigns an objective to a user or a group . If the objective has already been assigned returns false . Otherwise returns true . |
53,413 | public function loadSubjectObjectives ( $ subject ) { $ target = $ this -> getSubjectType ( $ subject ) ; $ repoMethod = "findBy{$target}" ; return $ this -> objectiveRepo -> { $ repoMethod } ( $ subject ) ; } | Returns an array representation of the objectives assigned to a user or a group . |
53,414 | public function removeGroupObjective ( Objective $ objective , Group $ group ) { $ objective -> removeGroup ( $ group ) ; $ this -> om -> flush ( ) ; $ this -> progressManager -> recomputeUserProgress ( $ group ) ; } | Removes a group objective . |
53,415 | public function deserialize ( $ data , PairQuestion $ pairQuestion = null , array $ options = [ ] ) { if ( empty ( $ pairQuestion ) ) { $ pairQuestion = new PairQuestion ( ) ; } if ( ! empty ( $ data [ 'penalty' ] ) || 0 === $ data [ 'penalty' ] ) { $ pairQuestion -> setPenalty ( $ data [ 'penalty' ] ) ; } $ this -> si... | Converts raw data into a Pair question entity . |
53,416 | public function postLoad ( Item $ item , LifecycleEventArgs $ event ) { $ type = $ this -> itemDefinitions -> getConvertedType ( $ item -> getMimeType ( ) ) ; $ definition = $ this -> itemDefinitions -> get ( $ type ) ; $ repository = $ event -> getEntityManager ( ) -> getRepository ( $ definition -> getEntityClass ( )... | Loads the entity that holds the item type data when an Item is loaded . |
53,417 | public function prePersist ( Item $ item , LifecycleEventArgs $ event ) { $ interaction = $ item -> getInteraction ( ) ; if ( null !== $ interaction ) { $ event -> getEntityManager ( ) -> persist ( $ interaction ) ; } } | Persists the entity that holds the item type data when an Item is persisted . |
53,418 | public function preRemove ( Item $ item , LifecycleEventArgs $ event ) { $ interaction = $ item -> getInteraction ( ) ; if ( null !== $ interaction ) { $ event -> getEntityManager ( ) -> remove ( $ interaction ) ; } } | Deletes the entity that holds the item type data when an Item is deleted . |
53,419 | public function setObjectManager ( ObjectManager $ om , $ rootDir ) { $ this -> om = $ om ; $ this -> rootDir = $ rootDir . '/..' ; $ this -> baseUri = 'https://github.com/claroline/Distribution/tree/master' ; } | Injects Serializer service . |
53,420 | public function add ( $ serializer ) { if ( ! method_exists ( $ serializer , 'serialize' ) ) { throw new \ Exception ( 'The serializer ' . get_class ( $ serializer ) . ' must implement the method serialize' ) ; } $ this -> serializers [ ] = $ serializer ; } | Registers a new serializer . |
53,421 | public function getSerializerHandledClass ( $ serializer ) { if ( method_exists ( $ serializer , 'getClass' ) ) { return $ serializer -> getClass ( ) ; } else { $ p = new \ ReflectionParameter ( [ get_class ( $ serializer ) , 'serialize' ] , 0 ) ; return $ p -> getClass ( ) -> getName ( ) ; } } | Returns the class handled by the serializer . |
53,422 | public function get ( $ object ) { if ( is_string ( $ object ) ) { if ( $ meta = $ this -> om -> getClassMetaData ( $ object ) ) { $ object = $ meta -> name ; } } foreach ( $ this -> serializers as $ serializer ) { $ className = $ this -> getSerializerHandledClass ( $ serializer ) ; if ( $ object instanceof $ className... | Gets a registered serializer instance . |
53,423 | public function has ( $ object ) { foreach ( $ this -> serializers as $ serializer ) { $ className = $ this -> getSerializerHandledClass ( $ serializer ) ; if ( $ object instanceof $ className || $ object === $ className ) { return true ; } } false ; } | Check if serializer instance exists . |
53,424 | public function getIdentifiers ( $ class ) { $ schema = $ this -> getSchema ( $ class ) ; if ( isset ( $ schema -> claroline ) ) { return $ schema -> claroline -> ids ; } return [ ] ; } | Get the identifier list from the json schema . |
53,425 | public function getSchema ( $ class ) { $ serializer = $ this -> get ( $ class ) ; if ( method_exists ( $ serializer , 'getSchema' ) ) { $ url = $ serializer -> getSchema ( ) ; $ path = explode ( '/' , $ url ) ; $ absolutePath = $ this -> rootDir . '/vendor/claroline/distribution/' . $ path [ 1 ] . '/' . $ path [ 2 ] .... | Gets the json schema of a class . |
53,426 | public function loadSchema ( $ path ) { $ schema = Utils :: LoadJsonFromFile ( $ path ) ; $ hook = function ( $ uri ) { return $ this -> resolveRef ( $ uri ) ; } ; $ resolver = new Resolver ( ) ; $ resolver -> setPreFetchHook ( $ hook ) ; $ walker = new Walker ( new Registry ( ) , $ resolver ) ; $ schema = $ walker -> ... | Loads a json schema . |
53,427 | public function prepareRightsArray ( array $ rights , array $ roles ) { $ preparedRightsArray = [ ] ; foreach ( $ rights as $ key => $ right ) { $ preparedRights = $ right ; $ preparedRights [ 'role' ] = $ roles [ $ key ] ; $ preparedRightsArray [ ] = $ preparedRights ; } return $ preparedRightsArray ; } | Appends a role list to a right array . |
53,428 | public function addFavourite ( Workspace $ workspace , User $ user ) { $ favourite = new WorkspaceFavourite ( ) ; $ favourite -> setWorkspace ( $ workspace ) ; $ favourite -> setUser ( $ user ) ; $ this -> om -> persist ( $ favourite ) ; $ this -> om -> flush ( ) ; } | Adds a favourite workspace . |
53,429 | public function removeFavourite ( WorkspaceFavourite $ favourite ) { $ this -> om -> remove ( $ favourite ) ; $ this -> om -> flush ( ) ; } | Removes a favourite workspace . |
53,430 | public function getAccesses ( TokenInterface $ token , array $ workspaces , $ toolName = null , $ action = 'open' , $ orderedToolType = 0 ) { $ userRoleNames = $ this -> sut -> getRoles ( $ token ) ; $ accesses = [ ] ; if ( in_array ( 'ROLE_ADMIN' , $ userRoleNames ) ) { foreach ( $ workspaces as $ workspace ) { $ acce... | Returns the accesses rights of a given token for a set of workspaces . If a tool name is passed in the check will be limited to that tool otherwise workspaces with at least one accessible tool will be considered open . Access to any tool is always granted to platform administrators and workspace managers . |
53,431 | public function getStorageDirectory ( Workspace $ workspace ) { $ ds = DIRECTORY_SEPARATOR ; return $ this -> container -> getParameter ( 'claroline.param.files_directory' ) . $ ds . 'WORKSPACE_' . $ workspace -> getId ( ) ; } | Get the workspace storage directory . |
53,432 | public function getUsedStorage ( Workspace $ workspace ) { $ dir = $ this -> getStorageDirectory ( $ workspace ) ; $ size = 0 ; if ( ! is_dir ( $ dir ) ) { return $ size ; } foreach ( new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ dir ) ) as $ file ) { $ size += $ file -> getSize ( ) ; } return ... | Get the current used storage in a workspace . |
53,433 | public function bindWorkspaceToOrganization ( ) { $ limit = 250 ; $ offset = 0 ; $ organizationManager = $ this -> container -> get ( 'claroline.manager.organization.organization_manager' ) ; $ this -> log ( 'Add organizations to workspaces...' ) ; $ this -> om -> startFlushSuite ( ) ; $ countWorkspaces = $ this -> om ... | This method will bind each workspaces that don t already have an organization to the default one . |
53,434 | public function copyFromCode ( Workspace $ workspace , $ code ) { if ( $ this -> logger ) { $ this -> container -> get ( 'claroline.api.serializer' ) -> setLogger ( $ this -> logger ) ; } $ newWorkspace = new Workspace ( ) ; $ newWorkspace -> setCode ( $ code ) ; $ newWorkspace -> setName ( $ code ) ; $ this -> copy ( ... | used for cli copy debug tool |
53,435 | public function copy ( Workspace $ workspace , Workspace $ newWorkspace , $ model = false ) { $ transferManager = $ this -> container -> get ( 'claroline.manager.workspace.transfer' ) ; $ fileBag = new FileBag ( ) ; $ data = $ transferManager -> serialize ( $ workspace ) ; $ data = $ transferManager -> exportFiles ( $ ... | Copies a Workspace . |
53,436 | public function getManagers ( Workspace $ workspace ) { $ roleManager = $ this -> roleManager -> getManagerRole ( $ workspace ) ; return $ this -> userRepo -> findUsersByRolesIncludingGroups ( [ $ roleManager ] ) ; } | Retrieves the managers list for a workspace . |
53,437 | public function cleanRecentWorkspaces ( ) { $ this -> log ( 'Cleaning recent workspaces entries that are older than six months' ) ; $ recentWorkspaceRepo = $ this -> om -> getRepository ( 'ClarolineCoreBundle:Workspace\WorkspaceRecent' ) ; $ recentWorkspaceRepo -> removeAllEntriesBefore ( new \ DateTime ( '-6 months' )... | Clean all recent workspaces that are more than 6 months old |
53,438 | public function favouriteToggleAction ( User $ user , Request $ request ) { $ nodes = $ this -> decodeIdsString ( $ request , 'Claroline\CoreBundle\Entity\Resource\ResourceNode' ) ; $ this -> manager -> toggleFavourites ( $ user , $ nodes ) ; return new JsonResponse ( null , 204 ) ; } | Creates or deletes favourite resources . |
53,439 | public function share ( array $ shareRequest , User $ user ) { $ errors = $ this -> validateShareRequest ( $ shareRequest ) ; if ( count ( $ errors ) > 0 ) { throw new InvalidDataException ( 'Share request is not valid' , $ errors ) ; } $ adminRights = isset ( $ shareRequest [ 'adminRights' ] ) && $ shareRequest [ 'adm... | Shares a list of question to users . |
53,440 | private function getSharedForUser ( User $ user , array $ shared ) { $ userLink = null ; foreach ( $ shared as $ shareLink ) { if ( $ shareLink -> getUser ( ) === $ user ) { $ userLink = $ shareLink ; break ; } } return $ userLink ; } | Gets an existing share link for a user in the share list of the question . |
53,441 | private function validateShareRequest ( array $ shareRequest ) { $ errors = [ ] ; if ( empty ( $ shareRequest [ 'questions' ] ) || ! is_array ( $ shareRequest [ 'questions' ] ) ) { $ errors [ ] = [ 'path' => '/questions' , 'message' => 'should be a list of question ids' , ] ; } if ( empty ( $ shareRequest [ 'users' ] )... | Validates a share request . |
53,442 | public static function normalize ( \ DateTime $ date = null ) { if ( ! empty ( $ date ) ) { return $ date -> format ( static :: DATE_FORMAT ) ; } return null ; } | Normalizes a DateTime to a string . |
53,443 | public static function denormalize ( $ dateString = null ) { if ( ! empty ( $ dateString ) ) { try { $ dateTime = \ DateTime :: createFromFormat ( static :: DATE_FORMAT , $ dateString ) ; return $ dateTime ; } catch ( \ Exception $ e ) { } } return null ; } | Denormalizes a string into a DateTime object . |
53,444 | public function load ( LoadResourceEvent $ event ) { $ event -> setData ( [ 'text' => $ this -> serializer -> serialize ( $ event -> getResource ( ) ) , ] ) ; $ event -> stopPropagation ( ) ; } | Loads a Text resource . |
53,445 | public function resetFieldFacets ( ) { foreach ( $ this -> fieldsFacet as $ field ) { $ field -> setPanelFacet ( null ) ; } $ this -> fieldsFacet = new ArrayCollection ( ) ; } | Remove all field facets . |
53,446 | public function create ( $ content , $ object , array $ users , $ sender = null , $ parent = null ) { $ message = new Message ( ) ; $ message -> setContent ( $ content ) ; $ message -> setParent ( $ parent ) ; $ message -> setObject ( $ object ) ; $ message -> setSender ( $ sender ) ; $ stringTo = '' ; foreach ( $ user... | Create a message . |
53,447 | public function generateStringTo ( array $ receivers , array $ groups , array $ workspaces ) { $ usernames = [ ] ; foreach ( $ receivers as $ receiver ) { $ usernames [ ] = $ receiver -> getUsername ( ) ; } $ string = implode ( ';' , $ usernames ) ; foreach ( $ groups as $ group ) { $ el = '{' . $ group -> getName ( ) ... | Generates a string containing the usernames from a list of users . |
53,448 | public function serialize ( Comment $ comment , array $ options = [ ] ) { return [ 'id' => $ comment -> getUuid ( ) , 'message' => $ comment -> getMessage ( ) , 'creationDate' => $ comment -> getCreationDate ( ) ? DateNormalizer :: normalize ( $ comment -> getCreationDate ( ) ) : null , 'updateDate' => $ comment -> get... | Serialize a post comment . |
53,449 | public function setDropzone ( \ Innova \ CollecticielBundle \ Entity \ Dropzone $ dropzone ) { $ this -> dropzone = $ dropzone ; return $ this ; } | Set dropzone . |
53,450 | public function setReturnReceiptType ( \ Innova \ CollecticielBundle \ Entity \ ReturnReceiptType $ returnReceiptType = null ) { $ this -> returnReceiptType = $ returnReceiptType ; return $ this ; } | Set returnReceiptType . |
53,451 | public function onError ( GetResponseForExceptionEvent $ event ) { if ( $ event -> getRequest ( ) -> isXmlHttpRequest ( ) ) { $ exception = $ event -> getException ( ) ; if ( $ exception instanceof InvalidDataException ) { $ response = new JsonResponse ( $ exception -> getErrors ( ) , 422 ) ; } else { $ response = new ... | Converts Exceptions in JSON for the async api . |
53,452 | public function onResponse ( FilterResponseEvent $ event ) { $ request = $ event -> getRequest ( ) ; $ debug = $ request -> query -> get ( 'debug' ) ; $ response = $ event -> getResponse ( ) ; if ( $ response instanceof JsonResponse && $ debug ) { $ new = new Response ( ) ; $ new -> setContent ( '<body>' . $ response -... | If we re returning a JsonResponse we can get the debug bar by passing ?debug = true on the query string . |
53,453 | public function menuAction ( ) { $ workspaces = [ ] ; $ personalWs = null ; $ user = null ; $ token = $ this -> tokenStorage -> getToken ( ) ; if ( $ token ) { $ user = $ token -> getUser ( ) ; } if ( $ user instanceof User ) { $ personalWs = $ user -> getPersonalWorkspace ( ) ; $ workspaces = $ this -> workspaceManage... | Gets the main workspace menu for the current user . |
53,454 | public function listCommentReportedAction ( Request $ request , Blog $ blog ) { $ this -> checkPermission ( 'OPEN' , $ blog -> getResourceNode ( ) , [ ] , true ) ; if ( $ this -> checkPermission ( 'MODERATE' , $ blog -> getResourceNode ( ) ) || $ this -> checkPermission ( 'EDIT' , $ blog -> getResourceNode ( ) ) ) { $ ... | Get reported comments posts . |
53,455 | public function listTrustedUsersAction ( Request $ request , Blog $ blog ) { if ( $ this -> checkPermission ( 'MODERATE' , $ blog -> getResourceNode ( ) ) || $ this -> checkPermission ( 'EDIT' , $ blog -> getResourceNode ( ) ) ) { $ users = $ this -> commentManager -> getTrustedUsers ( $ blog ) ; return new JsonRespons... | Get unpublished comments posts . |
53,456 | public function updateCommentAction ( Request $ request , Blog $ blog , Comment $ comment , User $ user = null ) { $ this -> checkPermission ( 'OPEN' , $ blog -> getResourceNode ( ) , [ ] , true ) ; if ( $ blog -> isCommentsAuthorized ( ) && $ this -> isLoggedIn ( $ user ) ) { if ( $ user !== $ comment -> getAuthor ( )... | Update post comment . |
53,457 | public function unpublishCommentAction ( Request $ request , Blog $ blog , Comment $ comment , User $ user ) { $ this -> checkPermission ( 'EDIT' , $ blog -> getResourceNode ( ) , [ ] , true ) ; $ comment = $ this -> commentManager -> unpublishComment ( $ blog , $ comment ) ; return new JsonResponse ( $ this -> comment... | Unpublish post comment . |
53,458 | public function reportCommentAction ( Request $ request , Blog $ blog , Comment $ comment , User $ user ) { $ comment = $ this -> commentManager -> reportComment ( $ blog , $ comment ) ; return new JsonResponse ( $ this -> commentSerializer -> serialize ( $ comment ) ) ; } | Report post comment . |
53,459 | public function deleteCommentAction ( Request $ request , Blog $ blog , Comment $ comment , User $ user ) { if ( $ blog -> isCommentsAuthorized ( ) && $ this -> isLoggedIn ( $ user ) ) { if ( $ user === $ comment -> getAuthor ( ) || $ this -> checkPermission ( 'EDIT' , $ blog -> getResourceNode ( ) ) || $ this -> check... | Delete post comment . |
53,460 | public function copyRoot ( Chapter $ root_original , Chapter $ root_copy ) { $ root_copy -> setTitle ( $ root_original -> getTitle ( ) ) ; $ root_copy -> setText ( $ root_original -> getText ( ) ) ; $ this -> copyChildren ( $ root_original , $ root_copy , true ) ; } | Copy full lesson chapters from original root to copy root . |
53,461 | public function copyChapter ( Chapter $ chapter_org , Chapter $ parent , $ copy_children , $ copyName = null ) { $ chapter_copy = new Chapter ( ) ; if ( ! $ copyName ) { $ copyName = $ chapter_org -> getTitle ( ) ; } $ chapter_copy -> setTitle ( $ copyName ) ; $ chapter_copy -> setText ( $ chapter_org -> getText ( ) ) ... | Copy chapter_org subchapters into provided chapter_copy . |
53,462 | public function getShareLink ( $ url , array $ options = array ( ) ) { $ options [ 'url' ] = $ url ; return sprintf ( self :: SHARE_URL , http_build_query ( $ options ) ) ; } | Gets the share link for provided URL . |
53,463 | public function serialize ( ResourceType $ resourceType ) { return [ 'id' => $ resourceType -> getId ( ) , 'name' => $ resourceType -> getName ( ) , 'class' => $ resourceType -> getClass ( ) , 'tags' => $ resourceType -> getTags ( ) , 'enabled' => $ resourceType -> isEnabled ( ) , 'actions' => array_map ( function ( Me... | Serializes a ResourceType entity for the JSON api . |
53,464 | public function removeShortcutsTo ( ResourceNode $ resourceNode ) { $ this -> om -> startFlushSuite ( ) ; $ shortcuts = $ this -> repository -> findBy ( [ 'target' => $ resourceNode ] ) ; foreach ( $ shortcuts as $ shortcut ) { $ this -> om -> remove ( $ shortcut -> getResourceNode ( ) ) ; } $ this -> om -> endFlushSui... | Removes all shortcuts associated to a resource . |
53,465 | public function serialize ( Forum $ forum , array $ options = [ ] ) { $ currentUser = $ this -> tokenStorage -> getToken ( ) -> getUser ( ) ; if ( ! is_string ( $ currentUser ) ) { $ forumUser = $ this -> manager -> getValidationUser ( $ currentUser , $ forum ) ; } else { $ forumUser = new User ( ) ; } $ now = new \ Da... | Serializes a Forum entity . |
53,466 | public function onDisplayWorkspace ( DisplayToolEvent $ event ) { $ levelMax = 1 ; $ workspace = $ event -> getWorkspace ( ) ; $ authenticatedUser = $ this -> tokenStorage -> getToken ( ) -> getUser ( ) ; $ user = 'anon.' !== $ authenticatedUser ? $ authenticatedUser : null ; $ items = $ this -> progressionManager -> f... | Displays workspace progression tool . |
53,467 | public function findByWorkspace ( Workspace $ workspace , $ orderedBy = 'id' , $ order = 'ASC' ) { $ dql = " SELECT r FROM Claroline\CoreBundle\Entity\Role r JOIN r.workspace ws WHERE ws.id = :workspaceId ORDER BY r.{$orderedBy} {$order} " ; $ query = $ this -> _em -> ... | Returns the roles associated to a workspace . |
53,468 | public function findByWorkspaceAndSearch ( Workspace $ workspace , $ search = '' , $ orderedBy = 'id' , $ order = 'ASC' ) { $ dql = " SELECT r FROM Claroline\CoreBundle\Entity\Role r JOIN r.workspace ws WHERE ws.id = :workspaceId AND UPPER(r.translationKey) LIKE :search ... | Returns the searched roles associated to a workspace . |
53,469 | public function findPlatformRoles ( User $ user ) { $ dql = " SELECT r FROM Claroline\CoreBundle\Entity\Role r JOIN r.users u WHERE u.id = {$user->getId()} AND r.type = " . Role :: PLATFORM_ROLE ; $ query = $ this -> _em -> createQuery ( $ dql ) ; return $ query -> getResult ( ) ; } | Returns the platform roles of a user . |
53,470 | public function findAllUserRoles ( $ executeQuery = true ) { $ dql = ' SELECT r FROM Claroline\CoreBundle\Entity\Role r WHERE r.type = :type ' ; $ query = $ this -> _em -> createQuery ( $ dql ) ; $ query -> setParameter ( 'type' , Role :: USER_ROLE ) ; return $ executeQuery ? $ q... | Returns all user - type roles . |
53,471 | public function findWorkspaceRolesByUser ( User $ user , $ executeQuery = true ) { $ dql = ' SELECT r FROM Claroline\CoreBundle\Entity\Role r JOIN r.users u WHERE u = :user AND r.type = :type AND r.workspace IS NOT NULL ' ; $ query = $ this -> _em... | Returns all workspace roles of an user . |
53,472 | public function getCell ( $ uuid ) { $ found = null ; foreach ( $ this -> cells as $ cell ) { if ( $ cell -> getUuid ( ) === $ uuid ) { $ found = $ cell ; break ; } } return $ found ; } | Get a cell by its uuid . |
53,473 | public function addCell ( Cell $ cell ) { if ( ! $ this -> cells -> contains ( $ cell ) ) { $ cell -> SetQuestion ( $ this ) ; $ this -> cells -> add ( $ cell ) ; } } | Add cell . |
53,474 | public function removeCell ( Cell $ cell ) { if ( $ this -> cells -> contains ( $ cell ) ) { $ this -> cells -> removeElement ( $ cell ) ; } } | Remove cell . |
53,475 | public function getReaderFor ( $ feedContent ) { @ $ content = new SimpleXMLElement ( $ feedContent ) ; foreach ( $ this -> readers as $ reader ) { if ( $ reader -> supports ( $ content -> getName ( ) ) ) { $ reader -> setFeed ( $ content ) ; return $ reader ; } } throw new UnknownFormatException ( "Parser has no suppo... | Returns a reader object for the given feed . |
53,476 | public function bookSearchAction ( ParamFetcher $ paramFetcher ) { $ api_key = $ this -> getApiKey ( ) ; $ query = $ paramFetcher -> get ( 'query' ) ; $ index = $ paramFetcher -> get ( 'index' ) ; $ page = $ paramFetcher -> get ( 'page' ) ; $ url = "http://isbndb.com/api/v2/json/$api_key/books?q=$query&i=$index&p=$page... | Search in ISBNDB . |
53,477 | public function bookDetailsAction ( ParamFetcher $ paramFetcher ) { $ api_key = $ this -> getApiKey ( ) ; $ bookId = $ paramFetcher -> get ( 'bookId' ) ; $ url = "http://isbndb.com/api/v2/json/$api_key/book/$bookId?opt=keystats" ; $ result = $ this -> sendRequest ( $ url ) ; unset ( $ result [ 'keystats' ] [ 'key_id' ]... | Get book details from ISBNDB . |
53,478 | public function exportLogsToCsv ( $ query ) { $ query [ 'limit' ] = self :: CSV_LOG_BATCH ; $ query [ 'page' ] = 0 ; $ count = 0 ; $ total = 0 ; $ handle = fopen ( 'php://output' , 'w+' ) ; fputcsv ( $ handle , [ $ this -> translator -> trans ( 'date' , [ ] , 'platform' ) , $ this -> translator -> trans ( 'action' , [ ... | Given a query params it exports all logs to a CSV file . |
53,479 | public function exportUserActionToCsv ( array $ finderParams = [ ] ) { $ queryParams = FinderProvider :: parseQueryParams ( $ finderParams ) ; $ allFilters = $ queryParams [ 'allFilters' ] ; $ sortBy = $ queryParams [ 'sortBy' ] ; $ limit = self :: CSV_LOG_BATCH ; $ page = 0 ; $ count = 0 ; $ total = intval ( $ this ->... | Exports users actions for a given query . |
53,480 | private function formatDataForChart ( array $ data , \ DateTime $ minDate = null , \ DateTime $ maxDate = null ) { $ prevDate = $ minDate ; $ chartData = [ ] ; $ idx = 0 ; foreach ( $ data as $ value ) { while ( $ prevDate !== null && $ prevDate < $ value [ 'date' ] ) { $ chartData [ "c${idx}" ] = [ 'xData' => $ prevDa... | Formats raw data to the appropriate charts format . |
53,481 | public function linkResource ( ResourceNode $ resource ) { if ( ! $ this -> isLinkedToResource ( $ resource ) ) { $ this -> resources -> add ( $ resource ) ; ++ $ this -> resourceCount ; } } | Associates the ability with a resource . |
53,482 | public function removeResource ( ResourceNode $ resource ) { if ( $ this -> isLinkedToResource ( $ resource ) ) { $ this -> resources -> removeElement ( $ resource ) ; -- $ this -> resourceCount ; } } | Removes an association with a resource . |
53,483 | public function preUpdate ( User $ user , PreUpdateEventArgs $ event ) { if ( $ event -> hasChangedField ( 'password' ) ) { $ event -> setNewValue ( 'password' , $ this -> encodePassword ( $ user ) ) ; } } | Encodes the password when a User is updated and value has changed . |
53,484 | private function encodePassword ( User $ user ) { $ password = $ this -> encoderFactory -> getEncoder ( $ user ) -> encodePassword ( $ user -> getPlainPassword ( ) , $ user -> getSalt ( ) ) ; $ user -> setPassword ( $ password ) ; return $ password ; } | Encodes the user password and returns it . |
53,485 | public function addUser ( User $ user ) { if ( ! $ this -> users -> contains ( $ user ) ) { $ this -> users -> add ( $ user ) ; } return $ this ; } | Adds an user to team . |
53,486 | public function removeUser ( User $ user ) { if ( $ this -> users -> contains ( $ user ) ) { $ this -> users -> removeElement ( $ user ) ; } return $ this ; } | Removes an user to team . |
53,487 | public function getFormattedSize ( ) { if ( $ this -> size < 1024 ) { return $ this -> size . ' B' ; } elseif ( $ this -> size < 1048576 ) { return round ( $ this -> size / 1024 , 2 ) . ' KB' ; } elseif ( $ this -> size < 1073741824 ) { return round ( $ this -> size / 1048576 , 2 ) . ' MB' ; } elseif ( $ this -> size <... | Returns the file size with unit and in a readable format . |
53,488 | public function fetchChartData ( array $ filters = [ ] , $ unique = false ) { $ qb = $ this -> createQueryBuilder ( 'obj' ) ; if ( true === $ unique ) { $ qb -> select ( 'obj.shortDateLog as date, COUNT(DISTINCT obj.doer) as total' ) ; } else { $ qb -> select ( 'obj.shortDateLog as date, COUNT(obj.id) as total' ) ; } $... | Fetches data for line chart . |
53,489 | public function findActionAfterDate ( $ action , $ date , $ doerId = null , $ resourceId = null , $ workspaceId = null , $ receiverId = null , $ roleId = null , $ groupId = null , $ toolName = null , $ userType = null ) { $ queryBuilder = $ this -> createQueryBuilder ( 'log' ) -> orderBy ( 'log.dateLog' , 'DESC' ) -> a... | this method is never used and not up to date . |
53,490 | public function serialize ( LtiResource $ ltiResource , array $ options = [ ] ) { $ serialized = [ 'id' => $ ltiResource -> getUuid ( ) , 'openInNewTab' => $ ltiResource -> getOpenInNewTab ( ) , 'ratio' => $ ltiResource -> getRatio ( ) , 'ltiApp' => $ ltiResource -> getLtiApp ( ) ? $ this -> ltiAppSerializer -> seriali... | Serializes a LTI resource for the JSON api . |
53,491 | public function viewHint ( Paper $ paper , Hint $ hint ) { $ log = $ this -> om -> getRepository ( 'UJMExoBundle:LinkHintPaper' ) -> findOneBy ( [ 'paper' => $ paper , 'hint' => $ hint ] ) ; if ( ! $ log ) { $ log = new LinkHintPaper ( $ hint , $ paper ) ; $ this -> om -> persist ( $ log ) ; $ this -> om -> flush ( ) ;... | Returns the contents of a hint and records a log asserting that the hint has been consulted for a given paper . |
53,492 | public function serialize ( ContentItem $ contentItem , array $ options = [ ] ) { $ serialized = [ ] ; if ( 1 === preg_match ( '#^text\/[^/]+$#' , $ contentItem -> getQuestion ( ) -> getMimeType ( ) ) ) { $ serialized [ 'data' ] = $ contentItem -> getData ( ) ; } else { $ serialized [ 'url' ] = $ contentItem -> getData... | Converts a content item into a JSON - encodable structure . |
53,493 | public function deserialize ( $ data , ContentItem $ contentItem = null , array $ options = [ ] ) { if ( empty ( $ contentItem ) ) { $ contentItem = new ContentItem ( ) ; } $ this -> sipe ( 'url' , 'setData' , $ data , $ contentItem ) ; $ this -> sipe ( 'data' , 'setData' , $ data , $ contentItem ) ; return $ contentIt... | Converts raw data into a content item entity . |
53,494 | public function findAll ( $ executeQuery = true , $ orderedBy = 'id' , $ order = null ) { if ( ! $ executeQuery ) { $ dql = " SELECT u, pws, g, r, rws FROM Claroline\CoreBundle\Entity\User u LEFT JOIN u.personalWorkspace pws LEFT JOIN u.groups g ... | Returns all the users . |
53,495 | public function findByGroup ( Group $ group , $ executeQuery = true , $ orderedBy = 'id' , $ order = 'ASC' ) { $ dql = " SELECT DISTINCT u FROM Claroline\CoreBundle\Entity\User u JOIN u.groups g WHERE g.id = :groupId AND u.isRemoved = false ORDER BY u.{$orderedBy} ... | Returns the users of a group . |
53,496 | public function findAllByWorkspaceAndName ( Workspace $ workspace , $ search , $ executeQuery = true ) { $ upperSearch = strtoupper ( $ search ) ; $ dql = ' SELECT DISTINCT u FROM Claroline\CoreBundle\Entity\User u WHERE u IN ( SELECT u1 FROM Claroline\CoreBundle\Entity\User u1 ... | Returns the users of a workspace whose first name last name or username match a given search string . Including users in groups . |
53,497 | public function findByUsernames ( array $ usernames ) { if ( count ( $ usernames ) > 0 ) { $ dql = ' SELECT u FROM Claroline\CoreBundle\Entity\User u WHERE u.isRemoved = false AND u.username IN (:usernames) ' ; $ query = $ this -> _em -> createQuery ( $ dql ) ; $ ... | Returns users by their usernames . |
53,498 | public function countUsersByRole ( Role $ role , $ restrictionRoleNames = null , $ organizations = null ) { $ qb = $ this -> createQueryBuilder ( 'user' ) -> select ( 'COUNT(DISTINCT user.id)' ) -> leftJoin ( 'user.roles' , 'roles' ) -> andWhere ( 'roles.id = :roleId' ) -> andWhere ( 'user.isEnabled = :enabled' ) -> se... | Counts the users subscribed in a platform role . |
53,499 | public function findUserIdsInRoles ( $ roleNames ) { $ qb = $ this -> createQueryBuilder ( 'user' ) -> select ( 'DISTINCT(user.id) as id' ) -> leftJoin ( 'user.roles' , 'roles' ) -> andWhere ( 'roles.name IN (:roleNames)' ) -> andWhere ( 'user.isRemoved = false' ) -> setParameter ( 'roleNames' , $ roleNames ) ; $ query... | Returns user Ids that are subscribed to one of the roles given . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.