delete($exerciseId); // if the question has been removed from the exercise if ($objExercise->removeFromList($deleteQuestion)) { $nbrQuestions--; } } // destruction of the Question object unset($objQuestionTmp); } $token = Security::get_token(); //jqgrid will use this URL to do the selects $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_question_list&exerciseId='.$exerciseId; //The order is important you need to check the the $column variable in the model.ajax.php file //$columns = array(get_lang('Questions'), get_lang('Type'), get_lang('Category'), get_lang('Difficulty'), get_lang('Score'), get_lang('Actions')); $columns = array(get_lang('Questions'), get_lang('Type'), get_lang('Category'), get_lang('Score')); // Adding filtered question extra fields $extraField = new ExtraField('question'); $extraFields = $extraField->get_all(array('field_filter = ?' => 1)); if (!empty($extraFields)) { foreach ($extraFields as $field) { $columns[] = $field['field_display_text']; } } $columns[] = get_lang('Actions'); //Column config $column_model = array( array('name' => 'question', 'index' => 'question', 'width' => '300', 'align' => 'left'), array( 'name' => 'type', 'index' => 'type', 'width' => '100', 'align' => 'left', 'sortable' => 'false' ), array( 'name' => 'category', 'index' => 'category', 'width' => '100', 'align' => 'left', 'sortable' => 'false' ), /*array( 'name' => 'level', 'index' => 'level', 'width' => '50', 'align' => 'left', 'sortable' => 'false' ),*/ array( 'name' => 'score', 'index' => 'score', 'width' => '50', 'align' => 'left', 'sortable' => 'false' ) ); if (!empty($extraFields)) { foreach ($extraFields as $field) { $column_model[] = array( 'name' => $field['field_variable'], 'index' => $field['field_variable'], 'width' => '100', 'align' => 'left', 'sortable' => 'false' ); } } $column_model[] = array( 'name' => 'actions', 'index' => 'actions', 'width' => '50', 'align' => 'left', 'formatter' => 'action_formatter', 'sortable' => 'false' ); //Autowidth $extra_params['autowidth'] = 'true'; //height auto $extra_params['height'] = 'auto'; $courseCode = api_get_course_id(); $delete_link = null; if ($objExercise->edit_exercise_in_lp == true) { $delete_link = ' '.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).''; } //With this function we can add actions to the jgrid (edit, delete, etc) $action_links = 'function action_formatter(cellvalue, options, rowObject) { return \''.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).''. ' '.Display::return_icon('cd.gif', get_lang('Copy'), '',ICON_SIZE_SMALL).''. $delete_link.'\'; }'; ?>
" style="display:none;">

'; echo Display::grid_html('question_list');