|
|
|
@ -1,4 +1,5 @@ |
|
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
/* For licensing terms, see /license.txt */ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -7,12 +8,12 @@ |
|
|
|
|
* @author Carlos Vargas <litox84@gmail.com>, move code of main/notebook up here |
|
|
|
|
* @package chamilo.library |
|
|
|
|
*/ |
|
|
|
|
class NotebookManager { |
|
|
|
|
|
|
|
|
|
class NotebookManager |
|
|
|
|
{ |
|
|
|
|
private function __construct() { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* a little bit of javascript to display a prettier warning when deleting a note |
|
|
|
|
* |
|
|
|
@ -21,8 +22,8 @@ class NotebookManager |
|
|
|
|
* @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\"> |
|
|
|
|
static function javascript_notebook() { |
|
|
|
|
return "<script> |
|
|
|
|
function confirmation (name) |
|
|
|
|
{ |
|
|
|
|
if (confirm(\" " . get_lang("NoteConfirmDelete") . " \"+ name + \" ?\")) |
|
|
|
@ -43,7 +44,7 @@ class NotebookManager |
|
|
|
|
* @version januari 2009, dokeos 1.8.6 |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
function save_note($values) { |
|
|
|
|
static function save_note($values) { |
|
|
|
|
if (!is_array($values) or empty($values['note_title'])) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
@ -74,8 +75,10 @@ class NotebookManager |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function get_note_information($notebook_id) { |
|
|
|
|
if (empty($notebook_id)) { return array(); } |
|
|
|
|
static function get_note_information($notebook_id) { |
|
|
|
|
if (empty($notebook_id)) { |
|
|
|
|
return array(); |
|
|
|
|
} |
|
|
|
|
// Database table definition |
|
|
|
|
$t_notebook = Database :: get_course_table(TABLE_NOTEBOOK); |
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
@ -87,7 +90,9 @@ class NotebookManager |
|
|
|
|
FROM $t_notebook |
|
|
|
|
WHERE c_id = $course_id AND notebook_id = '" . Database::escape_string($notebook_id) . "' "; |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
if (Database::num_rows($result)!=1) { return array(); } |
|
|
|
|
if (Database::num_rows($result) != 1) { |
|
|
|
|
return array(); |
|
|
|
|
} |
|
|
|
|
return Database::fetch_array($result); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -100,7 +105,7 @@ class NotebookManager |
|
|
|
|
* @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium |
|
|
|
|
* @version januari 2009, dokeos 1.8.6 |
|
|
|
|
*/ |
|
|
|
|
function update_note($values) { |
|
|
|
|
static function update_note($values) { |
|
|
|
|
if (!is_array($values) or empty($values['note_title'])) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
@ -127,8 +132,10 @@ class NotebookManager |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function delete_note($notebook_id) { |
|
|
|
|
if (empty($notebook_id) or $notebook_id != strval(intval($notebook_id))) { return false; } |
|
|
|
|
static function delete_note($notebook_id) { |
|
|
|
|
if (empty($notebook_id) or $notebook_id != strval(intval($notebook_id))) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
// Database table definition |
|
|
|
|
$t_notebook = Database :: get_course_table(TABLE_NOTEBOOK); |
|
|
|
|
|
|
|
|
@ -145,7 +152,7 @@ class NotebookManager |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function display_notes() { |
|
|
|
|
static function display_notes() { |
|
|
|
|
|
|
|
|
|
global $_user; |
|
|
|
|
if (!$_GET['direction']) { |
|
|
|
@ -159,22 +166,18 @@ class NotebookManager |
|
|
|
|
$link_sort_direction = 'ASC'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// action links |
|
|
|
|
echo '<div class="actions" style="margin-bottom:20px">'; |
|
|
|
|
//if (api_is_allowed_to_edit()) |
|
|
|
|
//{ |
|
|
|
|
echo '<div class="actions">'; |
|
|
|
|
if (!api_is_anonymous()) { |
|
|
|
|
if (api_get_session_id() == 0) |
|
|
|
|
echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' . Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>'; |
|
|
|
|
elseif (api_is_allowed_to_session_edit(false, true)) { |
|
|
|
|
echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' . Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
echo '<a href="javascript:void(0)">' . Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>'; |
|
|
|
|
} |
|
|
|
|
//} |
|
|
|
|
|
|
|
|
|
echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=creation_date&direction=' . $link_sort_direction . '">' . Display::return_icon('notes_order_by_date_new.png', get_lang('OrderByCreationDate'), '', '32') . '</a>'; |
|
|
|
|
echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=update_date&direction=' . $link_sort_direction . '">' . Display::return_icon('notes_order_by_date_mod.png', get_lang('OrderByModificationDate'), '', '32') . '</a>'; |
|
|
|
|
echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=title&direction=' . $link_sort_direction . '">' . Display::return_icon('notes_order_by_title.png', get_lang('OrderByTitle'), '', '32') . '</a>'; |
|
|
|
@ -221,6 +224,5 @@ class NotebookManager |
|
|
|
|
echo '<a href="' . api_get_self() . '?action=deletenote&notebook_id=' . $row['notebook_id'] . '" onclick="return confirmation(\'' . $row['title'] . '\');">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>'; |
|
|
|
|
echo '</div>'; |
|
|
|
|
} |
|
|
|
|
//return $return; |
|
|
|
|
} |
|
|
|
|
} |