Add multiple attachment in agenda see BT#10952

ofaj
Julio 10 years ago
parent aa83c1fe12
commit 10729dea98
  1. 74
      main/calendar/agenda.php
  2. 170
      main/inc/lib/agenda.lib.php
  3. 134
      main/inc/lib/blog.lib.php

@ -57,6 +57,33 @@ function plus_repeated_event() {
</script>
";
$htmlHeadXtra[] = '<script type="text/javascript">
var counter_image = 1;
function add_image_form() {
// Multiple filepaths for image form
var filepaths = document.getElementById("filepaths");
if (document.getElementById("filepath_"+counter_image)) {
counter_image = counter_image + 1;
} else {
counter_image = counter_image;
}
var elem1 = document.createElement("div");
elem1.setAttribute("id","filepath_"+counter_image);
filepaths.appendChild(elem1);
id_elem1 = "filepath_"+counter_image;
id_elem1 = "\'"+id_elem1+"\'";
document.getElementById("filepath_"+counter_image).innerHTML = "<input type=\"file\" name=\"attach_"+counter_image+"\" />&nbsp; <br />'.get_lang('Description').'&nbsp;&nbsp;<input type=\"text\" name=\"legend[]\" /><br /><br />";
if (filepaths.childNodes.length == 6) {
var link_attach = document.getElementById("link-more-attach");
if (link_attach) {
link_attach.innerHTML="";
}
}
}
</script>';
// setting the name of the tool
$nameTools = get_lang('Agenda');
@ -90,8 +117,8 @@ $content = null;
if (api_is_allowed_to_edit(false, true) ||
(api_get_course_setting('allow_user_edit_agenda') &&
!api_is_anonymous() &&
api_is_allowed_to_session_edit(false, true)) ||
!api_is_anonymous() &&
api_is_allowed_to_session_edit(false, true)) ||
GroupManager::user_has_access(api_get_user_id(), $group_id, GroupManager::GROUP_TOOL_CALENDAR) &&
GroupManager::is_tutor_of_group(api_get_user_id(), $group_id)
) {
@ -106,10 +133,9 @@ if (api_is_allowed_to_edit(false, true) ||
$sendEmail = isset($values['add_announcement']) ? true : false;
$allDay = isset($values['all_day']) ? 'true' : 'false';
$sendAttachment = isset($_FILES['user_upload']) ? true : false;
$attachment = $sendAttachment ? $_FILES['user_upload'] : null;
$attachmentComment = isset($values['file_comment']) ? $values['file_comment'] : null;
$sendAttachment = isset($_FILES) && !empty($_FILES) ? true : false;
$attachmentList = $sendAttachment ? $_FILES : null;
$attachmentCommentList = isset($values['legend']) ? $values['legend'] : null;
$comment = isset($values['comment']) ? $values['comment'] : null;
$startDate = $values['date_range_start'];
@ -124,8 +150,8 @@ if (api_is_allowed_to_edit(false, true) ||
$values['users_to_send'],
$sendEmail,
null,
$attachment,
$attachmentComment,
$attachmentList,
$attachmentCommentList,
$comment
);
@ -167,12 +193,14 @@ if (api_is_allowed_to_edit(false, true) ||
$values = $form->getSubmitValues();
$allDay = isset($values['all_day']) ? 'true' : 'false';
$sendEmail = isset($values['add_announcement']) ? true : false;
$startDate = $values['date_range_start'];
$endDate = $values['date_range_end'];
$sendEmail = isset($values['add_announcement']) ? true : false;
$sendAttachment = isset($_FILES['user_upload']) ? true : false;
$attachment = $sendAttachment ? $_FILES['user_upload'] : null;
$attachmentComment = isset($values['file_comment']) ? $values['file_comment'] : null;
$sendAttachment = isset($_FILES) && !empty($_FILES) ? true : false;
$attachmentList = $sendAttachment ? $_FILES : null;
$attachmentCommentList = isset($values['legend']) ? $values['legend'] : null;
$comment = isset($values['comment']) ? $values['comment'] : null;
// This is a sub event. Delete the current and create another BT#7803
@ -189,8 +217,8 @@ if (api_is_allowed_to_edit(false, true) ||
$values['users_to_send'],
false,
null,
$attachment,
$attachmentComment,
$attachmentList,
$attachmentCommentList,
$comment
);
@ -209,8 +237,8 @@ if (api_is_allowed_to_edit(false, true) ||
$values['title'],
$values['content'],
$values['users_to_send'],
$attachment,
$attachmentComment,
$attachmentList,
$attachmentCommentList,
$comment,
'',
$sendEmail
@ -227,13 +255,15 @@ if (api_is_allowed_to_edit(false, true) ||
);
}
$deleteAttachment = isset($values['delete_attachment']) ? true : false;
$deleteAttachmentList = isset($values['delete_attachment']) ? $values['delete_attachment'] : array();
if ($deleteAttachment && isset($event['attachment']) && !empty($event['attachment'])) {
$agenda->deleteAttachmentFile(
$event['attachment']['id'],
$agenda->course
);
if (!empty($deleteAttachmentList)) {
foreach ($deleteAttachmentList as $deleteAttachmentId => $value) {
$agenda->deleteAttachmentFile(
$deleteAttachmentId,
$agenda->course
);
}
}
$message = Display::return_message(get_lang('Updated'), 'confirmation');

@ -48,6 +48,7 @@ class Agenda
$this->event_session_color = '#00496D'; // kind of green
$this->eventOtherSessionColor = '#999';
$this->event_personal_color = 'steel blue'; //steel blue
}
/**
@ -120,8 +121,8 @@ class Agenda
* @param array $usersToSend array('everyone') or a list of user/group ids
* @param bool $addAsAnnouncement event as a *course* announcement
* @param int $parentEventId
* @param array $attachmentArray $_FILES['']
* @param string $attachmentComment
* @param array $attachmentArray array of $_FILES['']
* @param array $attachmentCommentList
* @param string $eventComment
* @param string $color
*
@ -137,8 +138,8 @@ class Agenda
$addAsAnnouncement = false,
$parentEventId = null,
$attachmentArray = array(),
$attachmentComment = '',
$eventComment = '',
$attachmentCommentList = array(),
$eventComment = null,
$color = ''
) {
$start = api_get_utc_datetime($start);
@ -294,12 +295,16 @@ class Agenda
// Add attachment.
if (isset($attachmentArray) && !empty($attachmentArray)) {
$this->addAttachment(
$id,
$attachmentArray,
$attachmentComment,
$this->course
);
$counter = 0;
foreach ($attachmentArray as $attachmentItem) {
$this->addAttachment(
$id,
$attachmentItem,
$attachmentCommentList[$counter],
$this->course
);
$counter++;
}
}
}
break;
@ -555,7 +560,7 @@ class Agenda
* @param string $content
* @param array $usersToSend
* @param array $attachmentArray
* @param string $attachmentComment
* @param array $attachmentCommentList
* @param string $comment
* @param string $color
* @param bool $addAnnouncement
@ -571,8 +576,8 @@ class Agenda
$content,
$usersToSend = array(),
$attachmentArray = array(),
$attachmentComment = '',
$comment = '',
$attachmentCommentList = array(),
$comment = null,
$color = '',
$addAnnouncement = false
) {
@ -781,12 +786,17 @@ class Agenda
// Add attachment.
if (isset($attachmentArray) && !empty($attachmentArray)) {
$this->updateAttachment(
$id,
$attachmentArray,
$attachmentComment,
$this->course
);
$counter = 0;
foreach ($attachmentArray as $attachmentItem) {
$this->updateAttachment(
$attachmentItem['id'],
$id,
$attachmentItem,
$attachmentCommentList[$counter],
$this->course
);
$counter++;
}
}
}
break;
@ -828,10 +838,11 @@ class Agenda
break;
case 'course':
$course_id = api_get_course_int_id();
if (!empty($course_id) && api_is_allowed_to_edit(null, true)) {
// Delete
$eventInfo = $this->get_event($id);
if ($deleteAllItemsFromSerie) {
$eventInfo = $this->get_event($id);
/* This is one of the children.
Getting siblings and delete 'Em all + the father! */
if (isset($eventInfo['parent_event_id']) && !empty($eventInfo['parent_event_id'])) {
@ -874,6 +885,12 @@ class Agenda
$this->table_repeat,
array('cal_id = ? AND c_id = ?' => array($id, $course_id))
);
if (isset($eventInfo['attachment']) && !empty($eventInfo['attachment'])) {
foreach ($eventInfo['attachment'] as $attachment) {
self::deleteAttachmentFile($attachment['id'], $this->course);
}
}
}
break;
case 'admin':
@ -1207,7 +1224,7 @@ class Agenda
$event['parent_info'] = $this->get_event($event['parent_event_id']);
}
$event['attachment'] = $this->getAttachment($id, $this->course);
$event['attachment'] = $this->getAttachmentList($id, $this->course);
}
}
break;
@ -1368,15 +1385,15 @@ class Agenda
if (!empty($courses)) {
foreach ($courses as $course) {
//if (api_is_coach($sessionId, $course['real_id'])) {
$this->getCourseEvents(
$start,
$end,
$course,
0,
$sessionId,
0,
$color
);
$this->getCourseEvents(
$start,
$end,
$course,
0,
$sessionId,
0,
$color
);
//}
}
}
@ -1600,15 +1617,16 @@ class Agenda
);
$group_to_array = $items['groups'];
$user_to_array = $items['users'];
$attachment = $this->getAttachment($row['id'], $courseInfo);
if (!empty($attachment)) {
$has_attachment = Display::return_icon('attachment.gif', get_lang('Attachment'));
$user_filename = $attachment['filename'];
$url = api_get_path(WEB_CODE_PATH).'calendar/download.php?file='.$attachment['path'].'&course_id='.$course_id.'&'.api_get_cidreq();
$event['attachment'] = $has_attachment.Display::url($user_filename, $url);
} else {
$event['attachment'] = '';
$attachmentList = $this->getAttachmentList($row['id'], $courseInfo);
$event['attachment'] = '';
if (!empty($attachmentList)) {
foreach ($attachmentList as $attachment) {
$has_attachment = Display::return_icon('attachment.gif', get_lang('Attachment'));
$user_filename = $attachment['filename'];
$url = api_get_path(WEB_CODE_PATH).'calendar/download.php?file='.$attachment['path'].'&course_id='.$course_id.'&'.api_get_cidreq();
$event['attachment'] .= $has_attachment.Display::url($user_filename, $url).'<br />';
}
}
$event['title'] = $row['title'];
@ -2122,21 +2140,38 @@ class Agenda
if ($this->type == 'course') {
$form->addElement('textarea', 'comment', get_lang('Comment'));
$form->addElement('file', 'user_upload', get_lang('AddAnAttachment'));
if ($showAttachmentForm) {
if (isset($params['attachment']) && !empty($params['attachment'])) {
$attachment = $params['attachment'];
$form->addLabel(
get_lang('FilesAttachment'),
'<span id="filepaths">
<div id="filepath_1">
<input type="file" name="attach_1"/><br />
'.get_lang('Description').'&nbsp;&nbsp;<input type="text" name="legend[]" /><br /><br />
</div>
</span>'
);
$form->addLabel('',
'<span id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">'.get_lang('AddOneMoreFile').'</a></span>&nbsp;('.sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize'))).')');
//if ($showAttachmentForm) {
if (isset($params['attachment']) && !empty($params['attachment'])) {
$attachmentList = $params['attachment'];
foreach ($attachmentList as $attachment) {
$params['file_comment'] = $attachment['comment'];
if (!empty($attachment['path'])) {
$form->addElement(
'checkbox',
'delete_attachment',
'delete_attachment['.$attachment['id'].']',
null,
get_lang('DeleteAttachment').' '.$attachment['filename']
get_lang('DeleteAttachment').': '.$attachment['filename']
);
}
}
}
// }
$form->addElement('textarea', 'file_comment', get_lang('FileComment'));
}
@ -2257,18 +2292,50 @@ class Agenda
* @param array $courseInfo
* @return array with the post info
*/
public function getAttachment($eventId, $courseInfo)
public function getAttachmentList($eventId, $courseInfo)
{
$tableAttachment = Database::get_course_table(TABLE_AGENDA_ATTACHMENT);
$courseId = intval($courseInfo['real_id']);
$eventId = intval($eventId);
$row = array();
$sql = "SELECT id, path, filename, comment
FROM $tableAttachment
WHERE
c_id = $courseId AND
agenda_id = $eventId";
$result = Database::query($sql);
$list = array();
if (Database::num_rows($result) != 0) {
$list = Database::store_result($result, 'ASSOC');
}
return $list;
}
/**
* Show a list with all the attachments according to the post's id
* @param int $attachmentId
* @param int $eventId
* @param array $courseInfo
* @return array with the post info
*/
public function getAttachment($attachmentId, $eventId, $courseInfo)
{
$tableAttachment = Database::get_course_table(TABLE_AGENDA_ATTACHMENT);
$courseId = intval($courseInfo['real_id']);
$eventId = intval($eventId);
$attachmentId = intval($attachmentId);
$row = array();
$sql = "SELECT id, path, filename, comment
FROM $tableAttachment
WHERE
c_id = $courseId AND
agenda_id = $eventId AND
id = $attachmentId
";
$result = Database::query($sql);
if (Database::num_rows($result) != 0) {
$row = Database::fetch_array($result, 'ASSOC');
}
@ -2349,16 +2416,17 @@ class Agenda
}
/**
* @param int $attachmentId
* @param int $eventId
* @param array $fileUserUpload
* @param string $comment
* @param array $courseInfo
*/
public function updateAttachment($eventId, $fileUserUpload, $comment, $courseInfo)
public function updateAttachment($attachmentId, $eventId, $fileUserUpload, $comment, $courseInfo)
{
$attachment = $this->getAttachment($eventId, $courseInfo);
$attachment = $this->getAttachment($attachmentId, $eventId, $courseInfo);
if (!empty($attachment)) {
$this->deleteAttachmentFile($attachment['id'], $courseInfo);
$this->deleteAttachmentFile($attachmentId, $courseInfo);
}
$this->addAttachment($eventId, $fileUserUpload, $comment, $courseInfo);
}
@ -3176,7 +3244,7 @@ class Agenda
if (!empty($agendaitems[$curday])) {
$items = $agendaitems[$curday];
$items = msort($items, 'start_date_tms');
foreach($items as $value) {
$value['title'] = Security::remove_XSS($value['title']);
$start_time = api_format_date($value['start_date'], TIME_NO_SEC_FORMAT);

@ -26,7 +26,6 @@ class Blog
$course_id = api_get_course_int_id();
if (is_numeric($blog_id)) {
// init
$tbl_blogs = Database::get_course_table(TABLE_BLOGS);
$sql = "SELECT blog_name
@ -35,6 +34,7 @@ class Blog
$result = Database::query($sql);
$blog = Database::fetch_array($result);
return stripslashes($blog['blog_name']);
}
}
@ -96,8 +96,8 @@ class Blog
/**
* Creates a new blog in the given course
* @author Toon Keppens
* @param Integer $course_id Id
* @param String $title
* @param int $course_id Id
* @param string $title
* @param Text $description
*/
public static function create_blog($title, $subtitle)
@ -111,7 +111,6 @@ class Blog
$tbl_blogs = Database::get_course_table(TABLE_BLOGS);
$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST);
$tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS);
$tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS);
//verified if exist blog
$sql = 'SELECT COUNT(*) as count FROM '.$tbl_blogs.'
@ -186,9 +185,9 @@ class Blog
/**
* Update title and subtitle of a blog in the given course
* @author Toon Keppens
* @param Integer $course_id Id
* @param String $title
* @param Text $description
* @param int $course_id Id
* @param string $title
* @param string $description
*/
public static function edit_blog($blog_id, $title, $subtitle)
{
@ -238,7 +237,6 @@ class Blog
$tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS);
$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST);
$tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING);
$tbl_blogs_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
$course_id = api_get_course_int_id();
$blog_id = intval($blog_id);
@ -545,7 +543,6 @@ class Blog
*/
public static function create_task($blog_id, $title, $description, $articleDelete, $articleEdit, $commentsDelete, $color)
{
// Init
$tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS);
$tbl_tasks_permissions = Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS);
@ -1395,11 +1392,11 @@ class Blog
echo '<span class="blogpost_title">' . get_lang('TaskList') . '</span><br />';
echo "<table class=\"data_table\">";
echo "<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">",
"<th width='240'><b>",get_lang('Title'),"</b></th>\n",
"<th><b>",get_lang('Description'),"</b></th>\n",
"<th><b>",get_lang('Color'),"</b></th>\n",
"<th width='50'><b>",get_lang('Modify'),"</b></th>\n",
"</tr>\n";
"<th width='240'><b>",get_lang('Title'),"</b></th>",
"<th><b>",get_lang('Description'),"</b></th>",
"<th><b>",get_lang('Color'),"</b></th>",
"<th width='50'><b>",get_lang('Modify'),"</b></th>",
"</tr>";
$sql = " SELECT
@ -1415,29 +1412,29 @@ class Blog
ORDER BY system_task, title";
$result = Database::query($sql);
while($task = Database::fetch_array($result)) {
while ($task = Database::fetch_array($result)) {
$counter++;
$css_class = (($counter % 2) == 0) ? "row_odd" : "row_even";
$delete_icon = ($task['system_task'] == '1') ? "delete_na.gif" : "delete.gif";
$delete_icon = ($task['system_task'] == '1') ? "delete_na.png" : "delete.png";
$delete_title = ($task['system_task'] == '1') ? get_lang('DeleteSystemTask') : get_lang('DeleteTask');
$delete_link = ($task['system_task'] == '1') ? '#' : api_get_self() . '?action=manage_tasks&blog_id=' . $task['blog_id'] . '&do=delete&task_id=' . $task['task_id'];
$delete_confirm = ($task['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"';
echo '<tr class="' . $css_class . '" valign="top">',
'<td width="240">' . Security::remove_XSS($task['title']) . '</td>',
'<td>' . Security::remove_XSS($task['description']) . '</td>',
'<td><span style="background-color: #' . $task['color'] . '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></td>',
'<td width="50">',
'<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $task['blog_id'] . '&do=edit&task_id=' . $task['task_id'] . '">',
'<img src="../img/edit.gif" border="0" title="' . get_lang('EditTask') . '" />',
"</a>\n",
'<a href="' . $delete_link . '"',
$delete_confirm,
'><img src="../img/' . $delete_icon . '" border="0" title="' . $delete_title . '" />',
"</a>\n",
'</td>',
'</tr>';
echo '<tr class="' . $css_class . '" valign="top">';
echo '<td width="240">'.Security::remove_XSS($task['title']).'</td>';
echo '<td>'.Security::remove_XSS($task['description']).'</td>';
echo '<td><span style="background-color: #'.$task['color'].'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></td>';
echo '<td width="50">';
echo '<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$task['blog_id'].'&do=edit&task_id='.$task['task_id'].'">',
echo Display::return_icon('edit.png', get_lang('EditTask'));
echo "</a>";
echo '<a href="'.$delete_link.'"';
echo $delete_confirm;
echo '>';
echo Display::return_icon($delete_icon, $delete_title);
echo "</a>";
echo '</td>';
echo '</tr>';
}
echo "</table>";
}
@ -1461,11 +1458,11 @@ class Blog
echo '<span class="blogpost_title">' . get_lang('AssignedTasks') . '</span><br />';
echo "<table class=\"data_table\">";
echo "<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">",
"<th width='240'><b>",get_lang('Member'),"</b></th>\n",
"<th><b>",get_lang('Task'),"</b></th>\n",
"<th><b>",get_lang('Description'),"</b></th>\n",
"<th><b>",get_lang('TargetDate'),"</b></th>\n",
"<th width='50'><b>",get_lang('Modify'),"</b></th>\n",
"<th width='240'><b>",get_lang('Member'),"</b></th>",
"<th><b>",get_lang('Task'),"</b></th>",
"<th><b>",get_lang('Description'),"</b></th>",
"<th><b>",get_lang('TargetDate'),"</b></th>",
"<th width='50'><b>",get_lang('Modify'),"</b></th>",
"</tr>";
$course_id = api_get_course_int_id();
@ -1484,28 +1481,32 @@ class Blog
while ($assignment = Database::fetch_array($result)) {
$counter++;
$css_class = (($counter % 2)==0) ? "row_odd" : "row_even";
$delete_icon = ($assignment['system_task'] == '1') ? "delete_na.gif" : "delete.gif";
$delete_icon = ($assignment['system_task'] == '1') ? "delete_na.png" : "delete.png";
$delete_title = ($assignment['system_task'] == '1') ? get_lang('DeleteSystemTask') : get_lang('DeleteTask');
$delete_link = ($assignment['system_task'] == '1') ? '#' : api_get_self() . '?action=manage_tasks&blog_id=' . $assignment['blog_id'] . '&do=delete&task_id=' . $assignment['task_id'];
$delete_confirm = ($assignment['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"';
$username = api_htmlentities(sprintf(get_lang('LoginX'), $assignment['username']), ENT_QUOTES);
echo '<tr class="' . $css_class . '" valign="top">',
'<td width="240">' . Display::tag('span', api_get_person_name($assignment['firstname'], $assignment['lastname']), array('title'=>$username)) . '</td>',
'<td>'.stripslashes($assignment['title']) . '</td>',
'<td>'.stripslashes($assignment['description']) . '</td>',
'<td>' . $assignment['target_date'] . '</td>',
'<td width="50">',
'<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $assignment['blog_id'] . '&do=edit_assignment&task_id=' . $assignment['task_id'] . '&user_id=' . $assignment['user_id'] . '">',
'<img src="../img/edit.gif" border="0" title="' . get_lang('EditTask') . '" />',
"</a>\n",
'<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $assignment['blog_id'] . '&do=delete_assignment&task_id=' . $assignment['task_id'] . '&user_id=' . $assignment['user_id'] . '" ',
'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"',
'<img src="../img/' . $delete_icon . '" border="0" title="' . $delete_title . '" />',
"</a>\n",
'</td>',
'</tr>';
echo '<tr class="'.$css_class.'" valign="top">';
echo '<td width="240">'.Display::tag(
'span',
api_get_person_name($assignment['firstname'], $assignment['lastname']),
array('title' => $username)
).'</td>';
echo '<td>'.stripslashes($assignment['title']).'</td>';
echo '<td>'.stripslashes($assignment['description']).'</td>';
echo '<td>'.$assignment['target_date'].'</td>';
echo '<td width="50">';
echo '<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$assignment['blog_id'].'&do=edit_assignment&task_id='.$assignment['task_id'].'&user_id='.$assignment['user_id'].'">',
echo Display::return_icon('edit.png', get_lang('EditTask'));
echo "</a>";
echo '<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$assignment['blog_id'].'&do=delete_assignment&task_id='.$assignment['task_id'].'&user_id='.$assignment['user_id'].'" ';
echo 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;"';
echo Display::return_icon($delete_icon, $delete_title);
echo "</a>";
echo '</td>';
echo '</tr>';
}
echo "</table>";
}
@ -2396,12 +2397,12 @@ class Blog
}
echo '<table id="smallcalendar" class="table table-responsive">',
"<tr id=\"title\">\n",
"<th width=\"10%\"><a href=\"", $backwardsURL, "\">&laquo;</a></th>\n",
"<th align=\"center\" width=\"80%\" colspan=\"5\">", $monthName, " ", $year, "</th>\n",
"<th width=\"10%\" align=\"right\"><a href=\"", $forewardsURL, "\">&raquo;</a></th>\n", "</tr>";
"<tr id=\"title\">",
"<th width=\"10%\"><a href=\"", $backwardsURL, "\">&laquo;</a></th>",
"<th align=\"center\" width=\"80%\" colspan=\"5\">", $monthName, " ", $year, "</th>",
"<th width=\"10%\" align=\"right\"><a href=\"", $forewardsURL, "\">&raquo;</a></th>", "</tr>";
echo "<tr>\n";
echo "<tr>";
for($ii = 1; $ii < 8; $ii ++)
echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>";
@ -2438,8 +2439,9 @@ class Blog
if (isset($tasks[$curday]) && is_array($tasks[$curday])) {
// Add tasks to calendar
foreach ($tasks[$curday] as $task) {
echo '<a href="blog.php?action=execute_task&blog_id=' . $task['blog_id'] . '&task_id='.stripslashes($task['task_id']) . '" title="' . $task['title'] . ' : ' . get_lang('InBlog') . ' : ' . $task['blog_name'] . ' - ' . get_lang('ExecuteThisTask') . '">
<img src="../img/blog_task.gif" alt="Task" title="' . get_lang('ExecuteThisTask') . '" /></a>';
echo '<a href="blog.php?action=execute_task&blog_id=' . $task['blog_id'] . '&task_id='.stripslashes($task['task_id']) . '" title="' . $task['title'] . ' : ' . get_lang('InBlog') . ' : ' . $task['blog_name'] . ' - ' . get_lang('ExecuteThisTask') . '">';
echo Display::return_icon('blog_task.gif', get_lang('ExecuteThisTask'));
echo '</a>';
}
}
}
@ -2527,7 +2529,6 @@ class Blog
//condition for the session
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id, false);
$sql = "SELECT blog_name, blog_subtitle, visibility, blog_id, session_id
FROM $tbl_blogs WHERE c_id = $course_id
@ -2561,27 +2562,22 @@ class Blog
$my_image = '<a href="' .api_get_self(). '?action=edit&blog_id=' . $info_log[3] . '">';
$my_image.= Display::return_icon('edit.png', get_lang('EditBlog'));
$my_image.= "</a>\n";
$my_image.= "</a>";
$my_image.= '<a href="' .api_get_self(). '?action=delete&blog_id=' . $info_log[3] . '" ';
$my_image.= 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;" >';
$my_image.= Display::return_icon('delete.png', get_lang('DeleteBlog'));
$my_image.= "</a>\n";
$my_image.= "</a>";
$my_image.= '<a href="' .api_get_self(). '?action=visibility&blog_id=' . $info_log[3] . '">';
$my_image.= Display::return_icon($visibility_icon . '.gif', get_lang($visibility_info));
$my_image.= "</a>\n";
$my_image.= "</a>";
$list_body_blog[]=$my_image;
$list_content_blog[]=$list_body_blog;
$list_body_blog = array();
}
$parameters='';
//$parameters=array('action'=>Security::remove_XSS($_GET['action']));
$table = new SortableTableFromArrayConfig($list_content_blog, 1,20,'project');
//$table->set_additional_parameters($parameters);
$table->set_header(0, get_lang('Title'));
$table->set_header(1, get_lang('SubTitle'));
$table->set_header(2, get_lang('Modify'));

Loading…
Cancel
Save