Răsfoiți Sursa

Fixing PHP warning/notices

Julio Montoya 13 ani în urmă
părinte
comite
cac0b163f2

+ 3 - 3
main/admin/course_add.php

@@ -67,13 +67,13 @@ $form->applyFilter('visual_code', 'api_strtoupper');
 $form->applyFilter('visual_code', 'html_filter');
 $form->addRule('visual_code', get_lang('Max'), 'maxlength', $maxlength);
 
-$form->addElement('select', 'tutor_id', get_lang('CourseTitular'), $teachers, array('style' => 'width:350px'));
+$form->addElement('select', 'tutor_id', get_lang('CourseTitular'), $teachers, array('style' => 'width:350px', 'class'=>'chzn-select', 'id'=>'tutor_id'));
 $form->applyFilter('tutor_id', 'html_filter');
 
-$form->addElement('select', 'course_teachers', get_lang('CourseTeachers'), $teachers, 'style="width:350px" multiple=multiple size=5');
+$form->addElement('select', 'course_teachers', get_lang('CourseTeachers'), $teachers, ' id="course_teachers" style="width:350px" multiple="multiple" size="5"');
 $form->applyFilter('course_teachers', 'html_filter');
 
-$categories_select = $form->addElement('select', 'category_code', get_lang('CourseFaculty'), $categories, array('style' => 'width:350px'));
+$categories_select = $form->addElement('select', 'category_code', get_lang('CourseFaculty'), $categories, array('style' => 'width:350px', 'class'=>'chzn-select', 'id'=>'category_code'));
 $form->applyFilter('category_code', 'html_filter');
 //This function fills the category_code select ...
 CourseManager::select_and_sort_categories($categories_select);

+ 1 - 1
main/admin/resume_session.php

