diff options
Diffstat (limited to 'scilab_fixer.module')
-rwxr-xr-x | scilab_fixer.module | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/scilab_fixer.module b/scilab_fixer.module index 5e210f4..33235e1 100755 --- a/scilab_fixer.module +++ b/scilab_fixer.module @@ -11,7 +11,6 @@ "title" => "Add AICTE books", "page callback" => "scilab_fixer_aicte_all", "access arguments" => array("fix scilab"), - "access arguments" => array("fix scilab"), "weight" => 30, "type" => MENU_NORMAL_ITEM ); @@ -28,7 +27,7 @@ "access arguments" => array("fix scilab"), "weight" => 2, "type" => MENU_LOCAL_TASK - ); + ); $items["fix/aicte/in"] = array( "title" => "Mark Indian edition books", "page callback" => "scilab_fixer_aicte_in_all", @@ -37,8 +36,7 @@ ); $items["fix/code"] = array( "title" => "Edit TBC code", - "page callback" => "scilab_fixer_code_all", - "access arguments" => array("fix scilab"), + "page callback" => "scilab_fixer_code_all", "access arguments" => array("fix scilab"), "type" => MENU_CALLBACK ); @@ -47,6 +45,11 @@ "access callback" => TRUE, "type" => MENU_CALLBACK ); + $items["fix/aicte/book/ajax"] = array( + "page callback" => "scilab_fixer_aicte_ajax", + "access callback" => TRUE, + "type" => MENU_CALLBACK + ); return $items; } @@ -208,12 +211,27 @@ "; db_query($query, $key); $data .= "updated"; - } else { + }else { $data = "Nothing to display."; } echo $data; exit(); } + function scilab_fixer_aicte_ajax($item="", $key="") { + $data = ""; + if($item == "selected") { + $query = " + UPDATE textbook_companion_aicte + SET selected = !selected + WHERE id = {$key} + "; + db_query($query); + $data = "updated"; + } + echo $data; + exit(); + } + function scilab_fixer_aicte_form($form_state, $aicte_id) { $query = " @@ -342,7 +360,7 @@ } function scilab_fixer_aicte_edit_all($aicte_id=0) { - $page_content = ""; + $page_content = ""; if($aicte_id) { $page_content .= drupal_get_form("scilab_fixer_aicte_form", $aicte_id); } else { @@ -356,22 +374,29 @@ "Edition", "Action", ); $rows = array(); + while($row = db_fetch_object($result)) { - $item = array( + $item = array( "{$row->book}", "{$row->author}", "{$row->edition}", - l(t("Edit"), "fix/aicte/edit/{$row->id}") + l(t("Edit"), "fix/aicte/edit/{$row->id}") ); + if($row->selected) { + $check = "<input class='selected' type='checkbox' data-bid='{$row->id}' checked>"; + } else { + $check = "<input class='selected' type='checkbox' data-bid='{$row->id}'>"; + } + array_push($item, $check); array_push($rows, $item); - } + } $page_content .= theme("table", $headers, $rows); } return $page_content; } function scilab_fixer_aicte_in_all(){ - $page_content = ""; + $page_content = ""; $query = " SELECT * FROM textbook_companion_aicte "; |