Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Commit

Permalink
more filter and page thumbnails
Browse files Browse the repository at this point in the history
- filter pages by status (public, draft, ghost ...)
- add page thumbnails
  • Loading branch information
patkon committed Mar 11, 2022
1 parent 3d6f945 commit 0063a97
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 9 deletions.
10 changes: 6 additions & 4 deletions backend/ajax.updatemetas.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@

require_once '../../../acp/core/access.php';

$page_title = fc_return_clean_value($_POST['page_title']);
$page_linkname = fc_return_clean_value($_POST['page_linkname']);
$page_meta_description = fc_return_clean_value($_POST['page_meta_description']);
$page_title = fc_return_clean_value($_POST['page_title']);
$page_linkname = fc_return_clean_value($_POST['page_linkname']);
$page_meta_description = fc_return_clean_value($_POST['page_meta_description']);
$page_thumbnail = $_POST['page_thumbnail'];

$data = $db_content->update("fc_pages", [
"page_title" => $page_title,
"page_linkname" => $page_linkname,
"page_meta_description" => $page_meta_description
"page_meta_description" => $page_meta_description,
"page_thumbnail" => $page_thumbnail
], [
"page_id" => $_POST['page_id']
]);
Expand Down
20 changes: 18 additions & 2 deletions backend/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* lang a = all, en/de/es/ ... filter by language
*/

function be_get_pages($type,$lang) {
function be_get_pages($type,$status,$lang) {

global $db_content;
global $languagePack;
Expand All @@ -21,14 +21,30 @@ function be_get_pages($type,$lang) {
$type_query = "page_sort = '' ";
}

if($status == 'a') {
$status_query = "page_status != '' ";
}
if($status == 'p') {
$status_query = "page_status = 'public' ";
}
if($status == 'pr') {
$status_query = "page_status = 'private' ";
}
if($status == 'g') {
$status_query = "page_status = 'ghost' ";
}
if($status == 'd') {
$status_query = "page_status = 'draft' ";
}


if($lang == '') {
$lang = $languagePack;
}



$query = "SELECT * FROM fc_pages WHERE (($type_query) AND (page_language = '$lang')) ORDER BY page_sort *1 ASC, LENGTH(page_sort), page_sort ASC";
$query = "SELECT * FROM fc_pages WHERE (($type_query) AND ($status_query) AND (page_language = '$lang')) ORDER BY page_sort *1 ASC, LENGTH(page_sort), page_sort ASC";
$get_pages = $db_content->query($query)->fetchAll();
return $get_pages;

Expand Down
85 changes: 82 additions & 3 deletions backend/metas.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@
$_SESSION['be_pt'] = 's';
}

if(!isset($_SESSION['be_st']) OR $_GET['st'] == 'a') {
$_SESSION['be_st'] = 'a';
}

if($_GET['st'] == 'p' || $_GET['st'] == 'd' || $_GET['st'] == 'pr' || $_GET['st'] == 'g') {
$_SESSION['be_st'] = $_GET['st'];
}




/* language */
$arr_lang = get_all_languages();

Expand All @@ -25,9 +36,30 @@
}


$get_all_pages = be_get_pages($_SESSION['be_pt'],$_SESSION['be_lang']);
$get_all_pages = be_get_pages($_SESSION['be_pt'],$_SESSION['be_st'],$_SESSION['be_lang']);
$cnt_pages = count($get_all_pages);


/* thumbnails */
$images = fc_get_all_media_data('image');
$images = fc_unique_multi_array($images,'media_file');
$thumbs = array();

foreach($images as $img) {

$image_name = basename($img['media_file']);
if($prefs_pagethumbnail_prefix != '') {
if((strpos($image_name, $prefs_pagethumbnail_prefix)) === false) {
continue;
}
}

$thumbs[] = $img['media_file'];
}




echo '<div class="subHeader">bulkedit.mod / edit meta data / (Matches: '.$cnt_pages.')</div>';