@@ -173,7 +173,7 @@ require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
 
 if (api_get_multiple_access_url()) {
     echo '<tr><td>';   
-    echo get_lang('URL');    
+    echo 'URL';    
     echo '</td>';
     echo '<td>';
     $url_list = UrlManager::get_access_url_from_session($id_session);

+ 13 - 11
main/admin/session_add.php

@@ -178,24 +178,26 @@ $count_users = Database::result($rs, 0, 0);
 
 if (intval($count_users)<50) {
 	$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
-	$sql="SELECT user_id,lastname,firstname,username FROM $tbl_user WHERE status='1'".$order_clause;
+	$sql="SELECT user_id, lastname,firstname,username FROM $tbl_user WHERE status='1'".$order_clause;
+	
 	global $_configuration;
 	if ($_configuration['multiple_access_urls']) {
 		$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
 		$access_url_id = api_get_current_access_url_id();
 		if ($access_url_id != -1){
-			$sql = 'SELECT username, lastname, firstname FROM '.$tbl_user.' user
+			$sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
 			INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
 			WHERE access_url_id = '.$access_url_id.'  AND status=1'.$order_clause;
 		}
 	}
-	$result=Database::query($sql);
-	$Coaches=Database::store_result($result);
+	$result = Database::query($sql);
+	$Coaches = Database::store_result($result);
+	
 	?>
-	<select id="coach_username" class="chzn-select" name="coach_username" value="true" style="width:350px;">
+	<select id="coach_username" class="chzn-select" name="coach_username" style="width:350px;" title="<?php echo get_lang('Select'); ?>" >
 		<option value="0"><?php get_lang('None'); ?></option>
 		<?php foreach($Coaches as $enreg): ?>
-		<option value="<?php echo $enreg['username']; ?>" <?php if($sent && $enreg['user_id'] == $id_coach) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?></option>
+		<option value="<?php echo $enreg['username']; ?>"> <?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?></option>
 		<?php endforeach; ?>
 	</select>
 	<?php
@@ -212,13 +214,13 @@ $Categories = SessionManager::get_all_session_category();
 <tr>
   <td width="40%"><?php echo get_lang('SessionCategory') ?></td>
   <td width="60%">
-  	<select id="session_category" class="chzn-select" name="session_category" value="true" style="width:350px;">
+  	<select id="session_category" class="chzn-select" name="session_category" style="width:350px;" title="<?php echo get_lang('Select'); ?>">
 		<option value="0"><?php get_lang('None'); ?></option>		
 		<?php 
 		  if (!empty($Categories)) {
 		      foreach($Categories as $Rows) { ?>
-		<option value="<?php echo $Rows['id']; ?>" <?php if($Rows['id'] == $id_session_category) echo 'selected="selected"'; ?>><?php echo $Rows['name']; ?></option>
-		<?php }
+				<option value="<?php echo $Rows['id']; ?>" <?php if($Rows['id'] == $id_session_category) echo 'selected="selected"'; ?>><?php echo $Rows['name']; ?></option>
+			<?php }
 		  }
 		?>
 	</select>
@@ -244,7 +246,7 @@ $Categories = SessionManager::get_all_session_category();
 
   <td width="40%"></td>
   <td width="60%">
-  <input id="start_limit" type="checkbox" name="start_limit" onchange="disable_starttime(this)" <?php if ($year_start=="0000") echo "checked"; ?>/>
+  <input id="start_limit" type="checkbox" name="start_limit" onchange="disable_starttime(this)" />
     <label for="start_limit">
     <?php echo get_lang('DateStartSession');?>
     </label> 
@@ -316,7 +318,7 @@ for ($i=$thisYear-5;$i <= ($thisYear+5);$i++) {
 <tr>
     <td width="40%">&nbsp;&nbsp;</td>
     <td width="60%">
-    <input id="end_limit" type="checkbox" name="end_limit" onchange="disable_endtime(this)" <?php if ($year_end=="0000") echo "checked"; ?>/>
+    <input id="end_limit" type="checkbox" name="end_limit" onchange="disable_endtime(this)" />
     <label for="end_limit">
         <?php echo get_lang('DateEndSession') ?>
     </label>

+ 17 - 15
main/admin/session_edit.php

@@ -3,7 +3,7 @@
 
 // name of the language file that needs to be included
 $language_file ='admin';
-$cidReset=true;
+$cidReset = true;
 require_once '../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'sessionmanager.lib.php';
 
@@ -23,11 +23,13 @@ $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
 $sql = "SELECT name,date_start,date_end,id_coach, session_admin_id, nb_days_access_before_beginning, nb_days_access_after_end, session_category_id, visibility FROM $tbl_session WHERE id = $id";
 $result = Database::query($sql);
 
-if (!$infos=Database::fetch_array($result)) {
+if (!$infos = Database::fetch_array($result)) {
     header('Location: session_list.php');
     exit();
 }
 
+$id_coach   = $infos['id_coach'];
+
 if (!api_is_platform_admin() && $infos['session_admin_id'] != api_get_user_id()) {
     api_not_allowed(true);
 }
@@ -114,24 +116,24 @@ if (!empty($return)) {
   <td width="70%"><input type="text" name="name" size="50" maxlength="50" value="<?php if($formSent) echo api_htmlentities($name,ENT_QUOTES,$charset); else echo api_htmlentities($infos['name'],ENT_QUOTES,$charset); ?>"></td>
 </tr>
 <tr>
-  <td width="30%"><?php echo get_lang('CoachName') ?>&nbsp;&nbsp;</td>
-  <td width="70%"><select class="chzn-select" name="id_coach" style="width:380px;">
-	<option value="">----- <?php echo get_lang('Choose') ?> -----</option>
-<?php
-foreach($Coaches as $enreg) {
-?>
-	<option value="<?php echo $enreg['user_id']; ?>" <?php if((!$sent && $enreg['user_id'] == $infos['id_coach']) || ($sent && $enreg['user_id'] == $id_coach)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?></option>
-<?php
-}
-unset($Coaches);
-$Categories = SessionManager::get_all_session_category();
+	<td width="30%"><?php echo get_lang('CoachName') ?>&nbsp;&nbsp;</td>
+	<td width="70%">
+		<select class="chzn-select" name="id_coach" style="width:380px;" title="<?php echo get_lang('Choose'); ?>" >
+			<option value="">----- <?php echo get_lang('None') ?> -----</option>
+			<?php foreach($Coaches as $enreg) { ?>
+			<option value="<?php echo $enreg['user_id']; ?>" <?php if(($enreg['user_id'] == $infos['id_coach']) || ($enreg['user_id'] == $id_coach)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?></option>
+			<?php
+			}
+			unset($Coaches);
+			$Categories = SessionManager::get_all_session_category();
 ?>
-  </select></td>
+  		</select>
+	</td>
 </tr>
 <tr>
   <td width="30%"><?php echo get_lang('SessionCategory') ?></td>
   <td width="70%">
-  	<select class="chzn-select" id="session_category" name="session_category" style="width:380px;">
+  	<select class="chzn-select" id="session_category" name="session_category" style="width:380px;" title="<?php echo get_lang('Select'); ?>">
 		<option value="0"><?php get_lang('None'); ?></option>
 		<?php
 		  if (!empty($Categories)) { 

+ 2 - 1
main/course_info/infocours.php

@@ -456,7 +456,8 @@ echo '</div>';
 */
 echo '<script>
 $(function() {
-	$( "#course_settings" ).accordion({
+	$("#course_settings").accordion({
+		autoHeight: false,		
 		header: "div> h3",
 	});
 });

+ 5 - 0
main/css/base.css

@@ -2264,4 +2264,9 @@ div.admin_section h4 {
     margin:5px;
     padding:5px;
     width: 380px;    
+}
+
+
+#course_settings h3 img {
+    margin-left: 25px;	
 }