コード例 #1
0
 /**
  * @param string $name
  * @param Request $request
  * @return Response
  */
 public function classicAction($name, Request $request)
 {
     // get.
     $_GET = $request->query->all();
     // post.
     $_POST = $request->request->all();
     $rootDir = $this->get('kernel')->getRealRootDir();
     //$_REQUEST = $request->request->all();
     $mainPath = $rootDir . 'main/';
     $fileToLoad = $mainPath . $name;
     // Setting legacy values inside the container
     /** @var Connection $dbConnection */
     $dbConnection = $this->container->get('database_connection');
     $em = $this->get('kernel')->getContainer()->get('doctrine.orm.entity_manager');
     $database = new \Database($dbConnection, array());
     $database->setConnection($dbConnection);
     $database->setManager($em);
     Container::$container = $this->container;
     Container::$dataDir = $this->container->get('kernel')->getDataDir();
     Container::$courseDir = $this->container->get('kernel')->getDataDir();
     //Container::$configDir = $this->container->get('kernel')->getConfigDir();
     $this->container->get('twig')->addGlobal('api_get_cidreq', api_get_cidreq());
     //$breadcrumb = $this->container->get('chamilo_core.block.breadcrumb');
     if (is_file($fileToLoad) && \Security::check_abs_path($fileToLoad, $mainPath)) {
         // Files inside /main need this variables to be set
         $is_allowed_in_course = api_is_allowed_in_course();
         $is_courseAdmin = api_is_course_admin();
         $is_platformAdmin = api_is_platform_admin();
         $toolNameFromFile = basename(dirname($fileToLoad));
         $charset = 'UTF-8';
         // Default values
         $_course = api_get_course_info();
         $_user = api_get_user_info();
         $debug = $this->container->get('kernel')->getEnvironment() == 'dev' ? true : false;
         // Loading file
         ob_start();
         require_once $fileToLoad;
         $out = ob_get_contents();
         ob_end_clean();
         // No browser cache when executing an exercise.
         if ($name == 'exercice/exercise_submit.php') {
             $responseHeaders = array('cache-control' => 'no-store, no-cache, must-revalidate');
         }
         $js = isset($htmlHeadXtra) ? $htmlHeadXtra : array();
         // $interbreadcrumb is loaded in the require_once file.
         $interbreadcrumb = isset($interbreadcrumb) ? $interbreadcrumb : null;
         $template = Container::$legacyTemplate;
         $defaultLayout = 'layout_one_col.html.twig';
         if (!empty($template)) {
             $defaultLayout = $template;
         }
         return $this->render('ChamiloCoreBundle::' . $defaultLayout, array('legacy_breadcrumb' => $interbreadcrumb, 'content' => $out, 'js' => $js));
     } else {
         // Found does not exist
         throw new NotFoundHttpException();
     }
 }
コード例 #2
0
 /**
  * @return string
  */
 public function getTeacherLink()
 {
     $link = null;
     if (api_is_allowed_to_edit()) {
         $url = api_get_path(WEB_PLUGIN_PATH) . 'courselegal/start.php?' . api_get_cidreq();
         $link = Display::url($this->get_lang('CourseLegal'), $url, array('class' => 'btn'));
     }
     return $link;
 }
コード例 #3
0
 public function get_link()
 {
     $eval = $this->get_evaluation();
     // course/platform admin can go to the view_results page
     if (api_is_allowed_to_edit()) {
         return 'gradebook_view_result.php?' . api_get_cidreq() . '&selecteval=' . $eval->get_id();
     } elseif (ScoreDisplay::instance()->is_custom()) {
         return 'gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . $eval->get_id();
     } else {
         return null;
     }
 }
コード例 #4
0
ファイル: qti2.php プロジェクト: KRCM13/chamilo-lms
/**
 * This function displays the form for import of the zip file with qti2
 */
function ch_qti2_display_form()
{
    $name_tools = get_lang('ImportQtiQuiz');
    $form = '<div class="actions">';
    $form .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/exercise.php?show=test&' . api_get_cidreq() . '">' . Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM) . '</a>';
    $form .= '</div>';
    $formValidator = new FormValidator('qti_upload', 'post', api_get_self() . "?" . api_get_cidreq(), null, array('enctype' => 'multipart/form-data'));
    $formValidator->addElement('header', $name_tools);
    $formValidator->addElement('file', 'userFile', get_lang('DownloadFile'));
    $formValidator->addButtonImport(get_lang('Upload'));
    $form .= $formValidator->returnForm();
    echo $form;
}
コード例 #5
0
/**
 * This function displays the form for import of the zip file with qti2
 * @param   string  Report message to show in case of error
 */
function aiken_display_form($msg = '')
{
    $name_tools = get_lang('ImportAikenQuiz');
    $form = '<div class="actions">';
    $form .= '<a href="exercice.php?show=test">' . Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM) . '</a>';
    $form .= '</div>';
    $form .= $msg;
    $form_validator = new FormValidator('aiken_upload', 'post', api_get_self() . "?" . api_get_cidreq(), null, array('enctype' => 'multipart/form-data'));
    $form_validator->addElement('header', $name_tools);
    $form_validator->addElement('text', 'total_weight', get_lang('TotalWeight'));
    $form_validator->addElement('file', 'userFile', get_lang('DownloadFile'));
    $form_validator->addElement('style_submit_button', 'submit', get_lang('Send'), 'class="upload"');
    $form .= $form_validator->return_form();
    $form .= '<blockquote>' . get_lang('ImportAikenQuizExplanation') . '<br /><pre>' . get_lang('ImportAikenQuizExplanationExample') . '</pre></blockquote>';
    echo $form;
}
コード例 #6
0
ファイル: qti2.php プロジェクト: ilosada/chamilo-lms-icpna
/**
 * This function will import the zip file with the respective qti2
 * @param array $uploaded_file ($_FILES)
 */
function ch_qti2_import_file($array_file)
{
    $unzip = 0;
    $lib_path = api_get_path(LIBRARY_PATH);
    $process = FileManager::process_uploaded_file($array_file);
    if (preg_match('/\\.zip$/i', $array_file['name'])) {
        // if it's a zip, allow zip upload
        $unzip = 1;
    }
    if ($process && $unzip == 1) {
        $main_path = api_get_path(SYS_CODE_PATH);
        require_once $main_path . 'exercice/export/exercise_import.inc.php';
        require_once $main_path . 'exercice/export/qti2/qti2_classes.php';
        $imported = import_exercise($array_file['name']);
        if ($imported) {
            header('Location: exercice.php?' . api_get_cidreq());
        } else {
            Display::display_error_message(get_lang('UplNoFileUploaded'));
            return false;
        }
    }
}
コード例 #7
0
    /**
     * Set system parameters
     */
    private function set_system_parameters()
    {
        global $_configuration;

        //Setting app paths/URLs
        $_p = array(
            'web'        => api_get_path(WEB_PATH),
            'web_course' => api_get_path(WEB_COURSE_PATH),
            'web_main'   => api_get_path(WEB_CODE_PATH),
            'web_css'    => api_get_path(WEB_CSS_PATH),
            'web_ajax'   => api_get_path(WEB_AJAX_PATH),
            'web_img'    => api_get_path(WEB_IMG_PATH),
            'web_plugin' => api_get_path(WEB_PLUGIN_PATH),
            'web_lib'    => api_get_path(WEB_LIBRARY_PATH),
            'web_self' => api_get_self(),
            'web_query_vars' => api_htmlentities($_SERVER['QUERY_STRING']),
            'web_self_query_vars' => api_htmlentities($_SERVER['REQUEST_URI']),
            'web_cid_query' => api_get_cidreq(),
        );
        $this->assign('_p', $_p);

        //Here we can add system parameters that can be use in any template
        $_s = array(
            'software_name'  => $_configuration['software_name'],
            'system_version' => $_configuration['system_version'],
            'site_name'      => api_get_setting('siteName'),
            'institution'    => api_get_setting('Institution')
        );
        $this->assign('_s', $_s);
    }
