/**
  * Called to define this moodle form
  *
  * @return void
  */
 public function definition()
 {
     global $USER;
     $mform =& $this->_form;
     $course = $this->_customdata['course'];
     $cm = $this->_customdata['cm'];
     $modcontext = $this->_customdata['modcontext'];
     $pageparams = new att_individualreport_page_params();
     $pageparams->init($cm);
     $studentslist = $pageparams->get_students_list();
     $mform->setType('id', PARAM_INT);
     $mform->addElement('select', 'studentid', get_string('student', 'attcontrol'), $studentslist);
     $mform->addElement('checkbox', 'includeallsessions', get_string('includeall', 'attcontrol'), get_string('yes'));
     $mform->setDefault('includeallsessions', true);
     $mform->addElement('checkbox', 'includenottaken', get_string('includenottaken', 'attcontrol'), get_string('yes'));
     $mform->setDefault('includenottaken', true);
     $mform->addElement('date_selector', 'startdate', get_string('startofperiod', 'attcontrol'));
     $mform->setDefault('startdate', $course->startdate);
     $mform->disabledIf('startdate', 'includeallsessions', 'checked');
     $mform->addElement('date_selector', 'enddate', get_string('endofperiod', 'attcontrol'));
     $mform->disabledIf('enddate', 'includeallsessions', 'checked');
     $mform->addElement('select', 'format', get_string('format'), array('excel' => get_string('downloadexcel', 'attcontrol'), 'ooo' => get_string('downloadooo', 'attcontrol'), 'text' => get_string('downloadtext', 'attcontrol')));
     $submit_string = get_string('export', 'attcontrol');
     $this->add_action_buttons(false, $submit_string);
     $mform->addElement('hidden', 'id', $cm->id);
 }
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
// This module is based in the original Attendance Module created by
// Artem Andreev <*****@*****.**> - 2011
/**
 * Attendance individual report
 *
 * @package    mod_attcontrol
 * @copyright  2013 JosĂ© Luis AntĂșnez <*****@*****.**>
 * @copyright  2011 Artem Andreev <*****@*****.**>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once dirname(__FILE__) . '/../../config.php';
require_once dirname(__FILE__) . '/locallib.php';
$pageparams = new att_individualreport_page_params();
$id = required_param('id', PARAM_INT);
$from = optional_param('from', null, PARAM_ACTION);
$pageparams->view = optional_param('view', null, PARAM_INT);
$pageparams->curdate = optional_param('curdate', null, PARAM_INT);
$pageparams->student = optional_param('student', null, PARAM_INT);
$pageparams->sort = optional_param('sort', null, PARAM_INT);
$pageparams->coursefilter = optional_param('coursefilter', null, PARAM_INT);
$pageparams->studentfilter = optional_param('studentfilter', null, PARAM_INT);
$pageparams->action = optional_param('action', null, PARAM_INT);
$cm = get_coursemodule_from_id('attcontrol', $id, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$att = $DB->get_record('attcontrol', array('id' => $cm->instance), '*', MUST_EXIST);
require_login($course, true, $cm);
//Defines whether the student view or the teacher view is displayed
$nostudent = $pageparams->student == null;