summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/textbook_companion_fixer_edit_category.js157
-rwxr-xr-xtextbook_companion_fixer.module56
-rw-r--r--textbook_companion_fixer_edit_book_category.inc341
3 files changed, 533 insertions, 21 deletions
diff --git a/js/textbook_companion_fixer_edit_category.js b/js/textbook_companion_fixer_edit_category.js
new file mode 100644
index 0000000..545f689
--- /dev/null
+++ b/js/textbook_companion_fixer_edit_category.js
@@ -0,0 +1,157 @@
+(function($) {
+ $(document).ready(function() {
+ var basePath = Drupal.settings.basePath;
+ //var modPath = basePath + "textbook_companion_fixer/";
+ var modPath = basePath +
+ "textbook_companion_fixer/ajax/edit-book-category/";
+ $category_form = $("#fix-tbc-category-form");
+ $(".main-subcategory-table-div").hide();
+
+ /*********************************************/
+ //$('#main-subcategory-table-'+ 1).show();
+ //var main_cat_chk_value = [];
+ $("input[name='ids[]']:checked").each(function() {
+ main_cat_chk_value = $(this).val();
+ console.log('ooo' + main_cat_chk_value);
+ if (main_cat_chk_value) {
+ $('#main-subcategory-table-div-id-' + main_cat_chk_value).show();
+ } else {
+ $('#main-subcategory-table-div-id-' + main_cat_chk_value).hide();
+ }
+ });
+
+ $('.main-category-checkbox').change(function() {
+ main_cat_chk_value = $(this).val();
+ if (!this.checked)
+ $('#main-subcategory-table-div-id-' + main_cat_chk_value).hide();
+ else
+ $('#main-subcategory-table-div-id-' + main_cat_chk_value).show();
+ });
+
+ $("#fix-tbc-category-form").on('click', '#btn-add', function() {
+ //$('#btn-add').click(function(){
+ var selectID = $(this).attr("data-cid");
+ console.log(selectID);
+ $('#subcats-' + selectID + ' option:selected').each(function() {
+ $('#selected-subcats-' + selectID).append("<option value='" + $(this)
+ .val() + "'>" + $(this).text() + "</option>");
+
+ /**********************/
+ console.log($('.main-subcategory-' + selectID).attr('data-cid'));
+ var pref_id = $('.prefrence_id').val();
+ var main_cat_chk_value = selectID;
+ var sub_cat_select_value = $(this).val();
+ $.ajax({
+ url: modPath,
+ type: "POST",
+ data: {
+ pref_id: pref_id,
+ main_category: main_cat_chk_value,
+ sub_category: sub_cat_select_value,
+ action: "add"
+ },
+ dataType: "html",
+ success: function(data) {
+ //alert("Updated");
+ console.log("My data:" + data);
+ $updating.hide();
+ $done.show();
+ console.log("data1: " + main_cat_chk_value + " data2: " +
+ sub_cat_select_value + " data3: " + pref_id);
+ $done.fadeOut("slow");
+ //alert("ok");
+ }
+ });
+ /**********************/
+
+ $(this).remove();
+ });
+ });
+ $("#fix-tbc-category-form").on('click', '#btn-remove', function() {
+ //$('#btn-remove').click(function(){
+ var selectID = $(this).attr("data-cid");
+ $('#selected-subcats-' + selectID + ' option:selected').each(function() {
+ $('#subcats-' + selectID).append("<option value='" + $(this).val() +
+ "'>" + $(this).text() + "</option>");
+ var action = "delete";
+ /**********************/
+ var pref_id = $('.prefrence_id').val();
+ var main_cat_chk_value = selectID;
+ var sub_cat_select_value = $(this).val();
+ $.ajax({
+ url: modPath,
+ type: "POST",
+ data: {
+ pref_id: pref_id,
+ main_category: main_cat_chk_value,
+ sub_category: sub_cat_select_value,
+ action: action
+ },
+ dataType: "html",
+ success: function(data) {
+ //alert("Updated");
+ console.log("My data:" + data);
+ $updating.hide();
+ $done.show();
+ console.log(action + "data1: " + main_cat_chk_value +
+ " data2: " + sub_cat_select_value + " data3: " + pref_id);
+ $done.fadeOut("slow");
+ //alert("ok");
+ }
+ });
+ /**********************/
+ $(this).remove();
+ });
+ });
+
+ //$("#main_cat_checkbox").change(function() {
+ $("#fix-tbc-category-form").on('change', '.main-category-checkbox',
+ function() {
+ var selectID = $(this).val();
+ prop = $(this).prop('checked');
+ if (prop) {
+ $('main-subcategory-table-' + selectID).show();
+ } else {
+ if (confirm('Are you sure?')) {
+ alert('Thanks for confirming');
+ var action = "delete-main-with-ub-category";
+ var pref_id = $('.prefrence_id').val();
+ var main_cat_chk_value = selectID;
+ console.log(action + "data1: " + main_cat_chk_value + " data2: " +
+ action + " data3: " + pref_id);
+ //ConfirmFunction();
+ $.ajax({
+ url: modPath,
+ type: "POST",
+ data: {
+ pref_id: pref_id,
+ main_category: main_cat_chk_value,
+ action: action
+ },
+ dataType: "html",
+ success: function(data) {
+ //alert("Updated");
+ location.reload();
+ $('main-subcategory-table-' + selectID).hide();
+ console.log("My data:" + data);
+ $updating.hide();
+ $done.show();
+ console.log(action + "data1: " + main_cat_chk_value + " data2: " +
+ action + " data3: " + pref_id);
+ $done.fadeOut("slow");
+ //alert("ok");
+ }
+ });
+ } else {
+ alert('You have not confirmed the action');
+ location.reload();
+ }
+ }
+ });
+ /**********************************************************************/
+ });
+})(jQuery);
+
+function ConfirmFunction() {
+ confirm("Are you sure?");
+}
diff --git a/textbook_companion_fixer.module b/textbook_companion_fixer.module
index f08234e..d31eac8 100755
--- a/textbook_companion_fixer.module
+++ b/textbook_companion_fixer.module
@@ -64,6 +64,12 @@ 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,
+ "file" => "textbook_companion_fixer_edit_book_category.inc"
+ );
/* for admin */
$items['admin/settings/textbook_companion_fixer_settings'] = array(
'title' => 'textbook companion fixer Settings',
@@ -78,6 +84,29 @@ function textbook_companion_fixer_menu()
'type' => MENU_NORMAL_ITEM,
'file' => 'textbook_companion_fixer_settings.inc'
);
+ // edit book categoery
+ $items["textbook_companion_fixer/edit_book_category"] = array(
+ "title" => "Edit Completed Books Category",
+ "page callback" => "textbook_companion_fixer_edit_book_proposal_all",
+ "access arguments" => array(
+ "fix scilab_textbook_category"
+ ),
+ "type" => MENU_NORMAL_ITEM,
+ 'file' => 'textbook_companion_fixer_edit_book_category.inc'
+ );
+ $items['textbook_companion_fixer/category_edit'] = array(
+ 'title' => 'Categorize',
+ 'description' => 'Edit Completed Books Category',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array(
+ 'textbook_companion_fixer_category_edit_form'
+ ),
+ 'access arguments' => array(
+ 'fix scilab_textbook_category'
+ ),
+ 'type' => MENU_NORMAL_ITEM,
+ 'file' => 'textbook_companion_fixer_edit_book_category.inc'
+ );
return $items;
}
function textbook_companion_fixer_permission()
@@ -94,6 +123,10 @@ function textbook_companion_fixer_permission()
"administer textbook companion fixer settings" => array(
"title" => t("administer textbook companion fixer settings"),
'restrict access' => TRUE
+ ),
+ "fix scilab_textbook_category" => array(
+ "title" => t("fix scilab textbook category"),
+ 'restrict access' => TRUE
)
);
}
@@ -732,31 +765,12 @@ function scilab_fixer_code_all()
$page_content .= "</div>";
return $page_content;
}
-function _tbc_fixer_list_of_category($category_id = NULL)
-{
- $category[0] = "Please select";
- if ($category_id == NULL) {
- $query = db_select('list_of_category');
- $query->fields('list_of_category');
- $query->orderBy('id', 'ASC');
- $category_list = $query->execute();
- } //$category_id == NULL
- else {
- $query = db_select('list_of_category');
- $query->fields('list_of_category');
- $query->condition('category_id', $category_id);
- $query->orderBy('id', 'ASC');
- $category_list = $query->execute();
- }
- while ($category_list_data = $category_list->fetchObject()) {
- $category[$category_list_data->category_id] = $category_list_data->category_name;
- } //$category_list_data = $category_list->fetchObject()
- return $category;
-}
+
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");
}
diff --git a/textbook_companion_fixer_edit_book_category.inc b/textbook_companion_fixer_edit_book_category.inc
new file mode 100644
index 0000000..8efea2a
--- /dev/null
+++ b/textbook_companion_fixer_edit_book_category.inc
@@ -0,0 +1,341 @@
+<?php
+function textbook_companion_fixer_edit_book_proposal_all()
+{
+ //get the book count
+ $result = db_query("SELECT COUNT( pe.book ) AS book_count FROM textbook_companion_preference pe LEFT JOIN textbook_companion_proposal po ON pe.proposal_id = po.id WHERE po.proposal_status =3 AND pe.approval_status =1 AND pe.category>0");
+ $row = $result->fetchObject();
+ $book_count = $row->book_count;
+ $i = 1;
+ /* get preference */
+ $preference_q = db_query("SELECT pe.id as pref_id, pe.book as book, pe.author as author,pe.category as existing_category, pe.publisher as publisher, pe.year as year, pe.id as pe_id, po.approval_date as approval_date
+ FROM {textbook_companion_preference} pe LEFT JOIN {textbook_companion_proposal} po ON pe.proposal_id = po.id
+ WHERE po.proposal_status = 3 AND pe.approval_status = 1 ORDER BY pe.book ASC");
+ while ($preference_data = $preference_q->fetchObject())
+ {
+ $proposal_rows[] = array(
+ $i,
+ "{$preference_data->book} <br> <em>by {$preference_data->author}</em>",
+ _textbook_companion_fixer_list_of_category($preference_data->existing_category),
+ _tbc_fixer_list_of_new_category($preference_data->pref_id),
+ l('Edit', 'textbook_companion_fixer/category_edit/' . $preference_data->pref_id)
+ );
+ $i++;
+ } //$proposal_data = $proposal_q->fetchObject()
+ /* check if there are any pending proposals */
+ if (!$proposal_rows)
+ {
+ drupal_set_message(t('There are no proposals.'), 'status');
+ return '';
+ } //!$proposal_rows
+ $output .= "Book count with category: " . $book_count;
+ $proposal_header = array(
+ 'No.',
+ 'Title of the Book',
+ 'Existing Category',
+ 'New Category',
+ 'Action'
+ );
+ $output .= theme('table', array(
+ 'header' => $proposal_header,
+ 'rows' => $proposal_rows
+ ));
+ return $output;
+}
+/******************************************************************************/
+/**************************** CATEGORY EDIT FORM ******************************/
+/******************************************************************************/
+function textbook_companion_fixer_category_edit_form($form, &$form_state)
+{
+ /* get current proposal */
+ $preference_id = arg(2);
+ $query = db_select('textbook_companion_preference');
+ $query->fields('textbook_companion_preference');
+ $query->condition('id', $preference_id);
+ $preference_q = $query->execute();
+ $preference_data = $preference_q->fetchObject();
+ if (!$preference_data)
+ {
+ drupal_set_message(t('Invalid book selected. Please try again.'), 'error');
+ drupal_goto('manage_proposal/category');
+ return;
+ } //!$preference_data
+ $form["wrapper"] = array(
+ "#type" => "fieldset",
+ "#title" => "Edit the existing book category to new category",
+ "#prefix" => "<div id='fix-tbc-category-form'>",
+ "#suffix" => "</div>"
+ );
+ $form["wrapper"]['book'] = array(
+ '#type' => 'item',
+ '#title' => t('Title of the book'),
+ '#markup' => $preference_data->book
+ );
+ $form["wrapper"]['author'] = array(
+ '#type' => 'item',
+ '#title' => t('Author Name'),
+ '#markup' => $preference_data->author
+ );
+ $form["wrapper"]['isbn'] = array(
+ '#type' => 'item',
+ '#title' => t('ISBN No'),
+ '#markup' => $preference_data->isbn
+ );
+ $form["wrapper"]['publisher'] = array(
+ '#type' => 'item',
+ '#title' => t('Publisher & Place'),
+ '#markup' => $preference_data->publisher
+ );
+ $form["wrapper"]['edition'] = array(
+ '#type' => 'item',
+ '#title' => t('Edition'),
+ '#markup' => $preference_data->edition
+ );
+ $form["wrapper"]['year'] = array(
+ '#type' => 'item',
+ '#title' => t('Year of pulication'),
+ '#markup' => $preference_data->year
+ );
+ $form["wrapper"]['pref_id'] = array(
+ '#markup' => '<input class="prefrence_id" type="hidden" name="pref_id" value="' . $preference_data->id . '">'
+ );
+ $form["wrapper"]['main_category'] = array(
+ "#markup" => _textbook_companion_fixer_list_of_category_checkboxes()
+ );
+ $form["wrapper"]['back'] = array(
+ '#markup' => l(t('Back'), 'textbook_companion_fixer/edit_book_category')
+ );
+ return $form;
+}
+function textbook_companion_fixer_edit_book_category_ajax($item, $key)
+{
+ $data = "";
+ $item = arg(2);
+ if ($item == "edit-book-category")
+ {
+ if ($_POST['action'] == "add")
+ {
+ $main_category = $_POST['main_category'];
+ $sub_category = $_POST['sub_category'];
+ $query_in1 = "
+ INSERT INTO {textbook_companion_book_main_subcategories}
+ (pref_id, main_category, sub_category)
+ VALUES
+ (:pref_id, :main_category, :subcategory)
+ ";
+ $args_in1 = array(
+ ':pref_id' => $_POST['pref_id'],
+ ':main_category' => $main_category,
+ ':subcategory' => $sub_category
+ );
+ $result_in1 = db_query($query_in1, $args_in1);
+ } //$_POST['action'] == "add"
+ elseif ($_POST['action'] == "delete")
+ {
+ $query_del1 = "DELETE FROM textbook_companion_book_main_subcategories
+WHERE pref_id= :pref_id AND main_category= :main_category AND sub_category = :subcategory
+ ";
+ $args_del1 = array(
+ ':pref_id' => $_POST['pref_id'],
+ ':main_category' => $_POST['main_category'],
+ ':subcategory' => $_POST['sub_category']
+ );
+ $result_del1 = db_query($query_del1, $args_del1);
+ } //$_POST['action'] == "delete"
+ elseif ($_POST['action'] == "delete-main-with-ub-category")
+ {
+ $query_del2 = "DELETE FROM textbook_companion_book_main_subcategories
+WHERE pref_id= :pref_id AND main_category= :main_category
+ ";
+ $args_del2 = array(
+ ':pref_id' => $_POST['pref_id'],
+ ':main_category' => $_POST['main_category']
+ );
+ $result_del2 = db_query($query_del2, $args_del2);
+ } //$_POST['action'] == "delete-main-with-ub-category"
+ else
+ {
+ $data = "Not Updated";
+ }
+ } //$item == "edit-book-category"
+ else
+ {
+ $data = "Not Updated";
+ }
+ echo $data;
+ exit();
+}
+function _tbc_fixer_list_of_category($category_id = NULL)
+{
+ $category[0] = "Please select";
+ if ($category_id == NULL)
+ {
+ $query = db_select('list_of_category');
+ $query->fields('list_of_category');
+ $query->orderBy('id', 'ASC');
+ $category_list = $query->execute();
+ } //$category_id == NULL
+ else
+ {
+ $query = db_select('list_of_category');
+ $query->fields('list_of_category');
+ $query->condition('category_id', $category_id);
+ $query->orderBy('id', 'ASC');
+ $category_list = $query->execute();
+ }
+ while ($category_list_data = $category_list->fetchObject())
+ {
+ $category[$category_list_data->category_id] = $category_list_data->category_name;
+ } //$category_list_data = $category_list->fetchObject()
+ return $category;
+}
+function _textbook_companion_fixer_list_of_category($category_id)
+{
+ $category .= "";
+ $query = db_select('list_of_category');
+ $query->fields('list_of_category');
+ $query->condition('id', $category_id);
+ $category_list = $query->execute();
+ while ($category_list_data = $category_list->fetchObject())
+ {
+ $category = $category_list_data->category_name;
+ } //$category_list_data = $category_list->fetchObject()
+ return $category;
+}
+function _tbc_fixer_list_of_new_category($pref_id)
+{
+ $category = "";
+ $main_category_query = "
+ SELECT distinct(maincategory)
+ FROM list_of_category loc
+ LEFT JOIN textbook_companion_book_main_subcategories tcbms ON loc.category_id = tcbms.main_category
+ LEFT JOIN list_of_subcategory los ON los.subcategory_id = tcbms.sub_category
+ WHERE tcbms.pref_id = :pref_id
+ ";
+ $args = array(
+ ':pref_id' => $pref_id
+ );
+ $maincategory_list = db_query($main_category_query, $args);
+ $category .= "<ol>";
+ while ($category_list_data = $maincategory_list->fetchObject())
+ {
+ $category .= "<li>$category_list_data->maincategory</li>";
+ $sub_category_query = "
+ SELECT DISTINCT (los.subcategory)
+ FROM list_of_category loc
+ LEFT JOIN textbook_companion_book_main_subcategories tcbms ON loc.category_id = tcbms.main_category
+ LEFT JOIN list_of_subcategory los ON los.subcategory_id = tcbms.sub_category
+ WHERE tcbms.pref_id = :pref_id and maincategory = :maincategoryvalue
+ ";
+ $sub_args = array(
+ ':pref_id' => $pref_id,
+ ':maincategoryvalue' => $category_list_data->maincategory
+ );
+ $sub_category_list = db_query($sub_category_query, $sub_args);
+ while ($sub_category_list_data = $sub_category_list->fetchObject())
+ {
+ $category .= "<ul><li>$sub_category_list_data->subcategory</li></ul>";
+ } //$sub_category_list_data = $sub_category_list->fetchObject()
+ } //$category_list_data = $maincategory_list->fetchObject()
+ $category .= "</ol>";
+ return $category;
+}
+function _tbc_fixer_list_of_ext_new_category($pref_id, $category_id)
+{
+ $category = "";
+ $query = "
+ SELECT maincategory, los.subcategory as subcategory
+ FROM list_of_category loc
+ LEFT JOIN textbook_companion_book_main_subcategories tcbms
+ ON loc.category_id = tcbms.main_category
+ LEFT JOIN list_of_subcategory los ON los.subcategory_id = tcbms.sub_category
+ WHERE tcbms.pref_id = :pref_id AND loc.category_id = :category_id
+ ";
+ $args = array(
+ ':pref_id' => $pref_id,
+ ':category_id' => $category_id
+ );
+ $category_list = db_query($query, $args);
+ while ($category_list_data = $category_list->fetchObject())
+ {
+ $category .= $category_list_data->maincategory;
+ } //$category_list_data = $category_list->fetchObject()
+ return $category;
+}
+function _textbook_companion_fixer_list_of_category_checkboxes()
+{
+ $pref_id = arg(2);
+ $query = db_select('list_of_category');
+ $query->fields('list_of_category');
+ //$query->fields(array('category_id','main_category'));
+ $query->orderBy('category_id', 'ASC');
+ $category_list = $query->execute();
+ while ($category_list_data = $category_list->fetchObject())
+ {
+ $categoryname = $category_list_data->maincategory;
+ if ($categoryname != null || strlen($categoryname) != 0)
+ {
+ //$category[$category_list_data->category_id] = $category_list_data->main_category;
+ $existing_category = _tbc_fixer_list_of_ext_new_category($pref_id, $category_list_data->category_id);
+ $existing_subcategory = _tbc_fixer_list_of_ext_new_subcategory($pref_id, $category_list_data->category_id);
+ $checked = $existing_category ? 'checked="checked"' : '';
+ $category .= "<input id='main_cat_checkbox-" . $category_list_data->category_id . "' type='checkbox' name='ids[]' value='" . $category_list_data->category_id . "' class='main-category-checkbox' " . $checked . " >" . $category_list_data->maincategory . "<br>
+ <div id ='main-subcategory-table-div-id-" . $category_list_data->category_id . "' class='main-subcategory-table-div'><table id='main-subcategory-table-" . $category_list_data->category_id . "' class='main-subcategory-table'>
+ <tr>
+ <th>Available sub categories</th>
+ <th>Selected sub categories</th>
+ </tr>
+ <tr>
+ <td rowspan='3'><select id='subcats-" . $category_list_data->category_id . "' name='subcats' class='main-subcategory' size='10' multiple name='subcat' data-cid='" . $category_list_data->category_id . "'>" . _textbook_companion_fixer_list_of_subcategory($pref_id, $category_list_data->category_id) . "</select>
+ <a href='JavaScript:void(0);' id='btn-add' class='select-main-subcategory-" . $category_list_data->category_id . "' data-cid='" . $category_list_data->category_id . "'>Add &raquo;</a>
+ </td>
+ <td rowspan='3'><a href='JavaScript:void(0);' id='btn-remove' class='select-main-subcategory-" . $category_list_data->category_id . "'data-cid='" . $category_list_data->category_id . "'>&laquo; Remove</a>
+ <select id='selected-subcats-" . $category_list_data->category_id . "' name='subcats' class='select-main-subcategory-list' size='10' multiple name='subcat' data-cid='" . $category_list_data->category_id . "'>" . _tbc_fixer_list_of_ext_new_subcategory($pref_id, $category_list_data->category_id) . "</select>
+ </td>
+ </tr>
+</table></div>
+ <hr>";
+ } //$category_list_data = $category_list->fetchObject()
+ } //$category_list_data = $category_list->fetchObject()
+ return $category;
+}
+function _textbook_companion_fixer_list_of_subcategory($pref_id, $category_id)
+{
+ $query = "
+ SELECT los.subcategory_id as subcat_id,los.subcategory as sub_category
+ FROM list_of_subcategory los WHERE los.maincategory_id= :category_id AND los.subcategory_id
+ NOT IN (SELECT los.subcategory_id as sub_id from list_of_subcategory los
+ LEFT OUTER JOIN textbook_companion_book_main_subcategories tcbms
+ ON los.subcategory_id=tcbms.sub_category WHERE tcbms.pref_id= :pref_id ORDER BY sub_id)
+ ";
+ $args = array(
+ ':pref_id' => $pref_id,
+ ':category_id' => $category_id
+ );
+ $subcategory_list = db_query($query, $args);
+ while ($subcategory_list_data = $subcategory_list->fetchObject())
+ {
+ $subcategory .= "<option value='" . $subcategory_list_data->subcat_id . "' data-name='" . $subcategory_list_data->sub_category . "' data-mcid='" . $category_id . "'>" . $subcategory_list_data->sub_category . "</option>";
+ } //$subcategory_list_data = $subcategory_list->fetchObject()
+ return $subcategory;
+}
+function _tbc_fixer_list_of_ext_new_subcategory($pref_id, $category_id)
+{
+ $subcategory = "";
+ $query = "
+ SELECT DISTINCT (los.subcategory), maincategory, los.subcategory as subcategory,
+ los.subcategory_id as subcat_id FROM list_of_category loc
+ LEFT JOIN textbook_companion_book_main_subcategories tcbms ON loc.category_id = tcbms.main_category
+ LEFT JOIN list_of_subcategory los ON los.subcategory_id = tcbms.sub_category
+ WHERE tcbms.pref_id = :pref_id AND loc.category_id = :category_id
+ ";
+ $args = array(
+ ':pref_id' => $pref_id,
+ ':category_id' => $category_id
+ );
+ $subcategory_list = db_query($query, $args);
+ while ($subcategory_list_data = $subcategory_list->fetchObject())
+ {
+ $subcategory .= "<option value='" . $subcategory_list_data->subcat_id . "' data-name='" . $subcategory_list_data->subcategory . "' data-mcid='" . $category_id . "'>" . $subcategory_list_data->subcategory . "</option>";
+ } //$category_list_data = $category_list->fetchObject()
+ return $subcategory;
+}