-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathmodule.class.php
More file actions
1432 lines (1323 loc) · 48.1 KB
/
Copy pathmodule.class.php
File metadata and controls
1432 lines (1323 loc) · 48.1 KB
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
/**
* EfrontModule Abstract Class file
*
* @package eFront
* @version 1.0
*/
//This file cannot be called directly, only included.
if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) {
exit;
}
/**
* EfrontModuleException class
*
* This class extends Exception class and is used to issue errors regarding Modules
* @author Nick Baltas <[email protected]>
* @package eFront
* @version 1.0
*/
class EfrontModuleException extends Exception
{
const NO_ERROR = 0;
const BRANCH_NOT_EXISTS = 201;
const INVALID_ID = 202;
const FATHER_NOT_VALID = 203;
const INVALID_LOGIN = 204;
const DATABASE_ERROR = 205;
const DIR_NOT_EXISTS = 206;
const FILESYSTEM_ERROR = 207;
const DIRECTION_NOT_EXISTS = 208;
const GENERAL_ERROR = 299;
}
/**
* EfrontModule class
*
* This class represents a branch
* @author Nick Baltas <[email protected]>
* @package eFront
* @version 1.0
*
* Index:
*
***** General functions ********
* - __construct($defined_moduleBaseUrl , $defined_moduleBaseDir) // Constructor defining the relative paths for the module
* - diagnose() // Function that checks whether the module's defined components are correct
* - getName() // Mandatory function returning the name of the module
* - getPermittedRoles() // Mandatory function returning an array of permitted roles from "administrator", "professor", "student"
* - getLanguageFile() // Function to include the language file. Can be overriden to include any file
* - getCenterLinkInfo() // Return the info regarding the link on the main control panel
* - getSidebarLinkInfo() // Return infos regarding link(s) on the menu(s) of the left side control panel
* - getNavigationLinks() // Return navigational links for the top of the independent module page(s)
* - getName() // The name-title of the module
* - getLinkToHighlight() // Get the id of the link to be highlighted by each independent module page
*
* - onInstall() // Function to be executed when the module is installed to an eFront system
* - onUninstall() // Function to be executed when a module is deleted from a eFront system
* - onUpgrade() // Function to be executed when the module is upgraded from the link of the modules' list
* - getCurrentUser() // Get the current session user
* - getCurrentLesson() // Get the current session lesson
* - getCurrentUnit() // Get current content
* - getSmartyVar() // Get the global smarty object
* - setMessageVar($message, $message_type) // Set the global messages variables
* - addScripts() // Add javascript libraries to be included in module page load
*
***** Module processing and appearance ********
* - getModule()
* - getSmartyTpl()
* - getLessonModule()
* - getLessonSmartyTpl()
* - getContentSideInfo()
* - getContentSmartyTpl()
* - getContentSideTitle()
* - getControlPanelModule()
* - getControlPanelSmartyTpl()
* - getDashboardModule()
* - getDashboardSmartyTpl()
* - getCatalogModule()
* - getCatalogSmartyTpl()
* - getSideCatalogModule()
* - getSideCatalogSmartyTpl()
* - getLandingPageModule()
* - getLandingPageSmartyTpl()
* - getTabSmartyTpl($tabberId)
* - getModuleJS()
* - getModuleCSS()
*
***** Module links ********
* - getNavigationLinks()
* - getLinkToHighlight()
* - getSidebarLinkInfo()
* - getLessonCenterLinkInfo()
* - getCenterLinkInfo()
*
***** Module event triggered functions ********
* - onNewUser($login)
* - onDeleteUser($login)
* - onNewLesson($lessonId)
* - onCreateInstance($lessonId)
* - onDeleteLesson($lessonId)
* - onExportLesson($lessonId)
* - onImportLesson($lessonId, $data)
* - onCompleteLesson($lessonId, $login)
* - onNewPageLoad()
* - onSetTheme($theme)
*/
abstract class EfrontModule
{
var $className;
var $moduleBaseUrl;
var $moduleBaseDir;
var $moduleBaseLink;
/**
* Class constructor
*
* @param string $defined_moduleBaseUrl The basic url from which we access the module.
* @param string $defined_moduleFolder The module's folder name inside the "modules/" folder
* @since 3.5.0
* @access public
*/
public function __construct($defined_moduleBaseUrl, $defined_moduleFolder ) {
// Information set by running environment
$this -> className = get_class($this);
$this -> moduleBaseDir = G_MODULESPATH. $defined_moduleFolder ."/";
$this -> moduleBaseUrl = $defined_moduleBaseUrl;
$this -> moduleBaseLink = G_SERVERNAME . "modules/". $defined_moduleFolder . "/";
}
/**
* Function that checks whether the module's defined components are correct
*
* @param $error The error string to populate
* @since 3.5.0
* @access public
*/
public final function diagnose(&$error) {
// Check whether the roles defined are acceptable
$roles = $this -> getPermittedRoles();
foreach ($roles as $role) {
if ($role != 'administrator' && $role != 'student' && $role != 'professor') {
$error = _PERMITTEDROLESMODULEERROR;
return false;
}
}
// Check existence of user defined files
$tpl = $this -> getSmartyTpl();
if ($tpl && !is_file($tpl)) {
$error = _SMARTYTEMPLATEDOESNOTEXIST . ": ".$tpl;
return false;
}
$tpl = $this -> getLessonSmartyTpl();
if ($tpl && !is_file($tpl)) {
$error = _SMARTYTEMPLATEDOESNOTEXIST . ": ".$tpl;
return false;
}
$tpl = $this -> getControlPanelSmartyTpl();
if ($tpl && !is_file($tpl)) {
$error = _SMARTYTEMPLATEDOESNOTEXIST . ": ".$tpl;
return false;
}
$file = $this -> getModuleJS();
if ($file && !is_file($file)) {
$error = _FILEDOESNOTEXIST . ": ".$file;
return false;
}
$file = $this -> getModuleCSS();
if ($file && !is_file($file)) {
$error = _FILEDOESNOTEXIST . ": ".$file;
return false;
}
// All checks passed successfully
return true;
}
/**
* Return the name of the module
*
* Use this function whenever you want the name of the module to appear
*
* @return string The module name
* @since 3.5.0
* @access public
*/
abstract public function getName();
/**
* Return an array of the roles this module applies to. For example, it can be array('administrator'), or array('professor', 'student')
* Only valid array values are 'administrator', 'professor', 'student'
*
* @return array The permitted roles
* @since 3.5.0
* @access public
*/
abstract public function getPermittedRoles();
/**
* Function denoting whether the module is related to lessons (and hence can be activated-deactivated) or not
*
* @return boolean Wether this is a lesson-related module
* @since 3.5.0
* @access public
*/
public function isLessonModule() {
return false;
}
/**
* Function to include the language file, by default named 'lang-<language>.php', inside the
* module's folder (for example, lang-english.php). Can be overriden to include any file
*
* @param $language The name of the language to include file for, eg 'english'
* @since 3.5.0
* @access public
*/
public function getLanguageFile($language) {
if (is_file($this -> moduleBaseDir . "lang-".$language.".php")) {
return $this -> moduleBaseDir . "lang-".$language.".php";
}
return $this -> moduleBaseDir . "lang-english.php";
}
// Any further actions that need to take place during installation
/**
* Function to be executed when the module is installed to an eFront system
* Example implementation:
*
* public function onInstall() {
* return eF_executeNew("CREATE TABLE module_mymodule (
* id int(11) NOT NULL auto_increment,
* name text not null,
* PRIMARY KEY (id)
* ) DEFAULT CHARSET=utf8;");
* }
*
* @return Boolean the result (true/false) of any module installation operations
* @since 3.5.0
* @access public
*/
public function onInstall() {
return true;
}
/**
* Function to be executed when the module is removed from an eFront system
* Example implementation:
*
* public function onUninstall() {
* return eF_executeNew("DROP TABLE module_mymodule;");
* }
*
* @return Boolean the result (true/false) of any module uninstallation operations
* @since 3.5.0
* @access public
*/
public function onUninstall() {
return true;
}
/**
* Any further actions that need to take place during module upgrade
* This might relate mainly to changes taking place in the database tables that have
* been defined for this module. If the upgraded version of the module is to
* use different tables at the eFront database (like different or additional fields or field
* names), then this function should take care to maintain existing data from
* the previous module version to the new table. This could happen like that:
* 1) Create a temporary table of the form that the upgraded version of the module requires
* 2) Parse data from the existing table
* 3) Transform them in such a way that the newly defined table will accept
* 4) Insert the transformed data to the newly created temp table
* 5) Delete the initial table (from which the data have been read) for the module
* 6) Rename the temporary table to the name that the module table needs to have
*
* This algorithm guarantees that if something goes wrong no data will be lost, since
* existing data are deleted only once they have been successfully copied to the new table
* It is noted here that if onUpgrade() is not defined, then the eFront system will leave
* existing module database tables and their data intact.
*
* @return Boolean the result (true/false) of any module upgrade operations
* @since 3.5.0
* @access public
*/
public function onUpgrade() {
return true;
}
/**
* Return the current user object
*
* @return mixed Either an EfrontUser object of the current logged in user, or false if noone is logged in
* @since 3.5.0
* @access public
*/
public function getCurrentUser() {
if ($GLOBALS['currentUser']) {
$currentUser = $GLOBALS['currentUser'];
} elseif ($_SESSION['s_login']) {
$currentUser = EfrontUserFactory::factory($_SESSION['s_login']);
} else {
$currentUser = false;
}
return $currentUser;
}
/**
* Return the current course object
*
* @return mixed Either an EfrontCourse object of the current course, or false if we are not inside a course
* @since 3.6.8
* @access public
*/
public function getCurrentCourse() {
if (isset($_SESSION['s_courses_ID'])) {
$currentCourse = new EfrontCourse($_SESSION['s_courses_ID']);
return $currentCourse;
} else {
return false;
}
}
/**
* Return the current lesson object
*
* @return mixed Either an EfrontLesson object of the current lesson, or false if we are not inside a lesson
* @since 3.5.0
* @access public
*/
public function getCurrentLesson() {
if ($GLOBALS['currentLesson']) {
$currentLesson = $GLOBALS['currentLesson'];
} elseif ($_SESSION['s_lessons_ID']) {
$currentLesson = new EfrontLesson($_SESSION['s_lessons_ID']);
} else {
$currentLesson = false;
}
return $currentLesson;
}
/**
* Return the current unit object
*
* @return mixed Either an EfrontUnit object of the current unit, or false if we are not inside a unit
* @since 3.5.0
* @access public
*/
public function getCurrentUnit() {
if ($GLOBALS['currentUnit']) {
$currentUnit = $GLOBALS['currentUnit'];
} elseif ($_GET['view_unit']) {
$currentUnit = new EfrontUnit($_GET['view_unit']);
} else {
$currentUnit = false;
}
return $currentUnit;
}
/**
* Get the $smarty variable, to manipulate templates
*
* @return Object The $smarty variable
* @since 3.5.0
* @access public
*/
public final function getSmartyVar() {
global $smarty;
return $smarty;
}
/**
* Use this function to set a message that will appear on the top of the page.
* Specify 'success' or 'failure' for the 2nd argument, to make it appear
* as a success or failure message
*
* @param string $message The message to show
* @param string $message_type Either 'success' or 'failure'
* @since 3.5.0
* @access public
*/
public function setMessageVar($message, $message_type) {
$GLOBALS['message'] = $message;
$GLOBALS['message_type'] = $message_type;
}
/**
* Add event to eFront's events log
*
* This function enables module to provide events to the log
* Events should be UNIQUELY defined INSIDE the module
*
* All data required for the appearance of the log message (provided by the getEventMessage function)
* should be defined in the second argument array.
*
* <br/>Example:
* <code>
* $define("NEW_MODULE_ENTITY_INSERTION", 1);
* $module -> addEvent(NEW_MODULE_ENTITY_INSERTION, array("id" => $id, "title" => $title));
* </code>
* The $data parameter is the information required by the getEventMessage function to display the related message
* for this event.
* Note:
* Field 'timestamp' is automatically completed
* If fields "users_LOGIN", "users_name" and "users_surname" are not defined, then the currentUser's info will be used
* If fields "lessons_ID" and "lessons_name" are defined, then this event will also be related with that lesson
* The array might contain any other fields. However, the exact same ones need to be used by getEventMessage
*
* @param integer $type The unique code of the event inside the particular module scope
* @param array $data The information required by the getEventMessage function to display the related message
* for this event.
* @return EfrontEvent the result of the event insertion to the database or false if arguments are not correct
* @since 3.6.0
* @access public
*/
public function addEvent($type, $data) {
$fields = array();
// All module related events have the same offset + the particular event's type
$fields['type'] = EfrontEvent::MODULE_BASE_TYPE_CODE + (integer)$type;
// This should not exist normally, just in case
unset($data['type']);
// The discimination between events from different modules with the same type is made
// by the entity_ID field, which is the className of the implicated module
$fields['entity_ID'] = $this -> className;
// Mandatory users_LOGIN, users_surname, users_name fields
if (isset($data['users_LOGIN'])) {
$fields['users_LOGIN'] = $data['users_LOGIN'];
if(isset($data['surname']) && isset($data['name'])) {
$fields['users_surname'] = $data['surname'];
$fields['users_name'] = $data['name'];
} else {
$eventsUser = EfrontUserFactory::factory($data['users_LOGIN']);
$fields['users_surname'] = $eventsUser -> user['surname'];
$fields['users_name'] = $eventsUser -> user['name'];
}
// We remove data fields, to serialize all remaining ones into the entity_name field
unset($data['users_LOGIN']);
unset($data['users_surname']);
unset($data['users_name']);
} else {
$currentUser = $this ->getCurrentUser();
$fields['users_LOGIN'] = $currentUser -> user['login'];
$fields['users_surname'] = $currentUser -> user['surname'];
$fields['users_name'] = $currentUser -> user['name'];
}
// The lessons_ID field associates an event with a specific lesson
if (isset($data['lessons_ID'])) {
$fields['lessons_ID'] = $data['lessons_ID'];
if (isset($data['lessons_name'])) {
$fields['lessons_name'] = $data['lessons_name'];
unset($data['lessons_name']);
} else {
$lesson = new EfrontLesson($fields['lessons_ID']);
$fields['lessons_name'] = $lesson -> lesson['name'];
}
// We remove data fields, to serialize all remaining ones into the entity_name field
unset($data['lessons_ID']);
}
// Serialize all remaining user provided data for this event, with the same labels as the ones given
if (!empty($data)) {
$fields['entity_name'] = serialize($data);
}
// Finally get current time
$fields['timestamp'] = time();
return EfrontEvent::triggerEvent($fields);
}
/**
* Get the message associated to a particular event
*
* This function returns the message that should appear in a log/timeline/email digest etc
* for this event. Data provided during event insertion are now used to create the message that should be
* returned.
*
*
* <br/>Example:
* <code>
* $define("NEW_MODULE_ENTITY_INSERTION", 1);
* $data_array = array("id" => $id, "title" => $title);
* $module -> addEvent(NEW_MODULE_ENTITY_INSERTION, $data_array);
*
* // Sample implementation
* public function getEventMessage($type, $data) {
* if ($type == 1) {
* return "User ".$data['users_surname']." ".$data['users_name']." inserted <a href='student.php?entity_ID=".$data['id']."'>entity</a> with title: " . $data['title'];
* }
* return false;
* }
* </code>
* The $data argument is the information as provided by the addEvent method, needed to display this message
* for this event.
* Notes:
* Fields "timestamp", "users_LOGIN", "users_name" and "users_surname" are ALWAYS provided
* The remaining fields are the same ones provided by the addEvent function
* The time of the event is implicitly printed by the eFront system and should not be provided by your defined event messages
*
* @param int $type the unique code of the event inside the particular module scope
* @param array $data information as provided by the addEvent method, needed to display this message
* for this event.
* @return mixed the message associated with this event and the provided data or false if no such message is to be provided
* @since 3.6.0
* @access public
*/
public function getEventMessage($type, $data) {
return false;
}
// Method used to load current eFront scripts from the www/js folder as
// return array("XX","folderY/ZZ"); will load www/js/XX.js and www/js/folderY/ZZ.js
/**
* Method used to load current eFront scripts from the www/js folder as
* return array("XX","folderY/ZZ"); will load www/js/XX.js and www/js/folderY/ZZ.js
*
* @return array An array of efront scripts to load
* @since 3.5.0
* @access public
*/
public function addScripts() {
return array();
}
/**
* This is the function for the php code of the MAIN module pages (the ones
* called from url: $this->moduleBaseUrl . "&...."
* The global smarty variable may also be used here and in conjunction
* with the getSmartyTpl() function, use php+smarty to display the page
*
* In essence, the functions getModule() and getSmartyTpl may be used interchangebly and you can
* implement either, or both. They are always both executed, but you can use the latter to include
* a smarty file in the module page
*
* @since 3.5.0
* @access public
*/
public function getModule() {
return false;
}
/**
* This is the function that returns the name of the module smarty template file
* for the appearance of the main page of the module (if one such is used)
* Example implementation:
*
* public function getSmartyTpl() {
* return $this -> moduleBaseDir . "
* }
*
* In essence, the functions getModule() and getSmartyTpl may be used interchangebly and you can
* implement either, or both. They are always both executed, but you can use the latter to include
* a smarty file in the module page
*
* @since 3.5.0
* @access public
*/
public function getSmartyTpl() {
$smarty = $this -> getSmartyVar();
$smarty -> assign("T_MODULE_BASEDIR" , $this -> moduleBaseDir);
$smarty -> assign("T_MODULE_BASELINK" , $this -> moduleBaseLink);
$smarty -> assign("T_MODULE_BASEURL" , $this -> moduleBaseUrl);
return false;
}
/**
* This is the function for the php code of the module page that may
* appear as a sub-window on the main lesson page of the current Lesson (for students/professors)
* Note: Current lesson information may be retrieved with the getCurrentLesson() function
*
* @since 3.5.0
* @access public
*/
public function getLessonModule() {
return false;
}
/**
* This is the template code returned inside a block in a lesson
*
* @since 3.5.0
* @access public
*/
public function getLessonSmartyTpl() {
return false;
}
/**
* This is the code executed inside the content (unit) page of a lesson
*
* @since 3.6.0
* @access public
*/
public function getContentSideInfo() {
return false;
}
/**
* This is a link appearning on the content tools block
*
* @since 3.6.10
* @access public
*/
public function getContentToolsLink() {
return false;
}
/**
* This is the template code returned inside the content (unit) page of a lesson
*
* @since 3.6.0
* @access public
*/
public function getContentSmartyTpl() {
return false;
}
/**
* Returns the title string to appear on top of the content side - if such is definedon
*
* @since 3.6.0
* @access public
*/
public function getContentSideTitle() {
return false;
}
/**
* This is the function for the php code of the module page that may
* appear as a sub-window on the main administrator control panel page
*
* @since 3.5.0
* @access public
*/
public function getControlPanelModule() {
return false;
}
/**
* This is the template code returned for admin's control panel blocks
*
* @since 3.5.0
* @access public
*/
public function getControlPanelSmartyTpl() {
$smarty = $this->getSmartyVar();
$smarty -> assign("T_MODULE_BASEDIR" , $this -> moduleBaseDir);
$smarty -> assign("T_MODULE_BASEURL" , $this -> moduleBaseUrl);
return false;
}
/**
* This is the function for the php code of the module page that may
* appear as a sub-window on the main administrator control panel page
*
* @since 3.6.0
* @access public
*/
public function getDashboardModule() {
return false;
}
/**
* This is the template code returned for admin's control panel blocks
*
* @since 3.6.0
* @access public
*/
public function getDashboardSmartyTpl() {
$smarty = $this->getSmartyVar();
$smarty -> assign("T_MODULE_BASEDIR" , $this -> moduleBaseDir);
$smarty -> assign("T_MODULE_BASEURL" , $this -> moduleBaseUrl);
return false;
}
/**
* This is the function for the php code of the module page that may
* appear inside the catalog
*
* @since 3.6.0
* @access public
*/
public function getCatalogModule() {
return false;
}
/**
* This is the template code returned for the catalog
*
* @since 3.6.0
* @access public
*/
public function getCatalogSmartyTpl() {
$smarty = $this->getSmartyVar();
$smarty -> assign("T_MODULE_BASEDIR" , $this -> moduleBaseDir);
$smarty -> assign("T_MODULE_BASEURL" , $this -> moduleBaseUrl);
return false;
}
/**
* This is the function for the php code of the module page that may
* appear in the side of the catalog
*
* @since 3.6.0
* @access public
*/
public function getSideCatalogModule() {
return false;
}
/**
* This is the template code returned for the side catalog
*
* @since 3.6.0
* @access public
*/
public function getSideCatalogSmartyTpl() {
$smarty = $this->getSmartyVar();
$smarty -> assign("T_MODULE_BASEDIR" , $this -> moduleBaseDir);
$smarty -> assign("T_MODULE_BASEURL" , $this -> moduleBaseUrl);
return false;
}
/**
* This is the code executed when a module is set as "landing page" and the
* user logs in
*
* @since 3.6.4
* @access public
*/
public function getLandingPageModule() {
return false;
}
/**
* This is the template code returned for admin's control panel blocks
*
* @since 3.6.4
* @access public
*/
public function getLandingPageSmartyTpl() {
$smarty = $this->getSmartyVar();
$smarty -> assign("T_MODULE_BASEDIR" , $this -> moduleBaseDir);
$smarty -> assign("T_MODULE_BASEURL" , $this -> moduleBaseUrl);
return false;
}
/**
* This should return an array with tab information. For example:
* <code>
* public function getTabSmartyTpl($tabberIdentifier) {
* $smarty = $this -> getSmartyVar();
* if ($tabberIdentifier == 'branches') {
* $smarty -> assign("T_USERS", eF_getTableData("users", "login"));
* }
* return array('tab' => 'rss_branch', 'title' => 'RSS Branch', 'file' => $this -> moduleBaseDir."module_rss_branch_tab.tpl");
* }
*</code>
*
* @param $tabberIdentifier A string with the unique identifier of the tab set
* @since 3.6.8
*/
public function getTabSmartyTpl($tabberIdentifier) {
return false;
}
/**
* Get a javascript file to load for this module
*
* @since 3.5.0
* @access public
*/
public function getModuleJS() {
return false;
}
/**
* Get a css file to load for this module
*
* @since 3.5.0
* @access public
*/
public function getModuleCSS() {
return false;
}
/**
* Get Navigational links for the top of the independent module page(s)
* Get information in an array of sub-arrays with fields:
* 'title': the title to appear on the link
* 'image': the image to appear (if image inside module folder then use ($this -> moduleBaseDir) . 'imageFileName' -TODO
* 'link': the url of the page to be from this link
* Each sub-array represents a different link. Between them the "»" character is automatically inserted by the system
* Example implementation:
*
* public function getNavigationLinks() {
* if (isset($_GET['subpage1'])) {
* return array (array ('title' => "Main Page" , 'link' => $this -> moduleBaseUrl),
* array ('title' => "Sub Page 1", 'link' => $this -> moduleBaseUrl . "&operation=subpage1"));
* else {
* return false; // Only the default page with the module Name as title will be returned
* }
* }
*
* @return array The array of navigational links
* @since 3.5.0
* @access public
*/
public function getNavigationLinks() {
return false;
}
/**
* Get links to be highlighted
* Each time a module independent page is displayed a different link of the left sidebar can be highlighted
* To do this return the id of the corresponding link as defined by your getSidebarLinkInfo() returned array
* Example implementation:
*
* public function getLinkToHighlight() {
* if (isset($_GET['management'])) {
* return 'other_link_id1';
* } else {
* return 'other_link_id2';
* }
* }
*
* @return array The link to highlight
* @since 3.5.0
* @access public
*/
public function getLinkToHighlight() {
return false;
}
/**
* Control Panel Module Link
* Get information in an array with fields:
* 'title': the title to appear on the link
* 'image': the image to appear (if image inside module folder then use ($this -> moduleBaseDir) . 'imageFileName'
* 'target': POPUP or innerTable (default Innertable) - TODO
*
*
* Example implementation:
*
* public function getCenterLinkInfo() {
* return array ('title' => 'My Module',
* 'image' => $this -> moduleBaseDir . 'images/my_module.jpg');
* }
*
* @return array The array of the control panel info
* @since 3.5.0
* @access public
*/
public function getCenterLinkInfo() {
return false;
}
/****
* Lesson Control Panel Module Link
* Get information in an array with fields:
* 'title': the title to appear on the link
* 'image': the image to appear (if image inside module folder then use ($this -> moduleBaseDir) . 'imageFileName'
* 'target': POPUP or innerTable (default Innertable) - TODO
*
* Example implementation:
*
* public function getCenterLinkInfo() {
* return array ('title' => 'My Module',
* 'image' => $this -> moduleBaseDir . 'images/my_module.jpg');
* }
*
* @return array The array of the lesson control panel info
* @since 3.5.0
* @access public
*/
public function getLessonCenterLinkInfo() {
return false;
}
/****
* Tools Module Link (in my courses list)
* Get information in an array with fields:
* 'title': the title to appear on the link
* 'image': the image to appear (if image inside module folder then use ($this -> moduleBaseDir) . 'imageFileName'
*
* Example implementation:
*
* public function getToolsLinkInfo() {
* return array ('title' => 'My Module',
* 'image' => $this -> moduleBaseDir . 'images/my_module.jpg');
* }
*
* @return array The array of the tools info
* @since 3.6.10
* @access public
*/
public function getToolsLinkInfo() {
return false;
}
/****
* Reports Module Link
* Get information in an array with fields:
* 'title': the title to appear on the link
* 'image': the image to appear (if image inside module folder then use ($this -> moduleBaseDir) . 'imageFileName'
*
* Example implementation:
*
* public function getReportsLinkInfo() {
* return array ('title' => 'My Module',
* 'image' => $this -> moduleBaseDir . 'images/my_module.jpg');
* }
*
* @return array The array of the tools info
* @since 3.6.10
* @access public
*/
public function getReportsLinkInfo() {
return false;
}
/**
* Get an icon url for the module
* @return string the url of the module icon
* @since 3.6.10
* @access public
*/
public function getModuleIcon() {
return false;
}
/****
* Left Sidebar Module Links
* Get information in an array of arrays with fields:
* 'menu': defines the menu(s) where links will appear "system" | "lessons" | "users" | "organization" | "tools" | "current_lesson" | "other"
* if "other" is selected then an additional "menuTitle" field can be defined for the Title of the menu
* -- multiple other menus may be defined - TODO
* 'id': a unique id of the link within the module (and NOT within the entire eFront) framework. This id is used for link highlighting purposes
* with highlightLink()
* 'title': the title to appear on the link
* 'image': the image to appear next to the link (if image inside module folder then use ($this -> moduleBaseDir) . 'imageFileName'
* 'eFrontExtensions': you may optionally define two images for each link: one .png and .gif, which will appear under FF and IE respectively.
* The filename (without the extension) and the path of the two pictures must be the same.
* If 'eFrontExtensions' => 1, then do not use an extension to the image filename
* 'link': the url of the page to be displayed in the main window
* 'target': POPUP or mainTable (default Innertable) - TODO
*
* Example implementation:
*
* public function getSidebarLinkInfo() {
* $link_of_menu_system = array (array ('id' => 'system_link_id',
* 'title' => 'My System Related Module Part 1',
* 'image' => '16x16/pens', // no extension in the filename,
* 'eFrontExtensions' => '1', // question_type_free_text.png and pens.gif must exist in 16x16
* 'link' => $this -> moduleBaseUrl . "&module_op=system_operation"),
* array ('id' => 'system_link_id2',
* 'title' => 'My System Related Module Part 2',
* 'image' => '16x16/pencil2.png',
* 'link' => $this -> moduleBaseUrl . "&module_op=system_operation"));
*
* $link_of_module_menus = array ( array ('id' => 'other_link_id1',
* 'title' => 'Main Module',
* 'image' => $this -> moduleBaseDir . 'images/my_module_pic', // no extension in the filename
* 'eFrontExtensions' => '1', // my_module_pic.gif and my_module_pic.png must exist in $this->moduleBaseDir . 'images/'
* 'link' => $this -> moduleBaseUrl),
* array ('id' => 'other_link_id2',
* 'title' => 'Second Module Page',
* 'image' => '16x16/attachment.png',
* 'link' => $this -> moduleBaseUrl . '&module_operat=2'));
*
* return array ( "system" => $link_of_menu_system,
* "other" => array('menuTitle' => 'My Module Menu', 'links' => $link_of_module_menus));
* }
*
* @return array The array of the sidebar menu items
* @since 3.5.0
* @access public
*/
public function getSidebarLinkInfo() {
return false;
}