'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, 'file' => 'proposal.inc' ); $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_CALLBACK, 'file' => 'proposal.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_CALLBACK, 'file' => 'proposal.inc' ); $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_CALLBACK, 'file' => 'proposal.inc' ); /* 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( 'title' => 'Categorize', 'description' => 'Categorize Books', 'page callback' => '_category_all', 'access callback' => 'user_access', 'access arguments' => array( 'approve book proposal' ), '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( 'title' => 'Edit Category', 'description' => 'Edit category', 'page callback' => 'drupal_get_form', 'page arguments' => array( 'category_edit_form' ), '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', '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['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/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', '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' => 3, '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( 'upload_dependency_form' ), 'access arguments' => array( 'upload code' ), 'type' => MENU_LOCAL_TASK, '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( '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_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['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['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/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( 'approve 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( 'approve 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' ); return $items; } /** * Implementation of hook_permission(). */ 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.") ) ); } function del_book_pdf($book_id) { $root_path = textbook_companion_path(); $dir_path = $root_path . "latex/"; $pdf_filename = "book_" . $book_id . ".pdf"; if (file_exists($dir_path . $pdf_filename)) unlink($dir_path . $pdf_filename); } function _tbc_list_of_states() { $states = array( 0 => '-Select-' ); $query = db_select('list_states_of_india'); $query->fields('list_states_of_india'); //$query->orderBy('', ''); $states_list = $query->execute(); while ($states_list_data = $states_list->fetchObject()) { $states[$states_list_data->state] = $states_list_data->state; } //$states_list_data = $states_list->fetchObject() return $states; } function _tbc_list_of_cities() { $city = array( 0 => '-Select-' ); $query = db_select('list_cities_of_india'); $query->fields('list_cities_of_india'); $query->orderBy('city', 'ASC'); $city_list = $query->execute(); while ($city_list_data = $city_list->fetchObject()) { $city[$city_list_data->city] = $city_list_data->city; } //$city_list_data = $city_list->fetchObject() return $city; } function _tbc_list_of_departments() { $query = db_select('list_of_departments'); $query->fields('list_of_departments'); $query->orderBy('id', 'DESC'); $department_list = $query->execute(); while ($department_list_data = $department_list->fetchObject()) { $department[$department_list_data->department] = $department_list_data->department; } //$department_list_data = $department_list->fetchObject() return $department; } function _tbc_list_of_category($category_id = NULL) { 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_init() { $path = drupal_get_path('module', 'textbook_companion'); drupal_add_css($path . '/css/textbook_companion.css'); drupal_add_js($path . '/js/textbook_companion.js'); drupal_add_js($path . '/js/jquery-1.7.1.js'); }