upgrade
This commit is contained in:
1152
plugin/learning_calendar/LearningCalendarPlugin.php
Normal file
1152
plugin/learning_calendar/LearningCalendarPlugin.php
Normal file
File diff suppressed because it is too large
Load Diff
2
plugin/learning_calendar/README.md
Normal file
2
plugin/learning_calendar/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
## Learning calendar
|
||||
|
||||
43
plugin/learning_calendar/ajax.php
Normal file
43
plugin/learning_calendar/ajax.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/* For license terms, see /license.txt */
|
||||
|
||||
require_once __DIR__.'/../../main/inc/global.inc.php';
|
||||
|
||||
$action = isset($_REQUEST['a']) ? $_REQUEST['a'] : '';
|
||||
$calendarId = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0;
|
||||
|
||||
$plugin = LearningCalendarPlugin::create();
|
||||
$item = $plugin->getCalendar($calendarId);
|
||||
$plugin->protectCalendar($item);
|
||||
|
||||
switch ($action) {
|
||||
case 'toggle_day':
|
||||
$startDate = isset($_REQUEST['start_date']) ? $_REQUEST['start_date'] : '';
|
||||
if (empty($startDate)) {
|
||||
exit;
|
||||
}
|
||||
$endDate = isset($_REQUEST['end_date']) ? $_REQUEST['end_date'] : '';
|
||||
if ($startDate == $endDate) {
|
||||
// One day
|
||||
$plugin->toogleDayType($calendarId, $startDate);
|
||||
} else {
|
||||
// A list of days
|
||||
$startDateTime = new DateTime($startDate);
|
||||
$endDateTime = new DateTime($endDate);
|
||||
$diff = $startDateTime->diff($endDateTime);
|
||||
$countDays = $diff->format('%a');
|
||||
$dayList[] = $startDate;
|
||||
for ($i = 0; $i < $countDays; $i++) {
|
||||
$startDateTime->modify('+1 day');
|
||||
$dayList[] = $startDateTime->format('Y-m-d');
|
||||
}
|
||||
foreach ($dayList as $day) {
|
||||
$plugin->toogleDayType($calendarId, $day);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'get_events':
|
||||
$list = $plugin->getEvents($calendarId);
|
||||
echo json_encode($list);
|
||||
break;
|
||||
}
|
||||
50
plugin/learning_calendar/calendar.php
Normal file
50
plugin/learning_calendar/calendar.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/* For license terms, see /license.txt */
|
||||
|
||||
require_once __DIR__.'/../../main/inc/global.inc.php';
|
||||
|
||||
$calendarId = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
|
||||
$plugin = LearningCalendarPlugin::create();
|
||||
$item = $plugin->getCalendar($calendarId);
|
||||
$plugin->protectCalendar($item);
|
||||
|
||||
$isoCode = api_get_language_isocode();
|
||||
$htmlHeadXtra[] = api_get_asset('bootstrap-year-calendar/js/bootstrap-year-calendar.js');
|
||||
$calendarLanguage = 'en';
|
||||
if ($isoCode !== 'en') {
|
||||
$file = 'bootstrap-year-calendar/js/languages/bootstrap-year-calendar.'.$isoCode.'.js';
|
||||
$path = api_get_path(SYS_PUBLIC_PATH).'assets/'.$file;
|
||||
if (file_exists($path)) {
|
||||
$htmlHeadXtra[] = api_get_asset($file);
|
||||
$calendarLanguage = $isoCode;
|
||||
}
|
||||
}
|
||||
|
||||
$htmlHeadXtra[] = api_get_css_asset('bootstrap-year-calendar/css/bootstrap-year-calendar.css');
|
||||
|
||||
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
|
||||
$formToString = '';
|
||||
|
||||
$template = new Template();
|
||||
$actionLeft = Display::url(
|
||||
Display::return_icon(
|
||||
'back.png',
|
||||
get_lang('Add'),
|
||||
null,
|
||||
ICON_SIZE_MEDIUM
|
||||
),
|
||||
api_get_path(WEB_PLUGIN_PATH).'learning_calendar/start.php'
|
||||
);
|
||||
|
||||
$actions = Display::toolbarAction('toolbar-forum', [$actionLeft]);
|
||||
|
||||
$eventList = $plugin->getEventTypeList();
|
||||
$template->assign('events', $eventList);
|
||||
$template->assign('calendar_language', $calendarLanguage);
|
||||
$template->assign('ajax_url', api_get_path(WEB_PLUGIN_PATH).'learning_calendar/ajax.php?id='.$calendarId);
|
||||
$template->assign('header', $item['title']);
|
||||
$content = $template->fetch('learning_calendar/view/calendar.tpl');
|
||||
$template->assign('actions', $actions);
|
||||
$template->assign('content', $content);
|
||||
|
||||
$template->display_one_col_template();
|
||||
108
plugin/learning_calendar/calendar_users.php
Normal file
108
plugin/learning_calendar/calendar_users.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/* For license terms, see /license.txt */
|
||||
|
||||
require_once __DIR__.'/../../main/inc/global.inc.php';
|
||||
|
||||
$calendarId = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
|
||||
$plugin = LearningCalendarPlugin::create();
|
||||
$plugin->protectCalendar($calendarId);
|
||||
$item = $plugin->getCalendar($calendarId);
|
||||
|
||||
if (empty($item)) {
|
||||
api_not_allowed(true);
|
||||
}
|
||||
|
||||
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
|
||||
$formToString = '';
|
||||
$template = new Template();
|
||||
$actionLeft = Display::url(
|
||||
Display::return_icon(
|
||||
'back.png',
|
||||
get_lang('Add'),
|
||||
null,
|
||||
ICON_SIZE_MEDIUM
|
||||
),
|
||||
api_get_path(WEB_PLUGIN_PATH).'learning_calendar/start.php'
|
||||
);
|
||||
|
||||
$actions = Display::toolbarAction('toolbar-forum', [$actionLeft]);
|
||||
|
||||
// jqgrid will use this URL to do the selects
|
||||
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_calendar_users&id='.$calendarId;
|
||||
|
||||
// The order is important you need to check the the $column variable in the model.ajax.php file
|
||||
$columns = [
|
||||
get_lang('FirstName'),
|
||||
get_lang('LastName'),
|
||||
get_lang('Exam'),
|
||||
];
|
||||
|
||||
// Column config
|
||||
$column_model = [
|
||||
['name' => 'firstname', 'index' => 'firstname', 'width' => '35', 'align' => 'left', 'sortable' => 'false'],
|
||||
['name' => 'lastname', 'index' => 'lastname', 'width' => '35', 'align' => 'left', 'sortable' => 'false'],
|
||||
[
|
||||
'name' => 'exam',
|
||||
'index' => 'exam',
|
||||
'width' => '20',
|
||||
'align' => 'center',
|
||||
'sortable' => 'false',
|
||||
],
|
||||
];
|
||||
|
||||
// Autowidth
|
||||
$extraParams['autowidth'] = 'true';
|
||||
// height auto
|
||||
$extraParams['height'] = 'auto';
|
||||
$extraParams['sortname'] = 'name';
|
||||
$extraParams['sortorder'] = 'desc';
|
||||
$extraParams['multiselect'] = true;
|
||||
|
||||
$deleteIcon = Display::return_icon('delete.png', get_lang('Delete'), null, ICON_SIZE_SMALL);
|
||||
$urlStats = api_get_path(WEB_CODE_PATH);
|
||||
$action_links = '';
|
||||
$deleteUrl = '';
|
||||
|
||||
// Add the JS needed to use the jqgrid
|
||||
$htmlHeadXtra[] = api_get_jqgrid_js();
|
||||
|
||||
Display::display_header();
|
||||
|
||||
?>
|
||||
<script>
|
||||
$(function() {
|
||||
<?php
|
||||
// grid definition see the $usergroup>display() function
|
||||
echo Display::grid_js(
|
||||
'usergroups',
|
||||
$url,
|
||||
$columns,
|
||||
$column_model,
|
||||
$extraParams,
|
||||
[],
|
||||
$action_links,
|
||||
true
|
||||
);
|
||||
?>
|
||||
$("#usergroups").jqGrid(
|
||||
"navGrid",
|
||||
"#usergroups_pager",
|
||||
{ edit: false, add: false, del: true, search: false},
|
||||
{ height:280, reloadAfterSubmit:false }, // edit options
|
||||
{ height:280, reloadAfterSubmit:false }, // add options
|
||||
{ reloadAfterSubmit:false, url: "<?php echo $deleteUrl; ?>" }, // del options
|
||||
{ width:500 } // search options
|
||||
);
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
|
||||
// action links
|
||||
echo '<div class="actions">';
|
||||
echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/usergroup_users.php?id='.$calendarId.'">'.
|
||||
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'), '', '32').
|
||||
'</a>';
|
||||
echo '</div>';
|
||||
echo Display::grid_html('usergroups');
|
||||
|
||||
Display::display_footer();
|
||||
8
plugin/learning_calendar/install.php
Normal file
8
plugin/learning_calendar/install.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/* For license terms, see /license.txt */
|
||||
|
||||
if (!api_is_platform_admin()) {
|
||||
exit('You must have admin permissions to install plugins');
|
||||
}
|
||||
|
||||
LearningCalendarPlugin::create()->install();
|
||||
22
plugin/learning_calendar/lang/english.php
Normal file
22
plugin/learning_calendar/lang/english.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/* For license terms, see /license.txt */
|
||||
|
||||
$strings['plugin_title'] = 'Learning calendar';
|
||||
$strings['plugin_comment'] = 'Advanced plugin allowing for the coaching of students with an overall time period to conclude their studies in alternated studies and work.';
|
||||
$strings['enabled'] = 'Enabled';
|
||||
$strings['LearningCalendar'] = 'Learning calendar';
|
||||
$strings['NumberDaysAccumulatedInCalendar'] = 'Number of days accumulated in the calendar: ';
|
||||
$strings['NumberDaysAccumulatedInLp'] = 'Number of days accumulated in the LP: ';
|
||||
$strings['NumberDaysInRetard'] = 'Number of days in retard: ';
|
||||
$strings['DifferenceOfDaysAndCalendar'] = 'Difference of days with the calendar plan';
|
||||
|
||||
$strings['EventTypeTaken'] = 'Busy';
|
||||
$strings['EventTypeExam'] = 'Exam';
|
||||
$strings['EventTypeFree'] = 'Free';
|
||||
$strings['CourseHoursDuration'] = 'Course hours duration';
|
||||
$strings['LearningCalendarOneDayMarker'] = 'Learning calendar one day marker';
|
||||
$strings['ControlPointAdded'] = 'Control point added';
|
||||
$strings['NumberOfDays'] = 'Number of days';
|
||||
$strings['Date'] = 'Date';
|
||||
$strings['AddMultipleUsersToCalendar'] = 'Add multiple users to a calendar';
|
||||
$strings['UpdateCalendar'] = 'Update calendar';
|
||||
22
plugin/learning_calendar/lang/french.php
Normal file
22
plugin/learning_calendar/lang/french.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/* For license terms, see /license.txt */
|
||||
|
||||
$strings['plugin_title'] = 'Learning calendar';
|
||||
$strings['plugin_comment'] = "Plugin avancé permettant le coaching d'étudiants qui ont un délai limité pour la conclusion de leurs études en mode études et travail alternés.";
|
||||
$strings['enabled'] = 'Enabled';
|
||||
$strings['LearningCalendar'] = 'Calendrier d\'apprentissage';
|
||||
$strings['NumberDaysAccumulatedInCalendar'] = 'Nombre de jours cumulés dans le calendrier: ';
|
||||
$strings['NumberDaysAccumulatedInLp'] = 'Nombre de jours cumulés dans les parcours réalisés: ';
|
||||
$strings['NumberDaysInRetard'] = "Nombre de jour de retard ou d'avance à la date d'aujourd'hui: ";
|
||||
$strings['DifferenceOfDaysAndCalendar'] = 'Différence de nombre de jours avec le plan issu du learning_calendar';
|
||||
|
||||
$strings['EventTypeTaken'] = 'Occupé';
|
||||
$strings['EventTypeExam'] = 'Examen';
|
||||
$strings['EventTypeFree'] = 'Libre';
|
||||
$strings['CourseHoursDuration'] = 'Durée du cours (h)';
|
||||
$strings['LearningCalendarOneDayMarker'] = 'Marqueur 1 jour calendrier';
|
||||
$strings['ControlPointAdded'] = 'Point de contrôle ajouté';
|
||||
$strings['NumberOfDays'] = 'Nombre de jours';
|
||||
$strings['Date'] = 'Date';
|
||||
$strings['AddMultipleUsersToCalendar'] = 'Ajouter plusieurs utilisateurs au calendrier';
|
||||
$strings['UpdateCalendar'] = 'Mettre à jour calendrier';
|
||||
22
plugin/learning_calendar/lang/spanish.php
Normal file
22
plugin/learning_calendar/lang/spanish.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/* For license terms, see /license.txt */
|
||||
|
||||
$strings['plugin_title'] = 'Learning calendar';
|
||||
$strings['plugin_comment'] = 'Plugin avanzado permitiendo el tutorado de alumnos que tienen un plazo específico para terminar sus estudios en estudios alternados.';
|
||||
$strings['enabled'] = 'Activado';
|
||||
$strings['LearningCalendar'] = 'Calendario de aprendizaje';
|
||||
$strings['NumberDaysAccumulatedInCalendar'] = 'Número de días acumulados en el calendario: ';
|
||||
$strings['NumberDaysAccumulatedInLp'] = 'Número de días acumulados en la lección: ';
|
||||
$strings['NumberDaysInRetard'] = 'Número de días de retraso: ';
|
||||
$strings['DifferenceOfDaysAndCalendar'] = 'Diferencia entre días y plan del calendario';
|
||||
|
||||
$strings['EventTypeTaken'] = 'Ocupado';
|
||||
$strings['EventTypeExam'] = 'Examen';
|
||||
$strings['EventTypeFree'] = 'Libre';
|
||||
$strings['CourseHoursDuration'] = 'Duración del curso (h)';
|
||||
$strings['LearningCalendarOneDayMarker'] = 'Marcador 1 día del calendario de aprendizaje';
|
||||
$strings['ControlPointAdded'] = 'Puntos de control añadidos';
|
||||
$strings['NumberOfDays'] = 'Número de días';
|
||||
$strings['Date'] = 'Fecha';
|
||||
$strings['AddMultipleUsersToCalendar'] = 'Añadir usuarios múltiples a un calendario';
|
||||
$strings['UpdateCalendar'] = 'Actualizar calendario';
|
||||
4
plugin/learning_calendar/plugin.php
Normal file
4
plugin/learning_calendar/plugin.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
/* For license terms, see /license.txt */
|
||||
|
||||
$plugin_info = LearningCalendarPlugin::create()->get_info();
|
||||
191
plugin/learning_calendar/start.php
Normal file
191
plugin/learning_calendar/start.php
Normal file
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
/* For license terms, see /license.txt */
|
||||
|
||||
require_once __DIR__.'/../../main/inc/global.inc.php';
|
||||
|
||||
$allow = api_is_platform_admin() || api_is_teacher();
|
||||
|
||||
if (!$allow) {
|
||||
api_not_allowed(true);
|
||||
}
|
||||
|
||||
$plugin = LearningCalendarPlugin::create();
|
||||
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
|
||||
$calendarId = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
|
||||
$formToString = '';
|
||||
|
||||
switch ($action) {
|
||||
case 'add':
|
||||
$form = new FormValidator('calendar', 'post', api_get_self().'?action=add');
|
||||
$plugin->getForm($form);
|
||||
$form->addButtonSave(get_lang('Save'));
|
||||
$formToString = $form->returnForm();
|
||||
|
||||
if ($form->validate()) {
|
||||
$values = $form->getSubmitValues();
|
||||
$params = [
|
||||
'title' => $values['title'],
|
||||
'total_hours' => $values['total_hours'],
|
||||
'minutes_per_day' => $values['minutes_per_day'],
|
||||
'description' => $values['description'],
|
||||
'author_id' => api_get_user_id(),
|
||||
];
|
||||
Database::insert('learning_calendar', $params);
|
||||
Display::addFlash(Display::return_message(get_lang('Saved')));
|
||||
header('Location: start.php');
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
case 'edit':
|
||||
$form = new FormValidator('calendar', 'post', api_get_self().'?action=edit&id='.$calendarId);
|
||||
$plugin->getForm($form);
|
||||
$form->addButtonSave(get_lang('Update'));
|
||||
$item = $plugin->getCalendar($calendarId);
|
||||
$plugin->protectCalendar($item);
|
||||
|
||||
if (empty($item)) {
|
||||
api_not_allowed(true);
|
||||
}
|
||||
|
||||
$form->setDefaults($item);
|
||||
$formToString = $form->returnForm();
|
||||
|
||||
if ($form->validate()) {
|
||||
$values = $form->getSubmitValues();
|
||||
$params = [
|
||||
'title' => $values['title'],
|
||||
'total_hours' => $values['total_hours'],
|
||||
'minutes_per_day' => $values['minutes_per_day'],
|
||||
'description' => $values['description'],
|
||||
];
|
||||
Database::update('learning_calendar', $params, ['id = ?' => $calendarId]);
|
||||
Display::addFlash(Display::return_message(get_lang('Updated')));
|
||||
header('Location: start.php');
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
case 'copy':
|
||||
$result = $plugin->copyCalendar($calendarId);
|
||||
if ($result) {
|
||||
Display::addFlash(Display::return_message(get_lang('Saved')));
|
||||
}
|
||||
header('Location: start.php');
|
||||
exit;
|
||||
|
||||
break;
|
||||
case 'delete':
|
||||
$result = $plugin->deleteCalendar($calendarId);
|
||||
if ($result) {
|
||||
Display::addFlash(Display::return_message(get_lang('Deleted')));
|
||||
}
|
||||
header('Location: start.php');
|
||||
exit;
|
||||
break;
|
||||
case 'toggle_visibility':
|
||||
$itemId = isset($_REQUEST['lp_item_id']) ? $_REQUEST['lp_item_id'] : 0;
|
||||
$lpId = isset($_REQUEST['lp_id']) ? $_REQUEST['lp_id'] : 0;
|
||||
$plugin->toggleVisibility($itemId);
|
||||
Display::addFlash(Display::return_message(get_lang('Updated')));
|
||||
$url = api_get_path(WEB_CODE_PATH).
|
||||
'lp/lp_controller.php?action=add_item&type=step&lp_id='.$lpId.'&'.api_get_cidreq();
|
||||
header("Location: $url");
|
||||
exit;
|
||||
break;
|
||||
}
|
||||
|
||||
$htmlHeadXtra[] = api_get_jqgrid_js();
|
||||
|
||||
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_learning_path_calendars';
|
||||
$columns = [
|
||||
get_lang('Title'),
|
||||
get_lang('TotalHours'),
|
||||
get_lang('MinutesPerDay'),
|
||||
get_lang('Actions'),
|
||||
];
|
||||
|
||||
$columnModel = [
|
||||
[
|
||||
'name' => 'title',
|
||||
'index' => 'title',
|
||||
'width' => '300',
|
||||
'align' => 'left',
|
||||
'sortable' => 'false',
|
||||
],
|
||||
[
|
||||
'name' => 'total_hours',
|
||||
'index' => 'total_hours',
|
||||
'width' => '100',
|
||||
'align' => 'left',
|
||||
'sortable' => 'false',
|
||||
],
|
||||
[
|
||||
'name' => 'minutes_per_day',
|
||||
'index' => 'minutes_per_day',
|
||||
'width' => '100',
|
||||
'align' => 'left',
|
||||
'sortable' => 'false',
|
||||
],
|
||||
[
|
||||
'name' => 'actions',
|
||||
'index' => 'actions',
|
||||
'width' => '150',
|
||||
'align' => 'left',
|
||||
//'formatter' => 'action_formatter',
|
||||
'sortable' => 'false',
|
||||
],
|
||||
];
|
||||
|
||||
$extraParams = [];
|
||||
$extraParams['autowidth'] = 'true';
|
||||
// height auto
|
||||
$extraParams['height'] = 'auto';
|
||||
|
||||
$template = new Template();
|
||||
|
||||
if (in_array($action, ['add', 'edit'])) {
|
||||
$actionLeft = Display::url(
|
||||
Display::return_icon(
|
||||
'back.png',
|
||||
get_lang('Back'),
|
||||
null,
|
||||
ICON_SIZE_MEDIUM
|
||||
),
|
||||
api_get_self().'?'.api_get_cidreq()
|
||||
);
|
||||
} else {
|
||||
$actionLeft = Display::url(
|
||||
Display::return_icon(
|
||||
'add.png',
|
||||
get_lang('Add'),
|
||||
null,
|
||||
ICON_SIZE_MEDIUM
|
||||
),
|
||||
api_get_self().'?'.api_get_cidreq().'&action=add'
|
||||
);
|
||||
|
||||
$content = '<script>
|
||||
$(function() {'.
|
||||
Display::grid_js(
|
||||
'calendars',
|
||||
$url,
|
||||
$columns,
|
||||
$columnModel,
|
||||
$extraParams,
|
||||
[],
|
||||
'',
|
||||
true
|
||||
).'
|
||||
});
|
||||
</script>';
|
||||
|
||||
$content .= Display::grid_html('calendars');
|
||||
$template->assign('grid', $content);
|
||||
}
|
||||
|
||||
$template->assign('form', $formToString);
|
||||
$actions = Display::toolbarAction('toolbar-calendar', [$actionLeft]);
|
||||
$content = $template->fetch('learning_calendar/view/start.tpl');
|
||||
$template->assign('content', $content);
|
||||
$template->assign('actions', $actions);
|
||||
|
||||
$template->display_one_col_template();
|
||||
4
plugin/learning_calendar/uninstall.php
Normal file
4
plugin/learning_calendar/uninstall.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
/* For license terms, see /license.txt */
|
||||
|
||||
LearningCalendarPlugin::create()->uninstall();
|
||||
104
plugin/learning_calendar/view/calendar.tpl
Normal file
104
plugin/learning_calendar/view/calendar.tpl
Normal file
@@ -0,0 +1,104 @@
|
||||
<script>
|
||||
function getEvents(e) {
|
||||
var myData = [];
|
||||
$.ajax({
|
||||
dataType: "json",
|
||||
url: "{{ ajax_url }}&a=get_events",
|
||||
success: function(response) {
|
||||
for (var i = 0; i < response.length; i++) {
|
||||
var startDate = moment(response[i].start_date + " 13:00:00").toDate();
|
||||
var endDate = moment(response[i].end_date + " 13:00:00").toDate();
|
||||
myData.push({
|
||||
id: response[i].id,
|
||||
title: response[i].title,
|
||||
startDate: startDate,
|
||||
endDate: endDate,
|
||||
color: response[i].color
|
||||
});
|
||||
}
|
||||
$(e.target).data('calendar').setDataSource(myData);
|
||||
}
|
||||
});
|
||||
}
|
||||
$(document).ready(function() {
|
||||
$('#calendar').calendar({
|
||||
style:'background',
|
||||
language : '{{ calendar_language }}',
|
||||
enableRangeSelection: true,
|
||||
enableContextMenu: true,
|
||||
/*contextMenuItems:[
|
||||
{
|
||||
text: 'Update',
|
||||
//click: editEvent
|
||||
},
|
||||
{
|
||||
text: 'Delete',
|
||||
click: deleteEvent
|
||||
}
|
||||
],*/
|
||||
customDayRenderer: function(e) {
|
||||
$(e).parent().css('background-color', 'green');
|
||||
},
|
||||
{#clickDay: function(e) {#}
|
||||
{#var dateString = moment(e.date).format("YYYY-MM-DD");#}
|
||||
{#$.ajax({#}
|
||||
{#type: "GET",#}
|
||||
{#url: "{{ ajax_url }}&a=toggle_day&start_date="+dateString+"&end_date=",#}
|
||||
{#success: function(returnValue) {#}
|
||||
{#getEvents(e);#}
|
||||
{#}#}
|
||||
{#});#}
|
||||
{#},#}
|
||||
selectRange: function(e) {
|
||||
var startString = moment(e.startDate).format("YYYY-MM-DD");
|
||||
var endString = moment(e.endDate).format("YYYY-MM-DD");
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "{{ ajax_url }}&a=toggle_day&start_date="+startString+"&end_date=" + endString,
|
||||
success: function(returnValue) {
|
||||
getEvents(e);
|
||||
}
|
||||
});
|
||||
},
|
||||
yearChanged: function(e) {
|
||||
e.preventRendering = true;
|
||||
$(e.target).append('<div style="text-align:center"><i class="fa fa-spinner fa-spin fa-2x"></i></div>');
|
||||
getEvents(e);
|
||||
},
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#calendar {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.calendar table.month tr td .day-content {
|
||||
height: 24px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-12">
|
||||
<div id="calendar"></div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<br />
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-12">
|
||||
<table>
|
||||
{% for event in events %}
|
||||
<tr>
|
||||
<td>
|
||||
{{ event.name }}:
|
||||
</td>
|
||||
<td>
|
||||
<span style="display:block;height:20px;width:100px; background-color: {{ event.color }}"></span>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
3
plugin/learning_calendar/view/start.tpl
Normal file
3
plugin/learning_calendar/view/start.tpl
Normal file
@@ -0,0 +1,3 @@
|
||||
{{ form }}
|
||||
|
||||
{{ grid }}
|
||||
Reference in New Issue
Block a user