summaryrefslogtreecommitdiff
path: root/scilab_fixer.module
diff options
context:
space:
mode:
authorJayaram R Pai2014-08-12 12:27:33 +0530
committerJayaram R Pai2014-08-12 12:27:33 +0530
commit107d64f7166cca11233a690ee127838bade6108d (patch)
tree70d6f35cce794ff8a4199025c2c08a0b6e2c9c39 /scilab_fixer.module
parent416556f05904077f08103254ec9da28d6d7fcb83 (diff)
downloadtextbook_companion_fixer-107d64f7166cca11233a690ee127838bade6108d.tar.gz
textbook_companion_fixer-107d64f7166cca11233a690ee127838bade6108d.tar.bz2
textbook_companion_fixer-107d64f7166cca11233a690ee127838bade6108d.zip
added page to mark indian edition aicte books
Diffstat (limited to 'scilab_fixer.module')
-rwxr-xr-xscilab_fixer.module55
1 files changed, 55 insertions, 0 deletions
diff --git a/scilab_fixer.module b/scilab_fixer.module
index 27bb6d5..5e210f4 100755
--- a/scilab_fixer.module
+++ b/scilab_fixer.module
@@ -29,6 +29,12 @@
"weight" => 2,
"type" => MENU_LOCAL_TASK
);
+ $items["fix/aicte/in"] = array(
+ "title" => "Mark Indian edition books",
+ "page callback" => "scilab_fixer_aicte_in_all",
+ "access arguments" => array("fix scilab"),
+ "type" => MENU_CALLBACK
+ );
$items["fix/code"] = array(
"title" => "Edit TBC code",
"page callback" => "scilab_fixer_code_all",
@@ -194,6 +200,14 @@
$example_path = $uploads_dir . $row->filepath;
file_put_contents($example_path, $code);
$data .= "updated";
+ } else if($item == "ind-ed" && $key) {
+ $query = "
+ UPDATE textbook_companion_aicte
+ SET ind = !ind
+ WHERE id = %d
+ ";
+ db_query($query, $key);
+ $data .= "updated";
} else {
$data = "Nothing to display.";
}
@@ -356,6 +370,47 @@
return $page_content;
}
+ function scilab_fixer_aicte_in_all(){
+ $page_content = "";
+ $query = "
+ SELECT * FROM textbook_companion_aicte
+ ";
+ $result = db_query($query);
+ $headers = array(
+ "Book", "Publisher", "Action"
+ );
+ $rows = array();
+ while($row = db_fetch_object($result)) {
+ $item = array(
+ "data" => array(
+ "{$row->book}<br>by{$row->author}",
+ $row->publisher,
+ ),
+ );
+ $ind_options = array(
+ /* # linking in drupal l() */
+ "fragment" => " ",
+ "external" => TRUE,
+ "attributes" => array(
+ "class" => "ind-ed",
+ "data-aicte" => "{$row->id}",
+ )
+ );
+ /* ind-ed link */
+ if($row->ind) {
+ array_push($item["data"], l("Unmark", "", $ind_options));
+ } else {
+ array_push($item["data"], l("Mark", "", $ind_options));
+ }
+ if($row->ind) {
+ $item["class"] .= " orange";
+ }
+ array_push($rows, $item);
+ }
+ $page_content .= theme("table", $headers, $rows);
+ return $page_content;
+ }
+
function scilab_fixer_code_form($form_state) {
$form = array();
$form["wrapper"] = array(