From e29a3266c467153af03819cb42576c42c973ab3e Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 16 Aug 2013 11:14:14 +0200 Subject: [PATCH] Adding missing works + reminder. --- main/work/work.lib.php | 28 +-------- main/work/work.php | 14 +---- main/work/work_list_all.php | 58 ++++++++++------- main/work/work_missing.php | 122 ++++++++++++++++++++++++++++++++++++ 4 files changed, 161 insertions(+), 61 deletions(-) create mode 100644 main/work/work_missing.php diff --git a/main/work/work.lib.php b/main/work/work.lib.php index 7d42a4fc54..e61e2b89ca 100644 --- a/main/work/work.lib.php +++ b/main/work/work.lib.php @@ -64,30 +64,6 @@ function display_action_links($id, $cur_dir_path, $show_tool_options, $display_u } } - if (api_is_allowed_to_edit(null, true)) { - global $token; - - if (!empty($id)) { - if (empty($_GET['list']) or Security::remove_XSS($_GET['list']) == 'with') { - $display_output .= ''. - Display::return_icon('exercice_uncheck.png', get_lang('ViewUsersWithoutTask'),'',ICON_SIZE_MEDIUM)."\n"; - $count = get_count_work($id); - if ($count > 0) { - $display_output .= ''.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'), ICON_SIZE_MEDIUM).''; - } - } else { - $display_output .= ''. - Display::return_icon('exercice_check.png', get_lang('ViewUsersWithTask'),'',ICON_SIZE_MEDIUM)."\n"; - $display_output .= ''.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'), ICON_SIZE_MEDIUM).''; - if (!isset($_GET['action']) || (isset($_GET['action']) && $_GET['action'] != 'send_mail')) { - $display_output .= ''. - Display::return_icon('mail_send.png', get_lang('ReminderMessage'),'',ICON_SIZE_MEDIUM).""; - } else { - $display_output .= Display::return_icon('mail_send_na.png', get_lang('ReminderMessage'),'',ICON_SIZE_MEDIUM); - } - } - } - } if ($display_output != '') { echo '
'; @@ -1897,10 +1873,12 @@ function get_work_user_list($start, $limit, $column, $direction, $work_id, $wher * @return array * @author cvargas carlos.vargas@beeznest.com cfasanando, christian.fasanado@beeznest.com */ -function send_reminder_users_without_publication($task_data) { +function send_reminder_users_without_publication($task_data) +{ global $_course; $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); + $task_id = $task_data['id']; $task_title = !empty($task_data['title']) ? $task_data['title'] : basename($task_data['url']); diff --git a/main/work/work.php b/main/work/work.php index ad9e51f922..ac51688135 100644 --- a/main/work/work.php +++ b/main/work/work.php @@ -311,17 +311,6 @@ echo $message; //for teachers switch ($action) { - case 'send_mail': - if (Security::check_token('get')) { - $mails_sent_to = send_reminder_users_without_publication($my_folder_data); - if (empty($mails_sent_to)) { - Display::display_warning_message(get_lang('NoResults')); - } else { - Display::display_confirmation_message(get_lang('MessageHasBeenSent').' '.implode(', ', $mails_sent_to)); - } - Security::clear_token(); - } - break; case 'settings': //if posts if ($is_allowed_to_edit && !empty($_POST['changeProperties'])) { @@ -754,8 +743,7 @@ switch ($action) { if (isset($work_id) && !empty($work_id) && !$display_list_users_without_publication) { } elseif (isset($_GET['list']) && $_GET['list'] == 'without') { - //User with no works - display_list_users_without_publication($work_id); + } else { $my_folder_data = get_work_data_by_id($work_id); diff --git a/main/work/work_list_all.php b/main/work/work_list_all.php index a0ff7fb19a..a5a29c899d 100644 --- a/main/work/work_list_all.php +++ b/main/work/work_list_all.php @@ -36,10 +36,8 @@ if (!api_is_allowed_to_edit()) { $tool_name = get_lang('StudentPublications'); $group_id = api_get_group_id(); $courseInfo = api_get_course_info(); - $htmlHeadXtra[] = api_get_jqgrid_js(); - if (!empty($group_id)) { $group_properties = GroupManager :: get_group_properties($group_id); $show_work = false; @@ -62,6 +60,8 @@ if (!empty($group_id)) { $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications')); $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work_list_all.php?'.api_get_cidreq().'&id='.$workId, 'name' => $my_folder_data['title']); +$error_message = null; + Display :: display_header(null); echo ''; -$error_message = isset($_GET['error_message']) ? Security::remove_XSS($_GET['error_message']) : null; +if (empty($error_message)) { + $error_message = isset($_GET['error_message']) ? Security::remove_XSS($_GET['error_message']) : null; +} if (!empty($error_message)) { echo $error_message; } @@ -84,31 +95,31 @@ if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) $type = 'simple'; $columns = array(get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('LoginName'), get_lang('Title'), get_lang('Qualification'), get_lang('Date'), get_lang('Status'), get_lang('Actions')); $column_model = array ( - array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false'), - array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), - array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), - array('name'=>'username', 'index'=>'username', 'width'=>'30', 'align'=>'left', 'search' => 'true'), - array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'), - // array('name'=>'file', 'index'=>'file', 'width'=>'20', 'align'=>'left', 'search' => 'false'), - array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'), - array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true'), - array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'), - array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false') + array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false'), + array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), + array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), + array('name'=>'username', 'index'=>'username', 'width'=>'30', 'align'=>'left', 'search' => 'true'), + array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'), + // array('name'=>'file', 'index'=>'file', 'width'=>'20', 'align'=>'left', 'search' => 'false'), + array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'), + array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true'), + array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'), + array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false') ); } else { $type = 'complex'; $columns = array(get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('LoginName'), get_lang('Title'), get_lang('Date'), get_lang('Actions')); $column_model = array ( - array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false'), - array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), - array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), - array('name'=>'username', 'index'=>'username', 'width'=>'30', 'align'=>'left', 'search' => 'true'), - array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"), - // array('name'=>'file', 'index'=>'file', 'width'=>'20', 'align'=>'left', 'search' => 'false'), - //array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'), - array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true'), - //array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'), - array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false') + array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false'), + array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), + array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'), + array('name'=>'username', 'index'=>'username', 'width'=>'30', 'align'=>'left', 'search' => 'true'), + array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"), + // array('name'=>'file', 'index'=>'file', 'width'=>'20', 'align'=>'left', 'search' => 'false'), + //array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'), + array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true'), + //array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'), + array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false') ); } @@ -134,6 +145,7 @@ $(function() { }); '../group/group.php', 'name' => get_lang('Groups')); + $interbreadcrumb[] = array ('url' => '../group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace').' '.$group_properties['name']); +} + +$interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications')); +$interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work_list_all.php?'.api_get_cidreq().'&id='.$workId, 'name' => $my_folder_data['title']); + +if (isset($_GET['list']) && $_GET['list'] == 'with') { + $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('UsersWithTask')); +} else { + $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('UsersWithoutTask')); +} + + +Display :: display_header(null); + +echo '
'; +echo ''.Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).''; + +if (!empty($workId)) { + if (empty($_GET['list']) or Security::remove_XSS($_GET['list']) == 'with') { + $display_output .= ''. + Display::return_icon('exercice_uncheck.png', get_lang('ViewUsersWithoutTask'),'',ICON_SIZE_MEDIUM).""; + } else { + $display_output .= ''. + Display::return_icon('exercice_check.png', get_lang('ViewUsersWithTask'),'',ICON_SIZE_MEDIUM).""; + + + if (!isset($_GET['action']) || (isset($_GET['action']) && $_GET['action'] != 'send_mail')) { + $display_output .= ''. + Display::return_icon('mail_send.png', get_lang('ReminderMessage'),'',ICON_SIZE_MEDIUM).""; + } else { + $display_output .= Display::return_icon('mail_send_na.png', get_lang('ReminderMessage'),'',ICON_SIZE_MEDIUM); + } + } +} + +echo $display_output; +echo '
'; + +if (empty($error_message)) { + $error_message = isset($_GET['error_message']) ? Security::remove_XSS($_GET['error_message']) : null; +} +if (!empty($error_message)) { + echo $error_message; +} + +display_list_users_without_publication($workId);