summaryrefslogtreecommitdiff
path: root/textbook_companion_fixer.module
diff options
context:
space:
mode:
authorprashantsinalkar2017-01-28 21:39:43 +0530
committerprashantsinalkar2017-01-28 21:39:43 +0530
commit75e5048dbbdec6a5f401999cace110c925835787 (patch)
tree16ba28c9f90d307290551bba7e8643940f61793c /textbook_companion_fixer.module
parent6df626312cf0a3719e197e4c2730294bfda4ff95 (diff)
downloadtextbook_companion_fixer-75e5048dbbdec6a5f401999cace110c925835787.tar.gz
textbook_companion_fixer-75e5048dbbdec6a5f401999cace110c925835787.tar.bz2
textbook_companion_fixer-75e5048dbbdec6a5f401999cace110c925835787.zip
added sub category hide show on checkbox action
Diffstat (limited to 'textbook_companion_fixer.module')
-rwxr-xr-xtextbook_companion_fixer.module58
1 files changed, 40 insertions, 18 deletions
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 .= "<input type='checkbox' name='ids[]' value='".$category_list_data->category_id."' class='main-category-chk-".$category_list_data->category_id."' >".$category_list_data->main_category."<br>
+ <select class='main-subcategory-".$category_list_data->category_id."'>"._textbook_companion_fixer_list_of_subcategory($category_list_data->category_id)."</select><br><br><hr>";
} //$category_list_data = $category_list->fetchObject()
}
return $category;
}
function _textbook_companion_fixer_list_of_subcategory($category_id)
{
-
- if ($category_id == NULL)
- {
$query = db_select('list_of_subcategory');
$query->fields('list_of_subcategory');
- $query->orderBy('id', 'ASC');
- $subcategory_list = $query->execute();
- } //$category_id == NULL
- else
- {
- $query = db_select('list_of_subcategory');
- $query->fields('list_of_subcategory');
- $query->condition('main_category', $category_id);
- $query->orderBy('id', 'ASC');
- $subcategory_list = $query->execute();
- }
+ $query->condition('main_category', $category_id);
+ $query->orderBy('id', 'ASC');
+ $subcategory_list = $query->execute();
+ $subcategory .= "<option value='0'> Please select a subcategory </option>";
while ($subcategory_list_data = $subcategory_list->fetchObject())
{
- $category[$subcategory_list_data->id] = $subcategory_list_data->subcategory;
+ $subcategory .= "<option value='".$subcategory_list_data->id."' data-name='".$subcategory_list_data->subcategory."'>".$subcategory_list_data->subcategory."</option>";
} //$category_list_data = $category_list->fetchObject()
return $subcategory;
}
@@ -849,6 +870,7 @@ function textbook_companion_fixer_init()
{
drupal_add_css(drupal_get_path("module", "textbook_companion_fixer") . "/css/textbook_companion_fixer.css");
drupal_add_js(drupal_get_path("module", "textbook_companion_fixer") . "/js/textbook_companion_fixer.js");
+ drupal_add_js(drupal_get_path("module", "textbook_companion_fixer") . "/js/textbook_companion_fixer_edit_category.js");
//drupal_add_js(drupal_get_path("module", "scilab_fixer") . "/js/jquery-noconfilct.js");
drupal_add_js(drupal_get_path("module", "textbook_companion_fixer") . "/js/selection.js");
}