|
@@ -11,14 +11,14 @@ api_protect_admin_script(true);
|
|
|
|
|
|
//Add the JS needed to use the jqgrid
|
|
|
$htmlHeadXtra[] = api_get_jqgrid_js();
|
|
|
+
|
|
|
$htmlHeadXtra[] = api_get_js('json-js/json2.js');
|
|
|
$htmlHeadXtra[] = api_get_js('date/date.js');
|
|
|
|
|
|
$htmlHeadXtra = api_get_datetime_picker_js($htmlHeadXtra);
|
|
|
|
|
|
-$action = $_REQUEST['action'];
|
|
|
-$idChecked = $_REQUEST['idChecked'];
|
|
|
-
|
|
|
+$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
|
|
|
+$idChecked = isset($_REQUEST['idChecked']) ? $_REQUEST['idChecked'] : null;
|
|
|
$list_type = isset($_REQUEST['list_type']) ? $_REQUEST['list_type'] : 'simple';
|
|
|
|
|
|
if ($action == 'delete') {
|
|
@@ -50,13 +50,13 @@ $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_sessions&list_type='.$l
|
|
|
|
|
|
if (isset($_REQUEST['keyword'])) {
|
|
|
//Begin with see the searchOper param
|
|
|
- $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_sessions&_search=true&rows=20&page=1&sidx=&sord=asc&filters=&searchField=name&searchString='.Security::remove_XSS($_REQUEST['keyword']).'&searchOper=bw';
|
|
|
+ $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_sessions&_search=true&rows=20&page=1&sidx=&sord=asc&filters=&searchField=name&searchString='.Security::remove_XSS($_REQUEST['keyword']).'&searchOper=bw';
|
|
|
}
|
|
|
|
|
|
-//Autowidth
|
|
|
+//Autowidth
|
|
|
$extra_params['autowidth'] = 'true';
|
|
|
-//Height auto
|
|
|
-$extra_params['height'] = '100%';
|
|
|
+//Height auto
|
|
|
+$extra_params['height'] = '100%';
|
|
|
|
|
|
$extra_params['rowList'] = array(20, 50, 100, 250, 500);
|
|
|
|
|
@@ -65,15 +65,15 @@ $columns = $result['columns'];
|
|
|
$column_model = $result['column_model'];
|
|
|
|
|
|
$extra_params['postData'] =array (
|
|
|
- 'filters' => array(
|
|
|
- "groupOp" => "AND",
|
|
|
- "rules" => $result['rules'],
|
|
|
+ 'filters' => array(
|
|
|
+ "groupOp" => "AND",
|
|
|
+ "rules" => $result['rules'],
|
|
|
/*array(
|
|
|
array( "field" => "display_start_date", "op" => "gt", "data" => ""),
|
|
|
array( "field" => "display_end_date", "op" => "gt", "data" => "")
|
|
|
- ),*/
|
|
|
+ ),*/
|
|
|
//'groups' => $groups
|
|
|
- )
|
|
|
+ )
|
|
|
);
|
|
|
|
|
|
//With this function we can add actions to the jgrid (edit, delete, etc)
|
|
@@ -83,17 +83,17 @@ $action_links = 'function action_formatter(cellvalue, options, rowObject) {
|
|
|
' <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=delete&idChecked=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
|
|
|
- '\';
|
|
|
+ '\';
|
|
|
}';
|
|
|
$url_select = api_get_path(WEB_AJAX_PATH).'extra_field.ajax.php?1=1';
|
|
|
?>
|
|
|
<script>
|
|
|
|
|
|
-function setSearchSelect(columnName) {
|
|
|
+function setSearchSelect(columnName) {
|
|
|
$("#sessions").jqGrid('setColProp', columnName, {
|
|
|
-
|
|
|
+
|
|
|
/*searchoptions:{
|
|
|
- dataInit:function(el){
|
|
|
+ dataInit:function(el){
|
|
|
$("option[value='1']",el).attr("selected", "selected");
|
|
|
setTimeout(function(){
|
|
|
$(el).trigger('change');
|
|
@@ -106,14 +106,14 @@ var added_cols = [];
|
|
|
var original_cols = [];
|
|
|
|
|
|
function clean_cols(grid, added_cols) {
|
|
|
- //Cleaning
|
|
|
+ //Cleaning
|
|
|
for (key in added_cols) {
|
|
|
- //console.log('hide: ' + key);
|
|
|
+ //console.log('hide: ' + key);
|
|
|
grid.hideCol(key);
|
|
|
};
|
|
|
grid.showCol('name');
|
|
|
grid.showCol('display_start_date');
|
|
|
- grid.showCol('display_end_date');
|
|
|
+ grid.showCol('display_end_date');
|
|
|
grid.showCol('course_title');
|
|
|
}
|
|
|
|
|
@@ -122,14 +122,14 @@ function show_cols(grid, added_cols) {
|
|
|
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()));
|
|
@@ -139,20 +139,20 @@ $(function() {
|
|
|
next_month = Date.today().next().month();
|
|
|
$(elem).datetimepicker('setDate', next_month);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//Great hack
|
|
|
register_second_select = function(elem) {
|
|
|
- second_filters[$(elem).val()] = $(elem);
|
|
|
+ second_filters[$(elem).val()] = $(elem);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
fill_second_select = function(elem) {
|
|
|
$(elem).on("change", function() {
|
|
|
composed_id = $(this).val();
|
|
|
field_id = composed_id.split("#")[0];
|
|
|
id = composed_id.split("#")[1];
|
|
|
-
|
|
|
+
|
|
|
$.ajax({
|
|
|
- url: "<?php echo $url_select ?>&a=get_second_select_options",
|
|
|
+ url: "<?php echo $url_select ?>&a=get_second_select_options",
|
|
|
dataType: "json",
|
|
|
data: "type=session&field_id="+field_id+"&option_value_id="+id,
|
|
|
success: function(data) {
|
|
@@ -163,106 +163,106 @@ $(function() {
|
|
|
value: index,
|
|
|
text: value
|
|
|
}));
|
|
|
- });
|
|
|
+ });
|
|
|
}
|
|
|
- });
|
|
|
- });
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- <?php
|
|
|
- echo Display::grid_js('sessions', $url, $columns, $column_model, $extra_params, array(), $action_links, true);
|
|
|
+ <?php
|
|
|
+ echo Display::grid_js('sessions', $url, $columns, $column_model, $extra_params, array(), $action_links, true);
|
|
|
?>
|
|
|
-
|
|
|
+
|
|
|
setSearchSelect("status");
|
|
|
-
|
|
|
+
|
|
|
var grid = $("#sessions"),
|
|
|
prmSearch = {
|
|
|
- multipleSearch : true,
|
|
|
- overlay : false,
|
|
|
+ multipleSearch : true,
|
|
|
+ overlay : false,
|
|
|
width: 'auto',
|
|
|
caption: '<?php echo addslashes(get_lang('Search')); ?>',
|
|
|
- formclass:'data_table',
|
|
|
+ formclass:'data_table',
|
|
|
onSearch : function() {
|
|
|
var postdata = grid.jqGrid('getGridParam', 'postData');
|
|
|
-
|
|
|
+
|
|
|
if (postdata && postdata.filters) {
|
|
|
filters = jQuery.parseJSON(postdata.filters);
|
|
|
clean_cols(grid, added_cols);
|
|
|
- added_cols = [];
|
|
|
+ added_cols = [];
|
|
|
//console.log(postdata);
|
|
|
$.each(filters, function(key, value){
|
|
|
console.log('key: ' + key );
|
|
|
-
|
|
|
+
|
|
|
if (key == 'rules') {
|
|
|
$.each(value, function(subkey, subvalue) {
|
|
|
-
|
|
|
- if (subvalue.data == undefined) {
|
|
|
+
|
|
|
+ if (subvalue.data == undefined) {
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//if (added_cols[value.field] == undefined) {
|
|
|
added_cols[subvalue.field] = subvalue.field;
|
|
|
//}
|
|
|
- //grid.showCol(value.field);
|
|
|
+ //grid.showCol(value.field);
|
|
|
});
|
|
|
- }
|
|
|
+ }
|
|
|
});
|
|
|
- show_cols(grid, added_cols);
|
|
|
+ show_cols(grid, added_cols);
|
|
|
}
|
|
|
},
|
|
|
- onReset: function() {
|
|
|
+ onReset: function() {
|
|
|
clean_cols(grid, added_cols);
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
- original_cols = grid.jqGrid('getGridParam', 'colModel');
|
|
|
-
|
|
|
- grid.jqGrid('navGrid','#sessions_pager',
|
|
|
+
|
|
|
+ original_cols = grid.jqGrid('getGridParam', 'colModel');
|
|
|
+
|
|
|
+ grid.jqGrid('navGrid','#sessions_pager',
|
|
|
{edit:false,add:false,del:false},
|
|
|
- {height:280,reloadAfterSubmit:false}, // edit options
|
|
|
- {height:280,reloadAfterSubmit:false}, // add options
|
|
|
- {reloadAfterSubmit:false},// del options
|
|
|
+ {height:280,reloadAfterSubmit:false}, // edit options
|
|
|
+ {height:280,reloadAfterSubmit:false}, // add options
|
|
|
+ {reloadAfterSubmit:false},// del options
|
|
|
prmSearch
|
|
|
);
|
|
|
-
|
|
|
+
|
|
|
// create the searching dialog
|
|
|
grid.searchGrid(prmSearch);
|
|
|
-
|
|
|
+
|
|
|
//Fixes search table
|
|
|
var searchDialogAll = $("#fbox_"+grid[0].id);
|
|
|
searchDialogAll.addClass("table");
|
|
|
-
|
|
|
- var searchDialog = $("#searchmodfbox_"+grid[0].id);
|
|
|
+
|
|
|
+ var searchDialog = $("#searchmodfbox_"+grid[0].id);
|
|
|
searchDialog.addClass("ui-jqgrid ui-widget ui-widget-content ui-corner-all");
|
|
|
- searchDialog.css({position:"relative", "z-index":"auto", "float":"left"})
|
|
|
+ searchDialog.css({position:"relative", "z-index":"auto", "float":"left"})
|
|
|
var gbox = $("#gbox_"+grid[0].id);
|
|
|
gbox.before(searchDialog);
|
|
|
gbox.css({clear:"left"});
|
|
|
-
|
|
|
- //Select first elements by default
|
|
|
+
|
|
|
+ //Select first elements by default
|
|
|
$('.input-elm').each(function(){
|
|
|
- $(this).find('option:first').attr('selected', 'selected');
|
|
|
+ $(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').on('click', function(){
|
|
|
console.log('deleted');
|
|
|
$('.input-elm').each(function(){
|
|
|
- $(this).find('option:first').attr('selected', 'selected');
|
|
|
+ $(this).find('option:first').attr('selected', 'selected');
|
|
|
});
|
|
|
});*/
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
});
|
|
|
</script>
|
|
|
-<?php
|
|
|
+<?php
|
|
|
echo '<div class="actions">';
|
|
|
echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/session_add.php">'.Display::return_icon('new_session.png',get_lang('AddSession'),'',ICON_SIZE_MEDIUM).'</a>';
|
|
|
echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/add_many_session_to_category.php">'.Display::return_icon('session_to_category.png',get_lang('AddSessionsInCategories'),'',ICON_SIZE_MEDIUM).'</a>';
|
|
@@ -282,17 +282,17 @@ $form->addElement('text', 'start_date_start', get_lang('Between'), array('id' =>
|
|
|
$form->addElement('text', 'start_date_end', get_lang('And'), array('id' =>'start_date_end'));
|
|
|
$renderer = $form->defaultRenderer();
|
|
|
|
|
|
-$renderer->setElementTemplate(get_lang('StartDate').' {label} {element}', 'start_date_start');
|
|
|
-$renderer->setElementTemplate('{label} {element}', 'start_date_end');
|
|
|
+$renderer->setElementTemplate(get_lang('StartDate').' {label} {element}', 'start_date_start');
|
|
|
+$renderer->setElementTemplate('{label} {element}', 'start_date_end');
|
|
|
|
|
|
$form->addElement('html', '<div class="clear"></div>');
|
|
|
|
|
|
$form->addElement('text', 'end_date_start', get_lang('Between'), array('id' =>'end_date_start'));
|
|
|
$form->addElement('text', 'end_date_end', get_lang('And'), array('id' =>'end_date_end'));
|
|
|
|
|
|
-$renderer->setElementTemplate(get_lang('EndDate').' {label} {element}', 'end_date_start');
|
|
|
-$renderer->setElementTemplate('{label} {element}', 'end_date_end');
|
|
|
-
|
|
|
+$renderer->setElementTemplate(get_lang('EndDate').' {label} {element}', 'end_date_start');
|
|
|
+$renderer->setElementTemplate('{label} {element}', 'end_date_end');
|
|
|
+
|
|
|
$options = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id());
|
|
|
$form->addElement('select', 'course', get_lang('Course'), $options);
|
|
|
$form->addElement('button', 'submit', get_lang('Search'), array('id' => 'search_button'));
|