-
Notifications
You must be signed in to change notification settings - Fork 4
/
textbook_companion.module
executable file
·3851 lines (3732 loc) · 132 KB
/
textbook_companion.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/*
implementation of hook_menu().
*/
function textbook_companion_menu()
{
$items = array();
/* users */
$items['textbook-companion/completed-books'] = array(
'title' => 'Completed Books',
'page callback' => 'tbc_completed_books_display_new_category_all',
'access arguments' => array(
'display books in progress'
),
'type' => MENU_LOCAL_TASK,
'file' => 'display_books.inc'
);
$items['textbook_run'] = array(
'title' => 'Download Codes',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'textbook_companion_book_run_form'
),
'access arguments' => array(
'access content'
),
'type' => MENU_NORMAL_ITEM,
'file' => 'textbook_run.inc'
);
$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_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['textbook-companion/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['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['textbook-companion/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['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' => 2,
'file' => 'code_approval.inc'
);
$items['textbook-companion/code-approval/codable-examples'] = array(
'title' => 'Manage Codable Examples',
'description' => 'Manage Codable Examples',
'page callback' => 'codable_example_approval',
'access arguments' => array(
'approve code'
),
'type' => MENU_LOCAL_TASK,
'weight' => 1,
'file' => 'code_approval.inc'
);
$items['textbook-companion/code-approval/approve-codable-examples'] = array(
'title' => 'Approve codable examples',
'description' => 'Approve codable examples',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'codable_examples_approval_form'
),
'access arguments' => array(
'approve code'
),
//'weight' => 3,
'type' => MENU_NORMAL_ITEM,
'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' => 3,
'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('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-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_ajax'),
'access arguments' => array('access content'),
'type' => MENU_NORMAL_ITEM,
'file' => 'run.inc',
);*/
$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_ajax'),
'access arguments' => array('access content'),
'type' => MENU_NORMAL_ITEM,
'file' => 'run.inc',
);*/
$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['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/codable-example'] = array(
'title' => 'Code Download',
'description' => 'Code Download',
'page callback' => 'textbook_companion_download_codable_example_file',
'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/certificates/verify"] = array(
"title" => "Certificate Verification",
"page callback" => "verify_certificates",
"access arguments" => array(
"verify certificates"
),
'file' => 'pdf/verify_certificates.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_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.")
),
"verify certificates" => array(
"title" => t("Verify certificates"),
"description" => t("Allows users to verify 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.")
),
"display books in progress" => array(
"title" => t("Book display books in progress"),
"description" => t("display books in progress.")
),
);
}
function textbook_companion_aicte_proposal_all()
{
global $user;
$page_content = "";
if (!$user->uid)
{
/*$query = "
SELECT * FROM textbook_companion_aicte
WHERE status = 0
";
$result = db_query($query);*/
$query = db_select('textbook_companion_aicte');
$query->fields('textbook_companion_aicte');
$query->condition('status', 0);
$result = $query->execute();
$page_content .= "<ul>";
$page_content .= "<li>These are the list of books available for <em>Textbook Companion</em> proposal.</li>";
$page_content .= "<li>Please <a href='/user'><b><u>Login</u></b></a> to create a proposal.</li>";
$page_content .= "</ul>";
$page_content .= "Search : <input type='text' id='searchtext' style='width:82%'/>";
$page_content .= "<input type='button' value ='clear' id='search_clear'/>";
$page_content .= "<div id='aicte-list-wrapper'>";
$num_rows = $result->rowCount();
if ($num_rows > 0)
{
$i = 1;
while ($row = $result->fetchObject())
{
/* fixing title string */
$title = "";
$edition = "";
$year = "";
$title = "{$row->book} by {$row->author}";
if ($row->edition)
{
$edition = "<i>ed</i>: {$row->edition}";
} //$row->edition
if ($row->year)
{
if ($row->edition)
{
$year = ", <i>pub</i>: {$row->year}";
} //$row->edition
else
{
$year = "<i>pub</i>: {$row->year}";
}
} //$row->year
if ($edition or $year)
{
$title .= "({$edition} {$year})";
} //$edition or $year
$page_content .= "<div class='title'>{$i}) {$title}</div>";
$i++;
} //$row = $result->fetchObject()
} //$num_rows > 0
$page_content .= "</div>";
/* adding aicte report form */
//$page_content .= drupal_get_form("textbook_companion_aicte_report_form");
return $page_content;
} //!$user->uid
/* check if user has already submitted a proposal */
/* $proposal_q = db_query("SELECT * FROM {textbook_companion_proposal} WHERE uid = %d ORDER BY id DESC LIMIT 1", $user->uid);*/
$query = db_select('textbook_companion_proposal');
$query->fields('textbook_companion_proposal');
$query->condition('uid', $user->uid);
$query->orderBy('id', 'DESC');
$query->range(0, 1);
$proposal_q = $query->execute();
if ($proposal_q)
{
if ($proposal_data = $proposal_q->fetchObject())
{
switch ($proposal_data->proposal_status)
{
case 0:
drupal_set_message(t('We have already received your proposal. We will get back to you soon.'), 'status');
drupal_goto('');
return;
break;
case 1:
drupal_set_message(t('Your proposal has been approved. Please go to ' . l('Code Submission', 'textbook-companion/code') . ' to upload your code'), 'status');
drupal_goto('');
return;
break;
case 2:
drupal_set_message(t('Your proposal has been dis-approved. Please create another proposal below.'), 'error');
break;
case 3:
drupal_set_message(t('Congratulations! You have completed your last book proposal. You can create another proposal below.'), 'status');
break;
default:
drupal_set_message(t('Invalid proposal state. Please contact site administrator for further information.'), 'error');