From 9675d3310a868498c7a0e172ebe7ec9b66a9301c Mon Sep 17 00:00:00 2001 From: Saketh1499 Date: Mon, 18 Oct 2021 14:10:19 +0530 Subject: Adding hide option to the interface --- fellowship_testimonials.module | 3 +++ testimonials_edit.inc | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/fellowship_testimonials.module b/fellowship_testimonials.module index a564de7..ea3b9a2 100755 --- a/fellowship_testimonials.module +++ b/fellowship_testimonials.module @@ -45,6 +45,7 @@ "access arguments" => array("manage fellowship_testimonials"), "type" => MENU_CALLBACK ); + return $items; } @@ -69,6 +70,7 @@ $result = pager_query($query, 4, 0, "SELECT COUNT(*) FROM fellowship_testimonials");*/ $query = db_select('fellowship_testimonials'); $query->fields('fellowship_testimonials'); + $query->condition('hide', '0'); $query->condition('testimonial_type', 'V'); $query->orderBy('year', 'DESC'); //$result = $query->extend('PagerDefault')->limit(3)->execute(); @@ -108,6 +110,7 @@ $result = pager_query($query, 4, 0, "SELECT COUNT(*) FROM fellowship_testimonials");*/ $query = db_select('fellowship_testimonials'); $query->fields('fellowship_testimonials'); + $query->condition('hide', '0'); $query->condition('testimonial_type', 'T'); $query->orderBy('year', 'DESC'); //$result = $query->extend('PagerDefault')->limit(3)->execute(); diff --git a/testimonials_edit.inc b/testimonials_edit.inc index 5e1f058..cfedd0f 100644 --- a/testimonials_edit.inc +++ b/testimonials_edit.inc @@ -218,6 +218,15 @@ function fellowship_testimonials_edit_form($form, $form_state, $testimonial_id = "#type" => "hidden", "#value" => $testimonial_id ); + $form["hide"]= array( + "#type" => "radios", + "#options" => array( + "1" => "Yes", + "0" => "No", + ), + '#title' => t('Do you want to hide the testimonial from the list:'), + '#default_value' => $row->hide + ); $form["submit"] = array( "#type" => "submit", "#value" => "Submit" @@ -272,7 +281,8 @@ function fellowship_testimonials_edit_form_submit($form, &$form_state) { 'activity' => $v['activity'], 'year' => $v['fellowship_year'], 'fellowship_task' => $v['fellowship_task'], - 'testimonial_video' => $v['testimonial_video'] + 'testimonial_video' => $v['testimonial_video'], + 'hide' => $v['hide']['value'] )); } @@ -283,7 +293,8 @@ function fellowship_testimonials_edit_form_submit($form, &$form_state) { 'year' => $v['fellowship_year'], 'fellowship_task' => $v['fellowship_task'], 'testimonial_text' => $v['testimonial_text']['value'], - 'testimonial_text_format' => $v['testimonial_text']['format'] + 'testimonial_text_format' => $v['testimonial_text']['format'], + 'hide' => $v['hide']['value'] )); } $query->condition('id', $v['testimonial_id']); @@ -364,7 +375,8 @@ function fellowship_testimonials_edit_all($testimonial_id=0) { $row -> activity, $testimonial_type, l("Edit", "internship-experiences/edit/{$row->id}") - // l("Delete", "fellowship-testimonials/delete/{$row->id}") +- // l("Delete", "fellowship-testimonials/delete/{$row->id}") + ); array_push($rows, $item); //} -- cgit From 91945e289f8f9fb7c96024d048c7a713612da327 Mon Sep 17 00:00:00 2001 From: Saketh1499 Date: Mon, 18 Oct 2021 14:15:39 +0530 Subject: Updating hide option to the interface --- testimonials_edit.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testimonials_edit.inc b/testimonials_edit.inc index cfedd0f..acfed1a 100644 --- a/testimonials_edit.inc +++ b/testimonials_edit.inc @@ -375,7 +375,7 @@ function fellowship_testimonials_edit_all($testimonial_id=0) { $row -> activity, $testimonial_type, l("Edit", "internship-experiences/edit/{$row->id}") -- // l("Delete", "fellowship-testimonials/delete/{$row->id}") + // l("Delete", "fellowship-testimonials/delete/{$row->id}") ); array_push($rows, $item); -- cgit From 022ccda60b3716816fc37b3b8f7a2246dc616225 Mon Sep 17 00:00:00 2001 From: Saketh1499 Date: Mon, 18 Oct 2021 15:26:19 +0530 Subject: Updating the interface --- fellowship_testimonials.module | 4 ++-- testimonials_edit.inc | 21 ++++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/fellowship_testimonials.module b/fellowship_testimonials.module index ea3b9a2..284d442 100755 --- a/fellowship_testimonials.module +++ b/fellowship_testimonials.module @@ -70,7 +70,7 @@ $result = pager_query($query, 4, 0, "SELECT COUNT(*) FROM fellowship_testimonials");*/ $query = db_select('fellowship_testimonials'); $query->fields('fellowship_testimonials'); - $query->condition('hide', '0'); + $query->condition('hidden', '0'); $query->condition('testimonial_type', 'V'); $query->orderBy('year', 'DESC'); //$result = $query->extend('PagerDefault')->limit(3)->execute(); @@ -110,7 +110,7 @@ $result = pager_query($query, 4, 0, "SELECT COUNT(*) FROM fellowship_testimonials");*/ $query = db_select('fellowship_testimonials'); $query->fields('fellowship_testimonials'); - $query->condition('hide', '0'); + $query->condition('hidden', '0'); $query->condition('testimonial_type', 'T'); $query->orderBy('year', 'DESC'); //$result = $query->extend('PagerDefault')->limit(3)->execute(); diff --git a/testimonials_edit.inc b/testimonials_edit.inc index acfed1a..44731c9 100644 --- a/testimonials_edit.inc +++ b/testimonials_edit.inc @@ -218,14 +218,14 @@ function fellowship_testimonials_edit_form($form, $form_state, $testimonial_id = "#type" => "hidden", "#value" => $testimonial_id ); - $form["hide"]= array( + $form["hidden"]= array( "#type" => "radios", "#options" => array( "1" => "Yes", "0" => "No", ), - '#title' => t('Do you want to hide the testimonial from the list:'), - '#default_value' => $row->hide + '#title' => t('Do you want to hide the testimonial from the public:'), + '#default_value' => $row->hidden ); $form["submit"] = array( "#type" => "submit", @@ -282,7 +282,7 @@ function fellowship_testimonials_edit_form_submit($form, &$form_state) { 'year' => $v['fellowship_year'], 'fellowship_task' => $v['fellowship_task'], 'testimonial_video' => $v['testimonial_video'], - 'hide' => $v['hide']['value'] + 'hidden' => $v['hidden']['value'] )); } @@ -294,7 +294,7 @@ function fellowship_testimonials_edit_form_submit($form, &$form_state) { 'fellowship_task' => $v['fellowship_task'], 'testimonial_text' => $v['testimonial_text']['value'], 'testimonial_text_format' => $v['testimonial_text']['format'], - 'hide' => $v['hide']['value'] + 'hidden' => $v['hidden']['value'] )); } $query->condition('id', $v['testimonial_id']); @@ -345,7 +345,7 @@ function fellowship_testimonials_edit_all($testimonial_id=0) { $result = $query->execute(); $headers = array( - "Name", "Institute", "Activity Name", "Type", "Action" + "Name", "Institute", "Activity Name", "Type", "Action", "Status" ); $rows = array(); @@ -359,6 +359,12 @@ function fellowship_testimonials_edit_all($testimonial_id=0) { } else{ $testimonial_type = "Video"; + } + if($row->hidden == 1){ + $display_status = "Hidden to public"; + } + else{ + $display_status = "Displayed to public"; } /*$speakerquery = db_select('fellows'); $speakerquery->fields('fellows'); @@ -374,8 +380,9 @@ function fellowship_testimonials_edit_all($testimonial_id=0) { $institute, $row -> activity, $testimonial_type, - l("Edit", "internship-experiences/edit/{$row->id}") + l("Edit", "internship-experiences/edit/{$row->id}"), // l("Delete", "fellowship-testimonials/delete/{$row->id}") + $display_status ); array_push($rows, $item); -- cgit