<commit_before><?php
/*
 * File: Courses.php
 * Holds: Displays a list of courses
 * Created: 16.05.2015
 * Project: Youkok2
 * 
*/

namespace Youkok2\Views;

/*
 * Define what classes to use
 */

use \Youkok2\Models\Element as Element;
use \Youkok2\Utilities\Database as Database;
use \Youkok2\Utilities\Loader as Loader;

/*
 * The Home class, extending Base class
 */

class Courses extends BaseView {

    /*
     * Constructor
     */

    public function __construct() {
        parent::__construct();
        
        // Turn on caching
        $this->template->setCaching(\Smarty::CACHING_LIFETIME_CURRENT);

        // Set menu
        $this->template->assign('HEADER_MENU', 'ARCHIVE');

        // Check if cached
        if (!$this->template->isCached('courses.tpl', Loader::queryGetClean())) {

            // Load content
            $this->loadCourses();
        }

        // Display
        $this->displayAndCleanup('courses.tpl', Loader::queryGetClean());
    }
    
    /*
     * Load courses
     */

    private function loadCourses() {
        // Variables are nice
        $index = -1;
        $current_letter = null;
        $collection = null;

        // Load all the courses
        $get_all_courses  = "SELECT id, name, url_friendly, parent, empty" . PHP_EOL;
        $get_all_courses .= "FROM archive" . PHP_EOL;
        $get_all_courses .= "WHERE parent IS NULL" . PHP_EOL;
        $get_all_courses .= "AND is_visible = 1" . PHP_EOL;
        $get_all_courses .= "ORDER BY name ASC";
        <commit_msg>Fixed incorrect link for courses<commit_after><?php
/*
 * File: Courses.php
 * Holds: Displays a list of courses
 * Created: 16.05.2015
 * Project: Youkok2
 * 
*/

namespace Youkok2\Views;

/*
 * Define what classes to use
 */

use \Youkok2\Models\Element as Element;
use \Youkok2\Utilities\Database as Database;
use \Youkok2\Utilities\Loader as Loader;

/*
 * The Home class, extending Base class
 */

class Courses extends BaseView {

    /*
     * Constructor
     */

    public function __construct() {
        parent::__construct();
        
        // Turn on caching
        $this->template->setCaching(\Smarty::CACHING_LIFETIME_CURRENT);

        // Set menu
        $this->template->assign('HEADER_MENU', 'ARCHIVE');

        // Check if cached
        if (!$this->template->isCached('courses.tpl', Loader::queryGetClean())) {

            // Load content
            $this->loadCourses();
        }

        // Display
        $this->displayAndCleanup('courses.tpl', Loader::queryGetClean());
    }
    
    /*
     * Load courses
     */

    private function loadCourses() {
        // Variables are nice
        $index = -1;
        $current_letter = null;
        $collection = null;

        // Load all the courses
        $get_all_courses  = "SELECT id, name, url_friendly, parent, empty, url, is_directory" . PHP_EOL;
        $get_all_courses .= "FROM archive" . PHP_EOL;
        $get_all_courses .= "WHERE parent IS NULL" . PHP_EOL;
        $get_all_courses .= "AND is_visible = 1" . PHP_EOL;
        $get_all_courses .= "ORDER BY name ASC";
        
{'fraction_non_alphanumeric': 0.12637008381689233, 'fraction_numerical': 0.009671179883945842, 'mean_word_length': 2.1760491299897646, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '621312', 'n_tokens_mistral': 1003, 'n_tokens_neox': 960, 'n_words': 232}