<commit_before><?php

namespace Claroline\Archiver\Controller;

use Silex\Application;

/**
 * Index controller
 * @package claroline-archiver
 */
class ArchiverController {

  /**
   * Serve the index page
   * @param  Silex\Application $app
   * @return page output
   */
  public function index(Application $app) {
    return $app['twig']->render('index.html.twig');
  }

  /**
   * Serve the course loading page
   * @param  Silex\Application $app
   * @return page output
   */
  public function loadCourse(Application $app) {

    $results = array(
      array('code' => 'TEST')
    );

    $choices = array();

    foreach ( $results as $row ) {
      $choices[] = $row['code'];
    }

    $data = array(
        'courseId' => ''
    );

    $form = $app['form.factory']->createBuilder('form', $data )
      ->setAction('/archiver/course/search')
      ->add('courseId', 'choice', array(
        'choices' => $choices,
        'expanded' => false,
        'multiple' => false
      ))
      ->getForm();

    return $app['twig']->render(
      'courseform.html.twig',
      array(
        'form'=>$form->createView()
      )
    );
  }
}
<commit_msg>use illuminate to retreive results from database<commit_after><?php

namespace Claroline\Archiver\Controller;

use Silex\Application;

/**
 * Index controller
 * @package claroline-archiver
 */
class ArchiverController {

  /**
   * Serve the index page
   * @param  Silex\Application $app
   * @return page output
   */
  public function index(Application $app) {
    return $app['twig']->render('index.html.twig');
  }

  /**
   * Serve the course loading page
   * @param  Silex\Application $app
   * @return page output
   */
  public function loadCourse(Application $app) {

    $courses = $app['db']->connection()->table('cours')->select('code', 'intitule as title')->get();

    // var_dump($courses);

    $results = array(
      array('code' => 'TEST')
    );

    $choices = array();

    foreach ( $courses as $course ) {
      $choices[$course->code] = utf8_encode($course->title);
    }

    $data = array(
        'courseId' => ''
    );

    $form = $app['form.factory']->createBuilder('form', $data )
      ->setAction('/archiver/course/search')
      ->add('courseId', 'choice', array(
        'choices' => $choices,
        'expanded' => false,
        'multiple' => false
      ))
      ->getForm();

    return $app['twig']->render(
      'courseform.html.twig',
      array(
        'form'=>$form->createView()
      )
    );
  }
}

{'fraction_non_alphanumeric': 0.17290836653386454, 'fraction_numerical': 0.00039840637450199205, 'mean_word_length': 2.582025677603424, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '529997', 'n_tokens_mistral': 825, 'n_tokens_neox': 804, 'n_words': 164}