Actualización
This commit is contained in:
75
plugin/h5p/inc/action.switch.php
Normal file
75
plugin/h5p/inc/action.switch.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
/* For license terms, see /license.txt */
|
||||
|
||||
$varString = api_get_self();
|
||||
$varUrlList = str_replace("node_process.php", "list.php", $varString);
|
||||
$varUrlProcess = str_replace("list.php", "node_process.php", $varString);
|
||||
|
||||
switch ($action) {
|
||||
case 'add':
|
||||
if ($form->validate()) {
|
||||
$values = $form->getSubmitValues();
|
||||
$date = new DateTime();
|
||||
$year = $date->format("Y");
|
||||
$month = $date->format('m');
|
||||
$day = $date->format('j');
|
||||
$dateStr = $day.'/'.$month.'/'.$year;
|
||||
$params = [
|
||||
'title' => $values['title'],
|
||||
'creation_date' => $dateStr,
|
||||
'user_id' => $userId,
|
||||
'node_type' => $values['node_type'],
|
||||
'terms_a' => $values['terms_a'],
|
||||
'terms_b' => $values['terms_b'],
|
||||
'terms_c' => $values['terms_c'],
|
||||
'terms_d' => $values['terms_d'],
|
||||
'terms_e' => $values['terms_e'],
|
||||
'terms_f' => $values['terms_f'],
|
||||
'descript' => $values['descript'],
|
||||
'url_id' => $urlId,
|
||||
];
|
||||
$result = Database::insert($table, $params);
|
||||
|
||||
$objectId = 0;
|
||||
if (!$result) {
|
||||
} else {
|
||||
Display::addFlash(Display::return_message(get_lang('Added')));
|
||||
$objectId = Database::insert_id();
|
||||
}
|
||||
|
||||
$varUrlProcess = $varUrlProcess.'?id='.$objectId.'&action=add';
|
||||
header('Location: '.$varUrlProcess);
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
case 'edit':
|
||||
$form->setDefaults($term);
|
||||
if ($form->validate()) {
|
||||
$values = $form->getSubmitValues();
|
||||
$params = [
|
||||
'title' => $values['title'],
|
||||
'terms_a' => $values['terms_a'],
|
||||
'terms_b' => $values['terms_b'],
|
||||
'terms_c' => $values['terms_c'],
|
||||
'terms_d' => $values['terms_d'],
|
||||
'terms_e' => $values['terms_e'],
|
||||
'terms_f' => $values['terms_f'],
|
||||
'descript' => $values['descript'],
|
||||
];
|
||||
Database::update($table, $params, ['id = ?' => $id]);
|
||||
Display::addFlash(Display::return_message(get_lang('Updated')));
|
||||
$varUrlProcess = $varUrlProcess.'?id='.$id.'&action=edit';
|
||||
header('Location: '.$varUrlProcess);
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
if (!empty($term)) {
|
||||
Database::delete($table, ['id = ?' => $id]);
|
||||
Display::addFlash(Display::return_message(get_lang('Deleted')));
|
||||
header('Location: '.$varUrlList);
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
}
|
||||
97
plugin/h5p/inc/edit.form.php
Normal file
97
plugin/h5p/inc/edit.form.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/* For license terms, see /license.txt */
|
||||
|
||||
$form = new FormValidator('dictionary', 'post', api_get_self().'?action='.$action.'&id='.$id);
|
||||
|
||||
$tableOfnodes = '';
|
||||
if ($nodeType == '') {
|
||||
$tableOfnodes = "<table id='nodeselection' class='styleOfPages' ";
|
||||
$tableOfnodes .= " style='max-width:840px;width:98%;";
|
||||
$tableOfnodes .= "margin-left:auto;margin-right:auto;margin-bottom:2%;' >";
|
||||
|
||||
$tableOfnodes .= "<tr><td colspan=6 style='text-align:center;padding-bottom:10px;padding-top:10px;border:solid 1px gray;' colspan=3 >";
|
||||
$tableOfnodes .= $plugin->get_lang('TypeContent')."</td></tr>";
|
||||
|
||||
$tableOfnodes .= "<tr style='width:98%;background-color:#D8D8D8;padding-top:10px;border-bottom:solid 2px white;' >";
|
||||
|
||||
$tableOfnodes .= "<td style='text-align:center;padding:5px;' >";
|
||||
$tableOfnodes .= "<img class=toolimage src='resources/img/wordsmatch.png' /></td>";
|
||||
$tableOfnodes .= "<td style='text-align:center;width:20%;' >Find the words</td>";
|
||||
$tableOfnodes .= "<td style='text-align:center;width:20%;'>";
|
||||
$tableOfnodes .= "<a href='list.php?node_type=wordsmatch' class='btn btn-primary' >";
|
||||
$tableOfnodes .= "<em class='fa'></em> ".$plugin->get_lang('Use')." </a>";
|
||||
$tableOfnodes .= "</td>";
|
||||
|
||||
$tableOfnodes .= "<td style='text-align:center;padding:5px;' >";
|
||||
$tableOfnodes .= "<img class=toolimage src='resources/img/dragthewords.png' /></td>";
|
||||
$tableOfnodes .= "<td style='text-align:center;width:20%;' >Drag the words</td>";
|
||||
$tableOfnodes .= "<td style='text-align:center;width:20%;'>";
|
||||
$tableOfnodes .= "<a href='list.php?node_type=dragthewords' class='btn btn-primary' >";
|
||||
$tableOfnodes .= "<em class='fa'></em> ".$plugin->get_lang('Use')." </a>";
|
||||
$tableOfnodes .= "</td>";
|
||||
|
||||
$tableOfnodes .= "</tr>";
|
||||
|
||||
$tableOfnodes .= "<tr style='width:98%;background-color:#D8D8D8;padding-top:10px;border-bottom:solid 2px white;' >";
|
||||
|
||||
$tableOfnodes .= "<td style='text-align:center;padding:5px;' >";
|
||||
$tableOfnodes .= "<img class=toolimage src='resources/img/dialogcard.png' /></td>";
|
||||
$tableOfnodes .= "<td style='text-align:center;' >Dialog card</td>";
|
||||
$tableOfnodes .= "<td style='text-align:center;' >";
|
||||
$tableOfnodes .= "<a href='list.php?node_type=dialogcard' class='btn btn-primary' >";
|
||||
$tableOfnodes .= "<em class='fa'></em> ".$plugin->get_lang('Use')." </a>";
|
||||
$tableOfnodes .= "</td>";
|
||||
|
||||
$tableOfnodes .= "<td style='text-align:center;padding:5px;' >";
|
||||
$tableOfnodes .= "<img class=toolimage src='resources/img/memory.png' /></td>";
|
||||
$tableOfnodes .= "<td style='text-align:center;' >Memory</td>";
|
||||
$tableOfnodes .= "<td style='text-align:center;' >";
|
||||
$tableOfnodes .= "<a href='list.php?node_type=memory' class='btn btn-primary' >";
|
||||
$tableOfnodes .= "<em class='fa'></em> ".$plugin->get_lang('Use')." </a>";
|
||||
$tableOfnodes .= "</td>";
|
||||
|
||||
$tableOfnodes .= "</tr>";
|
||||
|
||||
$tableOfnodes .= "<tr style='width:98%;background-color:#D8D8D8;";
|
||||
$tableOfnodes .= "padding-top:10px;border-bottom:solid 2px white;' >";
|
||||
|
||||
$tableOfnodes .= "<td style='text-align:center;padding:5px;' >";
|
||||
$tableOfnodes .= "<img class=toolimage src='resources/img/markthewords.png' /></td>";
|
||||
$tableOfnodes .= "<td style='text-align:center;' >Mark the words</td>";
|
||||
$tableOfnodes .= "<td style='text-align:center;' >";
|
||||
$tableOfnodes .= "<a href='list.php?node_type=markthewords' class='btn btn-primary' >";
|
||||
$tableOfnodes .= "<em class='fa'></em> ".$plugin->get_lang('Use')." </a>";
|
||||
$tableOfnodes .= "</td>";
|
||||
|
||||
$tableOfnodes .= "<td style='text-align:center;padding:5px;' >";
|
||||
$tableOfnodes .= "<img class=toolimage src='resources/img/guesstheanswer.png' /></td>";
|
||||
$tableOfnodes .= "<td style='text-align:center;' >Guess the answer</td>";
|
||||
$tableOfnodes .= "<td style='text-align:center;' >";
|
||||
$tableOfnodes .= "<a href='list.php?node_type=guesstheanswer' class='btn btn-primary' >";
|
||||
$tableOfnodes .= "<em class='fa'></em> ".$plugin->get_lang('Use')." </a>";
|
||||
$tableOfnodes .= "</td>";
|
||||
$tableOfnodes .= "</tr>";
|
||||
$tableOfnodes .= "</table>";
|
||||
}
|
||||
|
||||
// Use $tds defined in translate.php
|
||||
$html = $translations.'<link href="resources/css/H5P.css" rel="stylesheet" type="text/css" />';
|
||||
|
||||
$form->addText('title', get_lang('Title'), false);
|
||||
|
||||
$form->addText('descript', get_lang('Description'), false);
|
||||
|
||||
$nodeTypeForm = $form->addText('node_type', 'node_type', false);
|
||||
$nodeTypeForm->setValue($nodeType);
|
||||
|
||||
$form->addText('terms_a', 'terms_a', false);
|
||||
$form->addText('terms_b', 'terms_b', false);
|
||||
$form->addText('terms_c', 'terms_c', false);
|
||||
$form->addText('terms_d', 'terms_d', false);
|
||||
$form->addText('terms_e', 'terms_e', false);
|
||||
$form->addText('terms_f', 'terms_f', false);
|
||||
|
||||
$form->addElement('static', '', '', $html);
|
||||
|
||||
$form->addButtonSave(get_lang('Save'));
|
||||
34
plugin/h5p/inc/translate.php
Normal file
34
plugin/h5p/inc/translate.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
$translations = '<div id="h5p_title_help" style="display:none;" >'.$plugin->get_lang('h5p_title_help').'</div>';
|
||||
$translations .= '<div id="h5p_descr_help" style="display:none;" >'.$plugin->get_lang('h5p_descr_help').'</div>';
|
||||
$translations .= '<div id="h5p_cancel" style="display:none;" >'.get_lang('Cancel').'</div>';
|
||||
|
||||
$translations .= '<div id="h5p_wordsmatch_help" style="display:none;" >'.$plugin->get_lang('h5p_wordsmatch_help').'</div>';
|
||||
$translations .= '<div id="h5p_wordsmatch_load" style="display:none;" >'.$plugin->get_lang('h5p_wordsmatch_load').'</div>';
|
||||
$translations .= '<div id="h5p_wordsmatch_tutor" style="display:none;" >'.$plugin->get_lang('h5p_wordsmatch_tutor').'</div>';
|
||||
$translations .= '<div id="h5p_wordsmatch_term_a" style="display:none;" >'.$plugin->get_lang('h5p_wordsmatch_term_a').'</div>';
|
||||
|
||||
$translations .= '<div id="h5p_dragthewords_help" style="display:none;" >'.$plugin->get_lang('h5p_dragthewords_help').'</div>';
|
||||
$translations .= '<div id="h5p_dragthewords_load" style="display:none;" >'.$plugin->get_lang('h5p_dragthewords_load').'</div>';
|
||||
$translations .= '<div id="h5p_dragthewords_tutor" style="display:none;" >'.$plugin->get_lang('h5p_dragthewords_tutor').'</div>';
|
||||
$translations .= '<div id="h5p_dragthewords_term_a" style="display:none;" >'.$plugin->get_lang('h5p_dragthewords_term_a').'</div>';
|
||||
|
||||
$translations .= '<div id="h5p_dialogcard_help" style="display:none;" >'.$plugin->get_lang('h5p_dialogcard_help').'</div>';
|
||||
$translations .= '<div id="h5p_dialogcard_load" style="display:none;" >'.$plugin->get_lang('h5p_dialogcard_load').'</div>';
|
||||
$translations .= '<div id="h5p_dialogcard_tutor" style="display:none;" >'.$plugin->get_lang('h5p_dialogcard_tutor').'</div>';
|
||||
$translations .= '<div id="h5p_dialogcard_term_a" style="display:none;" >'.$plugin->get_lang('h5p_dialogcard_term_a').'</div>';
|
||||
|
||||
$translations .= '<div id="h5p_markthewords_help" style="display:none;" >'.$plugin->get_lang('h5p_markthewords_help').'</div>';
|
||||
$translations .= '<div id="h5p_markthewords_load" style="display:none;" >'.$plugin->get_lang('h5p_markthewords_load').'</div>';
|
||||
$translations .= '<div id="h5p_markthewords_tutor" style="display:none;" >'.$plugin->get_lang('h5p_markthewords_tutor').'</div>';
|
||||
$translations .= '<div id="h5p_markthewords_term_a" style="display:none;" >'.$plugin->get_lang('h5p_markthewords_term_a').'</div>';
|
||||
|
||||
$translations .= '<div id="h5p_guesstheanswer_help" style="display:none;" >'.$plugin->get_lang('h5p_guesstheanswer_help').'</div>';
|
||||
$translations .= '<div id="h5p_guesstheanswer_load" style="display:none;" >'.$plugin->get_lang('h5p_guesstheanswer_load').'</div>';
|
||||
$translations .= '<div id="h5p_guesstheanswer_tutor" style="display:none;" >'.$plugin->get_lang('h5p_guesstheanswer_tutor').'</div>';
|
||||
$translations .= '<div id="h5p_guesstheanswer_term_a" style="display:none;" >'.$plugin->get_lang('h5p_guesstheanswer_term_a').'</div>';
|
||||
$translations .= '<div id="h5p_guesstheanswer_term_b" style="display:none;" >'.$plugin->get_lang('h5p_guesstheanswer_term_b').'</div>';
|
||||
$translations .= '<div id="h5p_guesstheanswer_term_c" style="display:none;" >'.$plugin->get_lang('h5p_guesstheanswer_term_c').'</div>';
|
||||
Reference in New Issue
Block a user