コード例 #8
0
$minutes = 60;
$url = api_get_path(WEB_AJAX_PATH) . 'exercise.ajax.php?a=get_live_stats&exercise_id=' . $objExercise->id . '&minutes=' . $minutes;
//The order is important you need to check the the $column variable in the model.ajax.php file
$columns = array(get_lang('FirstName'), get_lang('LastName'), get_lang('Time'), get_lang('QuestionsAlreadyAnswered'), get_lang('Score'));
//Column config
$column_model = array(array('name' => 'firstname', 'index' => 'firstname', 'width' => '100', 'align' => 'left'), array('name' => 'lastname', 'index' => 'lastname', 'width' => '100', 'align' => 'left'), array('name' => 'start_date', 'index' => 'start_date', 'width' => '100', 'align' => 'left'), array('name' => 'question', 'index' => 'count_questions', 'width' => '60', 'align' => 'left', 'sortable' => 'false'), array('name' => 'score', 'index' => 'score', 'width' => '50', 'align' => 'left', 'sortable' => 'false'));
//Autowidth
$extra_params['autowidth'] = 'true';
//height auto
$extra_params['height'] = 'auto';
?>
<script>

function refreshGrid() {
    var grid = $("#live_stats");
    grid.trigger("reloadGrid");
    t = setTimeout("refreshGrid()", 10000);
}

