Kaynağa Gözat

Fixing PHP warnings.

Julio Montoya 11 yıl önce
ebeveyn
işleme
b7937e39c3

+ 4 - 3
main/admin/course_edit.php

@@ -106,9 +106,10 @@ $form->applyFilter('visual_code','html_filter');
 
 //$form->addElement('select', 'course_teachers', get_lang('CourseTeachers'), $teachers, 'multiple=multiple size="4" style="width: 150px;"');
 
-$group=array();
-$group[] = $form->createElement('select', 'platform_teachers', '', $teachers,        ' id="platform_teachers" multiple=multiple size="4" style="width:300px;"');
-$group[] = $form->createElement('select', 'course_teachers', '',   $course_teachers, ' id="course_teachers" multiple=multiple size="4" style="width:300px;"');
+$group = array(
+    $form->createElement('select', 'platform_teachers', '', $teachers,        ' id="platform_teachers" multiple=multiple size="4" style="width:300px;"'),
+    $form->createElement('select', 'course_teachers', '',   $course_teachers, ' id="course_teachers" multiple=multiple size="4" style="width:300px;"')
+);
 
 $multiSelectTemplate = $form->getDoubleMultipleSelectTemplate();
 $renderer = $form->defaultRenderer();

+ 1 - 1
main/admin/course_list.php

@@ -244,7 +244,7 @@ if (isset ($_GET['search']) && $_GET['search'] == 'advanced') {
 
     }
     // Create a search-box
-    $form = new FormValidator('search_simple', 'get', '', '', array('class'=>'form-search'), false);
+    $form = new FormValidator('search_simple', 'get', '', '', array('class'=>'form-inline'), false);
     $form->addElement('text', 'keyword', null);
     $form->addElement('style_submit_button', 'submit', get_lang('SearchCourse'), 'class="btn"');
     $form->addElement('static', 'search_advanced_link', null, '<a href="course_list.php?search=advanced">'.get_lang('AdvancedSearch').'</a>');

+ 4 - 28
main/admin/user_list.php

