1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* GCconnex onboarding |
4
|
|
|
* |
5
|
|
|
* Welcome Module |
6
|
|
|
* Profile Module |
7
|
|
|
* Groups Module |
8
|
|
|
* |
9
|
|
|
* Provides more info on the wire via popup |
10
|
|
|
* |
11
|
|
|
* @version 1.0 |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
|
15
|
|
|
elgg_register_event_handler('init', 'system', 'onboard_ME'); |
16
|
|
|
|
17
|
|
|
function onboard_ME() { |
18
|
|
|
|
19
|
|
|
elgg_register_page_handler('profileonboard', 'profileonboard_page_handler'); |
20
|
|
|
elgg_register_page_handler('groupsonboard', 'groupsonboard_page_handler'); |
21
|
|
|
|
22
|
|
|
//actions |
23
|
|
|
elgg_register_action("onboard/join", elgg_get_plugins_path() . "gc_onboard/actions/groups/membership/join.php"); |
24
|
|
|
elgg_register_action("onboard/search", elgg_get_plugins_path() . "gc_onboard/actions/groups/onboard-search.php"); |
25
|
|
|
elgg_register_action("onboard/upload", elgg_get_plugins_path() . "/gc_onboard/actions/onboard/upload.php"); |
26
|
|
|
elgg_register_action("onboard/update-profile", elgg_get_plugins_path() . "/gc_onboard/actions/update-profile.php"); |
27
|
|
|
elgg_register_action("onboard/set_cta", elgg_get_plugins_path() . "/gc_onboard/actions/set_cta.php"); |
28
|
|
|
elgg_register_action("onboard/set_wire_metadata", elgg_get_plugins_path() . "/gc_onboard/actions/set_wire_metadata.php"); |
29
|
|
|
|
30
|
|
|
//profile strength views |
31
|
|
|
elgg_register_ajax_view('profileStrength/info'); |
32
|
|
|
elgg_register_ajax_view('profileStrength/infoCard'); |
33
|
|
|
|
34
|
|
|
//views for complete profile onboarding |
35
|
|
|
elgg_register_ajax_view('profile-steps/stepOne'); |
36
|
|
|
elgg_register_ajax_view('profile-steps/stepTwo'); |
37
|
|
|
elgg_register_ajax_view('profile-steps/stepThree'); |
38
|
|
|
elgg_register_ajax_view('profile-steps/stepFour'); |
39
|
|
|
elgg_register_ajax_view('profile-steps/stepFive'); |
40
|
|
|
|
41
|
|
|
//views for groups onboarding |
42
|
|
|
elgg_register_ajax_view('groups-steps/group-tracker'); |
43
|
|
|
|
44
|
|
|
//views for intro profile onboarding |
45
|
|
|
elgg_register_ajax_view('welcome-steps/stepOne'); |
46
|
|
|
elgg_register_ajax_view('welcome-steps/stepTwo'); |
47
|
|
|
elgg_register_ajax_view('welcome-steps/stepThree'); |
48
|
|
|
elgg_register_ajax_view('welcome-steps/stepFour'); |
49
|
|
|
elgg_register_ajax_view('welcome-steps/stepFive'); |
50
|
|
|
|
51
|
|
|
//geds view |
52
|
|
|
elgg_register_ajax_view('welcome-steps/geds/org-people'); |
53
|
|
|
|
54
|
|
|
//step counter |
55
|
|
|
elgg_register_ajax_view('page/elements/step_counter'); |
56
|
|
|
|
57
|
|
|
elgg_extend_view('css/elgg', 'onboard/css'); |
58
|
|
|
elgg_extend_view('css/elgg', 'onboard/bootstrap-tour.min'); |
59
|
|
|
|
60
|
|
|
//Extend layout for call to action (cta) |
61
|
|
|
elgg_extend_view('page/layouts/one_sidebar', 'page/elements/onboard_start', 450); |
62
|
|
|
elgg_extend_view('thewire/sidebar', 'welcome-steps/wire_modal', 449); |
63
|
|
|
elgg_extend_view('contactform/contactform', 'onboard/module_links'); |
64
|
|
|
|
65
|
|
|
//extend newsfeed to launch onboarding |
66
|
|
|
elgg_extend_view('widgets/stream_newsfeed_index/content', 'onboard/launch', 491); |
67
|
|
|
elgg_extend_view('widgets/wet_activity/content', 'onboard/launch', 491); |
68
|
|
|
|
69
|
|
|
elgg_require_js("onboard_require"); |
70
|
|
|
|
71
|
|
|
elgg_register_js('bootstrap_tour',"mod/gc_onboard/views/default/js/bootstrap-tour.min.js"); |
72
|
|
|
elgg_register_js('group_tour', 'mod/gc_onboard/views/default/js/group_tour.js'); |
73
|
|
|
|
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
function profileonboard_page_handler(){ |
77
|
|
|
@include (dirname ( __FILE__ ) . "/pages/onboard-profile.php"); |
|
|
|
|
78
|
|
|
return true; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
function groupsonboard_page_handler(){ |
82
|
|
|
@include (dirname ( __FILE__ ) . "/pages/onboard-groups.php"); |
|
|
|
|
83
|
|
|
return true; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
|
87
|
|
|
/* |
88
|
|
|
* get_my_profile_strength |
89
|
|
|
* |
90
|
|
|
* Gets the profile strength of the logged in user as an INT value. |
91
|
|
|
* |
92
|
|
|
* @author Ethan Wallace |
93
|
|
|
* @return [INT] [<Profile strength percent>] |
|
|
|
|
94
|
|
|
*/ |
95
|
|
|
function get_my_profile_strength(){ |
96
|
|
|
|
97
|
|
|
$userEnt = elgg_get_logged_in_user_entity(); |
98
|
|
|
|
99
|
|
|
//avatar |
100
|
|
View Code Duplication |
if($userEnt->getIconURL() != elgg_get_site_url() . '_graphics/icons/user/defaultmedium.gif'){ |
101
|
|
|
$avIcon = '<span class="fa fa-check text-primary"></span>'; |
102
|
|
|
$avTotal = 100; |
103
|
|
|
}else{ |
104
|
|
|
$avIcon = '<span class="fa fa-exclamation-triangle text-danger"></span>'; |
105
|
|
|
$avTotal = 0; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
//About me |
109
|
|
View Code Duplication |
if($userEnt->description){ |
110
|
|
|
$aboutIcon = '<span class="fa fa-check text-primary"></span>'; |
111
|
|
|
$aboutTotal = 100; |
112
|
|
|
}else{ |
113
|
|
|
$aboutIcon = '<span class="fa fa-exclamation-triangle text-danger"></span>'; |
114
|
|
|
$aboutTotal = 0; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
//basic profile |
118
|
|
|
$basicCount = 0; |
119
|
|
|
|
120
|
|
|
if($userEnt->department){ |
121
|
|
|
$basicCount += 20; |
122
|
|
|
} |
123
|
|
|
if($userEnt->job){ |
124
|
|
|
$basicCount += 20; |
125
|
|
|
} |
126
|
|
|
if($userEnt->location || $userEnt->addressString || $userEnt->addressStringFr){ |
127
|
|
|
$basicCount += 20; |
128
|
|
|
} |
129
|
|
|
if($userEnt->email){ |
130
|
|
|
$basicCount += 20; |
131
|
|
|
} |
132
|
|
|
if($userEnt->phone || $userEnt->mobile){ |
133
|
|
|
$basicCount += 20; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
//education |
137
|
|
|
if(count($userEnt->education) >= 1){ |
138
|
|
|
$eduCount = 100; |
139
|
|
|
} else { |
140
|
|
|
$eduCount = 0; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
//work experience |
144
|
|
|
if(count($userEnt->work) >= 1){ |
145
|
|
|
$workCount = 100; |
146
|
|
|
} else { |
147
|
|
|
$workCount = 0; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
//skills |
151
|
|
View Code Duplication |
if(count($userEnt->gc_skills) >= 3){ |
152
|
|
|
$skillCount = 100; |
153
|
|
|
} else { |
154
|
|
|
$skillCount = round(count($userEnt->gc_skills)/3*100); |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
//overall total |
158
|
|
|
$complete = round(($skillCount + $workCount + $eduCount + $basicCount + $aboutTotal + $avTotal)/6); |
159
|
|
|
|
160
|
|
|
//set up profile strength metadata |
161
|
|
|
$userEnt->profilestrength = $complete; |
162
|
|
|
|
163
|
|
|
return $userEnt->profilestrength; |
164
|
|
|
} |
165
|
|
|
|
If you suppress an error, we recommend checking for the error condition explicitly: