Completed
Pull Request — develop (#740)
by Maxim
08:32
created
manager/includes/functions/actions/import.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -114,9 +114,9 @@
 block discarded – undo
114 114
                 $field['menuindex'] = 1;
115 115
                 $find = false;
116 116
                 foreach (array(
117
-                             'index.html',
118
-                             'index.htm'
119
-                         ) as $filename) {
117
+                                'index.html',
118
+                                'index.htm'
119
+                            ) as $filename) {
120 120
                     $filepath = $filedir . $alias . '/' . $filename;
121 121
                     if ($find === false && file_exists($filepath)) {
122 122
                         $file = getFileContent($filepath);
Please login to merge, or discard this patch.
manager/media/style/default/style.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@  discard block
 block discarded – undo
11 11
 $style_path = 'media/style/' . $modx->config['manager_theme'] . '/images/';
12 12
 $modx->config['mgr_date_picker_path'] = 'media/calendar/datepicker.inc.php';
13 13
 if(!$modx->config['lang_code']) {
14
-	global $modx_lang_attribute;
15
-	$modx->config['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute;
14
+    global $modx_lang_attribute;
15
+    $modx->config['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute;
16 16
 }
17 17
 
18 18
 if(!empty($_GET['a']) && $_GET['a'] == 2) {
19
-	include_once('welcome.php');
19
+    include_once('welcome.php');
20 20
 }
21 21
 
22 22
 // Favicon
@@ -274,66 +274,66 @@  discard block
 block discarded – undo
274 274
 $addnew = 0;
275 275
 $run = 0;
276 276
 switch($action) {
277
-	case '3':
278
-	case '4':
279
-	case '27':
280
-	case '72':
281
-		if($modx->hasPermission('new_document')) {
282
-			$addnew = 1;
283
-		}
284
-		break;
285
-	case '16':
286
-	case '19':
287
-		if($modx->hasPermission('new_template')) {
288
-			$addnew = 1;
289
-		}
290
-		break;
291
-	case '300':
292
-	case '301':
293
-		if($modx->hasPermission('new_snippet') && $modx->hasPermission('new_chunk') && $modx->hasPermission('new_plugin')) {
294
-			$addnew = 1;
295
-		}
296
-		break;
297
-	case '77':
298
-	case '78':
299
-		if($modx->hasPermission('new_chunk')) {
300
-			$addnew = 1;
301
-		}
302
-		break;
303
-	case '22':
304
-	case '23':
305
-		if($modx->hasPermission('new_snippet')) {
306
-			$addnew = 1;
307
-		}
308
-		break;
309
-	case '101':
310
-	case '102':
311
-		if($modx->hasPermission('new_plugin')) {
312
-			$addnew = 1;
313
-		}
314
-		break;
315
-	case '106':
316
-	case '107':
317
-	case '108':
318
-		if($modx->hasPermission('new_module')) {
319
-			$addnew = 1;
320
-		}
321
-		if($modx->hasPermission('exec_module')) {
322
-			$run = 1;
323
-		}
324
-		break;
325
-	case '88':
326
-		if($modx->hasPermission('new_web_user')) {
327
-			$addnew = 1;
328
-		}
329
-		break;
277
+    case '3':
278
+    case '4':
279
+    case '27':
280
+    case '72':
281
+        if($modx->hasPermission('new_document')) {
282
+            $addnew = 1;
283
+        }
284
+        break;
285
+    case '16':
286
+    case '19':
287
+        if($modx->hasPermission('new_template')) {
288
+            $addnew = 1;
289
+        }
290
+        break;
291
+    case '300':
292
+    case '301':
293
+        if($modx->hasPermission('new_snippet') && $modx->hasPermission('new_chunk') && $modx->hasPermission('new_plugin')) {
294
+            $addnew = 1;
295
+        }
296
+        break;
297
+    case '77':
298
+    case '78':
299
+        if($modx->hasPermission('new_chunk')) {
300
+            $addnew = 1;
301
+        }
302
+        break;
303
+    case '22':
304
+    case '23':
305
+        if($modx->hasPermission('new_snippet')) {
306
+            $addnew = 1;
307
+        }
308
+        break;
309
+    case '101':
310
+    case '102':
311
+        if($modx->hasPermission('new_plugin')) {
312
+            $addnew = 1;
313
+        }
314
+        break;
315
+    case '106':
316
+    case '107':
317
+    case '108':
318
+        if($modx->hasPermission('new_module')) {
319
+            $addnew = 1;
320
+        }
321
+        if($modx->hasPermission('exec_module')) {
322
+            $run = 1;
323
+        }
324
+        break;
325
+    case '88':
326
+        if($modx->hasPermission('new_web_user')) {
327
+            $addnew = 1;
328
+        }
329
+        break;
330 330
 }
331 331
 
332 332
 $disabled = ($action == '19' || $action == '300' || $action == '77' || $action == '23' || $action == '101' || $action == '4' || $action == '72' || $action == '87' || $action == '11' || $action == '107' || $action == '38') ? ' disabled' : '';
333 333
 
334 334
 $_style['actionbuttons'] = array(
335
-	'dynamic' => array(
336
-		'document' => '<div id="actions">
335
+    'dynamic' => array(
336
+        'document' => '<div id="actions">
337 337
 			<div class="btn-group">
338 338
 				<div class="btn-group">
339 339
 					<a id="Button1" class="btn btn-success" href="javascript:;" onclick="actions.save();">
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 						<option id="stay3" value="" ' . ($stay == '' ? ' selected="selected"' : '') . '>' . $_lang['close'] . '</option>
349 349
 					</select>
350 350
 				</div>' .
351
-					($addnew ? '
351
+                    ($addnew ? '
352 352
 					<a id="Button6" class="btn btn-secondary' . $disabled . '" href="javascript:;" onclick="actions.duplicate();">
353 353
 						<i class="' . $_style["actions_duplicate"] . '"></i><span>' . $_lang['duplicate'] . '</span>
354 354
 					</a>
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 				</a>
365 365
 			</div>
366 366
 		</div>',
367
-		'user' => '<div id="actions">
367
+        'user' => '<div id="actions">
368 368
 			<div class="btn-group">
369 369
 				<div class="btn-group">
370 370
 					<a id="Button1" class="btn btn-success" href="javascript:;" onclick="actions.save();">
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 				</a>
388 388
 			</div>
389 389
 		</div>',
390
-		'element' => '<div id="actions">
390
+        'element' => '<div id="actions">
391 391
 			<div class="btn-group">
392 392
 				<div class="btn-group">
393 393
 					<a id="Button1" class="btn btn-success" href="javascript:;" onclick="actions.save();">
@@ -420,21 +420,21 @@  discard block
 block discarded – undo
420 420
 				' : '') . '
421 421
 			</div>
422 422
 		</div>',
423
-		'newmodule' => ($addnew ? '<div id="actions">
423
+        'newmodule' => ($addnew ? '<div id="actions">
424 424
 			<div class="btn-group">
425 425
 				<a id="newModule" class="btn btn-secondary" href="javascript:;" onclick="actions.new();">
426 426
 					<i class="' . $_style["actions_new"] . '"></i><span>' . $_lang['new_module'] . '</span>
427 427
 				</a>
428 428
 			</div>
429 429
 		</div>' : ''),
430
-		'close' => '<div id="actions">
430
+        'close' => '<div id="actions">
431 431
 			<div class="btn-group">
432 432
 				<a id="Button5" class="btn btn-secondary" href="javascript:;" onclick="actions.close();">
433 433
 					<i class="' . $_style["actions_close"] . '"></i><span>' . $_lang['close'] . '</span>
434 434
 				</a>
435 435
 			</div>
436 436
 		</div>',
437
-		'save' => '<div id="actions">
437
+        'save' => '<div id="actions">
438 438
 			<div class="btn-group">
439 439
 				<a id="Button1" class="btn btn-success" href="javascript:;" onclick="actions.save();">
440 440
 					<i class="' . $_style["actions_save"] . '"></i><span>' . $_lang['save'] . '</span>
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 				</a>
445 445
 			</div>
446 446
 		</div>',
447
-		'savedelete' => '<div id="actions">
447
+        'savedelete' => '<div id="actions">
448 448
 			<div class="btn-group">
449 449
 				<a id="Button1" class="btn btn-success" href="javascript:;" onclick="actions.save();">
450 450
 					<i class="' . $_style["actions_save"] . '"></i><span>' . $_lang['save'] . '</span>
@@ -457,14 +457,14 @@  discard block
 block discarded – undo
457 457
 				</a>
458 458
 			</div>
459 459
 		</div>',
460
-		'cancel' => '<div id="actions">
460
+        'cancel' => '<div id="actions">
461 461
 			<div class="btn-group">
462 462
 				<a id="Button5" class="btn btn-secondary" href="javascript:;" onclick="actions.cancel();">
463 463
 					<i class="' . $_style["actions_cancel"] . '"></i><span>' . $_lang['cancel'] . '</span>
464 464
 				</a>
465 465
 			</div>
466 466
 		</div>',
467
-		'canceldelete' => '<div id="actions">
467
+        'canceldelete' => '<div id="actions">
468 468
 			<div class="btn-group">
469 469
 				<a id="Button3" class="btn btn-secondary' . $disabled . '" href="javascript:;" onclick="actions.delete();">
470 470
 					<i class="' . $_style["actions_delete"] . '"></i><span>' . $_lang['delete'] . '</span>
@@ -474,11 +474,11 @@  discard block
 block discarded – undo
474 474
 				</a>
475 475
 			</div>
476 476
 		</div>',
477
-	),
478
-	'static' => array(
479
-		'document' => '<div id="actions">
477
+    ),
478
+    'static' => array(
479
+        'document' => '<div id="actions">
480 480
 			<div class="btn-group">' .
481
-				($addnew ? '
481
+                ($addnew ? '
482 482
 					<a class="btn btn-secondary" href="javascript:;" onclick="actions.new();">
483 483
 						<i class="' . $_style["icons_new_document"] . '"></i><span>' . $_lang['create_resource_here'] . '</span>
484 484
 					</a>
@@ -503,12 +503,12 @@  discard block
 block discarded – undo
503 503
 				</a>
504 504
 			</div>
505 505
 		</div>',
506
-		'cancel' => '<div id="actions">
506
+        'cancel' => '<div id="actions">
507 507
 			<div class="btn-group">
508 508
 				<a id="Button5" class="btn btn-secondary" href="javascript:;" onclick="actions.cancel();">
509 509
 					<i class="' . $_style["actions_cancel"] . '"></i><span>' . $_lang['cancel'] . '</span>
510 510
 				</a>
511 511
 			</div>
512 512
 		</div>',
513
-	)
513
+    )
514 514
 );
Please login to merge, or discard this patch.
manager/includes/config_check.inc.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@  discard block
 block discarded – undo
5 5
 
6 6
 // PROCESSOR FIRST
7 7
 if($_SESSION['mgrRole'] == 1) {
8
-	if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) {
9
-		$current = $modx->getManagerApi()->getSystemChecksum($modx->config['check_files_onlogin']);
10
-		if(!empty($current)) {
11
-			$modx->getManagerApi()->setSystemChecksum($current);
12
-			$modx->clearCache('full');
13
-			$modx->config['sys_files_checksum'] = $current;
14
-		};
15
-	}
8
+    if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) {
9
+        $current = $modx->getManagerApi()->getSystemChecksum($modx->config['check_files_onlogin']);
10
+        if(!empty($current)) {
11
+            $modx->getManagerApi()->setSystemChecksum($current);
12
+            $modx->clearCache('full');
13
+            $modx->config['sys_files_checksum'] = $current;
14
+        };
15
+    }
16 16
 }
17 17
 
18 18
 // NOW CHECK CONFIG
@@ -20,15 +20,15 @@  discard block
 block discarded – undo
20 20
 
21 21
 $sysfiles_check = $modx->getManagerApi()->checkSystemChecksum();
22 22
 if ($sysfiles_check!=='0'){
23
-      $warningspresent = 1;
24
-      $warnings[] = array($_lang['configcheck_sysfiles_mod']);
23
+        $warningspresent = 1;
24
+        $warnings[] = array($_lang['configcheck_sysfiles_mod']);
25 25
 }
26 26
 
27 27
 if (is_writable("includes/config.inc.php")){
28 28
     // Warn if world writable
29 29
     if(@fileperms('includes/config.inc.php') & 0x0002) {
30
-      $warningspresent = 1;
31
-      $warnings[] = array($_lang['configcheck_configinc']);
30
+        $warningspresent = 1;
31
+        $warnings[] = array($_lang['configcheck_configinc']);
32 32
     }
33 33
 }
34 34
 
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
             break;
183 183
         case $_lang['configcheck_sysfiles_mod']:
184 184
             $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"];
185
-			$warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>';
186
-			if($modx->hasPermission('settings')) {
187
-				$warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>';
188
-			}
185
+            $warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>';
186
+            if($modx->hasPermission('settings')) {
187
+                $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>';
188
+            }
189 189
             if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']);
190 190
             break;
191 191
         case $_lang['configcheck_lang_difference'] :
Please login to merge, or discard this patch.
manager/includes/footer.inc.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+    die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 global $SystemAlertMsgQueque;
6 6
 // display system alert window if messages are available
7 7
 if(count($SystemAlertMsgQueque) > 0) {
8
-	include "sysalert.display.inc.php";
8
+    include "sysalert.display.inc.php";
9 9
 }
10 10
 ?>
11 11
 <script type='text/javascript'>
@@ -19,17 +19,17 @@  discard block
 block discarded – undo
19 19
 </script>
20 20
 <?php
21 21
 if(in_array($modx->getManagerApi()->action, array(
22
-	85,
23
-	27,
24
-	4,
25
-	72,
26
-	13,
27
-	11,
28
-	12,
29
-	87,
30
-	88
22
+    85,
23
+    27,
24
+    4,
25
+    72,
26
+    13,
27
+    11,
28
+    12,
29
+    87,
30
+    88
31 31
 ))) {
32
-	echo $modx->getManagerApi()->loadDatePicker($modx->config['mgr_date_picker_path']);
32
+    echo $modx->getManagerApi()->loadDatePicker($modx->config['mgr_date_picker_path']);
33 33
 }
34 34
 ?>
35 35
 </body>
Please login to merge, or discard this patch.
manager/includes/sysalert.display.inc.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-	/**
4
-	 *	System Alert Message Queue Display file
5
-	 *	Written By Raymond Irving, April, 2005
6
-	 *
7
-	 *	Used to display system alert messages inside the browser
8
-	 *
9
-	 */
3
+    /**
4
+     *	System Alert Message Queue Display file
5
+     *	Written By Raymond Irving, April, 2005
6
+     *
7
+     *	Used to display system alert messages inside the browser
8
+     *
9
+     */
10 10
 
11
-	require_once(dirname(__FILE__).'/protect.inc.php');
11
+    require_once(dirname(__FILE__).'/protect.inc.php');
12 12
 
13
-	$sysMsgs = "";
14
-	$limit = count($SystemAlertMsgQueque);
15
-	for($i=0;$i<$limit;$i++) {
16
-		$sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>";
17
-	}
18
-	// reset message queque
19
-	unset($_SESSION['SystemAlertMsgQueque']);
20
-	$_SESSION['SystemAlertMsgQueque'] = array();
21
-	$SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque'];
13
+    $sysMsgs = "";
14
+    $limit = count($SystemAlertMsgQueque);
15
+    for($i=0;$i<$limit;$i++) {
16
+        $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>";
17
+    }
18
+    // reset message queque
19
+    unset($_SESSION['SystemAlertMsgQueque']);
20
+    $_SESSION['SystemAlertMsgQueque'] = array();
21
+    $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque'];
22 22
 
23
-	if($sysMsgs!="") {
23
+    if($sysMsgs!="") {
24 24
 ?>
25 25
 
26 26
 <?php // fetch the styles
27
-	echo '<link rel="stylesheet" type="text/css" href="'.MODX_MANAGER_URL.'media/style/'.$manager_theme.'/style.css'.'" />';
27
+    echo '<link rel="stylesheet" type="text/css" href="'.MODX_MANAGER_URL.'media/style/'.$manager_theme.'/style.css'.'" />';
28 28
 ?>
29 29
 <script type="text/javascript">
30 30
 // <![CDATA[
@@ -42,5 +42,5 @@  discard block
 block discarded – undo
42 42
 // ]]>
43 43
 </script>
44 44
 <?php
45
-	}
45
+    }
46 46
 ?>
Please login to merge, or discard this patch.
manager/includes/src/Legacy/DeprecatedCore.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@
 block discarded – undo
5 5
 class DeprecatedCore implements DeprecatedCoreInterface
6 6
 {
7 7
     /**
8
-    * @deprecated
9
-    *
10
-    * return @void
11
-    */
8
+     * @deprecated
9
+     *
10
+     * return @void
11
+     */
12 12
     public function dbConnect()
13 13
     {
14 14
         $modx = evolutionCMS();
Please login to merge, or discard this patch.
manager/includes/src/Support/DataGrid.php 1 patch
Indentation   +223 added lines, -223 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 class DataGrid implements DataGridInterface{
15 15
 
16
-	public $ds; // datasource
16
+    public $ds; // datasource
17 17
     public $id;
18 18
     public $pageSize;            // pager settings
19 19
     public $pageNumber;
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public $colWraps;
38 38
     public $colColors;
39 39
     public $colTypes;            // coltype1, coltype2, etc or coltype1:format1, e.g. date:%Y %m
40
-	// data type: integer,float,currency,date
40
+    // data type: integer,float,currency,date
41 41
 
42 42
     public $header;
43 43
     public $footer;
@@ -76,236 +76,236 @@  discard block
 block discarded – undo
76 76
     public static $dataGridCnt;
77 77
 
78 78
     public function __construct($id, $ds, $pageSize = 20, $pageNumber = -1) {
79
-		// set id
80
-		self::$dataGridCnt++;
81
-		$this->id = $this->id ? empty($id) : "dg" . self::$dataGridCnt;
79
+        // set id
80
+        self::$dataGridCnt++;
81
+        $this->id = $this->id ? empty($id) : "dg" . self::$dataGridCnt;
82 82
 
83
-		// set datasource
84
-		$this->ds = $ds;
83
+        // set datasource
84
+        $this->ds = $ds;
85 85
 
86
-		// set pager
87
-		$this->pageSize = $pageSize;
88
-		$this->pageNumber = $pageNumber; // by setting pager to -1 will cause pager to load it's last page number
89
-		$this->pagerLocation = 'top-right';
90
-	}
86
+        // set pager
87
+        $this->pageSize = $pageSize;
88
+        $this->pageNumber = $pageNumber; // by setting pager to -1 will cause pager to load it's last page number
89
+        $this->pagerLocation = 'top-right';
90
+    }
91 91
 
92 92
     public function setDataSource($ds) {
93
-		$this->ds = $ds;
94
-	}
93
+        $this->ds = $ds;
94
+    }
95 95
 
96 96
     public function render() {
97 97
         $modx = evolutionCMS();
98
-		$columnHeaderStyle = ($this->columnHeaderStyle) ? "style='" . $this->columnHeaderStyle . "'" : '';
99
-		$columnHeaderClass = ($this->columnHeaderClass) ? "class='" . $this->columnHeaderClass . "'" : "";
100
-		$cssStyle = ($this->cssStyle) ? "style='" . $this->cssStyle . "'" : '';
101
-		$cssClass = ($this->cssClass) ? "class='" . $this->cssClass . "'" : '';
102
-
103
-		$pagerClass = ($this->pagerClass) ? "class='" . $this->pagerClass . "'" : '';
104
-		$pagerStyle = ($this->pagerStyle) ? "style='" . $this->pagerStyle . "'" : "style='background-color:#ffffff;'";
105
-
106
-		$this->_itemStyle = ($this->itemStyle) ? "style='" . $this->itemStyle . "'" : '';
107
-		$this->_itemClass = ($this->itemClass) ? "class='" . $this->itemClass . "'" : '';
108
-		$this->_altItemStyle = ($this->altItemStyle) ? "style='" . $this->altItemStyle . "'" : '';
109
-		$this->_altItemClass = ($this->altItemClass) ? "class='" . $this->altItemClass . "'" : '';
110
-
111
-		$this->_alt = 0;
112
-		$this->_total = 0;
113
-
114
-		$this->_isDataset = $modx->getDatabase()->isResult($this->ds); // if not dataset then treat as array
115
-
116
-		if(!$cssStyle && !$cssClass) {
117
-			$cssStyle = "style='width:100%;border:1px solid silver;font-family:verdana,arial; font-size:11px;'";
118
-		}
119
-		if(!$columnHeaderStyle && !$columnHeaderClass) {
120
-			$columnHeaderStyle = "style='color:black;background-color:silver'";
121
-		}
122
-		if(!$this->_itemStyle && !$this->_itemClass) {
123
-			$this->_itemStyle = "style='color:black;'";
124
-		}
125
-		if(!$this->_altItemStyle && !$this->_altItemClass) {
126
-			$this->_altItemStyle = "style='color:black;background-color:#eeeeee'";
127
-		}
128
-
129
-		if($this->_isDataset && !$this->columns) {
130
-			$cols = $modx->getDatabase()->numFields($this->ds);
131
-			for($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "") . $modx->getDatabase()->fieldName($this->ds, $i);
132
-		}
133
-
134
-		// start grid
135
-		$tblStart = "<table $cssClass $cssStyle cellpadding='" . (isset($this->cellPadding) ? (int) $this->cellPadding : 1) . "' cellspacing='" . (isset($this->cellSpacing) ? (int) $this->cellSpacing : 1) . "'>";
136
-		$tblEnd = "</table>";
137
-
138
-		// build column header
139
-		$this->_colnames = explode((strstr($this->columns, "||") !== false ? "||" : ","), $this->columns);
140
-		$this->_colwidths = explode((strstr($this->colWidths, "||") !== false ? "||" : ","), $this->colWidths);
141
-		$this->_colaligns = explode((strstr($this->colAligns, "||") !== false ? "||" : ","), $this->colAligns);
142
-		$this->_colwraps = explode((strstr($this->colWraps, "||") !== false ? "||" : ","), $this->colWraps);
143
-		$this->_colcolors = explode((strstr($this->colColors, "||") !== false ? "||" : ","), $this->colColors);
144
-		$this->_coltypes = explode((strstr($this->colTypes, "||") !== false ? "||" : ","), $this->colTypes);
145
-		$this->_colcount = count($this->_colnames);
146
-		if(!$this->_isDataset) {
147
-			$this->ds = explode((strstr($this->ds, "||") !== false ? "||" : ","), $this->ds);
148
-			$this->ds = array_chunk($this->ds, $this->_colcount);
149
-		}
150
-		$tblColHdr = "<thead><tr>";
151
-		for($c = 0; $c < $this->_colcount; $c++) {
152
-			$name = $this->_colnames[$c];
153
-			$width = $this->_colwidths[$c];
154
-			$tblColHdr .= "<td $columnHeaderStyle $columnHeaderClass" . ($width ? " width='$width'" : "") . ">$name</td>";
155
-		}
156
-		$tblColHdr .= "</tr></thead>\n";
157
-
158
-		// build rows
159
-		$rowcount = $this->_isDataset ? $modx->getDatabase()->getRecordCount($this->ds) : count($this->ds);
160
-		$this->_fieldnames = explode(",", $this->fields);
161
-		if($rowcount == 0) {
162
-			$tblRows .= "<tr><td " . $this->_itemStyle . " " . $this->_itemClass . " colspan='" . $this->_colcount . "'>" . $this->noRecordMsg . "</td></tr>\n";
163
-		} else {
164
-			// render grid items
165
-			if($this->pageSize <= 0) {
166
-				for($r = 0; $r < $rowcount; $r++) {
167
-					$row = $this->_isDataset ? $modx->getDatabase()->getRow($this->ds) : $this->ds[$r];
168
-					$tblRows .= $this->RenderRowFnc($r + 1, $row);
169
-				}
170
-			} else {
171
-				if(!$this->pager) {
172
-					$this->pager = new DataSetPager($this->id, $this->ds, $this->pageSize, $this->pageNumber);
173
-					$this->pager->setRenderRowFnc($this); // pass this object
174
-					$this->pager->cssStyle = $pagerStyle;
175
-					$this->pager->cssClass = $pagerClass;
176
-				} else {
177
-					$this->pager->pageSize = $this->pageSize;
178
-					$this->pager->pageNumber = $this->pageNumber;
179
-				}
180
-
181
-				$this->pager->render();
182
-				$tblRows = $this->pager->getRenderedRows();
183
-				$tblPager = $this->pager->getRenderedPager();
184
-			}
185
-		}
186
-
187
-		// setup header,pager and footer
188
-		$o = $tblStart;
189
-		$ptop = (substr($this->pagerLocation, 0, 3) == "top") || (substr($this->pagerLocation, 0, 4) == "both");
190
-		$pbot = (substr($this->pagerLocation, 0, 3) == "bot") || (substr($this->pagerLocation, 0, 4) == "both");
191
-		if($this->header) {
192
-			$o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->header . "</td></tr>";
193
-		}
194
-		if($tblPager && $ptop) {
195
-			$o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . "&nbsp;</td></tr>";
196
-		}
197
-		$o .= $tblColHdr . $tblRows;
198
-		if($tblPager && $pbot) {
199
-			$o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . "&nbsp;</td></tr>";
200
-		}
201
-		if($this->footer) {
202
-			$o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->footer . "</td></tr>";
203
-		}
204
-		$o .= $tblEnd;
205
-		return $o;
206
-	}
207
-
208
-	// format column values
98
+        $columnHeaderStyle = ($this->columnHeaderStyle) ? "style='" . $this->columnHeaderStyle . "'" : '';
99
+        $columnHeaderClass = ($this->columnHeaderClass) ? "class='" . $this->columnHeaderClass . "'" : "";
100
+        $cssStyle = ($this->cssStyle) ? "style='" . $this->cssStyle . "'" : '';
101
+        $cssClass = ($this->cssClass) ? "class='" . $this->cssClass . "'" : '';
102
+
103
+        $pagerClass = ($this->pagerClass) ? "class='" . $this->pagerClass . "'" : '';
104
+        $pagerStyle = ($this->pagerStyle) ? "style='" . $this->pagerStyle . "'" : "style='background-color:#ffffff;'";
105
+
106
+        $this->_itemStyle = ($this->itemStyle) ? "style='" . $this->itemStyle . "'" : '';
107
+        $this->_itemClass = ($this->itemClass) ? "class='" . $this->itemClass . "'" : '';
108
+        $this->_altItemStyle = ($this->altItemStyle) ? "style='" . $this->altItemStyle . "'" : '';
109
+        $this->_altItemClass = ($this->altItemClass) ? "class='" . $this->altItemClass . "'" : '';
110
+
111
+        $this->_alt = 0;
112
+        $this->_total = 0;
113
+
114
+        $this->_isDataset = $modx->getDatabase()->isResult($this->ds); // if not dataset then treat as array
115
+
116
+        if(!$cssStyle && !$cssClass) {
117
+            $cssStyle = "style='width:100%;border:1px solid silver;font-family:verdana,arial; font-size:11px;'";
118
+        }
119
+        if(!$columnHeaderStyle && !$columnHeaderClass) {
120
+            $columnHeaderStyle = "style='color:black;background-color:silver'";
121
+        }
122
+        if(!$this->_itemStyle && !$this->_itemClass) {
123
+            $this->_itemStyle = "style='color:black;'";
124
+        }
125
+        if(!$this->_altItemStyle && !$this->_altItemClass) {
126
+            $this->_altItemStyle = "style='color:black;background-color:#eeeeee'";
127
+        }
128
+
129
+        if($this->_isDataset && !$this->columns) {
130
+            $cols = $modx->getDatabase()->numFields($this->ds);
131
+            for($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "") . $modx->getDatabase()->fieldName($this->ds, $i);
132
+        }
133
+
134
+        // start grid
135
+        $tblStart = "<table $cssClass $cssStyle cellpadding='" . (isset($this->cellPadding) ? (int) $this->cellPadding : 1) . "' cellspacing='" . (isset($this->cellSpacing) ? (int) $this->cellSpacing : 1) . "'>";
136
+        $tblEnd = "</table>";
137
+
138
+        // build column header
139
+        $this->_colnames = explode((strstr($this->columns, "||") !== false ? "||" : ","), $this->columns);
140
+        $this->_colwidths = explode((strstr($this->colWidths, "||") !== false ? "||" : ","), $this->colWidths);
141
+        $this->_colaligns = explode((strstr($this->colAligns, "||") !== false ? "||" : ","), $this->colAligns);
142
+        $this->_colwraps = explode((strstr($this->colWraps, "||") !== false ? "||" : ","), $this->colWraps);
143
+        $this->_colcolors = explode((strstr($this->colColors, "||") !== false ? "||" : ","), $this->colColors);
144
+        $this->_coltypes = explode((strstr($this->colTypes, "||") !== false ? "||" : ","), $this->colTypes);
145
+        $this->_colcount = count($this->_colnames);
146
+        if(!$this->_isDataset) {
147
+            $this->ds = explode((strstr($this->ds, "||") !== false ? "||" : ","), $this->ds);
148
+            $this->ds = array_chunk($this->ds, $this->_colcount);
149
+        }
150
+        $tblColHdr = "<thead><tr>";
151
+        for($c = 0; $c < $this->_colcount; $c++) {
152
+            $name = $this->_colnames[$c];
153
+            $width = $this->_colwidths[$c];
154
+            $tblColHdr .= "<td $columnHeaderStyle $columnHeaderClass" . ($width ? " width='$width'" : "") . ">$name</td>";
155
+        }
156
+        $tblColHdr .= "</tr></thead>\n";
157
+
158
+        // build rows
159
+        $rowcount = $this->_isDataset ? $modx->getDatabase()->getRecordCount($this->ds) : count($this->ds);
160
+        $this->_fieldnames = explode(",", $this->fields);
161
+        if($rowcount == 0) {
162
+            $tblRows .= "<tr><td " . $this->_itemStyle . " " . $this->_itemClass . " colspan='" . $this->_colcount . "'>" . $this->noRecordMsg . "</td></tr>\n";
163
+        } else {
164
+            // render grid items
165
+            if($this->pageSize <= 0) {
166
+                for($r = 0; $r < $rowcount; $r++) {
167
+                    $row = $this->_isDataset ? $modx->getDatabase()->getRow($this->ds) : $this->ds[$r];
168
+                    $tblRows .= $this->RenderRowFnc($r + 1, $row);
169
+                }
170
+            } else {
171
+                if(!$this->pager) {
172
+                    $this->pager = new DataSetPager($this->id, $this->ds, $this->pageSize, $this->pageNumber);
173
+                    $this->pager->setRenderRowFnc($this); // pass this object
174
+                    $this->pager->cssStyle = $pagerStyle;
175
+                    $this->pager->cssClass = $pagerClass;
176
+                } else {
177
+                    $this->pager->pageSize = $this->pageSize;
178
+                    $this->pager->pageNumber = $this->pageNumber;
179
+                }
180
+
181
+                $this->pager->render();
182
+                $tblRows = $this->pager->getRenderedRows();
183
+                $tblPager = $this->pager->getRenderedPager();
184
+            }
185
+        }
186
+
187
+        // setup header,pager and footer
188
+        $o = $tblStart;
189
+        $ptop = (substr($this->pagerLocation, 0, 3) == "top") || (substr($this->pagerLocation, 0, 4) == "both");
190
+        $pbot = (substr($this->pagerLocation, 0, 3) == "bot") || (substr($this->pagerLocation, 0, 4) == "both");
191
+        if($this->header) {
192
+            $o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->header . "</td></tr>";
193
+        }
194
+        if($tblPager && $ptop) {
195
+            $o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . "&nbsp;</td></tr>";
196
+        }
197
+        $o .= $tblColHdr . $tblRows;
198
+        if($tblPager && $pbot) {
199
+            $o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . "&nbsp;</td></tr>";
200
+        }
201
+        if($this->footer) {
202
+            $o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->footer . "</td></tr>";
203
+        }
204
+        $o .= $tblEnd;
205
+        return $o;
206
+    }
207
+
208
+    // format column values
209 209
 
210 210
     public function RenderRowFnc($n, $row) {
211
-		if($this->_alt == 0) {
212
-			$Style = $this->_itemStyle;
213
-			$Class = $this->_itemClass;
214
-			$this->_alt = 1;
215
-		} else {
216
-			$Style = $this->_altItemStyle;
217
-			$Class = $this->_altItemClass;
218
-			$this->_alt = 0;
219
-		}
220
-		$o = "<tr>";
221
-		for($c = 0; $c < $this->_colcount; $c++) {
222
-			$colStyle = $Style;
223
-			$fld = trim($this->_fieldnames[$c]);
224
-			$width = isset($this->_colwidths[$c]) ? $this->_colwidths[$c] : null;
225
-			$align = isset($this->_colaligns[$c]) ? $this->_colaligns[$c] : null;
226
-			$color = isset($this->_colcolors[$c]) ? $this->_colcolors[$c] : null;
227
-			$type = isset($this->_coltypes[$c]) ? $this->_coltypes[$c] : null;
228
-			$nowrap = isset($this->_colwraps[$c]) ? $this->_colwraps[$c] : null;
229
-			$value = $row[($this->_isDataset && $fld ? $fld : $c)];
230
-			if($color && $Style) {
231
-				$colStyle = substr($colStyle, 0, -1) . ";background-color:$color;'";
232
-			}
233
-			$value = $this->formatColumnValue($row, $value, $type, $align);
234
-			$o .= "<td $colStyle $Class" . ($align ? " align='$align'" : "") . ($color ? " bgcolor='$color'" : "") . ($nowrap ? " nowrap='$nowrap'" : "") . ($width ? " width='$width'" : "") . ">$value</td>";
235
-		}
236
-		$o .= "</tr>\n";
237
-		return $o;
238
-	}
211
+        if($this->_alt == 0) {
212
+            $Style = $this->_itemStyle;
213
+            $Class = $this->_itemClass;
214
+            $this->_alt = 1;
215
+        } else {
216
+            $Style = $this->_altItemStyle;
217
+            $Class = $this->_altItemClass;
218
+            $this->_alt = 0;
219
+        }
220
+        $o = "<tr>";
221
+        for($c = 0; $c < $this->_colcount; $c++) {
222
+            $colStyle = $Style;
223
+            $fld = trim($this->_fieldnames[$c]);
224
+            $width = isset($this->_colwidths[$c]) ? $this->_colwidths[$c] : null;
225
+            $align = isset($this->_colaligns[$c]) ? $this->_colaligns[$c] : null;
226
+            $color = isset($this->_colcolors[$c]) ? $this->_colcolors[$c] : null;
227
+            $type = isset($this->_coltypes[$c]) ? $this->_coltypes[$c] : null;
228
+            $nowrap = isset($this->_colwraps[$c]) ? $this->_colwraps[$c] : null;
229
+            $value = $row[($this->_isDataset && $fld ? $fld : $c)];
230
+            if($color && $Style) {
231
+                $colStyle = substr($colStyle, 0, -1) . ";background-color:$color;'";
232
+            }
233
+            $value = $this->formatColumnValue($row, $value, $type, $align);
234
+            $o .= "<td $colStyle $Class" . ($align ? " align='$align'" : "") . ($color ? " bgcolor='$color'" : "") . ($nowrap ? " nowrap='$nowrap'" : "") . ($width ? " width='$width'" : "") . ">$value</td>";
235
+        }
236
+        $o .= "</tr>\n";
237
+        return $o;
238
+    }
239 239
 
240 240
     public function formatColumnValue($row, $value, $type, &$align) {
241
-		if(strpos($type, ":") !== false) {
242
-			list($type, $type_format) = explode(":", $type, 2);
243
-		}
244
-		switch(strtolower($type)) {
245
-			case "integer":
246
-				if($align == "") {
247
-					$align = "right";
248
-				}
249
-				$value = number_format($value);
250
-				break;
251
-
252
-			case "float":
253
-				if($align == "") {
254
-					$align = "right";
255
-				}
256
-				if(!$type_format) {
257
-					$type_format = 2;
258
-				}
259
-				$value = number_format($value, $type_format);
260
-				break;
261
-
262
-			case "currency":
263
-				if($align == "") {
264
-					$align = "right";
265
-				}
266
-				if(!$type_format) {
267
-					$type_format = 2;
268
-				}
269
-				$value = "$" . number_format($value, $type_format);
270
-				break;
271
-
272
-			case "date":
273
-				if($align == "") {
274
-					$align = "right";
275
-				}
276
-				if(!is_numeric($value)) {
277
-					$value = strtotime($value);
278
-				}
279
-				if(!$type_format) {
280
-					$type_format = "%A %d, %B %Y";
281
-				}
282
-				$value = strftime($type_format, $value);
283
-				break;
284
-
285
-			case "boolean":
286
-				if($align == '') {
287
-					$align = "center";
288
-				}
289
-				$value = number_format($value);
290
-				if($value) {
291
-					$value = '&bull;';
292
-				} else {
293
-					$value = '&nbsp;';
294
-				}
295
-				break;
296
-
297
-			case "template":
298
-				// replace [+value+] first
299
-				$value = str_replace("[+value+]", $value, $type_format);
300
-				// replace other [+fields+]
301
-				if(strpos($value, "[+") !== false) {
302
-					foreach($row as $k => $v) {
303
-						$value = str_replace("[+$k+]", $v, $value);
304
-					}
305
-				}
306
-				break;
307
-
308
-		}
309
-		return $value;
310
-	}
241
+        if(strpos($type, ":") !== false) {
242
+            list($type, $type_format) = explode(":", $type, 2);
243
+        }
244
+        switch(strtolower($type)) {
245
+            case "integer":
246
+                if($align == "") {
247
+                    $align = "right";
248
+                }
249
+                $value = number_format($value);
250
+                break;
251
+
252
+            case "float":
253
+                if($align == "") {
254
+                    $align = "right";
255
+                }
256
+                if(!$type_format) {
257
+                    $type_format = 2;
258
+                }
259
+                $value = number_format($value, $type_format);
260
+                break;
261
+
262
+            case "currency":
263
+                if($align == "") {
264
+                    $align = "right";
265
+                }
266
+                if(!$type_format) {
267
+                    $type_format = 2;
268
+                }
269
+                $value = "$" . number_format($value, $type_format);
270
+                break;
271
+
272
+            case "date":
273
+                if($align == "") {
274
+                    $align = "right";
275
+                }
276
+                if(!is_numeric($value)) {
277
+                    $value = strtotime($value);
278
+                }
279
+                if(!$type_format) {
280
+                    $type_format = "%A %d, %B %Y";
281
+                }
282
+                $value = strftime($type_format, $value);
283
+                break;
284
+
285
+            case "boolean":
286
+                if($align == '') {
287
+                    $align = "center";
288
+                }
289
+                $value = number_format($value);
290
+                if($value) {
291
+                    $value = '&bull;';
292
+                } else {
293
+                    $value = '&nbsp;';
294
+                }
295
+                break;
296
+
297
+            case "template":
298
+                // replace [+value+] first
299
+                $value = str_replace("[+value+]", $value, $type_format);
300
+                // replace other [+fields+]
301
+                if(strpos($value, "[+") !== false) {
302
+                    foreach($row as $k => $v) {
303
+                        $value = str_replace("[+$k+]", $v, $value);
304
+                    }
305
+                }
306
+                break;
307
+
308
+        }
309
+        return $value;
310
+    }
311 311
 }
Please login to merge, or discard this patch.
manager/includes/src/Support/DataSetPager.php 1 patch
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -13,18 +13,18 @@  discard block
 block discarded – undo
13 13
 
14 14
 class DataSetPager implements DataSetPagerInterface{
15 15
 
16
-	public $ds; // datasource
16
+    public $ds; // datasource
17 17
     public $pageSize;
18 18
     public $pageNumber;
19 19
     public $rows;
20 20
     public $pager;
21 21
     public $id;
22 22
 
23
-	// normal page
23
+    // normal page
24 24
     public $pageStyle;
25 25
     public $pageClass;
26 26
 
27
-	// selected page
27
+    // selected page
28 28
     public $selPageStyle;
29 29
     public $selPageClass;
30 30
     public $renderRowFnc;
@@ -34,164 +34,164 @@  discard block
 block discarded – undo
34 34
     public static $dataSetPagerCnt;
35 35
 
36 36
     public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) {
37
-		global $_PAGE; // use view state object
38
-
39
-		// set id
40
-		self::$dataSetPagerCnt++;
41
-		$this->id = !empty($id) ? $id : "dsp" . self::$dataSetPagerCnt;
42
-
43
-		// get pagenumber
44
-		// by setting pager to -1 cause pager to load it's last page number
45
-		if($pageNumber == -1) {
46
-			$pageNumber = 1;
47
-			if(isset($_GET["dpgn" . $this->id])) {
48
-				$pageNumber = $_GET["dpgn" . $this->id];
49
-			} elseif(isset($_PAGE['vs'][$id . '_dpgn'])) {
50
-				$pageNumber = $_PAGE['vs'][$id . '_dpgn'];
51
-			}
52
-		}
53
-		if(!is_numeric($pageNumber)) {
54
-			$pageNumber = 1;
55
-		}
56
-
57
-		$this->ds = $ds; // datasource
58
-		$this->pageSize = $pageSize;
59
-		$this->pageNumber = $pageNumber;
60
-		$this->rows = '';
61
-		$this->pager = '';
62
-	}
37
+        global $_PAGE; // use view state object
38
+
39
+        // set id
40
+        self::$dataSetPagerCnt++;
41
+        $this->id = !empty($id) ? $id : "dsp" . self::$dataSetPagerCnt;
42
+
43
+        // get pagenumber
44
+        // by setting pager to -1 cause pager to load it's last page number
45
+        if($pageNumber == -1) {
46
+            $pageNumber = 1;
47
+            if(isset($_GET["dpgn" . $this->id])) {
48
+                $pageNumber = $_GET["dpgn" . $this->id];
49
+            } elseif(isset($_PAGE['vs'][$id . '_dpgn'])) {
50
+                $pageNumber = $_PAGE['vs'][$id . '_dpgn'];
51
+            }
52
+        }
53
+        if(!is_numeric($pageNumber)) {
54
+            $pageNumber = 1;
55
+        }
56
+
57
+        $this->ds = $ds; // datasource
58
+        $this->pageSize = $pageSize;
59
+        $this->pageNumber = $pageNumber;
60
+        $this->rows = '';
61
+        $this->pager = '';
62
+    }
63 63
 
64 64
     public function getRenderedPager() {
65
-		return $this->pager;
66
-	}
65
+        return $this->pager;
66
+    }
67 67
 
68 68
     public function getRenderedRows() {
69
-		return $this->rows;
70
-	}
69
+        return $this->rows;
70
+    }
71 71
 
72 72
     public function setDataSource($ds) {
73
-		$this->ds = $ds;
74
-	}
73
+        $this->ds = $ds;
74
+    }
75 75
 
76 76
     public function setPageSize($ps) {
77
-		$this->pageSize = $ps;
78
-	}
77
+        $this->pageSize = $ps;
78
+    }
79 79
 