$(function() {
    <?php 
echo Display::grid_js('live_stats', $url, $columns, $column_model, $extra_params, array(), null, true);
?>
    refreshGrid();
});
</script>
<?php 
$actions = '<a href="exercise_report.php?exerciseId=' . intval($_GET['exerciseId']) . '&' . api_get_cidreq() . '">' . Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM) . '</a>';
echo $actions = Display::div($actions, array('class' => 'actions'));
echo Display::grid_html('live_stats');
Display::display_footer();
コード例 #9
0
$interbreadcrumb[] = array('url' => 'exercise_report.php' . '?filter=2', 'name' => get_lang('StudentScore'));
$interbreadcrumb[] = array('url' => 'exercise_history.php' . '?exe_id=' . intval($_GET['exe_id']), 'name' => get_lang('Details'));
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_EXERCICES_QUESTION = Database::get_course_table(TABLE_QUIZ_QUESTION);
$TBL_TRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_ATTEMPT_RECORDING = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
Display::display_header($nameTools, get_lang('Exercise'));
if (isset($_GET['message'])) {
    if (in_array($_GET['message'], array('ExerciseEdited'))) {
        $my_message_history = Security::remove_XSS($_GET['message']);
        Display::display_confirmation_message(get_lang($my_message_history));
    }
}
echo '<div class="actions">';
echo '<a href="exercise_report.php?' . api_get_cidreq() . '&filter=2">' . Display::return_icon('back.png', get_lang('BackToResultList'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
?>

<table class="data_table">
	<tr class="row_odd">
		<th><?php 
echo get_lang('Question');
?>
</th>
		<th width="50px"><?php 
echo get_lang('Value');
?>
</th>
		<th><?php 
echo get_lang('Feedback');
コード例 #10
0
                    }
                }
            });
    });
});
</script>';
if (isset($_GET['chatid']) && !empty($_GET['chatid'])) {
    //send out call request
    $time = time();
    $time = date("Y-m-d H:i:s", $time);
    $chatid = intval($_GET['chatid']);
    if ($_GET['chatid'] == strval(intval($_GET['chatid']))) {
        $sql = "UPDATE {$track_user_table} SET chatcall_user_id = '" . Database::escape_string($_user['user_id']) . "', chatcall_date = '" . Database::escape_string($time) . "', chatcall_text = '' where (user_id = " . (int) Database::escape_string($chatid) . ")";
        $result = Database::query($sql);
        //redirect caller to chat
        header("Location: " . api_get_path(WEB_CODE_PATH) . "chat/chat.php?" . api_get_cidreq() . "&origin=whoisonline&target=" . Security::remove_XSS($chatid));
        exit;
    }
}
$social_right_content = null;
// This if statement prevents users accessing the who's online feature when it has been disabled.
if (api_get_setting('showonline', 'world') == 'true' && !$_user['user_id'] || (api_get_setting('showonline', 'users') == 'true' || api_get_setting('showonline', 'course') == 'true') && $_user['user_id']) {
    if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
        $user_list = Online::who_is_online_in_this_course(0, 9, api_get_user_id(), api_get_setting('time_limit_whosonline'), $_GET['cidReq']);
    } else {
        $user_list = Online::who_is_online(0, 9);
    }
    if (!isset($_GET['id'])) {
        if (api_get_setting('allow_social_tool') == 'true') {
            if (!api_is_anonymous()) {
                //this include the social menu div
コード例 #11
0
 public static function getMediaLabels()
 {
     // Shows media questions
     $courseMedias = Question::prepare_course_media_select(api_get_course_int_id());
     $labels = null;
     if (!empty($courseMedias)) {
         $labels .= get_lang('MediaQuestions') . '<br />';
         foreach ($courseMedias as $mediaId => $media) {
             $editLink = '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&type=' . MEDIA_QUESTION . '&myid=1&editQuestion=' . $mediaId . '">' . Display::return_icon('edit.png', get_lang('Modify'), array(), ICON_SIZE_SMALL) . '</a>';
             $deleteLink = '<a id="delete_' . $mediaId . '" class="opener"  href="' . api_get_self() . '?' . api_get_cidreq() . '&deleteQuestion=' . $mediaId . '" >' . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
             if (!empty($mediaId)) {
                 $labels .= self::getMediaLabel($media) . '' . $editLink . $deleteLink . '<br />';
             }
         }
     }
     return $labels;
 }
コード例 #12
0
/**
 * Handles a given Excel spreadsheets as in the template provided
 */
function lp_upload_quiz_action_handling()
{
    global $debug;
    $_course = api_get_course_info();
    $courseId = $_course['real_id'];
    if (!isset($_POST['submit_upload_quiz'])) {
        return;
    }
    // Get the extension of the document.
    $path_info = pathinfo($_FILES['user_upload_quiz']['name']);
    // Check if the document is an Excel document
    if ($path_info['extension'] != 'xls') {
        return;
    }
    // Read the Excel document
    $data = new Spreadsheet_Excel_Reader();
    // Set output Encoding.
    $data->setOutputEncoding(api_get_system_encoding());
    // Reading the xls document.
    $data->read($_FILES['user_upload_quiz']['tmp_name']);
    $correctScore = isset($_POST['correct_score']) ? $_POST['correct_score'] : null;
    $incorrectScore = isset($_POST['incorrect_score']) ? $_POST['incorrect_score'] : null;
    $useCustomScore = isset($_POST['user_custom_score']) ? true : false;
    $propagateNegative = 0;
    if ($useCustomScore && !empty($incorrectScore)) {
        if ($incorrectScore < 0) {
            $propagateNegative = 1;
        }
    }
    // Variables
    $quiz_index = 0;
    $question_title_index = array();
    $question_name_index_init = array();
    $question_name_index_end = array();
    $score_index = array();
    $feedback_true_index = array();
    $feedback_false_index = array();
    $number_questions = 0;
    $question_description_index = array();
    // Reading all the first column items sequentially to create breakpoints
    for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
        if ($data->sheets[0]['cells'][$i][1] == 'Quiz' && $i == 1) {
            $quiz_index = $i;
            // Quiz title position, only occurs once
        } elseif ($data->sheets[0]['cells'][$i][1] == 'Question') {
            $question_title_index[] = $i;
            // Question title position line
            $question_name_index_init[] = $i + 1;
            // Questions name 1st position line
            $number_questions++;
        } elseif ($data->sheets[0]['cells'][$i][1] == 'Score') {
            $question_name_index_end[] = $i - 1;
            // Question name position
            $score_index[] = $i;
            // Question score position
        } elseif ($data->sheets[0]['cells'][$i][1] == 'FeedbackTrue') {
            $feedback_true_index[] = $i;
            // FeedbackTrue position (line)
        } elseif ($data->sheets[0]['cells'][$i][1] == 'FeedbackFalse') {
            $feedback_false_index[] = $i;
            // FeedbackFalse position (line)
        } elseif ($data->sheets[0]['cells'][$i][1] == 'EnrichQuestion') {
            $question_description_index[] = $i;
        }
    }
    // Variables
    $quiz = array();
    $question = array();
    $new_answer = array();
    $score_list = array();
    $feedback_true_list = array();
    $feedback_false_list = array();
    $question_description = array();
    // Getting questions.
    $k = $z = $q = $l = $m = 0;
    for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
        if (is_array($data->sheets[0]['cells'][$i])) {
            $column_data = $data->sheets[0]['cells'][$i];
            // Fill all column with data to have a full array
            for ($x = 1; $x <= $data->sheets[0]['numCols']; $x++) {
                if (empty($column_data[$x])) {
                    $data->sheets[0]['cells'][$i][$x] = '';
                }
            }
            // Array filled with data
            $column_data = $data->sheets[0]['cells'][$i];
        } else {
            $column_data = '';
        }
        // Fill quiz data
        if ($quiz_index == $i) {
            // The title always in the first position
            $quiz = $column_data;
        } elseif (in_array($i, $question_title_index)) {
            //a complete line where 1st column is 'Question'
            $question[$k] = $column_data;
            $k++;
        } elseif (in_array($i, $score_index)) {
            //a complete line where 1st column is 'Score'
            $score_list[$z] = $column_data;
            $z++;
        } elseif (in_array($i, $feedback_true_index)) {
            //a complete line where 1st column is 'FeedbackTrue'
            $feedback_true_list[$q] = $column_data;
            $q++;
        } elseif (in_array($i, $feedback_false_index)) {
            //a complete line where 1st column is 'FeedbackFalse' for wrong answers
            $feedback_false_list[$l] = $column_data;
            $l++;
        } elseif (in_array($i, $question_description_index)) {
            //a complete line where 1st column is 'EnrichQuestion'
            $question_description[$m] = $column_data;
            $m++;
        }
    }
    // Get answers
    for ($i = 0; $i < count($question_name_index_init); $i++) {
        for ($j = $question_name_index_init[$i]; $j <= $question_name_index_end[$i]; $j++) {
            if (is_array($data->sheets[0]['cells'][$j])) {
                $column_data = $data->sheets[0]['cells'][$j];
                // Fill all column with data
                for ($x = 1; $x <= $data->sheets[0]['numCols']; $x++) {
                    if (empty($column_data[$x])) {
                        $data->sheets[0]['cells'][$j][$x] = '';
                    }
                }
                $column_data = $data->sheets[0]['cells'][$j];
                // Array filled of data
                if (is_array($data->sheets[0]['cells'][$j]) && count($data->sheets[0]['cells'][$j]) > 0) {
                    $new_answer[$i][$j] = $data->sheets[0]['cells'][$j];
                }
            }
        }
    }
    // Quiz title.
    $quiz_title = $quiz[2];
    if ($quiz_title != '') {
        // Variables
        $type = 2;
        $random = $active = $results = $max_attempt = $expired_time = 0;
        // Make sure feedback is enabled (3 to disable), otherwise the fields
        // added to the XLS are not shown, which is confusing
        $feedback = 0;
        // Quiz object
        $exercise = new Exercise();
        //
        $quiz_id = $exercise->createExercise($quiz_title, $expired_time, $type, $random, $active, $results, $max_attempt, $feedback, $propagateNegative);
        if ($quiz_id) {
            // insert into the item_property table
            api_item_property_update($_course, TOOL_QUIZ, $quiz_id, 'QuizAdded', api_get_user_id());
            // Import questions.
            for ($i = 0; $i < $number_questions; $i++) {
                // Question name
                $question_title = $question[$i][2];
                $question_description_text = "<p></p>";
                if (isset($question_description[$i][2])) {
                    // Question description.
                    $question_description_text = "<p>" . $question_description[$i][2] . "</p>";
                }
                // Unique answers are the only question types available for now
                // through xls-format import
                $question_id = null;
                $detectQuestionType = detectQuestionType($new_answer[$i], $score_list);
                /** @var Question $answer */
                switch ($detectQuestionType) {
                    case FREE_ANSWER:
                        $answer = new FreeAnswer();
                        break;
                    case GLOBAL_MULTIPLE_ANSWER:
                        $answer = new GlobalMultipleAnswer();
                        break;
                    case MULTIPLE_ANSWER:
                        $answer = new MultipleAnswer();
                        break;
                    case UNIQUE_ANSWER:
                    default:
                        $answer = new UniqueAnswer();
                        break;
                }
                if ($question_title != '') {
                    $question_id = $answer->create_question($quiz_id, $question_title, $question_description_text, 0, $answer->type);
                }
                $total = 0;
                if (is_array($new_answer[$i]) && !empty($question_id)) {
                    $id = 1;
                    $answers_data = $new_answer[$i];
                    $globalScore = null;
                    $objAnswer = new Answer($question_id, $courseId);
                    $globalScore = $score_list[$i][3];
                    // Calculate the number of correct answers to divide the
                    // score between them when importing from CSV
                    $numberRightAnswers = 0;
                    foreach ($answers_data as $answer_data) {
                        if (strtolower($answer_data[3]) == 'x') {
                            $numberRightAnswers++;
                        }
                    }
                    foreach ($answers_data as $answer_data) {
                        $answerValue = $answer_data[2];
                        $correct = 0;
                        $score = 0;
                        if (strtolower($answer_data[3]) == 'x') {
                            $correct = 1;
                            $score = $score_list[$i][3];
                            $comment = $feedback_true_list[$i][2];
                        } else {
                            $comment = $feedback_false_list[$i][2];
                            $floatVal = (double) $answer_data[3];
                            if (is_numeric($floatVal)) {
                                $score = $answer_data[3];
                            }
                        }
                        if ($useCustomScore) {
                            if ($correct) {
                                $score = $correctScore;
                            } else {
                                $score = $incorrectScore;
                            }
                        }
                        // Fixing scores:
                        switch ($detectQuestionType) {
                            case GLOBAL_MULTIPLE_ANSWER:
                                $score /= $numberRightAnswers;
                                break;
                            case UNIQUE_ANSWER:
                                break;
                            case MULTIPLE_ANSWER:
                                if (!$correct) {
                                    //$total = $total - $score;
                                }
                                break;
                        }
                        $objAnswer->createAnswer($answerValue, $correct, $comment, $score, $id);
                        $total += $score;
                        $id++;
                    }
                    $objAnswer->save();
                    $questionObj = Question::read($question_id, $courseId);
                    switch ($detectQuestionType) {
                        case GLOBAL_MULTIPLE_ANSWER:
                            $questionObj->updateWeighting($globalScore);
                            break;
                        case UNIQUE_ANSWER:
                        case MULTIPLE_ANSWER:
                        default:
                            $questionObj->updateWeighting($total);
                            break;
                    }
                    $questionObj->save();
                } else {
                    if ($detectQuestionType === FREE_ANSWER) {
                        $questionObj = Question::read($question_id, $courseId);
                        $globalScore = $score_list[$i][3];
                        $questionObj->updateWeighting($globalScore);
                        $questionObj->save();
                    }
                }
            }
        }
        if (isset($_SESSION['lpobject'])) {
            if ($debug > 0) {
                error_log('New LP - SESSION[lpobject] is defined', 0);
            }
            $oLP = unserialize($_SESSION['lpobject']);
            if (is_object($oLP)) {
                if ($debug > 0) {
                    error_log('New LP - oLP is object', 0);
                }
                if (empty($oLP->cc) or $oLP->cc != api_get_course_id()) {
                    if ($debug > 0) {
                        error_log('New LP - Course has changed, discard lp object', 0);
                    }
                    $oLP = null;
                    Session::erase('oLP');
                    Session::erase('lpobject');
                } else {
                    $_SESSION['oLP'] = $oLP;
                }
            }
        }
        if (isset($_SESSION['oLP']) && isset($_GET['lp_id'])) {
            $previous = $_SESSION['oLP']->select_previous_item_id();
            $parent = 0;
            // Add a Quiz as Lp Item
            $_SESSION['oLP']->add_item($parent, $previous, TOOL_QUIZ, $quiz_id, $quiz_title, '');
            // Redirect to home page for add more content
            header('location: ../newscorm/lp_controller.php?' . api_get_cidreq() . '&action=add_item&type=step&lp_id=' . Security::remove_XSS($_GET['lp_id']));
            exit;
        } else {
            //  header('location: exercise.php?' . api_get_cidreq());
            echo '<script>window.location.href = "' . api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidReq() . '&exerciseId=' . $quiz_id . '&session_id=' . api_get_session_id() . '"</script>';
        }
    }
}
コード例 #13
0
ファイル: delete_course.php プロジェクト: ragebat/chamilo-lms
$this_section = SECTION_COURSES;
$current_course_tool = TOOL_COURSE_MAINTENANCE;
api_protect_course_script(true);
$_course = api_get_course_info();
$current_course_code = $_course['official_code'];
$current_course_name = $_course['name'];
if (!api_is_allowed_to_edit()) {
    api_not_allowed(true);
}
$tool_name = get_lang('DelCourse');
if (isset($_GET['delete']) && $_GET['delete'] == 'yes') {
    CourseManager::delete_course($_course['sysCode']);
    $obj_cat = new Category();
    $obj_cat->update_category_delete($_course['sysCode']);
    // DELETE CONFIRMATION MESSAGE
    Session::erase('_cid');
    Session::erase('_real_cid');
    $noPHP_SELF = true;
    $message = '<h2>' . get_lang('Course') . ' : ' . $current_course_name . ' (' . $current_course_code . ') </h2>';
    $message .= get_lang('HasDel');
    $message .= '<br /><br /><a href="../../index.php">' . get_lang('BackHome') . ' ' . api_get_setting('platform.site_name') . '</a>';
} else {
    $message = '<h3>' . get_lang('Course') . ' : ' . $current_course_name . ' (' . $current_course_code . ') </h3>';
    $message .= '<p>' . get_lang('ByDel') . '</p>';
    $message .= '<p><a class="btn btn-primary" href="' . api_get_path(WEB_CODE_PATH) . 'course_info/maintenance.php?' . api_get_cidreq() . '">' . get_lang('No') . '</a>&nbsp;<a class="btn" href="' . api_get_self() . '?delete=yes&' . api_get_cidreq() . '">' . get_lang('Yes') . '</a></p>';
    $interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance'));
}
Display::display_header($tool_name, 'Settings');
echo Display::page_header($tool_name);
Display::display_warning_message($message, false);
Display::display_footer();
コード例 #14
0
ファイル: learnpath.class.php プロジェクト: Eidn/shanghai
    /**
     * Creates a link to surveys with contextual JS list with all the surveys in it
     *
     * @modified 2010.10.12 - adding css classes and simple a tag
     * @return string
     */
    function get_survey()
    {
        global $charset;
        $table_survey = Database::get_course_table(TABLE_SURVEY);
        $survey_lang_var = api_convert_encoding(get_lang('Survey'), $charset, api_get_system_encoding());
        $newsurvey_lang_var = api_convert_encoding(get_lang('CreateANewSurvey'), $charset, api_get_system_encoding());
        $close_lang_var = api_convert_encoding(get_lang('Close'), $charset, api_get_system_encoding());
        $return = '<a href="#" onclick="javascript:popup(\'popUpDiv4\');" class="big_button four_buttons rounded grey_border survey_button">' . $survey_lang_var . '</a>';
        $return .= '<div id="popUpDiv4" class="author_popup gradient rounded_10 grey_border" style="display:none;">' . '<span class="title">' . $survey_lang_var . '</span>' . '<a href="#" class="close" onclick="javascript:popup(\'popUpDiv4\');">' . $close_lang_var . '</a>';
        $return .= '<div id="resDoc" class="content">';
        $add_condition = "";
        if (api_is_allowed_to_edit()) {
            $add_condition = " AND author = '" . api_get_user_id() . "' ";
        }
        $sql = "SELECT survey_id,title FROM {$table_survey} WHERE session_id = '" . api_get_session_id() . "' {$add_condition}";
        $rs = Database::query($sql, __FILE__, __LINE__);
        $a_survey = array();
        while ($row = Database::fetch_array($rs)) {
            $a_survey[] = $row;
        }
        foreach ($a_survey as $survey) {
            $return .= '<div class="lp_resource_element">';
            if (!empty($survey['survey_id'])) {
                $return .= '<img alt="" src="../img/survey_little.png" style="margin-right:5px;" title="" />';
                $return .= '<a style="cursor:hand" style="vertical-align:middle"></a>
									<a href="' . api_get_self() . '?cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&amp;action=add_item&amp;type=' . TOOL_SURVEY . '&amp;survey_id=' . $survey['survey_id'] . '&amp;lp_id=' . $this->lp_id . '" style="vertical-align:middle">' . api_convert_encoding($survey['title'], $charset, api_get_system_encoding()) . '</a>';
            }
            $return .= '</div>';
        }
        $return .= '<br/>';
        $return .= '<div class="lp_resource_element">';
        $return .= Display::return_icon('pixel.gif', '', array('class' => 'actionplaceholdericon actionnewlist', 'style' => 'margin-right:5px;', 'title' => ''));
        $return .= '<a href="' . api_get_path(REL_CODE_PATH) . 'survey/create_new_survey.php?' . api_get_cidreq() . '&action=add&lp_id=' . $this->lp_id . '" title="' . $newsurvey_lang_var . '">' . $newsurvey_lang_var . '</a>';
        $return .= '</div>';
        $return .= '</div>';
        $return .= '</div>';
        return $return;
    }
コード例 #15
0
    static function display_notes()
    {

        global $_user;
        if (!$_GET['direction']) {
            $sort_direction = 'ASC';
            $link_sort_direction = 'DESC';
        } elseif ($_GET['direction'] == 'ASC') {
            $sort_direction = 'ASC';
            $link_sort_direction = 'DESC';
        } else {
            $sort_direction = 'DESC';
            $link_sort_direction = 'ASC';
        }

        // action links
        echo '<div class="actions">';
        if (!api_is_anonymous()) {
            if (api_get_session_id() == 0)
                echo '<a href="index.php?' . api_get_cidreq() . '&amp;action=addnote">' . Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
            elseif (api_is_allowed_to_session_edit(false, true)) {
                echo '<a href="index.php?' . api_get_cidreq() . '&amp;action=addnote">' . Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
            }
        } else {
            echo '<a href="javascript:void(0)">' . Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
        }

        echo '<a href="index.php?' . api_get_cidreq() . '&amp;action=changeview&amp;view=creation_date&amp;direction=' . $link_sort_direction . '">' . Display::return_icon('notes_order_by_date_new.png', get_lang('OrderByCreationDate'), '', '32') . '</a>';
        echo '<a href="index.php?' . api_get_cidreq() . '&amp;action=changeview&amp;view=update_date&amp;direction=' . $link_sort_direction . '">' . Display::return_icon('notes_order_by_date_mod.png', get_lang('OrderByModificationDate'), '', '32') . '</a>';
        echo '<a href="index.php?' . api_get_cidreq() . '&amp;action=changeview&amp;view=title&amp;direction=' . $link_sort_direction . '">' . Display::return_icon('notes_order_by_title.png', get_lang('OrderByTitle'), '', '32') . '</a>';
        echo '</div>';

        if (!in_array($_SESSION['notebook_view'], array('creation_date', 'update_date', 'title'))) {
            $_SESSION['notebook_view'] = 'creation_date';
        }

        // Database table definition
        $t_notebook = Database :: get_course_table(TABLE_NOTEBOOK);
        $order_by = "";
        if ($_SESSION['notebook_view'] == 'creation_date' || $_SESSION['notebook_view'] == 'update_date') {
            $order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction ";
        } else {
            $order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction ";
        }

        //condition for the session
        $session_id = api_get_session_id();
        $condition_session = api_get_session_condition($session_id);

        $cond_extra = ($_SESSION['notebook_view'] == 'update_date') ? " AND update_date <> '0000-00-00 00:00:00'" : " ";
        $course_id = api_get_course_int_id();

        $sql = "SELECT * FROM $t_notebook WHERE c_id = $course_id AND user_id = '" . api_get_user_id() . "' $condition_session $cond_extra $order_by";
        $result = Database::query($sql);
        while ($row = Database::fetch_array($result)) {
            //validacion when belongs to a session
            $session_img = api_get_session_image($row['session_id'], $_user['status']);
            $creation_date = api_get_local_time($row['creation_date'], null, date_default_timezone_get());
            $update_date = api_get_local_time($row['update_date'], null, date_default_timezone_get());
            echo '<div class="sectiontitle">';
            echo '<span style="float: right;"> (' . get_lang('CreationDate') . ': ' . date_to_str_ago($creation_date) . '&nbsp;&nbsp;<span class="dropbox_date">' . $creation_date . '</span>';
            if ($row['update_date'] <> $row['creation_date']) {
                echo ', ' . get_lang('UpdateDate') . ': ' . date_to_str_ago($update_date) . '&nbsp;&nbsp;<span class="dropbox_date">' . $update_date . '</span>';
            }
            echo ')</span>';
            echo $row['title'] . $session_img;
            echo '</div>';
            echo '<div class="sectioncomment">' . $row['description'] . '</div>';
            echo '<div>';
            echo '<a href="' . api_get_self() . '?action=editnote&amp;notebook_id=' . $row['notebook_id'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>';
            echo '<a href="' . api_get_self() . '?action=deletenote&amp;notebook_id=' . $row['notebook_id'] . '" onclick="return confirmation(\'' . $row['title'] . '\');">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
            echo '</div>';
        }
    }
コード例 #16
0
// protect a course script
api_protect_course_script(true);
// error messages
if ($error) {
    Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false);
}
$param_gradebook = '';
if (isset($_SESSION['gradebook'])) {
    $param_gradebook = '&gradebook=' . Security::remove_XSS($_SESSION['gradebook']);
}
if (!$error) {
    $token = Security::get_token();
}
$attendance_weight = floatval($attendance_weight);
// display form
$form = new FormValidator('attendance_edit', 'POST', 'index.php?action=attendance_edit&' . api_get_cidreq() . '&attendance_id=' . $attendance_id . $param_gradebook);
$form->addElement('header', '', get_lang('Edit'));
$form->addElement('hidden', 'sec_token', $token);
$form->addElement('hidden', 'attendance_id', $attendance_id);
$form->add_textfield('title', get_lang('Title'), true, array('size' => '50'));
$form->applyFilter('title', 'html_filter');
$form->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '200'));
// Adavanced Parameters
if (Gradebook::is_active()) {
    if (!empty($attendance_qualify_title) || !empty($attendance_weight)) {
        $form->addElement('advanced_settings', 'id_qualify', get_lang('AdvancedParameters'));
        $form->addElement('html', '<div id="id_qualify_options" style="display:block">');
        $form->addElement('checkbox', 'attendance_qualify_gradebook', '', get_lang('QualifyAttendanceGradebook'), array('checked' => 'true', 'onclick' => 'javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}'));
        $form->addElement('html', '<div id="options_field" style="display:block">');
    } else {
        $form->addElement('advanced_settings', 'id_qualify', get_lang('AdvancedParameters'));
コード例 #17
0
ファイル: courseLog.php プロジェクト: annickvdp/Chamilo1.9.10
if (isset($_GET['users_tracking_per_page'])) {
    $users_tracking_per_page= '&users_tracking_per_page='.intval($_GET['users_tracking_per_page']);
}
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&export=csv&'.$addional_param.$users_tracking_per_page.'">
     '.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';

echo '</span>';
echo '</div>';


echo '<div class="actions">';
// Create a search-box.
$form_search = new FormValidator(
    'search_simple',
    'GET',
    api_get_path(WEB_CODE_PATH).'tracking/courseLog.php?'.api_get_cidreq(),
    '',
    array('class' => 'form-search'),
    false
);
$renderer = $form_search->defaultRenderer();
$renderer->setElementTemplate('<span>{element}</span>');
$form_search->addElement('hidden', 'from', Security::remove_XSS($from));
$form_search->addElement('hidden', 'session_id', $sessionId);
$form_search->addElement('hidden', 'id_session', $sessionId);
$form_search->addElement('text', 'user_keyword');
$form_search->addElement('style_submit_button', 'submit', get_lang('SearchUsers'), 'class="search"');
$form_search->display();
echo '</div>';

$course_name = get_lang('Course').' '.$courseInfo['name'];
コード例 #18
0
    echo '<div class="actions" style ="font-size:10pt;" >';
    if ($global) {
        $menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . "auth/my_progress.php");
        $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32), api_get_path(WEB_CODE_PATH) . 'mySpace/?view=teacher');
        $menu_items[] = Display::return_icon('star_na.png', get_lang('AdminInterface'), array(), 32);
        $menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH) . 'tracking/exams.php');
        $nb_menu_items = count($menu_items);
        if ($nb_menu_items > 1) {
            foreach ($menu_items as $key => $item) {
                echo $item;
            }
        }
    } else {
        echo '<div style="float:left; clear:left">
				<a href="courseLog.php?' . api_get_cidreq() . '&studentlist=true">' . get_lang('StudentsTracking') . '</a>&nbsp;|
				<a href="courseLog.php?' . api_get_cidreq() . '&studentlist=false">' . get_lang('CourseTracking') . '</a>&nbsp;';
        echo '</div>';
    }
    echo '</div>';
    if (api_is_platform_admin()) {
        echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/?view=admin&amp;display=coaches">' . get_lang('DisplayCoaches') . '</a> | ';
        echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/?view=admin&amp;display=useroverview">' . get_lang('DisplayUserOverview') . '</a>';
        echo ' | <a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/?view=admin&amp;display=sessionoverview">' . get_lang('DisplaySessionOverview') . '</a>';
        echo ' | <a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/?view=admin&amp;display=courseoverview">' . get_lang('DisplayCourseOverview') . '</a>';
        echo ' | ' . get_lang('LPQuestionListResults');
        echo ' | <a href="' . api_get_path(WEB_CODE_PATH) . 'tracking/course_session_report.php?view=admin">' . get_lang('LPExerciseResultsBySession') . '</a>';
    }
    echo '<br />';
    echo '<h2>' . get_lang('LPQuestionListResults') . '</h2>';
    $form->display();
    //Display::display_normal_message(get_lang('QuestionsAreTakenFromLPExercises'));
