diff options
author | Saketh1499 | 2021-10-21 12:36:55 +0530 |
---|---|---|
committer | GitHub | 2021-10-21 12:36:55 +0530 |
commit | ac7a2b306fd953882a9df7d91cc4e1def72cede7 (patch) | |
tree | 52f6aa72e16139683ee7d4e1a3d726f6ecae0e57 | |
parent | d72a3e1b6d89f3146ae3da34d385e125b9104cc1 (diff) | |
parent | 022ccda60b3716816fc37b3b8f7a2246dc616225 (diff) | |
download | fellowship_testimonials-ac7a2b306fd953882a9df7d91cc4e1def72cede7.tar.gz fellowship_testimonials-ac7a2b306fd953882a9df7d91cc4e1def72cede7.tar.bz2 fellowship_testimonials-ac7a2b306fd953882a9df7d91cc4e1def72cede7.zip |
Merge pull request #8 from Saketh1499/development
Adding hide option to the interface
-rwxr-xr-x | fellowship_testimonials.module | 3 | ||||
-rw-r--r-- | testimonials_edit.inc | 27 |
2 files changed, 26 insertions, 4 deletions
diff --git a/fellowship_testimonials.module b/fellowship_testimonials.module index a564de7..284d442 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('hidden', '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('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 5e1f058..44731c9 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["hidden"]= array( + "#type" => "radios", + "#options" => array( + "1" => "Yes", + "0" => "No", + ), + '#title' => t('Do you want to hide the testimonial from the public:'), + '#default_value' => $row->hidden + ); $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'], + 'hidden' => $v['hidden']['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'], + 'hidden' => $v['hidden']['value'] )); } $query->condition('id', $v['testimonial_id']); @@ -334,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(); @@ -349,6 +360,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'); $speakerquery->condition('t_id', $row->id); @@ -363,8 +380,10 @@ 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); //} |