80 80
     public function setRenderRowFnc($fncName, $args = "") {
81
-		$this->renderRowFnc = &$fncName;
82
-		$this->renderRowFncArgs = $args;    // extra agruments
81
+        $this->renderRowFnc = &$fncName;
82
+        $this->renderRowFncArgs = $args;    // extra agruments
83 83
 
84 84
 
85
-	}
85
+    }
86 86
 
87 87
     public function setRenderPagerFnc($fncName, $args = "") {
88
-		$this->renderPagerFnc = $fncName;
89
-		$this->renderPagerFncArgs = $args;    // extra agruments
90
-	}
88
+        $this->renderPagerFnc = $fncName;
89
+        $this->renderPagerFncArgs = $args;    // extra agruments
90
+    }
91 91
 
92 92
     public function render() {
93
-		$modx = evolutionCMS(); global $_PAGE;
94
-
95
-		$isDataset = $modx->getDatabase()->isResult($this->ds);
96
-
97
-		if(!$this->selPageStyle) {
98
-			$this->selPageStyle = "font-weight:bold";
99
-		}
100
-
101
-		// get total number of rows
102
-		$tnr = ($isDataset) ? $modx->getDatabase()->getRecordCount($this->ds) : count($this->ds);
103
-
104
-		// render: no records found
105
-		if($tnr <= 0) {
106
-			$fnc = $this->renderRowFnc;
107
-			$args = $this->renderRowFncArgs;
108
-			if(isset($fnc)) {
109
-				if($args != "") {
110
-					$this->rows .= $fnc(0, null, $args);
111
-				} // if agrs was specified then we will pass three params
112
-				else {
113
-					$this->rows .= $fnc(0, null);
114
-				}                 // otherwise two will be passed
115
-			}
116
-			return;
117
-		}
118
-
119
-		// get total pages
120
-		$tp = ceil($tnr / $this->pageSize);
121
-		if($this->pageNumber > $tp) {
122
-			$this->pageNumber = 1;
123
-		}
124
-
125
-		// get page number
126
-		$p = $this->pageNumber;
127
-
128
-		// save page number to view state if available
129
-		if(isset($_PAGE['vs'])) {
130
-			$_PAGE['vs'][$this->id . '_dpgn'] = $p;
131
-		}
132
-
133
-		// render pager : renderPagerFnc($cuurentPage,$pagerNumber,$arguments="");
134
-		if($tp > 1) {
135
-		    $url = '';
136
-			$fnc = $this->renderPagerFnc;
137
-			$args = $this->renderPagerFncArgs;
138
-			if(!isset($fnc)) {
139
-				if($modx->isFrontend()) {
140
-					$url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full') . '?';
141
-				} else {
142
-					$url = $_SERVER['PHP_SELF'] . '?';
143
-				}
144
-				$i = 0;
145
-				foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) {
146
-					$i++;
147
-					$url .= (($i > 1) ? "&" : "") . "$n=$v";
148
-				}
149
-				if($i >= 1) {
150
-					$url .= "&";
151
-				}
152
-			}
153
-			for($i = 1; $i <= $tp; $i++) {
154
-				if(isset($fnc)) {
155
-					if($args != "") {
156
-						$this->pager .= $fnc($p, $i, $args);
157
-					} else {
158
-						$this->pager .= $fnc($p, $i);
159
-					}
160
-				} else {
161
-					$this->pager .= ($p == $i) ? " <span class='" . $this->selPageClass . "' style='" . $this->selPageStyle . "'>$i</span> " : " <a href='" . $url . "dpgn" . $this->id . "=$i' class='" . $this->pageClass . "' style='" . $this->pageStyle . "'>$i</a> ";
162
-				}
163
-			}
164
-		}
165
-
166
-		// render row : renderRowFnc($rowNumber,$row,$arguments="")
167
-		$fnc = $this->renderRowFnc;
168
-		$args = $this->renderRowFncArgs;
169
-
170
-		if(isset($fnc)) {
171
-			$i = 1;
172
-			$fncObject = is_object($fnc);
173
-			$minitems = (($p - 1) * $this->pageSize) + 1;
174
-			$maxitems = (($p - 1) * $this->pageSize) + $this->pageSize;
175
-			while($i <= $maxitems && ($row = ($isDataset) ? $modx->getDatabase()->getRow($this->ds) : $this->ds[$i - 1])) {
176
-				if($i >= $minitems && $i <= $maxitems) {
177
-					if($fncObject) {
178
-						if($args != "") {
179
-							$this->rows .= $fnc->RenderRowFnc($i, $row, $args);
180
-						} else {
181
-							$this->rows .= $fnc->RenderRowFnc($i, $row);
182
-						}
183
-					} else {
184
-						if($args != "") {
185
-							$this->rows .= $fnc($i, $row, $args);
186
-						} // if agrs was specified then we wil pass three params
187
-						else {
188
-							$this->rows .= $fnc($i, $row);
189
-						}                 // otherwise two will be passed
190
-					}
191
-
192
-				}
193
-				$i++;
194
-			}
195
-		}
196
-	}
93
+        $modx = evolutionCMS(); global $_PAGE;
94
+
95
+        $isDataset = $modx->getDatabase()->isResult($this->ds);
96
+
97
+        if(!$this->selPageStyle) {
98
+            $this->selPageStyle = "font-weight:bold";
99
+        }
100
+
101
+        // get total number of rows
102
+        $tnr = ($isDataset) ? $modx->getDatabase()->getRecordCount($this->ds) : count($this->ds);
103
+
104
+        // render: no records found
105
+        if($tnr <= 0) {
106
+            $fnc = $this->renderRowFnc;
107
+            $args = $this->renderRowFncArgs;
108
+            if(isset($fnc)) {
109
+                if($args != "") {
110
+                    $this->rows .= $fnc(0, null, $args);
111
+                } // if agrs was specified then we will pass three params
112
+                else {
113
+                    $this->rows .= $fnc(0, null);
114
+                }                 // otherwise two will be passed
115
+            }
116
+            return;
117
+        }
118
+
119
+        // get total pages
120
+        $tp = ceil($tnr / $this->pageSize);
121
+        if($this->pageNumber > $tp) {
122
+            $this->pageNumber = 1;
123
+        }
124
+
125
+        // get page number
126
+        $p = $this->pageNumber;
127
+
128
+        // save page number to view state if available
129
+        if(isset($_PAGE['vs'])) {
130
+            $_PAGE['vs'][$this->id . '_dpgn'] = $p;
131
+        }
132
+
133
+        // render pager : renderPagerFnc($cuurentPage,$pagerNumber,$arguments="");
134
+        if($tp > 1) {
135
+            $url = '';
136
+            $fnc = $this->renderPagerFnc;
137
+            $args = $this->renderPagerFncArgs;
138
+            if(!isset($fnc)) {
139
+                if($modx->isFrontend()) {
140
+                    $url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full') . '?';
141
+                } else {
142
+                    $url = $_SERVER['PHP_SELF'] . '?';
143
+                }
144
+                $i = 0;
145
+                foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) {
146
+                    $i++;
147
+                    $url .= (($i > 1) ? "&" : "") . "$n=$v";
148
+                }
149
+                if($i >= 1) {
150
+                    $url .= "&";
151
+                }
152
+            }
153
+            for($i = 1; $i <= $tp; $i++) {
154
+                if(isset($fnc)) {
155
+                    if($args != "") {
156
+                        $this->pager .= $fnc($p, $i, $args);
157
+                    } else {
158
+                        $this->pager .= $fnc($p, $i);
159
+                    }
160
+                } else {
161
+                    $this->pager .= ($p == $i) ? " <span class='" . $this->selPageClass . "' style='" . $this->selPageStyle . "'>$i</span> " : " <a href='" . $url . "dpgn" . $this->id . "=$i' class='" . $this->pageClass . "' style='" . $this->pageStyle . "'>$i</a> ";
162
+                }
163
+            }
164
+        }
165
+
166
+        // render row : renderRowFnc($rowNumber,$row,$arguments="")
167
+        $fnc = $this->renderRowFnc;
168
+        $args = $this->renderRowFncArgs;
169
+
170
+        if(isset($fnc)) {
171
+            $i = 1;
172
+            $fncObject = is_object($fnc);
173
+            $minitems = (($p - 1) * $this->pageSize) + 1;
174
+            $maxitems = (($p - 1) * $this->pageSize) + $this->pageSize;
175
+            while($i <= $maxitems && ($row = ($isDataset) ? $modx->getDatabase()->getRow($this->ds) : $this->ds[$i - 1])) {
176
+                if($i >= $minitems && $i <= $maxitems) {
177
+                    if($fncObject) {
178
+                        if($args != "") {
179
+                            $this->rows .= $fnc->RenderRowFnc($i, $row, $args);
180
+                        } else {
181
+                            $this->rows .= $fnc->RenderRowFnc($i, $row);
182
+                        }
183
+                    } else {
184
+                        if($args != "") {
185
+                            $this->rows .= $fnc($i, $row, $args);
186
+                        } // if agrs was specified then we wil pass three params
187
+                        else {
188
+                            $this->rows .= $fnc($i, $row);
189
+                        }                 // otherwise two will be passed
190
+                    }
191
+
192
+                }
193
+                $i++;
194
+            }
195
+        }
196
+    }
197 197
 }
