From 327a293e267170d2b53cf819352ea2837e936966 Mon Sep 17 00:00:00 2001
From: prashantsinalkar
Date: Sat, 28 Jan 2017 21:39:43 +0530
Subject: added sub category hide show on checkbox action
---
textbook_companion_fixer.module | 58 ++++++++++++++++++++++++++++-------------
1 file changed, 40 insertions(+), 18 deletions(-)
(limited to 'textbook_companion_fixer.module')
diff --git a/textbook_companion_fixer.module b/textbook_companion_fixer.module
index 199b354..b7a8c3e 100755
--- a/textbook_companion_fixer.module
+++ b/textbook_companion_fixer.module
@@ -64,6 +64,11 @@ function textbook_companion_fixer_menu()
"access callback" => TRUE,
"type" => MENU_CALLBACK
);
+ $items["textbook_companion_fixer/ajax/edit-book-category"] = array(
+ "page callback" => "textbook_companion_fixer_edit_book_category_ajax",
+ "access callback" => TRUE,
+ "type" => MENU_CALLBACK
+ );
/* for admin */
$items['admin/settings/textbook_companion_fixer_settings'] = array(
'title' => 'textbook companion fixer Settings',
@@ -801,9 +806,32 @@ function _textbook_companion_fixer_list_of_category($category_id = NULL)
} //$category_list_data = $category_list->fetchObject()
return $category;
}
-function _textbook_companion_fixer_list_of_category_checkboxes()
-
+function textbook_companion_fixer_edit_book_category_ajax($item,$key){
+ if ($item == "edit_book_category") {
+ $data .= "Updated";
+ /* sending email */
+ $email_to = $user->mail;
+ $from = variable_get('textbook_companion_from_email', '');
+ $bcc = variable_get('textbook_companion_fixer_bcc_emails', '');
+ $cc = variable_get('textbook_companion_fixer_cc_emails', '');
+ $params['category_updated']['pref_id'] = $pref_id;
+ $params['category_updated']['user_id'] = $user->uid;
+ $params['category_updated']['headers'] = array(
+ 'From' => $from,
+ 'MIME-Version' => '1.0',
+ 'Content-Type' => 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer' => 'Drupal',
+ 'Cc' => $cc,
+ 'Bcc' => $bcc
+ );
+ if (!drupal_mail('textbook_companion_fixer', 'category_updated', $email_to, language_default(), $params, $from, TRUE)) {
+ $data .= 'Error sending email message.';
+ } //!drupal_mail('textbook_companion_fixer', 'example_updated', $email_to, language_default(), $params, $from, TRUE)
+ }
+}
+function _textbook_companion_fixer_list_of_category_checkboxes()
{
$query = db_select('list_of_category');
$query->fields('list_of_category');
@@ -816,32 +844,25 @@ function _textbook_companion_fixer_list_of_category_checkboxes()
{
$categoryname=$category_list_data->main_category;
if($categoryname!=null||strlen($categoryname)!=0){
- $category[$category_list_data->category_id] = $category_list_data->main_category;
+ //$category[$category_list_data->category_id] = $category_list_data->main_category;
+
+ $category .= "".$category_list_data->main_category."
+