From 205c03ca3b0c7caaf42ba2e7649edd4ee06ccc44 Mon Sep 17 00:00:00 2001 From: prashant Date: Sat, 30 Jan 2016 12:25:22 +0530 Subject: Done minor changes and added submit all code notification for tbc reviver interface --- textbook_companion.module | 6062 +++++++++++++++++++++++++++++---------------- 1 file changed, 3863 insertions(+), 2199 deletions(-) (limited to 'textbook_companion.module') diff --git a/textbook_companion.module b/textbook_companion.module index 0a6b051..5a3685c 100755 --- a/textbook_companion.module +++ b/textbook_companion.module @@ -1,67 +1,73 @@ 'Book Proposal Form', - 'description' => 'Book Proposal Form.', - 'page callback' => 'textbook_companion_nonaicte_proposal_all', - 'access callback' => 'user_access', - 'access arguments' => array('create book proposal'), - 'type' => MENU_CALLBACK, - ); - /* $items["aicte_proposal"] = array( + $items = array(); + /* users */ + $items['textbook-companion/proposal'] = array( + 'title' => 'Book Proposal Form', + 'description' => 'Book Proposal Form.', + 'page callback' => 'textbook_companion_proposal_all', + 'access callback' => 'user_access', + 'access arguments' => array( + 'create book proposal' + ), + 'type' => MENU_CALLBACK + ); + /*$items["aicte_proposal"] = array( "title" => "AICTE Book Proposal", "description" => "AICTE Book Proposal Form", "page callback" => "textbook_companion_aicte_proposal_all", 'access arguments' => array('create book proposal'), - 'type' => MENU_NORMAL_ITEM, - );*/ - // $items["all_proposal"] = array( - // "title" => "Book Proposal", - // "description" => "Book Proposal Form", - // "page callback" => "textbook_companion_aicte_proposal_all", - // 'access arguments' => array('create book proposal'), - // 'type' => MENU_NORMAL_ITEM, - // ); - /* for reviewers */ - $items['manage_proposal'] = array( - 'title' => 'Manage Book Proposals', - 'description' => 'Manage Book Proposals', - 'page callback' => '_proposal_pending', - 'access callback' => 'user_access', - 'access arguments' => array('approve book proposal'), - 'file' => 'manage_proposal.inc', - ); - $items['manage_proposal/pending'] = array( - 'title' => 'Pending Proposals', - 'description' => 'Pending Proposals Queue', - 'page callback' => '_proposal_pending', - 'access callback' => 'user_access', - 'access arguments' => array('approve book proposal'), - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => 1, - 'file' => 'manage_proposal.inc', - ); - $items['manage_proposal/all'] = array( - 'title' => 'All Proposals', - 'description' => 'All Proposals', - 'page callback' => '_proposal_all', - 'access callback' => 'user_access', - 'access arguments' => array('approve book proposal'), - 'type' => MENU_LOCAL_TASK, - 'weight' => 2, - 'file' => 'manage_proposal.inc', - ); - $items['manage_proposal/category'] = array( + 'type' => MENU_CALLBACK, + );*/ + $items["textbook-companion/all_proposal"] = array( + "title" => "Book Proposal", + "description" => "Book Proposal Form", + "page callback" => "textbook_companion_aicte_proposal_all", + 'access arguments' => array( + 'create book proposal' + ), + 'type' => MENU_CALLBACK + ); + /* for reviewers */ + $items['textbook-companion/manage-proposal'] = array( + 'title' => 'Manage Book Proposals', + 'description' => 'Manage Book Proposals', + 'page callback' => '_proposal_pending', + 'access callback' => 'user_access', + 'access arguments' => array( + 'approve book proposal' + ), + 'file' => 'manage_proposal.inc' + ); + $items['textbook-companion/manage-proposal/pending'] = array( + 'title' => 'Pending Proposals', + 'description' => 'Pending Proposals Queue', + 'page callback' => '_proposal_pending', + 'access callback' => 'user_access', + 'access arguments' => array( + 'approve book proposal' + ), + 'type' => MENU_DEFAULT_LOCAL_TASK, + 'weight' => 1, + 'file' => 'manage_proposal.inc' + ); + $items['textbook-companion/manage-proposal/all'] = array( + 'title' => 'All Proposals', + 'description' => 'All Proposals', + 'page callback' => '_proposal_all', + 'access callback' => 'user_access', + 'access arguments' => array( + 'approve book proposal' + ), + 'type' => MENU_LOCAL_TASK, + 'weight' => 2, + 'file' => 'manage_proposal.inc' + ); + /*$items['manage_proposal/category'] = array( 'title' => 'Categorize', 'description' => 'Categorize Books', 'page callback' => '_category_all', @@ -70,45 +76,59 @@ function textbook_companion_menu() 'type' => MENU_LOCAL_TASK, 'weight' => 2, 'file' => 'manage_proposal.inc', - ); - $items['manage_proposal/failed'] = array( - 'title' => 'Failed Proposals', - 'description' => 'Failed to submit code', - 'page callback' => '_failed_all', - 'access callback' => 'user_access', - 'access arguments' => array('approve book proposal'), - 'type' => MENU_LOCAL_TASK, - 'weight' => 3, - 'file' => 'manage_proposal.inc', - ); - $items['manage_proposal/approve'] = array( - 'title' => 'Proposal Approval', - 'description' => 'Proposal Approval', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('proposal_approval_form'), - 'access arguments' => array('approve book proposal'), - 'type' => MENU_CALLBACK, - 'file' => 'manage_proposal.inc', - ); - $items['manage_proposal/status'] = array( - 'title' => 'Proposal Status', - 'description' => 'Proposal Status', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('proposal_status_form'), - 'access arguments' => array('approve book proposal'), - 'type' => MENU_CALLBACK, - 'file' => 'manage_proposal.inc', - ); - $items['manage_proposal/edit'] = array( - 'title' => 'Edit Proposal', - 'description' => 'Edit Proposal', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('proposal_edit_form'), - 'access arguments' => array('edit book proposal'), - 'type' => MENU_CALLBACK, - 'file' => 'manage_proposal.inc', - ); - $items['manage_proposal/category/edit'] = array( + );*/ + $items['textbook-companion/manage-proposal/failed'] = array( + 'title' => 'Failed Proposals', + 'description' => 'Failed to submit code', + 'page callback' => '_failed_all', + 'access callback' => 'user_access', + 'access arguments' => array( + 'approve book proposal' + ), + 'type' => MENU_LOCAL_TASK, + 'weight' => 3, + 'file' => 'manage_proposal.inc' + ); + $items['textbook-companion/manage-proposal/approve'] = array( + 'title' => 'Proposal Approval', + 'description' => 'Proposal Approval', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'proposal_approval_form' + ), + 'access arguments' => array( + 'approve book proposal' + ), + 'type' => MENU_CALLBACK, + 'file' => 'manage_proposal.inc' + ); + $items['textbook-companion/manage-proposal/status'] = array( + 'title' => 'Proposal Status', + 'description' => 'Proposal Status', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'proposal_status_form' + ), + 'access arguments' => array( + 'approve book proposal' + ), + 'type' => MENU_CALLBACK, + 'file' => 'manage_proposal.inc' + ); + $items['textbook-companion/manage-proposal/edit'] = array( + 'title' => 'Edit Proposal', + 'description' => 'Edit Proposal', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'proposal_edit_form' + ), + 'access arguments' => array( + 'edit book proposal' + ), + 'type' => MENU_CALLBACK, + 'file' => 'manage_proposal.inc' + ); + /*$items['manage_proposal/category/edit'] = array( 'title' => 'Edit Category', 'description' => 'Edit category', 'page callback' => 'drupal_get_form', @@ -116,543 +136,893 @@ function textbook_companion_menu() 'access arguments' => array('edit book proposal'), 'type' => MENU_CALLBACK, 'file' => 'manage_proposal.inc', - ); - - $items['code_approval'] = array( - 'title' => 'Manage Code Approval', - 'description' => 'Manage Code Approval', - 'page callback' => 'code_approval', - 'access arguments' => array('approve code'), - 'type' => MENU_NORMAL_ITEM, - 'file' => 'code_approval.inc', - ); - $items['code_approval/approve'] = array( - 'title' => 'Code Approval', - 'description' => 'Code Approval', + );*/ + $items['textbook-companion/code-approval'] = array( + 'title' => 'Manage Code Approval', + 'description' => 'Manage Code Approval', + 'page callback' => 'code_approval', + 'access arguments' => array( + 'approve code' + ), + 'type' => MENU_NORMAL_ITEM, + 'file' => 'code_approval.inc' + ); + $items['textbook-companion/code-approval/approve'] = array( + 'title' => 'Code Approval', + 'description' => 'Code Approval', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'code_approval_form' + ), + 'access arguments' => array( + 'approve code' + ), + 'type' => MENU_DEFAULT_LOCAL_TASK, + 'weight' => 1, + 'file' => 'code_approval.inc' + ); + $items['textbook-companion/code-approval/bulk'] = array( + 'title' => 'Bulk Manage', + 'description' => 'Bulk Mangage', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'bulk_approval_form' + ), + 'access arguments' => array( + 'bulk manage code' + ), + 'type' => MENU_LOCAL_TASK, + 'weight' => 2, + 'file' => 'code_approval.inc' + ); + /* $items['textbook-companion/code-approval/edit-code-submission'] = array( + 'title' => 'Edit Code Submission', + 'description' => 'Enable users code submission interface', + // 'page callback' => 'drupal_get_form', + 'page callback' => 'edit_code_submission', + // 'page arguments' => array( + // 'edit_code_submission_form' + // ), + 'access arguments' => array( + 'bulk manage code' + ), + 'type' => MENU_LOCAL_TASK, + 'weight' => 3, + 'file' => 'code_approval.inc' + );*/ + $items['textbook-companion/code-approval/edit-code-submission/edit'] = array( + 'title' => 'Edit Code Submission', + 'description' => 'Enable users code submission interface', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'edit_code_submission_form' + ), + 'access arguments' => array( + 'bulk manage code' + ), + 'file' => 'code_approval.inc' + ); + $items['textbook-companion/code-approval/editcode'] = array( + 'title' => 'Admin Edit Example', + 'description' => 'Admin Edit Example', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'upload_examples_admin_edit_form' + ), + 'access arguments' => array( + 'approve code' + ), + 'type' => MENU_CALLBACK, + 'weight' => 3, + 'file' => 'editcodeadmin.inc' + ); + $items['textbook-companion/code-approval/notes'] = array( + 'title' => 'Notes for Reviewers', + 'description' => 'Notes for Reviewers', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'book_notes_form' + ), + 'access arguments' => array( + 'bulk manage code' + ), + 'type' => MENU_CALLBACK, + 'weight' => 4, + 'file' => 'notes.inc' + ); + /* $items['code_approval/dependency'] = array( + 'title' => 'Dependency', + 'description' => 'Dependency', 'page callback' => 'drupal_get_form', - 'page arguments' => array('code_approval_form'), - 'access arguments' => array('approve code'), + 'page arguments' => array('textbook_companion_dependency_approval_form'), + 'access arguments' => array('bulk manage code'), 'type' => MENU_LOCAL_TASK, - 'weight' => 1, - 'file' => 'code_approval.inc', - ); - // $items['code_approval/bulk'] = array( - // 'title' => 'Bulk Manage', - // 'description' => 'Bulk Mangage', - // 'page callback' => 'drupal_get_form', - // 'page arguments' => array('bulk_approval_form'), - // 'access arguments' => array('bulk manage code'), - // 'type' => MENU_LOCAL_TASK, - // 'weight' => 2, - // 'file' => 'code_approval.inc', - // ); - - $items['code_approval/ajax'] = array( - 'title' => 'Ajax', - 'description' => 'Ajax', - 'page callback' => 'textbook_companion_bulk_manage_ajax', - 'access arguments' => array('access content'), - 'type' => MENU_CALLBACK, - 'file' => 'code_approval.inc', - ); - $items['code_approval/editcode'] = array( - 'title' => 'Admin Edit Example', - 'description' => 'Admin Edit Example', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('upload_examples_admin_edit_form'), - 'access arguments' => array('approve code'), - 'type' => MENU_CALLBACK, 'weight' => 3, - 'file' => 'editcodeadmin.inc', - ); - $items['code_approval/notes'] = array( - 'title' => 'Notes for Reviewers', - 'description' => 'Notes for Reviewers', + 'file' => 'dependency_approval.inc', + );*/ + $items['textbook-companion/code'] = array( + 'title' => 'Code Submission', + 'description' => 'Code Submission', + 'page callback' => 'list_chapters', + 'access callback' => 'user_access', + 'access arguments' => array( + 'upload code' + ), + 'file' => 'general.inc' + ); + $items['textbook-companion/code/list_chapters'] = array( + 'title' => 'List Chapters', + 'description' => 'List Chapters', + 'page callback' => 'list_chapters', + 'access arguments' => array( + 'upload code' + ), + 'type' => MENU_DEFAULT_LOCAL_TASK, + 'file' => 'general.inc', + 'weight' => 1 + ); + $items['textbook-companion/code/upload'] = array( + 'title' => 'Code Submission', + 'description' => 'Code Submission', + 'page callback' => 'upload_examples', + 'access arguments' => array( + 'upload code' + ), + 'type' => MENU_LOCAL_TASK, + 'file' => 'code.inc', + 'weight' => 2 + ); + /* $items['textbook_companion/code/upload_dep'] = array( + 'title' => 'Upload Dependency', + 'description' => 'Upload Dependency Files', 'page callback' => 'drupal_get_form', - 'page arguments' => array('book_notes_form'), - 'access arguments' => array('bulk manage code'), - 'type' => MENU_CALLBACK, - 'weight' => 4, - 'file' => 'notes.inc', - ); - // $items['code_approval/dependency'] = array( - // 'title' => 'Dependency', - // 'description' => 'Dependency', - // 'page callback' => 'drupal_get_form', - // 'page arguments' => array('textbook_companion_dependency_approval_form'), - // 'access arguments' => array('bulk manage code'), - // 'type' => MENU_LOCAL_TASK, - // 'weight' => 2, - // 'file' => 'dependency_approval.inc', - // ); - $items['textbook_companion/code'] = array( - 'title' => 'Code Submission', - 'description' => 'Code Submission', - 'page callback' => 'list_chapters', - 'access callback' => 'user_access', - 'access arguments' => array('upload code'), - 'file' => 'general.inc', - ); - $items['textbook_companion/code/list_chapters'] = array( - 'title' => 'List Chapters', - 'description' => 'List Chapters', - 'page callback' => 'list_chapters', - 'access arguments' => array('upload code'), - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'file' => 'general.inc', - 'weight' => 1, - ); - $items['textbook_companion/code/upload'] = array( - 'title' => 'Code Submission', - 'description' => 'Code Submission', - 'page callback' => 'upload_examples', + 'page arguments' => array('upload_dependency_form'), 'access arguments' => array('upload code'), 'type' => MENU_LOCAL_TASK, - 'file' => 'code.inc', - 'weight' => 2, - ); - // $items['textbook_companion/code/upload_dep'] = array( - // 'title' => 'Upload Dependency', - // 'description' => 'Upload Dependency Files', - // 'page callback' => 'drupal_get_form', - // 'page arguments' => array('upload_dependency_form'), - // 'access arguments' => array('upload code'), - // 'type' => MENU_LOCAL_TASK, - // 'file' => 'dependency.inc', - // 'weight' => 3, - // ); - $items['textbook_companion/code/edit_dep'] = array( + 'file' => 'dependency.inc', + 'weight' => 3, + ); + $items['textbook_companion/code/edit_dep'] = array( 'title' => 'Edit Dependency', 'description' => 'Edit Dependency File', 'page callback' => 'edit_dependency', 'access arguments' => array('upload code'), 'type' => MENU_CALLBACK, 'file' => 'dependency.inc', - ); - $items['textbook_companion/code/delete_dep'] = array( + ); + $items['textbook_companion/code/delete_dep'] = array( 'title' => 'Delete Dependency', 'description' => 'Delete Dependency File', 'page callback' => 'delete_dependency', 'access arguments' => array('upload code'), 'type' => MENU_CALLBACK, 'file' => 'dependency.inc', - ); - $items['textbook_companion/code/edit'] = array( - 'title' => 'Edit Example', - 'description' => 'Edit Example', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('upload_examples_edit_form'), - 'access arguments' => array('edit uploaded code'), - 'type' => MENU_CALLBACK, - 'file' => 'editcode.inc', - ); - $items['textbook_companion/code/delete'] = array( - 'title' => 'Delete Example', - 'description' => 'Delete Example', - 'page callback' => '_upload_examples_delete', - 'access arguments' => array('upload code'), - 'type' => MENU_CALLBACK, - 'file' => 'code.inc', - ); - $items['textbook_companion/code/chapter/edit'] = array( - 'title' => 'Edit Chapter Title', - 'description' => 'Edit Chapter Title', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('edit_chapter_title_form'), - 'access arguments' => array('upload code'), - 'type' => MENU_CALLBACK, - 'file' => 'editcode.inc', - ); - $items['textbook_companion/code/list_examples'] = array( - 'title' => 'List Examples', - 'description' => 'List Examples', - 'page callback' => 'list_examples', - 'access arguments' => array('upload code'), - 'type' => MENU_CALLBACK, - 'file' => 'general.inc', - 'weight' => 3, - ); - $items['textbook_search'] = array( - 'title' => 'Book Search', - 'description' => '', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('textbook_companion_search_form'), - 'access arguments' => array('access content'), - 'type' => MENU_NORMAL_ITEM, - 'file' => 'search.inc', - ); - $items['textbook_search/search'] = array( - 'title' => 'Book Search', - 'description' => '', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('textbook_companion_search_form'), - 'access arguments' => array('access content'), - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'file' => 'search.inc', - 'weight' => 1, - ); - $items['textbook_search/book'] = array( - 'title' => 'By Book Title', - 'description' => '', - 'page callback' => 'textbook_companion_browse_book', - 'access arguments' => array('access content'), - 'type' => MENU_LOCAL_TASK, - 'file' => 'search.inc', - 'weight' => 2, - ); - $items['textbook_search/author'] = array( - 'title' => 'By Author', - 'description' => '', - 'page callback' => 'textbook_companion_browse_author', - 'access arguments' => array('access content'), - 'type' => MENU_LOCAL_TASK, - 'file' => 'search.inc', - 'weight' => 3, - ); - $items['textbook_search/college'] = array( - 'title' => 'By College', - 'description' => '', - 'page callback' => 'textbook_companion_browse_college', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('textbook_companion_browse_college_form'), - 'access arguments' => array('access content'), - 'type' => MENU_LOCAL_TASK, - 'file' => 'search.inc', - 'weight' => 4, - ); - $items['textbook_search/student'] = array( - 'title' => 'By Student', - 'description' => '', - 'page callback' => 'textbook_companion_browse_student', - 'access arguments' => array('access content'), - 'type' => MENU_LOCAL_TASK, - 'file' => 'search.inc', - 'weight' => 5, - ); - $items['textbook_run'] = array( + );*/ + $items['textbook-companion/code/edit'] = array( + 'title' => 'Edit Example', + 'description' => 'Edit Example', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'upload_examples_edit_form' + ), + 'access arguments' => array( + 'edit uploaded code' + ), + 'type' => MENU_CALLBACK, + 'file' => 'editcode.inc' + ); + $items['textbook-companion/code/delete'] = array( + 'title' => 'Delete Example', + 'description' => 'Delete Example', + 'page callback' => '_upload_examples_delete', + 'access arguments' => array( + 'upload code' + ), + 'type' => MENU_CALLBACK, + 'file' => 'code.inc' + ); + $items['textbook-companion/code/chapter/edit'] = array( + 'title' => 'Edit Chapter Title', + 'description' => 'Edit Chapter Title', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'edit_chapter_title_form' + ), + 'access arguments' => array( + 'upload code' + ), + 'type' => MENU_CALLBACK, + 'file' => 'editcode.inc' + ); + $items['textbook-companion/code/list-examples'] = array( + 'title' => 'List Examples', + 'description' => 'List Examples', + 'page callback' => 'list_examples', + 'access arguments' => array( + 'upload code' + ), + 'type' => MENU_CALLBACK, + 'file' => 'general.inc', + 'weight' => 3 + ); + $items['textbook-companion/textbook-search'] = array( + 'title' => 'Book Search', + 'description' => '', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'textbook_companion_search_form' + ), + 'access arguments' => array( + 'access content' + ), + 'type' => MENU_NORMAL_ITEM, + 'file' => 'search.inc' + ); + $items['textbook-companion/textbook-search/search'] = array( + 'title' => 'Book Search', + 'description' => '', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'textbook_companion_search_form' + ), + 'access arguments' => array( + 'access content' + ), + 'type' => MENU_DEFAULT_LOCAL_TASK, + 'file' => 'search.inc', + 'weight' => 1 + ); + $items['textbook-companion/textbook-search/book'] = array( + 'title' => 'By Book Title', + 'description' => '', + 'page callback' => 'textbook_companion_browse_book', + 'access arguments' => array( + 'access content' + ), + 'type' => MENU_LOCAL_TASK, + 'file' => 'search.inc', + 'weight' => 2 + ); + $items['textbook-companion/textbook-search/author'] = array( + 'title' => 'By Author', + 'description' => '', + 'page callback' => 'textbook_companion_browse_author', + 'access arguments' => array( + 'access content' + ), + 'type' => MENU_LOCAL_TASK, + 'file' => 'search.inc', + 'weight' => 3 + ); + $items['textbook-companion/textbook-search/college'] = array( + 'title' => 'By College', + 'description' => '', + 'page callback' => 'textbook_companion_browse_college', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'textbook_companion_browse_college_form' + ), + 'access arguments' => array( + 'access content' + ), + 'type' => MENU_LOCAL_TASK, + 'file' => 'search.inc', + 'weight' => 4 + ); + $items['textbook-companion/textbook-search/student'] = array( + 'title' => 'By Student', + 'description' => '', + 'page callback' => 'textbook_companion_browse_student', + 'access arguments' => array( + 'access content' + ), + 'type' => MENU_LOCAL_TASK, + 'file' => 'search.inc', + 'weight' => 5 + ); + /* $items['textbook_run'] = array( 'title' => 'Download Codes', 'page callback' => 'drupal_get_form', - 'page arguments' => array('textbook_companion_run_form'), + 'page arguments' => array('textbook_companion_run_form_ajax'), 'access arguments' => array('access content'), 'type' => MENU_NORMAL_ITEM, 'file' => 'run.inc', - ); - $items['download_codes'] = array( + );*/ + $items['textbook-companion/textbook-run'] = array( + 'title' => 'Download Codes', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'textbook_companion_run_form' + ), + 'access arguments' => array( + 'access content' + ), + 'type' => MENU_NORMAL_ITEM, + 'file' => 'run.inc' + ); + /*$items['textbook_run_ajax'] = array( + 'page callback' => 'textbook_run_ajax', + 'access callback' => TRUE, + 'file' => 'run.inc', + );*/ + /*$items['download_codes'] = array( 'title' => 'Download Codes', 'page callback' => 'drupal_get_form', - 'page arguments' => array('textbook_companion_run_form'), + 'page arguments' => array('textbook_companion_run_form_ajax'), 'access arguments' => array('access content'), 'type' => MENU_NORMAL_ITEM, 'file' => 'run.inc', - ); - /* download callbacks */ - $items['download/file'] = array( - 'title' => 'Code Download', - 'description' => 'Code Download', - 'page callback' => 'textbook_companion_download_example_file', - 'access arguments' => array('download code'), - 'type' => MENU_CALLBACK, - 'file' => 'download.inc', - ); - $items['download/dependency'] = array( + );*/ + $items['textbook-companion/download-codes'] = array( + 'title' => 'Download Codes', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'textbook_companion_run_form' + ), + 'access arguments' => array( + 'access content' + ), + 'type' => MENU_NORMAL_ITEM, + 'file' => 'run.inc' + ); + /* download callbacks */ + $items['textbook-companion/download/file'] = array( + 'title' => 'Code Download', + 'description' => 'Code Download', + 'page callback' => 'textbook_companion_download_example_file', + 'access arguments' => array( + 'download code' + ), + 'type' => MENU_CALLBACK, + 'file' => 'download.inc' + ); + $items['textbook-companion/download/samplecode'] = array( + 'title' => 'Sample Code Download', + 'description' => 'Sample Code Download', + 'page callback' => 'textbook_companion_download_sample_code', + 'access arguments' => array( + 'download code' + ), + 'type' => MENU_CALLBACK, + 'file' => 'download.inc' + ); + /* $items['download/dependency'] = array( 'title' => 'Code Download', 'description' => 'Code Download', 'page callback' => 'textbook_companion_download_dependency_file', 'access arguments' => array('download code'), 'type' => MENU_CALLBACK, 'file' => 'download.inc', - ); - $items['download/example'] = array( - 'title' => 'Code Download', - 'description' => 'Code Download', - 'page callback' => 'textbook_companion_download_example', - 'access arguments' => array('download code'), - 'type' => MENU_CALLBACK, - 'file' => 'download.inc', - ); - $items['download/chapter'] = array( - 'title' => 'Code Download', - 'description' => 'Code Download', - 'page callback' => 'textbook_companion_download_chapter', - 'access arguments' => array('download code'), - 'type' => MENU_CALLBACK, - 'file' => 'download.inc', - ); - $items['download/book'] = array( - 'title' => 'Code Download', - 'description' => 'Code Download', - 'page callback' => 'textbook_companion_download_book', - 'access arguments' => array('download code'), - 'type' => MENU_CALLBACK, - 'file' => 'download.inc', - ); - /* reviewer download */ - $items['full_download/chapter'] = array( - 'title' => 'Code Download', - 'description' => 'Code Download', - 'page callback' => 'textbook_companion_download_full_chapter', - 'access arguments' => array('download code'), - 'type' => MENU_CALLBACK, - 'file' => 'full_download.inc', - ); - $items['full_download/book'] = array( - 'title' => 'Code Download', - 'description' => 'Code Download', - 'page callback' => 'textbook_companion_download_full_book', - 'access arguments' => array('download code'), - 'type' => MENU_CALLBACK, - 'file' => 'full_download.inc', - ); - - /* external reviewer download */ - $items['full_download_external/chapter'] = array( - 'title' => 'Code Download', - 'description' => 'Code Download', - 'page callback' => 'textbook_companion_download_full_chapter', - 'access arguments' => array('download books to review'), - 'type' => MENU_CALLBACK, - 'file' => 'full_download.inc', - ); - $items['full_download_external/book'] = array( - 'title' => 'Code Download', - 'description' => 'Code Download', - 'page callback' => 'textbook_companion_download_full_book', - 'access arguments' => array('download books to review'), - 'type' => MENU_CALLBACK, - 'file' => 'full_download.inc', - ); - - /* latex script for book generation */ - $items['textbook_companion/generate_book'] = array( - 'title' => 'Generate Book', - 'description' => 'Generate Book From Latex Script', - 'page callback' => 'textbook_companion_download_book', - 'access arguments' => array('generate book'), - 'type' => MENU_CALLBACK, - 'file' => 'latex.inc', - ); - $items['textbook_companion/delete_book'] = array( - 'title' => 'Delete Book PDF', - 'description' => 'Delete Book PDF', - 'page callback' => 'textbook_companion_delete_book', - 'access arguments' => array('approve code'), - 'type' => MENU_CALLBACK, - 'file' => 'latex.inc', - ); - - /* general purpose callbacks */ - $items['textbook_companion/ajax'] = array( - 'title' => 'Ajax', - 'description' => 'Ajax', - 'page callback' => 'textbook_companion_ajax', - 'access arguments' => array('access content'), - 'type' => MENU_CALLBACK, - ); - - /* for admin */ - $items['admin/settings/book_companion'] = array( - 'title' => 'Book Companion Settings', - 'description' => 'Book Companion Settings', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('textbook_companion_settings_form'), - 'access arguments' => array('administer book companion'), - 'type' => MENU_NORMAL_ITEM, - 'file' => 'settings.inc', - ); - /* for data entry */ - $items['dataentry_book'] = array( - 'title' => 'Approved books list', - 'page callback' => '_data_entry_proposal_all', - 'access callback' => 'user_access', - 'access arguments' => array('dataentry book proposal'), - 'file' => 'manage_proposal.inc', - ); - $items['dataentry_edit'] = array( - 'title' => 'Edit book details', - 'page callback' => 'dataentry_edit', - 'access callback' => 'user_access', - 'access arguments' => array('dataentry book proposal'), - 'type' => MENU_NORMAL_ITEM, - 'file' => 'manage_proposal.inc', - ); - /*Cheque Details and Contact Form */ - $items['cheque_manage/all'] = array( - 'title' => 'Cheque Proposals', - 'description' => 'Cheque Proposals', - 'page callback' => 'cheque_proposal_all', - 'access arguments' => array('cheque proposal'), - 'file' => 'cheque_manage.inc', - ); - $items['mycontact'] = array( - 'title' => 'Update Contact Details', - 'description' => 'Update Contact Details', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('contact_details'), - 'access arguments' => array('contact_details'), - 'file' => 'cheque_contact.inc', - ); - - $items['cheque_contct'] = array( - 'title' => 'Report', - 'description' => 'Cheque Contact Form', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('cheque_contct_form'), - 'access arguments' => array('cheque contct form'), - 'file' => 'cheque_contact.inc', - ); - $items['cheque_contact/status'] = array( - 'title' => 'Cheque Status', - 'description' => 'Cheque Status', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('cheque_status_form'), - 'access' => 'user_is_logged_in', - 'access arguments' => array('cheque status form'), - 'file' => 'cheque_contact.inc', - ); - $items['cheque_contct/report'] = array( - 'title' => 'Report', - 'description' => 'Report', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('cheque_report_form'), - 'access' => 'user_is_logged_in', - 'access arguments' => array('cheque report form'), - 'file' => 'cheque_contact.inc', - ); - // $items['certificate'] = array( - // 'title' => 'List Of All Certificates', - // 'description' => 'List Of All Certificates', - // 'page callback' => '_list_all_certificates', - // 'access arguments' => array('list all certificates'), - // 'file' => 'pdf/list_all_certificates.inc', - // ); - // $items['certificate/generate_pdf'] = array( - // 'title' => 'Download Certificate', - // 'description' => 'Download Certificate', - // 'page callback' => 'drupal_get_form', - // 'page arguments' => array('generate_pdf'), - // 'access arguments' => array('generate pdf'), - // 'file' => 'pdf/generate_pdf.inc', - // ); - $items['manage_proposal/paper_submission'] = array( - 'title' => 'Application Submission', - 'description' => 'Application Submission', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('paper_submission_form'), - 'access arguments' => array('paper submission form'), - 'type' => MENU_CALLBACK, - 'file' => 'cheque_contact.inc', - ); - // $items["nonaicte_proposal"] = array( - // "title" => "Book Suggestion Form ", - // "description" => "NON-AICTE Book Proposal Form", - // 'page callback' => 'textbook_companion_nonaicte_proposal_all', - // 'access arguments' => array('create book proposal'), - // 'type' => MENU_NORMAL_ITEM, - // ); - return $items; + );*/ + $items['textbook-companion/download/example'] = array( + 'title' => 'Code Download', + 'description' => 'Code Download', + 'page callback' => 'textbook_companion_download_example', + 'access arguments' => array( + 'download code' + ), + 'type' => MENU_CALLBACK, + 'file' => 'download.inc' + ); + $items['textbook-companion/download/chapter'] = array( + 'title' => 'Code Download', + 'description' => 'Code Download', + 'page callback' => 'textbook_companion_download_chapter', + 'access arguments' => array( + 'download code' + ), + 'type' => MENU_CALLBACK, + 'file' => 'download.inc' + ); + $items['textbook-companion/download/book'] = array( + 'title' => 'Code Download', + 'description' => 'Code Download', + 'page callback' => 'textbook_companion_download_book', + 'access arguments' => array( + 'download code' + ), + 'type' => MENU_CALLBACK, + 'file' => 'download.inc' + ); + /* reviewer download */ + $items['textbook-companion/full-download/chapter'] = array( + 'title' => 'Code Download', + 'description' => 'Code Download', + 'page callback' => 'textbook_companion_download_full_chapter', + 'access arguments' => array( + 'approve code' + ), + 'type' => MENU_CALLBACK, + 'file' => 'full_download.inc' + ); + $items['textbook-companion/full-download/book'] = array( + 'title' => 'Code Download', + 'description' => 'Code Download', + 'page callback' => 'textbook_companion_download_full_book', + 'access arguments' => array( + 'approve code' + ), + 'type' => MENU_CALLBACK, + 'file' => 'full_download.inc' + ); + /* external reviewer download */ + $items['textbook-companion/full-download-external/chapter'] = array( + 'title' => 'Code Download', + 'description' => 'Code Download', + 'page callback' => 'textbook_companion_download_full_chapter', + 'access arguments' => array( + 'download books to review' + ), + 'type' => MENU_CALLBACK, + 'file' => 'full_download.inc' + ); + $items['textbook-companion/full-download-external/book'] = array( + 'title' => 'Code Download', + 'description' => 'Code Download', + 'page callback' => 'textbook_companion_download_full_book', + 'access arguments' => array( + 'download books to review' + ), + 'type' => MENU_CALLBACK, + 'file' => 'full_download.inc' + ); + /* latex script for book generation */ + $items['textbook-companion/generate-book'] = array( + 'title' => 'Generate Book', + 'description' => 'Generate Book From Latex Script', + 'page callback' => 'textbook_companion_download_book', + 'access arguments' => array( + 'generate book' + ), + 'type' => MENU_CALLBACK, + 'file' => 'latex.inc' + ); + $items['textbook-companion/delete-book'] = array( + 'title' => 'Delete Book PDF', + 'description' => 'Delete Book PDF', + 'page callback' => 'textbook_companion_delete_book', + 'access arguments' => array( + 'approve code' + ), + 'type' => MENU_CALLBACK, + 'file' => 'latex.inc' + ); + /* general purpose callbacks */ + $items['textbook-companion/ajax'] = array( + 'title' => 'Ajax', + 'description' => 'Ajax', + 'page callback' => 'textbook_companion_ajax', + 'access arguments' => array( + 'access content' + ), + 'type' => MENU_CALLBACK + ); + /* for admin */ + $items['admin/settings/book_companion'] = array( + 'title' => 'Book Companion Settings', + 'description' => 'Textbook Companion Settings', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'textbook_companion_settings_form' + ), + 'access arguments' => array( + 'administer book companion' + ), + 'type' => MENU_NORMAL_ITEM, + 'file' => 'settings.inc' + ); + /* for data entry */ + $items['textbook-companion/dataentry-book'] = array( + 'title' => 'Approved books list', + 'page callback' => '_data_entry_proposal_all', + 'access callback' => 'user_access', + 'access arguments' => array( + 'dataentry book proposal' + ), + 'file' => 'manage_proposal.inc' + ); + $items['textbook-companion/dataentry-edit'] = array( + 'title' => 'Edit book details', + 'page callback' => 'dataentry_edit', + 'access callback' => 'user_access', + 'access arguments' => array( + 'dataentry book proposal' + ), + 'type' => MENU_NORMAL_ITEM, + 'file' => 'manage_proposal.inc' + ); + /*Cheque Details and Contact Form */ + $items['textbook-companion/cheque-manage/all'] = array( + 'title' => 'Cheque Proposals', + 'description' => 'Cheque Proposals', + 'page callback' => 'cheque_proposal_all', + 'access arguments' => array( + 'cheque proposal' + ), + 'file' => 'cheque_manage.inc' + ); + $items['textbook-companion/mycontact'] = array( + 'title' => 'Update Contact Details', + 'description' => 'Update Contact Details', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'contact_details' + ), + 'access arguments' => array( + 'contact_details' + ), + 'file' => 'cheque_contact.inc' + ); + $items['textbook-companion/cheque-contct'] = array( + 'title' => 'Report', + 'description' => 'Cheque Contact Form', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'cheque_contct_form' + ), + 'access arguments' => array( + 'cheque contct form' + ), + 'file' => 'cheque_contact.inc' + ); + $items['textbook-companion/cheque-contact/status'] = array( + 'title' => 'Cheque Status', + 'description' => 'Cheque Status', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'cheque_status_form' + ), + 'access' => 'user_is_logged_in', + 'access arguments' => array( + 'cheque status form' + ), + 'file' => 'cheque_contact.inc' + ); + $items['textbook-companion/cheque-contct/report'] = array( + 'title' => 'Report', + 'description' => 'Report', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'cheque_report_form' + ), + 'access' => 'user_is_logged_in', + 'access arguments' => array( + 'cheque report form' + ), + 'file' => 'cheque_contact.inc' + ); + $items['textbook-companion/certificate'] = array( + 'title' => 'List Of All Certificates', + 'description' => 'List Of All Certificates', + 'page callback' => '_list_all_certificates', + 'access arguments' => array( + 'list all certificates' + ), + 'file' => 'pdf/list_all_certificates.inc' + ); + $items['textbook-companion/certificate/generate-pdf'] = array( + 'title' => 'Download Certificate', + 'description' => 'Download Certificate', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'generate_pdf' + ), + 'access arguments' => array( + 'generate pdf' + ), + 'file' => 'pdf/generate_pdf.inc' + ); + $items['textbook-companion/manage-proposal/paper-submission'] = array( + 'title' => 'Application Submission', + 'description' => 'Application Submission', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'paper_submission_form' + ), + 'access arguments' => array( + 'paper submission form' + ), + 'type' => MENU_CALLBACK, + 'file' => 'cheque_contact.inc' + ); + $items["textbook-companion/nonaicte-proposal"] = array( + "title" => "Book Suggestion Form ", + "description" => "NON-AICTE Book Proposal Form", + 'page callback' => 'textbook_companion_nonaicte_proposal_all', + 'access arguments' => array( + 'create book proposal' + ), + 'type' => MENU_CALLBACK + ); + return $items; } - /** * Implementation of hook_perm(). */ -function textbook_companion_perm() { - return array('create book proposal', 'approve book proposal', 'approve code', 'upload code', 'edit uploaded code', 'download code', 'create feedback', 'bulk manage code', 'bulk delete code', 'edit book proposal', 'administer book companion', 'generate book', 'cheque contct form', 'contact_details', 'comment cheque', 'list all certificates', 'generate pdf', 'paper submission form', 'cheque status form' ,'cheque report form' ,'cheque proposal', 'download books to review'); +function textbook_companion_permission() +{ + return array( + "create book proposal" => array( + "title" => t("Book Proposal Form"), + "description" => t("Book Proposal Form.") + ), + "approve book proposal" => array( + "title" => t("Approve book proposal"), + "description" => t("Allows users to approve book proposal.") + ), + "approve code" => array( + "title" => t("Approve code"), + "description" => t("Allows users to approve code.") + ), + "upload code" => array( + "title" => t("Upload code"), + "description" => t("Allows users to upload code.") + ), + "edit uploaded code" => array( + "title" => t("Edit uploaded code"), + "description" => t("Allows users to edit uploaded code.") + ), + "download code" => array( + "title" => t("Download code"), + "description" => t("Allows users to download code.") + ), + "create feedback" => array( + "title" => t("Create feedback"), + "description" => t("Allows users to create feedback.") + ), + "bulk manage code" => array( + "title" => t("Bulk manage code"), + "description" => t("Allows users to manage Bulk code.") + ), + "bulk delete code" => array( + "title" => t("Bulk delete code"), + "description" => t("Allows users to delete bulk code.") + ), + "edit book proposal" => array( + "title" => t("Edit book proposal"), + "description" => t("Allows users to edit book proposal.") + ), + "administer book companion" => array( + "title" => t("Administer book companion"), + "description" => t("Allows users to administer book companion.") + ), + "generate book" => array( + "title" => t("Generate book"), + "description" => t("Allows users to generate book.") + ), + "cheque contct form" => array( + "title" => t("Cheque contact form"), + "description" => t("Cheque contct form.") + ), + "contact_details" => array( + "title" => t("Contact_details"), + "description" => t("Contact_details.") + ), + "comment cheque" => array( + "title" => t("Comment cheque"), + "description" => t("Comment cheque.") + ), + "list all certificates" => array( + "title" => t("list all certificates"), + "description" => t("Allows users to list all certificates.") + ), + "generate pdf" => array( + "title" => t("Generate pdf"), + "description" => t("Allows users to Generate pdf.") + ), + "paper submission form" => array( + "title" => t("paper submission form"), + "description" => t("Paper submission form.") + ), + "cheque status form" => array( + "title" => t("Cheque status form"), + "description" => t("Cheque status form.") + ), + "cheque report form" => array( + "title" => t("Cheque report form"), + "description" => t("Cheque report form.") + ), + "cheque proposal" => array( + "title" => t("Cheque proposal"), + "description" => t("Cheque proposal.") + ), + "download books to review" => array( + "title" => t("download books to review"), + "description" => t("Download books to review.") + ) + ); } - /* Aicte books pickup before the proposal form */ -function textbook_companion_aicte_proposal_form($form_state) { - $query = " - SELECT * FROM textbook_companion_aicte - WHERE status = 0 AND selected = 0 - "; - $result = db_query($query); - - $form = array(); - $form["wrapper"] = array( - "#type" => "fieldset", - "#prefix" => "
", - "#suffix" => "
", - ); - $num_rows = mysql_num_rows($result); - if ($num_rows > 0) { - while($row = db_fetch_object($result)) { - /* fixing title string */ - $title = ""; - $edition = ""; - $year = ""; - $title = "{$row->book} by {$row->author}"; - if($row->edition) { - $edition = "ed: {$row->edition}"; - } - if($row->year) { - if($row->edition) { - $year = ", pub: {$row->year}"; - } else { - $year = "pub: {$row->year}"; - } - } - if($edition or $year) { - $title .= "({$edition} {$year})"; - } - $form["wrapper"][$row->id] = array( - "#type" => "checkbox", - "#title" => $title, - "#prefix" => "
", - "#suffix" => "
", - ); - } - } - $form["submit"] = array( - "#type" => "submit", - "#value" => "Submit Book Selections" - ); - return $form; +/*function textbook_companion_aicte_proposal_form($form_state) { +/* $query = " +SELECT * FROM textbook_companion_aicte +WHERE status = 0 AND selected = 0 +"; +$result = db_query($query);*/ +/* $query = " +SELECT * FROM textbook_companion_aicte +WHERE status = :status AND selected = :selected +"; +$args = array( +':status' => 0, +':selected' => 0, +); +$result = db_query($query,$args); */ +/* $query = db_select('textbook_companion_aicte'); +$query->fields('textbook_companion_aicte'); +$query->condition('status', 0); +$query->condition('selected', 0); +$result = $query->execute(); + +$form = array(); +$form["wrapper"] = array( +"#type" => "fieldset", +"#prefix" => "
", +"#suffix" => "
", +); +// $num_rows = mysql_num_rows($result); +$num_rows = $query->countQuery(); +if ($num_rows > 0) { +while($row = $result->fetchObject()) { +/* fixing title string */ +/* $title = ""; +$edition = ""; +$year = ""; +$title = "{$row->book} by {$row->author}"; +if($row->edition) { +$edition = "ed: {$row->edition}"; } - -function textbook_companion_aicte_proposal_form_validate($form, &$form_state) { - $query = " - SELECT * FROM textbook_companion_aicte - WHERE status = 0 AND selected = 0 - "; - $result = db_query($query); - - $count = 0; - $selections = array(); - while($row = db_fetch_object($result)) { - if($form_state["values"][$row->id] == 1) { - $count++; - array_push($selections, $row->id); - } - } - /* user can choose only 3 books to propose */ - if($count != 3) { - form_set_error("", "Please select exactly 3 books. You currently selected {$count}"); - } else { - $form_state["values"]["selections"] = $selections; - } +if($row->year) { +if($row->edition) { +$year = ", pub: {$row->year}"; +} else { +$year = "pub: {$row->year}"; } - -function textbook_companion_aicte_proposal_form_submit($form, &$form_state) { - global $user; - $selections = $form_state["values"]["selections"]; - variable_set("aicte_".$user->uid, $selections); - drupal_goto("proposal"); } - - - - -function textbook_companion_aicte_proposal_all() { +if($edition or $year) { +$title .= "({$edition} {$year})"; +} +$form["wrapper"][$row->id] = array( +"#type" => "checkbox", +"#title" => $title, +"#prefix" => "
", +"#suffix" => "
", +); +} +} +$form["submit"] = array( +"#type" => "submit", +"#value" => "Submit Book Selections" +); +return $form; +}*/ +/*function textbook_companion_aicte_proposal_form_validate($form, &$form_state) { +/*$query = " +SELECT * FROM textbook_companion_aicte +WHERE status = 0 AND selected = 0 +"; +$result = db_query($query);*/ +/*$query = db_select('textbook_companion_aicte'); +$query->fields('textbook_companion_aicte'); +$query->condition('status', 0); +$query->condition('selected', 0); +$result = $query->execute(); + +$count = 0; +$selections = array(); +while($row = $result->fetchObject()) { +if($form_state["values"][$row->id] == 1) { +$count++; +array_push($selections, $row->id); +} +} +/* user can choose only 3 books to propose */ +/* if($count != 3) { +form_set_error("", "Please select exactly 3 books. You currently selected {$count}"); +} else { +$form_state["values"]["selections"] = $selections; +} +}*/ +/*function textbook_companion_aicte_proposal_form_submit($form, &$form_state) { +global $user; +$selections = $form_state["values"]["selections"]; +var_dump($selections); +variable_set("aicte_".$user->uid, $selections); +drupal_goto("proposal"); +}*/ +/*function textbook_companion_aicte_report_form($form_state) { +/*$query = " +SELECT * FROM textbook_companion_aicte +WHERE status = 0 +ORDER BY book +"; +$result = db_query($query);*/ +/*$query = db_select('textbook_companion_aicte'); +$query->fields('textbook_companion_aicte'); +$query->condition('status', 0); +$query->orderBy('book', 'ASC'); +$result = $query->execute(); + +$books = array(); +$books[0] = "Please select a book"; +while($row = $result->fetchObject()) { +$books[$row->id] = "{$row->book} ({$row->author})"; +} +$form = array(); +$form["name"] = array( +"#type" => "textfield", +"#title" => "Name", +"#description" => t("Please enter your name."), +); +$form["email"] = array( +"#type" => "textfield", +"#title" => "Email", +"#description" => t("Please enter your valid email id."), +); +$form["number"] = array( +"#type" => "textfield", +"#title" => "Number", +"#description" => t("Please enter your valid phone number."), +); +$form["book"] = array( +"#type" => "select", +"#title" => "AICTE Book", +"#description" => t("Please select a book."), +"#options" => $books +); +$form["comment"] = array( +"#type" => "textarea", +"#title" => "Any other comment?", +"#description" => t("Please enter your query (if any)") +); +$form["submit"] = array( +"#type" => "submit", +"#value" => "Submit" +); +return $form; +} +*/ +/*function textbook_companion_aicte_report_form_submit($form, &$form_state) { +$v = $form_state["values"]; + +/*$query = " +INSERT INTO textbook_companion_aicte_report +(aicte_id, name, number, email, comment) +VALUES +(%d, '%s', '%s', '%s', '%s') +"; +$result = db_query($query, +$v["book"], $v["name"], $v["number"], $v["email"], $v["comment"] +);*/ +/*$query = "INSERT INTO textbook_companion_aicte_report +(aicte_id, name, number, email, comment) +VALUES (:aicte_id, :name, :number, :email, :comment)"; +$args = array( +":aicte_id" => $v["book"], +":name" => $v["name"], +":number" => $v["number"], +":email" =>$v["email"], +":comment" => $v["comment"] +); +$result = db_query($query, $args, array('return' => Database::RETURN_INSERT_ID)); + +drupal_set_message("Thank you for reporting.", "status"); +} +*/ +function textbook_companion_aicte_proposal_all() +{ global $user; $page_content = ""; - if (!$user->uid) { - $query = " - SELECT * FROM textbook_companion_aicte - WHERE status = 0 + /*$query = " + SELECT * FROM textbook_companion_aicte + WHERE status = 0 "; - $result = db_query($query); - + $result = db_query($query);*/ + $query = db_select('textbook_companion_aicte'); + $query->fields('textbook_companion_aicte'); + $query->condition('status', 0); + $result = $query->execute(); $page_content .= "