Please login to merge, or discard this patch.
manager/actions/document_data.static.php 1 patch
Indentation   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+    die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6 6
 if(isset($_REQUEST['id'])) {
7
-	$id = (int) $_REQUEST['id'];
7
+    $id = (int) $_REQUEST['id'];
8 8
 } else {
9
-	$id = 0;
9
+    $id = 0;
10 10
 }
11 11
 
12 12
 if(isset($_GET['opened'])) {
13
-	$_SESSION['openedArray'] = $_GET['opened'];
13
+    $_SESSION['openedArray'] = $_GET['opened'];
14 14
 }
15 15
 
16 16
 $url = $modx->config['site_url'];
@@ -23,17 +23,17 @@  discard block
 block discarded – undo
23 23
 
24 24
 // Get access permissions
25 25
 if($_SESSION['mgrDocgroups']) {
26
-	$docgrp = implode(",", $_SESSION['mgrDocgroups']);
26
+    $docgrp = implode(",", $_SESSION['mgrDocgroups']);
27 27
 }
28 28
 $access = "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0" . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
29 29
 
30 30
 //
31 31
 if($_SESSION['tree_show_only_folders']) {
32
-	$parent = $id ? ($modx->getDatabase()->getValue("SELECT parent FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1")) : 0;
33
-	$isfolder = $modx->getDatabase()->getValue("SELECT isfolder FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1");
34
-	if(!$isfolder && $parent != 0) {
35
-		$id = $_REQUEST['id'] = $parent;
36
-	}
32
+    $parent = $id ? ($modx->getDatabase()->getValue("SELECT parent FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1")) : 0;
33
+    $isfolder = $modx->getDatabase()->getValue("SELECT isfolder FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1");
34
+    if(!$isfolder && $parent != 0) {
35
+        $id = $_REQUEST['id'] = $parent;
36
+    }
37 37
 }
