added toogle for post-it inside course home, and new field progress inside track_e_item_property table - partial CT#578

skala
Cristian Fasanando 16 years ago
parent 075ee03e61
commit 9a25b32e6b
  1. 5
      main/course_description/add.php
  2. 18
      main/course_description/course_description_controller.php
  3. 5
      main/course_description/edit.php
  4. 5
      main/course_description/index.php
  5. 12
      main/course_description/layout.php
  6. 16
      main/course_description/listing.php
  7. 8
      main/course_home/course_home.php
  8. 2
      main/inc/introductionSection.inc.php
  9. 17
      main/inc/lib/course_description.lib.php
  10. 1
      main/install/dokeos_stats.sql
  11. 2
      main/install/migrate-db-1.8.6.2-1.8.7-pre.sql

@ -1,12 +1,13 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /license.txt */
/**
* View (MVC patter) for adding a course description
* @package dokeos.course_description
* @author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.course_description
*/
// protect a course script
api_protect_course_script(true);
// display categories

@ -1,13 +1,17 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /license.txt */
/**
* Controller script. Prepares the common background variables to give to the scripts corresponding to
* the requested action
* @package dokeos.course_description
* This file contains class used like controller, it should be included inside a dispatcher file (e.g: index.php)
* @author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.course_description
*/
/**
* Controller script. Prepares the common background variables to give to the scripts corresponding to
* the requested action
* @package dokeos.course_description
*/
class CourseDescriptionController { // extends Controller {
private $toolname;
@ -83,16 +87,18 @@ class CourseDescriptionController { // extends Controller {
if ($description_type >= ADD_BLOCK) {
$affected_rows = $course_description->update();
} else {
$thematic_advance = $course_description->get_data_by_description_type($description_type);
$thematic_advance = $course_description->get_data_by_description_type($description_type);
if (!empty($thematic_advance)) {
if ($description_type == THEMATIC_ADVANCE) {
// if is thematic advance type save in history
$course_description->set_title($thematic_advance['description_title']);
$course_description->set_content($thematic_advance['description_content']);
$course_description->set_progress($thematic_advance['progress']);
$course_description->insert_stats($description_type);
}
$course_description->set_title($title);
$course_description->set_content($content);
$course_description->set_content($content);
$course_description->set_progress($progress);
$affected_rows = $course_description->update();
} else {
$affected_rows = $course_description->insert();

@ -1,12 +1,13 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /license.txt */
/**
* View (MVC patter) for editing a course description
* @package dokeos.course_description
* @author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.course_description
*/
// protect a course script
api_protect_course_script(true);
$token = Security::get_token();

@ -1,10 +1,10 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /license.txt */
/**
* Template (front controller in MVC pattern) used for distpaching to the controllers depend on the current action
* @package dokeos.course_description
* @author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.course_description
*/
// name of the language file that needs to be included
@ -26,6 +26,7 @@ define('THEMATIC_ADVANCE', 8);
// current section
$this_section = SECTION_COURSES;
// protect a course script
api_protect_course_script(true);
// get actions

@ -1,19 +1,17 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /license.txt */
/**
* Layout (principal view) used for structuring other views
* @package dokeos.course_description
* @author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.course_description
*/
// Header
// protect a course script
api_protect_course_script(true);
$nameTools = get_lang('CourseProgram');
Display :: display_header('');
// Constants and variables
$nameTools = get_lang(TOOL_COURSE_DESCRIPTION);
// Header
Display :: display_header('');
// Introduction section
Display::display_introduction_section(TOOL_COURSE_DESCRIPTION);

@ -1,12 +1,13 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /license.txt */
/**
* Template (view in MVC pattern) used for listing course descriptions
* @package dokeos.course_description
* @author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.course_description
*/
// protect a course script
api_protect_course_script(true);
// display messages
@ -40,7 +41,6 @@ if (api_is_allowed_to_edit(null,true)) {
}
// display course description list
if ($history) {
echo '<div><table width="100%"><tr><td><h3>'.get_lang('ThematicAdvanceHistory').'</h3></td><td align="right"><a href="index.php?action=listing">'.Display::return_icon('info.gif',get_lang('BackToCourseDesriptionList'),array('style'=>'vertical-align:middle;')).' '.get_lang('BackToCourseDesriptionList').'</a></td></tr></table></div>';
}
@ -68,15 +68,17 @@ if (isset($descriptions) && count($descriptions) > 0) {
}
}
$progress = (isset($description['progress'])?$description['progress'].'%':'');
if ($description['description_type'] == THEMATIC_ADVANCE) {
$progress_icon = (isset($description['progress_icon'])?$description['progress_icon']:'');
echo get_lang('ThematicAdvance').' : '.$description['title'].' - '.$progress_icon;
echo get_lang('ThematicAdvance').' : '.$description['title'].' - '.$progress;
} else {
echo $description['title'];
}
if ($history) {
echo ' ('.$description['lastedit_date'].') ';
echo ' - '.$progress.' ('.$description['lastedit_date'].') ';
}
echo '</div>';

@ -90,6 +90,14 @@ $(document).ready(function() {
});
});
});
/* toogle for post-it in course home */
$(function() {
$(".thematic-postit-head").click(function() {
$(".thematic-postit-center").slideToggle("normal");
}).$(".thematic-postit-center").hide();
});
</script>';
if (!isset($cidReq)) {

@ -172,7 +172,7 @@ if (!empty($thematic_description)) {
$thematic_advance = '<a href="'.api_get_path(WEB_CODE_PATH).'course_description/index.php?action=edit&'.api_get_cidreq().'&description_type=8'.'">'.get_lang('ThematicAdvance').'&nbsp;'.$course_description->get_progress_porcent(false,8).'</a>';
}
$thematic_description_html = '<td valign="bottom" width="260px"><div class="thematic-postit">
<div class="thematic-postit-top">'.Display::return_icon('postit_top.jpg').'</div>
<div class="thematic-postit-top"><a class="thematic-postit-head" style="" href="#">'.Display::return_icon('postit_top.jpg').'</a></div>
<div class="thematic-postit-center">
<h3>'.$thematic_advance.'</h3>
'.$thematic_description['description_title'].'

@ -1,12 +1,16 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /license.txt */
/**
* This library provides functions for course description tool. It's also used like model to course_description_controller (MVC pattern)
* @package dokeos.library
* This file contains a class used like library provides functions for course description tool. It's also used like model to course_description_controller (MVC pattern)
* @author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.course_description
*/
/**
* CourseDescription can be used to instanciate objects or as a library to manage course descriptions
* @package chamilo.course_description
*/
class CourseDescription
{
private $id;
@ -55,9 +59,9 @@ class CourseDescription
$description_id = $this->get_id_by_description_type($description_type);
$item_property_id = api_get_item_property_id($course_id, TOOL_COURSE_DESCRIPTION, $description_id);
$sql = "SELECT tip.id, tip.course_id, tip.item_property_id, tip.title, tip.content, tip.lastedit_date, tip.session_id FROM $tbl_stats_item_property tip
$sql = "SELECT tip.id, tip.course_id, tip.item_property_id, tip.title, tip.content, tip.progress, tip.lastedit_date, tip.session_id FROM $tbl_stats_item_property tip
INNER JOIN $tbl_item_property ip ON ip.tool = '".TOOL_COURSE_DESCRIPTION."' AND ip.id = tip.item_property_id
WHERE tip.course_id = '$course_id' AND tip.session_id = '".intval($this->session_id)."'";
WHERE tip.course_id = '$course_id' AND tip.session_id = '".intval($this->session_id)."' ORDER BY tip.lastedit_date DESC";
$rs = Database::query($sql, __FILE__, __LINE__);
$data = array();
@ -123,7 +127,7 @@ class CourseDescription
/**
* Insert a row like history inside track_e_item_property table
* first you must set description_type, title, content properties with the object CourseDescription
* first you must set description_type, title, content, progress and session_id properties with the object CourseDescription
* @param int description type
* @return int affected rows
*/
@ -138,6 +142,7 @@ class CourseDescription
item_property_id = '$item_property_id',
title = '".Database::escape_string($this->title)."',
content = '".Database::escape_string($this->content)."',
progress = '".intval($this->progress)."',
lastedit_date = '".date('Y-m-d H:i:s')."',
lastedit_user_id = '".api_get_user_id()."',
session_id = '".intval($this->session_id)."'";

@ -234,6 +234,7 @@ CREATE TABLE track_e_item_property (
item_property_id int NOT NULL,
title varchar(255),
content text,
progress int NOT NULL default 0,
lastedit_date datetime NOT NULL default '0000-00-00 00:00:00',
lastedit_user_id int NOT NULL,
session_id int NOT NULL default 0

@ -25,7 +25,7 @@ ALTER TABLE course DROP PRIMARY KEY , ADD UNIQUE KEY code (code);
ALTER TABLE course ADD id int NOT NULL auto_increment PRIMARY KEY FIRST;
-- xxSTATSxx
CREATE TABLE track_e_item_property(id int NOT NULL auto_increment PRIMARY KEY, course_id int NOT NULL, item_property_id int NOT NULL, title varchar(255), content text, lastedit_date datetime NOT NULL default '0000-00-00 00:00:00', lastedit_user_id int NOT NULL, session_id int NOT NULL default 0);
CREATE TABLE track_e_item_property(id int NOT NULL auto_increment PRIMARY KEY, course_id int NOT NULL, item_property_id int NOT NULL, title varchar(255), content text, progress int NOT NULL default 0, lastedit_date datetime NOT NULL default '0000-00-00 00:00:00', lastedit_user_id int NOT NULL, session_id int NOT NULL default 0);
ALTER TABLE track_e_item_property ADD INDEX (course_id, item_property_id, session_id);
-- xxUSERxx

Loading…
Cancel
Save