Mukautetut toiminnot
Tavallisten CRUD-operaatioiden lisäksi Chamilossa on lukuisia mukautettuja API-toimintokontrollereita (kymmeniä), jotka käsittelevät erikoistuneita operaatioita. Tarkka määrä vaihtelee julkaisujen välillä — luettele src/CoreBundle/Controller/Api/ nähdäksesi nykyisen joukon.
Sijainti
Mukautetut toiminnot sijaitsevat polussa src/CoreBundle/Controller/Api/.
Huomionarvoiset mukautetut toiminnot
Dokumentit
CreateDocumentFileAction
Upload a file or create a folder/link document
UpdateDocumentFileAction
Replace a document's file
ReplaceDocumentFileAction
Replace a document file, preserving its IDs
MoveDocumentAction
Move a document to a different folder
UpdateVisibilityDocument
Toggle document visibility for learners
DownloadAllDocumentsAction
Download all documents in a folder as a ZIP
DownloadSelectedDocumentsAction
Download a selected set of documents as a ZIP
DocumentUsageAction
List courses/sessions where a document is used
DocumentLearningPathUsageAction
List learning paths where a document is used
Sanasto
CreateCGlossaryAction
Create a glossary term
UpdateCGlossaryAction
Update a glossary term
ExportCGlossaryAction
Export glossary to file
ImportCGlossaryAction
Import glossary from file
ExportGlossaryToDocumentsAction
Export glossary as a document in the course
GetGlossaryCollectionController
Get glossary collection with custom filtering
Linkit
CreateCLinkAction
Create an external link
UpdateCLinkAction
Update an external link
CreateCLinkCategoryAction
Create a link category
UpdateCLinkCategoryAction
Update a link category
CheckCLinkAction
Check whether a link URL is reachable
ExportCLinksAction
Export links to file
CLinkDetailsController
Get link details
CLinkImageController
Get or set a link's preview image
GetLinksCollectionController
Get links collection with custom filtering
UpdateVisibilityLink
Toggle link visibility
UpdateVisibilityLinkCategory
Toggle link category visibility
UpdatePositionLink
Reorder links
Oppimispolut
CreateCLpAction
Create a learning path
LpReorderController
Reorder learning path items
Kalenteri
UpdateCCalendarEventAction
Update a course calendar event
CalendarMyStudentsScheduleAction
Get the schedule of a teacher's students
Blogi
CreateCBlogAction
Create a blog post
CreateBlogAttachmentAction
Attach a file to a blog post
UpdateVisibilityBlog
Toggle blog visibility
Dropbox
CreateDropboxFileAction
Upload a file to the dropbox (file exchange tool)
Opiskelijatyöt (tehtävät)
CreateStudentPublicationFileAction
Submit an assignment file
CreateStudentPublicationCommentAction
Add a comment to a submission
CreateStudentPublicationCorrectionFileAction
Upload a correction file for a submission
Henkilökohtaiset tiedostot
CreatePersonalFileAction
Upload a file to the user's personal file space
UpdatePersonalFileAction
Update a personal file
Sosiaalinen
LikeSocialPostController
Like a social post
DislikeSocialPostController
Unlike a social post
CreateSocialPostAttachmentAction
Attach a file to a social post
SocialPostAttachmentsController
List attachments on a social post
AbstractFeedbackSocialPostController
Base class for social post feedback actions
Istunnot
CreateSessionWithUsersAndCoursesAction
Create a session and enrol users and courses in one call
Käyttäjät ja käyttö-URL:t
CreateUserOnAccessUrlAction
Create a user and associate them with an access URL
UserAccessUrlsController
List access URLs a user belongs to
UserSkillsController
List skills awarded to a user
Videoneuvottelu
VideoConferenceCallbackController
Handle callbacks from external video conference providers
Perusluokat
BaseResourceFileAction
Base class for file-upload actions; handles multipart parsing, resource node creation, and storage
Mukautetun toiminnon toteuttaminen
Mukautetut toiminnot ovat tavallisia Symfony-kontrolleria, joihin viitataan API Platformin operaatiomäärityksissä. #[ApiResource]-attribuutti sijaitsee entiteetissä, ja kunkin operaation controller:-parametri osoittaa toimintoluokkaan:
Itse toimintoluokka on tavallinen kutsuttava kontrolleri — palvelut injektoidaan __invoke()-metodin argumenttien kautta:
Keskeiset seikat:
deserialize: falseasetetaan, kun toiminto lukee pyynnön suoraan (esim. moniosaiset tiedostolähetykset) sen sijaan, että API Platform deserialisoisi JSON-rungon.Tiedostonlähetystoiminnot periytyvät tyypillisesti luokasta
BaseResourceFileAction, joka hoitaa moniosaisen jäsennnyksen ja resurssisolmun kytkennän.Tietoturva toteutetaan operaation
security:-parametrilla, ei kontrollerin sisällä.
Päivitetty viimeksi
Oliko tästä apua?