<commit_before><?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

require_once 'ilios_web_controller.php';

/**
 * @package Ilios
 *
 * This is the user calendar controller.
 */
class Calendar_Controller extends Ilios_Web_Controller
{
    /**
     * Constructor
     */
    public function __construct ()
    {
        parent::__construct();

        $this->load->model('Instructor_Group', 'instructorGroup', TRUE);
        $this->load->model('Program', 'program', TRUE);
        $this->load->model('Report', 'report', TRUE);
        $this->load->model('School', 'school', TRUE);
        $this->load->model('User', 'user', TRUE);
        $this->load->model('User_Made_Reminder', 'reminder', TRUE);
        $this->load->model('Authentication', 'authentication', TRUE);

        $this->load->library("ICalExporter");
        $this->load->library('CalendarFeedDataProvider');
    }

    /**
     * @todo add code docs
     */
    public function index ()
    {
        $data = array();

        // authorization check
        $isStudent = $this->session->userdata('is_learner');
        $hasInstructorAccess = $this->session->userdata('has_instructor_access');

        if (! $isStudent && ! $hasInstructorAccess) {
            $this->_viewAccessForbiddenPage($data);
            return;
        }

        $this->output->set_header('Expires: 0');

        $change_school = $this->input->get_post('schoolselect');
        if ($change_school) {
            $this->_setActiveSchool($change_school);
        }

        $schoolId = $this->session->userdata('school_id');

        if (! in_array($schoolId, $this->_getAvailableSchools())) {
            // Reset to primary school
            $this->_setActiveSchool($this->session->userdata('primary_school_id'));
            $schoolId = $this->session->userdata('school_id');
        }

        $userRow = $this->user->getRowForPrimaryKeyId($this->session->userdata('uid'));


        $schoolTitle = null;

        if ($schoolId) {
            $schoolRow = $this->school->getRowForPrimaryKeyId($schoolId);
            if ($schoolRow) {
                $schoolTitle = $schoolRow->title;<commit_msg>removed unused variable and db call.<commit_after><?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

require_once 'ilios_web_controller.php';

/**
 * @package Ilios
 *
 * This is the user calendar controller.
 */
class Calendar_Controller extends Ilios_Web_Controller
{
    /**
     * Constructor
     */
    public function __construct ()
    {
        parent::__construct();

        $this->load->model('Instructor_Group', 'instructorGroup', TRUE);
        $this->load->model('Program', 'program', TRUE);
        $this->load->model('Report', 'report', TRUE);
        $this->load->model('School', 'school', TRUE);
        $this->load->model('User', 'user', TRUE);
        $this->load->model('User_Made_Reminder', 'reminder', TRUE);
        $this->load->model('Authentication', 'authentication', TRUE);

        $this->load->library("ICalExporter");
        $this->load->library('CalendarFeedDataProvider');
    }

    /**
     * @todo add code docs
     */
    public function index ()
    {
        $data = array();

        // authorization check
        $isStudent = $this->session->userdata('is_learner');
        $hasInstructorAccess = $this->session->userdata('has_instructor_access');

        if (! $isStudent && ! $hasInstructorAccess) {
            $this->_viewAccessForbiddenPage($data);
            return;
        }

        $this->output->set_header('Expires: 0');

        $change_school = $this->input->get_post('schoolselect');
        if ($change_school) {
            $this->_setActiveSchool($change_school);
        }

        $schoolId = $this->session->userdata('school_id');

        if (! in_array($schoolId, $this->_getAvailableSchools())) {
            // Reset to primary school
            $this->_setActiveSchool($this->session->userdata('primary_school_id'));
            $schoolId = $this->session->userdata('school_id');
        }

        $schoolTitle = null;

        if ($schoolId) {
            $schoolRow = $this->school->getRowForPrimaryKeyId($schoolId);
            if ($schoolRow) {
                $schoolTitle = $schoolRow->title;
{'fraction_non_alphanumeric': 0.16506447831184057, 'fraction_numerical': 0.0004689331770222743, 'mean_word_length': 2.6712564543889843, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 85, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2646616', 'n_tokens_mistral': 1237, 'n_tokens_neox': 1200, 'n_words': 204}