Adding new interface when adding docs, works, etc in a LP

skala
Julio Montoya 15 years ago
parent 7285c4849e
commit e9f2567377
  1. 8
      main/css/base.css
  2. 18
      main/inc/lib/javascript/jquery-ui/default.css
  3. 80
      main/newscorm/learnpath.class.php
  4. 17
      main/newscorm/lp_add_item.php
  5. 4
      main/newscorm/lp_controller.php

@ -339,3 +339,11 @@ button:hover {
.session_course_item { .session_course_item {
padding: 6px 0px 6px 5px ; padding: 6px 0px 6px 5px ;
} }
div.lp_resource {
background:#FAFAFA;
border:1px solid #ccc;
padding:5px 10px;
width:450px;
font
}

@ -78,11 +78,23 @@
height:15px; height:15px;
} }
/* LP add items */
#resource_tab.ui-tabs .ui-tabs-nav {
height: 77px;
}
#resource_tab.ui-tabs .ui-tabs-nav li {
height: 75px;
border:1px solid #ccc;
}
#resource_tab.ui-tabs-nav li {
}
/* cupertino */ /* cupertino */
/* ui-lightness */ /* ui-lightness */
*
*/

@ -5098,28 +5098,36 @@ class learnpath {
public function display_resources() { public function display_resources() {
global $_course; // TODO: Don't use globals. global $_course; // TODO: Don't use globals.
$return .= '<div class="sectiontitle">' . get_lang('CreateNewStep') . '</div>'; /*$return .= '<div class="sectiontitle">' . get_lang('CreateNewStep') . '</div>';
$return .= '<div class="sectioncomment"><a href="' . api_get_self() . '?cidReq=' . $_GET['cidReq'] . '&amp;action=add_item&amp;type=' . TOOL_DOCUMENT . '&amp;lp_id=' . $_SESSION['oLP']->lp_id . '">' . '<img title="Nuevo documento" src="../img/new_doc.gif" alt="Nuevo documento"/> ' . get_lang('NewDocument') . '</a></div>'; // TODO: A hardcoded Spanish text is here. $return .= '<div class="sectioncomment"><a href="' . api_get_self() . '?cidReq=' . $_GET['cidReq'] . '&amp;action=add_item&amp;type=' . TOOL_DOCUMENT . '&amp;lp_id=' . $_SESSION['oLP']->lp_id . '">' . '<img title="Nuevo documento" src="../img/new_doc.gif" alt="Nuevo documento"/> ' . get_lang('NewDocument') . '</a></div>';
$return .= '<div class="sectiontitle">' . get_lang('UseAnExistingResource') . '</div>'; $return .= '<div class="sectiontitle">' . get_lang('UseAnExistingResource') . '</div>';*/
$return .= '<div class="sectioncomment">';
/* Get all the docs. */ $new_document = Display::return_message(Display::url(get_lang('NewDocument') , api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_DOCUMENT.'&lp_id='.$_SESSION['oLP']->lp_id));
$return .= $this->get_documents();
/* Get all the exercises. */ //Get all the docs
$return .= $this->get_exercises(); $documents = $this->get_documents();
/* Get all the links. */ //Get all the exercises
$return .= $this->get_links(); $exercises = $this->get_exercises();
/* Get al the student publications. */ // Get all the links
$return .= $this->get_student_publications(); $links = $this->get_links();
/* Get al the forums. */ //Get al the student publications
$return .= $this->get_forums(); $works = $this->get_student_publications();
$return .= '</div>'; //Get al the forums
$forums = $this->get_forums();
$headers = array( Display::return_icon('new_doc.png', get_lang('NewDocument'), array(), 64),
Display::return_icon('folder_document.png', get_lang('Documents'), array(), 64),
Display::return_icon('quiz.png', get_lang('Exercises'), array(), 64),
Display::return_icon('links.png', get_lang('Links'), array(), 64),
Display::return_icon('works.png', get_lang('Works'), array(), 64),
Display::return_icon('forum.png', get_lang('Forums'), array(), 64),
);
echo Display::tabs($headers, array($new_document, $documents, $exercises, $links, $works, $forums), 'resource_tab');
return $return; return $return;
} }
@ -7414,12 +7422,10 @@ class learnpath {
AND docs.path NOT LIKE '%_DELETED_%' AND docs.path NOT LIKE '%_DELETED_%'
AND last.tool = '".TOOL_DOCUMENT."' $condition_session ORDER BY docs.path ASC"; AND last.tool = '".TOOL_DOCUMENT."' $condition_session ORDER BY docs.path ASC";
//$sql_doc = "SELECT * FROM $tbl_doc WHERE path NOT LIKE '%_DELETED_%' ORDER BY path ASC";
$res_doc = Database::query($sql_doc); $res_doc = Database::query($sql_doc);
$return = '<div class="lp_resource_header"' . " onclick=\"if(document.getElementById('resDoc').style.display == 'block') {document.getElementById('resDoc').style.display = 'none';} else {document.getElementById('resDoc').style.display = 'block';}\"" . '>'.Display::return_icon('folder_document.gif',get_lang('Documents'),array('style'=>'margin-right:5px;', 'height' => '16px')).' '. get_lang('Documents') . '</div>'; //$return = '<div class="lp_resource_header"' ." onclick=\"if(document.getElementById('resDoc').style.display == 'block') {document.getElementById('resDoc').style.display = 'none';} else {document.getElementById('resDoc').style.display = 'block';}\"" . '>'.Display::return_icon('folder_document.gif',get_lang('Documents'),array('style'=>'margin-right:5px;', 'height' => '16px')).' '. get_lang('Documents') . '</div>';
$return .= '<div class="lp_resource_elements" id="resDoc">'; $return = '<div class="lp_resource" id="resDoc">';
$resources = Database::store_result($res_doc); $resources = Database::store_result($res_doc);
$resources_sorted = array(); $resources_sorted = array();
@ -7448,13 +7454,11 @@ class learnpath {
} else { } else {
eval ('$resources_sorted' . $path_to_eval . '["' . $last_path . '"]["id"]=' . $resource['id'] . ';'); eval ('$resources_sorted' . $path_to_eval . '["' . $last_path . '"]["id"]=' . $resource['id'] . ';');
} }
} }
$return .= $this->write_resources_tree($resources_sorted); $return .= $this->write_resources_tree($resources_sorted);
if (Database :: num_rows($res_doc) == 0) { if (Database :: num_rows($res_doc) == 0) {
$return .= '<div class="lp_resource_element">' . get_lang('NoDocuments') . '</div>'; $return .= '<div class="lp_resource_element">' . get_lang('NoDocuments') . '</div>';
} }
$return .= '</div>'; $return .= '</div>';
return $return; return $return;
} }
@ -7536,21 +7540,14 @@ class learnpath {
$session_id = api_get_session_id(); $session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id); $condition_session = api_get_session_condition($session_id);
$sql_quiz = " $sql_quiz = "SELECT * FROM " . $tbl_quiz . " WHERE active<>'-1' $condition_session ORDER BY title ASC";
SELECT * $sql_hot = "SELECT * FROM $tbl_doc WHERE path LIKE '" . $uploadPath . "/%/%htm%' $condition_session ORDER BY id ASC";
FROM " . $tbl_quiz . "
WHERE active<>'-1' $condition_session
ORDER BY title ASC";
$sql_hot = "SELECT * FROM " . $tbl_doc . " " .
" WHERE path LIKE '" . $uploadPath . "/%/%htm%' $condition_session " .
" ORDER BY id ASC";
$res_quiz = Database::query($sql_quiz); $res_quiz = Database::query($sql_quiz);
$res_hot = Database::query($sql_hot); $res_hot = Database::query($sql_hot);
$return .= '<div class="lp_resource_header"' . " onclick=\"javascript: if(document.getElementById('resExercise').style.display == 'block') {document.getElementById('resExercise').style.display = 'none';} else {document.getElementById('resExercise').style.display = 'block';}\"" . ' ><img align="left" alt="" src="../img/lp_' . TOOL_QUIZ . '.gif" style="margin-right:5px;" title="" />' . get_lang('Quiz') . '</div>'; //$return .= '<div class="lp_resource_header"' . " onclick=\"javascript: if(document.getElementById('resExercise').style.display == 'block') {document.getElementById('resExercise').style.display = 'none';} else {document.getElementById('resExercise').style.display = 'block';}\"" . ' ><img align="left" alt="" src="../img/lp_' . TOOL_QUIZ . '.gif" style="margin-right:5px;" title="" />' . get_lang('Quiz') . '</div>';
$return .= '<div class="lp_resource_elements" id="resExercise">'; $return .= '<div class="lp_resource" id="resExercise">';
while ($row_hot = Database :: fetch_array($res_hot)) { while ($row_hot = Database :: fetch_array($res_hot)) {
$return .= '<div class="lp_resource_element">'; $return .= '<div class="lp_resource_element">';
@ -7593,8 +7590,8 @@ class learnpath {
$sql_link = "SELECT * FROM $tbl_link $condition_session ORDER BY title ASC"; $sql_link = "SELECT * FROM $tbl_link $condition_session ORDER BY title ASC";
$res_link = Database::query($sql_link); $res_link = Database::query($sql_link);
$return .= '<div class="lp_resource_header"' . " onclick=\"javascript: if(document.getElementById('resLink').style.display == 'block') {document.getElementById('resLink').style.display = 'none';} else {document.getElementById('resLink').style.display = 'block';}\"" . '><img alt="" src="../img/lp_' . TOOL_LINK . '.gif" style="margin-right:5px;" title="" />' . get_lang('Links') . '</div>'; //$return .= '<div class="lp_resource_header"' . " onclick=\"javascript: if(document.getElementById('resLink').style.display == 'block') {document.getElementById('resLink').style.display = 'none';} else {document.getElementById('resLink').style.display = 'block';}\"" . '><img alt="" src="../img/lp_' . TOOL_LINK . '.gif" style="margin-right:5px;" title="" />' . get_lang('Links') . '</div>';
$return .= '<div class="lp_resource_elements" id="resLink">'; $return .= '<div class="lp_resource" id="resLink">';
while ($row_link = Database :: fetch_array($res_link)) { while ($row_link = Database :: fetch_array($res_link)) {
$return .= '<div class="lp_resource_element">'; $return .= '<div class="lp_resource_element">';
@ -7627,8 +7624,8 @@ class learnpath {
$condition_session = api_get_session_condition($session_id, false); $condition_session = api_get_session_condition($session_id, false);
$sql_student = "SELECT * FROM $tbl_student $condition_session ORDER BY title ASC"; $sql_student = "SELECT * FROM $tbl_student $condition_session ORDER BY title ASC";
$res_student = Database::query($sql_student); $res_student = Database::query($sql_student);
$return .= '<div class="lp_resource_header"' . " onclick=\"javascript: if(document.getElementById('resStudent').style.display == 'block') {document.getElementById('resStudent').style.display = 'none';} else {document.getElementById('resStudent').style.display = 'block';}\"" . '><img alt="" src="../img/lp_' . TOOL_STUDENTPUBLICATION . '.gif" style="margin-right:5px;" title="" />' . get_lang('Student_publication') . '</div>'; //$return .= '<div class="lp_resource_header"' . " onclick=\"javascript: if(document.getElementById('resStudent').style.display == 'block') {document.getElementById('resStudent').style.display = 'none';} else {document.getElementById('resStudent').style.display = 'block';}\"" . '><img alt="" src="../img/lp_' . TOOL_STUDENTPUBLICATION . '.gif" style="margin-right:5px;" title="" />' . get_lang('Student_publication') . '</div>';
$return .= '<div class="lp_resource_elements" id="resStudent">'; $return .= '<div class="lp_resource" id="resStudent">';
$return .= '<div class="lp_resource_element">'; $return .= '<div class="lp_resource_element">';
$return .= '<img align="left" alt="" src="../img/works_small.gif" style="margin-right:5px;" title="" />'; $return .= '<img align="left" alt="" src="../img/works_small.gif" style="margin-right:5px;" title="" />';
$return .= '<a href="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&amp;action=add_item&amp;type=' . TOOL_STUDENTPUBLICATION . '&amp;lp_id=' . $this->lp_id . '">' . get_lang('AddAssignmentPage') . '</a>'; $return .= '<a href="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&amp;action=add_item&amp;type=' . TOOL_STUDENTPUBLICATION . '&amp;lp_id=' . $this->lp_id . '">' . get_lang('AddAssignmentPage') . '</a>';
@ -7642,8 +7639,8 @@ class learnpath {
* @return string * @return string
*/ */
public function get_forums() { public function get_forums() {
include '../forum/forumfunction.inc.php'; require_once '../forum/forumfunction.inc.php';
include '../forum/forumconfig.inc.php'; require_once '../forum/forumconfig.inc.php';
global $table_forums, $table_threads, $table_posts, $table_item_property, $table_users; global $table_forums, $table_threads, $table_posts, $table_item_property, $table_users;
$table_forums = Database :: get_course_table(TABLE_FORUM); $table_forums = Database :: get_course_table(TABLE_FORUM);
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD); $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD);
@ -7652,8 +7649,8 @@ class learnpath {
$table_users = Database :: get_main_table(TABLE_MAIN_USER); $table_users = Database :: get_main_table(TABLE_MAIN_USER);
$a_forums = get_forums(); $a_forums = get_forums();
$return .= '<div class="lp_resource_header"' . " onclick=\"javascript: if(document.getElementById('forums').style.display == 'block') {document.getElementById('forums').style.display = 'none';} else {document.getElementById('forums').style.display = 'block';}\"" . '><img alt="" src="../img/lp_forum.gif" style="margin-right:5px;" title="" />' . get_lang('Forums') . '</div>'; //$return .= '<div class="lp_resource_header"' . " onclick=\"javascript: if(document.getElementById('forums').style.display == 'block') {document.getElementById('forums').style.display = 'none';} else {document.getElementById('forums').style.display = 'block';}\"" . '><img alt="" src="../img/lp_forum.gif" style="margin-right:5px;" title="" />' . get_lang('Forums') . '</div>';
$return .= '<div class="lp_resource_elements" style="border:1px solid #999999;" id="forums">'; $return .= '<div class="lp_resource" id="forums">';
foreach ($a_forums as $forum) { foreach ($a_forums as $forum) {
$return .= '<div class="lp_resource_element">'; $return .= '<div class="lp_resource_element">';
@ -7668,8 +7665,7 @@ class learnpath {
document.getElementById("forum_"+forum_id+"_opener").src = "' . api_get_path(WEB_IMG_PATH) . 'add.gif"; document.getElementById("forum_"+forum_id+"_opener").src = "' . api_get_path(WEB_IMG_PATH) . 'add.gif";
} }
} }
</script> </script>';
';
if (!empty($forum['forum_id'])) { if (!empty($forum['forum_id'])) {
$return .= '<img alt="" src="../img/lp_forum.gif" style="margin-right:5px;" title="" />'; $return .= '<img alt="" src="../img/lp_forum.gif" style="margin-right:5px;" title="" />';

@ -33,6 +33,8 @@ $language_file = 'learnpath';
/* Header and action code */ /* Header and action code */
$htmlHeadXtra[] = ' $htmlHeadXtra[] = '
<script type="text/javascript"> <script type="text/javascript">
@ -136,6 +138,7 @@ $_SESSION['oLP']->get_js_dropdown_array() .
'});'."\n" . '});'."\n" .
'</script>'; '</script>';
$htmlHeadXtra[] = api_get_jquery_ui_js(); //jQuery
/* Constants and variables */ /* Constants and variables */
@ -221,7 +224,6 @@ $suredel = trim(get_lang('AreYouSureToDelete'));
//$suredelstep = trim(get_lang('AreYouSureToDeleteSteps')); //$suredelstep = trim(get_lang('AreYouSureToDeleteSteps'));
?> ?>
<script type='text/javascript'> <script type='text/javascript'>
/* <![CDATA[ */
function stripslashes(str) { function stripslashes(str) {
str=str.replace(/\\'/g,'\''); str=str.replace(/\\'/g,'\'');
str=str.replace(/\\"/g,'"'); str=str.replace(/\\"/g,'"');
@ -229,18 +231,17 @@ function stripslashes(str) {
str=str.replace(/\\0/g,'\0'); str=str.replace(/\\0/g,'\0');
return str; return str;
} }
function confirmation(name) function confirmation(name) {
{
name=stripslashes(name); name=stripslashes(name);
if (confirm("<?php echo $suredel; ?> " + name + " ?")) if (confirm("<?php echo $suredel; ?> " + name + " ?")) {
{
return true; return true;
} } else {
else
{
return false; return false;
} }
} }
$(function() {;
$('#resource_tab').tabs();
});
</script> </script>
<?php <?php

@ -33,7 +33,7 @@ $language_file[] = 'registration';
// Including the global initialization file. // Including the global initialization file.
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
$htmlHeadXtra[] = api_get_jquery_js(); //jQuery $htmlHeadXtra[] = api_get_jquery_js(); //jQuery
if (api_get_setting('show_glossary_in_documents') == 'ismanual' || api_get_setting('show_glossary_in_documents') == 'isautomatic' ) { if (api_get_setting('show_glossary_in_documents') == 'ismanual' || api_get_setting('show_glossary_in_documents') == 'isautomatic' ) {
$htmlHeadXtra[] = '<script type="text/javascript"> $htmlHeadXtra[] = '<script type="text/javascript">
@ -47,7 +47,7 @@ if (api_get_setting('show_glossary_in_documents') == 'ismanual' || api_get_setti
$htmlHeadXtra[] = '<script type="text/javascript"> $htmlHeadXtra[] = '<script type="text/javascript">
function setFocus(){ function setFocus(){
$("#idTitle").focus(); $("#idTitle").focus();
} }
$(window).load(function () { $(window).load(function () {
setFocus(); setFocus();

Loading…
Cancel
Save