|
|
|
@ -19,12 +19,12 @@ $idChecked = isset($_REQUEST['idChecked']) ? $_REQUEST['idChecked'] : null; |
|
|
|
$list_type = isset($_REQUEST['list_type']) ? $_REQUEST['list_type'] : 'simple'; |
|
|
|
$list_type = isset($_REQUEST['list_type']) ? $_REQUEST['list_type'] : 'simple'; |
|
|
|
|
|
|
|
|
|
|
|
if ($action == 'delete') { |
|
|
|
if ($action == 'delete') { |
|
|
|
SessionManager::delete($idChecked); |
|
|
|
SessionManager::delete($idChecked); |
|
|
|
Display::addFlash(Display::return_message(get_lang('Deleted'))); |
|
|
|
Display::addFlash(Display::return_message(get_lang('Deleted'))); |
|
|
|
header('Location: session_list.php'); |
|
|
|
header('Location: session_list.php'); |
|
|
|
exit(); |
|
|
|
exit(); |
|
|
|
} elseif ($action == 'copy') { |
|
|
|
} elseif ($action == 'copy') { |
|
|
|
SessionManager::copy($idChecked); |
|
|
|
SessionManager::copy($idChecked); |
|
|
|
Display::addFlash(Display::return_message(get_lang('ItemCopied'))); |
|
|
|
Display::addFlash(Display::return_message(get_lang('ItemCopied'))); |
|
|
|
header('Location: session_list.php'); |
|
|
|
header('Location: session_list.php'); |
|
|
|
exit(); |
|
|
|
exit(); |
|
|
|
@ -113,183 +113,183 @@ $extra_params['postData'] =array( |
|
|
|
//With this function we can add actions to the jgrid (edit, delete, etc) |
|
|
|
//With this function we can add actions to the jgrid (edit, delete, etc) |
|
|
|
$action_links = 'function action_formatter(cellvalue, options, rowObject) { |
|
|
|
$action_links = 'function action_formatter(cellvalue, options, rowObject) { |
|
|
|
return \'<a href="session_edit.php?page=resume_session.php&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'. |
|
|
|
return \'<a href="session_edit.php?page=resume_session.php&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'. |
|
|
|
' <a href="add_users_to_session.php?page=session_list.php&id_session=\'+options.rowId+\'">'.Display::return_icon('user_subscribe_session.png',get_lang('SubscribeUsersToSession'),'',ICON_SIZE_SMALL).'</a>'. |
|
|
|
' <a href="add_users_to_session.php?page=session_list.php&id_session=\'+options.rowId+\'">'.Display::return_icon('user_subscribe_session.png',get_lang('SubscribeUsersToSession'),'',ICON_SIZE_SMALL).'</a>'. |
|
|
|
' <a href="add_courses_to_session.php?page=session_list.php&id_session=\'+options.rowId+\'">'.Display::return_icon('courses_to_session.png',get_lang('SubscribeCoursesToSession'),'',ICON_SIZE_SMALL).'</a>'. |
|
|
|
' <a href="add_courses_to_session.php?page=session_list.php&id_session=\'+options.rowId+\'">'.Display::return_icon('courses_to_session.png',get_lang('SubscribeCoursesToSession'),'',ICON_SIZE_SMALL).'</a>'. |
|
|
|
' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="session_list.php?action=copy&idChecked=\'+options.rowId+\'">'.Display::return_icon('copy.png',get_lang('Copy'),'',ICON_SIZE_SMALL).'</a>'. |
|
|
|
' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="session_list.php?action=copy&idChecked=\'+options.rowId+\'">'.Display::return_icon('copy.png',get_lang('Copy'),'',ICON_SIZE_SMALL).'</a>'. |
|
|
|
' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="session_list.php?action=delete&idChecked=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'. |
|
|
|
' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="session_list.php?action=delete&idChecked=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'. |
|
|
|
'\'; |
|
|
|
'\'; |
|
|
|
}'; |
|
|
|
}'; |
|
|
|
|
|
|
|
|
|
|
|
$urlAjaxExtraField = api_get_path(WEB_AJAX_PATH).'extra_field.ajax.php?1=1'; |
|
|
|
$urlAjaxExtraField = api_get_path(WEB_AJAX_PATH).'extra_field.ajax.php?1=1'; |
|
|
|
|
|
|
|
|
|
|
|
?> |
|
|
|
?> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
function setSearchSelect(columnName) { |
|
|
|
function setSearchSelect(columnName) { |
|
|
|
$("#sessions").jqGrid('setColProp', columnName, { |
|
|
|
$("#sessions").jqGrid('setColProp', columnName, { |
|
|
|
/*searchoptions:{ |
|
|
|
/*searchoptions:{ |
|
|
|
dataInit:function(el){ |
|
|
|
dataInit:function(el){ |
|
|
|
$("option[value='1']",el).attr("selected", "selected"); |
|
|
|
$("option[value='1']",el).attr("selected", "selected"); |
|
|
|
setTimeout(function(){ |
|
|
|
setTimeout(function(){ |
|
|
|
$(el).trigger('change'); |
|
|
|
$(el).trigger('change'); |
|
|
|
}, 1000); |
|
|
|
}, 1000); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var added_cols = []; |
|
|
|
|
|
|
|
var original_cols = []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function clean_cols(grid, added_cols) { |
|
|
|
|
|
|
|
//Cleaning |
|
|
|
|
|
|
|
for (key in added_cols) { |
|
|
|
|
|
|
|
//console.log('hide: ' + key); |
|
|
|
|
|
|
|
grid.hideCol(key); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
grid.showCol('name'); |
|
|
|
|
|
|
|
grid.showCol('display_start_date'); |
|
|
|
|
|
|
|
grid.showCol('display_end_date'); |
|
|
|
|
|
|
|
grid.showCol('course_title'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function show_cols(grid, added_cols) { |
|
|
|
|
|
|
|
grid.showCol('name').trigger('reloadGrid'); |
|
|
|
|
|
|
|
for (key in added_cols) { |
|
|
|
|
|
|
|
//console.log('show: ' + key); |
|
|
|
|
|
|
|
grid.showCol(key); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var second_filters = []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(function() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
date_pick_today = function(elem) { |
|
|
|
|
|
|
|
$(elem).datetimepicker({dateFormat: "yy-mm-dd"}); |
|
|
|
|
|
|
|
$(elem).datetimepicker('setDate', (new Date())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
date_pick_one_month = function(elem) { |
|
|
|
|
|
|
|
$(elem).datetimepicker({dateFormat: "yy-mm-dd"}); |
|
|
|
|
|
|
|
next_month = Date.today().next().month(); |
|
|
|
|
|
|
|
$(elem).datetimepicker('setDate', next_month); |
|
|
|
} |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var added_cols = []; |
|
|
|
|
|
|
|
var original_cols = []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function clean_cols(grid, added_cols) { |
|
|
|
|
|
|
|
//Cleaning |
|
|
|
|
|
|
|
for (key in added_cols) { |
|
|
|
|
|
|
|
//console.log('hide: ' + key); |
|
|
|
|
|
|
|
grid.hideCol(key); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
grid.showCol('name'); |
|
|
|
|
|
|
|
grid.showCol('display_start_date'); |
|
|
|
|
|
|
|
grid.showCol('display_end_date'); |
|
|
|
|
|
|
|
grid.showCol('course_title'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function show_cols(grid, added_cols) { |
|
|
|
|
|
|
|
grid.showCol('name').trigger('reloadGrid'); |
|
|
|
|
|
|
|
for (key in added_cols) { |
|
|
|
|
|
|
|
//console.log('show: ' + key); |
|
|
|
|
|
|
|
grid.showCol(key); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var second_filters = []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(function() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
date_pick_today = function(elem) { |
|
|
|
|
|
|
|
$(elem).datetimepicker({dateFormat: "yy-mm-dd"}); |
|
|
|
|
|
|
|
$(elem).datetimepicker('setDate', (new Date())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
date_pick_one_month = function(elem) { |
|
|
|
|
|
|
|
$(elem).datetimepicker({dateFormat: "yy-mm-dd"}); |
|
|
|
|
|
|
|
next_month = Date.today().next().month(); |
|
|
|
|
|
|
|
$(elem).datetimepicker('setDate', next_month); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Great hack |
|
|
|
//Great hack |
|
|
|
register_second_select = function(elem) { |
|
|
|
register_second_select = function(elem) { |
|
|
|
second_filters[$(elem).val()] = $(elem); |
|
|
|
second_filters[$(elem).val()] = $(elem); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fill_second_select = function(elem) { |
|
|
|
fill_second_select = function(elem) { |
|
|
|
$(elem).on("change", function() { |
|
|
|
$(elem).on("change", function() { |
|
|
|
composed_id = $(this).val(); |
|
|
|
composed_id = $(this).val(); |
|
|
|
field_id = composed_id.split("#")[0]; |
|
|
|
field_id = composed_id.split("#")[0]; |
|
|
|
id = composed_id.split("#")[1]; |
|
|
|
id = composed_id.split("#")[1]; |
|
|
|
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
url: "<?php echo $urlAjaxExtraField; ?>&a=get_second_select_options",
|
|
|
|
url: "<?php echo $urlAjaxExtraField; ?>&a=get_second_select_options",
|
|
|
|
dataType: "json", |
|
|
|
dataType: "json", |
|
|
|
data: "type=session&field_id="+field_id+"&option_value_id="+id, |
|
|
|
data: "type=session&field_id="+field_id+"&option_value_id="+id, |
|
|
|
success: function(data) { |
|
|
|
success: function(data) { |
|
|
|
my_select = second_filters[field_id]; |
|
|
|
my_select = second_filters[field_id]; |
|
|
|
my_select.empty(); |
|
|
|
my_select.empty(); |
|
|
|
$.each(data, function(index, value) { |
|
|
|
$.each(data, function(index, value) { |
|
|
|
my_select.append($("<option/>", { |
|
|
|
my_select.append($("<option/>", { |
|
|
|
value: index, |
|
|
|
value: index, |
|
|
|
text: value |
|
|
|
text: value |
|
|
|
})); |
|
|
|
})); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php |
|
|
|
|
|
|
|
echo Display::grid_js('sessions', $url, $columns, $column_model, $extra_params, array(), $action_links, true); |
|
|
|
|
|
|
|
?> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setSearchSelect("status"); |
|
|
|
<?php |
|
|
|
|
|
|
|
echo Display::grid_js('sessions', $url, $columns, $column_model, $extra_params, array(), $action_links, true); |
|
|
|
var grid = $("#sessions"), |
|
|
|
?> |
|
|
|
prmSearch = { |
|
|
|
|
|
|
|
multipleSearch : true, |
|
|
|
setSearchSelect("status"); |
|
|
|
overlay : false, |
|
|
|
|
|
|
|
width: 'auto', |
|
|
|
var grid = $("#sessions"), |
|
|
|
caption: '<?php echo addslashes(get_lang('Search')); ?>',
|
|
|
|
prmSearch = { |
|
|
|
formclass:'data_table', |
|
|
|
multipleSearch : true, |
|
|
|
onSearch : function() { |
|
|
|
overlay : false, |
|
|
|
var postdata = grid.jqGrid('getGridParam', 'postData'); |
|
|
|
width: 'auto', |
|
|
|
|
|
|
|
caption: '<?php echo addslashes(get_lang('Search')); ?>',
|
|
|
|
if (postdata && postdata.filters) { |
|
|
|
formclass:'data_table', |
|
|
|
filters = jQuery.parseJSON(postdata.filters); |
|
|
|
onSearch : function() { |
|
|
|
clean_cols(grid, added_cols); |
|
|
|
var postdata = grid.jqGrid('getGridParam', 'postData'); |
|
|
|
added_cols = []; |
|
|
|
|
|
|
|
$.each(filters, function(key, value){ |
|
|
|
if (postdata && postdata.filters) { |
|
|
|
//console.log('key: ' + key ); |
|
|
|
filters = jQuery.parseJSON(postdata.filters); |
|
|
|
if (key == 'rules') { |
|
|
|
clean_cols(grid, added_cols); |
|
|
|
$.each(value, function(subkey, subvalue) { |
|
|
|
added_cols = []; |
|
|
|
if (subvalue.data == undefined) { |
|
|
|
$.each(filters, function(key, value){ |
|
|
|
|
|
|
|
//console.log('key: ' + key ); |
|
|
|
|
|
|
|
if (key == 'rules') { |
|
|
|
|
|
|
|
$.each(value, function(subkey, subvalue) { |
|
|
|
|
|
|
|
if (subvalue.data == undefined) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (added_cols[value.field] == undefined) { |
|
|
|
|
|
|
|
added_cols[subvalue.field] = subvalue.field; |
|
|
|
|
|
|
|
//} |
|
|
|
|
|
|
|
//grid.showCol(value.field); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//if (added_cols[value.field] == undefined) { |
|
|
|
|
|
|
|
added_cols[subvalue.field] = subvalue.field; |
|
|
|
|
|
|
|
//} |
|
|
|
|
|
|
|
//grid.showCol(value.field); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
show_cols(grid, added_cols); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
show_cols(grid, added_cols); |
|
|
|
onReset: function() { |
|
|
|
} |
|
|
|
clean_cols(grid, added_cols); |
|
|
|
}, |
|
|
|
} |
|
|
|
onReset: function() { |
|
|
|
}; |
|
|
|
clean_cols(grid, added_cols); |
|
|
|
|
|
|
|
} |
|
|
|
original_cols = grid.jqGrid('getGridParam', 'colModel'); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
grid.jqGrid('navGrid','#sessions_pager', |
|
|
|
original_cols = grid.jqGrid('getGridParam', 'colModel'); |
|
|
|
{edit:false,add:false,del:false}, |
|
|
|
|
|
|
|
{height:280,reloadAfterSubmit:false}, // edit options |
|
|
|
grid.jqGrid('navGrid','#sessions_pager', |
|
|
|
{height:280,reloadAfterSubmit:false}, // add options |
|
|
|
{edit:false,add:false,del:false}, |
|
|
|
{reloadAfterSubmit:false},// del options |
|
|
|
{height:280,reloadAfterSubmit:false}, // edit options |
|
|
|
prmSearch |
|
|
|
{height:280,reloadAfterSubmit:false}, // add options |
|
|
|
); |
|
|
|
{reloadAfterSubmit:false},// del options |
|
|
|
|
|
|
|
prmSearch |
|
|
|
// Create the searching dialog. |
|
|
|
); |
|
|
|
grid.searchGrid(prmSearch); |
|
|
|
|
|
|
|
|
|
|
|
// Create the searching dialog. |
|
|
|
// Fixes search table. |
|
|
|
grid.searchGrid(prmSearch); |
|
|
|
var searchDialogAll = $("#fbox_"+grid[0].id); |
|
|
|
|
|
|
|
searchDialogAll.addClass("table"); |
|
|
|
// Fixes search table. |
|
|
|
var searchDialog = $("#searchmodfbox_"+grid[0].id); |
|
|
|
var searchDialogAll = $("#fbox_"+grid[0].id); |
|
|
|
searchDialog.addClass("ui-jqgrid ui-widget ui-widget-content ui-corner-all"); |
|
|
|
searchDialogAll.addClass("table"); |
|
|
|
searchDialog.css({position:"relative", "z-index":"auto", "float":"left"}) |
|
|
|
var searchDialog = $("#searchmodfbox_"+grid[0].id); |
|
|
|
var gbox = $("#gbox_"+grid[0].id); |
|
|
|
searchDialog.addClass("ui-jqgrid ui-widget ui-widget-content ui-corner-all"); |
|
|
|
gbox.before(searchDialog); |
|
|
|
searchDialog.css({position:"relative", "z-index":"auto", "float":"left"}) |
|
|
|
gbox.css({clear:"left"}); |
|
|
|
var gbox = $("#gbox_"+grid[0].id); |
|
|
|
|
|
|
|
gbox.before(searchDialog); |
|
|
|
//Select first elements by default |
|
|
|
gbox.css({clear:"left"}); |
|
|
|
$('.input-elm').each(function(){ |
|
|
|
|
|
|
|
|
|
|
|
//Select first elements by default |
|
|
|
|
|
|
|
$('.input-elm').each(function(){ |
|
|
|
|
|
|
|
$(this).find('option:first').attr('selected', 'selected'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('.delete-rule').each(function(){ |
|
|
|
|
|
|
|
$(this).click(function(){ |
|
|
|
|
|
|
|
$('.input-elm').each(function(){ |
|
|
|
|
|
|
|
$(this).find('option:first').attr('selected', 'selected'); |
|
|
|
$(this).find('option:first').attr('selected', 'selected'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
$('.delete-rule').each(function(){ |
|
|
|
$('.delete-rule').on('click', function(){ |
|
|
|
$(this).click(function(){ |
|
|
|
console.log('deleted'); |
|
|
|
$('.input-elm').each(function(){ |
|
|
|
$('.input-elm').each(function(){ |
|
|
|
$(this).find('option:first').attr('selected', 'selected'); |
|
|
|
$(this).find('option:first').attr('selected', 'selected'); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
$('.delete-rule').on('click', function(){ |
|
|
|
|
|
|
|
console.log('deleted'); |
|
|
|
|
|
|
|
$('.input-elm').each(function(){ |
|
|
|
|
|
|
|
$(this).find('option:first').attr('selected', 'selected'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
});*/ |
|
|
|
}); |
|
|
|
}); |
|
|
|
});*/ |
|
|
|
</script> |
|
|
|
}); |
|
|
|
<div class="actions"> |
|
|
|
</script> |
|
|
|
|
|
|
|
<div class="actions"> |
|
|
|
|
|
|
|
<?php |
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
|
|
echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/session_add.php">'. |
|
|
|
echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/session_add.php">'. |
|
|
|
|