38 38
 
39 39
 // Get the document content
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		LEFT JOIN {$tbl_document_groups} AS dg ON dg.document = sc.id", "sc.id ='{$id}' AND ({$access})");
42 42
 $content = $modx->getDatabase()->getRow($rs);
43 43
 if(!$content) {
44
-	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
44
+    $modx->webAlertAndQuit($_lang["access_permission_denied"]);
45 45
 }
46 46
 
47 47
 /**
@@ -83,134 +83,134 @@  discard block
 block discarded – undo
83 83
 $filter_sort = '';
84 84
 $filter_dir = '';
85 85
 if($numRecords > 0) {
86
-	$filter_sort = '<select size="1" name="sort" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&dir=' . $dir . '&sort=\'+this.options[this.selectedIndex].value">' . '<option value="createdon"' . (($sort == 'createdon') ? ' selected' : '') . '>' . $_lang['createdon'] . '</option>' . '<option value="pub_date"' . (($sort == 'pub_date') ? ' selected' : '') . '>' . $_lang["page_data_publishdate"] . '</option>' . '<option value="pagetitle"' . (($sort == 'pagetitle') ? ' selected' : '') . '>' . $_lang['pagetitle'] . '</option>' . '<option value="menuindex"' . (($sort == 'menuindex') ? ' selected' : '') . '>' . $_lang['resource_opt_menu_index'] . '</option>' . //********  resource_opt_is_published - //
87
-		'<option value="published"' . (($sort == 'published') ? ' selected' : '') . '>' . $_lang['resource_opt_is_published'] . '</option>' . //********//
88
-		'</select>';
89
-	$filter_dir = '<select size="1" name="dir" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&sort=' . $sort . '&dir=\'+this.options[this.selectedIndex].value">' . '<option value="DESC"' . (($dir == 'DESC') ? ' selected' : '') . '>' . $_lang['sort_desc'] . '</option>' . '<option value="ASC"' . (($dir == 'ASC') ? ' selected' : '') . '>' . $_lang['sort_asc'] . '</option>' . '</select>';
90
-	$resource = $modx->getDatabase()->makeArray($rs);
91
-
92
-	// CSS style for table
93
-	//	$tableClass = 'grid';
94
-	//	$rowHeaderClass = 'gridHeader';
95
-	//	$rowRegularClass = 'gridItem';
96
-	//	$rowAlternateClass = 'gridAltItem';
97
-	$tableClass = 'table data nowrap';
98
-	$columnHeaderClass = array(
99
-		'text-center',
100
-		'text-left',
101
-		'text-center',
102
-		'text-center',
103
-		'text-center',
104
-		'text-center'
105
-	);
106
-
107
-
108
-	$modx->getMakeTable()->setTableClass($tableClass);
109
-	$modx->getMakeTable()->setColumnHeaderClass($columnHeaderClass);
110
-	//	$modx->getMakeTable()->setRowHeaderClass($rowHeaderClass);
111
-	//	$modx->getMakeTable()->setRowRegularClass($rowRegularClass);
112
-	//	$modx->getMakeTable()->setRowAlternateClass($rowAlternateClass);
113
-
114
-	// Table header
115
-	$listTableHeader = array(
116
-		'docid' => $_lang['id'],
117
-		'title' => $_lang['resource_title'],
118
-		'createdon' => $_lang['createdon'],
119
-		'pub_date' => $_lang['page_data_publishdate'],
120
-		'status' => $_lang['page_data_status'],
121
-		'edit' => $_lang['mgrlog_action'],
122
-	);
123
-	$tbWidth = array(
124
-		'1%',
125
-		'',
126
-		'1%',
127
-		'1%',
128
-		'1%',
129
-		'1%'
130
-	);
131
-	$modx->getMakeTable()->setColumnWidths($tbWidth);
132
-
133
-	$sd = isset($_REQUEST['dir']) ? '&amp;dir=' . $_REQUEST['dir'] : '&amp;dir=DESC';
134
-	$sb = isset($_REQUEST['sort']) ? '&amp;sort=' . $_REQUEST['sort'] : '&amp;sort=createdon';
135
-	$pg = isset($_REQUEST['page']) ? '&amp;page=' . (int) $_REQUEST['page'] : '';
136
-	$add_path = $sd . $sb . $pg;
137
-
138
-	$icons = array(
139
-		'text/html' => $_style['tree_page_html'],
140
-		'text/plain' => $_style['tree_page'],
141
-		'text/xml' => $_style['tree_page_xml'],
142
-		'text/css' => $_style['tree_page_css'],
143
-		'text/javascript' => $_style['tree_page_js'],
144
-		'application/rss+xml' => $_style['tree_page_rss'],
145
-		'application/pdf' => $_style['tree_page_pdf'],
146
-		'application/vnd.ms-word' => $_style['tree_page_word'],
147
-		'application/vnd.ms-excel' => $_style['tree_page_excel'],
148
-		'image/gif' => $_style['tree_page_gif'],
149
-		'image/jpg' => $_style['tree_page_jpg'],
150
-		'image/png' => $_style['tree_page_png']
151
-	);
152
-
153
-	$listDocs = array();
154
-	foreach($resource as $k => $children) {
155
-
156
-		switch($children['id']) {
157
-			case $modx->config['site_start']            :
158
-				$icon = $_style['tree_page_home'];
159
-				break;
160
-			case $modx->config['error_page']            :
161
-				$icon = $_style['tree_page_404'];
162
-				break;
163
-			case $modx->config['site_unavailable_page'] :
164
-				$icon = $_style['tree_page_hourglass'];
165
-				break;
166
-			case $modx->config['unauthorized_page']     :
167
-				$icon = $_style['tree_page_info'];
168
-				break;
169
-			default:
170
-				if($children['isfolder']) {
171
-					$icon = $_style['tree_folder_new'];
172
-				} else {
173
-					if(isset($icons[$children['contentType']])) {
174
-						$icon = $icons[$children['contentType']];
175
-					} else {
176
-						$icon = $_style['tree_page'];
177
-					}
178
-				}
179
-		}
180
-
181
-		$private = ($children['privateweb'] || $children['privatemgr'] ? ' private' : '');
182
-
183
-		// дописываем в заголовок класс для неопубликованных плюс по всем ссылкам обратный путь
184
-		// для сохранения сортировки
185
-		$class = ($children['deleted'] ? 'text-danger text-decoration-through' : (!$children['published'] ? ' font-italic text-muted' : ' publish'));
186
-		//$class .= ($children['hidemenu'] ? ' text-muted' : ' text-primary');
187
-		//$class .= ($children['isfolder'] ? ' font-weight-bold' : '');
188
-		if($modx->hasPermission('edit_document')) {
189
-			$title = '<span class="doc-item' . $private . '">' . $icon . '<a href="index.php?a=27&amp;id=' . $children['id'] . $add_path . '">' . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></a></span>';
190
-		} else {
191
-			$title = '<span class="doc-item' . $private . '">' . $icon . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></span>';
192
-		}
193
-
194
-		$icon_pub_unpub = (!$children['published']) ? '<a href="index.php?a=61&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang["publish_resource"] . '"><i class="' . $_style["icons_publish_document"] . '"></i></a>' : '<a href="index.php?a=62&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang["unpublish_resource"] . '"><i class="' . $_style["icons_unpublish_resource"] . '" ></i></a>';
195
-
196
-		$icon_del_undel = (!$children['deleted']) ? '<a onclick="return confirm(\'' . $_lang["confirm_delete_resource"] . '\')" href="index.php?a=6&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['delete_resource'] . '"><i class="' . $_style["icons_delete_resource"] . '"></i></a>' : '<a onclick="return confirm(\'' . $_lang["confirm_undelete"] . '\')" href="index.php?a=63&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['undelete_resource'] . '"><i class="' . $_style["icons_undelete_resource"] . '"></i></a>';
197
-
198
-		$listDocs[] = array(
199
-			'docid' => '<div class="text-right">' . $children['id'] . '</div>',
200
-			'title' => $title,
201
-			'createdon' => '<div class="text-right">' . ($modx->toDateFormat($children['createdon'] + $server_offset_time, 'dateOnly')) . '</div>',
202
-			'pub_date' => '<div class="text-right">' . ($children['pub_date'] ? ($modx->toDateFormat($children['pub_date'] + $server_offset_time, 'dateOnly')) : '') . '</div>',
203
-			'status' => '<div class="text-nowrap">' . ($children['published'] == 0 ? '<span class="unpublishedDoc">' . $_lang['page_data_unpublished'] . '</span>' : '<span class="publishedDoc">' . $_lang['page_data_published'] . '</span>') . '</div>',
204
-			'edit' => '<div class="actions text-center text-nowrap">' . ($modx->hasPermission('edit_document') ? '<a href="index.php?a=27&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['edit'] . '"><i class="' . $_style["icons_edit_resource"] . '"></i></a><a href="index.php?a=51&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['move'] . '"><i 
86
+    $filter_sort = '<select size="1" name="sort" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&dir=' . $dir . '&sort=\'+this.options[this.selectedIndex].value">' . '<option value="createdon"' . (($sort == 'createdon') ? ' selected' : '') . '>' . $_lang['createdon'] . '</option>' . '<option value="pub_date"' . (($sort == 'pub_date') ? ' selected' : '') . '>' . $_lang["page_data_publishdate"] . '</option>' . '<option value="pagetitle"' . (($sort == 'pagetitle') ? ' selected' : '') . '>' . $_lang['pagetitle'] . '</option>' . '<option value="menuindex"' . (($sort == 'menuindex') ? ' selected' : '') . '>' . $_lang['resource_opt_menu_index'] . '</option>' . //********  resource_opt_is_published - //
87
+        '<option value="published"' . (($sort == 'published') ? ' selected' : '') . '>' . $_lang['resource_opt_is_published'] . '</option>' . //********//
88
+        '</select>';
89
+    $filter_dir = '<select size="1" name="dir" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&sort=' . $sort . '&dir=\'+this.options[this.selectedIndex].value">' . '<option value="DESC"' . (($dir == 'DESC') ? ' selected' : '') . '>' . $_lang['sort_desc'] . '</option>' . '<option value="ASC"' . (($dir == 'ASC') ? ' selected' : '') . '>' . $_lang['sort_asc'] . '</option>' . '</select>';
90
+    $resource = $modx->getDatabase()->makeArray($rs);
91
+
92
+    // CSS style for table
93
+    //	$tableClass = 'grid';
94
+    //	$rowHeaderClass = 'gridHeader';
95
+    //	$rowRegularClass = 'gridItem';
96
+    //	$rowAlternateClass = 'gridAltItem';
97
+    $tableClass = 'table data nowrap';
98
+    $columnHeaderClass = array(
99
+        'text-center',
100
+        'text-left',
101
+        'text-center',
102
+        'text-center',
103
+        'text-center',
104
+        'text-center'
105
+    );
106
+
107
+
108
+    $modx->getMakeTable()->setTableClass($tableClass);
109
+    $modx->getMakeTable()->setColumnHeaderClass($columnHeaderClass);
110
+    //	$modx->getMakeTable()->setRowHeaderClass($rowHeaderClass);
111
+    //	$modx->getMakeTable()->setRowRegularClass($rowRegularClass);
112
+    //	$modx->getMakeTable()->setRowAlternateClass($rowAlternateClass);
113
+
114
+    // Table header
115
+    $listTableHeader = array(
116
+        'docid' => $_lang['id'],
117
+        'title' => $_lang['resource_title'],
118
+        'createdon' => $_lang['createdon'],
119
+        'pub_date' => $_lang['page_data_publishdate'],
120
+        'status' => $_lang['page_data_status'],
121
+        'edit' => $_lang['mgrlog_action'],
122
+    );
123
+    $tbWidth = array(
124
+        '1%',
125
+        '',
126
+        '1%',
127
+        '1%',
128
+        '1%',
129
+        '1%'
130
+    );
131
+    $modx->getMakeTable()->setColumnWidths($tbWidth);
132
+
133
+    $sd = isset($_REQUEST['dir']) ? '&amp;dir=' . $_REQUEST['dir'] : '&amp;dir=DESC';
134
+    $sb = isset($_REQUEST['sort']) ? '&amp;sort=' . $_REQUEST['sort'] : '&amp;sort=createdon';
135
+    $pg = isset($_REQUEST['page']) ? '&amp;page=' . (int) $_REQUEST['page'] : '';
136
+    $add_path = $sd . $sb . $pg;
137
+
138
+    $icons = array(
139
+        'text/html' => $_style['tree_page_html'],
140
+        'text/plain' => $_style['tree_page'],
141
+        'text/xml' => $_style['tree_page_xml'],
142
+        'text/css' => $_style['tree_page_css'],
143
+        'text/javascript' => $_style['tree_page_js'],
144
+        'application/rss+xml' => $_style['tree_page_rss'],
145
+        'application/pdf' => $_style['tree_page_pdf'],
146
+        'application/vnd.ms-word' => $_style['tree_page_word'],
147
+        'application/vnd.ms-excel' => $_style['tree_page_excel'],
148
+        'image/gif' => $_style['tree_page_gif'],
149
+        'image/jpg' => $_style['tree_page_jpg'],
150
+        'image/png' => $_style['tree_page_png']
151
+    );
152
+
153
+    $listDocs = array();
154
+    foreach($resource as $k => $children) {
155
+
156
+        switch($children['id']) {
157
+            case $modx->config['site_start']            :
158
+                $icon = $_style['tree_page_home'];
159
+                break;
160
+            case $modx->config['error_page']            :
161
+                $icon = $_style['tree_page_404'];
162
+                break;
163
+            case $modx->config['site_unavailable_page'] :
164
+                $icon = $_style['tree_page_hourglass'];
165
+                break;
166
+            case $modx->config['unauthorized_page']     :
167
+                $icon = $_style['tree_page_info'];
168
+                break;
169
+            default:
170
+                if($children['isfolder']) {
171
+                    $icon = $_style['tree_folder_new'];
172
+                } else {
173
+                    if(isset($icons[$children['contentType']])) {
174
+                        $icon = $icons[$children['contentType']];
175
+                    } else {
176
+                        $icon = $_style['tree_page'];
177
+                    }
178
+                }
179
+        }
180
+
181
+        $private = ($children['privateweb'] || $children['privatemgr'] ? ' private' : '');
182
+
183
+        // дописываем в заголовок класс для неопубликованных плюс по всем ссылкам обратный путь
184
+        // для сохранения сортировки
185
+        $class = ($children['deleted'] ? 'text-danger text-decoration-through' : (!$children['published'] ? ' font-italic text-muted' : ' publish'));
186
+        //$class .= ($children['hidemenu'] ? ' text-muted' : ' text-primary');
187
+        //$class .= ($children['isfolder'] ? ' font-weight-bold' : '');
188
+        if($modx->hasPermission('edit_document')) {
189
+            $title = '<span class="doc-item' . $private . '">' . $icon . '<a href="index.php?a=27&amp;id=' . $children['id'] . $add_path . '">' . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></a></span>';
190
+        } else {
191
+            $title = '<span class="doc-item' . $private . '">' . $icon . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></span>';
192
+        }
193
+
194
+        $icon_pub_unpub = (!$children['published']) ? '<a href="index.php?a=61&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang["publish_resource"] . '"><i class="' . $_style["icons_publish_document"] . '"></i></a>' : '<a href="index.php?a=62&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang["unpublish_resource"] . '"><i class="' . $_style["icons_unpublish_resource"] . '" ></i></a>';
195
+
196
+        $icon_del_undel = (!$children['deleted']) ? '<a onclick="return confirm(\'' . $_lang["confirm_delete_resource"] . '\')" href="index.php?a=6&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['delete_resource'] . '"><i class="' . $_style["icons_delete_resource"] . '"></i></a>' : '<a onclick="return confirm(\'' . $_lang["confirm_undelete"] . '\')" href="index.php?a=63&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['undelete_resource'] . '"><i class="' . $_style["icons_undelete_resource"] . '"></i></a>';
197
+
198
+        $listDocs[] = array(
199
+            'docid' => '<div class="text-right">' . $children['id'] . '</div>',
200
+            'title' => $title,
201
+            'createdon' => '<div class="text-right">' . ($modx->toDateFormat($children['createdon'] + $server_offset_time, 'dateOnly')) . '</div>',
202
+            'pub_date' => '<div class="text-right">' . ($children['pub_date'] ? ($modx->toDateFormat($children['pub_date'] + $server_offset_time, 'dateOnly')) : '') . '</div>',
203
+            'status' => '<div class="text-nowrap">' . ($children['published'] == 0 ? '<span class="unpublishedDoc">' . $_lang['page_data_unpublished'] . '</span>' : '<span class="publishedDoc">' . $_lang['page_data_published'] . '</span>') . '</div>',
204
+            'edit' => '<div class="actions text-center text-nowrap">' . ($modx->hasPermission('edit_document') ? '<a href="index.php?a=27&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['edit'] . '"><i class="' . $_style["icons_edit_resource"] . '"></i></a><a href="index.php?a=51&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['move'] . '"><i 
205 205
 				class="' . $_style["icons_move_document"] . '"></i></a>' . $icon_pub_unpub : '') . ($modx->hasPermission('delete_document') ? $icon_del_undel : '') . '</div>'
206
-		);
207
-	}
206
+        );
207
+    }
208 208
 
209
-	$modx->getMakeTable()->createPagingNavigation($numRecords, 'a=3&id=' . $content['id'] . '&dir=' . $dir . '&sort=' . $sort);
210
-	$children_output = $modx->getMakeTable()->create($listDocs, $listTableHeader, 'index.php?a=3&amp;id=' . $content['id']);
209
+    $modx->getMakeTable()->createPagingNavigation($numRecords, 'a=3&id=' . $content['id'] . '&dir=' . $dir . '&sort=' . $sort);
210
+    $children_output = $modx->getMakeTable()->create($listDocs, $listTableHeader, 'index.php?a=3&amp;id=' . $content['id']);
211 211
 } else {
212
-	// No Child documents
213
-	$children_output = '<div class="container"><p>' . $_lang['resources_in_container_no'] . '</p></div>';
212
+    // No Child documents
213
+    $children_output = '<div class="container"><p>' . $_lang['resources_in_container_no'] . '</p></div>';
214 214
 }
215 215
 ?>
216 216
 	<script type="text/javascript">
@@ -411,20 +411,20 @@  discard block
 block discarded – undo
411 411
 				<h2 class="tab"><?= $_lang['page_data_source'] ?></h2>
412 412
 				<script type="text/javascript">docSettings.addTabPage(document.getElementById("tabSource"));</script>
413 413
 				<?php
414
-				$buffer = "";
415
-				$filename = $modx->config['base_path'] . "assets/cache/docid_" . $id . ".pageCache.php";
416
-				$handle = @fopen($filename, "r");
417
-				if(!$handle) {
418
-					$buffer = '<div class="container container-body">' . $_lang['page_data_notcached'] . '</div>';
419
-				} else {
420
-					while(!feof($handle)) {
421
-						$buffer .= fgets($handle, 4096);
422
-					}
423
-					fclose($handle);
424
-					$buffer = '<div class="navbar navbar-editor">' . $_lang['page_data_cached'] . '</div><div class="section-editor clearfix"><textarea rows="20" wrap="soft">' . $modx->getPhpCompat()->htmlspecialchars($buffer) . "</textarea></div>\n";
425
-				}
426
-				echo $buffer;
427
-				?>
414
+                $buffer = "";
415
+                $filename = $modx->config['base_path'] . "assets/cache/docid_" . $id . ".pageCache.php";
416
+                $handle = @fopen($filename, "r");
417
+                if(!$handle) {
418
+                    $buffer = '<div class="container container-body">' . $_lang['page_data_notcached'] . '</div>';
419
+                } else {
420
+                    while(!feof($handle)) {
421
+                        $buffer .= fgets($handle, 4096);
422
+                    }
423
+                    fclose($handle);
424
+                    $buffer = '<div class="navbar navbar-editor">' . $_lang['page_data_cached'] . '</div><div class="section-editor clearfix"><textarea rows="20" wrap="soft">' . $modx->getPhpCompat()->htmlspecialchars($buffer) . "</textarea></div>\n";
425
+                }
426
+                echo $buffer;
427
+                ?>
428 428
 			</div><!-- end tab-page -->
429 429
 		<?php } ?>
430 430
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 
433 433
 <?php
434 434
 if(isset($_GET['tab']) && is_numeric($_GET['tab'])) {
435
-	echo '<script type="text/javascript"> docSettings.setSelectedIndex( ' . $_GET['tab'] . ' );</script>';
435
+    echo '<script type="text/javascript"> docSettings.setSelectedIndex( ' . $_GET['tab'] . ' );</script>';
436 436
 }
437 437
 ?>
438 438
 
Please login to merge, or discard this patch.