Skip to content

MelisCmsMcq

Back-office MCQ (multiple-choice questionnaire / quiz) builder for the Melis CMS. Package melisplatform/melis-cms-mcq.

Purpose

MelisCmsMcq is the UI half of the MCQ system. It provides the backoffice workbench where you author questions (with answers, type, difficulty, category and tags), organise them into question categories and MCQ groups, and assemble MCQs (tests) either by hand via a per-user basket or automatically via a random model. It has no data layer of its own: all persistence (tables, services, scoring, XML snapshots and front-office rendering) is delegated to the companion module MelisCmsMcqEngine.

Enable it

Add to config/melis.module.load.php:

php
return [
    'MelisCmsMcq',
];

Requires melisplatform/melis-cms-mcq-engine (^5.3) and laminas/laminas-paginator. Also requires MelisCms, MelisCore (backoffice) and MelisCmsTags (question tagging) to be loaded. Install chain: MelisCmsMcqmelis-cms-mcq-enginemelis-cms + melis-cms-tags.

Key services

MelisCmsMcq itself registers no services — its controllers resolve aliases from MelisCmsMcqEngine at runtime:

Engine service aliasUsed by this module for
MelisCmsMcqQuestionsServiceQuestions CRUD, basket list (getQuestionsBasketList), random selection (getRandomQuestionIds)
MelisCmsMcqAnswersServiceAnswers CRUD (question editor)
MelisCmsMcqQuestionCategoryServiceQuestion categories CRUD
MelisCmsMcqGroupsServiceMCQ groups CRUD
MelisCmsMcqServiceMCQ CRUD, XML generation (generateMcqXml), fetch (getMcq), scoring (evaluateAnswers)

Form-element factories also come from the engine: McqQuestionCategoriesSelect, McqQuestionsDifficultySelect, QuestionsTypesSelect, McqPreviewTemplatesSelect.

Backoffice

Accessible via Left menu → MelisCms → MCQ (fa fa-list). The tool exposes four tabs and a Questions Favorites header button (a per-user bookmarked question shortlist).

TabWhat it manages
MCQFilterable DataTable of assembled tests (#tableMcq/MelisCmsMcq/getMcqList): id, status, code, name, creation date, total groups, total questions
QuestionsDataTable of questions (#tableMcqQuestions/McqQuestions/getQuestionsList): id, status, question text, answer count, type, difficulty, category, tags — with category/type/status/difficulty/tags/search filters; bookmark action adds to basket
Question CategoriesDataTable (#tableMcqQuestionCategories/McqQuestions/getQuestionCategoriesList): id, status, code, category name — add/edit modal (Status, Code, Name per language)
MCQ GroupsDataTable (#tableMcqGroups/MelisCmsMcq/getMcqGroupsList): id, status, code, group name — add/edit modal

MCQ editor

Opening an MCQ entry shows a three-tab editor:

Editor tabContent
PropertiesName, code, status, Minimum score required (%) (passing rate), Change questions order at every MCQ creation toggle
QuestionsAdd/remove MCQ groups; populate each group by dragging questions from the Questions Favorites or Search Questions side panels; Configure a random MCQ button opens the Random Model modal
PreviewPick a rendering template, take the assembled test, then submit to see the Correction panel (score, pass/fail, per-question user answer vs correct answer)

The Random Model modal (meliscmsmcq_mcq_page_random_model_modal) lets you define per-group criteria rows: Difficulty / Category / Tag / Number. Saving calls the engine's getRandomQuestionIds to resolve the matching question IDs.

Question editor

Opening a question shows a two-tab editor:

Editor tabContent
PropertiesCode, Type (MCQ / Open Ended), Category, Tags, Difficulty, Status; per language: Question text, Note for candidate
AnswersList of answers each with text, a Correct Answer (Yes/No) flag, a code, a status; drag the ✛ handle to reorder; Add an answer button

Front office

MelisCmsMcq has no front-office output of its own. The quiz renderer is a view helper (renderMcqQuestions) registered in MelisCmsMcqEngine; the Preview tab uses it via the engine. See the MelisCmsMcqEngine reference for front-office rendering details.

Database tables

All tables are owned by MelisCmsMcqEngine. The BO surfaces in this module map to them as follows:

Engine tableBO surface that writes to it
melis_cms_mcq_questions + _transQuestions tab + question editor
melis_cms_mcq_answers + _transAnswers editor (inside question editor)
melis_cms_mcq_question_groups + _transQuestion Categories tab (note: "question groups" in the DB, "categories" in the UI)
melis_cms_mcq_groups + _transMCQ Groups tab (tied to an MCQ via mcqg_mcq_id)
melis_cms_mcq + _transMCQ tab; assembled test stored as XML in mcq_xml
melis_cms_mcq_questions_listQuestion-to-MCQ-group membership
melis_cms_mcq_basketsQuestions Favorites per user

Naming caution. The UI's "Question categories" map to melis_cms_mcq_question_groups; the UI's "MCQ groups" map to melis_cms_mcq_groups. Two separate "group" tables with different purposes — see the MelisCmsMcqEngine doc.

Tags integration

config/app.interface.php registers a MelisCmsTags association so that questions are taggable:

php
'melis_cms_tag' => ['datas' => ['associations' => [
    'meliscmsmcq' => [
        'module'           => 'MelisCmsMcq',
        'entity_type'      => 'MCQ_QUESTION',
        'entity_table'     => 'melis_cms_mcq_questions',
        'entity_primary_id'=> 'mcqq_id',
        'trans' => [
            'trans_table'      => 'melis_cms_mcq_questions_trans',
            'trans_foreign_id' => 'mcqqt_question_id',
            'trans_lang_key'   => 'mcqqt_lang_id',
        ],
        'association_title_key' => 'mcqqt_question_text',
    ],
]]],

Association type is MCQ_QUESTION. The Questions DataTable shows a tags column and a tags filter driven by this registration.

Key files

ConcernPath
Routes + controller registrationsvendor/melisplatform/melis-cms-mcq/config/module.config.php
Backoffice tool tree, tabs, editor pages, modals, Tags associationvendor/melisplatform/melis-cms-mcq/config/app.interface.php
DataTable configurations (4 tables)vendor/melisplatform/melis-cms-mcq/config/app.tools.php
MCQ + groups + random model + preview controllervendor/melisplatform/melis-cms-mcq/src/Controller/MelisCmsMcqController.php
Questions + categories + basket controllervendor/melisplatform/melis-cms-mcq/src/Controller/McqQuestionsController.php
Flash-messenger listenervendor/melisplatform/melis-cms-mcq/src/Listener/MelisCmsMcqFlashMessengerListener.php
Views (question editor, MCQ editor, basket, random model, preview)vendor/melisplatform/melis-cms-mcq/view/melis-cms-mcq/
JS (questions, MCQ, groups, categories, preview, multi-select)vendor/melisplatform/melis-cms-mcq/public/js/

See also: melis-cms-mcq-engine, melis-cms-tags, melis-cms, melis-core