Fixing php notices and group creation

skala
Julio Montoya 12 years ago
parent d565ca0801
commit 7958ea0b50
  1. 2
      main/forum/forumfunction.inc.php
  2. 19
      main/group/group_creation.php
  3. 1
      main/group/group_edit.php
  4. 4
      main/inc/lib/groupmanager.lib.php

@ -673,7 +673,7 @@ function store_forum($values)
$new_file_name = isset($new_file_name) ? $new_file_name : '';
$sql_image = "'".$new_file_name."', ";
}
$b = $values['forum_comment'];
$b = isset($values['forum_comment']) ? $values['forum_comment'] : null;
$sql = "INSERT INTO ".$table_forums." (c_id, forum_title, forum_image, forum_comment, forum_category, allow_anonymous, allow_edit, approval_direct_post, allow_attachments, allow_new_threads, default_view, forum_of_group, forum_group_public_private, forum_order, session_id)
VALUES (

@ -49,16 +49,19 @@ if (isset ($_POST['action'])) {
}
$msg = urlencode(count($groups).' '.get_lang('GroupsAdded'));
header('Location: group.php?action=show_msg&msg='.$msg);
exit;
break;
case 'create_subgroups':
GroupManager :: create_subgroups($_POST['base_group'], $_POST['number_of_groups']);
$msg = urlencode($_POST['number_of_groups'].' '.get_lang('GroupsAdded'));
header('Location: group.php?action=show_msg&msg='.$msg);
exit;
break;
case 'create_class_groups':
$ids = GroupManager :: create_class_groups($_POST['group_category']);
$msg = urlencode(count($ids).' '.get_lang('GroupsAdded'));
header('Location: group.php?action=show_msg&msg='.$msg);
exit;
break;
}
}
@ -82,8 +85,7 @@ elseif (isset($_POST['number_of_groups'])) {
$number_of_groups = intval($_POST['number_of_groups']);
if ($number_of_groups > 1) {
?>
<script type="text/javascript">
<!--
<script>
var number_of_groups = <?php echo $number_of_groups; ?>;
function switch_state(key)
{
@ -120,7 +122,6 @@ elseif (isset($_POST['number_of_groups'])) {
element.value = ref.value;
}
}
-->
</script>
<?php
}
@ -132,7 +133,8 @@ elseif (isset($_POST['number_of_groups'])) {
$cat_options[$category['id']] = $category['title'];
}
}
$form = new FormValidator('create_groups_step2');
$form = new FormValidator('create_groups_step2', 'post', api_get_self().'?'.api_get_cidreq());
// Modify the default templates
$renderer = $form->defaultRenderer();
@ -152,9 +154,11 @@ EOT;
$renderer->setElementTemplate($element_template);
$form->addElement('hidden', 'action');
$form->addElement('hidden', 'number_of_groups');
$defaults = array ();
$defaults = array();
// Table heading
$group_el = array ();
$group_el = array();
$group_el[] =$form->createElement('static', null, null, '<b>'.get_lang('GroupName').'</b>');
if (api_get_setting('allow_group_categories') == 'true') {
$group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupCategory').'</b>');
@ -212,7 +216,7 @@ EOT;
$categories = GroupManager :: get_categories();
//echo '<blockquote>';
if (count($categories) > 1 || isset ($categories[0]) && $categories[0]['id'] != GroupManager::VIRTUAL_COURSE_CATEGORY) {
$create_groups_form = new FormValidator('create_groups');
$create_groups_form = new FormValidator('create_groups', 'post', api_get_self().'?'.api_get_cidreq());
$create_groups_form->addElement('header', '', $nameTools);
$group_el = array ();
$group_el[] = $create_groups_form->createElement('static', null, null, get_lang('Create'));
@ -301,7 +305,6 @@ EOT;
$create_class_groups_form->display();
echo '</blockquote>';
}
}
/* FOOTER */

@ -169,6 +169,7 @@ foreach ($group_member_list as $index => $user) {
// possible : number_groups_left > 0 and is group member
$possible_users = array();
foreach ($complete_user_list as $index => $user) {
if ($user['number_groups_left'] > 0 || in_array($user['user_id'], $selected_users)) {
$possible_users[$user['user_id']] = api_get_person_name(

@ -219,9 +219,13 @@ class GroupManager
self_registration_allowed = '".$category['self_reg_allowed']."',
self_unregistration_allowed = '".$category['self_unreg_allowed']."',
session_id='".Database::escape_string($session_id)."'";
Database::query($sql);
$lastId = Database::insert_id();
//Fixing Id
Database::update($table_group, array('id' => $lastId), array('iid = ? ' => $lastId));
if ($lastId) {
$desired_dir_name = '/'.replace_dangerous_char($name, 'strict').'_groupdocs';
$my_path = api_get_path(SYS_COURSE_PATH).$currentCourseRepository.'/document';

Loading…
Cancel
Save