echo '<div class="app-container">';
Expand All @@ -42,6 +74,8 @@

foreach($get_all_pages as $page) {
echo '<form action="?tn=moduls&sub=bulkedit.mod&a=metas" method="POST" class="auto_send">';
echo '<div class="card p-1 mb-1">';
echo '<div class="card-header">'.$page['page_permalink'].'</div>';
echo '<div class="row mb-1">';

echo '<div class="col-md-4">';
Expand All @@ -57,17 +91,35 @@
echo '<input type="text" name="page_title" value="' .$page['page_title'].'" onchange="mySubmit(this.form)" class="form-control">';
echo '</div>';

echo '<div class="col-md-12 mt-2">';
echo '<div class="col-md-8 mt-2">';
echo '<label>Description</label>';
echo '<input type="text" name="page_meta_description" value="' .$page['page_meta_description'].'" onchange="mySubmit(this.form)" class="form-control">';
echo '</div>';

echo '<div class="col-md-4 mt-2">';
echo '<label>Thumbnail</label>';
echo '<select name="page_thumbnail" class="form-control" onchange="mySubmit(this.form)">';
echo '<option value="">No selection</option>';
foreach($thumbs as $thumb) {

$sel = '';
if($page['page_thumbnail'] == $thumb) {
$sel = 'selected';
}

echo '<option value="'.$thumb.'" '.$sel.'>'.basename($thumb).'</option>';
}
echo '</select>';


echo '</div>';

echo '</div>';

echo '</div><hr>';

echo '<input type="hidden" name="page_id" value="'.$page['page_id'].'">';
echo '<input type="hidden" name="csrf_token" value="'.$_SESSION['token'].'">';
echo '</div>'; // card
echo '</form>';
}

Expand All @@ -81,6 +133,7 @@

echo '<div class="list-group">';

/* page type */
$set_be_pt1 = '';
$set_be_pt2 = '';
$set_be_pt3 = '';
Expand All @@ -98,6 +151,32 @@
echo '<a href="?tn=moduls&sub=bulkedit.mod&a=metas&pt=s" class="list-group-item list-group-item-ghost '.$set_be_pt3.'">Single Pages</a>';
echo '</div><hr>';

/* status type */
$set_be_st1 = ''; // all
$set_be_st2 = ''; // public
$set_be_st3 = ''; // ghost
$set_be_st4 = ''; // private
$set_be_st5 = ''; // draft

if($_SESSION['be_st'] == 'a') {
$set_be_st1 = 'active';
} else if($_SESSION['be_st'] == 'p') {
$set_be_st2 = 'active';
} else if($_SESSION['be_st'] == 'g') {
$set_be_st3 = 'active';
} else if($_SESSION['be_st'] == 'pr') {
$set_be_st4 = 'active';
} else if($_SESSION['be_st'] == 'd') {
$set_be_st5 = 'active';
}

echo '<a href="?tn=moduls&sub=bulkedit.mod&a=metas&st=a" class="list-group-item list-group-item-ghost '.$set_be_st1.'">All</a>';
echo '<a href="?tn=moduls&sub=bulkedit.mod&a=metas&st=p" class="list-group-item list-group-item-ghost '.$set_be_st2.'">Public</a>';
echo '<a href="?tn=moduls&sub=bulkedit.mod&a=metas&st=g" class="list-group-item list-group-item-ghost '.$set_be_st3.'">Ghost</a>';
echo '<a href="?tn=moduls&sub=bulkedit.mod&a=metas&st=pr" class="list-group-item list-group-item-ghost '.$set_be_st4.'">Private</a>';
echo '<a href="?tn=moduls&sub=bulkedit.mod&a=metas&st=d" class="list-group-item list-group-item-ghost '.$set_be_st5.'">Draft</a>';
echo '</div><hr>';


$lang_btn_group = '<div class="btn-group">';
foreach($lang_codes as $lang_code) {
Expand Down

0 comments on commit 0063a97

Please sign in to comment.