. /** * print the entries * * @author Fumi.Iseki * @license GNU Public License * @package mod_apply (modified from mod_feedback that by Andreas Grabs) */ require_once('../../config.php'); require_once(dirname(__FILE__).'/locallib.php'); require_once($CFG->libdir.'/tablelib.php'); //////////////////////////////////////////////////////// //get the params $id = required_param('id', PARAM_INT); $do_show = optional_param('do_show', 'view_entries', PARAM_ALPHAEXT); $courseid = optional_param('courseid', 0, PARAM_INT); $user_id = optional_param('user_id', 0, PARAM_INT); $submit_id = optional_param('submit_id', 0, PARAM_INT); $submit_ver = optional_param('submit_ver', -1, PARAM_INT); $show_all = optional_param('show_all', 0, PARAM_INT); $perpage = optional_param('perpage', APPLY_DEFAULT_PAGE_COUNT, PARAM_INT); // how many per page // //$sifirst = optional_param('sifirst', '', PARAM_ALPHA); //$silast = optional_param('silast', '', PARAM_ALPHA); //$ssort = optional_param('ssort', '', PARAM_ALPHAEXT); //$spage = optional_param('spage', 0, PARAM_INT); $sort = optional_param('sort', '', PARAM_ALPHAEXT); $order = optional_param('order', 'DESC', PARAM_ALPHAEXT); if ($sort and $order) $sort = $sort.' '.$order; $current_tab = $do_show; $this_action = 'view_entries'; $norder = $order; if ($sort) { if ($order=='DESC') $norder = 'ASC'; else $norder = 'DESC'; } //////////////////////////////////////////////////////// //get the objects if (! $cm = get_coursemodule_from_id('apply', $id)) { print_error('invalidcoursemodule'); } if (! $course = $DB->get_record('course', array('id'=>$cm->course))) { print_error('coursemisconf'); } if (! $apply = $DB->get_record('apply', array('id'=>$cm->instance))) { print_error('invalidcoursemodule'); } if (!$courseid) $courseid = $course->id; $req_own_data = false; $name_pattern = $apply->name_pattern; $context = context_module::instance($cm->id); //////////////////////////////////////////////////////// // Check require_login($course, true, $cm); $formdata = data_submitted(); if ($formdata) { if (!confirm_sesskey()) { print_error('invalidsesskey'); } if ($user_id) { $formdata->user_id = intval($user_id); } } require_capability('mod/apply:viewreports', $context); /////////////////////////////////////////////////////////////////////////// // URL $strapplys = get_string('modulenameplural', 'apply'); $strapply = get_string('modulename', 'apply'); $base_url = new moodle_url('/mod/apply/'.$this_action.'.php'); $base_url->params(array('id'=>$id, 'courseid'=>$courseid, 'show_all'=>$show_all)); // $this_url = new moodle_url($base_url); $this_url->params(array('do_show'=>$do_show, 'submit_id'=>$submit_id, 'submit_ver'=>$submit_ver)); $back_url = new moodle_url($base_url); $back_url->params(array('do_show'=>'view_entries')); //$log_url = explode('/', $this_url); //add_to_log($course->id, 'apply', 'view_entries', end($log_url), 'apply_id='.$apply->id); //////////////////////////////////////////////////////// /// Print the page header $PAGE->navbar->add(get_string('apply:viewentries', 'apply')); $PAGE->set_url($this_url); $PAGE->set_heading(format_string($course->fullname)); $PAGE->set_title(format_string($apply->name)); echo $OUTPUT->header(); require('tabs.php'); // $cap_view_hidden_activities = has_capability('moodle/course:viewhiddenactivities', $context); if ((empty($cm->visible) and !$cap_view_hidden_activities)) { notice(get_string('activityiscurrentlyhidden')); } if ((empty($cm->visible) and !$cap_view_hidden_activities)) { notice(get_string('activityiscurrentlyhidden')); } /////////////////////////////////////////////////////////////////////////// // view_enties: Print the main part of the page if ($do_show=='view_entries') { //////////////////////////////////////////////////////////// // Setup Table $table = new flexible_table('apply-show_entry-list-'.$courseid); $matchcount = apply_get_valid_submits_count($cm->instance); // $page_params = ''; require('entry_header.php'); // echo $OUTPUT->box_start('mdl-align'); echo '