Zaktualizowano obsługę błędów, dodano nowe pola do formularza edycji artykułów oraz poprawiono logikę zapisu daty modyfikacji.

This commit is contained in:
2025-02-05 22:23:10 +01:00
parent 8da0fc1925
commit a029c693b1
4 changed files with 30 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
<?
error_reporting( E_ALL ^ E_NOTICE ^ E_STRICT );
error_reporting( E_ALL ^ E_NOTICE ^ E_STRICT ^ E_WARNING ^ E_DEPRECATED );
function __autoload_my_classes( $classname )
{
$q = explode( '\\' , $classname );

View File

@@ -119,12 +119,19 @@ ob_start();
</div>
</div>
<div>
<? if ( is_array( $this -> authors ) ): foreach ( $this -> authors as $author ): $authors[ $author['id'] ] = $author['author']; endforeach; endif;?>
<?
$authors[0] = '--- wybierz autora ---';
if ( is_array( $this -> authors ) ):
foreach ( $this -> authors as $author ):
$authors[ $author['id'] ] = $author['author'];
endforeach;
endif;
?>
<?= \Html::select( [
'label' => 'Autor',
'name' => "id_author",
'id' => 'id_author',
'values' => array_merge( [ '0' => '--- wybierz autora ---' ], $authors ),
'values' => $authors,
'value' => $this -> article['id_author']
] );?>
<?= \Html::input_switch(
@@ -148,6 +155,11 @@ ob_start();
'checked' => $this -> article['show_title'] == 1 ? true : false
)
);?>
<?= \Html::input_switch( [
'label' => 'Pokaż spis treści',
'name' => 'show_table_of_contents',
'checked' => $this -> article['show_table_of_contents'] == 1 ? true : false
] );?>
<?= \Html::input_switch(
array(
'label' => 'Pokaż datę dodania',
@@ -169,6 +181,15 @@ ob_start();
'checked' => $this -> article['show_date_modify'] == 1 ? true : false
)
);?>
<?= \Html::input(
array(
'label' => 'Data modyfikacji',
'class' => 'date-time',
'name' => 'date_modify',
'id' => 'date_modify',
'value' => $this -> article['date_modify'] ? $this -> article['date_modify'] : date( 'Y-m-d H:i:s' )
)
);?>
<?= \Html::input_switch(
array(
'label' => 'Powtórz wprowadzenie',

View File

@@ -99,7 +99,7 @@ class Articles
if ( $id = \admin\factory\Articles::article_save(
$values['id'], $values['title'], $values['main_image'], $values['entry'], $values['text'], $values['table_of_contents'], $values['status'], $values['show_title'], $values['show_table_of_contents'], $values['show_date_add'], $values['date_add'],
$values['show_date_modify'], $values['seo_link'], $values['meta_title'], $values['meta_description'], $values['meta_keywords'], $values['layout_id'],
$values['show_date_modify'], $values['date_modify'], $values['seo_link'], $values['meta_title'], $values['meta_description'], $values['meta_keywords'], $values['layout_id'],
$values['pages'], $values['noindex'], $values['repeat_entry'], $values['copy_from'], $values['social_icons'], $values['event_date'], $values['hidden-tags'], $values['block_direct_access'],
$values['priority'], $values['password'], $values['pixieset'], $values['id_author'], $params
) )

View File

@@ -238,7 +238,7 @@ class Articles
}
public static function article_save(
$article_id, $title, $main_image, $entry, $text, $table_of_contents, $status, $show_title, $show_table_of_contents, $show_date_add, $date_add, $show_date_modify, $seo_link, $meta_title, $meta_description,
$article_id, $title, $main_image, $entry, $text, $table_of_contents, $status, $show_title, $show_table_of_contents, $show_date_add, $date_add, $show_date_modify, $date_modify, $seo_link, $meta_title, $meta_description,
$meta_keywords, $layout_id, $pages, $noindex, $repeat_entry, $copy_from, $social_icons, $event_date, $tags, $block_direct_access, $priority,
$password, $pixieset, $id_author, $params )
{
@@ -254,8 +254,8 @@ class Articles
'show_table_of_contents' => $show_table_of_contents == 'on' ? 1 : 0,
'show_date_add' => $show_date_add == 'on' ? 1 : 0,
'show_date_modify' => $show_date_modify == 'on' ? 1 : 0,
'date_add' => $date_add ? $date_add : date( 'Y-m-d H:i:s' ),
'date_modify' => $date_add ? $date_add : date( 'Y-m-d H:i:s' ),
'date_add' => date( 'Y-m-d H:i:s' ),
'date_modify' => date( 'Y-m-d H:i:s' ),
'modify_by' => $user['id'],
'layout_id' => $layout_id ? (int)$layout_id : null,
'status' => $status == 'on' ? 1 : 0,
@@ -438,8 +438,9 @@ class Articles
'show_title' => $show_title == 'on' ? 1 : 0,
'show_table_of_contents' => $show_table_of_contents == 'on' ? 1 : 0,
'show_date_add' => $show_date_add == 'on' ? 1 : 0,
'date_add' => $date_add,
'show_date_modify' => $show_date_modify == 'on' ? 1 : 0,
'date_modify' => date( 'Y-m-d H:i:s' ),
'date_modify' => $date_modify ? $date_modify : date( 'Y-m-d H:i:s' ),
'modify_by' => $user['id'],
'layout_id' => $layout_id ? (int)$layout_id : null,
'status' => $status == 'on' ? 1 : 0,