Skip to content

Commit 77064bb

Browse files
committed
[FIX] PHP 8 errors in page to show document's data.
1 parent c2d7261 commit 77064bb

File tree

1 file changed

+49
-52
lines changed

1 file changed

+49
-52
lines changed

manager/views/page/3.blade.php

Lines changed: 49 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
'cancel' => 'index.php?' . ($id == 0 ? 'a=2' : 'a=3&r=1&id=' . $id . $add_path),
5858
'move' => 'index.php?id=' . $_REQUEST['id'] . '&a=51',
5959
'duplicate' => 'index.php?id=' . $_REQUEST['id'] . '&a=94',
60-
'view' => $modx->getConfig('friendly_urls') ? UrlProcessor::makeUrl($id) : MODX_SITE_URL . 'index.php?id=' . $id,
60+
'view' => evo()->getConfig('friendly_urls') ? UrlProcessor::makeUrl($id) : MODX_SITE_URL . 'index.php?id=' . $id,
6161
];
6262
6363
/**
@@ -77,9 +77,8 @@
7777
}
7878
7979
// Get Template name
80-
$templatename = \EvolutionCMS\Models\SiteTemplate::query()->where('id', '=',
81-
$content['template'])->get()->toArray();
82-
if (!is_null($templatename)) {
80+
$templatename = \EvolutionCMS\Models\SiteTemplate::query()->where('id', '=', $content['template'])->get()->toArray();
81+
if (count($templatename)) {
8382
$templatename = $templatename[0]['templatename'];
8483
}
8584
@@ -90,7 +89,7 @@
9089
/**
9190
* "View Children" tab setup
9291
*/
93-
$maxpageSize = $modx->getConfig('number_of_results');
92+
$maxpageSize = evo()->getConfig('number_of_results');
9493
define('MAX_DISPLAY_RECORDS_NUM', $maxpageSize);
9594
9695
// predefined constants
@@ -114,8 +113,7 @@
114113
if ($_SESSION['mgrRole'] != 1) {
115114
if (is_array($_SESSION['mgrDocgroups']) && count($_SESSION['mgrDocgroups']) > 0) {
116115
$childs = $resources->where(function ($q) {
117-
$q->where('site_content.privatemgr', 0)
118-
->orWhereIn('document_groups.document_group', $_SESSION['mgrDocgroups']);
116+
$q->where('site_content.privatemgr', 0)->orWhereIn('document_groups.document_group', $_SESSION['mgrDocgroups']);
119117
});
120118
} else {
121119
$childs = $resources->where('site_content.privatemgr', 0);
@@ -131,9 +129,7 @@
131129
// Get child documents (with paging)
132130
133131
if ($numRecords > 0) {
134-
$childs = $childs->orderBy($sort,
135-
$dir)->offset($pg * MAX_DISPLAY_RECORDS_NUM)->limit(MAX_DISPLAY_RECORDS_NUM)->get();
136-
132+
$childs = $childs->orderBy($sort, $dir)->offset($pg * MAX_DISPLAY_RECORDS_NUM)->limit(MAX_DISPLAY_RECORDS_NUM)->get();
137133
$resource = $childs->toArray();
138134
139135
// CSS style for table
@@ -153,9 +149,9 @@
153149
$table = new \EvolutionCMS\Support\MakeTable();
154150
$table->setTableClass($tableClass);
155151
$table->setColumnHeaderClass($columnHeaderClass);
156-
// $modx->getMakeTable()->setRowHeaderClass($rowHeaderClass);
157-
// $modx->getMakeTable()->setRowRegularClass($rowRegularClass);
158-
// $modx->getMakeTable()->setRowAlternateClass($rowAlternateClass);
152+
// evo()->getMakeTable()->setRowHeaderClass($rowHeaderClass);
153+
// evo()->getMakeTable()->setRowRegularClass($rowRegularClass);
154+
// evo()->getMakeTable()->setRowAlternateClass($rowAlternateClass);
159155
160156
// Table header
161157
$listTableHeader = array(
@@ -195,16 +191,16 @@
195191
foreach ($resource as $k => $children) {
196192
197193
switch ($children['id']) {
198-
case $modx->getConfig('site_start') :
194+
case evo()->getConfig('site_start') :
199195
$icon = '<i class="' . $_style['icon_home'] . '"></i>';
200196
break;
201-
case $modx->getConfig('error_page') :
197+
case evo()->getConfig('error_page') :
202198
$icon = '<i class="' . $_style['icon_info_triangle'] . '"></i>';
203199
break;
204-
case $modx->getConfig('site_unavailable_page') :
200+
case evo()->getConfig('site_unavailable_page') :
205201
$icon = '<i class="' . $_style['icon_clock'] . '"></i>';
206202
break;
207-
case $modx->getConfig('unauthorized_page') :
203+
case evo()->getConfig('unauthorized_page') :
208204
$icon = '<i class="' . $_style['icon_info'] . '"></i>';
209205
break;
210206
default:
@@ -221,17 +217,15 @@
221217
222218
$private = ($children['privateweb'] || $children['privatemgr'] ? ' private' : '');
223219
224-
// дописываем в заголовок класс для неопубликованных плюс по всем ссылкам обратный путь
225-
// для сохранения сортировки
220+
// дописуємо в заголовок клас для неопублікованих плюс по всім посиланням зворотній шлях
221+
// для збереження сортування
226222
$class = ($children['deleted'] ? 'text-danger text-decoration-through' : (!$children['published'] ? ' font-italic text-muted' : ' publish'));
227-
//$class .= ($children['hidemenu'] ? ' text-muted' : ' text-primary');
228-
//$class .= ($children['isfolder'] ? ' font-weight-bold' : '');
229-
if ($modx->hasPermission('edit_document')) {
223+
if (evo()->hasPermission('edit_document')) {
230224
$title = '<span class="doc-item' . $private . '">' . $icon . '<a href="index.php?a=27&id=' . $children['id'] . $add_path . '">' . '<span class="' . $class . '">' . entities($children['pagetitle'],
231-
$modx->getConfig('modx_charset')) . '</span></a></span>';
225+
evo()->getConfig('modx_charset')) . '</span></a></span>';
232226
} else {
233227
$title = '<span class="doc-item' . $private . '">' . $icon . '<span class="' . $class . '">' . entities($children['pagetitle'],
234-
$modx->getConfig('modx_charset')) . '</span></span>';
228+
evo()->getConfig('modx_charset')) . '</span></span>';
235229
}
236230
237231
$icon_pub_unpub = (!$children['published'])
@@ -245,14 +239,14 @@
245239
$listDocs[] = array(
246240
'docid' => '<div class="text-right">' . $children['id'] . '</div>',
247241
'title' => $title,
248-
'createdon' => '<div class="text-right">' . ($modx->toDateFormat($children['createdon'] + $modx->timestamp(0),
242+
'createdon' => '<div class="text-right">' . (evo()->toDateFormat($children['createdon'] + evo()->timestamp(0),
249243
'dateOnly')) . '</div>',
250-
'pub_date' => '<div class="text-right">' . ($children['pub_date'] ? ($modx->toDateFormat($children['pub_date'] + $modx->timestamp(0),
244+
'pub_date' => '<div class="text-right">' . ($children['pub_date'] ? (evo()->toDateFormat($children['pub_date'] + evo()->timestamp(0),
251245
'dateOnly')) : '') . '</div>',
252246
'status' => '<div class="text-nowrap">' . ($children['published'] == 0 ? '<span class="unpublishedDoc">' . ManagerTheme::getLexicon('page_data_unpublished') . '</span>' : '<span class="publishedDoc">' . ManagerTheme::getLexicon('page_data_published') . '</span>') . '</div>',
253-
'edit' => '<div class="actions text-center text-nowrap">' . ($modx->hasPermission('edit_document') ? '<a href="index.php?a=27&id=' . $children['id'] . $add_path . '" title="' . ManagerTheme::getLexicon('edit') . '"><i class="' . $_style['icon_edit'] . '"></i></a>
247+
'edit' => '<div class="actions text-center text-nowrap">' . (evo()->hasPermission('edit_document') ? '<a href="index.php?a=27&id=' . $children['id'] . $add_path . '" title="' . ManagerTheme::getLexicon('edit') . '"><i class="' . $_style['icon_edit'] . '"></i></a>
254248
<a href="index.php?a=51&id=' . $children['id'] . $add_path . '" title="' . ManagerTheme::getLexicon('move') . '"><i
255-
class="' . $_style['icon_move'] . '"></i></a>' . $icon_pub_unpub : '') . ($modx->hasPermission('delete_document') ? $icon_del_undel : '') . '</div>'
249+
class="' . $_style['icon_move'] . '"></i></a>' . $icon_pub_unpub : '') . (evo()->hasPermission('delete_document') ? $icon_del_undel : '') . '</div>'
256250
);
257251
}
258252
@@ -264,7 +258,6 @@ class="' . $_style['icon_move'] . '"></i></a>' . $icon_pub_unpub : '') . ($modx-
264258
$add_path = '';
265259
}
266260
}
267-
268261
?>
269262
<script type="text/javascript">
270263
var actions = {
@@ -308,8 +301,8 @@ class="' . $_style['icon_move'] . '"></i></a>' . $icon_pub_unpub : '') . ($modx-
308301

309302
<h1>
310303
<i class="{{ $_style['icon_info'] }}"></i>
311-
{{ entities(iconv_substr($content['pagetitle'], 0, 50, $modx->getConfig('modx_charset')), $modx->getConfig('modx_charset')) }}
312-
@if(iconv_strlen($content['pagetitle'], $modx->getConfig('modx_charset')) > 50)
304+
{{ entities(iconv_substr($content['pagetitle'], 0, 50, evo()->getConfig('modx_charset')), evo()->getConfig('modx_charset')) }}
305+
@if(iconv_strlen($content['pagetitle'], evo()->getConfig('modx_charset')) > 50)
313306
...
314307
@endif
315308
<small>({{ (int)$_REQUEST['id'] }})</small>
@@ -319,7 +312,7 @@ class="' . $_style['icon_move'] . '"></i></a>' . $icon_pub_unpub : '') . ($modx-
319312

320313
<div class="tab-pane" id="childPane">
321314
<script type="text/javascript">
322-
docSettings = new WebFXTabPane(document.getElementById("childPane"), @if($modx->getConfig('remember_last_tab')) true
315+
docSettings = new WebFXTabPane(document.getElementById("childPane"), @if(evo()->getConfig('remember_last_tab')) true
323316
@else false @endif);
324317
</script>
325318

@@ -340,45 +333,51 @@ class="' . $_style['icon_move'] . '"></i></a>' . $icon_pub_unpub : '') . ($modx-
340333
<td width="200" valign="top">{{ ManagerTheme::getLexicon('long_title') }}:</td>
341334
<td>
342335
<small><?= $content['longtitle'] != '' ? entities($content['longtitle'],
343-
$modx->getConfig('modx_charset')) : "(<i>" . ManagerTheme::getLexicon('not_set') . "</i>)" ?></small>
336+
evo()->getConfig('modx_charset')) : "(<i>" . ManagerTheme::getLexicon('not_set') . "</i>)" ?>
337+
</small>
344338
</td>
345339
</tr>
346340
<tr>
347341
<td valign="top">{{ ManagerTheme::getLexicon('resource_description') }}:</td>
348342
<td><?= $content['description'] != '' ? entities($content['description'],
349-
$modx->getConfig('modx_charset')) : "(<i>" . ManagerTheme::getLexicon('not_set') . "</i>)" ?></td>
343+
evo()->getConfig('modx_charset')) : "(<i>" . ManagerTheme::getLexicon('not_set') . "</i>)" ?>
344+
</td>
350345
</tr>
351346
<tr>
352347
<td valign="top">{{ ManagerTheme::getLexicon('resource_summary') }}:</td>
353348
<td><?= $content['introtext'] != '' ? entities($content['introtext'],
354-
$modx->getConfig('modx_charset')) : "(<i>" . ManagerTheme::getLexicon('not_set') . "</i>)" ?></td>
349+
evo()->getConfig('modx_charset')) : "(<i>" . ManagerTheme::getLexicon('not_set') . "</i>)" ?>
350+
</td>
355351
</tr>
356352
<tr>
357353
<td valign="top">{{ ManagerTheme::getLexicon('type') }}:</td>
358354
<td><?= $content['type'] == 'reference' ? ManagerTheme::getLexicon('weblink') : ManagerTheme::getLexicon('resource') ?></td>
359355
</tr>
360356
<tr>
361357
<td valign="top">{{ ManagerTheme::getLexicon('resource_alias') }}:</td>
362-
<td><?= $content['alias'] != '' ? entities($content['alias'],
363-
$modx->getConfig('modx_charset')) : "(<i>" . ManagerTheme::getLexicon('not_set') . "</i>)" ?></td>
358+
<td><?= $content['alias'] != '' ? entities($content['alias'], evo()->getConfig('modx_charset')) : "(<i>" . ManagerTheme::getLexicon('not_set') . "</i>)" ?></td>
364359
</tr>
365360
<tr>
366361
<td colspan="2">&nbsp;</td>
367362
</tr>
368363
<tr>
369-
<td colspan="2"><b>{{ ManagerTheme::getLexicon('page_data_changes') }}</b></td>
364+
<td colspan="2"><b>{{ManagerTheme::getLexicon('page_data_changes')}}</b></td>
370365
</tr>
371366
<tr>
372-
<td>{{ ManagerTheme::getLexicon('page_data_created') }}:</td>
373-
<td><?= $modx->toDateFormat($content['createdon'] + $modx->timestamp(0)) ?>
374-
(<b><?= entities($createdbyname, $modx->getConfig('modx_charset')) ?></b>)
367+
<td>{{ManagerTheme::getLexicon('page_data_created')}}:</td>
368+
<td>{{evo()->toDateFormat($content['createdon'] + evo()->timestamp(0))}}
369+
@if($createdbyname)
370+
(<b>{{$createdbyname}}</b>)
371+
@else
372+
(<i>{{ManagerTheme::getLexicon('not_set')}}</i>)
373+
@endif
375374
</td>
376375
</tr>
377376
<?php if($editedbyname != '') { ?>
378377
<tr>
379-
<td>{{ ManagerTheme::getLexicon('page_data_edited') }}:</td>
380-
<td><?= $modx->toDateFormat($content['editedon'] + $modx->timestamp(0)) ?>
381-
(<b><?= entities($editedbyname, $modx->getConfig('modx_charset')) ?></b>)
378+
<td>{{ManagerTheme::getLexicon('page_data_edited')}}:</td>
379+
<td><?= evo()->toDateFormat($content['editedon'] + evo()->timestamp(0)) ?>
380+
(<b><?= entities($editedbyname, evo()->getConfig('modx_charset')) ?></b>)
382381
</td>
383382
</tr>
384383
<?php } ?>
@@ -394,11 +393,11 @@ class="' . $_style['icon_move'] . '"></i></a>' . $icon_pub_unpub : '') . ($modx-
394393
</tr>
395394
<tr>
396395
<td>{{ ManagerTheme::getLexicon('page_data_publishdate') }}:</td>
397-
<td><?= $content['pub_date'] == 0 ? "(<i>" . ManagerTheme::getLexicon('not_set') . "</i>)" : $modx->toDateFormat($content['pub_date']) ?></td>
396+
<td><?= $content['pub_date'] == 0 ? "(<i>" . ManagerTheme::getLexicon('not_set') . "</i>)" : evo()->toDateFormat($content['pub_date']) ?></td>
398397
</tr>
399398
<tr>
400399
<td>{{ ManagerTheme::getLexicon('page_data_unpublishdate') }}:</td>
401-
<td><?= $content['unpub_date'] == 0 ? "(<i>" . ManagerTheme::getLexicon('not_set') . "</i>)" : $modx->toDateFormat($content['unpub_date']) ?></td>
400+
<td><?= $content['unpub_date'] == 0 ? "(<i>" . ManagerTheme::getLexicon('not_set') . "</i>)" : evo()->toDateFormat($content['unpub_date']) ?></td>
402401
</tr>
403402
<tr>
404403
<td>{{ ManagerTheme::getLexicon('page_data_cacheable') }}:</td>
@@ -410,7 +409,7 @@ class="' . $_style['icon_move'] . '"></i></a>' . $icon_pub_unpub : '') . ($modx-
410409
</tr>
411410
<tr>
412411
<td>{{ ManagerTheme::getLexicon('resource_opt_menu_index') }}:</td>
413-
<td><?= entities($content['menuindex'], $modx->getConfig('modx_charset')) ?></td>
412+
<td><?= entities($content['menuindex'], evo()->getConfig('modx_charset')) ?></td>
414413
</tr>
415414
<tr>
416415
<td>{{ ManagerTheme::getLexicon('resource_opt_show_menu') }}:</td>
@@ -433,7 +432,7 @@ class="' . $_style['icon_move'] . '"></i></a>' . $icon_pub_unpub : '') . ($modx-
433432
<tr>
434433
<td>{{ ManagerTheme::getLexicon('page_data_template') }}:</td>
435434
<td><?= $content['template'] == 0 ? "(<i>" . ManagerTheme::getLexicon('not_set') . "</i>)" : entities($templatename,
436-
$modx->getConfig('modx_charset')) ?></td>
435+
evo()->getConfig('modx_charset')) ?></td>
437436
</tr>
438437
<tr>
439438
<td>{{ ManagerTheme::getLexicon('page_data_editor') }}:</td>
@@ -456,7 +455,7 @@ class="' . $_style['icon_move'] . '"></i></a>' . $icon_pub_unpub : '') . ($modx-
456455
<div class="form-group clearfix">
457456
@if($numRecords > 0)
458457
<div class="float-xs-left">
459-
<span class="publishedDoc">{{ $numRecords }} {{ ManagerTheme::getLexicon('resources_in_container') }} (<strong>{{ entities($content['pagetitle'], $modx->getConfig('modx_charset')) }}</strong>)</span>
458+
<span class="publishedDoc">{{ $numRecords }} {{ ManagerTheme::getLexicon('resources_in_container') }} (<strong>{{ entities($content['pagetitle'], evo()->getConfig('modx_charset')) }}</strong>)</span>
460459
</div>
461460
@endif
462461
<div class="float-right">
@@ -483,7 +482,6 @@ class="' . $_style['icon_move'] . '"></i></a>' . $icon_pub_unpub : '') . ($modx-
483482
</div>
484483
</div><!-- end tab-page -->
485484
@endif
486-
487485
</div><!-- end documentPane -->
488486

489487
@if(is_numeric(get_by_key($_GET, 'tab')))
@@ -495,8 +493,7 @@ class="' . $_style['icon_move'] . '"></i></a>' . $icon_pub_unpub : '') . ($modx-
495493
@if(!empty($show_preview))
496494
<div class="sectionHeader">{{ ManagerTheme::getLexicon('preview') }}</div>
497495
<div class="sectionBody" id="lyr2">
498-
<iframe src="{{ MODX_SITE_URL }}index.php?id={{ $id }}&z=manprev" frameborder="0" border="0"
499-
id="previewIframe"></iframe>
496+
<iframe src="{{ MODX_SITE_URL }}index.php?id={{ $id }}&z=manprev" frameborder="0" border="0" id="previewIframe"></iframe>
500497
</div>
501498
@endif
502499
@endsection

0 commit comments

Comments
 (0)