[svn r21933] FS#2867 - The FCKEditor, all introduction sections: Eliminating the global variable $fck_attribute.
parent
3ad5d561b1
commit
b8bf14f443
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,127 +1,125 @@ |
||||
<?php // $Id: $
|
||||
/** |
||||
* @copyright (c) 2001-2006 Universite catholique de Louvain (UCL) |
||||
* |
||||
* @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE |
||||
* |
||||
* @package dokeos.exercise |
||||
* @author claro team <cvs@claroline.net> |
||||
*/ |
||||
|
||||
require '../../inc/global.inc.php'; |
||||
|
||||
//SECURITY CHECK |
||||
|
||||
if ( api_is_platform_admin() ) api_not_allowed(); |
||||
|
||||
//DECLARE NEEDED LIBRARIES |
||||
|
||||
require_once api_get_path(LIBRARY_PATH) . 'fileManage.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php'; |
||||
|
||||
require_once 'exercise_import.inc.php'; |
||||
include_once '../exercise.class.php'; |
||||
include_once '../question.class.php'; |
||||
include_once 'qti/qti_classes.php'; |
||||
|
||||
//SQL table name |
||||
|
||||
$tbl_exercise = Database::get_course_table(TABLE_QUIZ_TEST); |
||||
$tbl_question = Database::get_course_table(TABLE_QUIZ_QUESTION); |
||||
$tbl_rel_exercise_question = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
||||
|
||||
// tool libraries |
||||
|
||||
include_once '../exercise.class.php'; |
||||
|
||||
//Tool title |
||||
|
||||
$nameTools = get_lang('ImportExercise'); |
||||
|
||||
//bredcrump |
||||
|
||||
$interbredcrump[]= array ('url' => '../exercise.php','name' => get_lang('Exercises')); |
||||
|
||||
//---------------------------------- |
||||
// EXECUTE COMMAND |
||||
//---------------------------------- |
||||
|
||||
$cmd = (isset($_REQUEST['cmd'])? $_REQUEST['cmd'] : 'show_import'); |
||||
|
||||
switch ( $cmd ) |
||||
{ |
||||
case 'show_import' : |
||||
{ |
||||
$display = '<p>' |
||||
. get_lang('Imported exercises must consist of a zip or an XML file (IMS-QTI) and be compatible with your Claroline version.') . '<br>' |
||||
. '</p>' |
||||
. '<form enctype="multipart/form-data" action="" method="post">' |
||||
. '<input name="cmd" type="hidden" value="import" />' |
||||
. '<input name="uploadedExercise" type="file" /><br><br>' |
||||
. get_lang('Import exercise') . ' : ' |
||||
. '<input value="' . get_lang('Ok') . '" type="submit" /> ' |
||||
. claro_html_button( $_SERVER['PHP_SELF'], get_lang('Cancel')) |
||||
. '<br><br>' |
||||
. '<small>' . get_lang('Max file size') . ' : 2 MB</small>' |
||||
. '</form>'; |
||||
} |
||||
break; |
||||
|
||||
case 'import' : |
||||
{ |
||||
//include needed librabries for treatment |
||||
|
||||
$result_log = import_exercise($_FILES['uploadedExercise']['name']); |
||||
|
||||
//display the result message (fail or success) |
||||
|
||||
$dialogBox = ''; |
||||
|
||||
foreach ($result_log as $log) |
||||
{ |
||||
$dialogBox .= $log . '<br>'; |
||||
} |
||||
|
||||
} |
||||
break; |
||||
} |
||||
|
||||
//---------------------------------- |
||||
// FIND INFORMATION |
||||
//---------------------------------- |
||||
|
||||
//empty! |
||||
|
||||
//---------------------------------- |
||||
// DISPLAY |
||||
//---------------------------------- |
||||
|
||||
include api_get_path(INCLUDE_PATH) . '/header.inc.php'; |
||||
|
||||
//display title |
||||
|
||||
|
||||
// Tool introduction |
||||
$fck_attribute['Width'] = '100%'; |
||||
$fck_attribute['Height'] = '300'; |
||||
$fck_attribute['ToolbarSet'] = 'Introduction'; |
||||
// TODO: These settings to be checked when it is possible. |
||||
$fck_attribute['Config']['CreateDocumentWebDir'] = api_get_path('WEB_COURSE_PATH').api_get_course_path().'/document/'; |
||||
$fck_attribute['Config']['CreateDocumentDir'] = '../../../courses/'.api_get_course_path().'/document/'; |
||||
$fck_attribute['Config']['BaseHref'] = api_get_path('WEB_COURSE_PATH').api_get_course_path().'/'; |
||||
Display::display_introduction_section(TOOL_QUIZ); |
||||
$fck_attribute = null; // Clearing this global variable immediatelly after it has been used. |
||||
|
||||
|
||||
//Display Forms or dialog box(if needed) |
||||
|
||||
if ( isset($dialogBox) ) echo Display::display_normal_message($dialogBox,false); |
||||
|
||||
//display content |
||||
|
||||
if (isset($display) ) echo $display; |
||||
|
||||
//footer display |
||||
|
||||
include api_get_path(INCLUDE_PATH) . '/footer.inc.php'; |
||||
?> |
||||
<?php // $Id: $
|
||||
/** |
||||
* @copyright (c) 2001-2006 Universite catholique de Louvain (UCL) |
||||
* |
||||
* @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE |
||||
* |
||||
* @package dokeos.exercise |
||||
* @author claro team <cvs@claroline.net> |
||||
*/ |
||||
|
||||
require '../../inc/global.inc.php'; |
||||
|
||||
//SECURITY CHECK |
||||
|
||||
if ( api_is_platform_admin() ) api_not_allowed(); |
||||
|
||||
//DECLARE NEEDED LIBRARIES |
||||
|
||||
require_once api_get_path(LIBRARY_PATH) . 'fileManage.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php'; |
||||
|
||||
require_once 'exercise_import.inc.php'; |
||||
include_once '../exercise.class.php'; |
||||
include_once '../question.class.php'; |
||||
include_once 'qti/qti_classes.php'; |
||||
|
||||
//SQL table name |
||||
|
||||
$tbl_exercise = Database::get_course_table(TABLE_QUIZ_TEST); |
||||
$tbl_question = Database::get_course_table(TABLE_QUIZ_QUESTION); |
||||
$tbl_rel_exercise_question = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
||||
|
||||
// tool libraries |
||||
|
||||
include_once '../exercise.class.php'; |
||||
|
||||
//Tool title |
||||
|
||||
$nameTools = get_lang('ImportExercise'); |
||||
|
||||
//bredcrump |
||||
|
||||
$interbredcrump[]= array ('url' => '../exercise.php','name' => get_lang('Exercises')); |
||||
|
||||
//---------------------------------- |
||||
// EXECUTE COMMAND |
||||
//---------------------------------- |
||||
|
||||
$cmd = (isset($_REQUEST['cmd'])? $_REQUEST['cmd'] : 'show_import'); |
||||
|
||||
switch ( $cmd ) |
||||
{ |
||||
case 'show_import' : |
||||
{ |
||||
$display = '<p>' |
||||
. get_lang('Imported exercises must consist of a zip or an XML file (IMS-QTI) and be compatible with your Claroline version.') . '<br>' |
||||
. '</p>' |
||||
. '<form enctype="multipart/form-data" action="" method="post">' |
||||
. '<input name="cmd" type="hidden" value="import" />' |
||||
. '<input name="uploadedExercise" type="file" /><br><br>' |
||||
. get_lang('Import exercise') . ' : ' |
||||
. '<input value="' . get_lang('Ok') . '" type="submit" /> ' |
||||
. claro_html_button( $_SERVER['PHP_SELF'], get_lang('Cancel')) |
||||
. '<br><br>' |
||||
. '<small>' . get_lang('Max file size') . ' : 2 MB</small>' |
||||
. '</form>'; |
||||
} |
||||
break; |
||||
|
||||
case 'import' : |
||||
{ |
||||
//include needed librabries for treatment |
||||
|
||||
$result_log = import_exercise($_FILES['uploadedExercise']['name']); |
||||
|
||||
//display the result message (fail or success) |
||||
|
||||
$dialogBox = ''; |
||||
|
||||
foreach ($result_log as $log) |
||||
{ |
||||
$dialogBox .= $log . '<br>'; |
||||
} |
||||
|
||||
} |
||||
break; |
||||
} |
||||
|
||||
//---------------------------------- |
||||
// FIND INFORMATION |
||||
//---------------------------------- |
||||
|
||||
//empty! |
||||
|
||||
//---------------------------------- |
||||
// DISPLAY |
||||
//---------------------------------- |
||||
|
||||
include api_get_path(INCLUDE_PATH) . '/header.inc.php'; |
||||
|
||||
//display title |
||||
|
||||
|
||||
// Tool introduction |
||||
// TODO: These settings to be checked when it is possible. |
||||
Display::display_introduction_section(TOOL_QUIZ, array( |
||||
'CreateDocumentWebDir' => api_get_path('WEB_COURSE_PATH').api_get_course_path().'/document/', |
||||
'CreateDocumentDir' => '../../../courses/'.api_get_course_path().'/document/', |
||||
'BaseHref' => api_get_path('WEB_COURSE_PATH').api_get_course_path().'/' |
||||
) |
||||
); |
||||
|
||||
|
||||
//Display Forms or dialog box(if needed) |
||||
|
||||
if ( isset($dialogBox) ) echo Display::display_normal_message($dialogBox,false); |
||||
|
||||
//display content |
||||
|
||||
if (isset($display) ) echo $display; |
||||
|
||||
//footer display |
||||
|
||||
include api_get_path(INCLUDE_PATH) . '/footer.inc.php'; |
||||
?> |
||||
|
@ -1,137 +1,131 @@ |
||||
<?php // $Id: document.php 16494 2008-10-10 22:07:36Z yannoo $
|
||||
|
||||
/* |
||||
============================================================================== |
||||
Dokeos - elearning and course management software |
||||
|
||||
Copyright (c) 2004-2008 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 |
||||
============================================================================== |
||||
*/ |
||||
|
||||
/** |
||||
* These files are a complete rework of the forum. The database structure is |
||||
* based on phpBB but all the code is rewritten. A lot of new functionalities |
||||
* are added: |
||||
* - forum categories and forums can be sorted up or down, locked or made invisible |
||||
* - consistent and integrated forum administration |
||||
* - forum options: are students allowed to edit their post? |
||||
* moderation of posts (approval) |
||||
* reply only forums (students cannot create new threads) |
||||
* multiple forums per group |
||||
* - sticky messages |
||||
* - new view option: nested view |
||||
* - quoting a message |
||||
* |
||||
* @Author Patrick Cool <patrick.cool@UGent.be>, Ghent University |
||||
* @Copyright Ghent University |
||||
* @Copyright Patrick Cool |
||||
* |
||||
* @package dokeos.forum |
||||
*/ |
||||
|
||||
// name of the language file that needs to be included |
||||
$language_file = array ( |
||||
'forum', |
||||
'group' |
||||
); |
||||
|
||||
// including the global dokeos file |
||||
require ('../inc/global.inc.php'); |
||||
|
||||
// the section (tabs) |
||||
$this_section=SECTION_COURSES; |
||||
|
||||
// notice for unauthorized people. |
||||
api_protect_course_script(true); |
||||
|
||||
// including additional library scripts |
||||
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'); |
||||
include_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php'); |
||||
include(api_get_path(LIBRARY_PATH).'events.lib.inc.php'); |
||||
include('forumfunction.inc.php'); |
||||
include('forumconfig.inc.php'); |
||||
|
||||
//are we in a lp ? |
||||
$origin = ''; |
||||
if (isset($_GET['origin'])) { |
||||
$origin = Security::remove_XSS($_GET['origin']); |
||||
} |
||||
|
||||
// name of the tool |
||||
$nameTools=get_lang('Forum'); |
||||
|
||||
// breadcrumbs |
||||
|
||||
if (isset($_SESSION['gradebook'])){ |
||||
$gradebook= $_SESSION['gradebook']; |
||||
} |
||||
|
||||
if (!empty($gradebook) && $gradebook=='view') { |
||||
$interbreadcrumb[]= array ( |
||||
'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
||||
'name' => get_lang('Gradebook') |
||||
); |
||||
} |
||||
|
||||
if (!empty ($_GET['gidReq'])) { |
||||
$toolgroup = Database::escape_string($_GET['gidReq']); |
||||
api_session_register('toolgroup'); |
||||
} |
||||
|
||||
if (!empty($_SESSION['toolgroup'])) { |
||||
$_clean['toolgroup']=(int)$_SESSION['toolgroup']; |
||||
$group_properties = GroupManager :: get_group_properties($_clean['toolgroup']); |
||||
$interbreadcrumb[] = array ("url" => "../group/group.php", "name" => get_lang('Groups')); |
||||
$interbreadcrumb[] = array ("url" => "../group/group_space.php?gidReq=".$_SESSION['toolgroup'], "name"=> get_lang('GroupSpace').' ('.$group_properties['name'].')'); |
||||
$interbreadcrumb[] = array ("url" => "viewforum.php?origin=".$origin."&gidReq=".$_SESSION['toolgroup']."&forum=".Security::remove_XSS($_GET['forum']),"name" => prepare4display($current_forum['forum_title'])); |
||||
$interbreadcrumb[]=array('url' => 'forumsearch.php','name' => get_lang('ForumSearch')); |
||||
} else { |
||||
$interbreadcrumb[]=array('url' => 'index.php?gradebook='.$gradebook.'','name' => $nameTools); |
||||
$interbreadcrumb[]=array('url' => 'forumsearch.php','name' => get_lang('ForumSearch')); |
||||
} |
||||
|
||||
// Display the header |
||||
if ($origin=='learnpath') { |
||||
include(api_get_path(INCLUDE_PATH).'reduced_header.inc.php'); |
||||
} else { |
||||
Display :: display_header($nameTools); |
||||
} |
||||
|
||||
// Display the tool title |
||||
// api_display_tool_title($nameTools); |
||||
|
||||
// tool introduction |
||||
|
||||
// Tool introduction |
||||
$fck_attribute['Width'] = '100%'; |
||||
$fck_attribute['Height'] = '300'; |
||||
$fck_attribute['ToolbarSet'] = 'Introduction'; |
||||
Display::display_introduction_section(TOOL_FORUM,'left'); |
||||
$fck_attribute = null; // Clearing this global variable immediatelly after it has been used. |
||||
|
||||
// tracking |
||||
event_access_tool(TOOL_FORUM); |
||||
|
||||
// forum search |
||||
forum_search(); |
||||
|
||||
// footer |
||||
if ($origin!='learnpath') { |
||||
Display :: display_footer(); |
||||
} |
||||
<?php // $Id: document.php 16494 2008-10-10 22:07:36Z yannoo $
|
||||
|
||||
/* |
||||
============================================================================== |
||||
Dokeos - elearning and course management software |
||||
|
||||
Copyright (c) 2004-2008 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 |
||||
============================================================================== |
||||
*/ |
||||
|
||||
/** |
||||
* These files are a complete rework of the forum. The database structure is |
||||
* based on phpBB but all the code is rewritten. A lot of new functionalities |
||||
* are added: |
||||
* - forum categories and forums can be sorted up or down, locked or made invisible |
||||
* - consistent and integrated forum administration |
||||
* - forum options: are students allowed to edit their post? |
||||
* moderation of posts (approval) |
||||
* reply only forums (students cannot create new threads) |
||||
* multiple forums per group |
||||
* - sticky messages |
||||
* - new view option: nested view |
||||
* - quoting a message |
||||
* |
||||
* @Author Patrick Cool <patrick.cool@UGent.be>, Ghent University |
||||
* @Copyright Ghent University |
||||
* @Copyright Patrick Cool |
||||
* |
||||
* @package dokeos.forum |
||||
*/ |
||||
|
||||
// name of the language file that needs to be included |
||||
$language_file = array ( |
||||
'forum', |
||||
'group' |
||||
); |
||||
|
||||
// including the global dokeos file |
||||
require ('../inc/global.inc.php'); |
||||
|
||||
// the section (tabs) |
||||
$this_section=SECTION_COURSES; |
||||
|
||||
// notice for unauthorized people. |
||||
api_protect_course_script(true); |
||||
|
||||
// including additional library scripts |
||||
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'); |
||||
include_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php'); |
||||
include(api_get_path(LIBRARY_PATH).'events.lib.inc.php'); |
||||
include('forumfunction.inc.php'); |
||||
include('forumconfig.inc.php'); |
||||
|
||||
//are we in a lp ? |
||||
$origin = ''; |
||||
if (isset($_GET['origin'])) { |
||||
$origin = Security::remove_XSS($_GET['origin']); |
||||
} |
||||
|
||||
// name of the tool |
||||
$nameTools=get_lang('Forum'); |
||||
|
||||
// breadcrumbs |
||||
|
||||
if (isset($_SESSION['gradebook'])){ |
||||
$gradebook= $_SESSION['gradebook']; |
||||
} |
||||
|
||||
if (!empty($gradebook) && $gradebook=='view') { |
||||
$interbreadcrumb[]= array ( |
||||
'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
||||
'name' => get_lang('Gradebook') |
||||
); |
||||
} |
||||
|
||||
if (!empty ($_GET['gidReq'])) { |
||||
$toolgroup = Database::escape_string($_GET['gidReq']); |
||||
api_session_register('toolgroup'); |
||||
} |
||||
|
||||
if (!empty($_SESSION['toolgroup'])) { |
||||
$_clean['toolgroup']=(int)$_SESSION['toolgroup']; |
||||
$group_properties = GroupManager :: get_group_properties($_clean['toolgroup']); |
||||
$interbreadcrumb[] = array ("url" => "../group/group.php", "name" => get_lang('Groups')); |
||||
$interbreadcrumb[] = array ("url" => "../group/group_space.php?gidReq=".$_SESSION['toolgroup'], "name"=> get_lang('GroupSpace').' ('.$group_properties['name'].')'); |
||||
$interbreadcrumb[] = array ("url" => "viewforum.php?origin=".$origin."&gidReq=".$_SESSION['toolgroup']."&forum=".Security::remove_XSS($_GET['forum']),"name" => prepare4display($current_forum['forum_title'])); |
||||
$interbreadcrumb[]=array('url' => 'forumsearch.php','name' => get_lang('ForumSearch')); |
||||
} else { |
||||
$interbreadcrumb[]=array('url' => 'index.php?gradebook='.$gradebook.'','name' => $nameTools); |
||||
$interbreadcrumb[]=array('url' => 'forumsearch.php','name' => get_lang('ForumSearch')); |
||||
} |
||||
|
||||
// Display the header |
||||
if ($origin=='learnpath') { |
||||
include(api_get_path(INCLUDE_PATH).'reduced_header.inc.php'); |
||||
} else { |
||||
Display :: display_header($nameTools); |
||||
} |
||||
|
||||
// Display the tool title |
||||
// api_display_tool_title($nameTools); |
||||
|
||||
// Tool introduction |
||||
Display::display_introduction_section(TOOL_FORUM); |
||||
|
||||
// tracking |
||||
event_access_tool(TOOL_FORUM); |
||||
|
||||
// forum search |
||||
forum_search(); |
||||
|
||||
// footer |
||||
if ($origin!='learnpath') { |
||||
Display :: display_footer(); |
||||
} |
||||
|
@ -1,482 +1,478 @@ |
||||
<?php // $Id: document.php 16494 2008-10-10 22:07:36Z yannoo $
|
||||
|
||||
/* |
||||
============================================================================== |
||||
Dokeos - elearning and course management software |
||||
|
||||
Copyright (c) 2004-2008 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 |
||||
============================================================================== |
||||
*/ |
||||
|
||||
/** |
||||
* These files are a complete rework of the forum. The database structure is |
||||
* based on phpBB but all the code is rewritten. A lot of new functionalities |
||||
* are added: |
||||
* - forum categories and forums can be sorted up or down, locked or made invisible |
||||
* - consistent and integrated forum administration |
||||
* - forum options: are students allowed to edit their post? |
||||
* moderation of posts (approval) |
||||
* reply only forums (students cannot create new threads) |
||||
* multiple forums per group |
||||
* - sticky messages |
||||
* - new view option: nested view |
||||
* - quoting a message |
||||
* |
||||
* @Author Patrick Cool <patrick.cool@UGent.be>, Ghent University |
||||
* @Copyright Ghent University |
||||
* @Copyright Patrick Cool |
||||
* |
||||
* @package dokeos.forum |
||||
*/ |
||||
|
||||
// name of the language file that needs to be included |
||||
$language_file = 'forum'; |
||||
|
||||
// including the global dokeos file |
||||
require '../inc/global.inc.php'; |
||||
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/jquery.js" ></script>'; |
||||
$htmlHeadXtra[] = '<script type="text/javascript" language="javascript"> |
||||
$(document).ready(function(){ $(\'.hide-me\').slideUp() }); |
||||
function hidecontent(content){ $(content).slideToggle(\'normal\'); } |
||||
</script>'; |
||||
$htmlHeadXtra[] = '<script type="text/javascript" language="javascript"> |
||||
|
||||
function advanced_parameters() { |
||||
if(document.getElementById(\'options\').style.display == \'none\') { |
||||
document.getElementById(\'options\').style.display = \'block\'; |
||||
document.getElementById(\'plus_minus\').innerHTML=\' '.Display::return_icon('div_hide.gif').' '.get_lang('AdvancedParameters').'\'; |
||||
} else { |
||||
document.getElementById(\'options\').style.display = \'none\'; |
||||
document.getElementById(\'plus_minus\').innerHTML=\' '.Display::return_icon('div_show.gif').' '.get_lang('AdvancedParameters').'\'; |
||||
} |
||||
} |
||||
</script>'; |
||||
// the section (tabs) |
||||
$this_section=SECTION_COURSES; |
||||
|
||||
// notice for unauthorized people. |
||||
api_protect_course_script(true); |
||||
|
||||
// including additional library scripts |
||||
require_once(api_get_path(LIBRARY_PATH).'/text.lib.php'); |
||||
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'); |
||||
require_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php'); |
||||
$nameTools=get_lang('Forums'); |
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Including necessary files |
||||
----------------------------------------------------------- |
||||
*/ |
||||
require 'forumconfig.inc.php'; |
||||
require_once 'forumfunction.inc.php'; |
||||
|
||||
$fck_attribute['Width'] = '100%'; |
||||
$fck_attribute['Height'] = '400'; |
||||
|
||||
$fck_attribute['Config']['IMUploadPath'] = 'upload/forum/'; |
||||
$fck_attribute['Config']['FlashUploadPath'] = 'upload/forum/'; |
||||
$fck_attribute['Config']['InDocument'] = false; |
||||
$fck_attribute['Config']['CreateDocumentDir'] = '../../courses/'.api_get_course_path().'/document/'; |
||||
|
||||
if(!api_is_allowed_to_edit(false,true)) { |
||||
$fck_attribute['Config']['UserStatus'] = 'student'; |
||||
$fck_attribute['ToolbarSet'] = 'Forum_Student'; |
||||
} |
||||
else |
||||
{ |
||||
$fck_attribute['ToolbarSet'] = 'Forum'; |
||||
} |
||||
|
||||
/* |
||||
============================================================================== |
||||
MAIN DISPLAY SECTION |
||||
============================================================================== |
||||
*/ |
||||
/* |
||||
----------------------------------------------------------- |
||||
Header |
||||
----------------------------------------------------------- |
||||
*/ |
||||
|
||||
if (!empty($_GET['gradebook']) && $_GET['gradebook']=='view' ) { |
||||
$_SESSION['gradebook']=Security::remove_XSS($_GET['gradebook']); |
||||
$gradebook= $_SESSION['gradebook']; |
||||
} elseif (empty($_GET['gradebook'])) { |
||||
unset($_SESSION['gradebook']); |
||||
$gradebook= ''; |
||||
} |
||||
|
||||
if (!empty($gradebook) && $gradebook=='view') { |
||||
$interbreadcrumb[] = array ( |
||||
'url' => '../gradebook/' . $_SESSION['gradebook_dest'], |
||||
'name' => get_lang('Gradebook') |
||||
); |
||||
} |
||||
|
||||
$search_forum=isset($_GET['search']) ? Security::remove_XSS($_GET['search']) : ''; |
||||
$interbreadcrumb[]=array("url" => "index.php?gradebook=$gradebook&search=".$search_forum,"name" => $nameTools); |
||||
|
||||
if (isset($_GET['action']) && $_GET['action']=='add' ) { |
||||
|
||||
switch ($_GET['content']) { |
||||
case 'forum': $interbreadcrumb[] = array ("url" => api_get_self().'?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=add&content=forum', 'name' => get_lang('AddForum')); break; |
||||
case 'forumcategory':$interbreadcrumb[] = array ("url" => api_get_self().'?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=add&content=forumcategory', 'name' => get_lang('AddForumCategory'));break; |
||||
default: break; |
||||
} |
||||
} |
||||
|
||||
Display :: display_header(''); |
||||
|
||||
// api_display_tool_title($nameTools); |
||||
//echo '<link href="forumstyles.css" rel="stylesheet" type="text/css" />'; |
||||
|
||||
// Tool introduction |
||||
$fck_attribute['Width'] = '100%'; |
||||
$fck_attribute['Height'] = '300'; |
||||
$fck_attribute['ToolbarSet'] = 'Introduction'; |
||||
Display::display_introduction_section(TOOL_FORUM,'left'); |
||||
$fck_attribute = null; // Clearing this global variable immediatelly after it has been used. |
||||
|
||||
$form_count=0; |
||||
|
||||
|
||||
/* |
||||
------------------------------------------------------------------------------------------------------ |
||||
ACTIONS |
||||
------------------------------------------------------------------------------------------------------ |
||||
*/ |
||||
$get_actions=isset($_GET['action']) ? $_GET['action'] : ''; |
||||
if (api_is_allowed_to_edit(false,true)) { |
||||
$fck_attribute['Width'] = '98%'; |
||||
$fck_attribute['Height'] = '200'; |
||||
$fck_attribute['ToolbarSet'] = 'Forum'; |
||||
handle_forum_and_forumcategories(); |
||||
} |
||||
|
||||
// notification |
||||
if (isset($_GET['action']) && $_GET['action'] == 'notify' AND isset($_GET['content']) AND isset($_GET['id'])) { |
||||
$return_message = set_notification($_GET['content'],$_GET['id']); |
||||
Display :: display_confirmation_message($return_message,false); |
||||
} |
||||
|
||||
get_whats_new(); |
||||
$whatsnew_post_info = array(); |
||||
$whatsnew_post_info = $_SESSION['whatsnew_post_info']; |
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
TRACKING |
||||
----------------------------------------------------------- |
||||
*/ |
||||
|
||||
include(api_get_path(LIBRARY_PATH).'events.lib.inc.php'); |
||||
event_access_tool(TOOL_FORUM); |
||||
|
||||
|
||||
/* |
||||
------------------------------------------------------------------------------------------------------ |
||||
RETRIEVING ALL THE FORUM CATEGORIES AND FORUMS |
||||
------------------------------------------------------------------------------------------------------ |
||||
note: we do this here just after het handling of the actions to be sure that we already incorporate the |
||||
latest changes |
||||
*/ |
||||
// Step 1: We store all the forum categories in an array $forum_categories |
||||
$forum_categories=array(); |
||||
$forum_categories_list=get_forum_categories(); |
||||
|
||||
// step 2: we find all the forums (only the visible ones if it is a student) |
||||
$forum_list=array(); |
||||
$forum_list=get_forums(); |
||||
|
||||
/* |
||||
------------------------------------------------------------------------------------------------------ |
||||
RETRIEVING ALL GROUPS AND THOSE OF THE USER |
||||
------------------------------------------------------------------------------------------------------ |
||||
*/ |
||||
// the groups of the user |
||||
$groups_of_user=array(); |
||||
$groups_of_user=GroupManager::get_group_ids($_course['dbName'], $_user['user_id']); |
||||
// all groups in the course (and sorting them as the id of the group = the key of the array |
||||
if (!api_is_anonymous()) { |
||||
$all_groups=GroupManager::get_group_list(); |
||||
if(is_array($all_groups)) { |
||||
foreach ($all_groups as $group) { |
||||
$all_groups[$group['id']]=$group; |
||||
} |
||||
} |
||||
} |
||||
|
||||
/* |
||||
------------------------------------------------------------------------------------------------------ |
||||
CLEAN GROUP ID FOR AJAXFILEMANAGER |
||||
------------------------------------------------------------------------------------------------------ |
||||
*/ |
||||
if(isset($_SESSION['_gid'])) |
||||
{ |
||||
unset($_SESSION['_gid']); |
||||
} |
||||
|
||||
/* |
||||
------------------------------------------------------------------------------------------------------ |
||||
ACTION LINKS |
||||
------------------------------------------------------------------------------------------------------ |
||||
*/ |
||||
$session_id=isset($_SESSION['id_session']) ? $_SESSION['id_session'] : false; |
||||
//if (api_is_allowed_to_edit() and !$_GET['action']) |
||||
echo '<div class="actions">'; |
||||
echo '<span>'.search_link().'</span>'; |
||||
if (api_is_allowed_to_edit(false,true)) { |
||||
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=add&content=forumcategory"> '.Display::return_icon('forum_category_new.gif', get_lang('AddForumCategory')).' '.get_lang('AddForumCategory').'</a>'; |
||||
if (is_array($forum_categories_list) and !empty($forum_categories_list)) { |
||||
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=add&content=forum"> '.Display::return_icon('forum_new.gif', get_lang('AddForum')).' '.get_lang('AddForum').'</a>'; |
||||
} |
||||
//echo ' | <a href="forum_migration.php">'.get_lang('MigrateForum').'</a>'; |
||||
} |
||||
echo '</div>'; |
||||
|
||||
/* |
||||
------------------------------------------------------------------------------------------------------ |
||||
Display Forum Categories and the Forums in it |
||||
------------------------------------------------------------------------------------------------------ |
||||
*/ |
||||
echo '<table class="data_table">'."\n"; |
||||
// Step 3: we display the forum_categories first |
||||
if(is_array($forum_categories_list)) { |
||||
foreach ($forum_categories_list as $forum_category_key => $forum_category) { |
||||
if((!isset($_SESSION['id_session']) || $_SESSION['id_session']==0) && !empty($forum_category['session_name'])) { |
||||
$session_displayed = ' ('.$forum_category['session_name'].')'; |
||||
} else { |
||||
$session_displayed = ''; |
||||
} |
||||
|
||||
echo "\t<tr>\n\t\t<th style=\"padding-left:5px;\" align=\"left\" colspan=\"5\">"; |
||||
echo '<a href="viewforumcategory.php?'.api_get_cidreq().'&forumcategory='.prepare4display($forum_category['cat_id']).'" '.class_visible_invisible(prepare4display($forum_category['visibility'])).'>'.prepare4display($forum_category['cat_title']).$session_displayed.'</a><br />'; |
||||
|
||||
if ($forum_category['cat_comment']<>'' AND trim($forum_category['cat_comment'])<>' ') { |
||||
echo '<span class="forum_description">'.prepare4display($forum_category['cat_comment']).'</span>'; |
||||
} |
||||
echo "</th>\n"; |
||||
|
||||
echo '<th style="vertical-align: top;" align="center" >'; |
||||
if (api_is_allowed_to_edit(false,true) && !($forum_category['session_id']==0 && intval($session_id)!=0)) { |
||||
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&gradebook=$gradebook&action=edit&content=forumcategory&id=".prepare4display($forum_category['cat_id'])."\">".icon('../img/edit.gif',get_lang('Edit'))."</a>"; |
||||
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&gradebook=$gradebook&action=delete&content=forumcategory&id=".prepare4display($forum_category['cat_id'])."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang("DeleteForumCategory"),ENT_QUOTES,$charset))."')) return false;\">".icon('../img/delete.gif',get_lang('Delete'))."</a>"; |
||||
display_visible_invisible_icon('forumcategory', prepare4display($forum_category['cat_id']), prepare4display($forum_category['visibility'])); |
||||
display_lock_unlock_icon('forumcategory',prepare4display($forum_category['cat_id']), prepare4display($forum_category['locked'])); |
||||
display_up_down_icon('forumcategory',prepare4display($forum_category['cat_id']), $forum_categories_list); |
||||
} |
||||
echo '</th>'; |
||||
echo "\t</tr>\n"; |
||||
|
||||
// step 4: the interim headers (for the forum) |
||||
echo "\t<tr class=\"forum_header\">\n"; |
||||
echo "\t\t<td colspan=\"2\">".get_lang('Forum')."</td>\n"; |
||||
echo "\t\t<td>".get_lang('Topics')."</td>\n"; |
||||
echo "\t\t<td>".get_lang('Posts')."</td>\n"; |
||||
echo "\t\t<td>".get_lang('LastPosts')."</td>\n"; |
||||
echo "\t\t<td>".get_lang('Actions')."</td>\n"; |
||||
echo "\t</tr>\n"; |
||||
|
||||
// the forums in this category |
||||
$forums_in_category=get_forums_in_category($forum_category['cat_id']); |
||||
|
||||
// step 5: we display all the forums in this category. |
||||
$forum_count=0; |
||||
|
||||
foreach ($forum_list as $key=>$forum) { |
||||
// Here we clean the whatnew_post_info array a little bit because to display the icon we |
||||
// test if $whatsnew_post_info[$forum['forum_id']] is empty or not. |
||||
if (!empty($whatsnew_post_info)) { |
||||
if (is_array(isset($whatsnew_post_info[$forum['forum_id']])?$whatsnew_post_info[$forum['forum_id']]:null)) { |
||||
foreach ($whatsnew_post_info[$forum['forum_id']] as $key_thread_id => $new_post_array) { |
||||
if (empty($whatsnew_post_info[$forum['forum_id']][$key_thread_id])) { |
||||
unset($whatsnew_post_info[$forum['forum_id']][$key_thread_id]); |
||||
unset($_SESSION['whatsnew_post_info'][$forum['forum_id']][$key_thread_id]); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
// note: this can be speeded up if we transform the $forum_list to an array that uses the forum_category as the key. |
||||
if (prepare4display($forum['forum_category'])==prepare4display($forum_category['cat_id'])) { |
||||
// the forum has to be showed if |
||||
// 1.v it is a not a group forum (teacher and student) |
||||
// 2.v it is a group forum and it is public (teacher and student) |
||||
// 3. it is a group forum and it is private (always for teachers only if the user is member of the forum |
||||
// if the forum is private and it is a group forum and the user is not a member of the group forum then it cannot be displayed |
||||
//if (!($forum['forum_group_public_private']=='private' AND !is_null($forum['forum_of_group']) AND !in_array($forum['forum_of_group'], $groups_of_user))) |
||||
//{ |
||||
$show_forum=false; |
||||
|
||||
// SHOULD WE SHOW THIS PARTICULAR FORUM |
||||
// you are teacher => show forum |
||||
|
||||
if (api_is_allowed_to_edit(false,true)) { |
||||
//echo 'teacher'; |
||||
$show_forum=true; |
||||
} else {// you are not a teacher |
||||
//echo 'student'; |
||||
// it is not a group forum => show forum (invisible forums are already left out see get_forums function) |
||||
if ($forum['forum_of_group']=='0') { |
||||
//echo '-gewoon forum'; |
||||
$show_forum=true; |
||||
} else { |
||||
// it is a group forum |
||||
//echo '-groepsforum'; |
||||
// it is a group forum but it is public => show |
||||
if ($forum['forum_group_public_private']=='public') { |
||||
$show_forum=true; |
||||
//echo '-publiek'; |
||||
} else if ($forum['forum_group_public_private']=='private') { |
||||
// it is a group forum and it is private |
||||
//echo '-prive'; |
||||
// it is a group forum and it is private but the user is member of the group |
||||
if (in_array($forum['forum_of_group'],$groups_of_user)) { |
||||
//echo '-is lid'; |
||||
$show_forum=true; |
||||
} else { |
||||
//echo '-is GEEN lid'; |
||||
$show_forum=false; |
||||
} |
||||
} else { |
||||
$show_forum=false; |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
|
||||
//echo '<hr>'; |
||||
|
||||
if ($show_forum) { |
||||
$form_count++; |
||||
$mywhatsnew_post_info=isset($whatsnew_post_info[$forum['forum_id']]) ? $whatsnew_post_info[$forum['forum_id']]: null; |
||||
echo "\t<tr class=\"forum\">\n"; |
||||
|
||||
// Showing the image |
||||
if(!empty($forum['forum_image'])) { |
||||
|
||||
$image_path = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/forum/images/'.$forum['forum_image']; |
||||
$image_size = @getimagesize(api_url_to_local_path($image_path)); |
||||
|
||||
$img_attributes = ''; |
||||
if (!empty($image_size)) { |
||||
if ($image_size[0] > 100 || $image_size[1] > 100) { |
||||
//limit display width and height to 100px |
||||
$img_attributes = 'width="100" height="100"'; |
||||
} |
||||
echo "<img src=\"$image_path\" $img_attributes>"; |
||||
} |
||||
} |
||||
echo "</td>\n"; |
||||
echo "\t\t<td width=\"20\">"; |
||||
|
||||
if ($forum['forum_of_group']!=='0') { |
||||
if (is_array($mywhatsnew_post_info) and !empty($mywhatsnew_post_info)) { |
||||
echo icon('../img/forumgroupnew.gif'); |
||||
} else { |
||||
echo icon('../img/forumgroup.gif', get_lang('GroupForum')); |
||||
} |
||||
} else { |
||||
|
||||
if (is_array($mywhatsnew_post_info) and !empty($mywhatsnew_post_info)) { |
||||
echo icon('../img/forum.gif', get_lang('Forum')); |
||||
} else { |
||||
echo icon('../img/forum.gif'); |
||||
} |
||||
|
||||
} |
||||
echo "</td>\n"; |
||||
if ($forum['forum_of_group']<>'0') { |
||||
$my_all_groups_forum_name=isset($all_groups[$forum['forum_of_group']]['name']) ? $all_groups[$forum['forum_of_group']]['name'] : null; |
||||
$my_all_groups_forum_id=isset($all_groups[$forum['forum_of_group']]['id']) ? $all_groups[$forum['forum_of_group']]['id'] : null; |
||||
$group_title=api_substr($my_all_groups_forum_name,0,30); |
||||
|
||||
$forum_title_group_addition=' (<a href="../group/group_space.php?'.api_get_cidreq().'&gidReq='.$forum['forum_of_group'].'" class="forum_group_link">'.get_lang('GoTo').' '.$group_title.'</a>)'; |
||||
|
||||
} else { |
||||
$forum_title_group_addition=''; |
||||
} |
||||
|
||||
if((!isset($_SESSION['id_session']) || $_SESSION['id_session']==0) && !empty($forum['session_name'])) { |
||||
$session_displayed = ' ('.$forum['session_name'].')'; |
||||
} else { |
||||
$session_displayed = ''; |
||||
} |
||||
$forum['forum_of_group']==0?$groupid='':$groupid=$forum['forum_of_group']; |
||||
|
||||
echo "\t\t<td><a href=\"viewforum.php?".api_get_cidreq()."&gidReq=".Security::remove_XSS($groupid)."&forum=".prepare4display($forum['forum_id'])."\" ".class_visible_invisible(prepare4display($forum['visibility'])).">".prepare4display($forum['forum_title']).$session_displayed.'</a>'.$forum_title_group_addition.'<br />'.prepare4display($forum['forum_comment'])."</td>\n"; |
||||
//$number_forum_topics_and_posts=get_post_topics_of_forum($forum['forum_id']); // deprecated |
||||
// the number of topics and posts |
||||
$number_threads=isset($forum['number_of_threads']) ? $forum['number_of_threads'] : null; |
||||
$number_posts =isset($forum['number_of_posts']) ? $forum['number_of_posts'] : null; |
||||
echo "\t\t<td>".$number_threads."</td>\n"; |
||||
echo "\t\t<td>".$number_posts."</td>\n"; |
||||
// the last post in the forum |
||||
if ($forum['last_poster_name']<>'') { |
||||
$name=$forum['last_poster_name']; |
||||
$poster_id=0; |
||||
} else { |
||||
$name=$forum['last_poster_firstname'].' '.$forum['last_poster_lastname']; |
||||
$poster_id=$forum['last_poster_id']; |
||||
} |
||||
echo "\t\t<td nowrap=\"nowrap\">"; |
||||
|
||||
if (!empty($forum['last_post_id'])) { |
||||
echo $forum['last_post_date']."<br /> ".get_lang('By').' '.display_user_link($poster_id, $name); |
||||
} |
||||
echo "</td>\n"; |
||||
echo "\t\t<td nowrap=\"nowrap\" align=\"center\">"; |
||||
if (api_is_allowed_to_edit(false,true) && !($forum['session_id']==0 && intval($session_id)!=0)) { |
||||
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&gradebook=$gradebook&action=edit&content=forum&id=".$forum['forum_id']."\">".icon('../img/edit.gif',get_lang('Edit'))."</a>"; |
||||
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&gradebook=$gradebook&action=delete&content=forum&id=".$forum['forum_id']."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang("DeleteForum"),ENT_QUOTES,$charset))."')) return false;\">".icon('../img/delete.gif',get_lang('Delete'))."</a>"; |
||||
display_visible_invisible_icon('forum',$forum['forum_id'], $forum['visibility']); |
||||
display_lock_unlock_icon('forum',$forum['forum_id'], $forum['locked']); |
||||
display_up_down_icon('forum',$forum['forum_id'], $forums_in_category); |
||||
} |
||||
$iconnotify = 'send_mail.gif'; |
||||
$session_forum_noti=isset($_SESSION['forum_notification']['forum']) ? $_SESSION['forum_notification']['forum'] : false; |
||||
if (is_array($session_forum_noti)) { |
||||
if (in_array($forum['forum_id'],$session_forum_noti)) { |
||||
$iconnotify = 'send_mail_checked.gif'; |
||||
} |
||||
} |
||||
if (!api_is_anonymous()) { |
||||
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&gradebook=$gradebook&action=notify&content=forum&id=".$forum['forum_id']."\">".icon('../img/'.$iconnotify,get_lang('NotifyMe'))."</a>"; |
||||
} |
||||
echo "</td>\n"; |
||||
echo "\t</tr>"; |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (count($forum_list)==0) { |
||||
echo "\t<tr><td>".get_lang('NoForumInThisCategory')."</td>".(api_is_allowed_to_edit(false,true)?'<td colspan="6"></td>':'<td colspan="6"></td>')."</tr>\n"; |
||||
} |
||||
} |
||||
} |
||||
echo "</table>\n"; |
||||
|
||||
/* |
||||
============================================================================== |
||||
FOOTER |
||||
============================================================================== |
||||
*/ |
||||
Display :: display_footer(); |
||||
<?php // $Id: document.php 16494 2008-10-10 22:07:36Z yannoo $
|
||||
|
||||
/* |
||||
============================================================================== |
||||
Dokeos - elearning and course management software |
||||
|
||||
Copyright (c) 2004-2008 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 |
||||
============================================================================== |
||||
*/ |
||||
|
||||
/** |
||||
* These files are a complete rework of the forum. The database structure is |
||||
* based on phpBB but all the code is rewritten. A lot of new functionalities |
||||
* are added: |
||||
* - forum categories and forums can be sorted up or down, locked or made invisible |
||||
* - consistent and integrated forum administration |
||||
* - forum options: are students allowed to edit their post? |
||||
* moderation of posts (approval) |
||||
* reply only forums (students cannot create new threads) |
||||
* multiple forums per group |
||||
* - sticky messages |
||||
* - new view option: nested view |
||||
* - quoting a message |
||||
* |
||||
* @Author Patrick Cool <patrick.cool@UGent.be>, Ghent University |
||||
* @Copyright Ghent University |
||||
* @Copyright Patrick Cool |
||||
* |
||||
* @package dokeos.forum |
||||
*/ |
||||
|
||||
// name of the language file that needs to be included |
||||
$language_file = 'forum'; |
||||
|
||||
// including the global dokeos file |
||||
require '../inc/global.inc.php'; |
||||
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/jquery.js" ></script>'; |
||||
$htmlHeadXtra[] = '<script type="text/javascript" language="javascript"> |
||||
$(document).ready(function(){ $(\'.hide-me\').slideUp() }); |
||||
function hidecontent(content){ $(content).slideToggle(\'normal\'); } |
||||
</script>'; |
||||
$htmlHeadXtra[] = '<script type="text/javascript" language="javascript"> |
||||
|
||||
function advanced_parameters() { |
||||
if(document.getElementById(\'options\').style.display == \'none\') { |
||||
document.getElementById(\'options\').style.display = \'block\'; |
||||
document.getElementById(\'plus_minus\').innerHTML=\' '.Display::return_icon('div_hide.gif').' '.get_lang('AdvancedParameters').'\'; |
||||
} else { |
||||
document.getElementById(\'options\').style.display = \'none\'; |
||||
document.getElementById(\'plus_minus\').innerHTML=\' '.Display::return_icon('div_show.gif').' '.get_lang('AdvancedParameters').'\'; |
||||
} |
||||
} |
||||
</script>'; |
||||
// the section (tabs) |
||||
$this_section=SECTION_COURSES; |
||||
|
||||
// notice for unauthorized people. |
||||
api_protect_course_script(true); |
||||
|
||||
// including additional library scripts |
||||
require_once(api_get_path(LIBRARY_PATH).'/text.lib.php'); |
||||
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'); |
||||
require_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php'); |
||||
$nameTools=get_lang('Forums'); |
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Including necessary files |
||||
----------------------------------------------------------- |
||||
*/ |
||||
require 'forumconfig.inc.php'; |
||||
require_once 'forumfunction.inc.php'; |
||||
|
||||
$fck_attribute['Width'] = '100%'; |
||||
$fck_attribute['Height'] = '400'; |
||||
|
||||
$fck_attribute['Config']['IMUploadPath'] = 'upload/forum/'; |
||||
$fck_attribute['Config']['FlashUploadPath'] = 'upload/forum/'; |
||||
$fck_attribute['Config']['InDocument'] = false; |
||||
$fck_attribute['Config']['CreateDocumentDir'] = '../../courses/'.api_get_course_path().'/document/'; |
||||
|
||||
if(!api_is_allowed_to_edit(false,true)) { |
||||
$fck_attribute['Config']['UserStatus'] = 'student'; |
||||
$fck_attribute['ToolbarSet'] = 'Forum_Student'; |
||||
} |
||||
else |
||||
{ |
||||
$fck_attribute['ToolbarSet'] = 'Forum'; |
||||
} |
||||
|
||||
/* |
||||
============================================================================== |
||||
MAIN DISPLAY SECTION |
||||
============================================================================== |
||||
*/ |
||||
/* |
||||
----------------------------------------------------------- |
||||
Header |
||||
----------------------------------------------------------- |
||||
*/ |
||||
|
||||
if (!empty($_GET['gradebook']) && $_GET['gradebook']=='view' ) { |
||||
$_SESSION['gradebook']=Security::remove_XSS($_GET['gradebook']); |
||||
$gradebook= $_SESSION['gradebook']; |
||||
} elseif (empty($_GET['gradebook'])) { |
||||
unset($_SESSION['gradebook']); |
||||
$gradebook= ''; |
||||
} |
||||
|
||||
if (!empty($gradebook) && $gradebook=='view') { |
||||
$interbreadcrumb[] = array ( |
||||
'url' => '../gradebook/' . $_SESSION['gradebook_dest'], |
||||
'name' => get_lang('Gradebook') |
||||
); |
||||
} |
||||
|
||||
$search_forum=isset($_GET['search']) ? Security::remove_XSS($_GET['search']) : ''; |
||||
$interbreadcrumb[]=array("url" => "index.php?gradebook=$gradebook&search=".$search_forum,"name" => $nameTools); |
||||
|
||||
if (isset($_GET['action']) && $_GET['action']=='add' ) { |
||||
|
||||
switch ($_GET['content']) { |
||||
case 'forum': $interbreadcrumb[] = array ("url" => api_get_self().'?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=add&content=forum', 'name' => get_lang('AddForum')); break; |
||||
case 'forumcategory':$interbreadcrumb[] = array ("url" => api_get_self().'?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=add&content=forumcategory', 'name' => get_lang('AddForumCategory'));break; |
||||
default: break; |
||||
} |
||||
} |
||||
|
||||
Display :: display_header(''); |
||||
|
||||
// api_display_tool_title($nameTools); |
||||
//echo '<link href="forumstyles.css" rel="stylesheet" type="text/css" />'; |
||||
|
||||
// Tool introduction |
||||
Display::display_introduction_section(TOOL_FORUM); |
||||
|
||||
$form_count=0; |
||||
|
||||
|
||||
/* |
||||
------------------------------------------------------------------------------------------------------ |
||||
ACTIONS |
||||
------------------------------------------------------------------------------------------------------ |
||||
*/ |
||||
$get_actions=isset($_GET['action']) ? $_GET['action'] : ''; |
||||
if (api_is_allowed_to_edit(false,true)) { |
||||
$fck_attribute['Width'] = '98%'; |
||||
$fck_attribute['Height'] = '200'; |
||||
$fck_attribute['ToolbarSet'] = 'Forum'; |
||||
handle_forum_and_forumcategories(); |
||||
} |
||||
|
||||
// notification |
||||
if (isset($_GET['action']) && $_GET['action'] == 'notify' AND isset($_GET['content']) AND isset($_GET['id'])) { |
||||
$return_message = set_notification($_GET['content'],$_GET['id']); |
||||
Display :: display_confirmation_message($return_message,false); |
||||
} |
||||
|
||||
get_whats_new(); |
||||
$whatsnew_post_info = array(); |
||||
$whatsnew_post_info = $_SESSION['whatsnew_post_info']; |
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
TRACKING |
||||
----------------------------------------------------------- |
||||
*/ |
||||
|
||||
include(api_get_path(LIBRARY_PATH).'events.lib.inc.php'); |
||||
event_access_tool(TOOL_FORUM); |
||||
|
||||
|
||||
/* |
||||
------------------------------------------------------------------------------------------------------ |
||||
RETRIEVING ALL THE FORUM CATEGORIES AND FORUMS |
||||
------------------------------------------------------------------------------------------------------ |
||||
note: we do this here just after het handling of the actions to be sure that we already incorporate the |
||||
latest changes |
||||
*/ |
||||
// Step 1: We store all the forum categories in an array $forum_categories |
||||
$forum_categories=array(); |
||||
$forum_categories_list=get_forum_categories(); |
||||
|
||||
// step 2: we find all the forums (only the visible ones if it is a student) |
||||
$forum_list=array(); |
||||
$forum_list=get_forums(); |
||||
|
||||
/* |
||||
------------------------------------------------------------------------------------------------------ |
||||
RETRIEVING ALL GROUPS AND THOSE OF THE USER |
||||
------------------------------------------------------------------------------------------------------ |
||||
*/ |
||||
// the groups of the user |
||||
$groups_of_user=array(); |
||||
$groups_of_user=GroupManager::get_group_ids($_course['dbName'], $_user['user_id']); |
||||
// all groups in the course (and sorting them as the id of the group = the key of the array |
||||
if (!api_is_anonymous()) { |
||||
$all_groups=GroupManager::get_group_list(); |
||||
if(is_array($all_groups)) { |
||||
foreach ($all_groups as $group) { |
||||
$all_groups[$group['id']]=$group; |
||||
} |
||||
} |
||||
} |
||||
|
||||
/* |
||||
------------------------------------------------------------------------------------------------------ |
||||
CLEAN GROUP ID FOR AJAXFILEMANAGER |
||||
------------------------------------------------------------------------------------------------------ |
||||
*/ |
||||
if(isset($_SESSION['_gid'])) |
||||
{ |
||||
unset($_SESSION['_gid']); |
||||
} |
||||
|
||||
/* |
||||
------------------------------------------------------------------------------------------------------ |
||||
ACTION LINKS |
||||
------------------------------------------------------------------------------------------------------ |
||||
*/ |
||||
$session_id=isset($_SESSION['id_session']) ? $_SESSION['id_session'] : false; |
||||
//if (api_is_allowed_to_edit() and !$_GET['action']) |
||||
echo '<div class="actions">'; |
||||
echo '<span>'.search_link().'</span>'; |
||||
if (api_is_allowed_to_edit(false,true)) { |
||||
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=add&content=forumcategory"> '.Display::return_icon('forum_category_new.gif', get_lang('AddForumCategory')).' '.get_lang('AddForumCategory').'</a>'; |
||||
if (is_array($forum_categories_list) and !empty($forum_categories_list)) { |
||||
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=add&content=forum"> '.Display::return_icon('forum_new.gif', get_lang('AddForum')).' '.get_lang('AddForum').'</a>'; |
||||
} |
||||
//echo ' | <a href="forum_migration.php">'.get_lang('MigrateForum').'</a>'; |
||||
} |
||||
echo '</div>'; |
||||
|
||||
/* |
||||
------------------------------------------------------------------------------------------------------ |
||||
Display Forum Categories and the Forums in it |
||||
------------------------------------------------------------------------------------------------------ |
||||
*/ |
||||
echo '<table class="data_table">'."\n"; |
||||
// Step 3: we display the forum_categories first |
||||
if(is_array($forum_categories_list)) { |
||||
foreach ($forum_categories_list as $forum_category_key => $forum_category) { |
||||
if((!isset($_SESSION['id_session']) || $_SESSION['id_session']==0) && !empty($forum_category['session_name'])) { |
||||
$session_displayed = ' ('.$forum_category['session_name'].')'; |
||||
} else { |
||||
$session_displayed = ''; |
||||
} |
||||
|
||||
echo "\t<tr>\n\t\t<th style=\"padding-left:5px;\" align=\"left\" colspan=\"5\">"; |
||||
echo '<a href="viewforumcategory.php?'.api_get_cidreq().'&forumcategory='.prepare4display($forum_category['cat_id']).'" '.class_visible_invisible(prepare4display($forum_category['visibility'])).'>'.prepare4display($forum_category['cat_title']).$session_displayed.'</a><br />'; |
||||
|
||||
if ($forum_category['cat_comment']<>'' AND trim($forum_category['cat_comment'])<>' ') { |
||||
echo '<span class="forum_description">'.prepare4display($forum_category['cat_comment']).'</span>'; |
||||
} |
||||
echo "</th>\n"; |
||||
|
||||
echo '<th style="vertical-align: top;" align="center" >'; |
||||
if (api_is_allowed_to_edit(false,true) && !($forum_category['session_id']==0 && intval($session_id)!=0)) { |
||||
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&gradebook=$gradebook&action=edit&content=forumcategory&id=".prepare4display($forum_category['cat_id'])."\">".icon('../img/edit.gif',get_lang('Edit'))."</a>"; |
||||
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&gradebook=$gradebook&action=delete&content=forumcategory&id=".prepare4display($forum_category['cat_id'])."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang("DeleteForumCategory"),ENT_QUOTES,$charset))."')) return false;\">".icon('../img/delete.gif',get_lang('Delete'))."</a>"; |
||||
display_visible_invisible_icon('forumcategory', prepare4display($forum_category['cat_id']), prepare4display($forum_category['visibility'])); |
||||
display_lock_unlock_icon('forumcategory',prepare4display($forum_category['cat_id']), prepare4display($forum_category['locked'])); |
||||
display_up_down_icon('forumcategory',prepare4display($forum_category['cat_id']), $forum_categories_list); |
||||
} |
||||
echo '</th>'; |
||||
echo "\t</tr>\n"; |
||||
|
||||
// step 4: the interim headers (for the forum) |
||||
echo "\t<tr class=\"forum_header\">\n"; |
||||
echo "\t\t<td colspan=\"2\">".get_lang('Forum')."</td>\n"; |
||||
echo "\t\t<td>".get_lang('Topics')."</td>\n"; |
||||
echo "\t\t<td>".get_lang('Posts')."</td>\n"; |
||||
echo "\t\t<td>".get_lang('LastPosts')."</td>\n"; |
||||
echo "\t\t<td>".get_lang('Actions')."</td>\n"; |
||||
echo "\t</tr>\n"; |
||||
|
||||
// the forums in this category |
||||
$forums_in_category=get_forums_in_category($forum_category['cat_id']); |
||||
|
||||
// step 5: we display all the forums in this category. |
||||
$forum_count=0; |
||||
|
||||
foreach ($forum_list as $key=>$forum) { |
||||
// Here we clean the whatnew_post_info array a little bit because to display the icon we |
||||
// test if $whatsnew_post_info[$forum['forum_id']] is empty or not. |
||||
if (!empty($whatsnew_post_info)) { |
||||
if (is_array(isset($whatsnew_post_info[$forum['forum_id']])?$whatsnew_post_info[$forum['forum_id']]:null)) { |
||||
foreach ($whatsnew_post_info[$forum['forum_id']] as $key_thread_id => $new_post_array) { |
||||
if (empty($whatsnew_post_info[$forum['forum_id']][$key_thread_id])) { |
||||
unset($whatsnew_post_info[$forum['forum_id']][$key_thread_id]); |
||||
unset($_SESSION['whatsnew_post_info'][$forum['forum_id']][$key_thread_id]); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
// note: this can be speeded up if we transform the $forum_list to an array that uses the forum_category as the key. |
||||
if (prepare4display($forum['forum_category'])==prepare4display($forum_category['cat_id'])) { |
||||
// the forum has to be showed if |
||||
// 1.v it is a not a group forum (teacher and student) |
||||
// 2.v it is a group forum and it is public (teacher and student) |
||||
// 3. it is a group forum and it is private (always for teachers only if the user is member of the forum |
||||
// if the forum is private and it is a group forum and the user is not a member of the group forum then it cannot be displayed |
||||
//if (!($forum['forum_group_public_private']=='private' AND !is_null($forum['forum_of_group']) AND !in_array($forum['forum_of_group'], $groups_of_user))) |
||||
//{ |
||||
$show_forum=false; |
||||
|
||||
// SHOULD WE SHOW THIS PARTICULAR FORUM |
||||
// you are teacher => show forum |
||||
|
||||
if (api_is_allowed_to_edit(false,true)) { |
||||
//echo 'teacher'; |
||||
$show_forum=true; |
||||
} else {// you are not a teacher |
||||
//echo 'student'; |
||||
// it is not a group forum => show forum (invisible forums are already left out see get_forums function) |
||||
if ($forum['forum_of_group']=='0') { |
||||
//echo '-gewoon forum'; |
||||
$show_forum=true; |
||||
} else { |
||||
// it is a group forum |
||||
//echo '-groepsforum'; |
||||
// it is a group forum but it is public => show |
||||
if ($forum['forum_group_public_private']=='public') { |
||||
$show_forum=true; |
||||
//echo '-publiek'; |
||||
} else if ($forum['forum_group_public_private']=='private') { |
||||
// it is a group forum and it is private |
||||
//echo '-prive'; |
||||
// it is a group forum and it is private but the user is member of the group |
||||
if (in_array($forum['forum_of_group'],$groups_of_user)) { |
||||
//echo '-is lid'; |
||||
$show_forum=true; |
||||
} else { |
||||
//echo '-is GEEN lid'; |
||||
$show_forum=false; |
||||
} |
||||
} else { |
||||
$show_forum=false; |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
|
||||
//echo '<hr>'; |
||||
|
||||
if ($show_forum) { |
||||
$form_count++; |
||||
$mywhatsnew_post_info=isset($whatsnew_post_info[$forum['forum_id']]) ? $whatsnew_post_info[$forum['forum_id']]: null; |
||||
echo "\t<tr class=\"forum\">\n"; |
||||
|
||||
// Showing the image |
||||
if(!empty($forum['forum_image'])) { |
||||
|
||||
$image_path = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/forum/images/'.$forum['forum_image']; |
||||
$image_size = @getimagesize(api_url_to_local_path($image_path)); |
||||
|
||||
$img_attributes = ''; |
||||
if (!empty($image_size)) { |
||||
if ($image_size[0] > 100 || $image_size[1] > 100) { |
||||
//limit display width and height to 100px |
||||
$img_attributes = 'width="100" height="100"'; |
||||
} |
||||
echo "<img src=\"$image_path\" $img_attributes>"; |
||||
} |
||||
} |
||||
echo "</td>\n"; |
||||
echo "\t\t<td width=\"20\">"; |
||||
|
||||
if ($forum['forum_of_group']!=='0') { |
||||
if (is_array($mywhatsnew_post_info) and !empty($mywhatsnew_post_info)) { |
||||
echo icon('../img/forumgroupnew.gif'); |
||||
} else { |
||||
echo icon('../img/forumgroup.gif', get_lang('GroupForum')); |
||||
} |
||||
} else { |
||||
|
||||
if (is_array($mywhatsnew_post_info) and !empty($mywhatsnew_post_info)) { |
||||
echo icon('../img/forum.gif', get_lang('Forum')); |
||||
} else { |
||||
echo icon('../img/forum.gif'); |
||||
} |
||||
|
||||
} |
||||
echo "</td>\n"; |
||||
if ($forum['forum_of_group']<>'0') { |
||||
$my_all_groups_forum_name=isset($all_groups[$forum['forum_of_group']]['name']) ? $all_groups[$forum['forum_of_group']]['name'] : null; |
||||
$my_all_groups_forum_id=isset($all_groups[$forum['forum_of_group']]['id']) ? $all_groups[$forum['forum_of_group']]['id'] : null; |
||||
$group_title=api_substr($my_all_groups_forum_name,0,30); |
||||
|
||||
$forum_title_group_addition=' (<a href="../group/group_space.php?'.api_get_cidreq().'&gidReq='.$forum['forum_of_group'].'" class="forum_group_link">'.get_lang('GoTo').' '.$group_title.'</a>)'; |
||||
|
||||
} else { |
||||
$forum_title_group_addition=''; |
||||
} |
||||
|
||||
if((!isset($_SESSION['id_session']) || $_SESSION['id_session']==0) && !empty($forum['session_name'])) { |
||||
$session_displayed = ' ('.$forum['session_name'].')'; |
||||
} else { |
||||
$session_displayed = ''; |
||||
} |
||||
$forum['forum_of_group']==0?$groupid='':$groupid=$forum['forum_of_group']; |
||||
|
||||
echo "\t\t<td><a href=\"viewforum.php?".api_get_cidreq()."&gidReq=".Security::remove_XSS($groupid)."&forum=".prepare4display($forum['forum_id'])."\" ".class_visible_invisible(prepare4display($forum['visibility'])).">".prepare4display($forum['forum_title']).$session_displayed.'</a>'.$forum_title_group_addition.'<br />'.prepare4display($forum['forum_comment'])."</td>\n"; |
||||
//$number_forum_topics_and_posts=get_post_topics_of_forum($forum['forum_id']); // deprecated |
||||
// the number of topics and posts |
||||
$number_threads=isset($forum['number_of_threads']) ? $forum['number_of_threads'] : null; |
||||
$number_posts =isset($forum['number_of_posts']) ? $forum['number_of_posts'] : null; |
||||
echo "\t\t<td>".$number_threads."</td>\n"; |
||||
echo "\t\t<td>".$number_posts."</td>\n"; |
||||
// the last post in the forum |
||||
if ($forum['last_poster_name']<>'') { |
||||
$name=$forum['last_poster_name']; |
||||
$poster_id=0; |
||||
} else { |
||||
$name=$forum['last_poster_firstname'].' '.$forum['last_poster_lastname']; |
||||
$poster_id=$forum['last_poster_id']; |
||||
} |
||||
echo "\t\t<td nowrap=\"nowrap\">"; |
||||
|
||||
if (!empty($forum['last_post_id'])) { |
||||
echo $forum['last_post_date']."<br /> ".get_lang('By').' '.display_user_link($poster_id, $name); |
||||
} |
||||
echo "</td>\n"; |
||||
echo "\t\t<td nowrap=\"nowrap\" align=\"center\">"; |
||||
if (api_is_allowed_to_edit(false,true) && !($forum['session_id']==0 && intval($session_id)!=0)) { |
||||
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&gradebook=$gradebook&action=edit&content=forum&id=".$forum['forum_id']."\">".icon('../img/edit.gif',get_lang('Edit'))."</a>"; |
||||
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&gradebook=$gradebook&action=delete&content=forum&id=".$forum['forum_id']."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang("DeleteForum"),ENT_QUOTES,$charset))."')) return false;\">".icon('../img/delete.gif',get_lang('Delete'))."</a>"; |
||||
display_visible_invisible_icon('forum',$forum['forum_id'], $forum['visibility']); |
||||
display_lock_unlock_icon('forum',$forum['forum_id'], $forum['locked']); |
||||
display_up_down_icon('forum',$forum['forum_id'], $forums_in_category); |
||||
} |
||||
$iconnotify = 'send_mail.gif'; |
||||
$session_forum_noti=isset($_SESSION['forum_notification']['forum']) ? $_SESSION['forum_notification']['forum'] : false; |
||||
if (is_array($session_forum_noti)) { |
||||
if (in_array($forum['forum_id'],$session_forum_noti)) { |
||||
$iconnotify = 'send_mail_checked.gif'; |
||||
} |
||||
} |
||||
if (!api_is_anonymous()) { |
||||
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&gradebook=$gradebook&action=notify&content=forum&id=".$forum['forum_id']."\">".icon('../img/'.$iconnotify,get_lang('NotifyMe'))."</a>"; |
||||
} |
||||
echo "</td>\n"; |
||||
echo "\t</tr>"; |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (count($forum_list)==0) { |
||||
echo "\t<tr><td>".get_lang('NoForumInThisCategory')."</td>".(api_is_allowed_to_edit(false,true)?'<td colspan="6"></td>':'<td colspan="6"></td>')."</tr>\n"; |
||||
} |
||||
} |
||||
} |
||||
echo "</table>\n"; |
||||
|
||||
/* |
||||
============================================================================== |
||||
FOOTER |
||||
============================================================================== |
||||
*/ |
||||
Display :: display_footer(); |
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,449 +1,446 @@ |
||||
<?php //$id:$
|
||||
/* |
||||
============================================================================== |
||||
Dokeos - elearning and course management software |
||||
|
||||
Copyright (c) 2004-2008 Dokeos SPRL |
||||
Copyright (c) 2004 Denes Nagy |
||||
Copyright (c) 2003 Ghent University (UGent) |
||||
Copyright (c) 2001 Universite catholique de Louvain (UCL) |
||||
|
||||
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: Dokeos, rue du Corbeau, 108, B-1000 Brussels, Belgium, info@dokeos.com |
||||
============================================================================== |
||||
*/ |
||||
/** |
||||
============================================================================== |
||||
* This file was origially the copy of document.php, but many modifications happened since then ; |
||||
* the direct file view is not any more needed, if the user uploads a scorm zip file, a directory |
||||
* will be automatically created for it, and the files will be uncompressed there for example ; |
||||
* |
||||
* @package dokeos.learnpath |
||||
* @author Yannick Warnier <ywarnier@beeznest.org> |
||||
============================================================================== |
||||
*/ |
||||
/** |
||||
* Script |
||||
*/ |
||||
|
||||
if(empty($lp_controller_touched) || $lp_controller_touched!=1){ |
||||
header('location: lp_controller.php?action=list'); |
||||
} |
||||
|
||||
require_once('back_compat.inc.php'); |
||||
$courseDir = api_get_course_path().'/scorm'; |
||||
$baseWordDir = $courseDir; |
||||
$display_progress_bar = true; |
||||
|
||||
require_once('learnpathList.class.php'); |
||||
require_once('learnpath.class.php'); |
||||
require_once('learnpathItem.class.php'); |
||||
//$charset = 'UTF-8'; |
||||
//$charset = 'ISO-8859-1'; |
||||
|
||||
/** |
||||
* Display initialisation and security checks |
||||
*/ |
||||
//extra javascript functions for in html head: |
||||
$htmlHeadXtra[] = |
||||
"<script language='javascript' type='text/javascript'> |
||||
|
||||
function confirmation(name) |
||||
{ |
||||
if (confirm(\" ".trim(get_lang('AreYouSureToDelete'))." \"+name+\"?\")) |
||||
{return true;} |
||||
else |
||||
{return false;} |
||||
} |
||||
</script>"; |
||||
$nameTools = get_lang(ucfirst(TOOL_LEARNPATH)); |
||||
event_access_tool(TOOL_LEARNPATH); |
||||
|
||||
if (! $is_allowed_in_course) api_not_allowed(); |
||||
|
||||
/** |
||||
* Display |
||||
*/ |
||||
/* Require the search widget and prepare the header with its stuff */ |
||||
if (api_get_setting('search_enabled') == 'true') { |
||||
require api_get_path(LIBRARY_PATH).'search/search_widget.php'; |
||||
search_widget_prepare(&$htmlHeadXtra); |
||||
} |
||||
Display::display_header($nameTools,"Path"); |
||||
//api_display_tool_title($nameTools); |
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Introduction section |
||||
(editable by course admins) |
||||
----------------------------------------------------------- |
||||
*/ |
||||
$fck_attribute['Width'] = '100%'; |
||||
$fck_attribute['Height'] = '300'; |
||||
$fck_attribute['ToolbarSet'] = 'Introduction'; |
||||
// These settings should stay here. |
||||
$fck_attribute['Config']['CreateDocumentWebDir'] = api_get_path('WEB_COURSE_PATH').api_get_course_path().'/document/'; |
||||
$fck_attribute['Config']['CreateDocumentDir'] = '../../courses/'.api_get_course_path().'/document/'; |
||||
$fck_attribute['Config']['BaseHref'] = api_get_path('WEB_COURSE_PATH').api_get_course_path().'/'; |
||||
Display::display_introduction_section(TOOL_LEARNPATH); |
||||
$fck_attribute = null; // Clearing this global variable immediatelly after it has been used. |
||||
|
||||
|
||||
if(api_is_allowed_to_edit()) |
||||
{ |
||||
|
||||
|
||||
/*-------------------------------------- |
||||
DIALOG BOX SECTION |
||||
--------------------------------------*/ |
||||
|
||||
if (!empty($dialog_box)) |
||||
{ |
||||
switch ($_GET['dialogtype']) |
||||
{ |
||||
case 'confirmation': |
||||
Display::display_confirmation_message($dialog_box); |
||||
break; |
||||
case 'error': |
||||
Display::display_error_message($dialog_box); |
||||
break; |
||||
case 'warning': |
||||
Display::display_warning_message($dialog_box); |
||||
break; |
||||
default: |
||||
Display::display_normal_message($dialog_box); |
||||
break; |
||||
} |
||||
} |
||||
if (api_failure::get_last_failure()) |
||||
{ |
||||
Display::display_normal_message(api_failure::get_last_failure()); |
||||
} |
||||
|
||||
//include('content_makers.inc.php'); |
||||
echo '<div class="actions">'; |
||||
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_lp">'. |
||||
'<img src="../img/wizard.gif" border="0" align="absmiddle" alt="'.get_lang('_add_learnpath'). |
||||
'"> '.get_lang('_add_learnpath'). |
||||
'</a>' . |
||||
str_repeat(' ',3). |
||||
'<a href="../upload/index.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'"><img src="../img/file_zip.gif" border="0" alt="'.get_lang("UploadScorm").'" align="absmiddle"> '.get_lang("UploadScorm").'</a>'; |
||||
if (api_get_setting('service_ppt2lp', 'active') == 'true') { |
||||
echo str_repeat(' ',3).'<a href="../upload/upload_ppt.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'"><img src="../img/powerpoint.gif" border="0" alt="'.get_lang("PowerPointConvert").'" align="absmiddle"> '.get_lang("PowerPointConvert").'</a>'; |
||||
//echo str_repeat(' ',3).'<a href="../upload/upload_word.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'"><img src="../img/word.gif" border="0" alt="'.get_lang("WordConvert").'" align="absmiddle"> '.get_lang("WordConvert").'</a>'; |
||||
} |
||||
echo '</div>'; |
||||
} |
||||
|
||||
echo '<table width="100%" border="0" cellspacing="2" class="data_table">'; |
||||
api_is_allowed_to_edit() ? $colspan = 9 : $colspan = 3; |
||||
|
||||
/* |
||||
if ($curDirName) // if the $curDirName is empty, we're in the root point and we can't go to a parent dir |
||||
{ |
||||
?> |
||||
<!-- parent dir --> |
||||
<a href="<?php echo api_get_self().'?'.api_get_cidreq().'&openDir='.$cmdParentDir.'&subdirs=yes'; ?>">
|
||||
<img src="../img/parent.gif" border="0" align="absbottom" hspace="5" alt="parent" /> |
||||
<?php echo get_lang("Up"); ?></a>
|
||||
<?php |
||||
} |
||||
*/ |
||||
if (!empty($curDirPath)) |
||||
{ |
||||
if(substr($curDirPath,1,1)=='/'){ |
||||
$tmpcurDirPath=substr($curDirPath,1,strlen($curDirPath)); |
||||
}else{ |
||||
$tmpcurDirPath = $curDirPath; |
||||
} |
||||
?> |
||||
<!-- current dir name --> |
||||
<tr> |
||||
<td colspan="<?php echo $colspan ?>" align="left" bgcolor="#4171B5">
|
||||
<img src="../img/opendir.gif" align="absbottom" vspace="2" hspace="3" alt="open_dir" /> |
||||
<font color="#ffffff"><b><?php echo $tmpcurDirPath ?></b></font>
|
||||
</td> |
||||
</tr> |
||||
<?php |
||||
} |
||||
|
||||
/* CURRENT DIRECTORY */ |
||||
|
||||
echo '<tr>'; |
||||
echo '<th>'.get_lang('Name').'</th>'."\n" . |
||||
'<th>'.get_lang('Progress')."</th>\n"; |
||||
if (api_is_allowed_to_edit()) |
||||
{ |
||||
echo '<th>'.get_lang('CourseSettings')."</th>\n" . |
||||
//xport now is inside "Edit" |
||||
//'<th>'.get_lang('ExportShort')."</th>\n" . |
||||
'<th>'.get_lang('AuthoringOptions')."</th>\n" . |
||||
'<th>'.get_lang('Move')."</th>\n"; |
||||
} |
||||
|
||||
echo "</tr>\n"; |
||||
|
||||
/*-------------------------------------- |
||||
DISPLAY SCORM LIST |
||||
--------------------------------------*/ |
||||
$list = new LearnpathList(api_get_user_id()); |
||||
$flat_list = $list->get_flat_list(); |
||||
$is_allowed_to_edit = api_is_allowed_to_edit(); |
||||
$test_mode = api_get_setting('server_type'); |
||||
$max = count($flat_list); |
||||
//var_dump($flat_list); |
||||
if (is_array($flat_list)) |
||||
{ |
||||
$counter = 0; |
||||
$current = 0; |
||||
foreach ($flat_list as $id => $details) |
||||
{ |
||||
if(!$is_allowed_to_edit && $details['lp_visibility'] == 0) |
||||
{ |
||||
// This is a student and this path is invisible, skip |
||||
continue; |
||||
} |
||||
$counter++; |
||||
if (($counter % 2)==0) { $oddclass="row_odd"; } else { $oddclass="row_even"; } |
||||
|
||||
$url_start_lp = 'lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$id; |
||||
$name = Security::remove_XSS($details['lp_name']); |
||||
$image='<img src="../img/kcmdf.gif" border="0" align="absmiddle" alt="' . $name . '">'."\n"; |
||||
$dsp_line = '<tr align="center" class="'.$oddclass.'">'."\n" . |
||||
'<td align="left" valign="top">' . |
||||
'<div style="float: left; width: 35px; height: 22px;"><a href="'.$url_start_lp.'">' . |
||||
$image . '</a></div><a href="'.$url_start_lp.'">' . $name . '</a>' . |
||||
"</td>\n"; |
||||
//$dsp_desc='<td>'.$details['lp_desc'].'</td>'."\n"; |
||||
$dsp_desc = ''; |
||||
|
||||
$dsp_export = ''; |
||||
$dsp_edit = ''; |
||||
$dsp_edit_close = ''; |
||||
$dsp_delete = ''; |
||||
$dsp_visible = ''; |
||||
$dsp_default_view = ''; |
||||
$dsp_debug = ''; |
||||
$dsp_order = ''; |
||||
|
||||
// Select course theme |
||||
if (!empty($platform_theme)) |
||||
{ |
||||
$mystyle=$platform_theme; |
||||
} |
||||
|
||||
if (!empty($user_theme)) |
||||
{ |
||||
$mystyle=$user_theme; |
||||
} |
||||
|
||||
if (!empty($mycoursetheme)) |
||||
{ |
||||
$mystyle=$mycoursetheme; |
||||
} |
||||
|
||||
$lp_theme_css=$mystyle; |
||||
|
||||
|
||||
if($display_progress_bar) |
||||
{ |
||||
$dsp_progress = '<td>'.learnpath::get_progress_bar('%',learnpath::get_db_progress($id,api_get_user_id()),'').'</td>'; |
||||
} |
||||
else |
||||
{ |
||||
$dsp_progress = '<td style="padding-top:1em;">'.learnpath::get_db_progress($id,api_get_user_id(),'both').'</td>'; |
||||
} |
||||
if($is_allowed_to_edit) |
||||
{ |
||||
$dsp_desc = '<td valign="middle" style="color: grey; padding-top:1em;"><em>'.$details['lp_maker'].'</em> '.$details['lp_proximity'].' '.$details['lp_encoding'].'<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id='.$id.'"> <img src="../img/edit.gif" border="0" title="'.get_lang('_edit_learnpath').'"></a></td>'."\n"; |
||||
|
||||
/* export */ |
||||
//Export is inside "Edit" |
||||
//export not available for normal lps yet |
||||
/*if($details['lp_type']==1){ |
||||
$dsp_export = '<td align="center">' . |
||||
"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" . |
||||
"<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . |
||||
"</a>" . |
||||
""; |
||||
}elseif($details['lp_type']==2){ |
||||
$dsp_export = '<td align="center">' . |
||||
"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id&export_name=".replace_dangerous_char($name,'strict').".zip'>" . |
||||
"<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . |
||||
"</a>" . |
||||
""; |
||||
}else{ |
||||
$dsp_export = '<td align="center">' . |
||||
//"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" . |
||||
"<img src=\"../img/cd_gray.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . |
||||
//"</a>" . |
||||
""; |
||||
}*/ |
||||
/* edit title and description */ |
||||
|
||||
$dsp_edit = '<td align="center">'; |
||||
$dsp_edit_close = '</td>'; |
||||
|
||||
/* DELETE COMMAND */ |
||||
$dsp_delete = "<a href=\"lp_controller.php?".api_get_cidreq()."&action=delete&lp_id=$id\" " . |
||||
"onClick=\"return confirmation('".addslashes($name)."');\">" . |
||||
"<img src=\"../img/delete.gif\" border=\"0\" title=\"".get_lang('_delete_learnpath')."\" />" . |
||||
"</a>"; |
||||
|
||||
/* VISIBILITY COMMAND */ |
||||
|
||||
if ($details['lp_published'] == "i") |
||||
{ |
||||
$dsp_publish = "<a href=\"".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_publish&new_status=v\">" . |
||||
"<img src=\"../img/invisible_LP_list.gif\" border=\"0\" title=\"".get_lang('_publish')."\" />" . |
||||
"</a>" . |
||||
""; |
||||
} |
||||
else |
||||
{ |
||||
$dsp_publish = "<a href='".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_publish&new_status=i'>" . |
||||
"<img src=\"../img/visible_LP_list.gif\" border=\"0\" title=\"".get_lang('_no_publish')."\" />" . |
||||
"</a>". |
||||
""; |
||||
} |
||||
/* VISIBILITY COMMAND */ |
||||
|
||||
if ($details['lp_visibility'] == 0) |
||||
{ |
||||
$dsp_visible = "<a href=\"".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_visible&new_status=1\">" . |
||||
"<img src=\"../img/invisible.gif\" border=\"0\" title=\"".get_lang('Show')."\" />" . |
||||
"</a>" . |
||||
""; |
||||
} |
||||
else |
||||
{ |
||||
$dsp_visible = "<a href='".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_visible&new_status=0'>" . |
||||
"<img src=\"../img/visible.gif\" border=\"0\" title=\"".get_lang('Hide')."\" />" . |
||||
"</a>". |
||||
""; |
||||
} |
||||
/* Default view mode settings (fullscreen/embedded) */ |
||||
if($details['lp_view_mode'] == 'fullscreen'){ |
||||
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' . |
||||
'<img src="../img/view_fullscreen.gif" border="0" alt="'.get_lang("ViewModeEmbedded").'" title="'.get_lang("ViewModeEmbedded").'"/>' . |
||||
'</a> '; |
||||
}else{ |
||||
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' . |
||||
'<img src="../img/view_choose.gif" border="0" alt="'.get_lang("ViewModeFullScreen").'" title="'.get_lang("ViewModeFullScreen").'"/>' . |
||||
'</a> '; |
||||
} |
||||
/* Increase SCORM recording */ |
||||
/* |
||||
if($details['lp_force_commit'] == 1){ |
||||
$dsp_force_commit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_force_commit&lp_id='.$id.'">' . |
||||
'<img src="../img/clock.gif" border="0" alt="Normal SCORM recordings" title="'.get_lang("MakeScormRecordingNormal").'"/>' . |
||||
'</a> '; |
||||
}else{ |
||||
$dsp_force_commit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_force_commit&lp_id='.$id.'">' . |
||||
'<img src="../img/clock_gray.gif" border="0" alt="Extra SCORM recordings" title="'.get_lang("MakeScormRecordingExtra").'"/>' . |
||||
'</a> '; |
||||
} |
||||
*/ |
||||
if($details['lp_prevent_reinit']==1){ |
||||
$dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_reinit&lp_id='.$id.'">' . |
||||
'<img src="../img/kaboodleloop_gray.gif" border="0" alt="Allow reinit" title="'.get_lang("AllowMultipleAttempts").'"/>' . |
||||
'</a> '; |
||||
}else{ |
||||
$dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_reinit&lp_id='.$id.'">' . |
||||
'<img src="../img/kaboodleloop.gif" border="0" alt="Prevent reinit" title="'.get_lang("PreventMultipleAttempts").'"/>' . |
||||
'</a> '; |
||||
} |
||||
if($details['lp_type']==1 || $details['lp_type']==2){ |
||||
$dsp_build = '<a href="lp_controller.php?'.api_get_cidreq().'&action=build&lp_id='.$id.'"><img src="../img/wizard.gif" border="0" title="'.get_lang("Build").'"></a> '; |
||||
}else{ |
||||
$dsp_build = '<img src="../img/wizard_gray.gif" border="0" title="'.get_lang("Build").'"> '; |
||||
} |
||||
if($test_mode == 'test' or api_is_platform_admin()) |
||||
{ |
||||
if($details['lp_scorm_debug']==1){ |
||||
$dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">' . |
||||
'<img src="../img/bug.gif" border="0" alt="'.get_lang("HideDebug").'" title="'.get_lang("HideDebug").'"/>' . |
||||
'</a> '; |
||||
}else{ |
||||
$dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">' . |
||||
'<img src="../img/bug_gray.gif" border="0" alt="'.get_lang("ShowDebug").'" title="'.get_lang("ShowDebug").'"/>' . |
||||
'</a> '; |
||||
} |
||||
} |
||||
/* Export */ |
||||
if($details['lp_type']==1){ |
||||
$dsp_disk = |
||||
"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" . |
||||
"<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . |
||||
"</a>" . |
||||
""; |
||||
}elseif($details['lp_type']==2){ |
||||
$dsp_disk = |
||||
"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id&export_name=".replace_dangerous_char($name,'strict').".zip'>" . |
||||
"<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . |
||||
"</a>" . |
||||
""; |
||||
}else{ |
||||
$dsp_disk = |
||||
//"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" . |
||||
"<img src=\"../img/cd_gray.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . |
||||
//"</a>" . |
||||
""; |
||||
} |
||||
|
||||
//hide icon export scorm |
||||
//$dsp_disk=''; |
||||
|
||||
if($details['lp_display_order'] == 1 && $max != 1) |
||||
{ |
||||
$dsp_order .= '<td><a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_down&lp_id='.$id.'">' . |
||||
'<img src="../img/arrow_down_0.gif" border="0" alt="'.get_lang("MoveDown").'" title="'.get_lang("MoveDown").'"/>' . |
||||
'</a><img src="../img/blanco.png" border="0" alt="" title="" /></td>'; |
||||
} |
||||
elseif($current == $max-1 && $max != 1) //last element |
||||
{ |
||||
$dsp_order .= '<td><img src="../img/blanco.png" border="0" alt="" title="" /><a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_up&lp_id='.$id.'">' . |
||||
'<img src="../img/arrow_up_0.gif" border="0" alt="'.get_lang("MoveUp").'" title="'.get_lang("MoveUp").'"/>' . |
||||
'</a></td>'; |
||||
} |
||||
elseif($max == 1) |
||||
{ |
||||
$dsp_order = '<td></td>'; |
||||
} |
||||
else |
||||
{ |
||||
$dsp_order .= '<td><a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_down&lp_id='.$id.'">' . |
||||
'<img src="../img/arrow_down_0.gif" border="0" alt="'.get_lang("MoveDown").'" title="'.get_lang("MoveDown").'"/>' . |
||||
'</a> '; |
||||
$dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_up&lp_id='.$id.'">' . |
||||
'<img src="../img/arrow_up_0.gif" border="0" alt="'.get_lang("MoveUp").'" title="'.get_lang("MoveUp").'"/>' . |
||||
'</a></td>'; |
||||
} |
||||
} // end if($is_allowedToEdit) |
||||
//echo $dsp_line.$dsp_desc.$dsp_export.$dsp_edit.$dsp_delete.$dsp_visible; |
||||
echo $dsp_line.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_build.$dsp_visible.$dsp_publish.$dsp_reinit.$dsp_default_view.$dsp_debug.$dsp_delete.$dsp_disk.$dsp_order; |
||||
//echo $dsp_line.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_build.$dsp_visible.$dsp_reinit.$dsp_force_commit.$dsp_delete; |
||||
echo "</tr>\n"; |
||||
$current ++; //counter for number of elements treated |
||||
} // end foreach ($flat_list) |
||||
//TODO print some user-friendly message if counter is still = 0 to tell nothing can be displayd yet |
||||
}// end if ( is_array($flat_list) |
||||
echo "</table>"; |
||||
echo "<br/><br/>"; |
||||
|
||||
/* |
||||
============================================================================== |
||||
FOOTER |
||||
============================================================================== |
||||
*/ |
||||
Display::display_footer(); |
||||
?> |
||||
<?php //$id:$
|
||||
/* |
||||
============================================================================== |
||||
Dokeos - elearning and course management software |
||||
|
||||
Copyright (c) 2004-2008 Dokeos SPRL |
||||
Copyright (c) 2004 Denes Nagy |
||||
Copyright (c) 2003 Ghent University (UGent) |
||||
Copyright (c) 2001 Universite catholique de Louvain (UCL) |
||||
|
||||
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: Dokeos, rue du Corbeau, 108, B-1000 Brussels, Belgium, info@dokeos.com |
||||
============================================================================== |
||||
*/ |
||||
/** |
||||
============================================================================== |
||||
* This file was origially the copy of document.php, but many modifications happened since then ; |
||||
* the direct file view is not any more needed, if the user uploads a scorm zip file, a directory |
||||
* will be automatically created for it, and the files will be uncompressed there for example ; |
||||
* |
||||
* @package dokeos.learnpath |
||||
* @author Yannick Warnier <ywarnier@beeznest.org> |
||||
============================================================================== |
||||
*/ |
||||
/** |
||||
* Script |
||||
*/ |
||||
|
||||
if(empty($lp_controller_touched) || $lp_controller_touched!=1){ |
||||
header('location: lp_controller.php?action=list'); |
||||
} |
||||
|
||||
require_once('back_compat.inc.php'); |
||||
$courseDir = api_get_course_path().'/scorm'; |
||||
$baseWordDir = $courseDir; |
||||
$display_progress_bar = true; |
||||
|
||||
require_once('learnpathList.class.php'); |
||||
require_once('learnpath.class.php'); |
||||
require_once('learnpathItem.class.php'); |
||||
//$charset = 'UTF-8'; |
||||
//$charset = 'ISO-8859-1'; |
||||
|
||||
/** |
||||
* Display initialisation and security checks |
||||
*/ |
||||
//extra javascript functions for in html head: |
||||
$htmlHeadXtra[] = |
||||
"<script language='javascript' type='text/javascript'> |
||||
|
||||
function confirmation(name) |
||||
{ |
||||
if (confirm(\" ".trim(get_lang('AreYouSureToDelete'))." \"+name+\"?\")) |
||||
{return true;} |
||||
else |
||||
{return false;} |
||||
} |
||||
</script>"; |
||||
$nameTools = get_lang(ucfirst(TOOL_LEARNPATH)); |
||||
event_access_tool(TOOL_LEARNPATH); |
||||
|
||||
if (! $is_allowed_in_course) api_not_allowed(); |
||||
|
||||
/** |
||||
* Display |
||||
*/ |
||||
/* Require the search widget and prepare the header with its stuff */ |
||||
if (api_get_setting('search_enabled') == 'true') { |
||||
require api_get_path(LIBRARY_PATH).'search/search_widget.php'; |
||||
search_widget_prepare(&$htmlHeadXtra); |
||||
} |
||||
Display::display_header($nameTools,"Path"); |
||||
//api_display_tool_title($nameTools); |
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Introduction section |
||||
(editable by course admins) |
||||
----------------------------------------------------------- |
||||
*/ |
||||
Display::display_introduction_section(TOOL_LEARNPATH, array( |
||||
'CreateDocumentWebDir' => api_get_path('WEB_COURSE_PATH').api_get_course_path().'/document/', |
||||
'CreateDocumentDir' => '../../courses/'.api_get_course_path().'/document/', |
||||
'BaseHref' => api_get_path('WEB_COURSE_PATH').api_get_course_path().'/' |
||||
) |
||||
); |
||||
|
||||
|
||||
if(api_is_allowed_to_edit()) |
||||
{ |
||||
|
||||
|
||||
/*-------------------------------------- |
||||
DIALOG BOX SECTION |
||||
--------------------------------------*/ |
||||
|
||||
if (!empty($dialog_box)) |
||||
{ |
||||
switch ($_GET['dialogtype']) |
||||
{ |
||||
case 'confirmation': |
||||
Display::display_confirmation_message($dialog_box); |
||||
break; |
||||
case 'error': |
||||
Display::display_error_message($dialog_box); |
||||
break; |
||||
case 'warning': |
||||
Display::display_warning_message($dialog_box); |
||||
break; |
||||
default: |
||||
Display::display_normal_message($dialog_box); |
||||
break; |
||||
} |
||||
} |
||||
if (api_failure::get_last_failure()) |
||||
{ |
||||
Display::display_normal_message(api_failure::get_last_failure()); |
||||
} |
||||
|
||||
//include('content_makers.inc.php'); |
||||
echo '<div class="actions">'; |
||||
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_lp">'. |
||||
'<img src="../img/wizard.gif" border="0" align="absmiddle" alt="'.get_lang('_add_learnpath'). |
||||
'"> '.get_lang('_add_learnpath'). |
||||
'</a>' . |
||||
str_repeat(' ',3). |
||||
'<a href="../upload/index.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'"><img src="../img/file_zip.gif" border="0" alt="'.get_lang("UploadScorm").'" align="absmiddle"> '.get_lang("UploadScorm").'</a>'; |
||||
if (api_get_setting('service_ppt2lp', 'active') == 'true') { |
||||
echo str_repeat(' ',3).'<a href="../upload/upload_ppt.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'"><img src="../img/powerpoint.gif" border="0" alt="'.get_lang("PowerPointConvert").'" align="absmiddle"> '.get_lang("PowerPointConvert").'</a>'; |
||||
//echo str_repeat(' ',3).'<a href="../upload/upload_word.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'"><img src="../img/word.gif" border="0" alt="'.get_lang("WordConvert").'" align="absmiddle"> '.get_lang("WordConvert").'</a>'; |
||||
} |
||||
echo '</div>'; |
||||
} |
||||
|
||||
echo '<table width="100%" border="0" cellspacing="2" class="data_table">'; |
||||
api_is_allowed_to_edit() ? $colspan = 9 : $colspan = 3; |
||||
|
||||
/* |
||||
if ($curDirName) // if the $curDirName is empty, we're in the root point and we can't go to a parent dir |
||||
{ |
||||
?> |
||||
<!-- parent dir --> |
||||
<a href="<?php echo api_get_self().'?'.api_get_cidreq().'&openDir='.$cmdParentDir.'&subdirs=yes'; ?>">
|
||||
<img src="../img/parent.gif" border="0" align="absbottom" hspace="5" alt="parent" /> |
||||
<?php echo get_lang("Up"); ?></a>
|
||||
<?php |
||||
} |
||||
*/ |
||||
if (!empty($curDirPath)) |
||||
{ |
||||
if(substr($curDirPath,1,1)=='/'){ |
||||
$tmpcurDirPath=substr($curDirPath,1,strlen($curDirPath)); |
||||
}else{ |
||||
$tmpcurDirPath = $curDirPath; |
||||
} |
||||
?> |
||||
<!-- current dir name --> |
||||
<tr> |
||||
<td colspan="<?php echo $colspan ?>" align="left" bgcolor="#4171B5">
|
||||
<img src="../img/opendir.gif" align="absbottom" vspace="2" hspace="3" alt="open_dir" /> |
||||
<font color="#ffffff"><b><?php echo $tmpcurDirPath ?></b></font>
|
||||
</td> |
||||
</tr> |
||||
<?php |
||||
} |
||||
|
||||
/* CURRENT DIRECTORY */ |
||||
|
||||
echo '<tr>'; |
||||
echo '<th>'.get_lang('Name').'</th>'."\n" . |
||||
'<th>'.get_lang('Progress')."</th>\n"; |
||||
if (api_is_allowed_to_edit()) |
||||
{ |
||||
echo '<th>'.get_lang('CourseSettings')."</th>\n" . |
||||
//xport now is inside "Edit" |
||||
//'<th>'.get_lang('ExportShort')."</th>\n" . |
||||
'<th>'.get_lang('AuthoringOptions')."</th>\n" . |
||||
'<th>'.get_lang('Move')."</th>\n"; |
||||
} |
||||
|
||||
echo "</tr>\n"; |
||||
|
||||
/*-------------------------------------- |
||||
DISPLAY SCORM LIST |
||||
--------------------------------------*/ |
||||
$list = new LearnpathList(api_get_user_id()); |
||||
$flat_list = $list->get_flat_list(); |
||||
$is_allowed_to_edit = api_is_allowed_to_edit(); |
||||
$test_mode = api_get_setting('server_type'); |
||||
$max = count($flat_list); |
||||
//var_dump($flat_list); |
||||
if (is_array($flat_list)) |
||||
{ |
||||
$counter = 0; |
||||
$current = 0; |
||||
foreach ($flat_list as $id => $details) |
||||
{ |
||||
if(!$is_allowed_to_edit && $details['lp_visibility'] == 0) |
||||
{ |
||||
// This is a student and this path is invisible, skip |
||||
continue; |
||||
} |
||||
$counter++; |
||||
if (($counter % 2)==0) { $oddclass="row_odd"; } else { $oddclass="row_even"; } |
||||
|
||||
$url_start_lp = 'lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$id; |
||||
$name = Security::remove_XSS($details['lp_name']); |
||||
$image='<img src="../img/kcmdf.gif" border="0" align="absmiddle" alt="' . $name . '">'."\n"; |
||||
$dsp_line = '<tr align="center" class="'.$oddclass.'">'."\n" . |
||||
'<td align="left" valign="top">' . |
||||
'<div style="float: left; width: 35px; height: 22px;"><a href="'.$url_start_lp.'">' . |
||||
$image . '</a></div><a href="'.$url_start_lp.'">' . $name . '</a>' . |
||||
"</td>\n"; |
||||
//$dsp_desc='<td>'.$details['lp_desc'].'</td>'."\n"; |
||||
$dsp_desc = ''; |
||||
|
||||
$dsp_export = ''; |
||||
$dsp_edit = ''; |
||||
$dsp_edit_close = ''; |
||||
$dsp_delete = ''; |
||||
$dsp_visible = ''; |
||||
$dsp_default_view = ''; |
||||
$dsp_debug = ''; |
||||
$dsp_order = ''; |
||||
|
||||
// Select course theme |
||||
if (!empty($platform_theme)) |
||||
{ |
||||
$mystyle=$platform_theme; |
||||
} |
||||
|
||||
if (!empty($user_theme)) |
||||
{ |
||||
$mystyle=$user_theme; |
||||
} |
||||
|
||||
if (!empty($mycoursetheme)) |
||||
{ |
||||
$mystyle=$mycoursetheme; |
||||
} |
||||
|
||||
$lp_theme_css=$mystyle; |
||||
|
||||
|
||||
if($display_progress_bar) |
||||
{ |
||||
$dsp_progress = '<td>'.learnpath::get_progress_bar('%',learnpath::get_db_progress($id,api_get_user_id()),'').'</td>'; |
||||
} |
||||
else |
||||
{ |
||||
$dsp_progress = '<td style="padding-top:1em;">'.learnpath::get_db_progress($id,api_get_user_id(),'both').'</td>'; |
||||
} |
||||
if($is_allowed_to_edit) |
||||
{ |
||||
$dsp_desc = '<td valign="middle" style="color: grey; padding-top:1em;"><em>'.$details['lp_maker'].'</em> '.$details['lp_proximity'].' '.$details['lp_encoding'].'<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id='.$id.'"> <img src="../img/edit.gif" border="0" title="'.get_lang('_edit_learnpath').'"></a></td>'."\n"; |
||||
|
||||
/* export */ |
||||
//Export is inside "Edit" |
||||
//export not available for normal lps yet |
||||
/*if($details['lp_type']==1){ |
||||
$dsp_export = '<td align="center">' . |
||||
"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" . |
||||
"<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . |
||||
"</a>" . |
||||
""; |
||||
}elseif($details['lp_type']==2){ |
||||
$dsp_export = '<td align="center">' . |
||||
"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id&export_name=".replace_dangerous_char($name,'strict').".zip'>" . |
||||
"<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . |
||||
"</a>" . |
||||
""; |
||||
}else{ |
||||
$dsp_export = '<td align="center">' . |
||||
//"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" . |
||||
"<img src=\"../img/cd_gray.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . |
||||
//"</a>" . |
||||
""; |
||||
}*/ |
||||
/* edit title and description */ |
||||
|
||||
$dsp_edit = '<td align="center">'; |
||||
$dsp_edit_close = '</td>'; |
||||
|
||||
/* DELETE COMMAND */ |
||||
$dsp_delete = "<a href=\"lp_controller.php?".api_get_cidreq()."&action=delete&lp_id=$id\" " . |
||||
"onClick=\"return confirmation('".addslashes($name)."');\">" . |
||||
"<img src=\"../img/delete.gif\" border=\"0\" title=\"".get_lang('_delete_learnpath')."\" />" . |
||||
"</a>"; |
||||
|
||||
/* VISIBILITY COMMAND */ |
||||
|
||||
if ($details['lp_published'] == "i") |
||||
{ |
||||
$dsp_publish = "<a href=\"".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_publish&new_status=v\">" . |
||||
"<img src=\"../img/invisible_LP_list.gif\" border=\"0\" title=\"".get_lang('_publish')."\" />" . |
||||
"</a>" . |
||||
""; |
||||
} |
||||
else |
||||
{ |
||||
$dsp_publish = "<a href='".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_publish&new_status=i'>" . |
||||
"<img src=\"../img/visible_LP_list.gif\" border=\"0\" title=\"".get_lang('_no_publish')."\" />" . |
||||
"</a>". |
||||
""; |
||||
} |
||||
/* VISIBILITY COMMAND */ |
||||
|
||||
if ($details['lp_visibility'] == 0) |
||||
{ |
||||
$dsp_visible = "<a href=\"".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_visible&new_status=1\">" . |
||||
"<img src=\"../img/invisible.gif\" border=\"0\" title=\"".get_lang('Show')."\" />" . |
||||
"</a>" . |
||||
""; |
||||
} |
||||
else |
||||
{ |
||||
$dsp_visible = "<a href='".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_visible&new_status=0'>" . |
||||
"<img src=\"../img/visible.gif\" border=\"0\" title=\"".get_lang('Hide')."\" />" . |
||||
"</a>". |
||||
""; |
||||
} |
||||
/* Default view mode settings (fullscreen/embedded) */ |
||||
if($details['lp_view_mode'] == 'fullscreen'){ |
||||
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' . |
||||
'<img src="../img/view_fullscreen.gif" border="0" alt="'.get_lang("ViewModeEmbedded").'" title="'.get_lang("ViewModeEmbedded").'"/>' . |
||||
'</a> '; |
||||
}else{ |
||||
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' . |
||||
'<img src="../img/view_choose.gif" border="0" alt="'.get_lang("ViewModeFullScreen").'" title="'.get_lang("ViewModeFullScreen").'"/>' . |
||||
'</a> '; |
||||
} |
||||
/* Increase SCORM recording */ |
||||
/* |
||||
if($details['lp_force_commit'] == 1){ |
||||
$dsp_force_commit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_force_commit&lp_id='.$id.'">' . |
||||
'<img src="../img/clock.gif" border="0" alt="Normal SCORM recordings" title="'.get_lang("MakeScormRecordingNormal").'"/>' . |
||||
'</a> '; |
||||
}else{ |
||||
$dsp_force_commit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_force_commit&lp_id='.$id.'">' . |
||||
'<img src="../img/clock_gray.gif" border="0" alt="Extra SCORM recordings" title="'.get_lang("MakeScormRecordingExtra").'"/>' . |
||||
'</a> '; |
||||
} |
||||
*/ |
||||
if($details['lp_prevent_reinit']==1){ |
||||
$dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_reinit&lp_id='.$id.'">' . |
||||
'<img src="../img/kaboodleloop_gray.gif" border="0" alt="Allow reinit" title="'.get_lang("AllowMultipleAttempts").'"/>' . |
||||
'</a> '; |
||||
}else{ |
||||
$dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_reinit&lp_id='.$id.'">' . |
||||
'<img src="../img/kaboodleloop.gif" border="0" alt="Prevent reinit" title="'.get_lang("PreventMultipleAttempts").'"/>' . |
||||
'</a> '; |
||||
} |
||||
if($details['lp_type']==1 || $details['lp_type']==2){ |
||||
$dsp_build = '<a href="lp_controller.php?'.api_get_cidreq().'&action=build&lp_id='.$id.'"><img src="../img/wizard.gif" border="0" title="'.get_lang("Build").'"></a> '; |
||||
}else{ |
||||
$dsp_build = '<img src="../img/wizard_gray.gif" border="0" title="'.get_lang("Build").'"> '; |
||||
} |
||||
if($test_mode == 'test' or api_is_platform_admin()) |
||||
{ |
||||
if($details['lp_scorm_debug']==1){ |
||||
$dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">' . |
||||
'<img src="../img/bug.gif" border="0" alt="'.get_lang("HideDebug").'" title="'.get_lang("HideDebug").'"/>' . |
||||
'</a> '; |
||||
}else{ |
||||
$dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">' . |
||||
'<img src="../img/bug_gray.gif" border="0" alt="'.get_lang("ShowDebug").'" title="'.get_lang("ShowDebug").'"/>' . |
||||
'</a> '; |
||||
} |
||||
} |
||||
/* Export */ |
||||
if($details['lp_type']==1){ |
||||
$dsp_disk = |
||||
"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" . |
||||
"<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . |
||||
"</a>" . |
||||
""; |
||||
}elseif($details['lp_type']==2){ |
||||
$dsp_disk = |
||||
"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id&export_name=".replace_dangerous_char($name,'strict').".zip'>" . |
||||
"<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . |
||||
"</a>" . |
||||
""; |
||||
}else{ |
||||
$dsp_disk = |
||||
//"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" . |
||||
"<img src=\"../img/cd_gray.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . |
||||
//"</a>" . |
||||
""; |
||||
} |
||||
|
||||
//hide icon export scorm |
||||
//$dsp_disk=''; |
||||
|
||||
if($details['lp_display_order'] == 1 && $max != 1) |
||||
{ |
||||
$dsp_order .= '<td><a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_down&lp_id='.$id.'">' . |
||||
'<img src="../img/arrow_down_0.gif" border="0" alt="'.get_lang("MoveDown").'" title="'.get_lang("MoveDown").'"/>' . |
||||
'</a><img src="../img/blanco.png" border="0" alt="" title="" /></td>'; |
||||
} |
||||
elseif($current == $max-1 && $max != 1) //last element |
||||
{ |
||||
$dsp_order .= '<td><img src="../img/blanco.png" border="0" alt="" title="" /><a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_up&lp_id='.$id.'">' . |
||||
'<img src="../img/arrow_up_0.gif" border="0" alt="'.get_lang("MoveUp").'" title="'.get_lang("MoveUp").'"/>' . |
||||
'</a></td>'; |
||||
} |
||||
elseif($max == 1) |
||||
{ |
||||
$dsp_order = '<td></td>'; |
||||
} |
||||
else |
||||
{ |
||||
$dsp_order .= '<td><a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_down&lp_id='.$id.'">' . |
||||
'<img src="../img/arrow_down_0.gif" border="0" alt="'.get_lang("MoveDown").'" title="'.get_lang("MoveDown").'"/>' . |
||||
'</a> '; |
||||
$dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_up&lp_id='.$id.'">' . |
||||
'<img src="../img/arrow_up_0.gif" border="0" alt="'.get_lang("MoveUp").'" title="'.get_lang("MoveUp").'"/>' . |
||||
'</a></td>'; |
||||
} |
||||
} // end if($is_allowedToEdit) |
||||
//echo $dsp_line.$dsp_desc.$dsp_export.$dsp_edit.$dsp_delete.$dsp_visible; |
||||
echo $dsp_line.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_build.$dsp_visible.$dsp_publish.$dsp_reinit.$dsp_default_view.$dsp_debug.$dsp_delete.$dsp_disk.$dsp_order; |
||||
//echo $dsp_line.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_build.$dsp_visible.$dsp_reinit.$dsp_force_commit.$dsp_delete; |
||||
echo "</tr>\n"; |
||||
$current ++; //counter for number of elements treated |
||||
} // end foreach ($flat_list) |
||||
//TODO print some user-friendly message if counter is still = 0 to tell nothing can be displayd yet |
||||
}// end if ( is_array($flat_list) |
||||
echo "</table>"; |
||||
echo "<br/><br/>"; |
||||
|
||||
/* |
||||
============================================================================== |
||||
FOOTER |
||||
============================================================================== |
||||
*/ |
||||
Display::display_footer(); |
||||
?> |
||||
|
@ -1,390 +1,386 @@ |
||||
<?php //$id: $
|
||||
|
||||
/* For licensing terms, see /dokeos_license.txt */ |
||||
|
||||
/** |
||||
* @package dokeos.glossary |
||||
* @author Christian Fasanando, initial version |
||||
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium, refactoring and tighter integration in Dokeos |
||||
*/ |
||||
|
||||
// name of the language file that needs to be included |
||||
$language_file = array('notebook'); |
||||
|
||||
// including the global dokeos file |
||||
require_once '../inc/global.inc.php'; |
||||
require_once '../inc/lib/events.lib.inc.php'; |
||||
|
||||
// the section (tabs) |
||||
$this_section=SECTION_COURSES; |
||||
|
||||
|
||||
// notice for unauthorized people. |
||||
api_protect_course_script(true); |
||||
|
||||
// including additional libraries |
||||
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'; |
||||
|
||||
// additional javascript |
||||
$htmlHeadXtra[] = javascript_notebook(); |
||||
|
||||
// setting the tool constants |
||||
$tool = TOOL_NOTEBOOK; |
||||
|
||||
// tracking |
||||
event_access_tool(TOOL_NOTEBOOK); |
||||
|
||||
// tool name |
||||
if ( isset($_GET['action']) && $_GET['action'] == 'addnote') |
||||
{ |
||||
$tool = get_lang('NoteAddNew'); |
||||
$interbreadcrumb[] = array ("url"=>"index.php", "name"=> get_lang('Notebook')); |
||||
} |
||||
if ( isset($_GET['action']) && $_GET['action'] == 'editnote') |
||||
{ |
||||
$tool = get_lang('ModifyNote'); |
||||
$interbreadcrumb[] = array ("url"=>"index.php", "name"=> get_lang('Notebook')); |
||||
} |
||||
|
||||
// displaying the header |
||||
Display::display_header(get_lang(ucfirst($tool))); |
||||
|
||||
// Tool introduction |
||||
$fck_attribute['Width'] = '100%'; |
||||
$fck_attribute['Height'] = '300'; |
||||
$fck_attribute['ToolbarSet'] = 'Introduction'; |
||||
Display::display_introduction_section(TOOL_NOTEBOOK,'left'); |
||||
$fck_attribute = null; // Clearing this global variable immediatelly after it has been used. |
||||
|
||||
|
||||
// Config notebook FckEditor buttons bar |
||||
$fck_attribute['Width'] = '100%'; |
||||
$fck_attribute['Height'] = '300'; |
||||
if(!api_is_allowed_to_edit()) |
||||
{ |
||||
$fck_attribute['Config']['UserStatus'] = 'student'; |
||||
$fck_attribute['ToolbarSet'] = 'Notebook_Student'; |
||||
} |
||||
else |
||||
{ |
||||
$fck_attribute['ToolbarSet'] = 'Notebook'; |
||||
} |
||||
|
||||
|
||||
// Action handling: Adding a note |
||||
if (isset($_GET['action']) && $_GET['action'] == 'addnote') |
||||
{ |
||||
|
||||
if (!empty($_GET['isStudentView'])) { |
||||
display_notes(); |
||||
exit; |
||||
} |
||||
|
||||
$_SESSION['notebook_view'] = 'creation_date'; |
||||
|
||||
// initiate the object |
||||
$form = new FormValidator('note','post', api_get_self().'?action='.Security::remove_XSS($_GET['action'])); |
||||
// settting the form elements |
||||
$form->addElement('header', '', get_lang('NoteAddNew')); |
||||
$form->addElement('text', 'note_title', get_lang('NoteTitle'),array('size'=>'95')); |
||||
//$form->applyFilter('note_title', 'html_filter'); |
||||
$form->addElement('html_editor', 'note_comment', get_lang('NoteComment')); |
||||
$form->addElement('style_submit_button', 'SubmitNote', get_lang('AddNote'), 'class="add"'); |
||||
|
||||
// setting the rules |
||||
$form->addRule('note_title', '<div class="required">'.get_lang('ThisFieldIsRequired'), 'required'); |
||||
|
||||
// The validation or display |
||||
if ( $form->validate() ) |
||||
{ |
||||
$check = Security::check_token('post'); |
||||
if ($check) |
||||
{ |
||||
$values = $form->exportValues(); |
||||
save_note($values); |
||||
|
||||
} |
||||
Security::clear_token(); |
||||
display_notes(); |
||||
} |
||||
else |
||||
{ |
||||
echo '<div class="actions">'; |
||||
echo '<a href="index.php">'.Display::return_icon('back.png').' '.get_lang('BackToNotesList').'</a>'; |
||||
echo '</div>'; |
||||
$token = Security::get_token(); |
||||
$form->addElement('hidden','sec_token'); |
||||
$form->setConstants(array('sec_token' => $token)); |
||||
$form->display(); |
||||
} |
||||
} |
||||
|
||||
// Action handling: Editing a note |
||||
else if (isset($_GET['action']) && $_GET['action'] == 'editnote' && is_numeric($_GET['notebook_id'])) |
||||
{ |
||||
|
||||
if (!empty($_GET['isStudentView'])) { |
||||
display_notes(); |
||||
exit; |
||||
} |
||||
|
||||
// initiate the object |
||||
$form = new FormValidator('note','post', api_get_self().'?action='.Security::remove_XSS($_GET['action']).'¬ebook_id='.Security::remove_XSS($_GET['notebook_id'])); |
||||
// settting the form elements |
||||
$form->addElement('header', '', get_lang('ModifyNote')); |
||||
$form->addElement('hidden', 'notebook_id'); |
||||
$form->addElement('text', 'note_title', get_lang('NoteTitle'),array('size'=>'100')); |
||||
//$form->applyFilter('note_title', 'html_filter'); |
||||
$form->addElement('html_editor', 'note_comment', get_lang('NoteComment')); |
||||
$form->addElement('style_submit_button', 'SubmitNote', get_lang('ModifyNote'), 'class="save"'); |
||||
|
||||
// setting the defaults |
||||
$defaults = get_note_information(Security::remove_XSS($_GET['notebook_id'])); |
||||
$form->setDefaults($defaults); |
||||
|
||||
// setting the rules |
||||
$form->addRule('note_title', '<div class="required">'.get_lang('ThisFieldIsRequired'), 'required'); |
||||
|
||||
// The validation or display |
||||
if ( $form->validate() ) |
||||
{ |
||||
$check = Security::check_token('post'); |
||||
if ($check) |
||||
{ |
||||
$values = $form->exportValues(); |
||||
update_note($values); |
||||
} |
||||
Security::clear_token(); |
||||
display_notes(); |
||||
} |
||||
else |
||||
{ |
||||
echo '<div class="actions">'; |
||||
echo '<a href="index.php">'.Display::return_icon('back.png').' '.get_lang('BackToNotesList').'</a>'; |
||||
echo '</div>'; |
||||
$token = Security::get_token(); |
||||
$form->addElement('hidden','sec_token'); |
||||
$form->setConstants(array('sec_token' => $token)); |
||||
$form->display(); |
||||
} |
||||
} |
||||
|
||||
// Action handling: deleting a note |
||||
else if (isset($_GET['action']) && $_GET['action'] == 'deletenote' && is_numeric($_GET['notebook_id'])) |
||||
{ |
||||
delete_note(Security::remove_XSS($_GET['notebook_id'])); |
||||
display_notes(); |
||||
} |
||||
|
||||
// Action handling: changing the view (sorting order) |
||||
else if ($_GET['action'] == 'changeview' AND in_array($_GET['view'],array('creation_date','update_date', 'title'))) |
||||
{ |
||||
switch ($_GET['view']) |
||||
{ |
||||
case 'creation_date': |
||||
if (!$_GET['direction'] OR $_GET['direction'] == 'ASC') |
||||
{ |
||||
Display::display_confirmation_message(get_lang('NotesSortedByCreationDateAsc')); |
||||
} |
||||
else |
||||
{ |
||||
Display::display_confirmation_message(get_lang('NotesSortedByCreationDateDESC')); |
||||
} |
||||
break; |
||||
case 'update_date': |
||||
if (!$_GET['direction'] OR $_GET['direction'] == 'ASC') |
||||
{ |
||||
Display::display_confirmation_message(get_lang('NotesSortedByUpdateDateAsc')); |
||||
} |
||||
else |
||||
{ |
||||
Display::display_confirmation_message(get_lang('NotesSortedByUpdateDateDESC')); |
||||
} |
||||
break; |
||||
case 'title': |
||||
if (!$_GET['direction'] OR $_GET['direction'] == 'ASC') |
||||
{ |
||||
Display::display_confirmation_message(get_lang('NotesSortedByTitleAsc')); |
||||
} |
||||
else |
||||
{ |
||||
Display::display_confirmation_message(get_lang('NotesSortedByTitleDESC')); |
||||
} |
||||
break; |
||||
} |
||||
$_SESSION['notebook_view'] = $_GET['view']; |
||||
display_notes(); |
||||
} else { |
||||
display_notes(); |
||||
} |
||||
|
||||
|
||||
// footer |
||||
Display::display_footer(); |
||||
|
||||
/** |
||||
* a little bit of javascript to display a prettier warning when deleting a note |
||||
* |
||||
* @return unknown |
||||
* |
||||
* @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium |
||||
* @version januari 2009, dokeos 1.8.6 |
||||
*/ |
||||
function javascript_notebook() |
||||
{ |
||||
return "<script type=\"text/javascript\"> |
||||
function confirmation (name) |
||||
{ |
||||
if (confirm(\" ". get_lang("NoteConfirmDelete") ." \"+ name + \" ?\")) |
||||
{return true;} |
||||
else |
||||
{return false;} |
||||
} |
||||
</script>"; |
||||
} |
||||
|
||||
/** |
||||
* This functions stores the note in the database |
||||
* |
||||
* @param array $values |
||||
* |
||||
* @author Christian Fasanando <christian.fasanando@dokeos.com> |
||||
* @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium |
||||
* @version januari 2009, dokeos 1.8.6 |
||||
*/ |
||||
function save_note($values) { |
||||
// Database table definition |
||||
$t_notebook = Database :: get_course_table(TABLE_NOTEBOOK); |
||||
|
||||
$sql = "INSERT INTO $t_notebook (user_id, course, session_id, title, description, creation_date,update_date,status) |
||||
VALUES( |
||||
'".Database::escape_string(api_get_user_id())."', |
||||
'".Database::escape_string(api_get_course_id())."', |
||||
'".Database::escape_string($_SESSION['id_session'])."', |
||||
'".Database::escape_string(Security::remove_XSS($values['note_title']))."', |
||||
'".Database::escape_string(Security::remove_XSS(stripslashes(api_html_entity_decode($values['note_comment'])),COURSEMANAGERLOWSECURITY))."', |
||||
'".Database::escape_string(date('Y-m-d H:i:s'))."', |
||||
'".Database::escape_string(date('Y-m-d H:i:s'))."', |
||||
'0')"; |
||||
$result = api_sql_query($sql, __FILE__, __LINE__); |
||||
// display the feedback message |
||||
Display::display_confirmation_message(get_lang('NoteAdded')); |
||||
} |
||||
|
||||
function get_note_information($notebook_id) { |
||||
// Database table definition |
||||
$t_notebook = Database :: get_course_table(TABLE_NOTEBOOK); |
||||
|
||||
$sql = "SELECT notebook_id AS notebook_id, |
||||
title AS note_title, |
||||
description AS note_comment |
||||
FROM $t_notebook |
||||
WHERE notebook_id = '".Database::escape_string($notebook_id)."' "; |
||||
$result = api_sql_query($sql, __FILE__, __LINE__); |
||||
return Database::fetch_array($result); |
||||
} |
||||
|
||||
/** |
||||
* This functions updates the note in the database |
||||
* |
||||
* @param array $values |
||||
* |
||||
* @author Christian Fasanando <christian.fasanando@dokeos.com> |
||||
* @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium |
||||
* @version januari 2009, dokeos 1.8.6 |
||||
*/ |
||||
function update_note($values) { |
||||
// Database table definition |
||||
$t_notebook = Database :: get_course_table(TABLE_NOTEBOOK); |
||||
|
||||
$sql = "UPDATE $t_notebook SET |
||||
user_id = '".Database::escape_string(api_get_user_id())."', |
||||
course = '".Database::escape_string(api_get_course_id())."', |
||||
session_id = '".Database::escape_string($_SESSION['id_session'])."', |
||||
title = '".Database::escape_string(Security::remove_XSS($values['note_title']))."', |
||||
description = '".Database::escape_string(Security::remove_XSS(stripslashes(api_html_entity_decode($values['note_comment'])),COURSEMANAGERLOWSECURITY))."', |
||||
update_date = '".Database::escape_string(date('Y-m-d H:i:s'))."' |
||||
WHERE notebook_id = '".Database::escape_string($values['notebook_id'])."'"; |
||||
$result = Database::query($sql, __FILE__, __LINE__); |
||||
// display the feedback message |
||||
Display::display_confirmation_message(get_lang('NoteUpdated')); |
||||
} |
||||
|
||||
function delete_note($notebook_id) { |
||||
// Database table definition |
||||
$t_notebook = Database :: get_course_table(TABLE_NOTEBOOK); |
||||
|
||||
$sql = "DELETE FROM $t_notebook WHERE notebook_id='".Database::escape_string($notebook_id)."' AND user_id = '".Database::escape_string(api_get_user_id())."'"; |
||||
$result = Database::query($sql, __FILE__, __LINE__); |
||||
Display::display_confirmation_message(get_lang('NoteDeleted')); |
||||
} |
||||
|
||||
function display_notes() { |
||||
|
||||
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" style="margin-bottom:20px">'; |
||||
//if (api_is_allowed_to_edit()) |
||||
//{ |
||||
if (!api_is_anonymous()) { |
||||
echo '<a href="index.php?'.api_get_cidreq().'&action=addnote">'.Display::return_icon('filenew.gif',get_lang('NoteAddNew')).get_lang('NoteAddNew').'</a>'; |
||||
} else { |
||||
echo '<a href="javascript:void(0)">'.Display::return_icon('filenew.gif',get_lang('NoteAddNew')).get_lang('NoteAddNew').'</a>'; |
||||
} |
||||
//} |
||||
echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=creation_date&direction='.$link_sort_direction.'">'.Display::return_icon('calendar_select.gif',get_lang('OrderByCreationDate')).get_lang('OrderByCreationDate').'</a>'; |
||||
echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=update_date&direction='.$link_sort_direction.'">'.Display::return_icon('calendar_select.gif',get_lang('OrderByModificationDate')).get_lang('OrderByModificationDate').'</a>'; |
||||
echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=title&direction='.$link_sort_direction.'">'.Display::return_icon('comment.gif',get_lang('OrderByTitle')).get_lang('OrderByTitle').'</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 "; |
||||
} |
||||
|
||||
$cond_extra = ($_SESSION['notebook_view']== 'update_date')?" AND update_date <> '0000-00-00 00:00:00'":" "; |
||||
|
||||
$sql = "SELECT * FROM $t_notebook WHERE user_id = '".Database::escape_string(api_get_user_id())."' $cond_extra $order_by"; |
||||
$result = Database::query($sql, __FILE__, __LINE__); |
||||
while ($row = Database::fetch_array($result)) { |
||||
echo '<div class="sectiontitle">'; |
||||
echo '<span style="float: right;"> ('.get_lang('CreationDate').': '.date_to_str_ago($row['creation_date']).' <span class="dropbox_date">'.$row['creation_date'].'</span>'; |
||||
if ($row['update_date'] <> $row['creation_date']) { |
||||
echo ', '.get_lang('UpdateDate').': '.date_to_str_ago($row['update_date']).' <span class="dropbox_date">'.$row['update_date'].'</span>'; |
||||
} |
||||
echo ')</span>'; |
||||
echo $row['title']; |
||||
echo '</div>'; |
||||
echo '<div class="sectioncomment">'.$row['description'].'</div>'; |
||||
echo '<div>'; |
||||
echo '<a href="'.api_get_self().'?action=editnote&notebook_id='.$row['notebook_id'].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>'; |
||||
echo '<a href="'.api_get_self().'?action=deletenote&notebook_id='.$row['notebook_id'].'" onclick="return confirmation(\''.$row['title'].'\');">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>'; |
||||
echo '</div>'; |
||||
} |
||||
return $return; |
||||
} |
||||
?> |
||||
<?php //$id: $
|
||||
|
||||
/* For licensing terms, see /dokeos_license.txt */ |
||||
|
||||
/** |
||||
* @package dokeos.glossary |
||||
* @author Christian Fasanando, initial version |
||||
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium, refactoring and tighter integration in Dokeos |
||||
*/ |
||||
|
||||
// name of the language file that needs to be included |
||||
$language_file = array('notebook'); |
||||
|
||||
// including the global dokeos file |
||||
require_once '../inc/global.inc.php'; |
||||
require_once '../inc/lib/events.lib.inc.php'; |
||||
|
||||
// the section (tabs) |
||||
$this_section=SECTION_COURSES; |
||||
|
||||
|
||||
// notice for unauthorized people. |
||||
api_protect_course_script(true); |
||||
|
||||
// including additional libraries |
||||
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'; |
||||
|
||||
// additional javascript |
||||
$htmlHeadXtra[] = javascript_notebook(); |
||||
|
||||
// setting the tool constants |
||||
$tool = TOOL_NOTEBOOK; |
||||
|
||||
// tracking |
||||
event_access_tool(TOOL_NOTEBOOK); |
||||
|
||||
// tool name |
||||
if ( isset($_GET['action']) && $_GET['action'] == 'addnote') |
||||
{ |
||||
$tool = get_lang('NoteAddNew'); |
||||
$interbreadcrumb[] = array ("url"=>"index.php", "name"=> get_lang('Notebook')); |
||||
} |
||||
if ( isset($_GET['action']) && $_GET['action'] == 'editnote') |
||||
{ |
||||
$tool = get_lang('ModifyNote'); |
||||
$interbreadcrumb[] = array ("url"=>"index.php", "name"=> get_lang('Notebook')); |
||||
} |
||||
|
||||
// displaying the header |
||||
Display::display_header(get_lang(ucfirst($tool))); |
||||
|
||||
// Tool introduction |
||||
Display::display_introduction_section(TOOL_NOTEBOOK); |
||||
|
||||
|
||||
// Config notebook FckEditor buttons bar |
||||
$fck_attribute['Width'] = '100%'; |
||||
$fck_attribute['Height'] = '300'; |
||||
if(!api_is_allowed_to_edit()) |
||||
{ |
||||
$fck_attribute['Config']['UserStatus'] = 'student'; |
||||
$fck_attribute['ToolbarSet'] = 'Notebook_Student'; |
||||
} |
||||
else |
||||
{ |
||||
$fck_attribute['ToolbarSet'] = 'Notebook'; |
||||
} |
||||
|
||||
|
||||
// Action handling: Adding a note |
||||
if (isset($_GET['action']) && $_GET['action'] == 'addnote') |
||||
{ |
||||
|
||||
if (!empty($_GET['isStudentView'])) { |
||||
display_notes(); |
||||
exit; |
||||
} |
||||
|
||||
$_SESSION['notebook_view'] = 'creation_date'; |
||||
|
||||
// initiate the object |
||||
$form = new FormValidator('note','post', api_get_self().'?action='.Security::remove_XSS($_GET['action'])); |
||||
// settting the form elements |
||||
$form->addElement('header', '', get_lang('NoteAddNew')); |
||||
$form->addElement('text', 'note_title', get_lang('NoteTitle'),array('size'=>'95')); |
||||
//$form->applyFilter('note_title', 'html_filter'); |
||||
$form->addElement('html_editor', 'note_comment', get_lang('NoteComment')); |
||||
$form->addElement('style_submit_button', 'SubmitNote', get_lang('AddNote'), 'class="add"'); |
||||
|
||||
// setting the rules |
||||
$form->addRule('note_title', '<div class="required">'.get_lang('ThisFieldIsRequired'), 'required'); |
||||
|
||||
// The validation or display |
||||
if ( $form->validate() ) |
||||
{ |
||||
$check = Security::check_token('post'); |
||||
if ($check) |
||||
{ |
||||
$values = $form->exportValues(); |
||||
save_note($values); |
||||
|
||||
} |
||||
Security::clear_token(); |
||||
display_notes(); |
||||
} |
||||
else |
||||
{ |
||||
echo '<div class="actions">'; |
||||
echo '<a href="index.php">'.Display::return_icon('back.png').' '.get_lang('BackToNotesList').'</a>'; |
||||
echo '</div>'; |
||||
$token = Security::get_token(); |
||||
$form->addElement('hidden','sec_token'); |
||||
$form->setConstants(array('sec_token' => $token)); |
||||
$form->display(); |
||||
} |
||||
} |
||||
|
||||
// Action handling: Editing a note |
||||
else if (isset($_GET['action']) && $_GET['action'] == 'editnote' && is_numeric($_GET['notebook_id'])) |
||||
{ |
||||
|
||||
if (!empty($_GET['isStudentView'])) { |
||||
display_notes(); |
||||
exit; |
||||
} |
||||
|
||||
// initiate the object |
||||
$form = new FormValidator('note','post', api_get_self().'?action='.Security::remove_XSS($_GET['action']).'¬ebook_id='.Security::remove_XSS($_GET['notebook_id'])); |
||||
// settting the form elements |
||||
$form->addElement('header', '', get_lang('ModifyNote')); |
||||
$form->addElement('hidden', 'notebook_id'); |
||||
$form->addElement('text', 'note_title', get_lang('NoteTitle'),array('size'=>'100')); |
||||
//$form->applyFilter('note_title', 'html_filter'); |
||||
$form->addElement('html_editor', 'note_comment', get_lang('NoteComment')); |
||||
$form->addElement('style_submit_button', 'SubmitNote', get_lang('ModifyNote'), 'class="save"'); |
||||
|
||||
// setting the defaults |
||||
$defaults = get_note_information(Security::remove_XSS($_GET['notebook_id'])); |
||||
$form->setDefaults($defaults); |
||||
|
||||
// setting the rules |
||||
$form->addRule('note_title', '<div class="required">'.get_lang('ThisFieldIsRequired'), 'required'); |
||||
|
||||
// The validation or display |
||||
if ( $form->validate() ) |
||||
{ |
||||
$check = Security::check_token('post'); |
||||
if ($check) |
||||
{ |
||||
$values = $form->exportValues(); |
||||
update_note($values); |
||||
} |
||||
Security::clear_token(); |
||||
display_notes(); |
||||
} |
||||
else |
||||
{ |
||||
echo '<div class="actions">'; |
||||
echo '<a href="index.php">'.Display::return_icon('back.png').' '.get_lang('BackToNotesList').'</a>'; |
||||
echo '</div>'; |
||||
$token = Security::get_token(); |
||||
$form->addElement('hidden','sec_token'); |
||||
$form->setConstants(array('sec_token' => $token)); |
||||
$form->display(); |
||||
} |
||||
} |
||||
|
||||
// Action handling: deleting a note |
||||
else if (isset($_GET['action']) && $_GET['action'] == 'deletenote' && is_numeric($_GET['notebook_id'])) |
||||
{ |
||||
delete_note(Security::remove_XSS($_GET['notebook_id'])); |
||||
display_notes(); |
||||
} |
||||
|
||||
// Action handling: changing the view (sorting order) |
||||
else if ($_GET['action'] == 'changeview' AND in_array($_GET['view'],array('creation_date','update_date', 'title'))) |
||||
{ |
||||
switch ($_GET['view']) |
||||
{ |
||||
case 'creation_date': |
||||
if (!$_GET['direction'] OR $_GET['direction'] == 'ASC') |
||||
{ |
||||
Display::display_confirmation_message(get_lang('NotesSortedByCreationDateAsc')); |
||||
} |
||||
else |
||||
{ |
||||
Display::display_confirmation_message(get_lang('NotesSortedByCreationDateDESC')); |
||||
} |
||||
break; |
||||
case 'update_date': |
||||
if (!$_GET['direction'] OR $_GET['direction'] == 'ASC') |
||||
{ |
||||
Display::display_confirmation_message(get_lang('NotesSortedByUpdateDateAsc')); |
||||
} |
||||
else |
||||
{ |
||||
Display::display_confirmation_message(get_lang('NotesSortedByUpdateDateDESC')); |
||||
} |
||||
break; |
||||
case 'title': |
||||
if (!$_GET['direction'] OR $_GET['direction'] == 'ASC') |
||||
{ |
||||
Display::display_confirmation_message(get_lang('NotesSortedByTitleAsc')); |
||||
} |
||||
else |
||||
{ |
||||
Display::display_confirmation_message(get_lang('NotesSortedByTitleDESC')); |
||||
} |
||||
break; |
||||
} |
||||
$_SESSION['notebook_view'] = $_GET['view']; |
||||
display_notes(); |
||||
} else { |
||||
display_notes(); |
||||
} |
||||
|
||||
|
||||
// footer |
||||
Display::display_footer(); |
||||
|
||||
/** |
||||
* a little bit of javascript to display a prettier warning when deleting a note |
||||
* |
||||
* @return unknown |
||||
* |
||||
* @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium |
||||
* @version januari 2009, dokeos 1.8.6 |
||||
*/ |
||||
function javascript_notebook() |
||||
{ |
||||
return "<script type=\"text/javascript\"> |
||||
function confirmation (name) |
||||
{ |
||||
if (confirm(\" ". get_lang("NoteConfirmDelete") ." \"+ name + \" ?\")) |
||||
{return true;} |
||||
else |
||||
{return false;} |
||||
} |
||||
</script>"; |
||||
} |
||||
|
||||
/** |
||||
* This functions stores the note in the database |
||||
* |
||||
* @param array $values |
||||
* |
||||
* @author Christian Fasanando <christian.fasanando@dokeos.com> |
||||
* @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium |
||||
* @version januari 2009, dokeos 1.8.6 |
||||
*/ |
||||
function save_note($values) { |
||||
// Database table definition |
||||
$t_notebook = Database :: get_course_table(TABLE_NOTEBOOK); |
||||
|
||||
$sql = "INSERT INTO $t_notebook (user_id, course, session_id, title, description, creation_date,update_date,status) |
||||
VALUES( |
||||
'".Database::escape_string(api_get_user_id())."', |
||||
'".Database::escape_string(api_get_course_id())."', |
||||
'".Database::escape_string($_SESSION['id_session'])."', |
||||
'".Database::escape_string(Security::remove_XSS($values['note_title']))."', |
||||
'".Database::escape_string(Security::remove_XSS(stripslashes(api_html_entity_decode($values['note_comment'])),COURSEMANAGERLOWSECURITY))."', |
||||
'".Database::escape_string(date('Y-m-d H:i:s'))."', |
||||
'".Database::escape_string(date('Y-m-d H:i:s'))."', |
||||
'0')"; |
||||
$result = api_sql_query($sql, __FILE__, __LINE__); |
||||
// display the feedback message |
||||
Display::display_confirmation_message(get_lang('NoteAdded')); |
||||
} |
||||
|
||||
function get_note_information($notebook_id) { |
||||
// Database table definition |
||||
$t_notebook = Database :: get_course_table(TABLE_NOTEBOOK); |
||||
|
||||
$sql = "SELECT notebook_id AS notebook_id, |
||||
title AS note_title, |
||||
description AS note_comment |
||||
FROM $t_notebook |
||||
WHERE notebook_id = '".Database::escape_string($notebook_id)."' "; |
||||
$result = api_sql_query($sql, __FILE__, __LINE__); |
||||
return Database::fetch_array($result); |
||||
} |
||||
|
||||
/** |
||||
* This functions updates the note in the database |
||||
* |
||||
* @param array $values |
||||
* |
||||
* @author Christian Fasanando <christian.fasanando@dokeos.com> |
||||
* @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium |
||||
* @version januari 2009, dokeos 1.8.6 |
||||
*/ |
||||
function update_note($values) { |
||||
// Database table definition |
||||
$t_notebook = Database :: get_course_table(TABLE_NOTEBOOK); |
||||
|
||||
$sql = "UPDATE $t_notebook SET |
||||
user_id = '".Database::escape_string(api_get_user_id())."', |
||||
course = '".Database::escape_string(api_get_course_id())."', |
||||
session_id = '".Database::escape_string($_SESSION['id_session'])."', |
||||
title = '".Database::escape_string(Security::remove_XSS($values['note_title']))."', |
||||
description = '".Database::escape_string(Security::remove_XSS(stripslashes(api_html_entity_decode($values['note_comment'])),COURSEMANAGERLOWSECURITY))."', |
||||
update_date = '".Database::escape_string(date('Y-m-d H:i:s'))."' |
||||
WHERE notebook_id = '".Database::escape_string($values['notebook_id'])."'"; |
||||
$result = Database::query($sql, __FILE__, __LINE__); |
||||
// display the feedback message |
||||
Display::display_confirmation_message(get_lang('NoteUpdated')); |
||||
} |
||||
|
||||
function delete_note($notebook_id) { |
||||
// Database table definition |
||||
$t_notebook = Database :: get_course_table(TABLE_NOTEBOOK); |
||||
|
||||
$sql = "DELETE FROM $t_notebook WHERE notebook_id='".Database::escape_string($notebook_id)."' AND user_id = '".Database::escape_string(api_get_user_id())."'"; |
||||
$result = Database::query($sql, __FILE__, __LINE__); |
||||
Display::display_confirmation_message(get_lang('NoteDeleted')); |
||||
} |
||||
|
||||
function display_notes() { |
||||
|
||||
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" style="margin-bottom:20px">'; |
||||
//if (api_is_allowed_to_edit()) |
||||
//{ |
||||
if (!api_is_anonymous()) { |
||||
echo '<a href="index.php?'.api_get_cidreq().'&action=addnote">'.Display::return_icon('filenew.gif',get_lang('NoteAddNew')).get_lang('NoteAddNew').'</a>'; |
||||
} else { |
||||
echo '<a href="javascript:void(0)">'.Display::return_icon('filenew.gif',get_lang('NoteAddNew')).get_lang('NoteAddNew').'</a>'; |
||||
} |
||||
//} |
||||
echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=creation_date&direction='.$link_sort_direction.'">'.Display::return_icon('calendar_select.gif',get_lang('OrderByCreationDate')).get_lang('OrderByCreationDate').'</a>'; |
||||
echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=update_date&direction='.$link_sort_direction.'">'.Display::return_icon('calendar_select.gif',get_lang('OrderByModificationDate')).get_lang('OrderByModificationDate').'</a>'; |
||||
echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=title&direction='.$link_sort_direction.'">'.Display::return_icon('comment.gif',get_lang('OrderByTitle')).get_lang('OrderByTitle').'</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 "; |
||||
} |
||||
|
||||
$cond_extra = ($_SESSION['notebook_view']== 'update_date')?" AND update_date <> '0000-00-00 00:00:00'":" "; |
||||
|
||||
$sql = "SELECT * FROM $t_notebook WHERE user_id = '".Database::escape_string(api_get_user_id())."' $cond_extra $order_by"; |
||||
$result = Database::query($sql, __FILE__, __LINE__); |
||||
while ($row = Database::fetch_array($result)) { |
||||
echo '<div class="sectiontitle">'; |
||||
echo '<span style="float: right;"> ('.get_lang('CreationDate').': '.date_to_str_ago($row['creation_date']).' <span class="dropbox_date">'.$row['creation_date'].'</span>'; |
||||
if ($row['update_date'] <> $row['creation_date']) { |
||||
echo ', '.get_lang('UpdateDate').': '.date_to_str_ago($row['update_date']).' <span class="dropbox_date">'.$row['update_date'].'</span>'; |
||||
} |
||||
echo ')</span>'; |
||||
echo $row['title']; |
||||
echo '</div>'; |
||||
echo '<div class="sectioncomment">'.$row['description'].'</div>'; |
||||
echo '<div>'; |
||||
echo '<a href="'.api_get_self().'?action=editnote&notebook_id='.$row['notebook_id'].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>'; |
||||
echo '<a href="'.api_get_self().'?action=deletenote&notebook_id='.$row['notebook_id'].'" onclick="return confirmation(\''.$row['title'].'\');">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>'; |
||||
echo '</div>'; |
||||
} |
||||
return $return; |
||||
} |
||||
?> |
||||
|
@ -1,226 +1,222 @@ |
||||
<?php // $Id: survey_list.php 19694 2009-04-09 21:45:33Z ivantcholakov $
|
||||
/* |
||||
============================================================================== |
||||
Dokeos - elearning and course management software |
||||
|
||||
Copyright (c) 2004-2008 Dokeos SPRL |
||||
Copyright (c) 2003 Ghent University (UGent) |
||||
|
||||
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: Dokeos, rue Notre Dame, 152, B-1140 Evere, Belgium, info@dokeos.com |
||||
============================================================================== |
||||
*/ |
||||
|
||||
|
||||
|
||||
/** |
||||
* @package dokeos.survey |
||||
* @author unknown, the initial survey that did not make it in 1.8 because of bad code |
||||
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code |
||||
* @author Julio Montoya Armas <gugli100@gmail.com>, Dokeos: Personality Test modification and rewriting large parts of the code |
||||
* @version $Id: survey_list.php 19694 2009-04-09 21:45:33Z ivantcholakov $ |
||||
* |
||||
* @todo use quickforms for the forms |
||||
*/ |
||||
|
||||
// name of the language file that needs to be included |
||||
$language_file = 'survey'; |
||||
if (!isset ($_GET['cidReq'])){ |
||||
$_GET['cidReq']='none'; // prevent sql errors |
||||
$cidReset = true; |
||||
} |
||||
// including the global dokeos file |
||||
require ('../inc/global.inc.php'); |
||||
|
||||
// including additional libraries |
||||
//require_once (api_get_path(LIBRARY_PATH)."/survey.lib.php"); |
||||
require_once('survey.lib.php'); |
||||
require_once (api_get_path(LIBRARY_PATH)."/course.lib.php"); |
||||
|
||||
/** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/ |
||||
if (!api_is_allowed_to_edit(false,true)) //coach can see this |
||||
{ |
||||
Display :: display_header(get_lang('SurveyList')); |
||||
SurveyUtil::survey_list_user($_user['user_id']); |
||||
Display :: display_footer(); |
||||
exit; |
||||
} |
||||
|
||||
$extend_rights_for_coachs = api_get_setting('extend_rights_for_coach_on_survey'); |
||||
|
||||
// Database table definitions |
||||
$table_survey = Database :: get_course_table(TABLE_SURVEY); |
||||
$table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
||||
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE); |
||||
$table_user = Database :: get_main_table(TABLE_MAIN_USER); |
||||
|
||||
// language variables |
||||
if (isset ($_GET['search']) && $_GET['search'] == 'advanced') |
||||
{ |
||||
$interbreadcrumb[] = array ('url' => 'survey_list.php', 'name' => get_lang('SurveyList')); |
||||
$tool_name = get_lang('SearchASurvey'); |
||||
} |
||||
else |
||||
{ |
||||
$tool_name = get_lang('SurveyList'); |
||||
} |
||||
|
||||
|
||||
// Header |
||||
Display :: display_header($tool_name,'Survey'); |
||||
//api_display_tool_title($tool_name); |
||||
|
||||
// Tool introduction |
||||
$fck_attribute['Width'] = '100%'; |
||||
$fck_attribute['Height'] = '300'; |
||||
$fck_attribute['ToolbarSet'] = 'Introduction'; |
||||
Display::display_introduction_section('survey', 'left'); |
||||
$fck_attribute = null; // Clearing this global variable immediatelly after it has been used. |
||||
|
||||
// Action handling: searching |
||||
if (isset ($_GET['search']) AND $_GET['search'] == 'advanced') |
||||
{ |
||||
SurveyUtil::display_survey_search_form(); |
||||
} |
||||
// Action handling: deleting a survey |
||||
if (isset($_GET['action']) AND $_GET['action'] == 'delete' AND isset($_GET['survey_id']) AND is_numeric($_GET['survey_id'])) |
||||
{ |
||||
// getting the information of the survey (used for when the survey is shared) |
||||
$survey_data = survey_manager::get_survey($_GET['survey_id']); |
||||
if(api_is_course_coach() && intval($_SESSION['id_session']) != $survey_data['session_id']) |
||||
{ // the coach can't delete a survey not belonging to his session |
||||
api_not_allowed(); |
||||
exit; |
||||
} |
||||
// if the survey is shared => also delete the shared content |
||||
if (is_numeric($survey_data['survey_share'])) |
||||
{ |
||||
survey_manager::delete_survey($survey_data['survey_share'], true); |
||||
} |
||||
$return = survey_manager :: delete_survey($_GET['survey_id']); |
||||
if ($return) |
||||
{ |
||||
Display :: display_confirmation_message(get_lang('SurveyDeleted'), false); |
||||
} |
||||
else |
||||
{ |
||||
Display :: display_error_message(get_lang('ErrorOccurred'), false); |
||||
} |
||||
} |
||||
|
||||
if(isset($_GET['action']) && $_GET['action'] == 'empty') |
||||
{ |
||||
$mysession = api_get_session_id(); |
||||
if ( $mysession != 0 ) { |
||||
if(!((api_is_course_coach() || api_is_platform_admin()) && api_is_element_in_the_session(TOOL_SURVEY,intval($_GET['survey_id'])))) { |
||||
// the coach can't empty a survey not belonging to his session |
||||
api_not_allowed(); |
||||
exit; |
||||
} |
||||
} else { |
||||
if (!(api_is_course_admin() || api_is_platform_admin())) { |
||||
api_not_allowed(); |
||||
exit; |
||||
} |
||||
} |
||||
$return = survey_manager::empty_survey(intval($_GET['survey_id'])); |
||||
if ($return) |
||||
{ |
||||
Display :: display_confirmation_message(get_lang('SurveyEmptied'), false); |
||||
} |
||||
else |
||||
{ |
||||
Display :: display_error_message(get_lang('ErrorOccurred'), false); |
||||
} |
||||
} |
||||
|
||||
// Action handling: performing the same action on multiple surveys |
||||
if ($_POST['action']) |
||||
{ |
||||
if (is_array($_POST['id'])) |
||||
{ |
||||
foreach ($_POST['id'] as $key=>$value) |
||||
{ |
||||
// getting the information of the survey (used for when the survey is shared) |
||||
$survey_data = survey_manager::get_survey($value); |
||||
// if the survey is shared => also delete the shared content |
||||
if (is_numeric($survey_data['survey_share'])) |
||||
{ |
||||
survey_manager::delete_survey($survey_data['survey_share'], true); |
||||
} |
||||
// delete the actual survey |
||||
survey_manager::delete_survey($value); |
||||
} |
||||
Display :: display_confirmation_message(get_lang('SurveysDeleted'), false); |
||||
} |
||||
else |
||||
{ |
||||
Display :: display_error_message(get_lang('NoSurveysSelected'), false); |
||||
} |
||||
} |
||||
echo $extended_rights_for_coachs; |
||||
echo '<div class="actions">'; |
||||
if (!api_is_course_coach() || $extend_rights_for_coachs=='true') |
||||
{ |
||||
// Action links |
||||
echo Display::return_icon('surveyadd.gif', get_lang('CreateNewSurvey')) . '<a href="create_new_survey.php?'.api_get_cidreq().'&action=add">'.get_lang('CreateNewSurvey').'</a> '; |
||||
} |
||||
//echo '<a href="survey_all_courses.php">'.get_lang('CreateExistingSurvey').'</a> '; |
||||
echo Display::return_icon('search.gif', get_lang('Search')) . '<a href="'.api_get_self().'?'.api_get_cidreq().'&search=advanced">'.get_lang('Search').'</a>'; |
||||
echo '</div>'; |
||||
|
||||
//Load main content |
||||
if (api_is_course_coach() && $extend_rights_for_coachs=='false') |
||||
SurveyUtil::display_survey_list_for_coach(); |
||||
else |
||||
SurveyUtil::display_survey_list(); |
||||
|
||||
// Footer |
||||
Display :: display_footer(); |
||||
|
||||
/* Bypass functions to make direct use from SortableTable possible */ |
||||
function get_number_of_surveys() |
||||
{ |
||||
return SurveyUtil::get_number_of_surveys(); |
||||
} |
||||
function get_survey_data($from, $number_of_items, $column, $direction) |
||||
{ |
||||
return SurveyUtil::get_survey_data($from, $number_of_items, $column, $direction); |
||||
} |
||||
function modify_filter($survey_id) |
||||
{ |
||||
return SurveyUtil::modify_filter($survey_id); |
||||
} |
||||
|
||||
function get_number_of_surveys_for_coach() |
||||
{ |
||||
return SurveyUtil::get_number_of_surveys_for_coach(); |
||||
} |
||||
function get_survey_data_for_coach($from, $number_of_items, $column, $direction) |
||||
{ |
||||
return SurveyUtil::get_survey_data_for_coach($from, $number_of_items, $column, $direction); |
||||
} |
||||
|
||||
|
||||
function modify_filter_for_coach($survey_id) |
||||
{ |
||||
return SurveyUtil::modify_filter_for_coach($survey_id); |
||||
} |
||||
|
||||
function anonymous_filter($anonymous) |
||||
{ |
||||
return SurveyUtil::anonymous_filter($anonymous); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
<?php // $Id: survey_list.php 21933 2009-07-09 06:08:22Z ivantcholakov $
|
||||
/* |
||||
============================================================================== |
||||
Dokeos - elearning and course management software |
||||
|
||||
Copyright (c) 2004-2008 Dokeos SPRL |
||||
Copyright (c) 2003 Ghent University (UGent) |
||||
|
||||
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: Dokeos, rue Notre Dame, 152, B-1140 Evere, Belgium, info@dokeos.com |
||||
============================================================================== |
||||
*/ |
||||
|
||||
|
||||
|
||||
/** |
||||
* @package dokeos.survey |
||||
* @author unknown, the initial survey that did not make it in 1.8 because of bad code |
||||
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code |
||||
* @author Julio Montoya Armas <gugli100@gmail.com>, Dokeos: Personality Test modification and rewriting large parts of the code |
||||
* @version $Id: survey_list.php 21933 2009-07-09 06:08:22Z ivantcholakov $ |
||||
* |
||||
* @todo use quickforms for the forms |
||||
*/ |
||||
|
||||
// name of the language file that needs to be included |
||||
$language_file = 'survey'; |
||||
if (!isset ($_GET['cidReq'])){ |
||||
$_GET['cidReq']='none'; // prevent sql errors |
||||
$cidReset = true; |
||||
} |
||||
// including the global dokeos file |
||||
require ('../inc/global.inc.php'); |
||||
|
||||
// including additional libraries |
||||
//require_once (api_get_path(LIBRARY_PATH)."/survey.lib.php"); |
||||
require_once('survey.lib.php'); |
||||
require_once (api_get_path(LIBRARY_PATH)."/course.lib.php"); |
||||
|
||||
/** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/ |
||||
if (!api_is_allowed_to_edit(false,true)) //coach can see this |
||||
{ |
||||
Display :: display_header(get_lang('SurveyList')); |
||||
SurveyUtil::survey_list_user($_user['user_id']); |
||||
Display :: display_footer(); |
||||
exit; |
||||
} |
||||
|
||||
$extend_rights_for_coachs = api_get_setting('extend_rights_for_coach_on_survey'); |
||||
|
||||
// Database table definitions |
||||
$table_survey = Database :: get_course_table(TABLE_SURVEY); |
||||
$table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
||||
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE); |
||||
$table_user = Database :: get_main_table(TABLE_MAIN_USER); |
||||
|
||||
// language variables |
||||
if (isset ($_GET['search']) && $_GET['search'] == 'advanced') |
||||
{ |
||||
$interbreadcrumb[] = array ('url' => 'survey_list.php', 'name' => get_lang('SurveyList')); |
||||
$tool_name = get_lang('SearchASurvey'); |
||||
} |
||||
else |
||||
{ |
||||
$tool_name = get_lang('SurveyList'); |
||||
} |
||||
|
||||
|
||||
// Header |
||||
Display :: display_header($tool_name,'Survey'); |
||||
//api_display_tool_title($tool_name); |
||||
|
||||
// Tool introduction |
||||
Display::display_introduction_section('survey', 'left'); |
||||
|
||||
// Action handling: searching |
||||
if (isset ($_GET['search']) AND $_GET['search'] == 'advanced') |
||||
{ |
||||
SurveyUtil::display_survey_search_form(); |
||||
} |
||||
// Action handling: deleting a survey |
||||
if (isset($_GET['action']) AND $_GET['action'] == 'delete' AND isset($_GET['survey_id']) AND is_numeric($_GET['survey_id'])) |
||||
{ |
||||
// getting the information of the survey (used for when the survey is shared) |
||||
$survey_data = survey_manager::get_survey($_GET['survey_id']); |
||||
if(api_is_course_coach() && intval($_SESSION['id_session']) != $survey_data['session_id']) |
||||
{ // the coach can't delete a survey not belonging to his session |
||||
api_not_allowed(); |
||||
exit; |
||||
} |
||||
// if the survey is shared => also delete the shared content |
||||
if (is_numeric($survey_data['survey_share'])) |
||||
{ |
||||
survey_manager::delete_survey($survey_data['survey_share'], true); |
||||
} |
||||
$return = survey_manager :: delete_survey($_GET['survey_id']); |
||||
if ($return) |
||||
{ |
||||
Display :: display_confirmation_message(get_lang('SurveyDeleted'), false); |
||||
} |
||||
else |
||||
{ |
||||
Display :: display_error_message(get_lang('ErrorOccurred'), false); |
||||
} |
||||
} |
||||
|
||||
if(isset($_GET['action']) && $_GET['action'] == 'empty') |
||||
{ |
||||
$mysession = api_get_session_id(); |
||||
if ( $mysession != 0 ) { |
||||
if(!((api_is_course_coach() || api_is_platform_admin()) && api_is_element_in_the_session(TOOL_SURVEY,intval($_GET['survey_id'])))) { |
||||
// the coach can't empty a survey not belonging to his session |
||||
api_not_allowed(); |
||||
exit; |
||||
} |
||||
} else { |
||||
if (!(api_is_course_admin() || api_is_platform_admin())) { |
||||
api_not_allowed(); |
||||
exit; |
||||
} |
||||
} |
||||
$return = survey_manager::empty_survey(intval($_GET['survey_id'])); |
||||
if ($return) |
||||
{ |
||||
Display :: display_confirmation_message(get_lang('SurveyEmptied'), false); |
||||
} |
||||
else |
||||
{ |
||||
Display :: display_error_message(get_lang('ErrorOccurred'), false); |
||||
} |
||||
} |
||||
|
||||
// Action handling: performing the same action on multiple surveys |
||||
if ($_POST['action']) |
||||
{ |
||||
if (is_array($_POST['id'])) |
||||
{ |
||||
foreach ($_POST['id'] as $key=>$value) |
||||
{ |
||||
// getting the information of the survey (used for when the survey is shared) |
||||
$survey_data = survey_manager::get_survey($value); |
||||
// if the survey is shared => also delete the shared content |
||||
if (is_numeric($survey_data['survey_share'])) |
||||
{ |
||||
survey_manager::delete_survey($survey_data['survey_share'], true); |
||||
} |
||||
// delete the actual survey |
||||
survey_manager::delete_survey($value); |
||||
} |
||||
Display :: display_confirmation_message(get_lang('SurveysDeleted'), false); |
||||
} |
||||
else |
||||
{ |
||||
Display :: display_error_message(get_lang('NoSurveysSelected'), false); |
||||
} |
||||
} |
||||
echo $extended_rights_for_coachs; |
||||
echo '<div class="actions">'; |
||||
if (!api_is_course_coach() || $extend_rights_for_coachs=='true') |
||||
{ |
||||
// Action links |
||||
echo Display::return_icon('surveyadd.gif', get_lang('CreateNewSurvey')) . '<a href="create_new_survey.php?'.api_get_cidreq().'&action=add">'.get_lang('CreateNewSurvey').'</a> '; |
||||
} |
||||
//echo '<a href="survey_all_courses.php">'.get_lang('CreateExistingSurvey').'</a> '; |
||||
echo Display::return_icon('search.gif', get_lang('Search')) . '<a href="'.api_get_self().'?'.api_get_cidreq().'&search=advanced">'.get_lang('Search').'</a>'; |
||||
echo '</div>'; |
||||
|
||||
//Load main content |
||||
if (api_is_course_coach() && $extend_rights_for_coachs=='false') |
||||
SurveyUtil::display_survey_list_for_coach(); |
||||
else |
||||
SurveyUtil::display_survey_list(); |
||||
|
||||
// Footer |
||||
Display :: display_footer(); |
||||
|
||||
/* Bypass functions to make direct use from SortableTable possible */ |
||||
function get_number_of_surveys() |
||||
{ |
||||
return SurveyUtil::get_number_of_surveys(); |
||||
} |
||||
function get_survey_data($from, $number_of_items, $column, $direction) |
||||
{ |
||||
return SurveyUtil::get_survey_data($from, $number_of_items, $column, $direction); |
||||
} |
||||
function modify_filter($survey_id) |
||||
{ |
||||
return SurveyUtil::modify_filter($survey_id); |
||||
} |
||||
|
||||
function get_number_of_surveys_for_coach() |
||||
{ |
||||
return SurveyUtil::get_number_of_surveys_for_coach(); |
||||
} |
||||
function get_survey_data_for_coach($from, $number_of_items, $column, $direction) |
||||
{ |
||||
return SurveyUtil::get_survey_data_for_coach($from, $number_of_items, $column, $direction); |
||||
} |
||||
|
||||
|
||||
function modify_filter_for_coach($survey_id) |
||||
{ |
||||
return SurveyUtil::modify_filter_for_coach($survey_id); |
||||
} |
||||
|
||||
function anonymous_filter($anonymous) |
||||
{ |
||||
return SurveyUtil::anonymous_filter($anonymous); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue