Completed
Pull Request — 1.11.x (#1661)
by José
27:18
created
main/exercise/hotspot.class.php 1 patch
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -12,31 +12,31 @@  discard block
 block discarded – undo
12 12
  **/
13 13
 class HotSpot extends Question
14 14
 {
15
-	public static $typePicture = 'hotspot.png';
16
-	public static $explanationLangVar = 'HotSpot';
15
+    public static $typePicture = 'hotspot.png';
16
+    public static $explanationLangVar = 'HotSpot';
17 17
 
18 18
     /**
19 19
      * HotSpot constructor.
20 20
      */
21
-	public function __construct()
22
-	{
23
-		parent::__construct();
24
-		$this->type = HOT_SPOT;
25
-	}
26
-
27
-	public function display()
28
-	{
29
-	}
30
-
31
-	/**
32
-	 * @param FormValidator $form
33
-	 * @param int $fck_config
34
-	 */
35
-	public function createForm (&$form, $fck_config=0)
36
-	{
37
-		parent::createForm($form, $fck_config);
38
-
39
-		if (!isset($_GET['editQuestion'])) {
21
+    public function __construct()
22
+    {
23
+        parent::__construct();
24
+        $this->type = HOT_SPOT;
25
+    }
26
+
27
+    public function display()
28
+    {
29
+    }
30
+
31
+    /**
32
+     * @param FormValidator $form
33
+     * @param int $fck_config
34
+     */
35
+    public function createForm (&$form, $fck_config=0)
36
+    {
37
+        parent::createForm($form, $fck_config);
38
+
39
+        if (!isset($_GET['editQuestion'])) {
40 40
             $form->addElement(
41 41
                 'file',
42 42
                 'imageUpload',
@@ -46,54 +46,54 @@  discard block
 block discarded – undo
46 46
                 )
47 47
             );
48 48
 
49
-			// setting the save button here and not in the question class.php
50
-			// Saving a question
51
-			$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
52
-			//$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
53
-			$form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif'));
54
-			$form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile');
55
-		} else {
56
-			// setting the save button here and not in the question class.php
57
-			// Editing a question
58
-			$form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion');
59
-		}
60
-	}
61
-
62
-	/**
63
-	 * @param FormValidator $form
64
-	 * @param null $objExercise
65
-	 * @return null|false
66
-	 */
67
-	public function processCreation($form, $objExercise = null)
68
-	{
69
-		$file_info = $form->getSubmitValue('imageUpload');
70
-		$_course = api_get_course_info();
71
-		parent::processCreation($form, $objExercise);
72
-
73
-		if(!empty($file_info['tmp_name'])) {
74
-			$this->uploadPicture($file_info['tmp_name'], $file_info['name']);
75
-			$documentPath  = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
76
-			$picturePath   = $documentPath.'/images';
77
-
78
-			// fixed width ang height
79
-			if (file_exists($picturePath.'/'.$this->picture)) {
80
-				$this->resizePicture('width', 800);
81
-				$this->save();
82
-			} else {
83
-				return false;
84
-			}
85
-		}
86
-	}
87
-
88
-	function createAnswersForm($form)
89
-	{
90
-		// nothing
91
-	}
92
-
93
-	function processAnswersCreation($form)
94
-	{
95
-		// nothing
96
-	}
49
+            // setting the save button here and not in the question class.php
50
+            // Saving a question
51
+            $form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
52
+            //$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
53
+            $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif'));
54
+            $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile');
55
+        } else {
56
+            // setting the save button here and not in the question class.php
57
+            // Editing a question
58
+            $form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion');
59
+        }
60
+    }
61
+
62
+    /**
63
+     * @param FormValidator $form
64
+     * @param null $objExercise
65
+     * @return null|false
66
+     */
67
+    public function processCreation($form, $objExercise = null)
68
+    {
69
+        $file_info = $form->getSubmitValue('imageUpload');
70
+        $_course = api_get_course_info();
71
+        parent::processCreation($form, $objExercise);
72
+
73
+        if(!empty($file_info['tmp_name'])) {
74
+            $this->uploadPicture($file_info['tmp_name'], $file_info['name']);
75
+            $documentPath  = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
76
+            $picturePath   = $documentPath.'/images';
77
+
78
+            // fixed width ang height
79
+            if (file_exists($picturePath.'/'.$this->picture)) {
80
+                $this->resizePicture('width', 800);
81
+                $this->save();
82
+            } else {
83
+                return false;
84
+            }
85
+        }
86
+    }
87
+
88
+    function createAnswersForm($form)
89
+    {
90
+        // nothing
91
+    }
92
+
93
+    function processAnswersCreation($form)
94
+    {
95
+        // nothing
96
+    }
97 97
 }
98 98
 
99 99
 /**
@@ -101,38 +101,38 @@  discard block
 block discarded – undo
101 101
  */
102 102
 class HotSpotDelineation extends HotSpot
103 103
 {
104
-	public static $typePicture = 'hotspot-delineation.png';
105
-	public static $explanationLangVar = 'HotspotDelineation';
104
+    public static $typePicture = 'hotspot-delineation.png';
105
+    public static $explanationLangVar = 'HotspotDelineation';
106 106
 
107 107
     /**
108 108
      * HotSpotDelineation constructor.
109 109
      */
110
-	public function __construct()
111
-	{
112
-		parent::__construct();
113
-		$this -> type = HOT_SPOT_DELINEATION;
114
-
115
-	}
116
-
117
-	function createForm(&$form, $fck_config=0)
118
-	{
119
-		parent::createForm ($form, $fck_config);
120
-	}
121
-
122
-	function processCreation ($form, $objExercise = null)
123
-	{
124
-		$file_info = $form -> getSubmitValue('imageUpload');
125
-		parent::processCreation ($form, $objExercise);
126
-	}
127
-
128
-	function createAnswersForm ($form)
129
-	{
130
-		parent::createAnswersForm ($form);
131
-	}
132
-
133
-	function processAnswersCreation ($form)
134
-	{
135
-		parent::processAnswersCreation ($form);
136
-	}
110
+    public function __construct()
111
+    {
112
+        parent::__construct();
113
+        $this -> type = HOT_SPOT_DELINEATION;
114
+
115
+    }
116
+
117
+    function createForm(&$form, $fck_config=0)
118
+    {
119
+        parent::createForm ($form, $fck_config);
120
+    }
121
+
122
+    function processCreation ($form, $objExercise = null)
123
+    {
124
+        $file_info = $form -> getSubmitValue('imageUpload');
125
+        parent::processCreation ($form, $objExercise);
126
+    }
127
+
128
+    function createAnswersForm ($form)
129
+    {
130
+        parent::createAnswersForm ($form);
131
+    }
132
+
133
+    function processAnswersCreation ($form)
134
+    {
135
+        parent::processAnswersCreation ($form);
136
+    }
137 137
 }
138 138
 
Please login to merge, or discard this patch.
main/inc/lib/grade_model.lib.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
     /**
52 52
      * Displays the title + grid
53 53
      */
54
-	public function display()
54
+    public function display()
55 55
     {
56
-		// action links
57
-		echo '<div class="actions" style="margin-bottom:20px">';
56
+        // action links
57
+        echo '<div class="actions" style="margin-bottom:20px">';
58 58
         echo '<a href="grade_models.php">'.Display::return_icon('back.png',get_lang('Back'),'', ICON_SIZE_MEDIUM).'</a>';
59
-		echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', ICON_SIZE_MEDIUM).'</a>';
60
-		echo '</div>';
59
+        echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', ICON_SIZE_MEDIUM).'</a>';
60
+        echo '</div>';
61 61
         echo Display::grid_html('grade_model');
62
-	}
62
+    }
63 63
 
64 64
     /**
65 65
      * Returns a Form validator Obj
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         }
118 118
 
119 119
         $form->addElement('hidden', 'maxvalue', '100');
120
-		$form->addElement('hidden', 'minvalue', '0');
120
+        $form->addElement('hidden', 'minvalue', '0');
121 121
         $renderer = & $form->defaultRenderer();
122 122
 
123 123
         $component_array = array();
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         // Setting the rules
193 193
         $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
194 194
 
195
-		return $form;
195
+        return $form;
196 196
     }
197 197
 
198 198
     /**
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
      */
256 256
     public function delete($id)
257 257
     {
258
-	    parent::delete($id);
258
+        parent::delete($id);
259 259
     }
260 260
 
261 261
     /**
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
     /**
310 310
      * GradeModelComponents constructor.
311 311
      */
312
-	public function __construct()
312
+    public function __construct()
313 313
     {
314 314
         parent::__construct();
315 315
         $this->table = Database::get_main_table(TABLE_GRADE_MODEL_COMPONENTS);
316
-	}
316
+    }
317 317
 
318 318
     /**
319 319
      * @param array $params
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      */
323 323
     public function save($params, $show_query = false)
324 324
     {
325
-	    $id = parent::save($params, $show_query);
325
+        $id = parent::save($params, $show_query);
326 326
 
327 327
         return $id;
328 328
     }
Please login to merge, or discard this patch.
main/inc/lib/dashboard.lib.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
             }
308 308
         }
309 309
 
310
-		return $block_data;
311
-	}
310
+        return $block_data;
311
+    }
312 312
 
313 313
     /**
314 314
      * get data about enabled dashboard block (stored insise block table)
@@ -491,42 +491,42 @@  discard block
 block discarded – undo
491 491
         return $data;
492 492
     }
493 493
 
494
-	/**
495
-	 * This function update extra user blocks data after closing a dashboard block
496
-	 * @param int 		User id
497
-	 * @param string	plugin path
498
-	 * @param integer $user_id
499
-	 * @return bool
500
-	 */
501
-	public static function close_user_block($user_id, $path)
494
+    /**
495
+     * This function update extra user blocks data after closing a dashboard block
496
+     * @param int 		User id
497
+     * @param string	plugin path
498
+     * @param integer $user_id
499
+     * @return bool
500
+     */
501
+    public static function close_user_block($user_id, $path)
502 502
     {
503
-		$enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path);
504
-		$user_block_data = self::get_user_block_data($user_id);
505
-
506
-		foreach ($enabled_dashboard_blocks as $enabled_block) {
507
-			unset($user_block_data[$enabled_block['id']]);
508
-		}
509
-
510
-		// get columns and blocks id for updating extra user data
511
-		$columns = array();
512
-		$user_blocks_id = array();
513
-		foreach ($user_block_data as $data) {
514
-			$user_blocks_id[$data['block_id']] = true;
515
-			$columns[$data['block_id']] = $data['column'];
516
-		}
517
-
518
-		// update extra user blocks data
519
-		$upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns);
520
-
521
-		return $upd_extra_field;
522
-	}
523
-
524
-	/**
525
-	 * get links for styles from dashboard plugins
526
-	 * @return string   links
527
-	 */
528
-	public static function get_links_for_styles_from_dashboard_plugins() {
529
-
530
-		return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL;
531
-	}
503
+        $enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path);
504
+        $user_block_data = self::get_user_block_data($user_id);
505
+
506
+        foreach ($enabled_dashboard_blocks as $enabled_block) {
507
+            unset($user_block_data[$enabled_block['id']]);
508
+        }
509
+
510
+        // get columns and blocks id for updating extra user data
511
+        $columns = array();
512
+        $user_blocks_id = array();
513
+        foreach ($user_block_data as $data) {
514
+            $user_blocks_id[$data['block_id']] = true;
515
+            $columns[$data['block_id']] = $data['column'];
516
+        }
517
+
518
+        // update extra user blocks data
519
+        $upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns);
520
+
521
+        return $upd_extra_field;
522
+    }
523
+
524
+    /**
525
+     * get links for styles from dashboard plugins
526
+     * @return string   links
527
+     */
528
+    public static function get_links_for_styles_from_dashboard_plugins() {
529
+
530
+        return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL;
531
+    }
532 532
 }
Please login to merge, or discard this patch.
main/calendar/ical_export.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
 $event = $agenda->get_event($id);
44 44
 
45 45
 if (!empty($event)) {
46
-	define('ICAL_LANG', api_get_language_isocode());
46
+    define('ICAL_LANG', api_get_language_isocode());
47 47
 
48 48
     $ical = new vcalendar();
49 49
     $ical->setConfig('unique_id',api_get_path(WEB_PATH));
Please login to merge, or discard this patch.
main/admin/ldap_users_list.php 1 patch
Indentation   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 // Login as ...
21 21
 if ($action == "login_as" && !empty ($login_as_user_id))
22 22
 {
23
-	login_user($login_as_user_id);
23
+    login_user($login_as_user_id);
24 24
 }
25 25
 
26 26
 //if we already have a session id and a user...
@@ -37,150 +37,150 @@  discard block
 block discarded – undo
37 37
 
38 38
 if (isset ($_GET['action']))
39 39
 {
40
-	$check = Security::check_token('get');
41
-	if($check)
42
-	{
43
-		switch ($_GET['action'])
44
-		{
45
-			case 'show_message' :
46
-				Display :: display_header($tool_name);
47
-				Display :: display_normal_message($_GET['message']);
48
-				break;
49
-			case 'delete_user' :
50
-				Display :: display_header($tool_name);
51
-				if ($user_id != $_user['user_id'] && UserManager :: delete_user($_GET['user_id']))
52
-				{
53
-					Display :: display_normal_message(get_lang('UserDeleted'));
54
-				}
55
-				else
56
-				{
57
-					Display :: display_error_message(get_lang('CannotDeleteUser'));
58
-				}
59
-				break;
60
-			case 'lock' :
61
-				Display :: display_header($tool_name);
62
-				$message=lock_unlock_user('lock',$_GET['user_id']);
63
-				Display :: display_normal_message($message);
64
-				break;
65
-			case 'unlock';
66
-				Display :: display_header($tool_name);
67
-				$message=lock_unlock_user('unlock',$_GET['user_id']);
68
-				Display :: display_normal_message($message);
69
-				break;
70
-			case 'add_user';
71
-				$id=$_GET['id'];
72
-				$UserList=array();
73
-				$userid_match_login = array();
74
-				foreach ($id as $user_id) {
75
-					$tmp = ldap_add_user($user_id);
76
-					$UserList[]= $tmp;
77
-					$userid_match_login[$tmp] = $user_id;
78
-				}
79
-				if (isset($_GET['id_session']) && ($_GET['id_session'] == strval(intval($_GET['id_session']))) && ($_GET['id_session']>0)) {
80
-					ldap_add_user_to_session($UserList, $_GET['id_session']);
81
-					header('Location: resume_session.php?id_session='.intval($_GET['id_session']));
82
-				} else {
83
-					Display :: display_header($tool_name);
84
-					if(count($userid_match_login)>0)
85
-					{
86
-						$message=get_lang('LDAPUsersAddedOrUpdated').':<br />';
87
-						foreach($userid_match_login as $user_id => $login)
88
-						{
89
-							$message .= '- '.$login.'<br />';
90
-						}
91
-					}
92
-					else
93
-					{
94
-						$message=get_lang('NoUserAdded');
95
-					}
96
-					Display :: display_normal_message($message,false);
97
-				}
98
-				break;
99
-			default :
100
-				Display :: display_header($tool_name);
101
-		}
102
-		Security::clear_token();
103
-	}
104
-	else
105
-	{
106
-		Display::display_header($tool_name);
107
-	}
40
+    $check = Security::check_token('get');
41
+    if($check)
42
+    {
43
+        switch ($_GET['action'])
44
+        {
45
+            case 'show_message' :
46
+                Display :: display_header($tool_name);
47
+                Display :: display_normal_message($_GET['message']);
48
+                break;
49
+            case 'delete_user' :
50
+                Display :: display_header($tool_name);
51
+                if ($user_id != $_user['user_id'] && UserManager :: delete_user($_GET['user_id']))
52
+                {
53
+                    Display :: display_normal_message(get_lang('UserDeleted'));
54
+                }
55
+                else
56
+                {
57
+                    Display :: display_error_message(get_lang('CannotDeleteUser'));
58
+                }
59
+                break;
60
+            case 'lock' :
61
+                Display :: display_header($tool_name);
62
+                $message=lock_unlock_user('lock',$_GET['user_id']);
63
+                Display :: display_normal_message($message);
64
+                break;
65
+            case 'unlock';
66
+                Display :: display_header($tool_name);
67
+                $message=lock_unlock_user('unlock',$_GET['user_id']);
68
+                Display :: display_normal_message($message);
69
+                break;
70
+            case 'add_user';
71
+                $id=$_GET['id'];
72
+                $UserList=array();
73
+                $userid_match_login = array();
74
+                foreach ($id as $user_id) {
75
+                    $tmp = ldap_add_user($user_id);
76
+                    $UserList[]= $tmp;
77
+                    $userid_match_login[$tmp] = $user_id;
78
+                }
79
+                if (isset($_GET['id_session']) && ($_GET['id_session'] == strval(intval($_GET['id_session']))) && ($_GET['id_session']>0)) {
80
+                    ldap_add_user_to_session($UserList, $_GET['id_session']);
81
+                    header('Location: resume_session.php?id_session='.intval($_GET['id_session']));
82
+                } else {
83
+                    Display :: display_header($tool_name);
84
+                    if(count($userid_match_login)>0)
85
+                    {
86
+                        $message=get_lang('LDAPUsersAddedOrUpdated').':<br />';
87
+                        foreach($userid_match_login as $user_id => $login)
88
+                        {
89
+                            $message .= '- '.$login.'<br />';
90
+                        }
91
+                    }
92
+                    else
93
+                    {
94
+                        $message=get_lang('NoUserAdded');
95
+                    }
96
+                    Display :: display_normal_message($message,false);
97
+                }
98
+                break;
99
+            default :
100
+                Display :: display_header($tool_name);
101
+        }
102
+        Security::clear_token();
103
+    }
104
+    else
105
+    {
106
+        Display::display_header($tool_name);
107
+    }
108 108
 }
109 109
 else
110 110
 {
111
-	Display::display_header($tool_name);
111
+    Display::display_header($tool_name);
112 112
 }
113 113
 if (isset ($_POST['action']))
114 114
 {
115
-	$check = Security::check_token('get');
116
-	if($check)
117
-	{
118
-		switch ($_POST['action'])
119
-		{
120
-			case 'delete' :
121
-				$number_of_selected_users = count($_POST['id']);
122
-				$number_of_deleted_users = 0;
123
-				foreach ($_POST['id'] as $index => $user_id)
124
-				{
125
-					if($user_id != $_user['user_id'])
126
-					{
127
-						if(UserManager :: delete_user($user_id))
128
-						{
129
-							$number_of_deleted_users++;
130
-						}
131
-					}
132
-				}
133
-				if($number_of_selected_users == $number_of_deleted_users)
134
-				{
135
-					Display :: display_normal_message(get_lang('SelectedUsersDeleted'));
136
-				}
137
-				else
138
-				{
139
-					Display :: display_error_message(get_lang('SomeUsersNotDeleted'));
140
-				}
141
-				break;
142
-			case 'add_user' :
143
-				$number_of_selected_users = count($_POST['id']);
144
-				$number_of_added_users = 0;
145
-				$UserList=array();
146
-				foreach ($_POST['id'] as $index => $user_id)
147
-				{
148
-					if($user_id != $_user['user_id'])
149
-					{
150
-						$UserList[] = ldap_add_user($user_id);
151
-					}
152
-				}
153
-				if (isset($_GET['id_session']) && (trim($_GET['id_session'])!=""))
154
-					addUserToSession($UserList, $_GET['id_session']);
155
-				if(count($UserList)>0)
156
-				{
157
-					Display :: display_normal_message(count($UserList)." ".get_lang('LDAPUsersAdded'));
158
-				}
159
-				else
160
-				{
161
-					Display :: display_normal_message(get_lang('NoUserAdded'));
162
-				}
163
-				break;
115
+    $check = Security::check_token('get');
116
+    if($check)
117
+    {
118
+        switch ($_POST['action'])
119
+        {
120
+            case 'delete' :
121
+                $number_of_selected_users = count($_POST['id']);
122
+                $number_of_deleted_users = 0;
123
+                foreach ($_POST['id'] as $index => $user_id)
124
+                {
125
+                    if($user_id != $_user['user_id'])
126
+                    {
127
+                        if(UserManager :: delete_user($user_id))
128
+                        {
129
+                            $number_of_deleted_users++;
130
+                        }
131
+                    }
132
+                }
133
+                if($number_of_selected_users == $number_of_deleted_users)
134
+                {
135
+                    Display :: display_normal_message(get_lang('SelectedUsersDeleted'));
136
+                }
137
+                else
138
+                {
139
+                    Display :: display_error_message(get_lang('SomeUsersNotDeleted'));
140
+                }
141
+                break;
142
+            case 'add_user' :
143
+                $number_of_selected_users = count($_POST['id']);
144
+                $number_of_added_users = 0;
145
+                $UserList=array();
146
+                foreach ($_POST['id'] as $index => $user_id)
147
+                {
148
+                    if($user_id != $_user['user_id'])
149
+                    {
150
+                        $UserList[] = ldap_add_user($user_id);
151
+                    }
152
+                }
153
+                if (isset($_GET['id_session']) && (trim($_GET['id_session'])!=""))
154
+                    addUserToSession($UserList, $_GET['id_session']);
155
+                if(count($UserList)>0)
156
+                {
157
+                    Display :: display_normal_message(count($UserList)." ".get_lang('LDAPUsersAdded'));
158
+                }
159
+                else
160
+                {
161
+                    Display :: display_normal_message(get_lang('NoUserAdded'));
162
+                }
163
+                break;
164 164
 
165
-		}
166
-		Security::clear_token();
167
-	}
165
+        }
166
+        Security::clear_token();
167
+    }
168 168
 }
169 169
 
170 170
 $form = new FormValidator('advanced_search','get');
171 171
 $form->addText('keyword_username',get_lang('LoginName'),false);
172 172
 if (api_is_western_name_order())
173 173
 {
174
-	$form->addText('keyword_firstname', get_lang('FirstName'), false);
175
-	$form->addText('keyword_lastname', get_lang('LastName'), false);
174
+    $form->addText('keyword_firstname', get_lang('FirstName'), false);
175
+    $form->addText('keyword_lastname', get_lang('LastName'), false);
176 176
 }
177 177
 else
178 178
 {
179
-	$form->addText('keyword_lastname',get_lang('LastName'),false);
180
-	$form->addText('keyword_firstname',get_lang('FirstName'),false);
179
+    $form->addText('keyword_lastname',get_lang('LastName'),false);
180
+    $form->addText('keyword_firstname',get_lang('FirstName'),false);
181 181
 }
182 182
 if (isset($_GET['id_session']))
183
-	$form->addElement('hidden','id_session',$_GET['id_session']);
183
+    $form->addElement('hidden','id_session',$_GET['id_session']);
184 184
 
185 185
 $type = array();
186 186
 $type["all"] = get_lang('All');
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 $parameters['keyword_lastname'] = @$_GET['keyword_lastname'] ?: null;
203 203
 $parameters['keyword_email'] = @$_GET['keyword_email'] ?: null;
204 204
 if (isset($_GET['id_session']))
205
-	$parameters['id_session'] = $_GET['id_session'];
205
+    $parameters['id_session'] = $_GET['id_session'];
206 206
 // Create a sortable table with user-data
207 207
 
208 208
 $parameters['sec_token'] = Security::get_token();
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
 $table->set_header(1, get_lang('LoginName'));
213 213
 if (api_is_western_name_order())
214 214
 {
215
-	$table->set_header(2, get_lang('FirstName'));
216
-	$table->set_header(3, get_lang('LastName'));
215
+    $table->set_header(2, get_lang('FirstName'));
216
+    $table->set_header(3, get_lang('LastName'));
217 217
 }
218 218
 else
219 219
 {
220
-	$table->set_header(2, get_lang('LastName'));
221
-	$table->set_header(3, get_lang('FirstName'));
220
+    $table->set_header(2, get_lang('LastName'));
221
+    $table->set_header(3, get_lang('FirstName'));
222 222
 }
223 223
 $table->set_header(4, get_lang('Email'));
224 224
 $table->set_header(5, get_lang('Actions'));
Please login to merge, or discard this patch.
main/inc/lib/add_courses_to_session_functions.lib.php 1 patch
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -6,47 +6,47 @@  discard block
 block discarded – undo
6 6
  */
7 7
 class AddCourseToSession
8 8
 {
9
-	/**
10
-	 * Searches a course, given a search string and a type of search box
11
-	 * @param string $needle Search string
12
-	 * @param string $type Type of search box ('single' or anything else)
13
-	 * @return xajaxResponse XajaxResponse
14
-	 * @assert ('abc', 'single') !== null
15
-	 * @assert ('abc', 'multiple') !== null
16
-	 */
17
-	public static function search_courses($needle, $type)
18
-	{
19
-		global $tbl_session_rel_course, $id_session;
9
+    /**
10
+     * Searches a course, given a search string and a type of search box
11
+     * @param string $needle Search string
12
+     * @param string $type Type of search box ('single' or anything else)
13
+     * @return xajaxResponse XajaxResponse
14
+     * @assert ('abc', 'single') !== null
15
+     * @assert ('abc', 'multiple') !== null
16
+     */
17
+    public static function search_courses($needle, $type)
18
+    {
19
+        global $tbl_session_rel_course, $id_session;
20 20
         $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
21
-		$course_title = null;
22
-		$xajax_response = new xajaxResponse();
23
-		$return = '';
24
-		if(!empty($needle) && !empty($type)) {
25
-			// xajax send utf8 datas... datas in db can be non-utf8 datas
26
-			$charset = api_get_system_encoding();
27
-			$needle = api_convert_encoding($needle, $charset, 'utf-8');
21
+        $course_title = null;
22
+        $xajax_response = new xajaxResponse();
23
+        $return = '';
24
+        if(!empty($needle) && !empty($type)) {
25
+            // xajax send utf8 datas... datas in db can be non-utf8 datas
26
+            $charset = api_get_system_encoding();
27
+            $needle = api_convert_encoding($needle, $charset, 'utf-8');
28 28
 
29
-			$cond_course_code = '';
30
-			if (!empty($id_session)) {
31
-				$id_session = intval($id_session);
32
-				// check course_code from session_rel_course table
33
-				$sql = 'SELECT c_id FROM '.$tbl_session_rel_course.'
29
+            $cond_course_code = '';
30
+            if (!empty($id_session)) {
31
+                $id_session = intval($id_session);
32
+                // check course_code from session_rel_course table
33
+                $sql = 'SELECT c_id FROM '.$tbl_session_rel_course.'
34 34
 						WHERE session_id = '.$id_session;
35
-				$res = Database::query($sql);
36
-				$course_codes = '';
37
-				if (Database::num_rows($res) > 0) {
38
-					while ($row = Database::fetch_row($res)) {
39
-						$course_codes .= '\''.$row[0].'\',';
40
-					}
41
-					$course_codes = substr($course_codes,0,(strlen($course_codes)-1));
35
+                $res = Database::query($sql);
36
+                $course_codes = '';
37
+                if (Database::num_rows($res) > 0) {
38
+                    while ($row = Database::fetch_row($res)) {
39
+                        $course_codes .= '\''.$row[0].'\',';
40
+                    }
41
+                    $course_codes = substr($course_codes,0,(strlen($course_codes)-1));
42 42
 
43
-					$cond_course_code = ' AND course.id NOT IN('.$course_codes.') ';
44
-				}
45
-			}
43
+                    $cond_course_code = ' AND course.id NOT IN('.$course_codes.') ';
44
+                }
45
+            }
46 46
 
47 47
             if ($type == 'single') {
48
-				// search users where username or firstname or lastname begins likes $needle
49
-				$sql = 'SELECT
48
+                // search users where username or firstname or lastname begins likes $needle
49
+                $sql = 'SELECT
50 50
                             course.id,
51 51
 						 	course.visual_code,
52 52
 						 	course.title,
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
 						WHERE
59 59
 							course.visual_code LIKE "'.$needle.'%" OR
60 60
 							course.title LIKE "'.$needle.'%"';
61
-			} else {
61
+            } else {
62 62
                 $sql = 'SELECT course.id, course.visual_code, course.title
63 63
 						FROM '.$tbl_course.' course
64 64
 						WHERE
65 65
 							course.visual_code LIKE "'.$needle.'%" '.$cond_course_code.'
66 66
 						ORDER BY course.code ';
67
-			}
67
+            }
68 68
 
69
-			if (api_is_multiple_url_enabled()) {
70
-				$tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
71
-				$access_url_id = api_get_current_access_url_id();
72
-				if ($access_url_id != -1){
69
+            if (api_is_multiple_url_enabled()) {
70
+                $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
71
+                $access_url_id = api_get_current_access_url_id();
72
+                if ($access_url_id != -1){
73 73
 
74
-					if ($type=='single') {
75
-						$sql = 'SELECT
74
+                    if ($type=='single') {
75
+                        $sql = 'SELECT
76 76
                                     course.id,
77 77
 						            course.visual_code,
78 78
 						            course.title,
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 									access_url_id = '.$access_url_id.' AND
88 88
 									(course.visual_code LIKE "'.$needle.'%" OR
89 89
 									course.title LIKE "'.$needle.'%" )';
90
-					} else {
90
+                    } else {
91 91
                         $sql = 'SELECT course.id, course.visual_code, course.title
92 92
 								FROM '.$tbl_course.' course, '.$tbl_course_rel_access_url.' url_course
93 93
 								WHERE
@@ -95,32 +95,32 @@  discard block
 block discarded – undo
95 95
 									access_url_id = '.$access_url_id.' AND
96 96
 									course.visual_code LIKE "'.$needle.'%" '.$cond_course_code.'
97 97
 								ORDER BY course.code ';
98
-					}
99
-				}
100
-			}
98
+                    }
99
+                }
100
+            }
101 101
 
102
-			$rs = Database::query($sql);
103
-			$course_list = array();
102
+            $rs = Database::query($sql);
103
+            $course_list = array();
104 104
             if ($type == 'single') {
105
-				while ($course = Database :: fetch_array($rs)) {
106
-					$course_list[] = $course['code'];
107
-					$course_title=str_replace("'","\'",$course_title);
105
+                while ($course = Database :: fetch_array($rs)) {
106
+                    $course_list[] = $course['code'];
107
+                    $course_title=str_replace("'","\'",$course_title);
108 108
                     $return .= '<a href="javascript: void(0);" onclick="javascript: add_course_to_session(\''.$course['id'].'\',\''.$course_title.' ('.$course['visual_code'].')'.'\')">'.$course['title'].' ('.$course['visual_code'].')</a><br />';
109
-				}
110
-				$xajax_response -> addAssign('ajax_list_courses_single','innerHTML',api_utf8_encode($return));
111
-			} else {
112
-				$return .= '<select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" style="width:340px;">';
113
-				while($course = Database :: fetch_array($rs)) {
114
-					$course_list[] = $course['code'];
115
-					$course_title=str_replace("'","\'",$course_title);
109
+                }
110
+                $xajax_response -> addAssign('ajax_list_courses_single','innerHTML',api_utf8_encode($return));
111
+            } else {
112
+                $return .= '<select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" style="width:340px;">';
113
+                while($course = Database :: fetch_array($rs)) {
114
+                    $course_list[] = $course['code'];
115
+                    $course_title=str_replace("'","\'",$course_title);
116 116
                     $return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['title'].' ('.$course['visual_code'].')',ENT_QUOTES).'">'.$course['title'].' ('.$course['visual_code'].')</option>';
117
-				}
118
-				$return .= '</select>';
119
-				$xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return));
120
-			}
121
-		}
122
-		$_SESSION['course_list'] = $course_list;
117
+                }
118
+                $return .= '</select>';
119
+                $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return));
120
+            }
121
+        }
122
+        $_SESSION['course_list'] = $course_list;
123 123
 