@@ -458,7 +458,8 @@ function modify_filter($user_id, $url_params, $row) {
 		/*if ($row[0] == api_get_user_id()) {
 			$result .= '<a href="dashboard_add_sessions_to_user.php?user='.$user_id.'">'.Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')).'</a>&nbsp;&nbsp;';
 		}*/
-	} else {
+	}
+    if (api_is_platform_admin()) {
 		if ($current_user_status_label == $statusname[DRH] || UserManager::is_admin($user_id)) {
 			$result .= '<a href="dashboard_add_users_to_user.php?user='.$user_id.'">'.Display::return_icon('user_subscribe_course.png', get_lang('AssignUsers'),'',ICON_SIZE_SMALL).'</a>';
 			$result .= '<a href="dashboard_add_courses_to_user.php?user='.$user_id.'">'.Display::return_icon('course_add.gif', get_lang('AssignCourses')).'</a>&nbsp;&nbsp;';
@@ -694,32 +695,8 @@ $active_group[] = $form->createElement('checkbox','keyword_active','', get_lang(
 $active_group[] = $form->createElement('checkbox','keyword_inactive','', get_lang('Inactive'));
 $form->addGroup($active_group,'',get_lang('ActiveAccount'),'<br/>',false);
 $form->addElement('html', '</td><td>');
-
 $form->addElement('checkbox', 'check_easy_passwords', null, get_lang('CheckEasyPasswords'));
-
-/*
- * @todo fix this code
-$extra_data = UserManager::get_extra_fields( 0,10,5, 'ASC', true, 1);
-var_dump($extra_data);
-$extra_options = array();
-if (!empty($extra_data)) {
-    $extra_options[0] = get_lang('All');
-    // get information about extra data for adding to input select
-    foreach ($extra_data as $field_variable => $field_value) {
-        $extra = UserManager::get_extra_field_information_by_name($field_variable);
-        $extra_options[$field_variable] = $extra['field_display_text'];
-    }
-
-    $form->addElement('select', 'keyword_extra_data', get_lang('ExtraData'), $extra_options, array('id'=>'input_select_extra_data', 'style'=>'margin-left:17px', 'onchange'=>'if(this.value!=0){document.getElementById(\'extra_data_text\').style.display=\'block\';document.getElementById(\'input_extra_text\').value = "";}else{document.getElementById(\'extra_data_text\').style.display=\'none\';}'));
-    $form->addElement('html', '<div id="extra_data_text" style="display:none;">');
-    $form->add_textfield('keyword_extra_data_text', '', false, array('style'=>'margin-left:17px', 'id'=>'input_extra_text'));
-    $form->addElement('html', '</div>');
-} else {
-    $form->addElement('html', '<div id="extra_data_text" style="display:none;">');
-}*/
-
 $form->addElement('html', '</td></tr>');
-
 $form->addElement('html', '<tr><td>');
 $form->addElement('button', 'submit',get_lang('SearchUsers'));
 $form->addElement('html', '</td></tr>');
@@ -760,11 +737,11 @@ $table->set_column_filter(7, 'status_filter');
 $table->set_column_filter(8, 'active_filter');
 $table->set_column_filter(10, 'modify_filter');
 
-if (api_is_platform_admin())
+if (api_is_platform_admin()) {
 	$table->set_form_actions(array ('delete' => get_lang('DeleteFromPlatform')));
+}
 
 $table_result = $table->return_table();
-
 $extra_search_options = '';
 
 //Try to search the user everywhere
@@ -830,4 +807,3 @@ $tpl = $app['template'];
 $tpl->assign('actions', $actions);
 $tpl->assign('message', $message);
 $tpl->assign('content', $form.$table_result.$extra_search_options);
-//$tpl->display_one_col_template();

+ 6 - 2
main/calendar/agenda_js.php

@@ -57,7 +57,6 @@ if (!empty($group_id)) {
 
 $app['title'] = get_lang('Agenda');
 $tpl = $app['template'];
-
 $tpl->assign('use_google_calendar', 0);
 
 $can_add_events = 0;
@@ -135,7 +134,12 @@ $tpl->assign('region_value', 	$region_value);
 $tpl->assign('export_ical_confidential_icon', Display::return_icon('export.png', get_lang('ExportiCalConfidential')));
 
 $actions = null;
-if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()) && api_is_allowed_to_session_edit(false,true) OR $is_group_tutor) {
+$filter = null;
+if (api_is_allowed_to_edit(false,true) OR
+    (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()) &&
+    api_is_allowed_to_session_edit(false,true) OR
+    $is_group_tutor
+) {
     if ($type == 'course') {
         if (isset($_GET['user_id'])) {
             $filter = $_GET['user_id'];

+ 3 - 17
main/inc/lib/display.lib.php

@@ -35,14 +35,7 @@ class Display
     {
         global $app;
         $app['classic_layout'] = true;
-        $app['title'] = $tool_name;
-
-        if ($app['allowed'] == true) {
-            //ob_start(array($app['template'], 'manageDisplay'));
-        } else {
-            //$app->run();
-            //exit;
-        }
+        $app['template']->setTitle($tool_name);
     }
 
     /**
@@ -50,11 +43,6 @@ class Display
      */
     public static function display_footer()
     {
-        //global $app;
-        //$out = ob_get_contents();
-        //ob_end_clean();
-        //$app['template']->assign('content', $out);
-        //$app->run();
     }
 
     /**
@@ -91,7 +79,7 @@ class Display
         $app['template.show_header']    = false;
         $app['template.show_footer']    = false;
         $app['template.show_learnpath'] = $show_learnpath;
-        $app['title'] = $tool_name;
+        $app['template']->setTitle($tool_name);
         self::$global_template = $app['template'];
     }
 
@@ -2141,9 +2129,7 @@ class Display
         $html .= '<a class="carousel-control left" href="#'.$name.'" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span></a>';
         $html .= '<a class="carousel-control right" href="#'.$name.'" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span></a>';
         $html .= '</div>';
-        return $html;
-
-
 
+        return $html;
     }
 }

+ 24 - 2
main/inc/lib/formvalidator/FormValidator.class.php

@@ -467,6 +467,26 @@ EOT;
         return $return_value;
     }
 
+    public function addDoubleMultipleSelect($name, $label, $values, $attributes)
+    {
+        $group = $this->addElement('advmultiselect', $name, $label, $values, $attributes);
+        $group->setElementTemplate('
+{javascript}
+<table{class}>
+<!-- BEGIN label_2 --><tr><th>{label_2}</th><!-- END label_2 -->
+<!-- BEGIN label_3 --><th>&nbsp;</th><th>{label_3}</th></tr><!-- END label_3 -->
+<tr>
+  <td valign="top">{unselected}</td>
+  <td align="center">{add}<br /><br />{remove}</td>
+  <td valign="top">{selected}</td>
+</tr>
+</table>
+');
+
+        $group->setButtonAttributes('add', array('class' => 'btn arrowr'));
+        $group->setButtonAttributes('remove', array('class' => 'btn arrowl'));
+    }
+
     /**
      * @return string
      */
@@ -476,14 +496,16 @@ EOT;
             <div class="form-group">
                 <label class="col-sm-2 control-label">
                     <!-- BEGIN required -->
-                    <span class="form_required">*</span> <!-- END required -->{label}
+                    <span class="form_required">*</span> <!-- END required -->
+                    {label}
                 </label>
                 <div class="col-sm-10">
                     <table cellpadding="0" cellspacing="0">
                         <tr>
                             <!-- BEGIN error -->
                             <span class="form_error">{error}</span>
-                            <br /><!-- END error -->	<td>{element}</td>
+                            <br /><!-- END error -->
+                            <td>{element}</td>
                         </tr>
                     </table>
                 </div>

+ 2 - 2
main/session/session_add.php

@@ -136,13 +136,13 @@ $(function() {
         }
     });
 
-    access_start_date_content = $("#access_end_date").val();
+    /*access_start_date_content = $("#access_end_date").val();
 
     if (access_start_date_content.length > 0) {
         $("#visibility_container").show();
     } else {
         $("#visibility_container").hide();
-    }
+    }*/
 
     $("#access_end_date").datetimepicker({
         dateFormat: "yy-mm-dd",