コード例 #19
0
ファイル: work.ajax.php プロジェクト: omaoibrahim/chamilo-lms
     $result = array();
     if (!empty($_FILES) && !empty($itemId)) {
         $file = $_FILES['file'];
         $courseInfo = api_get_course_info();
         $workInfo = get_work_data_by_id($itemId);
         $workInfoParent = get_work_data_by_id($workInfo['parent_id']);
         $resultUpload = uploadWork($workInfoParent, $courseInfo, true, $workInfo);
         $work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
         if (isset($resultUpload['url']) && !empty($resultUpload['url'])) {
             $title = isset($resultUpload['filename']) && !empty($resultUpload['filename']) ? $resultUpload['filename'] : get_lang('Untitled');
             $url = Database::escape_string($resultUpload['url']);
             $title = Database::escape_string($title);
             $sql = "UPDATE {$work_table} SET\n                            url_correction = '" . $url . "',\n                            title_correction = '" . $title . "'\n                        WHERE iid = {$itemId}";
             Database::query($sql);
             $result['title'] = $resultUpload['filename'];
             $result['url'] = 'view.php?' . api_get_cidreq() . '&id=' . $itemId;
             $json = array();
             $json['name'] = Display::url(api_htmlentities($result['title']), api_htmlentities($result['url']), array('target' => '_blank'));
             $json['type'] = api_htmlentities($file['type']);
             $json['size'] = format_file_size($file['size']);
         }
         if (isset($result['url'])) {
             $json['result'] = Display::return_icon('accept.png', get_lang('Uploaded'));
         } else {
             $json['result'] = Display::return_icon('exclamation.png', get_lang('Error'));
         }
         echo json_encode($json);
     }
     break;
 default:
     echo '';