124
-		return $xajax_response;
125
-	}
124
+        return $xajax_response;
125
+    }
126 126
 }
Please login to merge, or discard this patch.
main/exercise/hotpotatoes_exercise_report.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 }
45 45
 
46 46
 if (!$is_allowedToEdit) {
47
-   // api_not_allowed();
47
+    // api_not_allowed();
48 48
 }
49 49
 
50 50
 if (!empty($_REQUEST['path'])) {
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
         get_lang('Actions')
190 190
     );
191 191
 
192
-  // Column config
193
-  // @todo fix search firstname/lastname that doesn't work. rmove search for the moment
192
+    // Column config
193
+    // @todo fix search firstname/lastname that doesn't work. rmove search for the moment
194 194
     $column_model = array(
195 195
         array('name' => 'firstname', 'index' => 'firstname', 'width' => '50', 'align' => 'left', 'search' => 'false'),
196 196
         array(
Please login to merge, or discard this patch.
main/admin/sub_language.php 1 patch
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -66,30 +66,30 @@  discard block
 block discarded – undo
66 66
 $sublanguage_folder_error = false;
67 67
 
68 68
 if (isset($_GET['id']) && $_GET['id']==strval(intval($_GET['id']))) {
69
-	$language_name              = SubLanguageManager::get_name_of_language_by_id ($_GET['id']);
70
-	$sub_language_name          = SubLanguageManager::get_name_of_language_by_id ($_GET['sub_language_id']);
71
-	$all_data_of_language       = SubLanguageManager::get_all_information_of_language($_GET['id']);
72
-	$all_data_of_sublanguage    = SubLanguageManager::get_all_information_of_language($_GET['sub_language_id']);
73
-	$sub_language_file          = api_get_path(SYS_LANG_PATH).$all_data_of_sublanguage['dokeos_folder'];
69
+    $language_name              = SubLanguageManager::get_name_of_language_by_id ($_GET['id']);
70
+    $sub_language_name          = SubLanguageManager::get_name_of_language_by_id ($_GET['sub_language_id']);
71
+    $all_data_of_language       = SubLanguageManager::get_all_information_of_language($_GET['id']);
72
+    $all_data_of_sublanguage    = SubLanguageManager::get_all_information_of_language($_GET['sub_language_id']);
73
+    $sub_language_file          = api_get_path(SYS_LANG_PATH).$all_data_of_sublanguage['dokeos_folder'];
74 74
 
75
-	if (!file_exists($sub_language_file) || !is_writable($sub_language_file)) {
76
-		$sublanguage_folder_error = $sub_language_file.' '.get_lang('IsNotWritable');
77
-	}
78
-	if (SubLanguageManager::check_if_exist_language_by_id($_GET['id'])===true) {
79
-		$language_id_exist = true;
80
-	} else {
81
-		$language_id_exist = false;
82
-	}
75
+    if (!file_exists($sub_language_file) || !is_writable($sub_language_file)) {
76
+        $sublanguage_folder_error = $sub_language_file.' '.get_lang('IsNotWritable');
77
+    }
78
+    if (SubLanguageManager::check_if_exist_language_by_id($_GET['id'])===true) {
79
+        $language_id_exist = true;
80
+    } else {
81
+        $language_id_exist = false;
82
+    }
83 83
 } else {
84
-	$language_name='';
85
-	$language_id_exist=false;
84
+    $language_name='';
85
+    $language_id_exist=false;
86 86
 }
87 87
 
88 88
 $intro = sprintf(get_lang('RegisterTermsOfSubLanguageForX'), strtolower($sub_language_name));
89 89
 $path_folder = api_get_path(SYS_LANG_PATH).$all_data_of_language['dokeos_folder'];
90 90
 
91 91
 if (!is_dir($path_folder) || strlen($all_data_of_language['dokeos_folder'])==0) {
92
-	api_not_allowed(true);
92
+    api_not_allowed(true);
93 93
 }
94 94
 
95 95
 Display :: display_header($language_name);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 echo $html;
115 115
 echo '<br /><br /><br />';
116 116
 if (!empty($sublanguage_folder_error)) {
117
-	Display::display_warning_message($sublanguage_folder_error);
117
+    Display::display_warning_message($sublanguage_folder_error);
118 118
 }
119 119
 echo '<div id="div_message_information_id">&nbsp;</div>';
120 120
 
@@ -128,186 +128,186 @@  discard block
 block discarded – undo
128 128
  * @return array
129 129
  */
130 130
 function search_language_term(
131
-	$term,
132
-	$search_in_variable = true,
133
-	$search_in_english = true,
134
-	$search_in_parent = true,
135
-	$search_in_sub_language = true
131
+    $term,
132
+    $search_in_variable = true,
133
+    $search_in_english = true,
134
+    $search_in_parent = true,
135
+    $search_in_sub_language = true
136 136
 ) {
137
-	//These the $_REQUEST['id'] and the $_REQUEST['sub_language_id'] variables are process in global.inc.php (LOAD LANGUAGE FILES SECTION)
138
-	/*
137
+    //These the $_REQUEST['id'] and the $_REQUEST['sub_language_id'] variables are process in global.inc.php (LOAD LANGUAGE FILES SECTION)
138
+    /*
139 139
 		These 4 arrays are set in global.inc.php with the condition that will be load from sub_language.php or sub_language_ajax.inc.php
140 140
 		$english_language_array
141 141
 		$parent_language_array
142 142
 		$sub_language_array
143 143
 		$language_files_to_load
144 144
 	*/
145
-	global $language_files_to_load, $sub_language_array, $english_language_array, $parent_language_array;
146
-	$language_files_to_load_keys = array_flip($language_files_to_load);
147
-	$array_to_search = $parent_language_array;
148
-	$list_info = array();
149
-	$term='/'.Security::remove_XSS(trim($_REQUEST['txt_search_word'])).'/i';
150
-	//@todo optimize this foreach
151
-	foreach ($language_files_to_load as $lang_file) {
152
-		//searching in parent language of the sub language
153
-		if ($search_in_parent) {
154
-			$variables = $parent_language_array[$lang_file];
155
-			foreach ($variables as $parent_name_variable =>$parent_variable_value) {
156
-				//arrays are avoided
157
-				if (is_array($parent_variable_value)) {
158
-					continue;
159
-				}
160
-				$founded = false;
161
-				// searching the item in the parent tool
162
-				if (preg_match($term,$parent_variable_value)!==0) {
163
-					$founded = true;
164
-				}
165
-				if ($founded) {
166
-					//loading variable from the english array
167
-					$sub_language_name_variable = $sub_language_array[$lang_file][$parent_name_variable];
168
-					//loading variable from the english array
169
-					$english_name_variable = $english_language_array[$lang_file][$parent_name_variable];
145
+    global $language_files_to_load, $sub_language_array, $english_language_array, $parent_language_array;
146
+    $language_files_to_load_keys = array_flip($language_files_to_load);
147
+    $array_to_search = $parent_language_array;
148
+    $list_info = array();
149
+    $term='/'.Security::remove_XSS(trim($_REQUEST['txt_search_word'])).'/i';
150
+    //@todo optimize this foreach
151
+    foreach ($language_files_to_load as $lang_file) {
152
+        //searching in parent language of the sub language
153
+        if ($search_in_parent) {
154
+            $variables = $parent_language_array[$lang_file];
155
+            foreach ($variables as $parent_name_variable =>$parent_variable_value) {
156
+                //arrays are avoided
157
+                if (is_array($parent_variable_value)) {
158
+                    continue;
159
+                }
160
+                $founded = false;
161
+                // searching the item in the parent tool
162
+                if (preg_match($term,$parent_variable_value)!==0) {
163
+                    $founded = true;
164
+                }
165
+                if ($founded) {
166
+                    //loading variable from the english array
167
+                    $sub_language_name_variable = $sub_language_array[$lang_file][$parent_name_variable];
168
+                    //loading variable from the english array
169
+                    $english_name_variable = $english_language_array[$lang_file][$parent_name_variable];
170 170
 
171
-					//config buttons
172
-					/*if (strlen($english_name_variable)>1500) {
171
+                    //config buttons
172
+                    /*if (strlen($english_name_variable)>1500) {
173 173
 						$size =20;
174 174
 					} else {
175 175
 						$size =4;
176 176
 					}*/
177 177
 
178
-					$obj_text='<textarea rows="10" cols="40" name="txt|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$parent_name_variable.'" >'.$sub_language_name_variable.'</textarea>';
179
-					$obj_button='<button class="save" type="button" name="btn|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$parent_name_variable.'"  />'.get_lang('Save').'</button>';
178
+                    $obj_text='<textarea rows="10" cols="40" name="txt|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$parent_name_variable.'" >'.$sub_language_name_variable.'</textarea>';
179
+                    $obj_button='<button class="save" type="button" name="btn|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$parent_name_variable.'"  />'.get_lang('Save').'</button>';
180 180
 
181
-					$list_info[] = array(
182
-						$lang_file . '.inc.php',
183
-						$parent_name_variable,
184
-						$english_name_variable,
185
-						$parent_variable_value,
186
-						$obj_text,
187
-						$obj_button
188
-					);
189
-				}
190
-			}
191
-		}
181
+                    $list_info[] = array(
182
+                        $lang_file . '.inc.php',
183
+                        $parent_name_variable,
184
+                        $english_name_variable,
185
+                        $parent_variable_value,
186
+                        $obj_text,
187
+                        $obj_button
188
+                    );
189
+                }
190
+            }
191
+        }
192 192
 
193
-		//search in english
194
-		if ($search_in_english || $search_in_variable) {
195
-			$variables = $english_language_array[$lang_file];
196
-			foreach ($variables as $name_variable =>$variable_value) {
197
-				if (is_array($variable_value)) {
198
-					continue;
199
-				}
193
+        //search in english
194
+        if ($search_in_english || $search_in_variable) {
195
+            $variables = $english_language_array[$lang_file];
196
+            foreach ($variables as $name_variable =>$variable_value) {
197
+                if (is_array($variable_value)) {
198
+                    continue;
199
+                }
200 200
 
201
-				if (is_array($variable_value))
202
-					echo $lang_file;
203
-				$founded = false;
204
-				if ($search_in_english && $search_in_variable) {
205
-					// searching the item in the parent tool
206
-					if (preg_match($term,$variable_value)!==0 || preg_match($term,$name_variable)!==0 ) {
207
-						$founded = true;
208
-					}
209
-				} else {
210
-					if ($search_in_english) {
211
-						if (preg_match($term,$variable_value)!==0) {
212
-							$founded = true;
213
-						}
214
-					} else {
215
-						if (preg_match($term,$name_variable)!==0) {
216
-							$founded = true;
217
-						}
218
-					}
219
-				}
201
+                if (is_array($variable_value))
202
+                    echo $lang_file;
203
+                $founded = false;
204
+                if ($search_in_english && $search_in_variable) {
205
+                    // searching the item in the parent tool
206
+                    if (preg_match($term,$variable_value)!==0 || preg_match($term,$name_variable)!==0 ) {
207
+                        $founded = true;
208
+                    }
209
+                } else {
210
+                    if ($search_in_english) {
211
+                        if (preg_match($term,$variable_value)!==0) {
212
+                            $founded = true;
213
+                        }
214
+                    } else {
215
+                        if (preg_match($term,$name_variable)!==0) {
216
+                            $founded = true;
217
+                        }
218
+                    }
219
+                }
220 220
 
221
-				if ($founded) {
222
-					//loading variable from the english array
223
-					$sub_language_name_variable = null;
224
-					if (isset($sub_language_array[$lang_file][$name_variable])) {
225
-						$sub_language_name_variable = $sub_language_array[$lang_file][$name_variable];
226
-					}
227
-					$parent_variable_value = null;
228
-					if (isset($parent_language_array[$lang_file][$name_variable])) {
229
-						$parent_variable_value = $parent_language_array[$lang_file][$name_variable];
230
-					}
231
-					//config buttons
232
-					$obj_text='<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'.
233
-						$sub_language_name_variable.'
221
+                if ($founded) {
222
+                    //loading variable from the english array
223
+                    $sub_language_name_variable = null;
224
+                    if (isset($sub_language_array[$lang_file][$name_variable])) {
225
+                        $sub_language_name_variable = $sub_language_array[$lang_file][$name_variable];
226
+                    }
227
+                    $parent_variable_value = null;
228
+                    if (isset($parent_language_array[$lang_file][$name_variable])) {
229
+                        $parent_variable_value = $parent_language_array[$lang_file][$name_variable];
230
+                    }
231
+                    //config buttons
232
+                    $obj_text='<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'.
233
+                        $sub_language_name_variable.'
234 234
 						</textarea>';
235
-					$obj_button='<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'"  />'.get_lang('Save').'</button>';
235
+                    $obj_button='<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'"  />'.get_lang('Save').'</button>';
236 236
 
237
-					//loading variable from the english array
238
-					$english_name_variable = $english_language_array[$lang_file][$name_variable];
237
+                    //loading variable from the english array
238
+                    $english_name_variable = $english_language_array[$lang_file][$name_variable];
239 239
 
240
-					$list_info[] = array(
241
-						$lang_file . '.inc.php',
242
-						$name_variable,
243
-						$english_name_variable,
244
-						$parent_variable_value,
245
-						$obj_text,
246
-						$obj_button
247
-					);
248
-				}
249
-			}
250
-		}
240
+                    $list_info[] = array(
241
+                        $lang_file . '.inc.php',
242
+                        $name_variable,
243
+                        $english_name_variable,
244
+                        $parent_variable_value,
245
+                        $obj_text,
246
+                        $obj_button
247
+                    );
248
+                }
249
+            }
250
+        }
251 251
 
252
-		// Search in sub language
253
-		if ($search_in_sub_language) {
254
-			$variables = $sub_language_array[$lang_file];
255
-			foreach ($variables as $name_variable =>$variable_value) {
256
-				if (is_array($parent_variable_value)) {
257
-					continue;
258
-				}
252
+        // Search in sub language
253
+        if ($search_in_sub_language) {
254
+            $variables = $sub_language_array[$lang_file];
255
+            foreach ($variables as $name_variable =>$variable_value) {
256
+                if (is_array($parent_variable_value)) {
257
+                    continue;
258
+                }
259 259
 
260
-				if (is_array($variable_value)) {
261
-					continue;
262
-				}
260
+                if (is_array($variable_value)) {
261
+                    continue;
262
+                }
263 263
 
264
-				$founded = false;
265
-				// searching the item in the parent tool
266
-				if (preg_match($term,$variable_value)!==0) {
267
-					$founded = true;
268
-				}
269
-				if ($founded) {
270
-					//loading variable from the english array
271
-					$sub_language_name_variable = $sub_language_array[$lang_file][$name_variable];
272
-					$parent_variable_value = $parent_language_array[$lang_file][$name_variable];
273
-					//config buttons
274
-					$obj_text='<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'.$sub_language_name_variable.'</textarea>';
275
-					$obj_button='<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'"  />'.get_lang('Save').'</button>';
264
+                $founded = false;
265
+                // searching the item in the parent tool
266
+                if (preg_match($term,$variable_value)!==0) {
267
+                    $founded = true;
268
+                }
269
+                if ($founded) {
270
+                    //loading variable from the english array
271
+                    $sub_language_name_variable = $sub_language_array[$lang_file][$name_variable];
272
+                    $parent_variable_value = $parent_language_array[$lang_file][$name_variable];
273
+                    //config buttons
274
+                    $obj_text='<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'.$sub_language_name_variable.'</textarea>';
275
+                    $obj_button='<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'"  />'.get_lang('Save').'</button>';
276 276
 
277
-					//loading variable from the english array
278
-					$english_name_variable = $english_language_array[$lang_file][$name_variable];
279
-					$list_info[]=array($lang_file.'.inc.php',
280
-						$name_variable,
281
-						$english_name_variable,
282
-						$parent_variable_value,$obj_text,$obj_button);
283
-				}
284
-			}
285
-		}
286
-	}
277
+                    //loading variable from the english array
278
+                    $english_name_variable = $english_language_array[$lang_file][$name_variable];
279
+                    $list_info[]=array($lang_file.'.inc.php',
280
+                        $name_variable,
281
+                        $english_name_variable,
282
+                        $parent_variable_value,$obj_text,$obj_button);
283
+                }
284
+            }
285
+        }
286
+    }
287 287
 
288
-	$list_info = array_unique_dimensional($list_info);
289
-	return $list_info;
288
+    $list_info = array_unique_dimensional($list_info);
289
+    return $list_info;
290 290
 }
291 291
 
292 292
 // Allow see data in sort table
293 293
 $list_info = array();
294 294
 if (isset($_REQUEST['txt_search_word'])) {
295
-	//@todo fix to accept a char with 1 char
296
-	if (strlen(trim($_REQUEST['txt_search_word']))>2) {
297
-		$list_info = search_language_term(
298
-			$_REQUEST['txt_search_word'],
299
-			true,
300
-			true,
301
-			true,
302
-			true
303
-		);
304
-	}
295
+    //@todo fix to accept a char with 1 char
296
+    if (strlen(trim($_REQUEST['txt_search_word']))>2) {
297
+        $list_info = search_language_term(
298
+            $_REQUEST['txt_search_word'],
299
+            true,
300
+            true,
301
+            true,
302
+            true
303
+        );
304
+    }
305 305
 }
306 306
 
307 307
 $parameters = array(
308
-	'id' => intval($_GET['id']),
309
-	'sub_language_id' => intval($_GET['sub_language_id']),
310
-	'txt_search_word' => $txt_search_word
308
+    'id' => intval($_GET['id']),
309
+    'sub_language_id' => intval($_GET['sub_language_id']),
310
+    'txt_search_word' => $txt_search_word
311 311
 );
312 312
 $table = new SortableTableFromArrayConfig($list_info, 1,20,'data_info');
313 313
 $table->set_additional_parameters($parameters);
Please login to merge, or discard this patch.
main/admin/user_add.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -99,27 +99,27 @@  discard block
 block discarded – undo
99 99
 $form = new FormValidator('user_add');
100 100
 $form->addElement('header', '', $tool_name);
101 101
 if (api_is_western_name_order()) {
102
-	// Firstname
103
-	$form->addElement('text', 'firstname', get_lang('FirstName'));
104
-	$form->applyFilter('firstname', 'html_filter');
105
-	$form->applyFilter('firstname', 'trim');
106
-	$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
107
-	// Lastname
108
-	$form->addElement('text', 'lastname', get_lang('LastName'));
109
-	$form->applyFilter('lastname', 'html_filter');
110
-	$form->applyFilter('lastname', 'trim');
111
-	$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
102
+    // Firstname
103
+    $form->addElement('text', 'firstname', get_lang('FirstName'));
104
+    $form->applyFilter('firstname', 'html_filter');
105
+    $form->applyFilter('firstname', 'trim');
106
+    $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
107
+    // Lastname
108
+    $form->addElement('text', 'lastname', get_lang('LastName'));
109
+    $form->applyFilter('lastname', 'html_filter');
110
+    $form->applyFilter('lastname', 'trim');
111
+    $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
112 112
 } else {
113
-	// Lastname
114
-	$form->addElement('text', 'lastname', get_lang('LastName'));
115
-	$form->applyFilter('lastname', 'html_filter');
116
-	$form->applyFilter('lastname', 'trim');
117
-	$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
118
-	// Firstname
119
-	$form->addElement('text', 'firstname', get_lang('FirstName'));
120
-	$form->applyFilter('firstname', 'html_filter');
121
-	$form->applyFilter('firstname', 'trim');
122
-	$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
113
+    // Lastname
114
+    $form->addElement('text', 'lastname', get_lang('LastName'));
115
+    $form->applyFilter('lastname', 'html_filter');
116
+    $form->applyFilter('lastname', 'trim');
117
+    $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
118
+    // Firstname
119
+    $form->addElement('text', 'firstname', get_lang('FirstName'));
120
+    $form->applyFilter('firstname', 'html_filter');
121
+    $form->applyFilter('firstname', 'trim');
122
+    $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
123 123
 }
124 124
 // Official code
125 125
 $form->addElement('text', 'official_code', get_lang('OfficialCode'), array('size' => '40'));
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 $auth_sources = 0; //make available wider as we need it in case of form reset (see below)
164 164
 $nb_ext_auth_source_added = 0;
165 165
 if (isset($extAuthSource) && count($extAuthSource) > 0) {
166
-	$auth_sources = array();
166
+    $auth_sources = array();
167 167
     foreach ($extAuthSource as $key => $info) {
168 168
         // @todo : make uniform external authentification configuration (ex : cas and external_login ldap)
169 169
         // Special case for CAS. CAS is activated from Chamilo > Administration > Configuration > CAS
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
             $nb_ext_auth_source_added++;
175 175
         }
176 176
     }
177
-	if ($nb_ext_auth_source_added > 0) {
178
-    	$group[] = $form->createElement('radio', 'password_auto', null, get_lang('ExternalAuthentication').' ', 2);
179
-    	$group[] = $form->createElement('select', 'auth_source', null, $auth_sources);
180
-    	$group[] = $form->createElement('static', '', '', '<br />');
177
+    if ($nb_ext_auth_source_added > 0) {
178
+        $group[] = $form->createElement('radio', 'password_auto', null, get_lang('ExternalAuthentication').' ', 2);
179
+        $group[] = $form->createElement('select', 'auth_source', null, $auth_sources);
180
+        $group[] = $form->createElement('static', '', '', '<br />');
181 181
     }
182 182
 }
183 183
 
@@ -246,12 +246,12 @@  discard block
 block discarded – undo
246 246
 $form->addElement('html', '<div id="drh_list" style="display:'.$display.';">');
247 247
 
248 248
 if (isset($drh_list) && is_array($drh_list)) {
249
-	foreach ($drh_list as $drh) {
249
+    foreach ($drh_list as $drh) {
250 250
         $drh_select->addOption(
251 251
             api_get_person_name($drh['firstname'], $drh['lastname']),
252 252
             $drh['user_id']
253 253
         );
254
-	}
254
+    }
255 255
 }
256 256
 $form->addElement('html', '</div>');
257 257
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 
326 326
 // Validate form
327 327
 if ($form->validate()) {
328
-	$check = Security::check_token('post');
328
+    $check = Security::check_token('post');
329 329
     if ($check) {
330 330
         $user = $form->exportValues();
331 331
         $lastname = $user['lastname'];
@@ -341,15 +341,15 @@  discard block
 block discarded – undo
341 341
         $send_mail = intval($user['mail']['send_mail']);
342 342
         $hr_dept_id = isset($user['hr_dept_id']) ? intval($user['hr_dept_id']) : 0;
343 343
 
344
-		if (isset($extAuthSource) && count($extAuthSource) > 0 &&
344
+        if (isset($extAuthSource) && count($extAuthSource) > 0 &&
345 345
             $user['password']['password_auto'] == '2'
346 346
         ) {
347
-			$auth_source = $user['password']['auth_source'];
348
-			$password = 'PLACEHOLDER';
349
-		} else {
350
-			$auth_source = PLATFORM_AUTH_SOURCE;
351
-			$password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password'];
352
-		}
347
+            $auth_source = $user['password']['auth_source'];
348
+            $password = 'PLACEHOLDER';
349
+        } else {
350
+            $auth_source = PLATFORM_AUTH_SOURCE;
351
+            $password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password'];
352
+        }
353 353
 
354 354
         if ($user['radio_expiration_date'] == '1') {
355 355
             $expiration_date = $user['expiration_date'];
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
             $expiration_date = null;
358 358
         }
359 359
 
360
-		$active = intval($user['active']);
360
+        $active = intval($user['active']);
361 361
 
362 362
         if (api_get_setting('login_is_email') == 'true') {
363 363
             $username = $email;
@@ -388,12 +388,12 @@  discard block
 block discarded – undo
388 388
             $extra,
389 389
             null,
390 390
             $send_mail,
391
-			$platform_admin
391
+            $platform_admin
392 392
         );
393 393
 
394
-		Security::clear_token();
395
-		$tok = Security::get_token();
396
-		if (!empty($user_id)) {
394
+        Security::clear_token();
395
+        $tok = Security::get_token();
396
+        if (!empty($user_id)) {
397 397
             if (!empty($picture['name'])) {
398 398
                 $picture_uri = UserManager::update_user_picture(
399 399
                     $user_id,
@@ -420,37 +420,37 @@  discard block
 block discarded – undo
420 420
                     null,
421 421
                     $language
422 422
                 );
423
-			}
423
+            }
424 424
 
425 425
             $extraFieldValues = new ExtraFieldValue('user');
426 426
             $user['item_id'] = $user_id;
427 427
             $extraFieldValues->saveFieldValues($user);
428
-			$message = get_lang('UserAdded');
429
-		}
428
+            $message = get_lang('UserAdded');
429
+        }
430 430
 
431
-		if (isset($user['submit_plus'])) {
432
-			//we want to add more. Prepare report message and redirect to the same page (to clean the form)
431
+        if (isset($user['submit_plus'])) {
432
+            //we want to add more. Prepare report message and redirect to the same page (to clean the form)
433 433
             Display::addFlash(Display::return_message($message));
434
-			header('Location: user_add.php?sec_token='.$tok);
435
-			exit;
436
-		} else {
437
-			$tok = Security::get_token();
434
+            header('Location: user_add.php?sec_token='.$tok);
435
+            exit;
436
+        } else {
437
+            $tok = Security::get_token();
438 438
             Display::addFlash(Display::return_message($message));
439
-			header('Location: user_list.php?sec_token='.$tok);
440
-			exit;
441
-		}
442
-	}
439
+            header('Location: user_list.php?sec_token='.$tok);
440
+            exit;
441
+        }
442
+    }
443 443
 } else {
444
-	if (isset($_POST['submit'])) {
445
-		Security::clear_token();
446
-	}
447
-	$token = Security::get_token();
448
-	$form->addElement('hidden', 'sec_token');
449
-	$form->setConstants(array('sec_token' => $token));
444
+    if (isset($_POST['submit'])) {
445
+        Security::clear_token();
446
+    }
447
+    $token = Security::get_token();
448
+    $form->addElement('hidden', 'sec_token');
449
+    $form->setConstants(array('sec_token' => $token));
450 450
 }
451 451
 
452 452
 if (!empty($message)){
453
-	$message = Display::return_message(stripslashes($message));
453
+    $message = Display::return_message(stripslashes($message));
454 454
 }
455 455
 $content = $form->returnForm();
456 456
 
Please login to merge, or discard this patch.