$form->addElement('textarea', 'description', get_lang('Description')); //the first url with id = 1 will be always active if (isset($_GET['url_id']) && $_GET['url_id'] != 1) { $form->addElement('checkbox', 'active', null, get_lang('Active')); } $defaults['url'] = 'http://'; $form->setDefaults($defaults); $submit_name = get_lang('AddUrl'); if (isset($_GET['url_id'])) { $url_id = intval($_GET['url_id']); $num_url_id = UrlManager::url_id_exist($url_id); if ($num_url_id != 1) { header('Location: access_urls.php'); exit; } $url_data = UrlManager::get_url_data_from_id($url_id); $form->addElement('hidden', 'id', $url_data['id']); $form->setDefaults($url_data); $submit_name = get_lang('AddUrl'); } if (!api_is_multiple_url_enabled()) { header('Location: index.php'); exit; } $tool_name = get_lang('AddUrl'); $interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin')); $interbreadcrumb[] = array("url" => 'access_urls.php', "name" => get_lang('MultipleAccessURLs')); Display::display_header($tool_name); if (isset($_GET['action'])) { switch ($_GET['action']) { case 'show_message':
$errorMsg = ''; $UserList = array(); $message = ''; if (isset($_POST['form_sent']) && $_POST['form_sent']) { $form_sent = $_POST['form_sent']; $UserList = $_POST['sessionUsersList']; if (!is_array($UserList)) { $UserList = array(); } if ($form_sent == 1) { if ($access_url_id == 0) { header('Location: access_url_edit_users_to_url.php?action=show_message&message=' . get_lang('SelectURL')); exit; } elseif (is_array($UserList)) { $result = UrlManager::update_urls_rel_user($UserList, $access_url_id); $url_info = UrlManager::get_url_data_from_id($access_url_id); if (!empty($result)) { $message .= 'URL: ' . $url_info['url'] . '<br />'; } if (!empty($result['users_added'])) { $message .= '<h4>' . get_lang('UsersAdded') . ':</h4>'; $i = 1; $user_added_list = array(); foreach ($result['users_added'] as $user) { $user_info = api_get_user_info($user); if (!empty($user_info)) { $user_added_list[] = $i . '. ' . api_get_person_name($user_info['firstname'], $user_info['lastname'], null, null, null, null, $user_info['username']); $i++; } } if (!empty($user_added_list)) {