Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Sep 13, 2021
1 parent d142c57 commit 04977a2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
11 changes: 8 additions & 3 deletions userfiles/modules/testimonials/edit.php
Expand Up @@ -208,10 +208,15 @@


<?php
$projectName = get_option('show_testimonials_per_project', $params['parent-module-id']);
if (empty($projectName)) {
$projectName = 'All projects';
if (isset($params['project_name']) && !empty($params['project_name'])) {
$projectName = $params['project_name'];
} else {
$projectName = get_option('show_testimonials_per_project', $params['parent-module-id']);
if (empty($projectName)) {
$projectName = 'All projects';
}
}

if ($data['id'] > 0) {
$projectName = $data['project_name'];
}
Expand Down
1 change: 0 additions & 1 deletion userfiles/modules/testimonials/index.php
Expand Up @@ -52,7 +52,6 @@
}

$data = get_testimonials($get);

}


Expand Down
15 changes: 14 additions & 1 deletion userfiles/modules/testimonials/list.php
Expand Up @@ -19,11 +19,13 @@ function delete_testimonial(id) {
add_testimonial = function () {
$('.js-add-new-button').hide();
$("#edit-testimonials").attr("edit-id", "0");
$("#edit-testimonials").attr("project_name", '<?php echo $params['project_name']; ?>');
mw.reload_module("#edit-testimonials");
}

add_new_testimonial = function () {
$("#edit-testimonials").attr("edit-id", 0);
$("#edit-testimonials").attr("project_name", '<?php echo $params['project_name']; ?>');
mw.reload_module("#edit-testimonials");
$('.js-add-new-testimonials').trigger('click');
}
Expand All @@ -35,6 +37,7 @@ function delete_testimonial(id) {
edit_testimonial = function (id) {
$('.js-add-new-button').show();
$("#edit-testimonials").attr("edit-id", id);
$("#edit-testimonials").attr("project_name", '<?php echo $params['project_name']; ?>');
mw.reload_module("#edit-testimonials");
$('.js-add-new-testimonials').trigger('click');
}
Expand Down Expand Up @@ -110,8 +113,18 @@ function delete_testimonial(id) {
}
}

$data = \Illuminate\Support\Facades\DB::table('testimonials')->where('project_name', $selected_project)->orderBy('id','DESC')->get();
$testimonialsQuery = \Illuminate\Support\Facades\DB::table('testimonials');
if (trim($selected_project) != '') {
$testimonialsQuery->where('project_name', $selected_project);
}
$data = $testimonialsQuery->orderBy('id','DESC')->get();

?>

<?php if ((trim($selected_project) != '') && $data->count()==0): ?>
No testimonials data found for the project <b><?php echo $selected_project; ?></b>.
<?php endif; ?>

<?php if ($data != null): ?>
<script>
$(document).ready(function () {
Expand Down
3 changes: 1 addition & 2 deletions userfiles/modules/testimonials/project_select.php
Expand Up @@ -24,9 +24,8 @@
</script>
<?php if (!empty($data)): ?>
<select class="form-control mw_option_field" name="show_testimonials_per_project" option-group="<?php print $params['option-group'] ?>">
<option value=""><?php _e('All projects'); ?></option>
<?php foreach ($data as $item): ?>
<?php if ($item['project_name'] != ''): ?>
<?php if ($item['project_name'] != ''): ?>
<option <?php if ($item['project_name'] == $selected): ?> selected="selected" <?php endif; ?> value="<?php print $item['project_name'] ?>"><?php print mw()->format->titlelize($item['project_name']) ?></option>
<?php endif; ?>
<?php endforeach; ?>
Expand Down

0 comments on commit 04977a2

Please sign in to comment.