コード例 #20
0
    echo '<a href="admin.php?' . api_get_cidreq() . '&exerciseId=' . $objExercise->id . '">' . Display::return_icon('back.png', get_lang('GoBackToQuestionList'), array(), 32) . '</a>';
    echo '<a href="exercise_admin.php?' . api_get_cidreq() . '&modifyExercise=yes&exerciseId=' . $objExercise->id . '">' . Display::return_icon('edit.png', get_lang('ModifyExercise'), array(), 32) . '</a>';
    echo '</div>';
}
$feedback_type = $objExercise->feedback_type;
$exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id);
if (!empty($exercise_stat_info['data_tracking'])) {
    $question_list = explode(',', $exercise_stat_info['data_tracking']);
}
$learnpath_id = $exercise_stat_info['orig_lp_id'];
$learnpath_item_id = $exercise_stat_info['orig_lp_item_id'];
$learnpath_item_view_id = $exercise_stat_info['orig_lp_item_view_id'];
if ($origin == 'learnpath') {
    ?>
	<form method="GET" action="exercise.php?<?php 
    echo api_get_cidreq();
    ?>
">
	<input type="hidden" name="origin" value="<?php 
    echo $origin;
    ?>
" />
    <input type="hidden" name="learnpath_id" value="<?php 
    echo $learnpath_id;
    ?>
" />
    <input type="hidden" name="learnpath_item_id" 		value="<?php 
    echo $learnpath_item_id;
    ?>
" />
    <input type="hidden" name="learnpath_item_view_id"  value="<?php 
コード例 #21
0
ファイル: feedback.php プロジェクト: annickvdp/Chamilo1.9.10
?>
</h4>
<?php 
$id = $_REQUEST['question'];
$objQuestionTmp = Question::read($id);
echo "<tr><td><b>" . get_lang('Question') . " : </b>";
echo $objQuestionTmp->selectTitle();
echo "</td></tr>";
echo " <br><tr><td><b><br>" . get_lang('Answer') . " : </b></td></tr>";
$objAnswerTmp = new Answer($id);
$num = $objAnswerTmp->selectNbrAnswers();
$objAnswerTmp->read();
for ($i = 1; $i <= $num; $i++) {
    echo "<tr><td width='10%'> ";
    $ans = $objAnswerTmp->answer[$i];
    $form = new FormValidator('feedbackform', 'post', api_get_self() . "?" . api_get_cidreq() . "&modifyQuestion=" . $modifyQuestion . "&newQuestion=" . $newQuestion);
    $obj_registration_form = new HTML_QuickForm('frmRegistration', 'POST');
    $renderer =& $obj_registration_form->defaultRenderer();
    $renderer->setElementTemplate('<tr>
	<td align="left" style="" valign="top" width=30%>{label}
		<!-- BEGIN required --><span style="color: #ff0000">*</span><!-- END required -->
	</td>
	<td align="left" width=70%>{element}
		<!-- BEGIN error --><br /><span style="color: #ff0000;font-size:10px">{error}</span><!-- END error -->
	</td>
</tr>');
    $form->add_html_editor('Feedback', $i . '.' . $ans, false, false, array('ToolbarSet' => 'TestAnswerFeedback', 'Width' => '600', 'Height' => '200'));
    $form->display();
    echo "</td>";
}
?>
コード例 #22
0
ファイル: student_work.php プロジェクト: ragebat/chamilo-lms
        $table->setCellAttributes($row, $column, array('width' => '300px'));
        $column++;
        $table->setCellContents($row, $column, $userResult['sent_date']);
        $column++;
        $dateQualification = !empty($workExtraData['expires_on']) && $workExtraData['expires_on'] != '0000-00-00 00:00:00' ? api_get_local_time($workExtraData['expires_on']) : '-';
        $table->setCellContents($row, $column, $dateQualification);
        $column++;
        $score = '-';
        if (!empty($scoreWeight)) {
            $score = strip_tags($userResult['qualification']) . "/" . $scoreWeight;
        }
        $table->setCellContents($row, $column, $score);
        $column++;
        // Actions
        $links = null;
        // is a text
        $url = api_get_path(WEB_CODE_PATH) . 'work/view.php?' . api_get_cidreq() . '&id=' . $userResult['id'];
        $links .= Display::url(Display::return_icon('default.png'), $url);
        if (!empty($userResult['url'])) {
            $url = api_get_path(WEB_CODE_PATH) . 'work/download.php?' . api_get_cidreq() . '&id=' . $userResult['id'];
            $links .= Display::url(Display::return_icon('save.png', get_lang('Download')), $url);
        }
        $url = api_get_path(WEB_CODE_PATH) . 'work/edit.php?' . api_get_cidreq() . '&item_id=' . $userResult['id'] . '&id=' . $workId . '&parent_id=' . $workId;
        $links .= Display::url(Display::return_icon('edit.png', get_lang('Comment')), $url);
        $table->setCellContents($row, $column, $links);
        $row++;
        $column = 0;
    }
}
echo $table->toHtml();
Display::display_footer();
コード例 #23
0
 /**
  * Update action icons column
  *
  * @param integer $glossary_id
  * @param array   Parameters to use to affect links
  * @param array   The line of results from a query on the glossary table
  * @return string HTML string for the action icons columns
  *
  * @author Patrick Cool <*****@*****.**>, Ghent University, Belgium
  * @version januari 2009, dokeos 1.8.6
  */
 public static function actions_filter($glossary_id, $url_params, $row)
 {
     $glossary_id = $row[2];
     $return = '<a href="' . api_get_self() . '?action=edit_glossary&amp;glossary_id=' . $glossary_id . '&' . api_get_cidreq() . '&msg=edit">' . Display::return_icon('edit.png', get_lang('Edit'), '', 22) . '</a>';
     $glossary_data = GlossaryManager::get_glossary_information($glossary_id);
     $glossary_term = $glossary_data['glossary_title'];
     if (api_is_allowed_to_edit(null, true)) {
         if ($glossary_data['session_id'] == api_get_session_id()) {
             $return .= '<a href="' . api_get_self() . '?action=delete_glossary&amp;glossary_id=' . $glossary_id . '&' . api_get_cidreq() . '" onclick="return confirmation(\'' . $glossary_term . '\');">' . Display::return_icon('delete.png', get_lang('Delete'), '', 22) . '</a>';
         } else {
             $return = get_lang('EditionNotAvailableFromSession');
         }
     }
     return $return;
 }
