idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
49,300 | public function getStoryEmbedAction ( Request $ request , $ databox_id , $ record_id ) { $ record = $ this -> findDataboxById ( $ databox_id ) -> get_record ( $ record_id ) ; $ devices = $ request -> get ( 'devices' , [ ] ) ; $ mimes = $ request -> get ( 'mimes' , [ ] ) ; $ ret = array_values ( array_filter ( array_map... | Get a Response containing the story embed files |
49,301 | public function getStoryAction ( Request $ request , $ databox_id , $ record_id ) { try { $ story = $ this -> findDataboxById ( $ databox_id ) -> get_record ( $ record_id ) ; return Result :: create ( $ request , [ 'story' => $ this -> listStory ( $ request , $ story ) ] ) -> createResponse ( ) ; } catch ( NotFoundHttp... | Return detailed information about one story |
49,302 | public function getCurrentUserStructureAction ( Request $ request ) { $ ret = [ "meta_fields" => $ this -> listUserAuthorizedMetadataFields ( $ this -> getAuthenticatedUser ( ) ) , "aggregable_fields" => $ this -> buildUserFieldList ( ElasticsearchOptions :: getAggregableTechnicalFields ( ) , [ 'choices' ] ) , "technic... | Returns all documentary fields available for user |
49,303 | public function getCurrentUserSubdefsAction ( Request $ request ) { $ ret = [ "subdefs" => $ this -> listUserAuthorizedSubdefs ( $ this -> getAuthenticatedUser ( ) ) , ] ; return Result :: create ( $ request , $ ret ) -> createResponse ( ) ; } | Returns all sub - definitions available for the user |
49,304 | public function getCurrentUserCollectionsAction ( Request $ request ) { $ ret = [ "collections" => $ this -> listUserAuthorizedCollections ( $ this -> getAuthenticatedUser ( ) ) , ] ; return Result :: create ( $ request , $ ret ) -> createResponse ( ) ; } | Returns all collections available for the user |
49,305 | private function listUserAuthorizedMetadataFields ( User $ user ) { $ acl = $ this -> getAclForUser ( $ user ) ; $ ret = [ ] ; foreach ( $ acl -> get_granted_sbas ( ) as $ databox ) { $ databoxId = $ databox -> get_sbas_id ( ) ; foreach ( $ databox -> get_meta_structure ( ) as $ databox_field ) { $ data = [ 'name' => $... | Returns list of Metadata Fields from the databoxes on which the user has rights |
49,306 | private function listUserAuthorizedSubdefs ( User $ user ) { $ acl = $ this -> getAclForUser ( $ user ) ; $ ret = [ ] ; foreach ( $ acl -> get_granted_sbas ( ) as $ databox ) { $ databoxId = $ databox -> get_sbas_id ( ) ; $ subdefs = $ databox -> get_subdef_structure ( ) ; foreach ( $ subdefs as $ subGroup ) { foreach ... | Returns list of sub - definitions from the databoxes on which the user has rights |
49,307 | private function listUserAuthorizedCollections ( User $ user ) { $ acl = $ this -> getAclForUser ( $ user ) ; $ rights = $ acl -> get_bas_rights ( ) ; $ bases = $ acl -> get_granted_base ( ) ; $ grants = [ ] ; $ statusMapper = new RestrictedStatusExtractor ( $ acl , $ this -> getApplicationBox ( ) ) ; foreach ( $ bases... | Returns list of collection from the databoxes on which the user has rights |
49,308 | protected function updateMetadatas ( \ record_adapter $ record , $ xml ) { $ metas = $ record -> getDatabox ( ) -> get_meta_structure ( ) ; $ datas = $ metadatas = [ ] ; if ( false !== $ sxe = simplexml_load_string ( $ xml ) ) { $ fields = $ sxe -> xpath ( '/record/description' ) ; if ( $ fields && is_array ( $ fields ... | Update the metadatas of a record |
49,309 | protected function setOriginalName ( \ databox $ databox , array $ record ) { static $ stmt ; if ( ! isset ( $ stmt [ $ databox -> get_sbas_id ( ) ] ) ) { $ sql = 'UPDATE record SET originalname = :originalname WHERE record_id = :record_id' ; $ stmt [ $ databox -> get_sbas_id ( ) ] = $ databox -> get_connection ( ) -> ... | Update the original name of a record |
49,310 | protected function ensureDropMigrateColumn ( \ databox $ databox ) { $ sql = 'ALTER TABLE `record` DROP `migrate35` ' ; $ stmt = $ databox -> get_connection ( ) -> prepare ( $ sql ) ; $ stmt -> execute ( ) ; $ stmt -> closeCursor ( ) ; } | Removes the migration column |
49,311 | protected function ensureMigrateColumn ( \ databox $ databox ) { try { $ sql = 'ALTER TABLE `record` ADD `migrate35` TINYINT( 1 ) UNSIGNED NOT NULL , ADD INDEX ( `migrate35` ) ' ; $ stmt = $ databox -> get_connection ( ) -> prepare ( $ sql ) ; $ stmt -> execute ( ) ; $ stmt -> clos... | Add a migration column to the table |
49,312 | public function getModuleNameFromId ( $ appId ) { if ( null === $ this -> moduleNames ) { $ translator = $ this -> translator ; $ this -> moduleNames = [ '0' => $ translator -> trans ( 'admin::monitor: module inconnu' ) , '1' => $ translator -> trans ( 'admin::monitor: module production' ) , '2' => $ translator -> tran... | Return module name according to its ID |
49,313 | public function findNotConfirmedAndNotRemindedParticipantsByExpireDate ( \ DateTime $ expireDate ) { $ dql = ' SELECT p, s FROM Phraseanet:ValidationParticipant p JOIN p.session s JOIN s.basket b WHERE p.is_confirmed = 0 AND p.reminded IS NULL ... | Retrieve all not reminded participants where the validation has not expired |
49,314 | private function useTokenHeaderChoice ( $ apiTokenHeader ) { if ( $ apiTokenHeader === true ) { return Oauth2 :: TOKEN_ONLY_IN_HEADER ; } elseif ( $ apiTokenHeader === false ) { return Oauth2 :: TOKEN_ONLY_IN_GETPOST ; } else { return Oauth2 :: TOKEN_AUTO_FIND ; } } | Get the correct constante to call on Oauth2 |
49,315 | public function readNotifications ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { $ this -> app -> abort ( 400 ) ; } try { $ this -> getEventsManager ( ) -> read ( explode ( '_' , ( string ) $ request -> request -> get ( 'notifications' ) ) , $ this -> getAuthenticatedUser ( ) -> getId ( ) ) ; retu... | Set notifications as read |
49,316 | public static function create ( Application $ app , ReceiverInterface $ receiver , EmitterInterface $ emitter = null , $ message = null ) { return new static ( $ app , $ receiver , $ emitter , $ message ) ; } | Creates an Email |
49,317 | public function has ( User $ user ) { return $ this -> entries -> exists ( function ( $ key , $ entry ) use ( $ user ) { return $ entry -> getUser ( ) -> getId ( ) === $ user -> getId ( ) ; } ) ; } | Return true if one of the entry is related to the given user |
49,318 | public function getCaptionFieldLabel ( RecordInterface $ record , $ fieldName ) { if ( $ record ) { $ appbox = $ this -> app [ 'phraseanet.appbox' ] ; $ databox = $ appbox -> get_databox ( $ record -> getDataboxId ( ) ) ; foreach ( $ databox -> get_meta_structure ( ) as $ meta ) { if ( $ meta -> get_name ( ) === $ fiel... | get localized field s label |
49,319 | protected function checkChromeFrame ( ) { $ this -> _chrome_frame = false ; if ( preg_match ( '/chromeframe/i' , $ this -> _agent ) ) { $ this -> _chrome_frame = true ; $ aresult = explode ( '/' , stristr ( $ this -> _agent , 'chromeframe' ) ) ; $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; $ chrome_version = explod... | Protected routine to determine if the browser is chrome frame enabled |
49,320 | protected function checkNewGeneration ( ) { $ this -> _is_new_generation = false ; if ( in_array ( $ this -> _browser_name , [ 'Opera' , 'Internet Explorer' , 'Firefox' , 'Iceweasel' , 'Safari' , 'Chrome' , 'iPhone' , 'iPod' ] ) ) { switch ( $ this -> _browser_name ) { case 'Opera' : if ( $ this -> _version >= 10 ) $ t... | Check if is new generation |
49,321 | protected function checkHTML5 ( ) { if ( in_array ( $ this -> _browser_name , [ 'Opera' , 'Internet Explorer' , 'Firefox' , 'Iceweasel' , 'Safari' , 'Chrome' , 'iPhone' , 'iPod' ] ) ) { switch ( $ this -> _browser_name ) { case 'Opera' : if ( $ this -> _version >= 10 ) $ this -> _is_html5 = true ; break ; case 'Interne... | Check if is HTML5 |
49,322 | protected function checkAge ( ) { $ this -> _is_old = false ; switch ( $ this -> _browser_name ) { case 'Opera' : if ( $ this -> _version < 10 ) $ this -> _is_old = true ; break ; case 'Firefox' : case 'Iceweasel' : if ( $ this -> _version < 3 ) $ this -> _is_old = true ; break ; case 'Safari' : if ( $ this -> _version... | Check the version of browser |
49,323 | protected function checkIP ( ) { if ( getenv ( "HTTP_CLIENT_IP" ) ) $ this -> _ip = getenv ( "HTTP_CLIENT_IP" ) ; elseif ( getenv ( "HTTP_X_FORWARDED_FOR" ) ) $ this -> _ip = getenv ( "HTTP_X_FORWARDED_FOR" ) ; else $ this -> _ip = getenv ( "REMOTE_ADDR" ) ; } | GET the IP address |
49,324 | public function displayStatusProperty ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { $ this -> app -> abort ( 400 ) ; } $ records = RecordsRequest :: fromRequest ( $ this -> app , $ request , false , [ \ ACL :: CHGSTATUS ] ) ; $ databoxes = $ records -> databoxes ( ) ; if ( count ( $ databoxes ) >... | Display Status property |
49,325 | public function displayTypeProperty ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { $ this -> app -> abort ( 400 ) ; } $ records = RecordsRequest :: fromRequest ( $ this -> app , $ request , false , [ \ ACL :: CANMODIFRECORD ] ) ; $ recordsType = [ ] ; foreach ( $ records as $ record ) { $ sbasId =... | Display type property |
49,326 | public function changeStatus ( Request $ request ) { $ applyStatusToChildren = $ request -> request -> get ( 'apply_to_children' , [ ] ) ; $ records = RecordsRequest :: fromRequest ( $ this -> app , $ request , false , [ \ ACL :: CHGSTATUS ] ) ; $ updated = [ ] ; $ postStatus = ( array ) $ request -> request -> get ( '... | Change record status |
49,327 | public function changeType ( Request $ request ) { $ typeLst = $ request -> request -> get ( 'types' , [ ] ) ; $ records = RecordsRequest :: fromRequest ( $ this -> app , $ request , false , [ \ ACL :: CANMODIFRECORD ] ) ; $ mimeLst = $ request -> request -> get ( 'mimes' , [ ] ) ; $ forceType = $ request -> request ->... | Change record type |
49,328 | private function updateRecordStatus ( \ record_adapter $ record , array $ postStatus ) { $ sbasId = $ record -> getDataboxId ( ) ; if ( isset ( $ postStatus [ $ sbasId ] ) && is_array ( $ postStatus [ $ sbasId ] ) ) { $ postStatus = $ postStatus [ $ sbasId ] ; $ currentStatus = strrev ( $ record -> getStatus ( ) ) ; $ ... | Set new status to selected record |
49,329 | public function databoxes ( ) { if ( ! $ this -> databoxes ) { $ this -> databoxes = [ ] ; foreach ( $ this as $ record ) { if ( false === array_key_exists ( $ record -> get_databox ( ) -> get_sbas_id ( ) , $ this -> databoxes ) ) { $ this -> databoxes [ $ record -> get_databox ( ) -> get_sbas_id ( ) ] = $ record -> ge... | Return all distinct databoxes related to the contained records |
49,330 | public function collections ( ) { if ( ! $ this -> collections ) { $ this -> collections = [ ] ; foreach ( $ this as $ record ) { if ( ! isset ( $ this -> collections [ $ record -> getBaseId ( ) ] ) ) { $ this -> collections [ $ record -> getBaseId ( ) ] = $ record -> get_collection ( ) ; } } $ this -> collections = ar... | Return all distinct collections related to the contained records |
49,331 | public function serializedList ( ) { if ( $ this -> isSingleStory ( ) ) { return $ this -> singleStory ( ) -> getId ( ) ; } $ basrec = [ ] ; foreach ( $ this as $ record ) { $ basrec [ ] = $ record -> get_serialize_key ( ) ; } return implode ( ';' , $ basrec ) ; } | Return a serialized list of elements |
49,332 | public function slash ( Request $ request ) { switch ( $ emailStatus = $ request -> query -> get ( 'email' ) ) { case 'sent' ; $ emailStatus = $ this -> app -> trans ( 'Mail sent' ) ; break ; case 'error' : $ emailStatus = $ this -> app -> trans ( 'Could not send email' ) ; break ; } return $ this -> render ( 'admin/da... | Display admin dashboard page |
49,333 | public function flush ( ) { $ cache = $ this -> app [ 'phraseanet.cache-service' ] ; $ flushOK = $ cache -> flushAll ( ) ? 'ok' : 'ko' ; return $ this -> app -> redirectPath ( 'admin_dashboard' , [ 'flush_cache' => $ flushOK ] ) ; } | Flush all cache services |
49,334 | public function sendMail ( Request $ request ) { if ( null === $ mail = $ request -> request -> get ( 'email' ) ) { $ this -> app -> abort ( 400 , 'Bad request missing email parameter' ) ; } ; if ( ! \ Swift_Validate :: email ( $ mail ) ) { $ this -> app -> abort ( 400 , 'Bad request missing email parameter' ) ; } ; tr... | Test a mail address |
49,335 | public function resetAdminRights ( ) { $ aclManipulator = $ this -> app [ 'manipulator.acl' ] ; $ aclManipulator -> resetAdminRights ( $ this -> getUserRepository ( ) -> findAdmins ( ) ) ; return $ this -> app -> redirectPath ( 'admin_dashboard' ) ; } | Reset admin rights |
49,336 | public function addAdmins ( Request $ request ) { $ admins = $ request -> request -> get ( 'admins' , [ ] ) ; $ admins = array_filter ( $ admins ) ; if ( ! is_array ( $ admins ) || count ( $ admins ) === 0 ) { $ this -> app -> abort ( 400 , '"admins" parameter must contains at least one value.' ) ; } $ authenticator = ... | Grant to an user admin rights |
49,337 | public function parse ( $ string , $ postprocessing = true ) { return $ this -> visitString ( $ string , $ this -> createQueryVisitor ( ) , $ postprocessing ) ; } | Creates a Query object from a string |
49,338 | private function fixOperatorAssociativity ( TreeNode & $ root ) { switch ( $ root -> getChildrenNumber ( ) ) { case 0 : return ; case 2 : $ rootType = $ root -> getId ( ) ; if ( ! in_array ( $ rootType , self :: $ leftAssociativeOperators ) ) { break ; } $ pivot = $ root -> getChild ( 1 ) ; if ( $ pivot -> getId ( ) !=... | Walks the tree to restore left - associativity of some operators |
49,339 | public function restrictToDataboxes ( $ databoxes ) { if ( $ this -> collections ) { throw new \ LogicException ( 'You can not restrict on databoxes and collections simultanously' ) ; } $ this -> databoxes = [ ] ; foreach ( $ this -> toIterator ( $ databoxes ) as $ databox ) { if ( ! $ databox instanceof \ databox ) { ... | Restrict the checker to a set of databoxes . Warning you can not restrict on both databoxes and collections |
49,340 | public function restrictToCollections ( $ collections ) { if ( $ this -> databoxes ) { throw new \ LogicException ( 'You can not restrict on databoxes and collections simultanously' ) ; } $ this -> collections = [ ] ; foreach ( $ this -> toIterator ( $ collections ) as $ collection ) { if ( ! $ collection instanceof \ ... | Restrict the checker to a set of collections . Warning you can not restrict on both databoxes and collections |
49,341 | public function isApplicable ( File $ file ) { if ( empty ( $ this -> databoxes ) && empty ( $ this -> collections ) ) { return true ; } if ( null === $ file -> getCollection ( ) ) { return true ; } $ fileDatabox = $ file -> getCollection ( ) -> get_databox ( ) ; foreach ( $ this -> databoxes as $ databox ) { if ( $ da... | Returns true if the checker should be executed against the current file |
49,342 | public function getDashboard ( Request $ request ) { if ( 'json' === $ request -> getRequestFormat ( ) ) { \ Session_Logger :: updateClientInfos ( $ this -> app , 4 ) ; $ dashboard = new \ module_report_dashboard ( $ this -> app , $ this -> getAuthenticatedUser ( ) ) ; $ dmin = $ request -> query -> get ( 'dmin' ) ; $ ... | Display dashboard information |
49,343 | public function countTotalOrders ( array $ baseIds = [ ] , $ filters = [ ] ) { $ builder = $ this -> createQueryBuilder ( 'o' ) ; $ builder -> select ( $ builder -> expr ( ) -> countDistinct ( 'o.id' ) ) ; $ this -> performQuery ( $ builder , $ baseIds , $ filters ) ; return $ builder -> getQuery ( ) -> getSingleScalar... | Returns the total number of orders from an array of base_id and filters |
49,344 | public function getUserRegistrations ( User $ user , array $ collections ) { $ qb = $ this -> createQueryBuilder ( 'd' ) ; $ qb -> where ( $ qb -> expr ( ) -> eq ( 'd.user' , ':user' ) ) ; $ qb -> setParameter ( ':user' , $ user -> getId ( ) ) ; if ( count ( $ collections ) > 0 ) { $ qb -> andWhere ( 'd.baseId IN (:bas... | Displays registrations for user on provided collection . |
49,345 | public function getPendingRegistrations ( array $ collections ) { $ builder = $ this -> createQueryBuilder ( 'r' ) ; $ builder -> where ( 'r.pending = 1' ) ; if ( ! empty ( $ collections ) ) { $ builder -> andWhere ( 'r.baseId IN (:bases)' ) ; $ builder -> setParameter ( 'bases' , array_map ( function ( \ collection $ ... | Get Current pending registrations . |
49,346 | public function getService ( $ name ) { return isset ( $ this -> container [ $ name ] ) ? $ this -> container [ $ name ] : null ; } | Returns a service contained in the application container or null if none is found with that name . |
49,347 | public function getFormattedDuration ( $ seconds ) { $ duration = ceil ( $ seconds ) . ' seconds' ; if ( $ duration > 60 ) { $ duration = round ( $ duration / 60 , 1 ) . ' minutes' ; } elseif ( $ duration > 3600 ) { $ duration = round ( $ duration / ( 60 * 60 ) , 1 ) . ' hours' ; } elseif ( $ duration > ( 24 * 60 * 60 ... | Format a duration in seconds to human readable |
49,348 | public function openAccount ( User $ user ) { $ this -> session -> remove ( 'usr_id' ) ; $ this -> session -> remove ( 'session_id' ) ; $ session = new Session ( ) ; $ session -> setBrowserName ( $ this -> browser -> getBrowser ( ) ) -> setBrowserVersion ( $ this -> browser -> getVersion ( ) ) -> setPlatform ( $ this -... | Open user session |
49,349 | public function closeAccount ( ) { if ( ! $ this -> session -> has ( 'session_id' ) ) { throw new RuntimeException ( 'No session to close.' ) ; } if ( null !== $ session = $ this -> app [ 'repo.sessions' ] -> find ( $ this -> session -> get ( 'session_id' ) ) ) { $ this -> em -> remove ( $ session ) ; $ this -> em -> f... | Closes user session |
49,350 | public function isAuthenticated ( ) { if ( ! $ this -> session -> has ( 'usr_id' ) ) { return false ; } if ( $ this -> session -> has ( 'session_id' ) ) { if ( null !== $ this -> app [ 'repo.sessions' ] -> find ( $ this -> session -> get ( 'session_id' ) ) ) { return true ; } } $ this -> session -> invalidate ( ) ; $ t... | Tell if current a session is open |
49,351 | public function getStats ( ) { $ this -> stopWatch -> start ( 'cache' ) ; $ result = $ this -> cache -> getStats ( ) ; $ this -> stopWatch -> stop ( 'cache' ) ; return $ result ; } | Retrieves cached information from the data store . |
49,352 | public function flushAll ( ) { $ this -> collect ( 'flush-all' , null ) ; $ this -> stopWatch -> start ( 'cache' ) ; $ this -> cache -> flushAll ( ) ; $ this -> stopWatch -> stop ( 'cache' ) ; } | Flushes all data contained in the adapter |
49,353 | public function getUUID ( $ generate = false , $ write = false ) { if ( $ this -> uuid && ! $ write ) { return $ this -> uuid ; } $ availableUUIDs = [ 'XMP-exif:ImageUniqueID' , 'SigmaRaw:ImageUniqueID' , 'IPTC:UniqueDocumentID' , 'ExifIFD:ImageUniqueID' , 'Canon:ImageUniqueID' , 'XMP-xmpMM:DocumentID' , ] ; if ( ! $ t... | Checks for UUID in metadatas |
49,354 | public function getSha256 ( ) { if ( ! $ this -> sha256 ) { $ this -> sha256 = $ this -> media -> getHash ( 'sha256' ) ; } return $ this -> sha256 ; } | Returns the sha256 checksum of the document |
49,355 | public function getMD5 ( ) { if ( ! $ this -> md5 ) { $ this -> md5 = $ this -> media -> getHash ( 'md5' ) ; } return $ this -> md5 ; } | Returns the md5 checksum of the document |
49,356 | public static function buildFromPathfile ( $ pathfile , \ collection $ collection , Application $ app , $ originalName = null ) { try { $ media = $ app -> getMediaFromUri ( $ pathfile ) ; } catch ( FileNotFoundException $ e ) { throw new \ InvalidArgumentException ( sprintf ( 'Unable to build media file from non exista... | Build the File package object |
49,357 | public function get_duration ( ) { if ( ! $ this -> duration ) { $ duration = $ this -> get_technical_infos ( media_subdef :: TC_DATA_DURATION ) ; $ this -> duration = $ duration ? round ( $ duration -> getValue ( ) ) : false ; } return $ this -> duration ; } | Returns duration in seconds |
49,358 | public function getSubdfefByDeviceAndMime ( $ devices = null , $ mimes = null ) { $ subdefNames = $ subdefs = [ ] ; $ availableSubdefs = $ this -> get_subdefs ( ) ; if ( isset ( $ availableSubdefs [ 'document' ] ) ) { $ mime_ok = ! $ mimes || in_array ( $ availableSubdefs [ 'document' ] -> get_mime ( ) , ( array ) $ mi... | Returns an array of subdef matching |
49,359 | public function get_technical_infos ( $ data = '' ) { if ( null === $ this -> technical_data ) { $ sets = $ this -> app [ 'service.technical_data' ] -> fetchRecordsTechnicalData ( [ $ this ] ) ; $ this -> setTechnicalDataSet ( reset ( $ sets ) ) ; } if ( $ data ) { if ( isset ( $ this -> technical_data [ $ data ] ) ) {... | Return a Technical data set or a specific technical data or false when not found |
49,360 | public function getPositionFromTechnicalInfos ( ) { $ positionTechnicalField = [ media_subdef :: TC_DATA_LATITUDE , media_subdef :: TC_DATA_LONGITUDE ] ; $ position = [ ] ; foreach ( $ positionTechnicalField as $ field ) { $ fieldData = $ this -> get_technical_infos ( $ field ) ; if ( $ fieldData ) { $ position [ $ fie... | Return an array containing GPSPosition |
49,361 | public function insertTechnicalDatas ( MediaVorus $ mediavorus ) { try { $ document = $ this -> get_subdef ( 'document' ) ; } catch ( \ Exception_Media_SubdefNotFound $ e ) { return $ this ; } $ connection = $ this -> getDataboxConnection ( ) ; $ connection -> executeUpdate ( 'DELETE FROM technical_datas WHERE record_i... | Read technical datas an insert them This method can be long to perform |
49,362 | public static function get_record_by_uuid ( \ databox $ databox , $ uuid , $ record_id = null ) { $ records = $ databox -> getRecordRepository ( ) -> findByUuid ( $ uuid ) ; if ( ! is_null ( $ record_id ) ) { $ records = array_filter ( $ records , function ( record_adapter $ record ) use ( $ record_id ) { return $ reco... | Search for a record on a databox by UUID |
49,363 | public function getCollection ( Request $ request , $ bas_id ) { $ collection = \ collection :: getByBaseId ( $ this -> app , $ bas_id ) ; $ admins = [ ] ; if ( $ this -> getAclForUser ( ) -> has_right_on_base ( $ bas_id , \ ACL :: COLL_MANAGE ) ) { $ query = $ this -> createUserQuery ( ) ; $ admins = $ query -> on_bas... | Display collection information page |
49,364 | public function setOrderAdmins ( Request $ request , $ bas_id ) { $ admins = array_filter ( array_values ( $ request -> request -> get ( 'admins' , [ ] ) ) , function ( $ value ) { return $ value != false ; } ) ; if ( false && count ( $ admins ) === 0 ) { $ this -> app -> abort ( 400 , 'No admins provided.' ) ; } if ( ... | Set new admin to handle orders |
49,365 | public function emptyCollection ( Request $ request , $ bas_id ) { $ success = false ; $ msg = $ this -> app -> trans ( 'An error occurred' ) ; $ collection = \ collection :: getByBaseId ( $ this -> app , $ bas_id ) ; try { if ( $ collection -> get_record_amount ( ) <= 500 ) { $ collection -> empty_collection ( 500 ) ;... | Empty a collection |
49,366 | public function deleteStamp ( Request $ request , $ bas_id ) { $ success = false ; $ collection = \ collection :: getByBaseId ( $ this -> app , $ bas_id ) ; try { $ this -> app -> getApplicationBox ( ) -> write_collection_pic ( $ this -> app [ 'media-alchemyst' ] , $ this -> app [ 'filesystem' ] , $ collection , null ,... | Delete the collection stamp |
49,367 | public function setStamp ( Request $ request , $ bas_id ) { if ( null === $ file = $ request -> files -> get ( 'newStamp' ) ) { $ this -> app -> abort ( 400 ) ; } if ( $ file -> getClientSize ( ) > 1024 * 1024 ) { return $ this -> app -> redirectPath ( 'admin_display_collection' , [ 'bas_id' => $ bas_id , 'success' => ... | Set a collection stamp |
49,368 | public function delete ( Request $ request , $ bas_id ) { $ success = false ; $ msg = $ this -> app -> trans ( 'An error occured' ) ; $ collection = \ collection :: getByBaseId ( $ this -> app , $ bas_id ) ; try { if ( $ collection -> get_record_amount ( ) > 0 ) { $ msg = $ this -> app -> trans ( 'Empty the collection ... | Delete a Collection |
49,369 | public function unmount ( Request $ request , $ bas_id ) { $ success = false ; $ collection = \ collection :: getByBaseId ( $ this -> app , $ bas_id ) ; try { $ collection -> unmount ( ) ; $ success = true ; } catch ( \ Exception $ e ) { } if ( 'json' === $ request -> getRequestFormat ( ) ) { $ msg = $ success ? $ this... | Unmount a collection from application box |
49,370 | public function setPublicationDisplay ( Request $ request , $ bas_id ) { if ( null === $ watermark = $ request -> request -> get ( 'pub_wm' ) ) { $ this -> app -> abort ( 400 , 'Missing public watermark setting' ) ; } $ success = false ; $ collection = \ collection :: getByBaseId ( $ this -> app , $ bas_id ) ; try { $ ... | Set public presentation watermark |
49,371 | public function getSuggestedValues ( $ bas_id ) { $ databox = $ this -> app -> findDataboxById ( \ phrasea :: sbasFromBas ( $ this -> app , $ bas_id ) ) ; $ collection = \ collection :: getByBaseId ( $ this -> app , $ bas_id ) ; $ structFields = $ suggestedValues = $ basePrefs = [ ] ; foreach ( $ databox -> get_meta_st... | Display suggested values |
49,372 | public function submitSuggestedValues ( Request $ request , $ bas_id ) { $ success = false ; $ collection = \ collection :: getByBaseId ( $ this -> app , $ bas_id ) ; $ prefs = $ request -> request -> get ( 'str' ) ; try { if ( '' !== trim ( $ prefs ) ) { $ domdoc = new \ DOMDocument ( ) ; if ( true === @ $ domdoc -> l... | Register suggested values |
49,373 | private function load ( ) { if ( ! $ this -> loaded ) { $ this -> databoxes = $ this -> repository -> findAll ( ) ; $ this -> loaded = true ; } } | Initializes the memory cache if needed . |
49,374 | public function getModuleById ( $ moduleId ) { foreach ( $ this -> getModules ( ) as $ module ) { if ( $ module -> getModuleId ( ) == $ moduleId ) { return $ module ; } } return null ; } | Get a module by its identifier |
49,375 | public function isRegistrationEnabled ( ) { if ( false === $ xml = simplexml_load_string ( $ this -> get_prefs ( ) ) ) { return false ; } $ element = $ xml -> xpath ( '/baseprefs/caninscript' ) ; if ( count ( $ element ) === 0 ) { return $ this -> databox -> isRegistrationEnabled ( ) ; } foreach ( $ element as $ canins... | Tells whether registration is activated for provided collection or not . |
49,376 | public function getTermsOfUse ( ) { if ( false === $ xml = simplexml_load_string ( $ this -> get_prefs ( ) ) ) { return null ; } foreach ( $ xml -> xpath ( '/baseprefs/cgu' ) as $ sbpcgu ) { return $ sbpcgu -> saveXML ( ) ; } } | Gets terms of use . |
49,377 | public function setLocale ( $ locale ) { if ( $ locale && ! preg_match ( '/[a-z]{2,3}/' , $ locale ) ) { throw new \ InvalidArgumentException ( 'Locale must be a valid i18n code' ) ; } $ this -> i18n = $ locale ; return $ this ; } | Defines locale code to use for query |
49,378 | public function setSearchType ( $ search_type ) { switch ( $ search_type ) { case self :: RECORD_RECORD : default : $ this -> search_type = self :: RECORD_RECORD ; break ; case self :: RECORD_GROUPING : case self :: RECORD_STORY : $ this -> search_type = self :: RECORD_GROUPING ; break ; } return $ this ; } | Set document type to search for |
49,379 | public function update ( Manifest $ manifest ) { try { $ this -> fs -> mirror ( $ this -> pluginsDirectory . DIRECTORY_SEPARATOR . $ manifest -> getName ( ) . DIRECTORY_SEPARATOR . 'public' , $ this -> rootPath . DIRECTORY_SEPARATOR . 'www' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $ manifest -> getName... | Updates plugins assets so that they are available online . |
49,380 | public function remove ( $ name ) { try { $ this -> fs -> remove ( $ this -> rootPath . DIRECTORY_SEPARATOR . 'www' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $ name ) ; } catch ( IOException $ e ) { throw new RuntimeException ( sprintf ( 'Unable to remove assets for plugin %s' , $ name ) , $ e -> getCod... | Removes assets for the plugin named with the given name |
49,381 | public function findUserBasket ( $ basket_id , User $ user , $ requireOwner ) { $ dql = 'SELECT b FROM Phraseanet:Basket b LEFT JOIN b.elements e WHERE b.id = :basket_id' ; $ query = $ this -> _em -> createQuery ( $ dql ) ; $ query -> setParameters ( [ 'basket_id' => $ basket_id ] ) ; $... | Find a basket specified by his basket_id and his owner |
49,382 | public function saveTemporaryPref ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { $ this -> app -> abort ( 400 ) ; } $ prop = $ request -> request -> get ( 'prop' ) ; $ value = $ request -> request -> get ( 'value' ) ; $ success = false ; $ msg = $ this -> app -> trans ( 'Error while saving prefere... | Save temporary user preferences |
49,383 | public function saveUserPref ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { $ this -> app -> abort ( 400 ) ; } $ msg = $ this -> app -> trans ( 'Error while saving preference' ) ; $ prop = $ request -> request -> get ( 'prop' ) ; $ value = $ request -> request -> get ( 'value' ) ; $ success = fals... | Save user preferences |
49,384 | public static function fromListExtractor ( $ list , callable $ extractor , callable $ creator = null ) { Assertion :: isTraversable ( $ list ) ; $ references = [ ] ; if ( null === $ creator ) { $ creator = function ( $ data ) { return $ data ; } ; } foreach ( $ list as $ index => $ item ) { $ data = $ extractor ( $ ite... | Append all RecordReferences extracted via call to extractor on each element |
49,385 | public function isOwner ( User $ user ) { $ owner = $ this -> getOwner ( ) ; if ( $ owner !== null && $ user -> getId ( ) === $ owner -> getUser ( ) -> getId ( ) ) { return true ; } return false ; } | Returns a boolean indicating whether the given user is the owner of the feed . |
49,386 | public function getCollection ( Application $ app ) { if ( $ this -> getBaseId ( ) !== null ) { return \ collection :: getByBaseId ( $ app , $ this -> getBaseId ( ) ) ; } } | Returns the collection to which the feed belongs . |
49,387 | public function setCollection ( \ collection $ collection = null ) { if ( $ collection === null ) { $ this -> baseId = null ; return ; } $ this -> baseId = $ collection -> get_base_id ( ) ; } | Sets the collection . |
49,388 | public function getPublisher ( User $ user ) { foreach ( $ this -> getPublishers ( ) as $ publisher ) { if ( $ publisher -> getUser ( ) -> getId ( ) == $ user -> getId ( ) ) { return $ publisher ; } } return null ; } | Returns an instance of FeedPublisher matching to the given user . |
49,389 | public function hasAccess ( User $ user , Application $ app ) { if ( $ this -> getCollection ( $ app ) instanceof collection ) { return $ app -> getAclForUser ( $ user ) -> has_access_to_base ( $ this -> collection -> get_base_id ( ) ) ; } return true ; } | Returns a boolean indicating whether the given user has access to the feed . |
49,390 | public function create ( $ name , $ jobId , $ settings , $ period ) { $ task = new Task ( ) ; $ task -> setName ( $ name ) -> setJobId ( $ jobId ) -> setSettings ( $ settings ) -> setPeriod ( $ period ) ; $ this -> om -> persist ( $ task ) ; $ this -> om -> flush ( ) ; $ this -> notify ( NotifierInterface :: MESSAGE_CR... | Creates a Task . |
49,391 | public function createEmptyCollectionJob ( \ collection $ collection ) { $ job = new EmptyCollectionJob ( $ this -> translator ) ; $ settings = simplexml_load_string ( $ job -> getEditor ( ) -> getDefaultSettings ( ) ) ; $ settings -> bas_id = $ collection -> get_base_id ( ) ; $ task = new Task ( ) ; $ task -> setName ... | Creates a EmptyCollection task given a collection |
49,392 | public function update ( Task $ task ) { $ this -> om -> persist ( $ task ) ; $ this -> om -> flush ( ) ; $ this -> notify ( NotifierInterface :: MESSAGE_UPDATE ) ; return $ task ; } | Updates a Task in the manager . |
49,393 | public function start ( Task $ task ) { $ task -> setStatus ( Task :: STATUS_STARTED ) ; $ this -> om -> persist ( $ task ) ; $ this -> om -> flush ( ) ; $ this -> notify ( NotifierInterface :: MESSAGE_UPDATE ) ; return $ task ; } | Sets the task status to started . |
49,394 | public function stop ( Task $ task ) { $ task -> setStatus ( Task :: STATUS_STOPPED ) ; $ this -> om -> persist ( $ task ) ; $ this -> om -> flush ( ) ; $ this -> notify ( NotifierInterface :: MESSAGE_UPDATE ) ; return $ task ; } | Sets the task status to stopped . |
49,395 | public function resetCrashes ( Task $ task ) { $ task -> setCrashed ( 0 ) ; $ this -> om -> persist ( $ task ) ; $ this -> om -> flush ( ) ; $ this -> notify ( NotifierInterface :: MESSAGE_UPDATE ) ; return $ task ; } | Reset the number of crashes of the task . |
49,396 | public function runCLI ( $ interactive = false ) { $ this -> boot ( ) ; $ app = $ this [ 'console' ] ; if ( $ interactive ) { $ app = new Console \ Shell ( $ app ) ; } $ app -> run ( ) ; } | Executes this application . |
49,397 | public function displayOrders ( Request $ request ) { $ page = ( int ) $ request -> query -> get ( 'page' , 1 ) ; $ perPage = ( int ) $ request -> query -> get ( 'per-page' , 10 ) ; $ offsetStart = 0 ; $ todo = $ request -> query -> get ( 'todo' , Order :: STATUS_TODO ) ; $ start = $ request -> query -> get ( 'start' ,... | Display list of orders |
49,398 | public function sendOrder ( Request $ request , $ order_id ) { $ elementIds = $ request -> request -> get ( 'elements' , [ ] ) ; $ acceptor = $ this -> getAuthenticatedUser ( ) ; $ basketElements = $ this -> doAcceptElements ( $ order_id , $ elementIds , $ acceptor ) ; $ success = ! empty ( $ basketElements ) ; if ( 'j... | Send an order |
49,399 | public function denyOrder ( Request $ request , $ order_id ) { $ elementIds = $ request -> request -> get ( 'elements' , [ ] ) ; $ acceptor = $ this -> getAuthenticatedUser ( ) ; $ elements = $ this -> doDenyElements ( $ order_id , $ elementIds , $ acceptor ) ; $ success = ! empty ( $ elements ) ; if ( 'json' === $ req... | Deny an order |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.