Fixing advmultiselect form icons see BT#5768

skala
Julio Montoya 13 years ago
parent 4ac57a8df5
commit bd19ed2d8e
  1. 440
      main/group/group_edit.php
  2. 39
      main/inc/lib/pear/HTML/QuickForm/advanced_settings.php
  3. 789
      main/inc/lib/pear/HTML/QuickForm/advmultiselect.php
  4. 48
      main/inc/lib/pear/HTML/QuickForm/label.php
  5. 235
      main/survey/survey_invite.php

@ -2,13 +2,13 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This script displays an area where teachers can edit the group properties and member list. * This script displays an area where teachers can edit the group properties and member list.
* Groups are also often called "teams" in the Dokeos code. * Groups are also often called "teams" in the Dokeos code.
* *
* @author various contributors * @author various contributors
* @author Roan Embrechts (VUB), partial code cleanup, initial virtual course support * @author Roan Embrechts (VUB), partial code cleanup, initial virtual course support
* @package chamilo.group * @package chamilo.group
* @todo course admin functionality to create groups based on who is in which course (or class). * @todo course admin functionality to create groups based on who is in which course (or class).
*/ */
/* INIT SECTION */ /* INIT SECTION */
@ -18,7 +18,7 @@ $language_file = 'group';
require '../inc/global.inc.php'; require '../inc/global.inc.php';
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
$current_course_tool = TOOL_GROUP; $current_course_tool = TOOL_GROUP;
// Notice for unauthorized people. // Notice for unauthorized people.
api_protect_course_script(true); api_protect_course_script(true);
@ -27,13 +27,13 @@ $group_id = api_get_group_id();
$current_group = GroupManager :: get_group_properties($group_id); $current_group = GroupManager :: get_group_properties($group_id);
$nameTools = get_lang('EditGroup'); $nameTools = get_lang('EditGroup');
$interbreadcrumb[] = array ('url' => 'group.php', 'name' => get_lang('Groups')); $interbreadcrumb[] = array('url' => 'group.php', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array ('url' => 'group_space.php?'.api_get_cidReq(), 'name' => $current_group['name']); $interbreadcrumb[] = array('url' => 'group_space.php?'.api_get_cidReq(), 'name' => $current_group['name']);
$is_group_member = GroupManager :: is_tutor_of_group(api_get_user_id(), $group_id); $is_group_member = GroupManager :: is_tutor_of_group(api_get_user_id(), $group_id);
if (!api_is_allowed_to_edit(false,true) && !$is_group_member) { if (!api_is_allowed_to_edit(false, true) && !$is_group_member) {
api_not_allowed(true); api_not_allowed(true);
} }
/* FUNCTIONS */ /* FUNCTIONS */
@ -41,69 +41,80 @@ if (!api_is_allowed_to_edit(false,true) && !$is_group_member) {
/** /**
* List all users registered to the course * List all users registered to the course
*/ */
function search_members_keyword($firstname, $lastname, $username, $official_code, $keyword) { function search_members_keyword($firstname, $lastname, $username, $official_code, $keyword)
if (api_strripos($firstname, $keyword) !== false || api_strripos($lastname, $keyword) !== false || api_strripos($username, $keyword) !== false || api_strripos($official_code, $keyword) !== false) { {
return true; if (api_strripos($firstname, $keyword) !== false || api_strripos($lastname, $keyword) !== false || api_strripos(
} else { $username,
return false; $keyword
} ) !== false || api_strripos($official_code, $keyword) !== false
) {
return true;
} else {
return false;
}
} }
/** /**
* function to sort users after getting the list in the db. Necessary because there are 2 or 3 queries. Called by usort() * function to sort users after getting the list in the db. Necessary because there are 2 or 3 queries. Called by usort()
*/ */
function sort_users($user_a, $user_b) { function sort_users($user_a, $user_b)
if (api_sort_by_first_name()) { {
$cmp = api_strcmp($user_a['firstname'], $user_b['firstname']); if (api_sort_by_first_name()) {
if ($cmp !== 0) { $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
return $cmp; if ($cmp !== 0) {
} else { return $cmp;
$cmp = api_strcmp($user_a['lastname'], $user_b['lastname']); } else {
if ($cmp !== 0) { $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
return $cmp; if ($cmp !== 0) {
} else { return $cmp;
return api_strcmp($user_a['username'], $user_b['username']); } else {
} return api_strcmp($user_a['username'], $user_b['username']);
} }
} else { }
$cmp = api_strcmp($user_a['lastname'], $user_b['lastname']); } else {
if ($cmp !== 0) { $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
return $cmp; if ($cmp !== 0) {
} else { return $cmp;
$cmp = api_strcmp($user_a['firstname'], $user_b['firstname']); } else {
if ($cmp !== 0) { $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
return $cmp; if ($cmp !== 0) {
} else { return $cmp;
return api_strcmp($user_a['username'], $user_b['username']); } else {
} return api_strcmp($user_a['username'], $user_b['username']);
} }
} }
}
} }
/** /**
* Function to check the given max number of members per group * Function to check the given max number of members per group
*/ */
function check_max_number_of_members($value) { function check_max_number_of_members($value)
$max_member_no_limit = $value['max_member_no_limit']; {
if ($max_member_no_limit == GroupManager::MEMBER_PER_GROUP_NO_LIMIT) { $max_member_no_limit = $value['max_member_no_limit'];
return true; if ($max_member_no_limit == GroupManager::MEMBER_PER_GROUP_NO_LIMIT) {
} return true;
$max_member = $value['max_member']; }
return is_numeric($max_member); $max_member = $value['max_member'];
return is_numeric($max_member);
} }
/** /**
* Function to check if the number of selected group members is valid * Function to check if the number of selected group members is valid
*/ */
function check_group_members($value) { function check_group_members($value)
if ($value['max_member_no_limit'] == GroupManager::MEMBER_PER_GROUP_NO_LIMIT) { {
return true; if ($value['max_member_no_limit'] == GroupManager::MEMBER_PER_GROUP_NO_LIMIT) {
} return true;
if (isset($value['max_member']) && isset($value['group_members']) && $value['max_member'] < count($value['group_members'])) { }
return array ('group_members' => get_lang('GroupTooMuchMembers')); if (isset($value['max_member']) && isset($value['group_members']) && $value['max_member'] < count(
} $value['group_members']
return true; )
) {
return array('group_members' => get_lang('GroupTooMuchMembers'));
}
return true;
} }
/* MAIN CODE */ /* MAIN CODE */
@ -127,14 +138,17 @@ $form->addElement('hidden', 'referer');
$form->add_textfield('name', get_lang('GroupName')); $form->add_textfield('name', get_lang('GroupName'));
// Description // Description
$form->addElement('textarea', 'description', get_lang('Description'), array ('class' => 'span6', 'rows' => 6)); $form->addElement('textarea', 'description', get_lang('Description'), array('class' => 'span6', 'rows' => 6));
$complete_user_list = GroupManager :: fill_groups_list($current_group['id']); $complete_user_list = GroupManager :: fill_groups_list($current_group['id']);
usort($complete_user_list, 'sort_users'); usort($complete_user_list, 'sort_users');
$possible_users = array(); $possible_users = array();
foreach ($complete_user_list as $index => $user) { foreach ($complete_user_list as $index => $user) {
$possible_users[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; $possible_users[$user['user_id']] = api_get_person_name(
$user['firstname'],
$user['lastname']
).' ('.$user['username'].')';
} }
// Group tutors // Group tutors
@ -145,27 +159,14 @@ foreach ($group_tutor_list as $index => $user) {
$selected_tutors[] = $user['user_id']; $selected_tutors[] = $user['user_id'];
} }
$group_tutors_element = $form->addElement('advmultiselect', 'group_tutors', get_lang('GroupTutors'), $possible_users, 'style="width: 280px;"'); $group_tutors_element = $form->addElement('advmultiselect', 'group_tutors', get_lang('GroupTutors'), $possible_users);
$group_tutors_element->setElementTemplate(' $group_tutors_element->setButtonAttributes('add');
{javascript} $group_tutors_element->setButtonAttributes('remove');
<table{class}>
<!-- BEGIN label_2 --><tr><th>{label_2}</th><!-- END label_2 -->
<!-- BEGIN label_3 --><th>&nbsp;</th><th>{label_3}</th></tr><!-- END label_3 -->
<tr>
<td valign="top">{unselected}</td>
<td align="center">{add}<br /><br />{remove}</td>
<td valign="top">{selected}</td>
</tr>
</table>
');
$group_tutors_element->setButtonAttributes('add', array('class' => 'btn arrowr'));
$group_tutors_element->setButtonAttributes('remove', array('class' => 'btn arrowl'));
// Group members // Group members
$group_member_list = GroupManager :: get_subscribed_users($current_group['id']); $group_member_list = GroupManager :: get_subscribed_users($current_group['id']);
$selected_users = array (); $selected_users = array();
foreach ($group_member_list as $index => $user) { foreach ($group_member_list as $index => $user) {
$selected_users[] = $user['user_id']; $selected_users[] = $user['user_id'];
} }
@ -173,33 +174,41 @@ foreach ($group_member_list as $index => $user) {
// possible : number_groups_left > 0 and is group member // possible : number_groups_left > 0 and is group member
$possible_users = array(); $possible_users = array();
foreach ($complete_user_list as $index => $user) { foreach ($complete_user_list as $index => $user) {
if ($user['number_groups_left'] > 0 || in_array($user['user_id'], $selected_users) ) { if ($user['number_groups_left'] > 0 || in_array($user['user_id'], $selected_users)) {
$possible_users[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; $possible_users[$user['user_id']] = api_get_person_name(
} $user['firstname'],
$user['lastname']
).' ('.$user['username'].')';
}
} }
$group_members_element = $form->addElement('advmultiselect', 'group_members', get_lang('GroupMembers'), $possible_users, 'style="width: 280px;"'); $group_members_element = $form->addElement(
'advmultiselect',
$group_members_element->setElementTemplate(' 'group_members',
{javascript} get_lang('GroupMembers'),
<table{class}> $possible_users
<!-- BEGIN label_2 --><tr><th>{label_2}</th><!-- END label_2 --> );
<!-- BEGIN label_3 --><th>&nbsp;</th><th>{label_3}</th></tr><!-- END label_3 --> $group_members_element->setButtonAttributes('add');
<tr> $group_members_element->setButtonAttributes('remove');
<td valign="top">{unselected}</td>
<td align="center">{add}<br /><br />{remove}</td>
<td valign="top">{selected}</td>
</tr>
</table>');
$group_members_element->setButtonAttributes('add', array('class' => 'btn arrowr'));
$group_members_element->setButtonAttributes('remove', array('class' => 'btn arrowl'));
$form->addFormRule('check_group_members'); $form->addFormRule('check_group_members');
// Members per group // Members per group
$form->addElement('radio', 'max_member_no_limit', get_lang('GroupLimit'), get_lang('NoLimit'), GroupManager::MEMBER_PER_GROUP_NO_LIMIT); $form->addElement(
'radio',
'max_member_no_limit',
get_lang('GroupLimit'),
get_lang('NoLimit'),
GroupManager::MEMBER_PER_GROUP_NO_LIMIT
);
$group = array(); $group = array();
$group[] = $form->createElement('radio', 'max_member_no_limit', null, get_lang('MaximumOfParticipants'), 1, array('id' => 'max_member_selected')); $group[] = $form->createElement(
'radio',
'max_member_no_limit',
null,
get_lang('MaximumOfParticipants'),
1,
array('id' => 'max_member_selected')
);
$group[] = $form->createElement('text', 'max_member', null, array('class' => 'span1', 'id' => 'max_member')); $group[] = $form->createElement('text', 'max_member', null, array('class' => 'span1', 'id' => 'max_member'));
$group[] = $form->createElement('static', null, null, get_lang('GroupPlacesThis')); $group[] = $form->createElement('static', null, null, get_lang('GroupPlacesThis'));
$form->addGroup($group, 'max_member_group', null, '', false); $form->addGroup($group, 'max_member_group', null, '', false);
@ -207,91 +216,226 @@ $form->addRule('max_member_group', get_lang('InvalidMaxNumberOfMembers'), 'callb
// Self registration // Self registration
$group = array(); $group = array();
$group[] = $form->createElement('checkbox', 'self_registration_allowed', get_lang('GroupSelfRegistration'), get_lang('GroupAllowStudentRegistration'), 1); $group[] = $form->createElement(
$group[] = $form->createElement('checkbox', 'self_unregistration_allowed', null, get_lang('GroupAllowStudentUnregistration'), 1); 'checkbox',
$form->addGroup($group, '', Display::return_icon('user.png', get_lang('GroupSelfRegistration') , array(), ICON_SIZE_SMALL).' '.get_lang('GroupSelfRegistration'), '', false); 'self_registration_allowed',
get_lang('GroupSelfRegistration'),
get_lang('GroupAllowStudentRegistration'),
1
);
$group[] = $form->createElement(
'checkbox',
'self_unregistration_allowed',
null,
get_lang('GroupAllowStudentUnregistration'),
1
);
$form->addGroup(
$group,
'',
Display::return_icon('user.png', get_lang('GroupSelfRegistration'), array(), ICON_SIZE_SMALL).' '.get_lang(
'GroupSelfRegistration'
),
'',
false
);
// Documents settings // Documents settings
$group = array(); $group = array();
$group[] = $form->createElement('radio', 'doc_state', get_lang('GroupDocument'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE); $group[] = $form->createElement(
'radio',
'doc_state',
get_lang('GroupDocument'),
get_lang('NotAvailable'),
GroupManager::TOOL_NOT_AVAILABLE
);
$group[] = $form->createElement('radio', 'doc_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC); $group[] = $form->createElement('radio', 'doc_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC);
$group[] = $form->createElement('radio', 'doc_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE); $group[] = $form->createElement('radio', 'doc_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE);
$form->addGroup($group, '', Display::return_icon('folder.png', get_lang('GroupDocument') , array(), ICON_SIZE_SMALL).' '.get_lang('GroupDocument'), '', false); $form->addGroup(
$group,
'',
Display::return_icon('folder.png', get_lang('GroupDocument'), array(), ICON_SIZE_SMALL).' '.get_lang(
'GroupDocument'
),
'',
false
);
// Work settings // Work settings
$group = array(); $group = array();
$group[] = $form->createElement('radio', 'work_state', get_lang('GroupWork'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE); $group[] = $form->createElement(
'radio',
'work_state',
get_lang('GroupWork'),
get_lang('NotAvailable'),
GroupManager::TOOL_NOT_AVAILABLE
);
$group[] = $form->createElement('radio', 'work_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC); $group[] = $form->createElement('radio', 'work_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC);
$group[] = $form->createElement('radio', 'work_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE); $group[] = $form->createElement('radio', 'work_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE);
$form->addGroup($group, '', Display::return_icon('work.png', get_lang('GroupWork') , array(), ICON_SIZE_SMALL).' '.get_lang('GroupWork'), '', false); $form->addGroup(
$group,
'',
Display::return_icon('work.png', get_lang('GroupWork'), array(), ICON_SIZE_SMALL).' '.get_lang('GroupWork'),
'',
false
);
// Calendar settings // Calendar settings
$group = array(); $group = array();
$group[] = $form->createElement('radio', 'calendar_state', get_lang('GroupCalendar'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE); $group[] = $form->createElement(
'radio',
'calendar_state',
get_lang('GroupCalendar'),
get_lang('NotAvailable'),
GroupManager::TOOL_NOT_AVAILABLE
);
$group[] = $form->createElement('radio', 'calendar_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC); $group[] = $form->createElement('radio', 'calendar_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC);
$group[] = $form->createElement('radio', 'calendar_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE); $group[] = $form->createElement('radio', 'calendar_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE);
$form->addGroup($group, '', Display::return_icon('agenda.png', get_lang('GroupCalendar') , array(), ICON_SIZE_SMALL).' '.get_lang('GroupCalendar'), '', false); $form->addGroup(
$group,
'',
Display::return_icon('agenda.png', get_lang('GroupCalendar'), array(), ICON_SIZE_SMALL).' '.get_lang(
'GroupCalendar'
),
'',
false
);
// Announcements settings // Announcements settings
$group = array(); $group = array();
$group[] = $form->createElement('radio', 'announcements_state', get_lang('GroupAnnouncements'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE); $group[] = $form->createElement(
'radio',
'announcements_state',
get_lang('GroupAnnouncements'),
get_lang('NotAvailable'),
GroupManager::TOOL_NOT_AVAILABLE
);
$group[] = $form->createElement('radio', 'announcements_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC); $group[] = $form->createElement('radio', 'announcements_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC);
$group[] = $form->createElement('radio', 'announcements_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE); $group[] = $form->createElement('radio', 'announcements_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE);
$form->addGroup($group, '', Display::return_icon('announce.png', get_lang('GroupAnnouncements') , array(), ICON_SIZE_SMALL).' '.get_lang('GroupAnnouncements'), '', false); $form->addGroup(
$group,
'',
Display::return_icon('announce.png', get_lang('GroupAnnouncements'), array(), ICON_SIZE_SMALL).' '.get_lang(
'GroupAnnouncements'
),
'',
false
);
//Forum settings //Forum settings
$group = array(); $group = array();
$group[] = $form->createElement('radio', 'forum_state', get_lang('GroupForum'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE); $group[] = $form->createElement(
'radio',
'forum_state',
get_lang('GroupForum'),
get_lang('NotAvailable'),
GroupManager::TOOL_NOT_AVAILABLE
);
$group[] = $form->createElement('radio', 'forum_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC); $group[] = $form->createElement('radio', 'forum_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC);
$group[] = $form->createElement('radio', 'forum_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE); $group[] = $form->createElement('radio', 'forum_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE);
$form->addGroup($group, '', Display::return_icon('forum.png', get_lang('GroupForum') , array(), ICON_SIZE_SMALL).' '.get_lang('GroupForum'), '', false); $form->addGroup(
$group,
'',
Display::return_icon('forum.png', get_lang('GroupForum'), array(), ICON_SIZE_SMALL).' '.get_lang('GroupForum'),
'',
false
);
// Wiki settings // Wiki settings
$group = array(); $group = array();
$group[] = $form->createElement('radio', 'wiki_state', get_lang('GroupWiki'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE); $group[] = $form->createElement(
'radio',
'wiki_state',
get_lang('GroupWiki'),
get_lang('NotAvailable'),
GroupManager::TOOL_NOT_AVAILABLE
);
$group[] = $form->createElement('radio', 'wiki_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC); $group[] = $form->createElement('radio', 'wiki_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC);
$group[] = $form->createElement('radio', 'wiki_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE); $group[] = $form->createElement('radio', 'wiki_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE);
$form->addGroup($group, '', Display::return_icon('wiki.png', get_lang('GroupWiki') , array(), ICON_SIZE_SMALL).' '.get_lang('GroupWiki'), '', false); $form->addGroup(
$group,
'',
Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), ICON_SIZE_SMALL).' '.get_lang('GroupWiki'),
'',
false
);
// Chat settings // Chat settings
$group = array(); $group = array();
$group[] = $form->createElement('radio', 'chat_state', get_lang('Chat'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE); $group[] = $form->createElement(
'radio',
'chat_state',
get_lang('Chat'),
get_lang('NotAvailable'),
GroupManager::TOOL_NOT_AVAILABLE
);
$group[] = $form->createElement('radio', 'chat_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC); $group[] = $form->createElement('radio', 'chat_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC);
$group[] = $form->createElement('radio', 'chat_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE); $group[] = $form->createElement('radio', 'chat_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE);
$form->addGroup($group, '', Display::return_icon('chat.png', get_lang('Chat') , array(), ICON_SIZE_SMALL).' '.get_lang('Chat'), '', false); $form->addGroup(
$group,
'',
Display::return_icon('chat.png', get_lang('Chat'), array(), ICON_SIZE_SMALL).' '.get_lang('Chat'),
'',
false
);
// submit button // submit button
$form->addElement('style_submit_button', 'submit', get_lang('PropModify'), 'class="save"'); $form->addElement('style_submit_button', 'submit', get_lang('PropModify'), 'class="save"');
if ($form->validate()) { if ($form->validate()) {
$values = $form->exportValues(); $values = $form->exportValues();
if ($values['max_member_no_limit'] == GroupManager::MEMBER_PER_GROUP_NO_LIMIT) { if ($values['max_member_no_limit'] == GroupManager::MEMBER_PER_GROUP_NO_LIMIT) {
$max_member = GroupManager::MEMBER_PER_GROUP_NO_LIMIT; $max_member = GroupManager::MEMBER_PER_GROUP_NO_LIMIT;
} else { } else {
$max_member = $values['max_member']; $max_member = $values['max_member'];
} }
$self_registration_allowed = isset($values['self_registration_allowed']) ? 1 : 0; $self_registration_allowed = isset($values['self_registration_allowed']) ? 1 : 0;
$self_unregistration_allowed = isset($values['self_unregistration_allowed']) ? 1 : 0; $self_unregistration_allowed = isset($values['self_unregistration_allowed']) ? 1 : 0;
GroupManager :: set_group_properties($current_group['id'], strip_tags($values['name']), strip_tags($values['description']), $max_member, $values['doc_state'], $values['work_state'], $values['calendar_state'], $values['announcements_state'], $values['forum_state'], $values['wiki_state'], $values['chat_state'], $self_registration_allowed, $self_unregistration_allowed); GroupManager :: set_group_properties(
$current_group['id'],
// Storing the tutors (we first remove all the tutors and then add only those who were selected) strip_tags($values['name']),
GroupManager :: unsubscribe_all_tutors($current_group['id']); strip_tags($values['description']),
if (isset ($_POST['group_tutors']) && count($_POST['group_tutors']) > 0) { $max_member,
GroupManager :: subscribe_tutors($values['group_tutors'], $current_group['id']); $values['doc_state'],
} $values['work_state'],
$values['calendar_state'],
// Storing the users (we first remove all users and then add only those who were selected) $values['announcements_state'],
GroupManager :: unsubscribe_all_users($current_group['id']); $values['forum_state'],
if (isset ($_POST['group_members']) && count($_POST['group_members']) > 0) { $values['wiki_state'],
GroupManager :: subscribe_users($values['group_members'], $current_group['id']); $values['chat_state'],
} $self_registration_allowed,
$self_unregistration_allowed
// Returning to the group area (note: this is inconsistent with the rest of chamilo) );
$cat = GroupManager :: get_category_from_group($current_group['id']);
if (isset($_POST['group_members']) && count($_POST['group_members']) > $max_member && $max_member != GroupManager::MEMBER_PER_GROUP_NO_LIMIT) { // Storing the tutors (we first remove all the tutors and then add only those who were selected)
header('Location: group.php?'.api_get_cidreq(true, false).'&action=warning_message&msg='.get_lang('GroupTooMuchMembers')); GroupManager :: unsubscribe_all_tutors($current_group['id']);
if (isset ($_POST['group_tutors']) && count($_POST['group_tutors']) > 0) {
GroupManager :: subscribe_tutors($values['group_tutors'], $current_group['id']);
}
// Storing the users (we first remove all users and then add only those who were selected)
GroupManager :: unsubscribe_all_users($current_group['id']);
if (isset ($_POST['group_members']) && count($_POST['group_members']) > 0) {
GroupManager :: subscribe_users($values['group_members'], $current_group['id']);
}
// Returning to the group area (note: this is inconsistent with the rest of chamilo)
$cat = GroupManager :: get_category_from_group($current_group['id']);
if (isset($_POST['group_members']) && count(
$_POST['group_members']
) > $max_member && $max_member != GroupManager::MEMBER_PER_GROUP_NO_LIMIT
) {
header(
'Location: group.php?'.api_get_cidreq(true, false).'&action=warning_message&msg='.get_lang(
'GroupTooMuchMembers'
)
);
} else { } else {
header('Location: group.php?'.api_get_cidreq(true, false).'&action=success_message&msg='.get_lang('GroupSettingsModified').'&category='.$cat['id']); header(
'Location: group.php?'.api_get_cidreq(true, false).'&action=success_message&msg='.get_lang(
'GroupSettingsModified'
).'&category='.$cat['id']
);
} }
exit; exit;
} }
@ -302,22 +446,22 @@ $defaults['group_tutors'] = $selected_tutors;
$action = isset($_GET['action']) ? $_GET['action'] : ''; $action = isset($_GET['action']) ? $_GET['action'] : '';
$defaults['action'] = $action; $defaults['action'] = $action;
if ($defaults['maximum_number_of_students'] == GroupManager::MEMBER_PER_GROUP_NO_LIMIT) { if ($defaults['maximum_number_of_students'] == GroupManager::MEMBER_PER_GROUP_NO_LIMIT) {
$defaults['max_member_no_limit'] = GroupManager::MEMBER_PER_GROUP_NO_LIMIT; $defaults['max_member_no_limit'] = GroupManager::MEMBER_PER_GROUP_NO_LIMIT;
} else { } else {
$defaults['max_member_no_limit'] = 1; $defaults['max_member_no_limit'] = 1;
$defaults['max_member'] = $defaults['maximum_number_of_students']; $defaults['max_member'] = $defaults['maximum_number_of_students'];
} }
if (!empty($_GET['keyword']) && !empty($_GET['submit'])) { if (!empty($_GET['keyword']) && !empty($_GET['submit'])) {
$keyword_name = Security::remove_XSS($_GET['keyword']); $keyword_name = Security::remove_XSS($_GET['keyword']);
echo '<br/>'.get_lang('SearchResultsFor').' <span style="font-style: italic ;"> '.$keyword_name.' </span><br>'; echo '<br/>'.get_lang('SearchResultsFor').' <span style="font-style: italic ;"> '.$keyword_name.' </span><br>';
} }
Display :: display_header($nameTools, 'Group'); Display :: display_header($nameTools, 'Group');
//@todo fix this //@todo fix this
if (isset($_GET['show_message_warning'])) { if (isset($_GET['show_message_warning'])) {
echo Display::display_warning_message($_GET['show_message_warning']); echo Display::display_warning_message($_GET['show_message_warning']);
} }
if (isset($_GET['show_message_sucess'])) { if (isset($_GET['show_message_sucess'])) {

@ -22,34 +22,35 @@ class HTML_QuickForm_advanced_settings extends HTML_QuickForm_static
{ {
// {{{ constructor // {{{ constructor
/** /**
* Class constructor * Class constructor
* *
* @param string $text raw HTML to add * @param string $text raw HTML to add
* @access public * @access public
* @return void * @return void
*/ */
function HTML_QuickForm_advanced_settings($text = null) function HTML_QuickForm_advanced_settings($text = null)
{ {
$this->HTML_QuickForm_static(null, null, $text); $this->HTML_QuickForm_static(null, null, $text);
$this->_type = 'html'; $this->_type = 'html';
} }
/** /**
* Accepts a renderer * Accepts a renderer
* *
* @param HTML_QuickForm_Renderer renderer object (only works with Default renderer!) * @param HTML_QuickForm_Renderer renderer object (only works with Default renderer!)
* @access public * @access public
* @return void * @return void
*/ */
function accept(&$renderer, $required=false, $error=null) function accept(&$renderer, $required = false, $error = null)
{ {
$renderer->renderHtml($this); $renderer->renderHtml($this);
} // end func accept } // end func accept
function toHtml() { function toHtml()
return '<div class="control-group "> {
return '<div class="control-group">
<label class="control-label"></label> <label class="control-label"></label>
<div class="controls"> <div class="controls">
'.HTML_QuickForm_static::toHtml().' '.HTML_QuickForm_static::toHtml().'
@ -57,5 +58,5 @@ class HTML_QuickForm_advanced_settings extends HTML_QuickForm_static
</div> </div>
'; ';
} //end func toHtml }
} //end class HTML_QuickForm_html }

File diff suppressed because it is too large Load Diff

@ -22,14 +22,15 @@ class HTML_QuickForm_label extends HTML_QuickForm_static
{ {
// {{{ constructor // {{{ constructor
/** /**
* Class constructor * Class constructor
* *
* @param string $text raw HTML to add * @param string $text raw HTML to add
* @access public * @access public
* @return void * @return void
*/ */
function HTML_QuickForm_label($label = null, $text = null) { function HTML_QuickForm_label($label = null, $text = null)
{
$this->HTML_QuickForm_static(null, $label, $text); $this->HTML_QuickForm_static(null, $label, $text);
$this->_type = 'html'; $this->_type = 'html';
} }
@ -37,29 +38,26 @@ class HTML_QuickForm_label extends HTML_QuickForm_static
// }}} // }}}
// {{{ accept() // {{{ accept()
/** /**
* Accepts a renderer * Accepts a renderer
* *
* @param HTML_QuickForm_Renderer renderer object (only works with Default renderer!) * @param HTML_QuickForm_Renderer renderer object (only works with Default renderer!)
* @access public * @access public
* @return void * @return void
*/ */
function accept(&$renderer, $required=false, $error=null) { function accept(&$renderer, $required = false, $error = null)
{
$renderer->renderHtml($this); $renderer->renderHtml($this);
} }
function toHtml() { function toHtml()
return '<div class="control-group "> {
return '<div class="control-group">
<label class="control-label">'.$this->getLabel().'</label> <label class="control-label">'.$this->getLabel().'</label>
<div class="controls"> <div class="controls">
'.HTML_QuickForm_static::toHtml().' '.HTML_QuickForm_static::toHtml().'
</div> </div>
</div> </div>
'; ';
} //end func toHtml }
}
// }}}
} //end class HTML_QuickForm_html

@ -2,15 +2,15 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* @package chamilo.survey * @package chamilo.survey
* @author unknown, the initial survey that did not make it in 1.8 because of bad code * @author unknown, the initial survey that did not make it in 1.8 because of bad code
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code
* @author Julio Montoya Chamilo: cleanup, refactoring, security improvements * @author Julio Montoya Chamilo: cleanup, refactoring, security improvements
* @version $Id: survey_invite.php 10680 2007-01-11 21:26:23Z pcool $ * @version $Id: survey_invite.php 10680 2007-01-11 21:26:23Z pcool $
* *
* @todo checking if the additional emails are valid (or add a rule for this) * @todo checking if the additional emails are valid (or add a rule for this)
* @todo check if the mailtext contains the **link** part, if not, add the link to the end * @todo check if the mailtext contains the **link** part, if not, add the link to the end
* @todo add rules: title and text cannot be empty * @todo add rules: title and text cannot be empty
*/ */
// Language file that needs to be included // Language file that needs to be included
@ -25,18 +25,18 @@ require_once 'survey.lib.php';
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
if (!api_is_allowed_to_edit(false, true)) { if (!api_is_allowed_to_edit(false, true)) {
Display :: display_header(get_lang('ToolSurvey')); Display :: display_header(get_lang('ToolSurvey'));
Display :: display_error_message(get_lang('NotAllowed'), false); Display :: display_error_message(get_lang('NotAllowed'), false);
Display :: display_footer(); Display :: display_footer();
exit; exit;
} }
// Database table definitions // Database table definitions
$table_survey = Database :: get_course_table(TABLE_SURVEY); $table_survey = Database :: get_course_table(TABLE_SURVEY);
$table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE); $table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$table_user = Database :: get_main_table(TABLE_MAIN_USER); $table_user = Database :: get_main_table(TABLE_MAIN_USER);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -44,28 +44,28 @@ $course_id = api_get_course_int_id();
$survey_id = Security::remove_XSS($_GET['survey_id']); $survey_id = Security::remove_XSS($_GET['survey_id']);
$survey_data = survey_manager::get_survey($survey_id); $survey_data = survey_manager::get_survey($survey_id);
if (empty($survey_data)) { if (empty($survey_data)) {
Display :: display_header(get_lang('ToolSurvey')); Display :: display_header(get_lang('ToolSurvey'));
Display :: display_error_message(get_lang('InvallidSurvey'), false); Display :: display_error_message(get_lang('InvallidSurvey'), false);
Display :: display_footer(); Display :: display_footer();
exit; exit;
} }
$urlname = strip_tags(api_substr(api_html_entity_decode($survey_data['title'], ENT_QUOTES), 0, 40)); $urlname = strip_tags(api_substr(api_html_entity_decode($survey_data['title'], ENT_QUOTES), 0, 40));
if (api_strlen(strip_tags($survey_data['title'])) > 40) { if (api_strlen(strip_tags($survey_data['title'])) > 40) {
$urlname .= '...'; $urlname .= '...';
} }
// Breadcrumbs // Breadcrumbs
$interbreadcrumb[] = array('url' => 'survey_list.php', 'name' => get_lang('SurveyList')); $interbreadcrumb[] = array('url' => 'survey_list.php', 'name' => get_lang('SurveyList'));
if (api_is_course_admin()) { if (api_is_course_admin()) {
$interbreadcrumb[] = array('url' => 'survey.php?survey_id='.$survey_id, 'name' => $urlname); $interbreadcrumb[] = array('url' => 'survey.php?survey_id='.$survey_id, 'name' => $urlname);
} else { } else {
$interbreadcrumb[] = array('url' => 'survey_invite.php?survey_id='.$survey_id, 'name' => $urlname); $interbreadcrumb[] = array('url' => 'survey_invite.php?survey_id='.$survey_id, 'name' => $urlname);
} }
$tool_name = get_lang('SurveyPublication'); $tool_name = get_lang('SurveyPublication');
// Displaying the header // Displaying the header
Display::display_header($tool_name,'Survey'); Display::display_header($tool_name, 'Survey');
echo '<script> echo '<script>
$(function() { $(function() {
@ -77,19 +77,21 @@ $(function() {
// Checking if there is another survey with this code. // Checking if there is another survey with this code.
// If this is the case there will be a language choice // If this is the case there will be a language choice
$sql = "SELECT * FROM $table_survey WHERE c_id = $course_id AND code='".Database::escape_string($survey_data['code'])."'"; $sql = "SELECT * FROM $table_survey WHERE c_id = $course_id AND code='".Database::escape_string(
$survey_data['code']
)."'";
$result = Database::query($sql); $result = Database::query($sql);
if (Database::num_rows($result) > 1) { if (Database::num_rows($result) > 1) {
Display::display_warning_message(get_lang('IdenticalSurveycodeWarning')); Display::display_warning_message(get_lang('IdenticalSurveycodeWarning'));
} }
// Invited / answered message // Invited / answered message
if ($survey_data['invited'] > 0 && !isset($_POST['submit'])) { if ($survey_data['invited'] > 0 && !isset($_POST['submit'])) {
$message = '<a href="survey_invitation.php?view=answered&amp;survey_id='.$survey_data['survey_id'].'">'.$survey_data['answered'].'</a> '; $message = '<a href="survey_invitation.php?view=answered&amp;survey_id='.$survey_data['survey_id'].'">'.$survey_data['answered'].'</a> ';
$message .= get_lang('HaveAnswered').' '; $message .= get_lang('HaveAnswered').' ';
$message .= '<a href="survey_invitation.php?view=invited&amp;survey_id='.$survey_data['survey_id'].'">'.$survey_data['invited'].'</a> '; $message .= '<a href="survey_invitation.php?view=invited&amp;survey_id='.$survey_data['survey_id'].'">'.$survey_data['invited'].'</a> ';
$message .= get_lang('WereInvited'); $message .= get_lang('WereInvited');
Display::display_normal_message($message, false); Display::display_normal_message($message, false);
} }
// Building the form for publishing the survey // Building the form for publishing the survey
@ -98,37 +100,32 @@ $form = new FormValidator('publish_form', 'post', api_get_self().'?survey_id='.$
$form->addElement('header', '', $tool_name); $form->addElement('header', '', $tool_name);
// Course users // Course users
$complete_user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), api_get_session_id(), '', api_sort_by_first_name() ? 'ORDER BY firstname' : 'ORDER BY lastname'); $complete_user_list = CourseManager::get_user_list_from_course_code(
api_get_course_id(),
api_get_session_id(),
'',
api_sort_by_first_name() ? 'ORDER BY firstname' : 'ORDER BY lastname'
);
$possible_users = array(); $possible_users = array();
foreach ($complete_user_list as & $user) { foreach ($complete_user_list as & $user) {
$possible_users[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']); $possible_users[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']);
} }
$list = UserManager::generate_user_group_array(api_get_course_id(), api_get_session_id()); $list = UserManager::generate_user_group_array(api_get_course_id(), api_get_session_id());
$users = $form->addElement('advmultiselect', 'course_users', get_lang('CourseUsers'), $list);
$users = $form->addElement('advmultiselect', 'course_users', get_lang('CourseUsers'), $list, 'style="width: 250px; height: 200px;"'); $users->setButtonAttributes('add');
$users->setButtonAttributes('remove');
//$users = $form->addElement('advmultiselect', 'course_users', get_lang('CourseUsers'), $possible_users, 'style="width: 250px; height: 200px;"');
$users->setElementTemplate('
{javascript}
<table{class}>
<!-- BEGIN label_2 --><tr><th>{label_2}</th><!-- END label_2 -->
<!-- BEGIN label_3 --><th>&nbsp;</th><th>{label_3}</th></tr><!-- END label_3 -->
<tr>
<td valign="top">{unselected}</td>
<td align="center">{add}<br /><br />{remove}</td>
<td valign="top">{selected}</td>
</tr>
</table>
');
$users->setButtonAttributes('add', array('class' => 'btn arrowr'));
$users->setButtonAttributes('remove', array('class' => 'btn arrowl'));
// Additional users // Additional users
$form->addElement('textarea', 'additional_users', array(get_lang('AdditonalUsers'), get_lang('AdditonalUsersComment')), array('class' => 'span6', 'rows' => 5)); $form->addElement(
'textarea',
'additional_users',
array(get_lang('AdditonalUsers'), get_lang('AdditonalUsersComment')),
array('class' => 'span6', 'rows' => 5)
);
$form->addElement('html', '<div id="check_mail">'); $form->addElement('html', '<div id="check_mail">');
$form->addElement('checkbox', 'send_mail','', get_lang('SendMail')); $form->addElement('checkbox', 'send_mail', '', get_lang('SendMail'));
$form->addElement('html', '</div>'); $form->addElement('html', '</div>');
$form->addElement('html', '<div id="mail_text">'); $form->addElement('html', '<div id="mail_text">');
@ -136,11 +133,17 @@ $form->addElement('html', '<div id="mail_text">');
// The title of the mail // The title of the mail
$form->addElement('text', 'mail_title', get_lang('MailTitle'), array('class' => 'span6')); $form->addElement('text', 'mail_title', get_lang('MailTitle'), array('class' => 'span6'));
// The text of the mail // The text of the mail
$form->addElement('html_editor', 'mail_text', array(get_lang('MailText'), get_lang('UseLinkSyntax')), null, array('ToolbarSet' => 'Survey', 'Width' => '100%', 'Height' => '150')); $form->addElement(
'html_editor',
'mail_text',
array(get_lang('MailText'), get_lang('UseLinkSyntax')),
null,
array('ToolbarSet' => 'Survey', 'Width' => '100%', 'Height' => '150')
);
$form->addElement('html', '</div>'); $form->addElement('html', '</div>');
// You cab send a reminder to unanswered people if the survey is not anonymous // You cab send a reminder to unanswered people if the survey is not anonymous
if ($survey_data['anonymous'] != 1) { if ($survey_data['anonymous'] != 1) {
$form->addElement('checkbox', 'remindUnAnswered', '', get_lang('RemindUnanswered')); $form->addElement('checkbox', 'remindUnAnswered', '', get_lang('RemindUnanswered'));
} }
// Allow resending to all selected users // Allow resending to all selected users
$form->addElement('checkbox', 'resend_to_all', '', get_lang('ReminderResendToAllUsers')); $form->addElement('checkbox', 'resend_to_all', '', get_lang('ReminderResendToAllUsers'));
@ -151,11 +154,11 @@ $form->addElement('style_submit_button', 'submit', get_lang('PublishSurvey'), 'c
// The rules (required fields) // The rules (required fields)
$portal_url = api_get_path(WEB_PATH); $portal_url = api_get_path(WEB_PATH);
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) { if ($access_url_id != -1) {
$url = api_get_access_url($access_url_id); $url = api_get_access_url($access_url_id);
$portal_url = $url['url']; $portal_url = $url['url'];
} }
} }
// Show the URL that can be used by users to fill a survey without invitation // Show the URL that can be used by users to fill a survey without invitation
@ -165,72 +168,86 @@ $form->addElement('label', null, get_lang('AutoInviteLink'));
$form->addElement('label', null, "<pre>$auto_survey_link</pre>"); $form->addElement('label', null, "<pre>$auto_survey_link</pre>");
if ($form->validate()) { if ($form->validate()) {
$values = $form->exportValues(); $values = $form->exportValues();
if ($values['send_mail'] == 1) { if ($values['send_mail'] == 1) {
if (empty($values['mail_title']) || empty($values['mail_text'])) { if (empty($values['mail_title']) || empty($values['mail_text'])) {
Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete')); Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete'));
// Getting the invited users // Getting the invited users
$defaults = SurveyUtil::get_invited_users($survey_data['code']); $defaults = SurveyUtil::get_invited_users($survey_data['code']);
// Getting the survey mail text // Getting the survey mail text
if (!empty($survey_data['reminder_mail'])) { if (!empty($survey_data['reminder_mail'])) {
$defaults['mail_text'] = $survey_data['reminder_mail']; $defaults['mail_text'] = $survey_data['reminder_mail'];
} else { } else {
$defaults['mail_text'] = $survey_data['invite_mail']; $defaults['mail_text'] = $survey_data['invite_mail'];
} }
$defaults['mail_title'] = $survey_data['mail_subject']; $defaults['mail_title'] = $survey_data['mail_subject'];
$defaults['send_mail'] = 1; $defaults['send_mail'] = 1;
$form->setDefaults($defaults); $form->setDefaults($defaults);
$form->display(); $form->display();
return; return;
} }
} }
// Save the invitation mail // Save the invitation mail
SurveyUtil::save_invite_mail($values['mail_text'], $values['mail_title'], !empty($survey_data['invite_mail'])); SurveyUtil::save_invite_mail($values['mail_text'], $values['mail_title'], !empty($survey_data['invite_mail']));
// Saving the invitations for the course users // Saving the invitations for the course users
$count_course_users = SurveyUtil::save_invitations($values['course_users'], $values['mail_title'], $count_course_users = SurveyUtil::save_invitations(
$values['mail_text'], $values['resend_to_all'], $values['send_mail'], $values['remindUnAnswered']); $values['course_users'],
$values['mail_title'],
// Saving the invitations for the additional users $values['mail_text'],
$values['additional_users'] = $values['additional_users'].';'; // This is for the case when you enter only one email $values['resend_to_all'],
$temp = str_replace(',', ';', $values['additional_users']); // This is to allow , and ; as email separators $values['send_mail'],
$additional_users = explode(';', $temp); $values['remindUnAnswered']
for ($i = 0; $i < count($additional_users); $i++) { );
$additional_users[$i] = trim($additional_users[$i]);
} // Saving the invitations for the additional users
$counter_additional_users = SurveyUtil::save_invitations($additional_users, $values['mail_title'], $values['additional_users'] = $values['additional_users'].';'; // This is for the case when you enter only one email
$values['mail_text'], $values['resend_to_all'], $values['send_mail'], $values['remindUnAnswered']); $temp = str_replace(',', ';', $values['additional_users']); // This is to allow , and ; as email separators
// Updating the invited field in the survey table $additional_users = explode(';', $temp);
SurveyUtil::update_count_invited($survey_data['code']); for ($i = 0; $i < count($additional_users); $i++) {
$total_count = $count_course_users + $counter_additional_users; $additional_users[$i] = trim($additional_users[$i]);
}
$counter_additional_users = SurveyUtil::save_invitations(
$additional_users,
$values['mail_title'],
$values['mail_text'],
$values['resend_to_all'],
$values['send_mail'],
$values['remindUnAnswered']
);
// Updating the invited field in the survey table
SurveyUtil::update_count_invited($survey_data['code']);
$total_count = $count_course_users + $counter_additional_users;
$total_invited = count(SurveyUtil::get_invitations($survey_data['code'])); $total_invited = count(SurveyUtil::get_invitations($survey_data['code']));
if ($total_invited > 0) { if ($total_invited > 0) {
$message = '<a href="survey_invitation.php?view=answered&amp;survey_id='.$survey_data['survey_id'].'">'.$survey_data['answered'].'</a> '; $message = '<a href="survey_invitation.php?view=answered&amp;survey_id='.$survey_data['survey_id'].'">'.$survey_data['answered'].'</a> ';
$message .= get_lang('HaveAnswered').' '; $message .= get_lang('HaveAnswered').' ';
$message .= '<a href="survey_invitation.php?view=invited&amp;survey_id='.$survey_data['survey_id'].'">'.$total_invited.'</a> '; $message .= '<a href="survey_invitation.php?view=invited&amp;survey_id='.$survey_data['survey_id'].'">'.$total_invited.'</a> ';
$message .= get_lang('WereInvited'); $message .= get_lang('WereInvited');
Display::display_normal_message($message, false); Display::display_normal_message($message, false);
Display::display_confirmation_message($total_count.' '.get_lang('InvitationsSend')); Display::display_confirmation_message($total_count.' '.get_lang('InvitationsSend'));
} }
} else { } else {
// Getting the invited users // Getting the invited users
$defaults = SurveyUtil::get_invited_users($survey_data['code']); $defaults = SurveyUtil::get_invited_users($survey_data['code']);
// Getting the survey mail text // Getting the survey mail text
if (!empty($survey_data['reminder_mail'])) { if (!empty($survey_data['reminder_mail'])) {
$defaults['mail_text'] = $survey_data['reminder_mail']; $defaults['mail_text'] = $survey_data['reminder_mail'];
} else { } else {
$defaults['mail_text'] = $survey_data['invite_mail']; $defaults['mail_text'] = $survey_data['invite_mail'];
} }
$defaults['mail_title'] = $survey_data['mail_subject']; $defaults['mail_title'] = $survey_data['mail_subject'];
$defaults['send_mail'] = 1; $defaults['send_mail'] = 1;
$defaults['course_users'] = array_keys(UserManager::transform_user_group_array($defaults['course_users'], $defaults['course_groups'], true, true)); $defaults['course_users'] = array_keys(
UserManager::transform_user_group_array($defaults['course_users'], $defaults['course_groups'], true, true)
);
$form->setDefaults($defaults); $form->setDefaults($defaults);
$form->display(); $form->display();
} }
Display :: display_footer(); Display :: display_footer();
Loading…
Cancel
Save