コード例 #24
0
                Database::query("UPDATE {$doc_table} SET" . substr($ct, 1) . " WHERE c_id = {$course_id} AND id = '{$document_id}'");
            }
            $dir = substr($dir, 0, -1);
            $selectcat = '';
            if (isset($_REQUEST['selectcat'])) {
                $selectcat = "&selectcat=" . Security::remove_XSS($_REQUEST['selectcat']);
            }
            $certificate_condition = '';
            if ($is_certificate_mode) {
                $df = DocumentManager::get_default_certificate_id($_course['code']);
                if (!isset($df)) {
                    DocumentManager::attach_gradebook_certificate($_course['code'], $document_id);
                }
                $certificate_condition = '&certificate=true';
            }
            header('Location: document.php?' . api_get_cidreq() . '&id=' . $folder_id . $selectcat . $certificate_condition);
            exit;
        } else {
            Display::display_header($nameTools, 'Doc');
            Display::display_error_message(get_lang('Impossible'));
            Display::display_footer();
        }
    } else {
        Display::display_header($nameTools, 'Doc');
        Display::display_error_message(get_lang('Impossible'));
        Display::display_footer();
    }
} else {
    // Interbreadcrumb for the current directory root path
    // Copied from document.php
    $dir_array = explode('/', $dir);
コード例 #25
0
$form->addElement('hidden', 'action', 'add_lp_category');
$form->addElement('hidden', 'c_id', api_get_course_int_id());
$form->addElement('hidden', 'id', 0);
$form->addButtonSave(get_lang('Save'));
if ($form->validate()) {
    $values = $form->getSubmitValues();
    if (!empty($values['id'])) {
        learnpath::updateCategory($values);
        $url = api_get_self() . '?action=list&' . api_get_cidreq();
        header('Location: ' . $url);
        exit;
    } else {
        learnpath::createCategory($values);
        $url = api_get_self() . '?action=list&' . api_get_cidreq();
        header('Location: ' . $url);
        exit;
    }
} else {
    $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
    if ($id) {
        $item = learnpath::getCategory($id);
        $defaults = array('id' => $item->getId(), 'name' => $item->getName());
        $form->setDefaults($defaults);
    }
}
Display::display_header(get_lang('LearnpathAddLearnpath'), 'Path');
echo '<div class="actions">';
echo '<a href="lp_controller.php?' . api_get_cidreq() . '">' . Display::return_icon('back.png', get_lang('ReturnToLearningPaths'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
$form->display();
Display::display_footer();
コード例 #26
0
                     foreach ($new_values as $value) {
                         if (!empty($value)) {
                             add_specific_field_value($specific_field['id'], api_get_course_id(), TOOL_LEARNPATH, $_SESSION['oLP']->lp_id, $value);
                         }
                     }
                 }
             }
         }
         $referer = isset($_REQUEST['referer']) ? $_REQUEST['referer'] : 'add_item';
         switch ($referer) {
             case 'lplist':
                 $url = api_get_self() . '?action=list&' . api_get_cidreq();
                 break;
             default:
             case 'add_item':
                 $url = api_get_self() . '?action=add_item&type=step&lp_id=' . intval($_SESSION['oLP']->lp_id) . '&' . api_get_cidreq();
                 break;
         }
         header('Location: ' . $url);
         exit;
     }
     break;
 case 'add_sub_item':
     // Add an item inside a chapter.
     if (!$is_allowed_to_edit) {
         api_not_allowed(true);
     }
     if ($debug > 0) {
         error_log('New LP - add sub item action triggered', 0);
     }
     if (!$lp_found) {
コード例 #27
0
$form->addButtonSave(get_lang('SaveSettings'));
if ($form->validate()) {
    $values = $form->exportValues();
    // Storing the users (we first remove all users and then add only those who were selected)
    GroupManager::unsubscribe_all_users($current_group['id']);
    if (isset($_POST['group_members']) && count($_POST['group_members']) > 0) {
        GroupManager::subscribe_users($values['group_members'], $current_group['id']);
    }
    // Returning to the group area (note: this is inconsistent with the rest of chamilo)
    $cat = GroupManager::get_category_from_group($current_group['id']);
    if (isset($_POST['group_members']) && count($_POST['group_members']) > $max_member && $max_member != GroupManager::MEMBER_PER_GROUP_NO_LIMIT) {
        Display::addFlash(Display::return_message(get_lang('GroupTooMuchMembers'), 'warning'));
        header('Location: group.php?' . api_get_cidreq(true, false));
    } else {
        Display::addFlash(Display::return_message(get_lang('GroupSettingsModified'), 'success'));
        header('Location: group.php?' . api_get_cidreq(true, false) . '&category=' . $cat['id']);
    }
    exit;
}
$action = isset($_GET['action']) ? $_GET['action'] : null;
switch ($action) {
    case 'empty':
        if (api_is_allowed_to_edit(false, true)) {
            GroupManager::unsubscribe_all_users($group_id);
            Display::display_confirmation_message(get_lang('GroupEmptied'));
        }
        break;
}
$defaults = $current_group;
$defaults['group_members'] = $selected_users;
$action = isset($_GET['action']) ? $_GET['action'] : '';
コード例 #28
0
/**
   Return the <a> html code for delete, add, clone, edit a question
   in_action = the code of the action triggered by the button
   from_exercice = the id of the current exercice from which we click on question pool
   in_questionid = the id of the current question
   in_questiontype = the code of the type of the current question
   in_questionname = the name of the question
   in_selected_course = the if of the course chosen in the FILTERING MENU
   in_courseCategoryId = the id of the category chosen in the FILTERING MENU
   in_exerciseLevel = the level of the exercice chosen in the FILTERING MENU
   in_answerType = the code of the type of the question chosen in the FILTERING MENU
   in_session_id = the id of the session_id chosen in the FILTERING MENU
   in_exercice_id = the id of the exercice chosen in the FILTERING MENU
*/
function get_action_icon_for_question($in_action, $from_exercice, $in_questionid, $in_questiontype, $in_questionname, $in_selected_course, $in_courseCategoryId, $in_exerciseLevel, $in_answerType, $in_session_id, $in_exercice_id)
{
    $res = "";
    $getParams = "&selected_course={$in_selected_course}&courseCategoryId={$in_courseCategoryId}&exerciseId={$in_exercice_id}&exerciseLevel={$in_exerciseLevel}&answerType={$in_answerType}&session_id={$in_session_id}";
    switch ($in_action) {
        case "delete":
            $res = "<a href='" . api_get_self() . "?" . api_get_cidreq() . $getParams . "&delete={$in_questionid}' onclick='return confirm_your_choice()'>";
            $res .= Display::return_icon("delete.png", get_lang('Delete'));
            $res .= "</a>";
            break;
        case "edit":
            $res = get_a_tag_for_question(1, $from_exercice, $in_questionid, $in_questiontype, Display::return_icon("edit.png", get_lang('Modify')), $in_session_id);
            break;
        case "add":
            // add if question is not already in test
            $myObjEx = new Exercise();
            $myObjEx->read($from_exercice);
            if (!$myObjEx->isInList($in_questionid)) {
                $res = "<a href='" . api_get_self() . "?" . api_get_cidreq() . $getParams . "&recup={$in_questionid}&fromExercise={$from_exercice}'>";
                $res .= Display::return_icon("view_more_stats.gif", get_lang('InsertALinkToThisQuestionInTheExercise'));
                $res .= "</a>";
            } else {
                $res = "-";
            }
            unset($myObjEx);
            break;
        case "clone":
            $url = api_get_self() . "?" . api_get_cidreq() . $getParams . "&amp;copy_question={$in_questionid}&amp;course_id={$in_selected_course}&amp;fromExercise={$from_exercice}";
            $res = Display::url(Display::return_icon('cd.gif', get_lang('ReUseACopyInCurrentTest')), $url);
            break;
        default:
            $res = $in_action;
            break;
    }
    return $res;
}
コード例 #29
0
            }
        }
    }
    if ($total_resource_weight != $total_weight) {
        Display::display_warning_message(get_lang('SumOfActivitiesWeightMustBeEqualToTotalWeight'));
    }
}
$filter = api_get_setting('certificate_filter_by_official_code');
$userList = array();
$filterForm = null;
$certificate_list = array();
if ($filter === 'true') {
    echo '<br />';
    $options = UserManager::getOfficialCodeGrouped();
    $options = array_merge(array('all' => get_lang('All')), $options);
    $form = new FormValidator('official_code_filter', 'POST', api_get_self() . '?' . api_get_cidreq() . '&cat_id=' . $cat_id);
    $form->addElement('select', 'filter', get_lang('OfficialCode'), $options);
    $form->addButton('submit', get_lang('Submit'));
    $filterForm = '<br />' . $form->return_form();
    if ($form->validate()) {
        $officialCode = $form->getSubmitValue('filter');
        if ($officialCode == 'all') {
            $certificate_list = GradebookUtils::get_list_users_certificates($cat_id);
        } else {
            $userList = UserManager::getUsersByOfficialCode($officialCode);
            if (!empty($userList)) {
                $certificate_list = GradebookUtils::get_list_users_certificates($cat_id, $userList);
            }
        }
    } else {
        $certificate_list = GradebookUtils::get_list_users_certificates($cat_id);
コード例 #30
0
    private function build_edit_column($item)
    {
        $status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
        $locked_status = $this->evaluation->get_locked();
        if (api_is_allowed_to_edit(null, true) && $locked_status == 0) {
            //api_is_course_admin()
            $edit_column = '<a href="' . api_get_self() . '?editres=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '&' . api_get_cidreq() . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', '22') . '</a>';
            $edit_column .= ' <a href="' . api_get_self() . '?delete_mark=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '&' . api_get_cidreq() . '">' . Display::return_icon('delete.png', get_lang('Delete'), '', '22') . '</a>';
        }
        if ($this->evaluation->get_course_code() == null) {
            $edit_column .= '&nbsp;<a href="' . api_get_self() . '?resultdelete=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '" onclick="return confirmationuser();">
			<img src="../img/delete.gif" border="0" title="' . get_lang('Delete') . '" alt="" /></a>';
            $edit_column .= '&nbsp;<a href="user_stats.php?userid=' . $item['id'] . '&selecteval=' . $this->evaluation->get_id() . '&' . api_get_cidreq() . '">
		    <img src="../img/statistics.gif" width="17px" border="0" title="' . get_lang('Statistics') . '" alt="" /></a>';
        }
        // Evaluation's origin is a link
        if ($this->evaluation->get_category_id() < 0) {
            $link = LinkFactory::get_evaluation_link($this->evaluation->get_id());
            $doc_url = $link->get_view_url($item['id']);
            if ($doc_url != null) {
                $edit_column .= '&nbsp;<a href="' . $doc_url . '" target="_blank">' . '<img src="' . api_get_path(WEB_CODE_PATH) . 'img/link.gif" border="0" title="' . get_lang('OpenDocument') . '" alt="" />' . '</a>';
            }
        }
        return $edit_column;
    }