diff --git a/main/css/base.css b/main/css/base.css
index 5d73458905..eea9059505 100644
--- a/main/css/base.css
+++ b/main/css/base.css
@@ -1981,12 +1981,13 @@ input.maininput:focus {
/* LP tool*/
-div.lp_resource {
- padding:5px 10px;
- /* width:380px; */
+.lp_resource {
+ padding:5px 10px;
list-style-type: none;
margin: 0;
padding: 0;
+ float:left;
+ width:70%;
}
.lp_resource_element, .lp_resource_element_no_link {
@@ -2000,15 +2001,30 @@ div.lp_resource {
text-shadow: 0 1px 1px #F6F6F6;
margin:5px;
padding:5px;
+ list-style: none outside none;
}
+.lp_resource_element_new {
+ background-image:-moz-linear-gradient(top,#fefefe,#eee);
+ background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fdfdfd),color-stop(1,#eee));
+ border: 1px solid #CCCCCC;
+ color: #444444;
+ cursor: pointer;
+ font-weight: bold;
+ text-decoration: none;
+ text-shadow: 0 1px 1px #F6F6F6;
+ margin:5px;
+ padding:5px;
+ list-style: none outside none;
+}
+
.doc_resource {
margin:6px;
}
div.lp_tree {
height: 100%;
- overflow: auto;
+ /* overflow: auto;*/
padding: 3px 10px 3px 0;
}
@@ -2224,10 +2240,11 @@ div.admin_section h4 {
}
#lp_item_list {
width:90%;
-
+ margin:0px;
}
#lp_item_list, #lp_item_list li {
list-style-type: none;
+ float:left;
}
#lp_item_list ul, #lp_item_list li{
@@ -2240,11 +2257,12 @@ div.admin_section h4 {
}
#lp_item_list .empty {
- height:20px;
+ height:5px;
}
#lp_item_list .item_data {
padding:5px 0px 5px 0px;
+ float:left;
}
.ui-state-highlight {
diff --git a/main/img/icons/16/delete.png b/main/img/icons/16/delete.png
index 894d97a48d..f26e2636e3 100644
Binary files a/main/img/icons/16/delete.png and b/main/img/icons/16/delete.png differ
diff --git a/main/img/icons/16/edit.png b/main/img/icons/16/edit.png
new file mode 100644
index 0000000000..8396177bc7
Binary files /dev/null and b/main/img/icons/16/edit.png differ
diff --git a/main/img/icons/16/forumthread.png b/main/img/icons/16/forumthread.png
new file mode 100644
index 0000000000..656f1d65e0
Binary files /dev/null and b/main/img/icons/16/forumthread.png differ
diff --git a/main/img/icons/16/move_everywhere.png b/main/img/icons/16/move_everywhere.png
new file mode 100644
index 0000000000..96cea00f35
Binary files /dev/null and b/main/img/icons/16/move_everywhere.png differ
diff --git a/main/img/icons/22/move_everywhere.png b/main/img/icons/22/move_everywhere.png
new file mode 100644
index 0000000000..b93c43a916
Binary files /dev/null and b/main/img/icons/22/move_everywhere.png differ
diff --git a/main/inc/ajax/lp.ajax.php b/main/inc/ajax/lp.ajax.php
index dbf105114e..b1647638fe 100644
--- a/main/inc/ajax/lp.ajax.php
+++ b/main/inc/ajax/lp.ajax.php
@@ -9,8 +9,18 @@ api_protect_course_script(true);
$action = $_REQUEST['a'];
$course_id = api_get_course_int_id();
+$tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
switch ($action) {
+ case 'add_lp_item':
+ if (api_is_allowed_to_edit(null, true)) {
+ if ($_SESSION['oLP']) {
+ //Updating the lp.modified_on
+ $_SESSION['oLP']->set_modified_on();
+ echo $_SESSION['oLP']->add_item($_REQUEST['parent_id'], $_REQUEST['previous_id'], $_REQUEST['type'], $_REQUEST['id'], $_REQUEST['title']);
+ }
+ }
+ break;
case 'update_lp_item_order':
if (api_is_allowed_to_edit(null, true)) {
$new_order = $_POST['new_order'];
@@ -23,7 +33,6 @@ switch ($action) {
$new_array[$i]['parent_id'] = intval($parent_id);
$i++;
}
- $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
$counter = 1;
for ($i=0; $i < count($new_array); $i++) {
$params = array();
diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php
index b9595d59a9..dbe2f8784c 100755
--- a/main/inc/lib/document.lib.php
+++ b/main/inc/lib/document.lib.php
@@ -2436,17 +2436,14 @@ class DocumentManager {
return $html;
}
- function get_document_preview($course_info, $lp_id = false, $target = '', $session_id = 0) {
-
- $course_info = api_get_course_info($course_info['code']);
-
+ function get_document_preview($course_info, $lp_id = false, $target = '', $session_id = 0, $add_move_button = false) {
+ $course_info = api_get_course_info($course_info['code']);
if (empty($course_info) || !is_array($course_info)) {
return '';
}
- $user_id = api_get_user_id();
-
+ $user_id = api_get_user_id();
$user_in_course = false;
-
+
if (api_is_platform_admin()) {
$user_in_course = true;
}
@@ -2477,8 +2474,7 @@ class DocumentManager {
}
}
}
-
- $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
+
$tbl_doc = Database::get_course_table(TABLE_DOCUMENT);
$tbl_item_prop = Database::get_course_table(TABLE_ITEM_PROPERTY);
@@ -2569,7 +2565,7 @@ class DocumentManager {
$new_array[$label] = array('id' => 0, 'files' => $resources_sorted);
- $write_result = self::write_resources_tree($course_info, $session_id, $new_array, 0, $lp_id, $target);
+ $write_result = self::write_resources_tree($course_info, $session_id, $new_array, 0, $lp_id, $target, $add_move_button);
$return .= $write_result ;
@@ -2581,7 +2577,7 @@ class DocumentManager {
$('.doc_folder').mouseover(function() {
var my_id = this.id.split('_')[2];
$('#'+my_id).show();
- });
+ });
$('.close_div').click(function() {
var course_id = this.id.split('_')[2];
@@ -2619,7 +2615,7 @@ class DocumentManager {
* @param integer Enables the tree display by shifting the new elements a certain distance to the right
* @return string The HTML list
*/
- public function write_resources_tree($course_info, $session_id, $resources_sorted, $num = 0, $lp_id = false, $target = '') {
+ public function write_resources_tree($course_info, $session_id, $resources_sorted, $num = 0, $lp_id = false, $target = '', $add_move_button = false) {
require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php';
$img_path = api_get_path(WEB_IMG_PATH);
@@ -2661,30 +2657,32 @@ class DocumentManager {
}
$onclick = '';
+
if ($lp_id) {
- $onclick = 'onclick="javascript: testResources(\'' . $resource['id'] . '\',\'img_' . $resource['id'] . '\')"';
+ $onclick = 'onclick="javascript: testResources(\'res_' . $resource['id'] . '\',\'img_' . $resource['id'] . '\')"';
}
- $return .= '
';
- $return .= '
';
- if ($lp_id) {
- $return .= '
';
- } else {
- $return .= '
';
- }
- $return .= '
';
- $return .= '
'.$title.'';
- $return .= '
-
';
-
- if (isset($resource['files'])) {
- $return .= self::write_resources_tree($course_info, $session_id, $resource['files'], $num +1, $lp_id, $target);
- }
- $return .= '
';
+ $return .= '';
+
+ $return .= '';
+ if ($lp_id) {
+ $return .= '
';
+ } else {
+ $return .= '
';
+ }
+ $return .= '
';
+
+ $return .= '
'.$title.'';
+ $return .= '
+ ';
+
+ if (isset($resource['files'])) {
+ $return .= self::write_resources_tree($course_info, $session_id, $resource['files'], $num +1, $lp_id, $target, $add_move_button);
+ }
+ $return .= '
';
+ $return .= '
';
} else {
- if (!is_array($resource)) {
- //if (isset($resource)) {
- //var_dump($resource);
+ if (!is_array($resource)) {
$resource = base64_decode($resource);
// It's a file.
$icon = choose_image($resource);
@@ -2712,11 +2710,19 @@ class DocumentManager {
$img = $img_path.'icons/16/default_small.gif';
}
- $link = Display::url(' ' . $my_file_title, $url, array('target' => $target));
-
- $return .= '';
+ $link = Display::url('
' . $my_file_title, $url, array('target' => $target));
+
+ $return .= '
';
+
+ $return .= '';
+ $return .= '
';
}
}
}
diff --git a/main/inc/lib/javascript/dtree/dtree.css b/main/inc/lib/javascript/dtree/dtree.css
index 2c1cf1abdd..280a5a2cc9 100755
--- a/main/inc/lib/javascript/dtree/dtree.css
+++ b/main/inc/lib/javascript/dtree/dtree.css
@@ -9,9 +9,22 @@
.dtree img{border:0; margin-right:5px; vertical-align:middle;}
.dtree a{color:#000000; font-weight:normal; text-decoration:none;}
- .dtree a.node,
- .dtree a.nodeSel{padding:1px 2px 1px 2px; white-space: nowrap;}
- .dtree a.node:hover, .dtree a.nodeSel:hover{color:#000000; text-decoration:none;}
- .dtree a.nodeSel{background:#F8F8F8; border:1px dashed #999999;}
+.dtree a.node,
+.dtree a.nodeSel{padding:1px 2px 1px 2px; white-space: nowrap;}
+.dtree a.node:hover, .dtree a.nodeSel:hover{color:#000000; text-decoration:none;}
+.dtree a.nodeSel{background:#F8F8F8; border:1px dashed #999999;}
-.dtree .clip{overflow:hidden;}
\ No newline at end of file
+.dtree .clip{overflow:hidden;}
+
+/*
+.dTreeNode {
+ background-image: -moz-linear-gradient(center top , #FEFEFE, #EEEEEE);
+ border: 1px solid #CCCCCC;
+ color: #444444;
+ cursor: pointer;
+ font-weight: bold;
+ margin: 0px 5px 2px 5px;
+ padding: 5px;
+ text-decoration: none;
+ text-shadow: 0 1px 1px #F6F6F6;
+}*/
\ No newline at end of file
diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php
index 03d00ba743..425b3a12a4 100644
--- a/main/newscorm/learnpath.class.php
+++ b/main/newscorm/learnpath.class.php
@@ -4744,51 +4744,18 @@ class learnpath {
* @param int $lp_id
* @return string
*/
- public function overview() {
- $course_id = api_get_course_int_id();
+ public function overview() {
$is_allowed_to_edit = api_is_allowed_to_edit(null,true);
if ($this->debug > 0) {
error_log('New LP - In learnpath::overview()', 0);
}
- global $charset, $_course;
+ global $_course;
$_SESSION['gradebook'] = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
$return = '';
- $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
-
- $sql = "SELECT * FROM " . $tbl_lp_item . "
- WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
-
- $result = Database::query($sql);
- $arrLP = array ();
- while ($row = Database :: fetch_array($result)) {
- $row['title'] = Security :: remove_XSS($row['title']);
- $row['description'] = Security :: remove_XSS($row['description']);
- $arrLP[] = array (
- 'id' => $row['id'],
- 'item_type' => $row['item_type'],
- 'title' => $row['title'],
- 'path' => $row['path'],
- 'description' => $row['description'],
- 'parent_item_id' => $row['parent_item_id'],
- 'previous_item_id' => $row['previous_item_id'],
- 'next_item_id' => $row['next_item_id'],
- 'max_score' => $row['max_score'],
- 'min_score' => $row['min_score'],
- 'mastery_score' => $row['mastery_score'],
- 'prerequisite' => $row['prerequisite'],
- 'display_order' => $row['display_order'],
- 'audio' => $row['audio']
- );
- }
-
- $this->tree_array($arrLP);
- $arrLP = $this->arrMenu;
- unset ($this->arrMenu);
- $update_audio = isset($_GET['updateaudio']) ? $_GET['updateaudio'] : null;
- if ($is_allowed_to_edit) {
- $token = Security::get_token();
+ $update_audio = isset($_GET['updateaudio']) ? $_GET['updateaudio'] : null;
+ if ($is_allowed_to_edit) {
$gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
$return .= '';
@@ -4802,10 +4769,7 @@ class learnpath {
$return .= '
' . Display :: return_icon('view_left_right.png', get_lang('Display'),'',ICON_SIZE_MEDIUM).'';
$return .= ' '.Display :: return_icon('i.gif');
$return .= '
- '. Display :: return_icon('new_learnigpath_object.png', get_lang('NewStep'),'',ICON_SIZE_MEDIUM).'';
-
- /*$return .= '
- '. Display :: return_icon('add_learnpath_section.png', get_lang('NewChapter'),'',ICON_SIZE_MEDIUM).'';*/
+ '. Display :: return_icon('new_learnigpath_object.png', get_lang('NewStep'),'',ICON_SIZE_MEDIUM).'';
if ($update_audio == 'true') {
$return .= Display::url(Display :: return_icon('upload_audio_na.png', get_lang('UpdateAllAudioFragments'),'',ICON_SIZE_MEDIUM),'#');
} else {
@@ -4816,21 +4780,76 @@ class learnpath {
}
// we need to start a form when we want to update all the mp3 files
- if ($update_audio == 'true' AND count($arrLP) <> 0) {
- $return .= '
';
+ }
+ return $return;
+ }
+
+ public function return_new_tree($update_audio = 'false') {
+ $is_allowed_to_edit = api_is_allowed_to_edit(null,true);
+
+ $course_id = api_get_course_int_id();
+ $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
+
+ $sql = "SELECT * FROM $tbl_lp_item
+ WHERE c_id = $course_id AND lp_id = ".$this->lp_id;
+
+ $result = Database::query($sql);
+ $arrLP = array ();
+ while ($row = Database :: fetch_array($result)) {
+ $row['title'] = Security :: remove_XSS($row['title']);
+ $row['description'] = Security :: remove_XSS($row['description']);
+ $arrLP[] = array (
+ 'id' => $row['id'],
+ 'item_type' => $row['item_type'],
+ 'title' => $row['title'],
+ 'path' => $row['path'],
+ 'description' => $row['description'],
+ 'parent_item_id' => $row['parent_item_id'],
+ 'previous_item_id' => $row['previous_item_id'],
+ 'next_item_id' => $row['next_item_id'],
+ 'max_score' => $row['max_score'],
+ 'min_score' => $row['min_score'],
+ 'mastery_score' => $row['mastery_score'],
+ 'prerequisite' => $row['prerequisite'],
+ 'display_order' => $row['display_order'],
+ 'audio' => $row['audio']
+ );
+ }
+
+ $this->tree_array($arrLP);
+ $arrLP = $this->arrMenu;
+ unset ($this->arrMenu);
+
+ $elements = array();
for ($i = 0; $i < count($arrLP); $i++) {
$title = $arrLP[$i]['title'];
if (($i % 2) == 0) {
@@ -4887,22 +4906,22 @@ class learnpath {
if ($is_allowed_to_edit) {
if (!$update_audio OR $update_audio <> 'true') {
$move_icon .= '
';
- $move_icon .= Display::return_icon('move.png', get_lang('Move'), array(), 24);
+ $move_icon .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
$move_icon .= '';
}
if ($arrLP[$i]['item_type'] != 'dokeos_chapter' && $arrLP[$i]['item_type'] != 'dokeos_module') {
- $edit_icon .= '
';
- $edit_icon .= '';
+ $edit_icon .= '';
+ $edit_icon .= Display::return_icon('edit.png', get_lang('_edit_learnpath_module'), array(), ICON_SIZE_TINY);
$edit_icon .= '';
} else {
- $edit_icon .= '
';
- $edit_icon .= '';
+ $edit_icon .= '';
+ $edit_icon .= Display::return_icon('edit.png', get_lang('_edit_learnpath_module'), array(), ICON_SIZE_TINY);
$edit_icon .= '';
}
- $delete_icon .= '
';
- $delete_icon .= '';
+ $delete_icon .= ' ';
+ $delete_icon .= Display::return_icon('delete.png', get_lang('_delete_learnpath_module'), array(), ICON_SIZE_TINY);
$delete_icon .= '';
}
if ($update_audio != 'true') {
@@ -4924,11 +4943,9 @@ class learnpath {
//Getting list of parents
for($j = 0; $j < $arrLP[$i]['depth']; $j++) {
foreach($arrLP as $item) {
- if ($item['id'] == $parent_id) {
-
+ if ($item['id'] == $parent_id) {
if ($item['parent_item_id'] == 0) {
- $parent_id = $item['id'];
- //$parent_arrays[] = $parent_id;
+ $parent_id = $item['id'];
break;
} else {
$parent_id = $item['parent_item_id'];
@@ -4942,9 +4959,9 @@ class learnpath {
}
}
}
+
if (!empty($parent_arrays)) {
- $parent_arrays = array_reverse($parent_arrays);
- $value_to_insert = array();
+ $parent_arrays = array_reverse($parent_arrays);
$val = '$elements';
$x = 0;
foreach($parent_arrays as $item) {
@@ -4955,8 +4972,7 @@ class learnpath {
}
$x++;
}
- $val .= "";
- $generated_array = null;
+ $val .= "";
$code_str = $val."[".$arrLP[$i]['id']."][\"load_data\"] = '".$arrLP[$i]['id']."' ; ";
eval($code_str);
} else {
@@ -4964,67 +4980,40 @@ class learnpath {
$elements[$parent_id]['children'][$arrLP[$i]['id']]['type'] = $arrLP[$i]['item_type'];
}
}
- }
-
- //@todo move this somewhere else
- function print_recursive($elements, $default_data, $default_content) {
- $return = '';
- foreach($elements as $key => $item) {
- if (isset($item['load_data']) || empty($item['data'])) {
- $item['data'] = $default_data[$item['load_data']];
- $item['type'] = $default_content[$item['load_data']]['item_type'];
- }
- $sub_list = '';
- if (isset($item['type']) && $item['type'] == 'dokeos_chapter') {
- $sub_list = Display::tag('li', '', array('class'=>'sub_item empty')); // empty value
- }
- if (empty($item['children'])) {
- $sub_list = Display::tag('ul', $sub_list, array('id'=>'UL_'.$key, 'class'=>'record li_container'));
- $return .= Display::tag('li', Display::div($item['data'], array('class'=>'item_data')).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
- } else {
- //sections
- if (isset($item['children'])) {
- $data = print_recursive($item['children'], $default_data, $default_content);
- }
- /*foreach($item['children'] as $my_key => $sub_item) {
- $sub_list .= Display::tag('li', $sub_item['data'], array('id'=>$my_key,'class'=>'record item'));
- }*/
- $sub_list = Display::tag('ul', $sub_list.$data, array('id'=>'UL_'.$key, 'class'=>'record li_container'));
- $return .= Display::tag('li', Display::div($item['data'], array('class'=>'item_data')).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
- }
- }
- return $return;
- }
+ }
-
- if ($update_audio != 'true') {
- $return .= '
';
- $return .= print_recursive($elements, $default_data, $default_content);
- $return .='
';
- $return .= Display::div(Display::url(get_lang('Save'), '#', array('id'=>'listSubmit', 'class'=>'btn')), array('style'=>'float:left; margin-top:15px;width:100%'));
- } else {
- $return .= $return_audio.'';
- }
-
-/*
- if (count($arrLP) == 0) {
- $return .= '
';
- $return .= '' . get_lang('NoItemsInLp') . ' | ';
- $return .= '
';
- }*/
-
-
- // We need to close the form when we are updating the mp3 files.
-
+ $return = '
';
+ $return .= self::print_recursive($elements, $default_data, $default_content);
+ $return .= '
';
if ($update_audio == 'true') {
- $return .= '
'; // TODO: What kind of language variable is this?
- }
-
- // We need to close the form when we are updating the mp3 files.
- if ($update_audio == 'true' && count($arrLP) != 0) {
- $return .= '';
+ $return = $return_audio;
+ }
+ return $return;
+ }
+
+ function print_recursive($elements, $default_data, $default_content) {
+ $return = '';
+ foreach($elements as $key => $item) {
+ if (isset($item['load_data']) || empty($item['data'])) {
+ $item['data'] = $default_data[$item['load_data']];
+ $item['type'] = $default_content[$item['load_data']]['item_type'];
+ }
+ $sub_list = '';
+ if (isset($item['type']) && $item['type'] == 'dokeos_chapter') {
+ $sub_list = Display::tag('li', '', array('class'=>'sub_item empty')); // empty value
+ }
+ if (empty($item['children'])) {
+ $sub_list = Display::tag('ul', $sub_list, array('id'=>'UL_'.$key, 'class'=>'record li_container'));
+ $return .= Display::tag('li', Display::div($item['data'], array('class'=>'item_data')).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
+ } else {
+ //sections
+ if (isset($item['children'])) {
+ $data = self::print_recursive($item['children'], $default_data, $default_content);
+ }
+ $sub_list = Display::tag('ul', $sub_list.$data, array('id'=>'UL_'.$key, 'class'=>'record li_container'));
+ $return .= Display::tag('li', Display::div($item['data'], array('class'=>'item_data')).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
+ }
}
-
return $return;
}
@@ -5063,6 +5052,7 @@ class learnpath {
$return .= "\tm.config.useLines = true;\n";
$return .= "\tm.config.useSelection = true;\n";
$return .= "\tm.config.useStatustext = false;\n\n";
+
$menu = 0;
$parent = '';
@@ -5154,6 +5144,7 @@ class learnpath {
$array = array('dir' => $dir, 'filepath' => $filepath);
return $array;
}
+
/**
* Create a new document //still needs some finetuning
* @param array $_course
@@ -6988,14 +6979,14 @@ class learnpath {
reset($arrLP);
}
- $return .= "\t\t\t\t" . '';
+ $return .= '';
$return .= '';
$return .= '';
$return .= '
';
$return .= ' | ';
$return .= '';
- $return .= "\t\t\t\t" . ' |