-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The start of support for the mobile app
- Loading branch information
1 parent
f875a5b
commit ff93785
Showing
4 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Mobile output class for qtype_aitext | ||
* | ||
* @package qtype_aitext | ||
* @copyright 2018 Marcus Green | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace qtype_aitext\output; | ||
|
||
/** | ||
* Mobile output class for aitext question type | ||
* | ||
* @package qtype_aitext | ||
* @copyright 2018 Marcus Green | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class mobile { | ||
|
||
/** | ||
* Returns the aite question type for the quiz in the mobile app. | ||
* @param array $args | ||
* @return array | ||
*/ | ||
public static function mobile_get_aitext($args) { | ||
global $CFG; | ||
$args = (object) $args; | ||
$folder = $args->appversioncode >= 3950 ? 'latest' : 'ionic3'; | ||
$templatepath = $CFG->dirroot."/question/type/aitext/mobile/$folder/addon-qtype-aitext.html"; | ||
return [ | ||
'templates' => [ | ||
[ | ||
'id' => 'main', | ||
'html' => file_get_contents($templatepath) | ||
] | ||
], | ||
'javascript' => file_get_contents($CFG->dirroot . '/question/type/aitext/mobile/mobile.js') | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Mobile app areas for AI Text | ||
* | ||
* Documentation: {@link https://moodledev.io/general/app/development/plugins-development-guide} | ||
* | ||
* @package qtype_aitext | ||
* @copyright 2024 Marcus Green | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
$addons = [ | ||
"qtype_aitext" => [ | ||
"handlers" => [ // Different places where the add-on will display content. | ||
'aitext' => [ // Handler unique name (can be anything). | ||
'displaydata' => [ | ||
'title' => 'AIText question', | ||
'icon' => '/question/type/aitext/pix/icon.gif', | ||
'class' => '', | ||
], | ||
'delegate' => 'CoreQuestionDelegate', // Delegate (where to display the link to the add-on). | ||
'method' => 'mobile_get_aitext', | ||
'offlinefunctions' => [ | ||
'mobile_get_aitext' => [], // Function in classes/output/mobile.php. | ||
], // Function needs caching for offline. | ||
'styles' => [ | ||
'url' => $CFG->wwwroot.'/question/type/aitext/mobile/styles_app.css', | ||
'version' => '0.1' | ||
] | ||
] | ||
], | ||
'lang' => [ | ||
['pluginname', 'qtype_aitext'], // Matching value in lang/en/qtype_gapfill. | ||
], | ||
] | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<section class="list qtype-aitext-container qtype_aitext" ion-list *ngIf="question.text || question.text === ''"> | ||
<ion-item><p> | ||
<core-format-text [component]="component" [componentId]="componentId" | ||
[text]="question.text"></core-format-text> | ||
</p></ion-item> | ||
<ion-item> | ||
<core-format-text [component]="component" [componentId]="componentId" | ||
[text]="question.textarea"></core-format-text> | ||
</ion-item> | ||
<ion-item> | ||
<core-format-text [component]="component" [componentId]="componentId" | ||
[text]="question.itemcount" (afterRender)="questionRendered()"></core-format-text> | ||
</ion-item> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.qtype-aitext .countwords { | ||
margin-top: 0.5rem; /* mt-2 */ | ||
margin-bottom: 0; | ||
} | ||
.qtype-aitext .minwords, | ||
.qtype-aitext .minwords { | ||
margin-top: 0; | ||
margin-bottom: 0; | ||
} |