Use ChamiloSession

pull/2487/head
jmontoyaa 9 years ago
parent 8cf39faaf1
commit 07b950b05f
  1. 6
      main/exercise/TestCategory.php
  2. 9
      main/exercise/UniqueAnswerImage.php
  3. 16
      main/exercise/admin.php
  4. 14
      main/exercise/exercise.php
  5. 10
      main/exercise/exercise_show.php
  6. 6
      main/exercise/exercise_submit_modal.php
  7. 5
      main/exercise/global_multiple_answer.class.php
  8. 17
      main/exercise/hotspot_savescore.inc.php
  9. 19
      main/exercise/hotspot_updatescore.inc.php
  10. 4
      main/exercise/multiple_answer.class.php
  11. 4
      main/exercise/multiple_answer_combination.class.php
  12. 4
      main/exercise/multiple_answer_true_false.class.php
  13. 6
      main/exercise/overview.php
  14. 4
      main/exercise/question_list_admin.inc.php
  15. 4
      main/exercise/unique_answer.class.php
  16. 7
      main/exercise/unique_answer_no_option.class.php
  17. 10
      main/inc/ajax/lp.ajax.php
  18. 5
      main/inc/ajax/record_audio_rtc.ajax.php
  19. 4
      main/inc/ajax/record_audio_wami.ajax.php
  20. 4
      main/inc/lib/nanogong/upload_nanogong_file.php
  21. 4
      main/lp/aicc_api.php
  22. 9
      main/lp/aicc_hacp.php
  23. 4
      main/lp/lp_add_item.php
  24. 7
      main/lp/lp_ajax_switch_item.php
  25. 8
      main/lp/lp_ajax_switch_item_toc.php
  26. 21
      main/lp/openoffice_presentation.class.php
  27. 44
      main/lp/openoffice_text_document.class.php
  28. 14
      main/session/index.php
  29. 7
      main/tracking/userlogCSV.php

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* Class TestCategory
* @author hubert.borderiou
@ -615,12 +617,12 @@ class TestCategory
{
$is_student = !(api_is_allowed_to_edit(null,true) || api_is_session_admin());
// @todo fix $_SESSION['objExercise']
$objExercise = isset($_SESSION['objExercise']) ? $_SESSION['objExercise'] : null;
$objExercise = Session::read('objExercise');
if (!empty($objExercise)) {
$in_display_category_name = $objExercise->display_category_name;
}
$content = null;
if (TestCategory::getCategoryNameForQuestion($questionId) != "" && ($in_display_category_name == 1 || !$is_student)) {
if (TestCategory::getCategoryNameForQuestion($questionId) != '' && ($in_display_category_name == 1 || !$is_student)) {
$content .= '<div class="page-header">';
$content .= '<h4>'.get_lang('Category').": ".TestCategory::getCategoryNameForQuestion($questionId).'</h4>';
$content .= "</div>";

@ -1,7 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* UniqueAnswerImage
*
@ -22,9 +23,13 @@ class UniqueAnswerImage extends UniqueAnswer
$this->isContent = $this->getIsContent();
}
/**
* @param FormValidator $form
* @throws Exception
*/
public function createAnswersForm($form)
{
$objExercise = $_SESSION['objExercise'];
$objExercise = Session::read('objExercise');
$editorConfig = array(
'ToolbarSet' => 'TestFreeAnswer',

@ -1,5 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* Exercise administration
* This script allows to manage (create, modify) an exercise and its questions
@ -44,8 +47,6 @@
* Modified by Hubert Borderiou 21-10-2011 Question by category
*/
use ChamiloSession as Session;
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_QUIZ;
$this_section = SECTION_COURSES;
@ -94,7 +95,7 @@ if (empty($deleteQuestion)) {
}
$clone_question = isset($_REQUEST['clone_question']) ? $_REQUEST['clone_question'] : 0;
if (empty($questionId)) {
$questionId = isset($_SESSION['questionId']) ? $_SESSION['questionId'] : 0;
$questionId = Session::read('questionId');
}
if (empty($modifyExercise)) {
$modifyExercise = isset($_GET['modifyExercise']) ? $_GET['modifyExercise'] : null;
@ -117,13 +118,14 @@ Event::delete_all_incomplete_attempts(
);
// get from session
$objExercise = isset($_SESSION['objExercise']) ? $_SESSION['objExercise'] : null;
$objQuestion = isset($_SESSION['objQuestion']) ? $_SESSION['objQuestion'] : null;
$objExercise = Session::read('objExercise');
$objQuestion = Session::read('objQuestion');
if (isset($_REQUEST['convertAnswer'])) {
$objQuestion = $objQuestion->swapSimpleAnswerTypes();
$_SESSION['objQuestion'] = $objQuestion;
Session::write('objQuestion', $objQuestion);
}
$objAnswer = isset($_SESSION['objAnswer']) ? $_SESSION['objAnswer'] : null;
$objAnswer = Session::read('objAnswer');
// document path
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';

@ -66,21 +66,12 @@ $exercisePath = substr($exercisePath, 0, strpos($exercisePath, $exfile));
$exercisePath = $exercisePath."exercise.php";
// Clear the exercise session
if (isset($_SESSION['objExercise'])) {
Session::erase('objExercise');
}
if (isset($_SESSION['objQuestion'])) {
Session::erase('objQuestion');
}
if (isset($_SESSION['objAnswer'])) {
Session::erase('objAnswer');
}
if (isset($_SESSION['questionList'])) {
Session::erase('questionList');
}
if (isset($_SESSION['exerciseResult'])) {
Session::erase('exerciseResult');
}
//General POST/GET/SESSION/COOKIES parameters recovery
$origin = isset($_REQUEST['origin']) ? Security::remove_XSS($_REQUEST['origin']) : null;
@ -172,11 +163,10 @@ if (!empty($errorXmlExport)) {
HotPotGCt($documentPath, 1, $userId);
// Only for administrator
if ($is_allowedToEdit) {
if (!empty($choice)) {
// All test choice, clean all test's results
if ($choice == 'clean_all_test') {
if ($choice === 'clean_all_test') {
$check = Security::check_token('get');
if ($check) {
// list of exercises in a course/session

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* Shows the exercise results
*
@ -12,8 +14,6 @@
*
*/
use ChamiloSession as Session;
require_once '../inc/global.inc.php';
$debug = false;
if (empty($origin)) {
@ -41,7 +41,7 @@ if (empty($formSent)) {
$formSent = isset($_REQUEST['formSent']) ? $_REQUEST['formSent'] : null;
}
if (empty($exerciseResult)) {
$exerciseResult = isset($_SESSION['exerciseResult']) ? $_SESSION['exerciseResult'] : null;
$exerciseResult = Session::read('exerciseResult');
}
if (empty($questionId)) {
$questionId = isset($_REQUEST['questionId']) ? $_REQUEST['questionId'] : null;
@ -56,10 +56,10 @@ if (empty($nbrQuestions)) {
$nbrQuestions = isset($_REQUEST['nbrQuestions']) ? $_REQUEST['nbrQuestions'] : null;
}
if (empty($questionList)) {
$questionList = isset($_SESSION['questionList']) ? $_SESSION['questionList'] : null;
$questionList = Session::read('questionList');
}
if (empty($objExercise)) {
$objExercise = isset($_SESSION['objExercise']) ? $_SESSION['objExercise'] : null;
$objExercise = Session::read('objExercise');
}
if (empty($exeId)) {
$exeId = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;

@ -28,11 +28,7 @@ $threadhold1 = null;
$threadhold2 = null;
$threadhold3 = null;
$exerciseResult = [];
if (isset($_SESSION['exerciseResult'])) {
$exerciseResult = $_SESSION['exerciseResult'];
}
$exerciseResult = Session::read('exerciseResult');
$exerciseResultCoordinates = isset($_REQUEST['exerciseResultCoordinates']) ? $_REQUEST['exerciseResultCoordinates'] : null;

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* Class GlobalMultipleAnswer
*/
@ -28,7 +30,7 @@ class GlobalMultipleAnswer extends Question
$nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4;
$nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0));
$obj_ex = $_SESSION['objExercise'];
$obj_ex = Session::read('objExercise');
/* Mise en variable de Affichage "Reponses" et son icone, "N<EFBFBD>", "Vrai", "Reponse" */
$html = '<table class="data_table">
@ -130,7 +132,6 @@ class GlobalMultipleAnswer extends Question
//only 1 answer the all deal ...
$form->addElement('text', 'weighting[1]', get_lang('Score'));
global $pts;
//--------- Creation coche pour ne pas prendre en compte les n<EFBFBD>gatifs
$form->addElement('checkbox', 'pts', '', get_lang('NoNegativeScore'));
$form->addElement('html', '<br />');

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This file saves every click in the hotspot tool into track_e_hotspots
* @package chamilo.exercise
@ -11,17 +13,16 @@ require_once '../inc/global.inc.php';
$courseCode = $_GET['coursecode'];
$questionId = $_GET['questionId'];
$coordinates = $_GET['coord'];
$objExcercise = $_SESSION['objExercise'];
$exerciseId = $objExcercise->selectId();
$objExercise = Session::read('objExercise');
$exerciseId = $objExercise->selectId();
// Save clicking order
$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['ids'])+1;
if ($_GET['answerId'] == "0") // click is NOT on a hotspot
{
if ($_GET['answerId'] == "0") {
// click is NOT on a hotspot
$hit = 0;
$answerId = NULL;
}
else // user clicked ON a hotspot
{
$answerId = null;
} else {
// user clicked ON a hotspot
$hit = 1;
$answerId = api_substr($_GET['answerId'],22,2);
// Save into session

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This file saves every click in the hotspot tool into track_e_hotspots
* @package chamilo.exercise
@ -13,29 +15,21 @@ require_once '../inc/global.inc.php';
$courseCode = $_GET['coursecode'];
$questionId = $_GET['questionId'];
$coordinates = $_GET['coord'];
$objExcercise = $_SESSION['objExercise'];
$objExercise = Session::read('objExercise');
$hotspotId = $_GET['hotspotId'];
$exerciseId = $objExcercise->selectId();
$exerciseId = $objExercise->selectId();
if ($_GET['answerId'] == "0") { // click is NOT on a hotspot
$hit = 0;
$answerId = $hotspotId;
// remove from session
unset($_SESSION['exerciseResult'][$questionId][$answerId]);
// Save clicking order
//$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1;
//$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId;
} else { // user clicked ON a hotspot
$hit = 1;
$answerId = $hotspotId;
// Save into session
$_SESSION['exerciseResult'][$questionId][$answerId] = $hit;
// Save clicking order
//$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1;
//$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId;
}
//round-up the coordinates
@ -51,5 +45,8 @@ $TBL_TRACK_E_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPO
// update db
$update_id = $_SESSION['exerciseResult'][$questionId]['ids'][$answerId];
$sql = "UPDATE $TBL_TRACK_E_HOTSPOT SET coordinate = '".Database::escape_string($coordinates)."' WHERE id = ".intval($update_id)." LIMIT 1 ;;";
$sql = "UPDATE $TBL_TRACK_E_HOTSPOT
SET coordinate = '".Database::escape_string($coordinates)."'
WHERE id = ".intval($update_id)."
LIMIT 1";
$result = Database::query($sql);

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* Class MultipleAnswer
*
@ -41,7 +43,7 @@ class MultipleAnswer extends Question
$nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4; // The previous default value was 2. See task #1759.
$nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0));
$obj_ex = $_SESSION['objExercise'];
$obj_ex = Session::read('objExercise');
$form->addHeader(get_lang('Answers'));

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* Class MultipleAnswerCombination
*
@ -34,7 +36,7 @@ class MultipleAnswerCombination extends Question
{
$nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 2;
$nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0));
$obj_ex = $_SESSION['objExercise'];
$obj_ex = Session::read('objExercise');
$html = '<table class="table table-striped table-hover">';
$html .= '<thead>';

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* Class MultipleAnswerTrueFalse
* This class allows to instantiate an object of type MULTIPLE_ANSWER
@ -37,7 +39,7 @@ class MultipleAnswerTrueFalse extends Question
$nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0));
$course_id = api_get_course_int_id();
$obj_ex = $_SESSION['objExercise'];
$obj_ex = Session::read('objExercise');
$renderer = & $form->defaultRenderer();
$defaults = array();

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use \ChamiloSession as Session;
/**
* Exercise preview
*
@ -8,16 +10,12 @@
* @author Julio Montoya <gugli100@gmail.com>
*/
use \ChamiloSession as Session;
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_QUIZ;
// Clear the exercise session just in case
if (isset($_SESSION['objExercise'])) {
Session::erase('objExercise');
}
$this_section = SECTION_COURSES;

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* Code library for HotPotatoes integration.
* @package chamilo.exercise
@ -133,7 +135,7 @@ echo '<div style="clear:both;"></div>';
echo '<div id="message"></div>';
$token = Security::get_token();
//deletes a session when using don't know question type (ugly fix)
unset($_SESSION['less_answer']);
Session::erase('less_answer');
// If we are in a test
$inATest = isset($exerciseId) && $exerciseId > 0;

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* Class UniqueAnswer
*
@ -34,7 +36,7 @@ class UniqueAnswer extends Question
public function createAnswersForm($form)
{
// Getting the exercise list
$obj_ex = $_SESSION['objExercise'];
$obj_ex = Session::read('objExercise');
$editor_config = array(
'ToolbarSet' => 'TestProposedAnswer',

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* Class UniqueAnswerNoOption
* Allows to instantiate an object of type UNIQUE_ANSWER (MULTIPLE CHOICE, UNIQUE ANSWER),
@ -30,13 +32,12 @@ class UniqueAnswerNoOption extends Question
* @param the formvalidator instance
* @param the answers number to display
*/
function createAnswersForm($form)
public function createAnswersForm($form)
{
// getting the exercise list
$obj_ex = $_SESSION['objExercise'];
$obj_ex = Session::read('objExercise');
$editor_config = array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '125');
//this line define how many question by default appear when creating a choice question
$nb_answers = isset($_POST['nb_answers']) ? (int) $_POST['nb_answers'] : 3; // The previous default value was 2. See task #1759.
$nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0));

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* Responses to AJAX calls
*/
@ -126,7 +128,7 @@ switch ($action) {
exit;
}
/** @var Learnpath $lp */
$lp = isset($_SESSION['oLP']) ? $_SESSION['oLP'] : null;
$lp = Session::read('oLP');
$course_info = api_get_course_info();
$lpPathInfo = $lp->generate_lp_folder($course_info);
@ -259,7 +261,7 @@ switch ($action) {
]);
break;
case 'update_gamification':
$lp = isset($_SESSION['oLP']) ? $_SESSION['oLP'] : null;
$lp = Session::read('oLP');
$jsonGamification = [
'stars' => 0,
@ -276,10 +278,10 @@ switch ($action) {
echo json_encode($jsonGamification);
break;
case 'check_item_position':
$lp = isset($_SESSION['oLP']) ? $_SESSION['oLP'] : null;
$lp = Session::read('oLP');
$lpItemId = isset($_GET['lp_item']) ? intval($_GET['lp_item']) : 0;
if ($lp) {
$position = $_SESSION['oLP']->isFirstOrLastItem($lpItemId);
$position = $lp->isFirstOrLastItem($lpItemId);
}
echo json_encode($position);

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
require_once '../global.inc.php';
// Add security from Chamilo
@ -54,9 +56,8 @@ if (!empty($result) && is_array($result)) {
$courseId = $result['c_id'];
/** @var learnpath $lp */
$lp = isset($_SESSION['oLP']) ? $_SESSION['oLP'] : null;
$lp = Session::read('oLP');
$lpItemId = isset($_REQUEST['lp_item_id']) && !empty($_REQUEST['lp_item_id']) ? $_REQUEST['lp_item_id'] : null;
if (!empty($lp) && empty($lpItemId)) {
$lp->set_modified_on();

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
require_once '../global.inc.php';
// Add security from Chamilo
@ -121,7 +123,7 @@ if (!empty($documentData)) {
if (isset($_REQUEST['lp_item_id']) && !empty($_REQUEST['lp_item_id'])) {
$lpItemId = $_REQUEST['lp_item_id'];
/** @var learnpath $lp */
$lp = isset($_SESSION['oLP']) ? $_SESSION['oLP'] : null;
$lp = Session::read('oLP');
if (!empty($lp)) {
$lp->set_modified_on();

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This file allows creating new svg and png documents with an online editor.
*
@ -52,7 +54,7 @@ if (!empty($documentData)) {
if (isset($_REQUEST['lp_item_id']) && !empty($_REQUEST['lp_item_id'])) {
$lpItemId = $_REQUEST['lp_item_id'];
/** @var learnpath $lp */
$lp = isset($_SESSION['oLP']) ? $_SESSION['oLP'] : null;
$lp = Session::read('oLP');
if (!empty($lp)) {
$lp->set_modified_on();

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* API event handler functions for AICC / CMIv4 in API communication mode
*
@ -31,7 +33,7 @@ require_once '../inc/global.inc.php';
// Is this needed? This is probabaly done in the header file.
$file = $_SESSION['file'];
$oLP = unserialize($_SESSION['lpobject']);
$oLP = unserialize(Session::read('lpobject'));
$oItem = $oLP->items[$oLP->current];
if (!is_object($oItem)) {
error_log('New LP - scorm_api - Could not load oItem item', 0);

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* API event handler functions for AICC / CMIv4 in HACP communication mode
*
@ -53,8 +55,8 @@ if ($debug > 2) { error_log('New LP - '.__FILE__.','.__LINE__.' - Current sessio
// Is this needed? This is probabaly done in the header file.
//$_user = $_SESSION['_user'];
$file = $_SESSION['file'];
$oLP = unserialize($_SESSION['lpobject']);
$file = Session::read('file');
$oLP = unserialize(Session::read('lpobject'));
$oItem =& $oLP->items[$oLP->current];
if (!is_object($oItem)) {
error_log('New LP - aicc_hacp - Could not load oItem item', 0);
@ -258,7 +260,8 @@ if (!empty($_REQUEST['command'])) {
$result = $s_ec.$error_code.$crlf.$s_et.$error_text.$crlf;
}
}
$_SESSION['lpobject'] = serialize($oLP);
Session::write('lpobject', serialize($oLP));
session_write_close();
// Content type must be text/plain.
header('Content-type: text/plain');

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This is a learning path creation and player tool in Chamilo - previously
* learnpath_handler.php
@ -21,7 +23,7 @@ require_once 'learnpath_functions.inc.php';
require_once 'resourcelinker.inc.php';
/** @var learnpath $learnPath */
$learnPath = $_SESSION['oLP'];
$learnPath = Session::read('oLP');
$htmlHeadXtra[] = '<script>'.
$learnPath->get_js_dropdown_array()."

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This script contains the server part of the xajax interaction process. The client part is located
* in lp_api.php or other api's.
@ -222,8 +224,9 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
error_log('Prereq_match() returned '.htmlentities($mylp->error), 0);
}
// Save the new item ID for the exercise tool to use.
$_SESSION['scorm_item_id'] = $new_item_id;
$_SESSION['lpobject'] = serialize($mylp);
Session::write('scorm_item_id', $new_item_id);
Session::write('lpobject', serialize($mylp));
return $return;
}

@ -1,5 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This script contains the server part of the ajax interaction process. The client part is located
* in lp_api.php or other api's.
@ -152,8 +155,9 @@ function switch_item_toc($lpId, $userId, $viewId, $currentItem, $nextItem)
if ($debug > 1) {
error_log('prerequisites_match() returned '.htmlentities($myLP->error), 0);
}
$_SESSION['scorm_item_id'] = $newItemId; // Save the new item ID for the exercise tool to use.
$_SESSION['lpobject'] = serialize($myLP);
Session::write('scorm_item_id', $newItemId);
Session::write('lpobject', serialize($myLP));
return $return;
}

@ -226,9 +226,26 @@ class OpenofficePresentation extends OpenofficeDocument
$slide_name = str_replace('&rsquo;', '\'', $slide_name);
$slide_name = api_convert_encoding($slide_name, api_get_system_encoding(), $this->original_charset);
$slide_name = api_html_entity_decode($slide_name, ENT_COMPAT, api_get_system_encoding());
$did = add_document($_course, $this->created_dir.'/'.urlencode($file_name), 'file', filesize($this->base_work_dir.$this->created_dir.'/'.$file_name), $slide_name);
$did = add_document(
$_course,
$this->created_dir.'/'.urlencode($file_name),
'file',
filesize($this->base_work_dir.$this->created_dir.'/'.$file_name),
$slide_name
);
if ($did) {
api_item_property_update($_course, TOOL_DOCUMENT, $did, 'DocumentAdded', $_SESSION['_uid'], 0, null, null, null, api_get_session_id());
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$did,
'DocumentAdded',
api_get_user_id(),
0,
null,
null,
null,
api_get_session_id()
);
}
}
}

@ -141,12 +141,29 @@ class OpenOfficeTextDocument extends OpenofficeDocument {
fwrite($handle, $page_content);
fclose($handle);
$document_id = add_document($_course, $this->created_dir.'/'.$html_file, 'file', filesize($this->base_work_dir.$this->created_dir.'/'.$html_file), $html_file);
$document_id = add_document(
$_course,
$this->created_dir.'/'.$html_file,
'file',
filesize($this->base_work_dir.$this->created_dir.'/'.$html_file),
$html_file
);
if ($document_id) {
// Put the document in item_property update.
api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentAdded', $_SESSION['_uid'], 0, 0, null, null, api_get_session_id());
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$document_id,
'DocumentAdded',
api_get_user_id(),
0,
0,
null,
null,
api_get_session_id()
);
$infos = pathinfo($this->filepath);
$slide_name = strip_tags(nl2br($item_title));
@ -185,14 +202,29 @@ class OpenOfficeTextDocument extends OpenofficeDocument {
fwrite($handle, $page_content);
fclose($handle);
$document_id = add_document($_course, $this->created_dir.$html_file, 'file', filesize($this->base_work_dir.$this->created_dir.$html_file), $html_file);
$document_id = add_document(
$_course,
$this->created_dir.$html_file,
'file',
filesize($this->base_work_dir.$this->created_dir.$html_file),
$html_file
);
$slide_name = '';
if ($document_id) {
// Put the document in item_property update.
api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentAdded', $_SESSION['_uid'], 0, 0, null, null, api_get_session_id());
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$document_id,
'DocumentAdded',
api_get_user_id(),
0,
0,
null,
null,
api_get_session_id()
);
$infos = pathinfo($this->filepath);
$slide_name = 'Page '.str_repeat('0', 2 - strlen($key)).$key;

@ -1,15 +1,15 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* Session view
* @package chamilo.session
* @author Julio Montoya <gugli100@gmail.com> Beeznest
*/
use ChamiloSession as Session;
$cidReset = true;
require_once '../inc/global.inc.php';
if (empty($_GET['session_id'])) {
@ -17,10 +17,8 @@ if (empty($_GET['session_id'])) {
}
$session_id = isset($_GET['session_id']) ? intval($_GET['session_id']): null;
$sessionField = new ExtraFieldValue('session');
$valueAllowVisitors = $sessionField->get_values_by_handler_and_field_variable($session_id, 'allow_visitors');
$allowVisitors = $valueAllowVisitors != false;
if (!$allowVisitors) {
@ -30,15 +28,11 @@ if (!$allowVisitors) {
$this_section = SECTION_COURSES;
$htmlHeadXtra[] = api_get_jqgrid_js();
$course_id = isset($_GET['course_id']) ? intval($_GET['course_id']) : null;
$_SESSION['id_session'] = $session_id;
Session::write('id_session', $session_id);
// Clear the exercise session just in case
if (isset($_SESSION['objExercise'])) {
Session::erase('objExercise');
}
$userId = api_get_user_id();
$session_info = SessionManager::fetch($session_id);

@ -7,11 +7,6 @@
* @package chamilo.tracking
* @todo clean code - structure is unclear and difficult to modify
*/
/**
* Code
*/
/* INIT SECTION */
$uInfo = $_REQUEST['uInfo'];
$view = $_REQUEST['view'];
@ -71,7 +66,7 @@ $sql = "SELECT 1
AND ((access_start_date <= '$now'
AND access_end_date >= '$now')
OR (access_start_date='0000-00-00' AND access_end_date='0000-00-00'))
WHERE session_id='" . $_SESSION['id_session'] . "' AND c_id = $courseId";
WHERE session_id='" . api_get_session_id() . "' AND c_id = $courseId";
//echo $sql;
$result = Database::query($sql);
if (!Database::num_rows($result)) {

Loading…
Cancel
Save