Adding actions menu

skala
Julio Montoya 15 years ago
parent e96fad74d4
commit b29953df0e
  1. 18
      main/exercice/exercise_admin.php
  2. 40
      main/exercice/hotpotatoes.php
  3. 82
      main/exercice/question_create.php

@ -9,7 +9,6 @@
* @version $Id$
*/
// name of the language file that needs to be included
$language_file='exercice';
@ -162,8 +161,10 @@ if ($form -> validate()) {
$objExercise -> processCreation($form);
if ($form -> getSubmitValue('edit') == 'true') {
header('Location:exercice.php?message=ExerciseEdited&'.api_get_cidreq());
exit;
} else {
header('Location:admin.php?message=ExerciseAdded&exerciseId='.$objExercise->id);
exit;
}
} else {
/*********************
@ -174,14 +175,17 @@ if ($form -> validate()) {
}
if (!empty($gradebook) && $gradebook=='view') {
$interbreadcrumb[]= array (
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('Gradebook')
);
$interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('Gradebook'));
}
$nameTools=get_lang('ExerciseManagement');
$interbreadcrumb[] = array ("url"=>"exercice.php", "name"=> get_lang('Exercices'));
Display::display_header($nameTools,"Exercise");
$interbreadcrumb[] = array ("url"=>'exercice.php', 'name'=> get_lang('Exercices'));
Display::display_header($nameTools,get_lang('Exercise'));
echo '<div class="actions">';
echo '<a href="exercice.php?show=test">' . Display :: return_icon('quiz.gif', get_lang('BackToExercisesList')) . get_lang('BackToExercisesList') . '</a>';
echo '</div>';
if ($objExercise->feedbacktype==1)
Display::display_normal_message(get_lang("DirectFeedbackCantModifyTypeQuestion"));
if(api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) {

@ -1,26 +1,8 @@
<?php
/*
DOKEOS - elearning and course management software
For a full list of contributors, see documentation/credits.html
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See "documentation/licence.html" more details.
Contact:
Dokeos
Rue des Palais 44 Paleizenstraat
B-1030 Brussels - Belgium
Tel. +32 (2) 211 34 56
*/
/* For licensing terms, see /license.txt */
/**
* Code for Hotpotatoes integration.
* @package dokeos.exercise
* @package chamilo.exercise
* @author Istvan Mandak
* @version $Id: hotpotatoes.php 20798 2009-05-18 18:13:25Z cvargas1 $
*/
@ -36,15 +18,14 @@ require_once '../inc/global.inc.php';
require_once (api_get_path(LIBRARY_PATH).'fileUpload.lib.php');
require_once (api_get_path(LIBRARY_PATH).'document.lib.php');
require_once (api_get_path(LIBRARY_PATH).'fileManage.lib.php');
require_once (api_get_path(LIBRARY_PATH)."pclzip/pclzip.lib.php");
require_once (api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php');
require_once 'hotpotatoes.lib.php';
// section (for the tabs)
$this_section=SECTION_COURSES;
// access restriction: only teachers are allowed here
if(!api_is_allowed_to_edit(null,true))
{
if(!api_is_allowed_to_edit(null,true)) {
api_not_allowed();
}
@ -76,13 +57,12 @@ $imgcount = (!empty($_POST['imgcount'])?$_POST['imgcount']:null);
$fld = (!empty($_POST['fld'])?$_POST['fld']:null);
// if user is allowed to edit
if (api_is_allowed_to_edit(null,true))
{
if (api_is_allowed_to_edit(null,true)) {
//disable document parsing(?) - obviously deprecated
$enableDocumentParsing=false;
if(hotpotatoes_init($document_sys_path.$uploadPath))
{//if the directory doesn't exist
if(hotpotatoes_init($document_sys_path.$uploadPath)) {
//if the directory doesn't exist
//create the "HotPotatoes" directory
$doc_id = add_document($_course, '/HotPotatoes_files','folder',0,'HotPotatoes Files');
//update properties in dbase (in any case)
@ -223,7 +203,11 @@ if((api_is_allowed_to_edit(null,true)) && (($finish == 0) || ($finish == 2)))
exit;
}
Display::display_header($nameTools,"Exercise");
Display::display_header($nameTools,get_lang('Exercise'));
echo '<div class="actions">';
echo '<a href="exercice.php?show=test">' . Display :: return_icon('quiz.gif', get_lang('BackToExercisesList')) . get_lang('BackToExercisesList') . '</a>';
echo '</div>';
if ($finish==2) //if we are in the img upload process
{

@ -1,40 +1,15 @@
<?php // $Id: question_create.php 20569 2009-05-12 21:34:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2009 Dokeos SPRL
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) various contributors
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
<?php
/* For licensing terms, see /license.txt */
// name of the language file that needs to be included
$language_file='exercice';
// including global Dokeos file
include("../inc/global.inc.php");
require_once '../inc/global.inc.php';
// including additional libraries
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
require_once ('question.class.php');
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once 'question.class.php';
// the section (tabs)
$this_section=SECTION_COURSES;
@ -48,8 +23,6 @@ $interbreadcrumb[]=array("url" => "exercice.php","name" => get_lang('Exercices')
// Tool name
$nameTools=get_lang('AddQuestionToExercise');
// The form
$form = new FormValidator('add_question','post',api_get_self().'?'.api_get_cidreq());
// form title
@ -76,8 +49,7 @@ $tbl_exercices = Database :: get_course_table(TABLE_QUIZ_TEST);
$sql = "SELECT id,title,type,description, results_disabled FROM $tbl_exercices WHERE active<>'-1' ORDER BY title ASC";
$result = Database::query($sql);
$exercises['-'] = '-'.get_lang('SelectExercice').'-';
while ($row = Database :: fetch_array($result))
{
while ($row = Database :: fetch_array($result)) {
$exercises[$row['id']] = $row['title'];
}
$form->addElement('select', 'exercice', get_lang('Exercice'), $exercises);
@ -92,28 +64,25 @@ $form->addRule('exercice', '<span class="required">'.get_lang('YouHaveToSelectAT
$form->registerRule('validquestiontype', 'callback', 'check_question_type');
$form->addRule('question_type_hidden', get_lang('InvalidQuestionType'), 'validquestiontype');
if ($form->validate())
{
if ($form->validate()) {
$values = $form->exportValues();
//echo 'form validates';
//print_r($values);
foreach (Question::$questionTypes as $question_type_id => $question_type_class_and_name)
{
if (get_lang($question_type_class_and_name[1]) == $values['question_type_hidden'])
{
foreach (Question::$questionTypes as $question_type_id => $question_type_class_and_name) {
if (get_lang($question_type_class_and_name[1]) == $values['question_type_hidden']) {
$answer_type = $question_type_id;
}
}
header('Location: admin.php?exerciseId='.$values['exercice'].'&newQuestion=yes&answerType='.$answer_type);
}
else
{
exit;
} else {
// header
Display::display_header($nameTools);
echo '<div class="actions">';
echo '<a href="exercice.php?show=test">' . Display :: return_icon('quiz.gif', get_lang('BackToExercisesList')) . get_lang('BackToExercisesList') . '</a>';
echo '</div>';
// displaying the form
$form->display();
@ -121,20 +90,12 @@ else
// footer
Display::display_footer();
}
?>
<script>
var ddlObj1=$("#questiontypes").finalselect({id:"test",viewWidth:'260px', viewHeight:'150px', selectText:'<?php echo Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle; cursor:hand'))."&nbsp;&nbsp;".get_lang('SelectQuestionType');?>',selectImage:'<?php echo api_get_path(WEB_IMG_PATH); ?>select.png', viewMouseoverColor: '#EFEFEF'});
$("#test-select").bind('click',function(){
$("#question_type_hidden").val(ddlObj1.getText());
});
<?php
// defining the pictures of the question types
$pictures_question_types[1] = 'mcua.gif';
@ -156,19 +117,14 @@ foreach (Question::$questionTypes as $key=>$value) {
<?php
function check_question_type($parameter)
{
foreach (Question::$questionTypes as $key=>$value)
{
function check_question_type($parameter) {
foreach (Question::$questionTypes as $key=>$value) {
$valid_question_types[] = get_lang($value[1]);
//$valid_question_types[] = trim($value[1]);
}
if (in_array($parameter, $valid_question_types))
{
if (in_array($parameter, $valid_question_types)) {
return true;
}
else
{
} else {
return false;
}
}

Loading…
Cancel
Save