skala
jmontoya 12 years ago
commit 83d6f7d0d8
  1. 11
      main/coursecopy/classes/CourseRestorer.class.php
  2. 19
      main/exercice/exercise.class.php
  3. 10
      main/exercice/media_question.class.php
  4. 2
      main/exercice/question_list_admin.inc.php
  5. 12
      main/inc/services.php

@ -1485,6 +1485,7 @@ class CourseRestorer
'propagate_neg' => $quiz->propagate_neg,
'text_when_finished' => $quiz->text_when_finished,
'expired_time' => (int)$quiz->expired_time,
'end_button' => (int)$quiz->end_button
);
if ($respect_base_content) {
@ -1579,7 +1580,7 @@ class CourseRestorer
$table_ans = Database::get_course_table(TABLE_QUIZ_ANSWER);
$table_options = Database::get_course_table(TABLE_QUIZ_QUESTION_OPTION);
// check resources inside html from fckeditor tool and copy correct urls into recipient course
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$question->description = DocumentManager::replace_urls_inside_content_html_from_copy_course(
$question->description,
$this->course->code,
@ -1592,13 +1593,13 @@ class CourseRestorer
$question_obj = Question::readByTitle($question->parent_info['question'], $this->destination_course_id);
if ($question_obj) {
//Reuse media
// Reuse media.
$parent_id = $question_obj->selectId();
} else {
//Create media
// Create media.
$question_obj = new MediaQuestion();
$question_obj->updateCourse($this->destination_course_id);
$parent_id = $question_obj->save_media(array(
$parent_id = $question_obj->saveMedia(array(
'questionName' => $question->parent_info['question'],
'questionDescription' => $question->parent_info['description']
));
@ -1614,7 +1615,7 @@ class CourseRestorer
type='".self::DBUTF8escapestring($question->quiz_type)."',
picture='".self::DBUTF8escapestring($question->picture)."',
level='".self::DBUTF8escapestring($question->level)."',
parent_id ='".$parent_id."',
parent_id = '".$parent_id."',
extra='".self::DBUTF8escapestring($question->extra)."'";
Database::query($sql);

@ -113,6 +113,7 @@ class Exercise
$this->display_category_name = 0;
$this->pass_percentage = null;
$this->modelType = 1;
$this->endButton = 0;
if (!empty($course_id)) {
$course_info = api_get_course_info_by_id($course_id);
@ -301,8 +302,8 @@ class Exercise
/**
* Returns the exercise sound file
*
* @author - Olivier Brouckaert
* @return - string - exercise description
* @author Olivier Brouckaert
* @return string - exercise description
*/
function selectSound()
{
@ -360,7 +361,7 @@ class Exercise
/**
* @author Hubert borderiou 30-11-11
* @return modify object to update the switch display_category_name
* @return void modify object to update the switch display_category_name
* $in_txt is an integer 0 or 1
*/
public function updateDisplayCategoryName($text)
@ -1882,6 +1883,7 @@ class Exercise
$defaults['email_notification_template'] = $this->selectEmailNotificationTemplate();
$defaults['model_type'] = $this->getModelType();
if (($this->start_time != '0000-00-00 00:00:00')) {
$defaults['activate_start_date_check'] = 1;
}
@ -1918,6 +1920,7 @@ class Exercise
$defaults['display_category_name'] = 1; //
$defaults['end_time'] = date('Y-m-d 12:00:00', time() + 84600);
$defaults['pass_percentage'] = '';
$defaults['end_button'] = $this->selectEndButton();
}
} else {
$defaults['exerciseTitle'] = $this->selectTitle();
@ -5015,7 +5018,7 @@ class Exercise
}
/**
* Is media question activated
* Is media question activated?
* @return bool
*/
public function mediaIsActivated()
@ -5039,7 +5042,7 @@ class Exercise
/**
* Gets question list from the exercise
* (true show all questions, false show media question id instead of the question ids)
*
* @return array
*/
public function getQuestionList()
@ -5052,10 +5055,10 @@ class Exercise
* @example
* <code>
* array(
* question_id,
* question_id,
* question_id_1,
* question_id_2,
* media_id, <- this media id contains question ids
* question_id,
* question_id_3,
* )
* </code>
* @return array

@ -12,12 +12,19 @@ class MediaQuestion extends Question
$this->type = MEDIA_QUESTION;
}
/**
* @param \FormValidator $form
*/
public function processAnswersCreation($form)
{
$params = $form->getSubmitValues();
$this->saveMedia($params);
}
/**
* @param array $params
* @return int
*/
public function saveMedia($params)
{
$table_question = Database::get_course_table(TABLE_QUIZ_QUESTION);
@ -36,6 +43,9 @@ class MediaQuestion extends Question
}
}
/**
* @param \FormValidator $form
*/
public function createAnswersForm ($form)
{
$form->addElement('button', 'submitQuestion', get_lang('Save'));

@ -129,7 +129,7 @@ if (!$inATest) {
// Always getting list from DB.
$objExercise->setCategoriesGrouping(false);
$questionList = $objExercise->getQuestionList();
$questionList = $objExercise->getQuestionListWithMediasUncompressed();
// Style for columns.
$styleQuestion = "width:50%; float:left;";

@ -14,6 +14,7 @@ use Silex\Application;
use Silex\ServiceProviderInterface;
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
// Monolog.
if (is_writable($app['sys_temp_path'])) {
/**
@ -73,13 +74,14 @@ $app->register(new Silex\Provider\SecurityServiceProvider(), array(
)
));
// Registering Password encoder
// @todo fix hardcoded sha1 value
// Registering Password encoder.
// @todo test with the "none" encrypt method.
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
$app['security.encoder.digest'] = $app->share(function($app) {
// use the sha1 algorithm
// don't base64 encode the password
// use only 1 iteration
return new MessageDigestPasswordEncoder('sha1', false, 1);
return new MessageDigestPasswordEncoder($app['configuration']['password_encryption'], false, 1);
});
// What to do when login success?
@ -94,7 +96,7 @@ $app['security.authentication.logout_handler.admin'] = $app->share(function($app
// Role hierarchy
$app['security.role_hierarchy'] = array(
'ROLE_ADMIN' => array('ROLE_QUESTION_MANAGER', 'ROLE_TEACHER', 'ROLE_DIRECTOR', 'ROLE_JURY_PRESIDENT', 'ROLE_ALLOWED_TO_SWITCH'),
'ROLE_ADMIN' => array('ROLE_QUESTION_MANAGER', 'ROLE_TEACHER', 'ROLE_ALLOWED_TO_SWITCH'),
'ROLE_TEACHER' => array('ROLE_STUDENT'),
'ROLE_RRHH' => array('ROLE_TEACHER'),
'ROLE_QUESTION_MANAGER' => array('ROLE_QUESTION_MANAGER'),
@ -142,6 +144,7 @@ $app->register(new Silex\Provider\FormServiceProvider());
$app->register(new Silex\Provider\UrlGeneratorServiceProvider());
// Needed to use the "entity" option in symfony forms
use Doctrine\Common\Persistence\AbstractManagerRegistry;
class ManagerRegistry extends AbstractManagerRegistry
{
@ -319,6 +322,7 @@ if (is_writable($app['sys_temp_path'])) {
}
// Pagerfanta settings (Pagination using Doctrine2, arrays, etc)
use FranMoreno\Silex\Provider\PagerfantaServiceProvider;
$app->register(new PagerfantaServiceProvider());

Loading…
Cancel
Save