@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | $user['error'] = get_lang('UserNameNotAvailable'); |
| 61 | 61 | $errors[] = $user; |
| 62 | 62 | } |
| 63 | - } |
|
| 64 | - } |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | 66 | // 3. Check status. |
| 67 | 67 | if (isset($user['Status']) && !api_status_exists($user['Status'])) { |
@@ -242,10 +242,10 @@ discard block |
||
| 242 | 242 | return $users; |
| 243 | 243 | } |
| 244 | 244 | /** |
| 245 | - * XML-parser: handle start of element |
|
| 246 | - * @param string $parser Deprecated? |
|
| 247 | - * @param string $data The data to be parsed |
|
| 248 | - */ |
|
| 245 | + * XML-parser: handle start of element |
|
| 246 | + * @param string $parser Deprecated? |
|
| 247 | + * @param string $data The data to be parsed |
|
| 248 | + */ |
|
| 249 | 249 | function element_start($parser, $data) |
| 250 | 250 | { |
| 251 | 251 | $data = api_utf8_decode($data); |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* For licensing terms, see /license.txt */ |
| 3 | 3 | /** |
| 4 | - * Code |
|
| 5 | - * @todo use globals or parameters or add this file in the template |
|
| 6 | - * @package chamilo.include |
|
| 7 | - */ |
|
| 4 | + * Code |
|
| 5 | + * @todo use globals or parameters or add this file in the template |
|
| 6 | + * @package chamilo.include |
|
| 7 | + */ |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Determines the possible tabs (=sections) that are available. |
@@ -42,20 +42,20 @@ discard block |
||
| 42 | 42 | $navigation['myprofile']['url'] = api_get_path(WEB_CODE_PATH).'auth/profile.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&courseCode='.$_course['official_code'] : '' ); |
| 43 | 43 | $navigation['myprofile']['title'] = get_lang('ModifyProfile'); |
| 44 | 44 | $navigation['myprofile']['key'] = 'profile'; |
| 45 | - // Link to my agenda |
|
| 45 | + // Link to my agenda |
|
| 46 | 46 | $navigation['myagenda']['url'] = api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?type=personal'; |
| 47 | 47 | $navigation['myagenda']['title'] = get_lang('MyAgenda'); |
| 48 | 48 | $navigation['myagenda']['key'] = 'agenda'; |
| 49 | 49 | |
| 50 | - // Gradebook |
|
| 51 | - if (api_get_setting('gradebook_enable') == 'true') { |
|
| 50 | + // Gradebook |
|
| 51 | + if (api_get_setting('gradebook_enable') == 'true') { |
|
| 52 | 52 | $navigation['mygradebook']['url'] = api_get_path(WEB_CODE_PATH).'gradebook/gradebook.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&courseCode='.$_course['official_code'] : '' ); |
| 53 | 53 | $navigation['mygradebook']['title'] = get_lang('MyGradebook'); |
| 54 | 54 | $navigation['mygradebook']['key'] = 'gradebook'; |
| 55 | - } |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - // Reporting |
|
| 58 | - if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) { |
|
| 57 | + // Reporting |
|
| 58 | + if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) { |
|
| 59 | 59 | // Link to my space |
| 60 | 60 | $navigation['session_my_space']['url'] = api_get_path(WEB_CODE_PATH).'mySpace/'.(api_is_drh()?'session.php':''); |
| 61 | 61 | $navigation['session_my_space']['title'] = get_lang('MySpace'); |
@@ -79,21 +79,21 @@ discard block |
||
| 79 | 79 | $navigation['session_my_progress']['key'] = 'my-progress'; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - // Social |
|
| 83 | - if (api_get_setting('allow_social_tool')=='true') { |
|
| 82 | + // Social |
|
| 83 | + if (api_get_setting('allow_social_tool')=='true') { |
|
| 84 | 84 | $navigation['social']['url'] = api_get_path(WEB_CODE_PATH).'social/home.php'; |
| 85 | 85 | $navigation['social']['title'] = get_lang('SocialNetwork'); |
| 86 | 86 | $navigation['social']['key'] = 'social-network'; |
| 87 | - } |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - // Dashboard |
|
| 90 | - if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) { |
|
| 89 | + // Dashboard |
|
| 90 | + if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) { |
|
| 91 | 91 | $navigation['dashboard']['url'] = api_get_path(WEB_CODE_PATH).'dashboard/index.php'; |
| 92 | 92 | $navigation['dashboard']['title'] = get_lang('Dashboard'); |
| 93 | 93 | $navigation['dashboard']['key'] = 'dashboard'; |
| 94 | - } |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - // Reports |
|
| 96 | + // Reports |
|
| 97 | 97 | /* |
| 98 | 98 | if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) { |
| 99 | 99 | $navigation['reports']['url'] = api_get_path(WEB_CODE_PATH).'reports/index.php'; |
@@ -116,14 +116,14 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | // End Custom Tabs |
| 118 | 118 | |
| 119 | - // Platform administration |
|
| 120 | - if (api_is_platform_admin(true)) { |
|
| 119 | + // Platform administration |
|
| 120 | + if (api_is_platform_admin(true)) { |
|
| 121 | 121 | $navigation['platform_admin']['url'] = api_get_path(WEB_CODE_PATH).'admin/'; |
| 122 | 122 | $navigation['platform_admin']['title'] = get_lang('PlatformAdmin'); |
| 123 | 123 | $navigation['platform_admin']['key'] = 'admin'; |
| 124 | - } |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - return $navigation; |
|
| 126 | + return $navigation; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | } |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - // Reports |
|
| 354 | + // Reports |
|
| 355 | 355 | if (!empty($possible_tabs['reports'])) { |
| 356 | 356 | if (api_get_setting('show_tabs', 'reports') == 'true') { |
| 357 | 357 | if ((api_is_platform_admin() || api_is_drh() || api_is_session_admin()) && Rights::hasRight('show_tabs:reports')) { |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | |
| 493 | 493 | $menu = null; |
| 494 | 494 | if (!empty($lis)) { |
| 495 | - $menu .= $lis; |
|
| 495 | + $menu .= $lis; |
|
| 496 | 496 | } |
| 497 | 497 | return $menu; |
| 498 | 498 | } |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | $navigation_item_my_courses['title'] = get_lang('MyCourses'); |
| 549 | 549 | $navigation_item_my_courses['url'] = api_get_path(WEB_PATH).'user_portal.php'; |
| 550 | 550 | $navigation[] = $navigation_item_my_courses; |
| 551 | - */ |
|
| 551 | + */ |
|
| 552 | 552 | $navigation[] = $navigation_item; |
| 553 | 553 | } |
| 554 | 554 | |
@@ -53,93 +53,93 @@ discard block |
||
| 53 | 53 | //if ($annee == "" && $composante == "" && $etape == "") { |
| 54 | 54 | if (empty($annee) && empty($id_session)) |
| 55 | 55 | { |
| 56 | - Display::display_header($tool_name); |
|
| 57 | - echo '<div style="align:center">'; |
|
| 58 | - echo Display::return_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU')).' '.get_lang('LDAPSelectFilterOnUsersOU'); |
|
| 59 | - echo '<form method="get" action="'.api_get_self().'"><br />'; |
|
| 60 | - echo '<em>'.get_lang('LDAPOUAttributeFilter').' :</em> '; |
|
| 61 | - echo '<input type="text" name="annee" size="4" maxlength="30" value="'.$annee_base.'"> '; |
|
| 62 | - echo '<input type="submit" value="'.get_lang('Submit').'">'; |
|
| 63 | - echo '</form>'; |
|
| 64 | - echo '</div>'; |
|
| 56 | + Display::display_header($tool_name); |
|
| 57 | + echo '<div style="align:center">'; |
|
| 58 | + echo Display::return_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU')).' '.get_lang('LDAPSelectFilterOnUsersOU'); |
|
| 59 | + echo '<form method="get" action="'.api_get_self().'"><br />'; |
|
| 60 | + echo '<em>'.get_lang('LDAPOUAttributeFilter').' :</em> '; |
|
| 61 | + echo '<input type="text" name="annee" size="4" maxlength="30" value="'.$annee_base.'"> '; |
|
| 62 | + echo '<input type="submit" value="'.get_lang('Submit').'">'; |
|
| 63 | + echo '</form>'; |
|
| 64 | + echo '</div>'; |
|
| 65 | 65 | |
| 66 | 66 | } |
| 67 | 67 | elseif(!empty($annee) && empty($id_session)) |
| 68 | 68 | { |
| 69 | - Display::display_header($tool_name); |
|
| 70 | - echo '<div style="align:center">'; |
|
| 71 | - echo Display::return_icon( |
|
| 72 | - 'course.png', |
|
| 73 | - get_lang('SelectSessionToImportUsersTo')).' '.get_lang('SelectSessionToImportUsersTo').'<br />'; |
|
| 74 | - echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />'; |
|
| 75 | - echo '<select name="id_session">'; |
|
| 76 | - |
|
| 77 | - $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
|
| 78 | - $sql = "SELECT id,name,nbr_courses,access_start_date,access_end_date " . |
|
| 79 | - " FROM $tbl_session ". |
|
| 80 | - " ORDER BY name"; |
|
| 81 | - $result = Database::query($sql); |
|
| 82 | - |
|
| 83 | - $sessions=Database::store_result($result); |
|
| 84 | - $nbr_results=count($sessions); |
|
| 85 | - foreach($sessions as $row) { |
|
| 86 | - echo '<option value="'.$row['id'].'">'.api_htmlentities($row['name']).' ('.$row['access_start_date'].' - '.$row['access_end_date'].')</option>'; |
|
| 87 | - } |
|
| 88 | - echo '</select>'; |
|
| 89 | - echo '<input type="submit" value="'.get_lang('Submit').'">'; |
|
| 90 | - echo '</form>'; |
|
| 91 | - echo '</div>'; |
|
| 69 | + Display::display_header($tool_name); |
|
| 70 | + echo '<div style="align:center">'; |
|
| 71 | + echo Display::return_icon( |
|
| 72 | + 'course.png', |
|
| 73 | + get_lang('SelectSessionToImportUsersTo')).' '.get_lang('SelectSessionToImportUsersTo').'<br />'; |
|
| 74 | + echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />'; |
|
| 75 | + echo '<select name="id_session">'; |
|
| 76 | + |
|
| 77 | + $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
|
| 78 | + $sql = "SELECT id,name,nbr_courses,access_start_date,access_end_date " . |
|
| 79 | + " FROM $tbl_session ". |
|
| 80 | + " ORDER BY name"; |
|
| 81 | + $result = Database::query($sql); |
|
| 82 | + |
|
| 83 | + $sessions=Database::store_result($result); |
|
| 84 | + $nbr_results=count($sessions); |
|
| 85 | + foreach($sessions as $row) { |
|
| 86 | + echo '<option value="'.$row['id'].'">'.api_htmlentities($row['name']).' ('.$row['access_start_date'].' - '.$row['access_end_date'].')</option>'; |
|
| 87 | + } |
|
| 88 | + echo '</select>'; |
|
| 89 | + echo '<input type="submit" value="'.get_lang('Submit').'">'; |
|
| 90 | + echo '</form>'; |
|
| 91 | + echo '</div>'; |
|
| 92 | 92 | } |
| 93 | 93 | // form4 annee != 0; composante != 0 etape != 0 |
| 94 | 94 | //elseif ($annee <> "" && $composante <> "" && $etape <> "" && $listeok != 'yes') { |
| 95 | 95 | elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed'])) |
| 96 | 96 | { |
| 97 | - Display::display_header($tool_name); |
|
| 98 | - echo '<div style="align: center;">'; |
|
| 99 | - echo '<br />'; |
|
| 100 | - echo '<br />'; |
|
| 101 | - echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>'; |
|
| 102 | - //echo "Connection ..."; |
|
| 103 | - $ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError')); |
|
| 104 | - ldap_set_version($ds); |
|
| 105 | - |
|
| 106 | - if ($ds) { |
|
| 107 | - |
|
| 108 | - $r = false; |
|
| 109 | - $res = ldap_handle_bind($ds, $r); |
|
| 110 | - |
|
| 111 | - //$sr = @ ldap_search($ds, "ou=people,$LDAPbasedn", "(|(edupersonprimaryorgunitdn=ou=$etape,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn)(edupersonprimaryorgunitdn=ou=02PEL,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn))"); |
|
| 112 | - //echo "(ou=*$annee,ou=$composante)"; |
|
| 113 | - $sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)"); |
|
| 114 | - |
|
| 115 | - $info = ldap_get_entries($ds, $sr); |
|
| 116 | - |
|
| 117 | - for ($key = 0; $key < $info["count"]; $key ++) { |
|
| 118 | - $nom_form[] = $info[$key]["sn"][0]; |
|
| 119 | - $prenom_form[] = $info[$key]["givenname"][0]; |
|
| 120 | - $email_form[] = $info[$key]["mail"][0]; |
|
| 121 | - // Get uid from dn |
|
| 122 | - //$dn_array=ldap_explode_dn($info[$key]["dn"],1); |
|
| 123 | - //$username_form[] = $dn_array[0]; // uid is first key |
|
| 124 | - $username_form[] = $info[$key]['uid'][0]; |
|
| 125 | - $outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student" |
|
| 126 | - //$val = ldap_get_values_len($ds, $entry, "userPassword"); |
|
| 127 | - //$password_form[] = $val[0]; |
|
| 128 | - $password_form[] = $info[$key]['userPassword'][0]; |
|
| 129 | - } |
|
| 130 | - ldap_unbind($ds); |
|
| 131 | - |
|
| 132 | - /*-----------------------------------------------*/ |
|
| 133 | - |
|
| 134 | - asort($nom_form); |
|
| 135 | - reset($nom_form); |
|
| 136 | - |
|
| 137 | - $statut=5; |
|
| 138 | - include ('ldap_form_add_users_group.php'); |
|
| 139 | - } else { |
|
| 140 | - echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>'; |
|
| 141 | - } |
|
| 142 | - echo '<br /><br />'; |
|
| 97 | + Display::display_header($tool_name); |
|
| 98 | + echo '<div style="align: center;">'; |
|
| 99 | + echo '<br />'; |
|
| 100 | + echo '<br />'; |
|
| 101 | + echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>'; |
|
| 102 | + //echo "Connection ..."; |
|
| 103 | + $ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError')); |
|
| 104 | + ldap_set_version($ds); |
|
| 105 | + |
|
| 106 | + if ($ds) { |
|
| 107 | + |
|
| 108 | + $r = false; |
|
| 109 | + $res = ldap_handle_bind($ds, $r); |
|
| 110 | + |
|
| 111 | + //$sr = @ ldap_search($ds, "ou=people,$LDAPbasedn", "(|(edupersonprimaryorgunitdn=ou=$etape,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn)(edupersonprimaryorgunitdn=ou=02PEL,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn))"); |
|
| 112 | + //echo "(ou=*$annee,ou=$composante)"; |
|
| 113 | + $sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)"); |
|
| 114 | + |
|
| 115 | + $info = ldap_get_entries($ds, $sr); |
|
| 116 | + |
|
| 117 | + for ($key = 0; $key < $info["count"]; $key ++) { |
|
| 118 | + $nom_form[] = $info[$key]["sn"][0]; |
|
| 119 | + $prenom_form[] = $info[$key]["givenname"][0]; |
|
| 120 | + $email_form[] = $info[$key]["mail"][0]; |
|
| 121 | + // Get uid from dn |
|
| 122 | + //$dn_array=ldap_explode_dn($info[$key]["dn"],1); |
|
| 123 | + //$username_form[] = $dn_array[0]; // uid is first key |
|
| 124 | + $username_form[] = $info[$key]['uid'][0]; |
|
| 125 | + $outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student" |
|
| 126 | + //$val = ldap_get_values_len($ds, $entry, "userPassword"); |
|
| 127 | + //$password_form[] = $val[0]; |
|
| 128 | + $password_form[] = $info[$key]['userPassword'][0]; |
|
| 129 | + } |
|
| 130 | + ldap_unbind($ds); |
|
| 131 | + |
|
| 132 | + /*-----------------------------------------------*/ |
|
| 133 | + |
|
| 134 | + asort($nom_form); |
|
| 135 | + reset($nom_form); |
|
| 136 | + |
|
| 137 | + $statut=5; |
|
| 138 | + include ('ldap_form_add_users_group.php'); |
|
| 139 | + } else { |
|
| 140 | + echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>'; |
|
| 141 | + } |
|
| 142 | + echo '<br /><br />'; |
|
| 143 | 143 | echo '<a href="ldap_import_students.php?annee=">'.get_lang('BackToNewSearch').'</a>'; |
| 144 | 144 | echo '<br /><br />'; |
| 145 | 145 | echo '</div>'; |
@@ -147,23 +147,23 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed']=='yes')) |
| 149 | 149 | { |
| 150 | - $id=$_POST['username_form']; |
|
| 151 | - $UserList=array(); |
|
| 152 | - $userid_match_login = array(); |
|
| 153 | - foreach ($id as $form_index=>$user_id) |
|
| 154 | - { |
|
| 155 | - if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes']))) |
|
| 156 | - { |
|
| 157 | - $tmp = ldap_add_user($user_id); |
|
| 158 | - $UserList[]= $tmp; |
|
| 159 | - $userid_match_login[$tmp] = $user_id; |
|
| 160 | - } |
|
| 161 | - } |
|
| 162 | - if (!empty($_POST['id_session'])) { |
|
| 163 | - $num = 0; |
|
| 164 | - $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); |
|
| 165 | - $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
|
| 166 | - foreach ($UserList as $user_id) { |
|
| 150 | + $id=$_POST['username_form']; |
|
| 151 | + $UserList=array(); |
|
| 152 | + $userid_match_login = array(); |
|
| 153 | + foreach ($id as $form_index=>$user_id) |
|
| 154 | + { |
|
| 155 | + if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes']))) |
|
| 156 | + { |
|
| 157 | + $tmp = ldap_add_user($user_id); |
|
| 158 | + $UserList[]= $tmp; |
|
| 159 | + $userid_match_login[$tmp] = $user_id; |
|
| 160 | + } |
|
| 161 | + } |
|
| 162 | + if (!empty($_POST['id_session'])) { |
|
| 163 | + $num = 0; |
|
| 164 | + $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); |
|
| 165 | + $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
|
| 166 | + foreach ($UserList as $user_id) { |
|
| 167 | 167 | $res_user = Database::insert( |
| 168 | 168 | $tbl_session_user, |
| 169 | 169 | [ |
@@ -175,15 +175,15 @@ discard block |
||
| 175 | 175 | if ($res_user !== false) { |
| 176 | 176 | $num++; |
| 177 | 177 | } |
| 178 | - } |
|
| 179 | - |
|
| 180 | - if($num>0) { |
|
| 181 | - $sql = 'UPDATE '.$tbl_session.' SET nbr_users = (nbr_users + '.$num.') WHERE id = '.intval($id_session); |
|
| 182 | - $res = Database::query($sql); |
|
| 183 | - } |
|
| 184 | - header('Location: resume_session.php?id_session='.Security::remove_XSS($_POST['id_session'])); |
|
| 185 | - } |
|
| 186 | - /* |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + if($num>0) { |
|
| 181 | + $sql = 'UPDATE '.$tbl_session.' SET nbr_users = (nbr_users + '.$num.') WHERE id = '.intval($id_session); |
|
| 182 | + $res = Database::query($sql); |
|
| 183 | + } |
|
| 184 | + header('Location: resume_session.php?id_session='.Security::remove_XSS($_POST['id_session'])); |
|
| 185 | + } |
|
| 186 | + /* |
|
| 187 | 187 | else |
| 188 | 188 | { |
| 189 | 189 | Display :: display_header($tool_name); |
@@ -202,13 +202,13 @@ discard block |
||
| 202 | 202 | Display :: display_normal_message($message,false); |
| 203 | 203 | } |
| 204 | 204 | */ |
| 205 | - else |
|
| 206 | - { |
|
| 207 | - Display::display_header($tool_name); |
|
| 208 | - $message=get_lang('NoUserAdded'); |
|
| 209 | - Display :: display_normal_message($message,false); |
|
| 210 | - } |
|
| 211 | - echo '<br /><br />'; |
|
| 205 | + else |
|
| 206 | + { |
|
| 207 | + Display::display_header($tool_name); |
|
| 208 | + $message=get_lang('NoUserAdded'); |
|
| 209 | + Display :: display_normal_message($message,false); |
|
| 210 | + } |
|
| 211 | + echo '<br /><br />'; |
|
| 212 | 212 | echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>'; |
| 213 | 213 | echo '<br /><br />'; |
| 214 | 214 | } |
@@ -56,19 +56,19 @@ discard block |
||
| 56 | 56 | //if ($annee == "" && $composante == "" && $etape == "") { |
| 57 | 57 | if (empty($annee) && empty($course)) |
| 58 | 58 | { |
| 59 | - Display::display_header($tool_name); |
|
| 60 | - echo '<div style="align:center">'; |
|
| 61 | - Display::display_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU')); |
|
| 62 | - echo get_lang('LDAPSelectFilterOnUsersOU'); |
|
| 63 | - //echo '<em>'.get_lang('ToDoThisYouMustEnterYearComponentAndComponentStep').'</em><br />'; |
|
| 64 | - ///echo get_lang('FollowEachOfTheseStepsStepByStep').'<br />'; |
|
| 65 | - |
|
| 66 | - echo '<form method="get" action="'.api_get_self().'"><br />'; |
|
| 67 | - echo '<em>'.get_lang('LDAPOUAttributeFilter').' :</em> '; |
|
| 68 | - echo '<input type="text" name="annee" size="4" maxlength="30" value="'.$annee_base.'"><br />'; |
|
| 69 | - echo '<input type="submit" value="'.get_lang('Submit').'">'; |
|
| 70 | - echo '</form>'; |
|
| 71 | - echo '</div>'; |
|
| 59 | + Display::display_header($tool_name); |
|
| 60 | + echo '<div style="align:center">'; |
|
| 61 | + Display::display_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU')); |
|
| 62 | + echo get_lang('LDAPSelectFilterOnUsersOU'); |
|
| 63 | + //echo '<em>'.get_lang('ToDoThisYouMustEnterYearComponentAndComponentStep').'</em><br />'; |
|
| 64 | + ///echo get_lang('FollowEachOfTheseStepsStepByStep').'<br />'; |
|
| 65 | + |
|
| 66 | + echo '<form method="get" action="'.api_get_self().'"><br />'; |
|
| 67 | + echo '<em>'.get_lang('LDAPOUAttributeFilter').' :</em> '; |
|
| 68 | + echo '<input type="text" name="annee" size="4" maxlength="30" value="'.$annee_base.'"><br />'; |
|
| 69 | + echo '<input type="submit" value="'.get_lang('Submit').'">'; |
|
| 70 | + echo '</form>'; |
|
| 71 | + echo '</div>'; |
|
| 72 | 72 | |
| 73 | 73 | } |
| 74 | 74 | /* |
@@ -200,71 +200,71 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | elseif(!empty($annee) && empty($course)) |
| 202 | 202 | { |
| 203 | - Display::display_header($tool_name); |
|
| 204 | - echo '<div style="align:center">'; |
|
| 205 | - echo Display::return_icon('course.png', get_lang('SelectCourseToImportUsersTo')).' '.get_lang('SelectCourseToImportUsersTo').'<br />'; |
|
| 206 | - echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />'; |
|
| 207 | - echo '<select name="course">'; |
|
| 208 | - $courses = CourseManager::get_courses_list(); |
|
| 209 | - foreach($courses as $row) |
|
| 210 | - { |
|
| 211 | - echo '<option value="'.$row['code'].'">'.api_htmlentities($row['title']).'</option>'; |
|
| 212 | - } |
|
| 213 | - echo '</select>'; |
|
| 214 | - echo '<input type="submit" value="'.get_lang('Submit').'">'; |
|
| 215 | - echo '</form>'; |
|
| 216 | - echo '</div>'; |
|
| 203 | + Display::display_header($tool_name); |
|
| 204 | + echo '<div style="align:center">'; |
|
| 205 | + echo Display::return_icon('course.png', get_lang('SelectCourseToImportUsersTo')).' '.get_lang('SelectCourseToImportUsersTo').'<br />'; |
|
| 206 | + echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />'; |
|
| 207 | + echo '<select name="course">'; |
|
| 208 | + $courses = CourseManager::get_courses_list(); |
|
| 209 | + foreach($courses as $row) |
|
| 210 | + { |
|
| 211 | + echo '<option value="'.$row['code'].'">'.api_htmlentities($row['title']).'</option>'; |
|
| 212 | + } |
|
| 213 | + echo '</select>'; |
|
| 214 | + echo '<input type="submit" value="'.get_lang('Submit').'">'; |
|
| 215 | + echo '</form>'; |
|
| 216 | + echo '</div>'; |
|
| 217 | 217 | } |
| 218 | 218 | // form4 annee != 0; composante != 0 etape != 0 |
| 219 | 219 | //elseif ($annee <> "" && $composante <> "" && $etape <> "" && $listeok != 'yes') { |
| 220 | 220 | elseif (!empty($annee) && !empty($course) && empty($_POST['confirmed'])) |
| 221 | 221 | { |
| 222 | - Display::display_header($tool_name); |
|
| 223 | - echo '<div style="align: center;">'; |
|
| 224 | - echo '<br />'; |
|
| 225 | - echo '<br />'; |
|
| 226 | - echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>'; |
|
| 227 | - //echo "Connection ..."; |
|
| 228 | - $ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError')); |
|
| 229 | - ldap_set_version($ds); |
|
| 230 | - |
|
| 231 | - if ($ds) { |
|
| 232 | - |
|
| 233 | - $r = false; |
|
| 234 | - $res = ldap_handle_bind($ds, $r); |
|
| 235 | - |
|
| 236 | - //$sr = @ ldap_search($ds, "ou=people,$LDAPbasedn", "(|(edupersonprimaryorgunitdn=ou=$etape,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn)(edupersonprimaryorgunitdn=ou=02PEL,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn))"); |
|
| 237 | - //echo "(ou=*$annee,ou=$composante)"; |
|
| 238 | - $sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)"); |
|
| 239 | - |
|
| 240 | - $info = ldap_get_entries($ds, $sr); |
|
| 241 | - |
|
| 242 | - for ($key = 0; $key < $info["count"]; $key ++) { |
|
| 243 | - $nom_form[] = $info[$key]["sn"][0]; |
|
| 244 | - $prenom_form[] = $info[$key]["givenname"][0]; |
|
| 245 | - $email_form[] = $info[$key]["mail"][0]; |
|
| 246 | - // Get uid from dn |
|
| 247 | - //$dn_array=ldap_explode_dn($info[$key]["dn"],1); |
|
| 248 | - //$username_form[] = $dn_array[0]; // uid is first key |
|
| 249 | - $username_form[] = $info[$key]['uid'][0]; |
|
| 250 | - $outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student" |
|
| 251 | - //$val = ldap_get_values_len($ds, $entry, "userPassword"); |
|
| 252 | - //$password_form[] = $val[0]; |
|
| 253 | - $password_form[] = $info[$key]['userPassword'][0]; |
|
| 254 | - } |
|
| 255 | - ldap_unbind($ds); |
|
| 256 | - |
|
| 257 | - /*-----------------------------------------------*/ |
|
| 258 | - |
|
| 259 | - asort($nom_form); |
|
| 260 | - reset($nom_form); |
|
| 261 | - |
|
| 262 | - $statut=5; |
|
| 263 | - include ('ldap_form_add_users_group.php'); |
|
| 264 | - } else { |
|
| 265 | - echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>'; |
|
| 266 | - } |
|
| 267 | - echo '<br /><br />'; |
|
| 222 | + Display::display_header($tool_name); |
|
| 223 | + echo '<div style="align: center;">'; |
|
| 224 | + echo '<br />'; |
|
| 225 | + echo '<br />'; |
|
| 226 | + echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>'; |
|
| 227 | + //echo "Connection ..."; |
|
| 228 | + $ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError')); |
|
| 229 | + ldap_set_version($ds); |
|
| 230 | + |
|
| 231 | + if ($ds) { |
|
| 232 | + |
|
| 233 | + $r = false; |
|
| 234 | + $res = ldap_handle_bind($ds, $r); |
|
| 235 | + |
|
| 236 | + //$sr = @ ldap_search($ds, "ou=people,$LDAPbasedn", "(|(edupersonprimaryorgunitdn=ou=$etape,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn)(edupersonprimaryorgunitdn=ou=02PEL,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn))"); |
|
| 237 | + //echo "(ou=*$annee,ou=$composante)"; |
|
| 238 | + $sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)"); |
|
| 239 | + |
|
| 240 | + $info = ldap_get_entries($ds, $sr); |
|
| 241 | + |
|
| 242 | + for ($key = 0; $key < $info["count"]; $key ++) { |
|
| 243 | + $nom_form[] = $info[$key]["sn"][0]; |
|
| 244 | + $prenom_form[] = $info[$key]["givenname"][0]; |
|
| 245 | + $email_form[] = $info[$key]["mail"][0]; |
|
| 246 | + // Get uid from dn |
|
| 247 | + //$dn_array=ldap_explode_dn($info[$key]["dn"],1); |
|
| 248 | + //$username_form[] = $dn_array[0]; // uid is first key |
|
| 249 | + $username_form[] = $info[$key]['uid'][0]; |
|
| 250 | + $outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student" |
|
| 251 | + //$val = ldap_get_values_len($ds, $entry, "userPassword"); |
|
| 252 | + //$password_form[] = $val[0]; |
|
| 253 | + $password_form[] = $info[$key]['userPassword'][0]; |
|
| 254 | + } |
|
| 255 | + ldap_unbind($ds); |
|
| 256 | + |
|
| 257 | + /*-----------------------------------------------*/ |
|
| 258 | + |
|
| 259 | + asort($nom_form); |
|
| 260 | + reset($nom_form); |
|
| 261 | + |
|
| 262 | + $statut=5; |
|
| 263 | + include ('ldap_form_add_users_group.php'); |
|
| 264 | + } else { |
|
| 265 | + echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>'; |
|
| 266 | + } |
|
| 267 | + echo '<br /><br />'; |
|
| 268 | 268 | echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>'; |
| 269 | 269 | echo '<br /><br />'; |
| 270 | 270 | echo '</div>'; |
@@ -272,27 +272,27 @@ discard block |
||
| 272 | 272 | } |
| 273 | 273 | elseif (!empty($annee) && !empty($course) && ($_POST['confirmed']=='yes')) |
| 274 | 274 | { |
| 275 | - $id=$_POST['username_form']; |
|
| 276 | - $UserList=array(); |
|
| 277 | - $userid_match_login = array(); |
|
| 278 | - foreach ($id as $form_index=>$user_id) |
|
| 279 | - { |
|
| 280 | - if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes']))) |
|
| 281 | - { |
|
| 282 | - $tmp = ldap_add_user($user_id); |
|
| 283 | - $UserList[]= $tmp; |
|
| 284 | - $userid_match_login[$tmp] = $user_id; |
|
| 285 | - } |
|
| 286 | - } |
|
| 287 | - if (!empty($_POST['course'])) |
|
| 288 | - { |
|
| 289 | - foreach($UserList as $user_id) |
|
| 290 | - { |
|
| 291 | - CourseManager::add_user_to_course($user_id,$_POST['course']); |
|
| 292 | - } |
|
| 293 | - header('Location: course_information.php?code='.Security::remove_XSS($_POST['course'])); |
|
| 294 | - } |
|
| 295 | - /* |
|
| 275 | + $id=$_POST['username_form']; |
|
| 276 | + $UserList=array(); |
|
| 277 | + $userid_match_login = array(); |
|
| 278 | + foreach ($id as $form_index=>$user_id) |
|
| 279 | + { |
|
| 280 | + if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes']))) |
|
| 281 | + { |
|
| 282 | + $tmp = ldap_add_user($user_id); |
|
| 283 | + $UserList[]= $tmp; |
|
| 284 | + $userid_match_login[$tmp] = $user_id; |
|
| 285 | + } |
|
| 286 | + } |
|
| 287 | + if (!empty($_POST['course'])) |
|
| 288 | + { |
|
| 289 | + foreach($UserList as $user_id) |
|
| 290 | + { |
|
| 291 | + CourseManager::add_user_to_course($user_id,$_POST['course']); |
|
| 292 | + } |
|
| 293 | + header('Location: course_information.php?code='.Security::remove_XSS($_POST['course'])); |
|
| 294 | + } |
|
| 295 | + /* |
|
| 296 | 296 | else |
| 297 | 297 | { |
| 298 | 298 | Display :: display_header($tool_name); |
@@ -311,13 +311,13 @@ discard block |
||
| 311 | 311 | Display :: display_normal_message($message,false); |
| 312 | 312 | } |
| 313 | 313 | */ |
| 314 | - else |
|
| 315 | - { |
|
| 316 | - Display::display_header($tool_name); |
|
| 317 | - $message=get_lang('NoUserAdded'); |
|
| 318 | - Display :: display_normal_message($message,false); |
|
| 319 | - } |
|
| 320 | - echo '<br /><br />'; |
|
| 314 | + else |
|
| 315 | + { |
|
| 316 | + Display::display_header($tool_name); |
|
| 317 | + $message=get_lang('NoUserAdded'); |
|
| 318 | + Display :: display_normal_message($message,false); |
|
| 319 | + } |
|
| 320 | + echo '<br /><br />'; |
|
| 321 | 321 | echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>'; |
| 322 | 322 | echo '<br /><br />'; |
| 323 | 323 | } |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* For licensing terms, see /license.txt */ |
| 3 | 3 | /** |
| 4 | - * This tool allows platform admins to add skills by uploading a CSV or XML file |
|
| 5 | - * @package chamilo.admin |
|
| 6 | - * @documentation Some interesting basic skills can be found in the "Skills" |
|
| 7 | - * section here: http://en.wikipedia.org/wiki/Personal_knowledge_management |
|
| 8 | - */ |
|
| 4 | + * This tool allows platform admins to add skills by uploading a CSV or XML file |
|
| 5 | + * @package chamilo.admin |
|
| 6 | + * @documentation Some interesting basic skills can be found in the "Skills" |
|
| 7 | + * section here: http://en.wikipedia.org/wiki/Personal_knowledge_management |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | $cidReset = true; |
| 11 | 11 | require_once '../inc/global.inc.php'; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $oskill = new Skill(); |
| 71 | 71 | $skill_id = $oskill->add($skill); |
| 72 | 72 | $parents[$saved_id] = $skill_id; |
| 73 | - } |
|
| 73 | + } |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
@@ -81,12 +81,12 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | function parse_csv_data($file) |
| 83 | 83 | { |
| 84 | - $skills = Import :: csvToArray($file); |
|
| 85 | - foreach ($skills as $index => $skill) { |
|
| 86 | - $skills[$index] = $skill; |
|
| 87 | - } |
|
| 84 | + $skills = Import :: csvToArray($file); |
|
| 85 | + foreach ($skills as $index => $skill) { |
|
| 86 | + $skills[$index] = $skill; |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - return $skills; |
|
| 89 | + return $skills; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -94,16 +94,16 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | function element_start($parser, $data) |
| 96 | 96 | { |
| 97 | - $data = api_utf8_decode($data); |
|
| 98 | - global $skill; |
|
| 99 | - global $current_tag; |
|
| 100 | - switch ($data) { |
|
| 101 | - case 'Skill' : |
|
| 102 | - $skill = array (); |
|
| 103 | - break; |
|
| 104 | - default : |
|
| 105 | - $current_tag = $data; |
|
| 106 | - } |
|
| 97 | + $data = api_utf8_decode($data); |
|
| 98 | + global $skill; |
|
| 99 | + global $current_tag; |
|
| 100 | + switch ($data) { |
|
| 101 | + case 'Skill' : |
|
| 102 | + $skill = array (); |
|
| 103 | + break; |
|
| 104 | + default : |
|
| 105 | + $current_tag = $data; |
|
| 106 | + } |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -111,18 +111,18 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | function element_end($parser, $data) |
| 113 | 113 | { |
| 114 | - $data = api_utf8_decode($data); |
|
| 115 | - global $skill; |
|
| 116 | - global $skills; |
|
| 117 | - global $current_value; |
|
| 118 | - switch ($data) { |
|
| 119 | - case 'Skill' : |
|
| 120 | - $skills[] = $skill; |
|
| 121 | - break; |
|
| 122 | - default : |
|
| 123 | - $skill[$data] = $current_value; |
|
| 124 | - break; |
|
| 125 | - } |
|
| 114 | + $data = api_utf8_decode($data); |
|
| 115 | + global $skill; |
|
| 116 | + global $skills; |
|
| 117 | + global $current_value; |
|
| 118 | + switch ($data) { |
|
| 119 | + case 'Skill' : |
|
| 120 | + $skills[] = $skill; |
|
| 121 | + break; |
|
| 122 | + default : |
|
| 123 | + $skill[$data] = $current_value; |
|
| 124 | + break; |
|
| 125 | + } |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | function character_data($parser, $data) |
| 132 | 132 | { |
| 133 | - $data = trim(api_utf8_decode($data)); |
|
| 134 | - global $current_value; |
|
| 135 | - $current_value = $data; |
|
| 133 | + $data = trim(api_utf8_decode($data)); |
|
| 134 | + global $current_value; |
|
| 135 | + $current_value = $data; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -142,19 +142,19 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | function parse_xml_data($file) |
| 144 | 144 | { |
| 145 | - global $current_tag; |
|
| 146 | - global $current_value; |
|
| 147 | - global $skill; |
|
| 148 | - global $skills; |
|
| 149 | - $skills = array(); |
|
| 150 | - $parser = xml_parser_create('UTF-8'); |
|
| 151 | - xml_set_element_handler($parser, 'element_start', 'element_end'); |
|
| 152 | - xml_set_character_data_handler($parser, 'character_data'); |
|
| 153 | - xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false); |
|
| 154 | - xml_parse($parser, api_utf8_encode_xml(file_get_contents($file))); |
|
| 155 | - xml_parser_free($parser); |
|
| 145 | + global $current_tag; |
|
| 146 | + global $current_value; |
|
| 147 | + global $skill; |
|
| 148 | + global $skills; |
|
| 149 | + $skills = array(); |
|
| 150 | + $parser = xml_parser_create('UTF-8'); |
|
| 151 | + xml_set_element_handler($parser, 'element_start', 'element_end'); |
|
| 152 | + xml_set_character_data_handler($parser, 'character_data'); |
|
| 153 | + xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false); |
|
| 154 | + xml_parse($parser, api_utf8_encode_xml(file_get_contents($file))); |
|
| 155 | + xml_parser_free($parser); |
|
| 156 | 156 | |
| 157 | - return $skills; |
|
| 157 | + return $skills; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | $this_section = SECTION_PLATFORM_ADMIN; |
@@ -169,81 +169,81 @@ discard block |
||
| 169 | 169 | $error_message = ''; |
| 170 | 170 | |
| 171 | 171 | if (!empty($_POST['formSent']) && $_FILES['import_file']['size'] !== 0) { |
| 172 | - $file_type = $_POST['file_type']; |
|
| 173 | - Security::clear_token(); |
|
| 174 | - $tok = Security::get_token(); |
|
| 175 | - $allowed_file_mimetype = array('csv','xml'); |
|
| 176 | - $error_kind_file = false; |
|
| 172 | + $file_type = $_POST['file_type']; |
|
| 173 | + Security::clear_token(); |
|
| 174 | + $tok = Security::get_token(); |
|
| 175 | + $allowed_file_mimetype = array('csv','xml'); |
|
| 176 | + $error_kind_file = false; |
|
| 177 | 177 | $error_message = ''; |
| 178 | 178 | |
| 179 | - $ext_import_file = substr($_FILES['import_file']['name'], (strrpos($_FILES['import_file']['name'],'.')+1)); |
|
| 179 | + $ext_import_file = substr($_FILES['import_file']['name'], (strrpos($_FILES['import_file']['name'],'.')+1)); |
|
| 180 | 180 | |
| 181 | - if (in_array($ext_import_file,$allowed_file_mimetype)) { |
|
| 182 | - if (strcmp($file_type, 'csv') === 0 && $ext_import_file == $allowed_file_mimetype[0]) { |
|
| 183 | - $skills = parse_csv_data($_FILES['import_file']['tmp_name']); |
|
| 184 | - $errors = validate_data($skills); |
|
| 185 | - $error_kind_file = false; |
|
| 186 | - } elseif (strcmp($file_type, 'xml') === 0 && $ext_import_file == $allowed_file_mimetype[1]) { |
|
| 187 | - $skills = parse_xml_data($_FILES['import_file']['tmp_name']); |
|
| 188 | - $errors = validate_data($skills); |
|
| 189 | - $error_kind_file = false; |
|
| 190 | - } else { |
|
| 191 | - $error_kind_file = true; |
|
| 192 | - } |
|
| 193 | - } else { |
|
| 194 | - $error_kind_file = true; |
|
| 195 | - } |
|
| 181 | + if (in_array($ext_import_file,$allowed_file_mimetype)) { |
|
| 182 | + if (strcmp($file_type, 'csv') === 0 && $ext_import_file == $allowed_file_mimetype[0]) { |
|
| 183 | + $skills = parse_csv_data($_FILES['import_file']['tmp_name']); |
|
| 184 | + $errors = validate_data($skills); |
|
| 185 | + $error_kind_file = false; |
|
| 186 | + } elseif (strcmp($file_type, 'xml') === 0 && $ext_import_file == $allowed_file_mimetype[1]) { |
|
| 187 | + $skills = parse_xml_data($_FILES['import_file']['tmp_name']); |
|
| 188 | + $errors = validate_data($skills); |
|
| 189 | + $error_kind_file = false; |
|
| 190 | + } else { |
|
| 191 | + $error_kind_file = true; |
|
| 192 | + } |
|
| 193 | + } else { |
|
| 194 | + $error_kind_file = true; |
|
| 195 | + } |
|
| 196 | 196 | |
| 197 | - // List skill id with error. |
|
| 198 | - $skills_to_insert = $skill_id_error = array(); |
|
| 199 | - if (is_array($errors)) { |
|
| 200 | - foreach ($errors as $my_errors) { |
|
| 201 | - $skill_id_error[] = $my_errors['SkillName']; |
|
| 202 | - } |
|
| 203 | - } |
|
| 204 | - if (is_array($skills)) { |
|
| 205 | - foreach ($skills as $my_skill) { |
|
| 206 | - if (isset($my_skill['name']) && !in_array($my_skill['name'], $skill_id_error)) { |
|
| 207 | - $skills_to_insert[] = $my_skill; |
|
| 208 | - } |
|
| 209 | - } |
|
| 210 | - } |
|
| 197 | + // List skill id with error. |
|
| 198 | + $skills_to_insert = $skill_id_error = array(); |
|
| 199 | + if (is_array($errors)) { |
|
| 200 | + foreach ($errors as $my_errors) { |
|
| 201 | + $skill_id_error[] = $my_errors['SkillName']; |
|
| 202 | + } |
|
| 203 | + } |
|
| 204 | + if (is_array($skills)) { |
|
| 205 | + foreach ($skills as $my_skill) { |
|
| 206 | + if (isset($my_skill['name']) && !in_array($my_skill['name'], $skill_id_error)) { |
|
| 207 | + $skills_to_insert[] = $my_skill; |
|
| 208 | + } |
|
| 209 | + } |
|
| 210 | + } |
|
| 211 | 211 | |
| 212 | - if (strcmp($file_type, 'csv') === 0) { |
|
| 213 | - save_data($skills_to_insert); |
|
| 214 | - } elseif (strcmp($file_type, 'xml') === 0) { |
|
| 215 | - save_data($skills_to_insert); |
|
| 216 | - } else { |
|
| 217 | - $error_message = get_lang('YouMustImportAFileAccordingToSelectedOption'); |
|
| 218 | - } |
|
| 212 | + if (strcmp($file_type, 'csv') === 0) { |
|
| 213 | + save_data($skills_to_insert); |
|
| 214 | + } elseif (strcmp($file_type, 'xml') === 0) { |
|
| 215 | + save_data($skills_to_insert); |
|
| 216 | + } else { |
|
| 217 | + $error_message = get_lang('YouMustImportAFileAccordingToSelectedOption'); |
|
| 218 | + } |
|
| 219 | 219 | |
| 220 | - if (count($errors) > 0) { |
|
| 221 | - $see_message_import = get_lang('FileImportedJustSkillsThatAreNotRegistered'); |
|
| 222 | - } else { |
|
| 223 | - $see_message_import = get_lang('FileImported'); |
|
| 224 | - } |
|
| 220 | + if (count($errors) > 0) { |
|
| 221 | + $see_message_import = get_lang('FileImportedJustSkillsThatAreNotRegistered'); |
|
| 222 | + } else { |
|
| 223 | + $see_message_import = get_lang('FileImported'); |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | - if (count($errors) != 0) { |
|
| 227 | - $warning_message = '<ul>'; |
|
| 228 | - foreach ($errors as $index => $error_skill) { |
|
| 229 | - $warning_message .= '<li><b>'.$error_skill['error'].'</b>: '; |
|
| 230 | - $warning_message .= '<strong>'.$error_skill['SkillName'].'</strong> ('.$error_skill['SkillName'].')'; |
|
| 231 | - $warning_message .= '</li>'; |
|
| 232 | - } |
|
| 233 | - $warning_message .= '</ul>'; |
|
| 234 | - } |
|
| 226 | + if (count($errors) != 0) { |
|
| 227 | + $warning_message = '<ul>'; |
|
| 228 | + foreach ($errors as $index => $error_skill) { |
|
| 229 | + $warning_message .= '<li><b>'.$error_skill['error'].'</b>: '; |
|
| 230 | + $warning_message .= '<strong>'.$error_skill['SkillName'].'</strong> ('.$error_skill['SkillName'].')'; |
|
| 231 | + $warning_message .= '</li>'; |
|
| 232 | + } |
|
| 233 | + $warning_message .= '</ul>'; |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | 236 | if ($error_kind_file) { |
| 237 | - $error_message = get_lang('YouMustImportAFileAccordingToSelectedOption'); |
|
| 238 | - } |
|
| 237 | + $error_message = get_lang('YouMustImportAFileAccordingToSelectedOption'); |
|
| 238 | + } |
|
| 239 | 239 | } |
| 240 | 240 | Display :: display_header($tool_name); |
| 241 | 241 | |
| 242 | 242 | if (!empty($error_message)) { |
| 243 | - Display::display_error_message($error_message); |
|
| 243 | + Display::display_error_message($error_message); |
|
| 244 | 244 | } |
| 245 | 245 | if (!empty($see_message_import)) { |
| 246 | - Display::display_normal_message($see_message_import); |
|
| 246 | + Display::display_normal_message($see_message_import); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | $form = new FormValidator('user_import','post','skills_import.php'); |
@@ -266,16 +266,16 @@ discard block |
||
| 266 | 266 | $i = 0; |
| 267 | 267 | $count_fields = count($extra_fields); |
| 268 | 268 | if ($count_fields > 0) { |
| 269 | - foreach ($extra_fields as $extra) { |
|
| 270 | - $list[] = $extra[1]; |
|
| 271 | - $list_reponse[] = 'xxx'; |
|
| 272 | - $spaces = ' '; |
|
| 273 | - $result_xml .= $spaces.'<'.$extra[1].'>xxx</'.$extra[1].'>'; |
|
| 274 | - if ($i != $count_fields - 1) { |
|
| 275 | - $result_xml .= '<br/>'; |
|
| 276 | - } |
|
| 277 | - $i++; |
|
| 278 | - } |
|
| 269 | + foreach ($extra_fields as $extra) { |
|
| 270 | + $list[] = $extra[1]; |
|
| 271 | + $list_reponse[] = 'xxx'; |
|
| 272 | + $spaces = ' '; |
|
| 273 | + $result_xml .= $spaces.'<'.$extra[1].'>xxx</'.$extra[1].'>'; |
|
| 274 | + if ($i != $count_fields - 1) { |
|
| 275 | + $result_xml .= '<br/>'; |
|
| 276 | + } |
|
| 277 | + $i++; |
|
| 278 | + } |
|
| 279 | 279 | } |
| 280 | 280 | ?> |
| 281 | 281 | <p><?php echo get_lang('CSVMustLookLike').' ('.get_lang('MandatoryFields').')'; ?> :</p> |
@@ -61,44 +61,44 @@ discard block |
||
| 61 | 61 | /* Please, do not modify this dirname formatting */ |
| 62 | 62 | |
| 63 | 63 | if (strstr($dir, '..')) { |
| 64 | - $dir = '/'; |
|
| 64 | + $dir = '/'; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | if ($dir[0] == '.') { |
| 68 | - $dir = substr($dir, 1); |
|
| 68 | + $dir = substr($dir, 1); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | if ($dir[0] != '/') { |
| 72 | - $dir = '/'.$dir; |
|
| 72 | + $dir = '/'.$dir; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | if ($dir[strlen($dir) - 1] != '/') { |
| 76 | - $dir .= '/'; |
|
| 76 | + $dir .= '/'; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; |
| 80 | 80 | |
| 81 | 81 | if (!is_dir($filepath)) { |
| 82 | - $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
| 83 | - $dir = '/'; |
|
| 82 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
| 83 | + $dir = '/'; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | //groups //TODO:clean |
| 87 | 87 | if (!empty($groupId)) { |
| 88 | - $interbreadcrumb[] = array( |
|
| 89 | - 'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(), |
|
| 90 | - 'name' => get_lang('GroupSpace'), |
|
| 91 | - ); |
|
| 92 | - $group_document = true; |
|
| 93 | - $noPHP_SELF = true; |
|
| 88 | + $interbreadcrumb[] = array( |
|
| 89 | + 'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(), |
|
| 90 | + 'name' => get_lang('GroupSpace'), |
|
| 91 | + ); |
|
| 92 | + $group_document = true; |
|
| 93 | + $noPHP_SELF = true; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $is_certificate_mode = DocumentManager::is_certificate_mode($dir); |
| 97 | 97 | |
| 98 | 98 | if (!$is_certificate_mode) |
| 99 | - $interbreadcrumb[]= array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), "name"=> get_lang('Documents')); |
|
| 99 | + $interbreadcrumb[]= array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), "name"=> get_lang('Documents')); |
|
| 100 | 100 | else |
| 101 | - $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); |
|
| 101 | + $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); |
|
| 102 | 102 | |
| 103 | 103 | // Interbreadcrumb for the current directory root path |
| 104 | 104 | if (empty($document_data['parents'])) { |
@@ -113,10 +113,10 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $is_allowedToEdit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights'] || |
| 116 | - DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); |
|
| 116 | + DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); |
|
| 117 | 117 | |
| 118 | 118 | if (!$is_allowedToEdit) { |
| 119 | - api_not_allowed(true); |
|
| 119 | + api_not_allowed(true); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | Event::event_access_tool(TOOL_DOCUMENT); |
@@ -148,21 +148,21 @@ discard block |
||
| 148 | 148 | $locktitle="false"; |
| 149 | 149 | |
| 150 | 150 | if ($_SERVER['HTTP_HOST']=="localhost") { |
| 151 | - $path_and_file= api_get_path(SYS_SERVER_ROOT_PATH).'/crossdomain.xml'; |
|
| 152 | - if (!file_exists($path_and_file)) { |
|
| 153 | - $crossdomain='<?xml version="1.0"?> |
|
| 151 | + $path_and_file= api_get_path(SYS_SERVER_ROOT_PATH).'/crossdomain.xml'; |
|
| 152 | + if (!file_exists($path_and_file)) { |
|
| 153 | + $crossdomain='<?xml version="1.0"?> |
|
| 154 | 154 | <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"> |
| 155 | 155 | <cross-domain-policy> |
| 156 | 156 | <allow-access-from domain="cdn.pixlr.com" /> |
| 157 | 157 | <site-control permitted-cross-domain-policies="master-only"/> |
| 158 | 158 | <allow-http-request-headers-from domain="cnd.pixlr.com" headers="*" secure="true"/> |
| 159 | 159 | </cross-domain-policy>';//more open domain="*" |
| 160 | - @file_put_contents($path_and_file, $crossdomain); |
|
| 161 | - } |
|
| 162 | - $credentials="true"; |
|
| 160 | + @file_put_contents($path_and_file, $crossdomain); |
|
| 161 | + } |
|
| 162 | + $credentials="true"; |
|
| 163 | 163 | } |
| 164 | 164 | else { |
| 165 | - $credentials="false"; |
|
| 165 | + $credentials="false"; |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | //make temp images |
@@ -175,23 +175,23 @@ discard block |
||
| 175 | 175 | $htaccess=api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess'; |
| 176 | 176 | if (!file_exists($htaccess)) { |
| 177 | 177 | |
| 178 | - $htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes"; |
|
| 178 | + $htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes"; |
|
| 179 | 179 | |
| 180 | - $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess', 'w'); |
|
| 181 | - if ($fp) { |
|
| 182 | - fwrite($fp, $htaccess_content); |
|
| 183 | - fclose($fp); |
|
| 184 | - } |
|
| 180 | + $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess', 'w'); |
|
| 181 | + if ($fp) { |
|
| 182 | + fwrite($fp, $htaccess_content); |
|
| 183 | + fclose($fp); |
|
| 184 | + } |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | $html_index=api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html'; |
| 188 | 188 | if (!file_exists($html_index)) { |
| 189 | - $html_index_content="<html><head></head><body></body></html>"; |
|
| 190 | - $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html', 'w'); |
|
| 191 | - if ($fp) { |
|
| 192 | - fwrite($fp, $html_index_content); |
|
| 193 | - fclose($fp); |
|
| 194 | - } |
|
| 189 | + $html_index_content="<html><head></head><body></body></html>"; |
|
| 190 | + $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html', 'w'); |
|
| 191 | + if ($fp) { |
|
| 192 | + fwrite($fp, $html_index_content); |
|
| 193 | + fclose($fp); |
|
| 194 | + } |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | //encript temp name file |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* For licensing terms, see /license.txt */ |
| 3 | 3 | /** |
| 4 | - * @author Patrick Cool [email protected] Ghent University Mai 2004 |
|
| 5 | - * @author Julio Montoya Lots of improvements, cleaning, adding security |
|
| 6 | - * @author Juan Carlos Raña Trabado [email protected] January 2008 |
|
| 7 | - * @package chamilo.document |
|
| 8 | - */ |
|
| 4 | + * @author Patrick Cool [email protected] Ghent University Mai 2004 |
|
| 5 | + * @author Julio Montoya Lots of improvements, cleaning, adding security |
|
| 6 | + * @author Juan Carlos Raña Trabado [email protected] January 2008 |
|
| 7 | + * @package chamilo.document |
|
| 8 | + */ |
|
| 9 | 9 | require_once '../inc/global.inc.php'; |
| 10 | 10 | api_protect_course_script(); |
| 11 | 11 | |
@@ -15,15 +15,15 @@ discard block |
||
| 15 | 15 | $slide_id = isset($_GET['slide_id']) ? Security::remove_XSS($_GET['slide_id']) : null; |
| 16 | 16 | |
| 17 | 17 | if (empty($slide_id)) { |
| 18 | - $edit_slide_id = 1; |
|
| 18 | + $edit_slide_id = 1; |
|
| 19 | 19 | } else { |
| 20 | - $edit_slide_id = $slide_id; |
|
| 20 | + $edit_slide_id = $slide_id; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | if ($path != '/') { |
| 24 | - $folder = $path.'/'; |
|
| 24 | + $folder = $path.'/'; |
|
| 25 | 25 | } else { |
| 26 | - $folder = '/'; |
|
| 26 | + $folder = '/'; |
|
| 27 | 27 | } |
| 28 | 28 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
| 29 | 29 | |
@@ -41,15 +41,15 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // Loading the slides from the session |
| 43 | 43 | if (isset($_SESSION['image_files_only'])) { |
| 44 | - $image_files_only = $_SESSION['image_files_only']; |
|
| 44 | + $image_files_only = $_SESSION['image_files_only']; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // Calculating the current slide, next slide, previous slide and the number of slides |
| 48 | 48 | $slide = null; |
| 49 | 49 | if ($slide_id != 'all') { |
| 50 | - $slide = $slide_id ? $slide_id : 0; |
|
| 51 | - $previous_slide = $slide - 1; |
|
| 52 | - $next_slide = $slide + 1; |
|
| 50 | + $slide = $slide_id ? $slide_id : 0; |
|
| 51 | + $previous_slide = $slide - 1; |
|
| 52 | + $next_slide = $slide + 1; |
|
| 53 | 53 | } |
| 54 | 54 | $total_slides = count($image_files_only); |
| 55 | 55 | ?> |
@@ -62,62 +62,62 @@ discard block |
||
| 62 | 62 | <?php |
| 63 | 63 | |
| 64 | 64 | if ($slide_id != 'all') { |
| 65 | - $image = null; |
|
| 66 | - if (isset($image_files_only[$slide])) { |
|
| 67 | - $image = $sys_course_path . $_course['path'] . '/document' . $folder . $image_files_only[$slide]; |
|
| 68 | - } |
|
| 69 | - if (file_exists($image)) { |
|
| 70 | - echo '<div class="actions-pagination">'; |
|
| 71 | - |
|
| 72 | - // Back forward buttons |
|
| 73 | - if ($slide == 0) { |
|
| 74 | - $imgp = 'action_prev_na.png'; |
|
| 75 | - $first = Display::return_icon('action_first_na.png'); |
|
| 76 | - } else { |
|
| 77 | - $imgp = 'action_prev.png'; |
|
| 78 | - $first = '<a href="slideshow.php?slide_id=0&curdirpath='.$pathurl.'"> |
|
| 65 | + $image = null; |
|
| 66 | + if (isset($image_files_only[$slide])) { |
|
| 67 | + $image = $sys_course_path . $_course['path'] . '/document' . $folder . $image_files_only[$slide]; |
|
| 68 | + } |
|
| 69 | + if (file_exists($image)) { |
|
| 70 | + echo '<div class="actions-pagination">'; |
|
| 71 | + |
|
| 72 | + // Back forward buttons |
|
| 73 | + if ($slide == 0) { |
|
| 74 | + $imgp = 'action_prev_na.png'; |
|
| 75 | + $first = Display::return_icon('action_first_na.png'); |
|
| 76 | + } else { |
|
| 77 | + $imgp = 'action_prev.png'; |
|
| 78 | + $first = '<a href="slideshow.php?slide_id=0&curdirpath='.$pathurl.'"> |
|
| 79 | 79 | '.Display::return_icon('action_first.png', get_lang('FirstSlide')).' |
| 80 | 80 | </a>'; |
| 81 | - } |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - // First slide |
|
| 84 | - echo $first; |
|
| 83 | + // First slide |
|
| 84 | + echo $first; |
|
| 85 | 85 | |
| 86 | - // Previous slide |
|
| 87 | - if ($slide > 0) { |
|
| 88 | - echo '<a href="slideshow.php?slide_id='.$previous_slide.'&curdirpath='.$pathurl.'">'; |
|
| 89 | - } |
|
| 86 | + // Previous slide |
|
| 87 | + if ($slide > 0) { |
|
| 88 | + echo '<a href="slideshow.php?slide_id='.$previous_slide.'&curdirpath='.$pathurl.'">'; |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | 91 | echo Display::return_icon($imgp, get_lang('Previous')); |
| 92 | - if ($slide > 0) { |
|
| 93 | - echo '</a>'; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - // Divider |
|
| 97 | - echo ' [ '.$next_slide.'/'.$total_slides.' ] '; |
|
| 98 | - |
|
| 99 | - // Next slide |
|
| 100 | - if ($slide < $total_slides - 1) { |
|
| 101 | - echo '<a href="slideshow.php?slide_id='.$next_slide.'&curdirpath='.$pathurl.'">'; |
|
| 102 | - } |
|
| 103 | - if ($slide == $total_slides - 1) { |
|
| 104 | - $imgn = 'action_next_na.png'; |
|
| 92 | + if ($slide > 0) { |
|
| 93 | + echo '</a>'; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + // Divider |
|
| 97 | + echo ' [ '.$next_slide.'/'.$total_slides.' ] '; |
|
| 98 | + |
|
| 99 | + // Next slide |
|
| 100 | + if ($slide < $total_slides - 1) { |
|
| 101 | + echo '<a href="slideshow.php?slide_id='.$next_slide.'&curdirpath='.$pathurl.'">'; |
|
| 102 | + } |
|
| 103 | + if ($slide == $total_slides - 1) { |
|
| 104 | + $imgn = 'action_next_na.png'; |
|
| 105 | 105 | $last = Display::return_icon('action_last_na.png', get_lang('LastSlide')); |
| 106 | - } else { |
|
| 107 | - $imgn = 'action_next.png'; |
|
| 108 | - $last = '<a href="slideshow.php?slide_id='.($total_slides-1).'&curdirpath='.$pathurl.'"> |
|
| 106 | + } else { |
|
| 107 | + $imgn = 'action_next.png'; |
|
| 108 | + $last = '<a href="slideshow.php?slide_id='.($total_slides-1).'&curdirpath='.$pathurl.'"> |
|
| 109 | 109 | '.Display::return_icon('action_last.png', get_lang('LastSlide')).' |
| 110 | 110 | </a>'; |
| 111 | - } |
|
| 111 | + } |
|
| 112 | 112 | echo Display::return_icon($imgn, get_lang('Next')); |
| 113 | - if ($slide > 0) { |
|
| 114 | - echo '</a>'; |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - // Last slide |
|
| 118 | - echo $last; |
|
| 119 | - echo '</div>'; |
|
| 120 | - } |
|
| 113 | + if ($slide > 0) { |
|
| 114 | + echo '</a>'; |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + // Last slide |
|
| 118 | + echo $last; |
|
| 119 | + echo '</div>'; |
|
| 120 | + } |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | // Exit the slideshow |
@@ -126,10 +126,10 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | // Show thumbnails |
| 128 | 128 | if ($slide_id != 'all') { |
| 129 | - echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'. |
|
| 129 | + echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'. |
|
| 130 | 130 | Display::return_icon('thumbnails.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM).'</a>'; |
| 131 | 131 | } else { |
| 132 | - echo Display::return_icon('thumbnails_na.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM); |
|
| 132 | + echo Display::return_icon('thumbnails_na.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM); |
|
| 133 | 133 | } |
| 134 | 134 | // Slideshow options |
| 135 | 135 | echo '<a href="slideshowoptions.php?curdirpath='.$pathurl.'&'.api_get_cidreq().'">'. |
@@ -142,24 +142,24 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | // If we come from slideshowoptions.php we sessionize (new word !!! ;-) the options |
| 144 | 144 | if (isset($_POST['Submit'])) { |
| 145 | - // We come from slideshowoptions.php |
|
| 146 | - //$_SESSION["auto_image_resizing"]=Security::remove_XSS($_POST['auto_radio_resizing']); |
|
| 147 | - $_SESSION["image_resizing"] = Security::remove_XSS($_POST['radio_resizing']); |
|
| 148 | - if ($_POST['radio_resizing'] == "resizing" && $_POST['width'] != '' && $_POST['height'] != '') { |
|
| 149 | - //echo "resizing"; |
|
| 150 | - $_SESSION["image_resizing_width"] = Security::remove_XSS($_POST['width']); |
|
| 151 | - $_SESSION["image_resizing_height"] = Security::remove_XSS($_POST['height']); |
|
| 152 | - } else { |
|
| 153 | - //echo "unsetting the session heighte and width"; |
|
| 154 | - $_SESSION["image_resizing_width"] = null; |
|
| 155 | - $_SESSION["image_resizing_height"] = null; |
|
| 156 | - } |
|
| 145 | + // We come from slideshowoptions.php |
|
| 146 | + //$_SESSION["auto_image_resizing"]=Security::remove_XSS($_POST['auto_radio_resizing']); |
|
| 147 | + $_SESSION["image_resizing"] = Security::remove_XSS($_POST['radio_resizing']); |
|
| 148 | + if ($_POST['radio_resizing'] == "resizing" && $_POST['width'] != '' && $_POST['height'] != '') { |
|
| 149 | + //echo "resizing"; |
|
| 150 | + $_SESSION["image_resizing_width"] = Security::remove_XSS($_POST['width']); |
|
| 151 | + $_SESSION["image_resizing_height"] = Security::remove_XSS($_POST['height']); |
|
| 152 | + } else { |
|
| 153 | + //echo "unsetting the session heighte and width"; |
|
| 154 | + $_SESSION["image_resizing_width"] = null; |
|
| 155 | + $_SESSION["image_resizing_height"] = null; |
|
| 156 | + } |
|
| 157 | 157 | } |
| 158 | 158 | $target_width = $target_height = null; |
| 159 | 159 | // The target height and width depends if we choose resizing or no resizing |
| 160 | 160 | if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == "resizing") { |
| 161 | - $target_width = $_SESSION["image_resizing_width"]; |
|
| 162 | - $target_height = $_SESSION["image_resizing_height"]; |
|
| 161 | + $target_width = $_SESSION["image_resizing_width"]; |
|
| 162 | + $target_height = $_SESSION["image_resizing_height"]; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /* THUMBNAIL VIEW */ |
@@ -169,59 +169,59 @@ discard block |
||
| 169 | 169 | $html = ''; |
| 170 | 170 | if ($slide_id == 'all') { |
| 171 | 171 | |
| 172 | - // Config for make thumbnails |
|
| 172 | + // Config for make thumbnails |
|
| 173 | 173 | $allowed_thumbnail_types = array('jpg', 'jpeg', 'gif', 'png'); |
| 174 | - $max_thumbnail_width = 250; |
|
| 175 | - $max_thumbnail_height = 250; |
|
| 176 | - $png_compression = 0; // 0(none)-9 |
|
| 177 | - $jpg_quality = 75; // from 0 to 100 (default is 75). More quality less compression |
|
| 174 | + $max_thumbnail_width = 250; |
|
| 175 | + $max_thumbnail_height = 250; |
|
| 176 | + $png_compression = 0; // 0(none)-9 |
|
| 177 | + $jpg_quality = 75; // from 0 to 100 (default is 75). More quality less compression |
|
| 178 | 178 | |
| 179 | - $directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/'; |
|
| 179 | + $directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/'; |
|
| 180 | 180 | |
| 181 | - //Other parameters only for show tumbnails |
|
| 182 | - $row_items = 4;//only in slideshow.php |
|
| 183 | - $number_image = 7;//num icons cols to show |
|
| 184 | - $thumbnail_width_frame = $max_thumbnail_width;//optional $max_thumbnail_width+x |
|
| 185 | - $thumbnail_height_frame = $max_thumbnail_height; |
|
| 181 | + //Other parameters only for show tumbnails |
|
| 182 | + $row_items = 4;//only in slideshow.php |
|
| 183 | + $number_image = 7;//num icons cols to show |
|
| 184 | + $thumbnail_width_frame = $max_thumbnail_width;//optional $max_thumbnail_width+x |
|
| 185 | + $thumbnail_height_frame = $max_thumbnail_height; |
|
| 186 | 186 | |
| 187 | - // Create the template_thumbnails folder (if no exist) |
|
| 187 | + // Create the template_thumbnails folder (if no exist) |
|
| 188 | 188 | |
| 189 | - if (!file_exists($directory_thumbnails)) { |
|
| 190 | - @mkdir($directory_thumbnails, api_get_permissions_for_new_directories()); |
|
| 189 | + if (!file_exists($directory_thumbnails)) { |
|
| 190 | + @mkdir($directory_thumbnails, api_get_permissions_for_new_directories()); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - // check files and thumbnails |
|
| 194 | - if (is_array($image_files_only)) { |
|
| 193 | + // check files and thumbnails |
|
| 194 | + if (is_array($image_files_only)) { |
|
| 195 | 195 | |
| 196 | - foreach ($image_files_only as $one_image_file) { |
|
| 197 | - $image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file; |
|
| 198 | - $image_thumbnail= $directory_thumbnails.'.'.$one_image_file; |
|
| 196 | + foreach ($image_files_only as $one_image_file) { |
|
| 197 | + $image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file; |
|
| 198 | + $image_thumbnail= $directory_thumbnails.'.'.$one_image_file; |
|
| 199 | 199 | |
| 200 | - if (file_exists($image)) { |
|
| 201 | - //check thumbnail |
|
| 202 | - $imagetype = explode(".", $image); |
|
| 200 | + if (file_exists($image)) { |
|
| 201 | + //check thumbnail |
|
| 202 | + $imagetype = explode(".", $image); |
|
| 203 | 203 | //or check $imagetype = image_type_to_extension(exif_imagetype($image), false); |
| 204 | - $imagetype = strtolower($imagetype[count($imagetype)-1]); |
|
| 204 | + $imagetype = strtolower($imagetype[count($imagetype)-1]); |
|
| 205 | 205 | |
| 206 | - if (in_array($imagetype,$allowed_thumbnail_types)) { |
|
| 207 | - if (!file_exists($image_thumbnail)){ |
|
| 206 | + if (in_array($imagetype,$allowed_thumbnail_types)) { |
|
| 207 | + if (!file_exists($image_thumbnail)){ |
|
| 208 | 208 | //run each once we view thumbnails is too heavy, then need move into !file_exists($image_thumbnail, and only run when haven't the thumbnail |
| 209 | - $original_image_size = api_getimagesize($image); |
|
| 210 | - |
|
| 211 | - switch($imagetype) { |
|
| 212 | - case 'gif': |
|
| 213 | - $source_img = imagecreatefromgif($image); |
|
| 214 | - break; |
|
| 215 | - case 'jpg': |
|
| 216 | - $source_img = imagecreatefromjpeg($image); |
|
| 217 | - break; |
|
| 218 | - case 'jpeg': |
|
| 219 | - $source_img = imagecreatefromjpeg($image); |
|
| 220 | - break; |
|
| 221 | - case 'png': |
|
| 222 | - $source_img = imagecreatefrompng($image); |
|
| 223 | - break; |
|
| 224 | - } |
|
| 209 | + $original_image_size = api_getimagesize($image); |
|
| 210 | + |
|
| 211 | + switch($imagetype) { |
|
| 212 | + case 'gif': |
|
| 213 | + $source_img = imagecreatefromgif($image); |
|
| 214 | + break; |
|
| 215 | + case 'jpg': |
|
| 216 | + $source_img = imagecreatefromjpeg($image); |
|
| 217 | + break; |
|
| 218 | + case 'jpeg': |
|
| 219 | + $source_img = imagecreatefromjpeg($image); |
|
| 220 | + break; |
|
| 221 | + case 'png': |
|
| 222 | + $source_img = imagecreatefrompng($image); |
|
| 223 | + break; |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | 226 | $new_thumbnail_size = api_calculate_image_size( |
| 227 | 227 | $original_image_size['width'], |
@@ -229,33 +229,33 @@ discard block |
||
| 229 | 229 | $max_thumbnail_width, |
| 230 | 230 | $max_thumbnail_height |
| 231 | 231 | ); |
| 232 | - if ($max_thumbnail_width>$original_image_size['width'] && $max_thumbnail_height>$original_image_size['height']){ |
|
| 233 | - $new_thumbnail_size['width']=$original_image_size['width']; |
|
| 234 | - $new_thumbnail_size['height']=$original_image_size['height']; |
|
| 235 | - } |
|
| 236 | - |
|
| 237 | - $crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']); |
|
| 238 | - |
|
| 239 | - // preserve transparency |
|
| 240 | - if ($imagetype == "png"){ |
|
| 241 | - imagesavealpha($crop, true); |
|
| 242 | - $color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127); |
|
| 243 | - imagefill($crop, 0, 0, $color); |
|
| 244 | - } |
|
| 245 | - |
|
| 246 | - if ($imagetype == "gif") { |
|
| 247 | - $transindex = imagecolortransparent($source_img); |
|
| 232 | + if ($max_thumbnail_width>$original_image_size['width'] && $max_thumbnail_height>$original_image_size['height']){ |
|
| 233 | + $new_thumbnail_size['width']=$original_image_size['width']; |
|
| 234 | + $new_thumbnail_size['height']=$original_image_size['height']; |
|
| 235 | + } |
|
| 236 | + |
|
| 237 | + $crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']); |
|
| 238 | + |
|
| 239 | + // preserve transparency |
|
| 240 | + if ($imagetype == "png"){ |
|
| 241 | + imagesavealpha($crop, true); |
|
| 242 | + $color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127); |
|
| 243 | + imagefill($crop, 0, 0, $color); |
|
| 244 | + } |
|
| 245 | + |
|
| 246 | + if ($imagetype == "gif") { |
|
| 247 | + $transindex = imagecolortransparent($source_img); |
|
| 248 | 248 | $palletsize = imagecolorstotal($source_img); |
| 249 | - //GIF89a for transparent and anim (first clip), either GIF87a |
|
| 250 | - if ($transindex >= 0 && $transindex < $palletsize){ |
|
| 251 | - $transcol = imagecolorsforindex($source_img, $transindex); |
|
| 252 | - $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127); |
|
| 253 | - imagefill($crop, 0, 0, $transindex); |
|
| 254 | - imagecolortransparent($crop, $transindex); |
|
| 255 | - } |
|
| 256 | - } |
|
| 257 | - |
|
| 258 | - //resampled image |
|
| 249 | + //GIF89a for transparent and anim (first clip), either GIF87a |
|
| 250 | + if ($transindex >= 0 && $transindex < $palletsize){ |
|
| 251 | + $transcol = imagecolorsforindex($source_img, $transindex); |
|
| 252 | + $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127); |
|
| 253 | + imagefill($crop, 0, 0, $transindex); |
|
| 254 | + imagecolortransparent($crop, $transindex); |
|
| 255 | + } |
|
| 256 | + } |
|
| 257 | + |
|
| 258 | + //resampled image |
|
| 259 | 259 | imagecopyresampled( |
| 260 | 260 | $crop, |
| 261 | 261 | $source_img, |
@@ -269,69 +269,69 @@ discard block |
||
| 269 | 269 | $original_image_size['height'] |
| 270 | 270 | ); |
| 271 | 271 | |
| 272 | - switch ($imagetype) { |
|
| 273 | - case 'gif': |
|
| 274 | - imagegif($crop,$image_thumbnail); |
|
| 275 | - break; |
|
| 276 | - case 'jpg': |
|
| 277 | - imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
| 278 | - break; |
|
| 279 | - case 'jpeg': |
|
| 280 | - imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
| 281 | - break; |
|
| 282 | - case 'png': |
|
| 283 | - imagepng($crop,$image_thumbnail,$png_compression); |
|
| 284 | - break; |
|
| 285 | - } |
|
| 286 | - |
|
| 287 | - //clean memory |
|
| 288 | - imagedestroy($crop); |
|
| 289 | - }//end !exist thumbnail |
|
| 290 | - |
|
| 291 | - //show thumbnail and link |
|
| 292 | - |
|
| 293 | - $one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail |
|
| 294 | - $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file; |
|
| 295 | - $image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">'; |
|
| 296 | - } else { |
|
| 297 | - //if images aren't support by gd (not gif, jpg, jpeg, png) |
|
| 298 | - if ($imagetype=="bmp") { |
|
| 272 | + switch ($imagetype) { |
|
| 273 | + case 'gif': |
|
| 274 | + imagegif($crop,$image_thumbnail); |
|
| 275 | + break; |
|
| 276 | + case 'jpg': |
|
| 277 | + imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
| 278 | + break; |
|
| 279 | + case 'jpeg': |
|
| 280 | + imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
| 281 | + break; |
|
| 282 | + case 'png': |
|
| 283 | + imagepng($crop,$image_thumbnail,$png_compression); |
|
| 284 | + break; |
|
| 285 | + } |
|
| 286 | + |
|
| 287 | + //clean memory |
|
| 288 | + imagedestroy($crop); |
|
| 289 | + }//end !exist thumbnail |
|
| 290 | + |
|
| 291 | + //show thumbnail and link |
|
| 292 | + |
|
| 293 | + $one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail |
|
| 294 | + $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file; |
|
| 295 | + $image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">'; |
|
| 296 | + } else { |
|
| 297 | + //if images aren't support by gd (not gif, jpg, jpeg, png) |
|
| 298 | + if ($imagetype=="bmp") { |
|
| 299 | 299 | // use getimagesize instead api_getimagesize($image); becasuse api_getimagesize doesn't support bmp files. Put here for each show, only for a few bmp files isn't heavy |
| 300 | - $original_image_size = getimagesize($image); |
|
| 301 | - if ($max_thumbnail_width<$original_image_size[0] || $max_thumbnail_height<$original_image_size[1]){ |
|
| 302 | - $thumbnail_size=api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height);//don't use resize_image because doesn't run with bmp files |
|
| 303 | - $image_height = $thumbnail_size['height']; |
|
| 304 | - $image_width = $thumbnail_size['width']; |
|
| 305 | - } else { |
|
| 306 | - $image_height=$original_image_size[0]; |
|
| 307 | - $image_width=$original_image_size[1]; |
|
| 308 | - } |
|
| 309 | - } else { |
|
| 310 | - //example for svg files,... |
|
| 311 | - $image_width=$max_thumbnail_width; |
|
| 312 | - $image_height=$max_thumbnail_height; |
|
| 313 | - } |
|
| 314 | - |
|
| 315 | - $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file; |
|
| 316 | - $image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" width="'.$image_width.'" height="'.$image_height.'" title="'.$one_image_file.'">'; |
|
| 317 | - |
|
| 318 | - }//end allowed image types |
|
| 319 | - }//end if exist file image |
|
| 320 | - }//end foreach |
|
| 321 | - }//end image files only |
|
| 322 | - |
|
| 323 | - // Creating the table |
|
| 324 | - $html_table = ''; |
|
| 325 | - |
|
| 326 | - $i = 0; |
|
| 327 | - $count_image = count($image_tag); |
|
| 328 | - $number_iteration = ceil($count_image/$number_image); |
|
| 329 | - $p = 0; |
|
| 300 | + $original_image_size = getimagesize($image); |
|
| 301 | + if ($max_thumbnail_width<$original_image_size[0] || $max_thumbnail_height<$original_image_size[1]){ |
|
| 302 | + $thumbnail_size=api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height);//don't use resize_image because doesn't run with bmp files |
|
| 303 | + $image_height = $thumbnail_size['height']; |
|
| 304 | + $image_width = $thumbnail_size['width']; |
|
| 305 | + } else { |
|
| 306 | + $image_height=$original_image_size[0]; |
|
| 307 | + $image_width=$original_image_size[1]; |
|
| 308 | + } |
|
| 309 | + } else { |
|
| 310 | + //example for svg files,... |
|
| 311 | + $image_width=$max_thumbnail_width; |
|
| 312 | + $image_height=$max_thumbnail_height; |
|
| 313 | + } |
|
| 314 | + |
|
| 315 | + $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file; |
|
| 316 | + $image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" width="'.$image_width.'" height="'.$image_height.'" title="'.$one_image_file.'">'; |
|
| 317 | + |
|
| 318 | + }//end allowed image types |
|
| 319 | + }//end if exist file image |
|
| 320 | + }//end foreach |
|
| 321 | + }//end image files only |
|
| 322 | + |
|
| 323 | + // Creating the table |
|
| 324 | + $html_table = ''; |
|
| 325 | + |
|
| 326 | + $i = 0; |
|
| 327 | + $count_image = count($image_tag); |
|
| 328 | + $number_iteration = ceil($count_image/$number_image); |
|
| 329 | + $p = 0; |
|
| 330 | 330 | $html = ''; |
| 331 | 331 | $html .= '<div class="gallery">'; |
| 332 | - for ($k = 0; $k < $number_iteration; $k++) { |
|
| 333 | - for ($i = 0; $i < $number_image; $i++) { |
|
| 334 | - if (isset($image_tag[$p])) { |
|
| 332 | + for ($k = 0; $k < $number_iteration; $k++) { |
|
| 333 | + for ($i = 0; $i < $number_image; $i++) { |
|
| 334 | + if (isset($image_tag[$p])) { |
|
| 335 | 335 | $html .= '<div class="col-xs-6 col-sm-3 col-md-2">'; |
| 336 | 336 | $html .= '<div class="canvas-one">'; |
| 337 | 337 | $html .= '<a class="canvas-two" href="slideshow.php?slide_id='.$p.'&curdirpath='.$pathurl.'">'; |
@@ -343,10 +343,10 @@ discard block |
||
| 343 | 343 | $html .= '</a>'; |
| 344 | 344 | $html .= '</div>'; |
| 345 | 345 | $html .= '</div>'; |
| 346 | - } |
|
| 347 | - $p++; |
|
| 348 | - } |
|
| 349 | - } |
|
| 346 | + } |
|
| 347 | + $p++; |
|
| 348 | + } |
|
| 349 | + } |
|
| 350 | 350 | $html .= '</div>'; |
| 351 | 351 | |
| 352 | 352 | }//end slide==all |
@@ -357,43 +357,43 @@ discard block |
||
| 357 | 357 | // This is for viewing all the images in the slideshow one at a time. |
| 358 | 358 | |
| 359 | 359 | if ($slide_id != 'all' && !empty($image_files_only)) { |
| 360 | - if (file_exists($image) && is_file($image)) { |
|
| 361 | - $image_height_width = resize_image($image, $target_width, $target_height); |
|
| 362 | - |
|
| 363 | - $image_height = $image_height_width[0]; |
|
| 364 | - $image_width = $image_height_width[1]; |
|
| 365 | - |
|
| 366 | - $height_width_tags = null; |
|
| 367 | - if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') { |
|
| 368 | - $height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"'; |
|
| 369 | - } |
|
| 370 | - |
|
| 371 | - // This is done really quickly and should be cleaned up a little bit using the API functions |
|
| 372 | - $tbl_documents = Database::get_course_table(TABLE_DOCUMENT); |
|
| 373 | - if ($path == '/') { |
|
| 374 | - $pathpart = '/'; |
|
| 375 | - } else { |
|
| 376 | - $pathpart = $path.'/'; |
|
| 377 | - } |
|
| 378 | - $sql = "SELECT * FROM $tbl_documents |
|
| 360 | + if (file_exists($image) && is_file($image)) { |
|
| 361 | + $image_height_width = resize_image($image, $target_width, $target_height); |
|
| 362 | + |
|
| 363 | + $image_height = $image_height_width[0]; |
|
| 364 | + $image_width = $image_height_width[1]; |
|
| 365 | + |
|
| 366 | + $height_width_tags = null; |
|
| 367 | + if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') { |
|
| 368 | + $height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"'; |
|
| 369 | + } |
|
| 370 | + |
|
| 371 | + // This is done really quickly and should be cleaned up a little bit using the API functions |
|
| 372 | + $tbl_documents = Database::get_course_table(TABLE_DOCUMENT); |
|
| 373 | + if ($path == '/') { |
|
| 374 | + $pathpart = '/'; |
|
| 375 | + } else { |
|
| 376 | + $pathpart = $path.'/'; |
|
| 377 | + } |
|
| 378 | + $sql = "SELECT * FROM $tbl_documents |
|
| 379 | 379 | WHERE c_id = $course_id AND path='".Database::escape_string($pathpart.$image_files_only[$slide])."'"; |
| 380 | - $result = Database::query($sql); |
|
| 381 | - $row = Database::fetch_array($result); |
|
| 380 | + $result = Database::query($sql); |
|
| 381 | + $row = Database::fetch_array($result); |
|
| 382 | 382 | |
| 383 | 383 | echo '<div class="thumbnail">'; |
| 384 | - if ($slide < $total_slides - 1 && $slide_id != 'all') { |
|
| 385 | - echo "<a href='slideshow.php?slide_id=".$next_slide."&curdirpath=$pathurl'>"; |
|
| 386 | - } else { |
|
| 387 | - echo "<a href='slideshow.php?slide_id=0&curdirpath=$pathurl'>"; |
|
| 388 | - } |
|
| 384 | + if ($slide < $total_slides - 1 && $slide_id != 'all') { |
|
| 385 | + echo "<a href='slideshow.php?slide_id=".$next_slide."&curdirpath=$pathurl'>"; |
|
| 386 | + } else { |
|
| 387 | + echo "<a href='slideshow.php?slide_id=0&curdirpath=$pathurl'>"; |
|
| 388 | + } |
|
| 389 | 389 | if ($path == '/') { |
| 390 | - $path = ''; |
|
| 390 | + $path = ''; |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | - list($width, $height) = getimagesize($image); |
|
| 394 | - // Auto resize |
|
| 395 | - if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') { |
|
| 396 | - ?> |
|
| 393 | + list($width, $height) = getimagesize($image); |
|
| 394 | + // Auto resize |
|
| 395 | + if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') { |
|
| 396 | + ?> |
|
| 397 | 397 | |
| 398 | 398 | <script type="text/javascript"> |
| 399 | 399 | var initial_width='<?php echo $width; ?>'; |
@@ -446,21 +446,21 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | </script> |
| 448 | 448 | <?php |
| 449 | - } else { |
|
| 450 | - echo "<img class=\"img-responsive\" src='download.php?doc_url=$path/".$image_files_only[$slide]."' alt='".$image_files_only[$slide]."' border='0'".$height_width_tags.">"; |
|
| 451 | - } |
|
| 449 | + } else { |
|
| 450 | + echo "<img class=\"img-responsive\" src='download.php?doc_url=$path/".$image_files_only[$slide]."' alt='".$image_files_only[$slide]."' border='0'".$height_width_tags.">"; |
|
| 451 | + } |
|
| 452 | 452 | |
| 453 | - echo '</a>'; |
|
| 453 | + echo '</a>'; |
|
| 454 | 454 | echo '<div class="caption text-center">'; |
| 455 | 455 | echo Display::tag('h3', $row['title']); |
| 456 | 456 | echo '<p>' . $row['comment'] . '</p>'; |
| 457 | 457 | echo '</div>'; |
| 458 | 458 | echo '</div>'; |
| 459 | 459 | |
| 460 | - if (api_is_allowed_to_edit(null, true)) { |
|
| 460 | + if (api_is_allowed_to_edit(null, true)) { |
|
| 461 | 461 | echo '<ul class="list-unstyled">'; |
| 462 | - $aux = explode('.', htmlspecialchars($image_files_only[$slide])); |
|
| 463 | - $ext = $aux[count($aux) - 1]; |
|
| 462 | + $aux = explode('.', htmlspecialchars($image_files_only[$slide])); |
|
| 463 | + $ext = $aux[count($aux) - 1]; |
|
| 464 | 464 | |
| 465 | 465 | if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') { |
| 466 | 466 | $resize_info = get_lang('Resizing').'<br />'; |
@@ -472,8 +472,8 @@ discard block |
||
| 472 | 472 | $resize_height = get_lang('Auto'); |
| 473 | 473 | } else { |
| 474 | 474 | $resize_info = get_lang('NoResizing').'<br />'; |
| 475 | - $resize_width = ''; |
|
| 476 | - $resize_height = ''; |
|
| 475 | + $resize_width = ''; |
|
| 476 | + $resize_height = ''; |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | echo '<li class="text-center">'; |
@@ -493,16 +493,16 @@ discard block |
||
| 493 | 493 | ); |
| 494 | 494 | echo '</li>'; |
| 495 | 495 | echo '<li class="text-center">' . $width.' x '.$height . '</li>'; |
| 496 | - echo '<li class="text-center">' . round((filesize($image) / 1024), 2) . ' KB - ' . $ext . '</li>'; |
|
| 496 | + echo '<li class="text-center">' . round((filesize($image) / 1024), 2) . ' KB - ' . $ext . '</li>'; |
|
| 497 | 497 | echo '<li class="text-center">' . $resize_info . '</li>'; |
| 498 | - echo '<li class="text-center">' . $resize_width . '</li>'; |
|
| 499 | - echo '<li class="text-center">' . $resize_height . '</li>'; |
|
| 498 | + echo '<li class="text-center">' . $resize_width . '</li>'; |
|
| 499 | + echo '<li class="text-center">' . $resize_height . '</li>'; |
|
| 500 | 500 | echo '</ul>'; |
| 501 | - } |
|
| 501 | + } |
|
| 502 | 502 | |
| 503 | - } else { |
|
| 504 | - Display::display_warning_message(get_lang('FileNotFound')); |
|
| 505 | - } |
|
| 503 | + } else { |
|
| 504 | + Display::display_warning_message(get_lang('FileNotFound')); |
|
| 505 | + } |
|
| 506 | 506 | } else { |
| 507 | 507 | if ($slide_id != 'all') { |
| 508 | 508 | Display::display_warning_message(get_lang('NoDataAvailable')); |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /* For licensing terms, see /license.txt */ |
| 3 | 3 | /** |
| 4 | - * Index page of the admin tools |
|
| 5 | - * @package chamilo.admin |
|
| 6 | - */ |
|
| 4 | + * Index page of the admin tools |
|
| 5 | + * @package chamilo.admin |
|
| 6 | + */ |
|
| 7 | 7 | // Resetting the course id. |
| 8 | 8 | $cidReset = true; |
| 9 | 9 | |