Code Duplication    Length = 12-13 lines in 3 locations

main/admin/add_courses_to_usergroup.php 1 location

@@ 75-86 (lines=12) @@
72
$usergroup = new UserGroup();
73
$id = intval($_GET['id']);
74
75
if (isset($_POST['form_sent']) && $_POST['form_sent']) {
76
    $form_sent = $_POST['form_sent'];
77
    $elements_posted = $_POST['elements_in_name'];
78
    if (!is_array($elements_posted)) {
79
        $elements_posted = array();
80
    }
81
    if ($form_sent == 1) {
82
        $usergroup->subscribe_courses_to_usergroup($id, $elements_posted);
83
        header('Location: usergroups.php');
84
        exit;
85
    }
86
}
87
88
89
// Filters

main/admin/add_sessions_to_promotion.php 1 location

@@ 73-85 (lines=13) @@
70
$users      =$sessions=array();
71
$promotion = new Promotion();
72
$id = intval($_GET['id']);
73
if (isset($_POST['form_sent']) && $_POST['form_sent']) {
74
    $form_sent = $_POST['form_sent'];
75
    $session_in_promotion_posted = $_POST['session_in_promotion_name'];
76
    if (!is_array($session_in_promotion_posted)) {
77
        $session_in_promotion_posted=array();
78
    }
79
    if ($form_sent == 1) {
80
        // Added a parameter to send emails when registering a user
81
        SessionManager::suscribe_sessions_to_promotion($id, $session_in_promotion_posted);
82
        header('Location: promotions.php');
83
        exit;
84
    }
85
}
86
87
$promotion_data = $promotion->get($id);
88
$session_list = SessionManager::get_sessions_list(array(), array('name'));

main/admin/add_sessions_to_usergroup.php 1 location

@@ 88-100 (lines=13) @@
85
$sessions=array();
86
$usergroup = new UserGroup();
87
$id = intval($_GET['id']);
88
if (isset($_POST['form_sent']) && $_POST['form_sent']) {
89
    $form_sent          = $_POST['form_sent'];
90
    $elements_posted    = $_POST['elements_in_name'];
91
    if (!is_array($elements_posted)) {
92
        $elements_posted = array();
93
    }
94
    if ($form_sent == 1) {
95
        //added a parameter to send emails when registering a user
96
        $usergroup->subscribe_sessions_to_usergroup($id, $elements_posted);
97
        header('Location: usergroups.php');
98
        exit;
99
    }
100
}
101
$data               = $usergroup->get($id);
102
$session_list_in    = $usergroup->get_sessions_by_usergroup($id);
103
$session_list       = SessionManager::get_sessions_list(array(), array('name'));