-
Notifications
You must be signed in to change notification settings - Fork 8
/
co_workers.php
396 lines (358 loc) · 21.6 KB
/
co_workers.php
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
<?php
/**COPYRIGHTS**/
// Copyrights 2008 - 2010 all rights reserved, SQLFusion LLC, info@sqlfusion.com
$pageTitle = 'Ofuz :: '._('Co-Workers');
$Author = 'SQLFusion LLC';
$Keywords = 'Keywords for search engine';
$Description = 'Description for search engine';
$background_color = 'white';
include_once('config.php');
include_once('includes/ofuz_check_access.script.inc.php');
include_once('includes/header.inc.php');
$do_notes = new ContactNotes($GLOBALS['conx']);
$do_contact = new Contact($GLOBALS['conx']);
$do_company = new Company($GLOBALS['conx']);
$do_task = new Task($GLOBALS['conx']);
$do_task_category = new TaskCategory($GLOBALS['conx']);
$do_contact_task = new Contact();
$do_project = new Project();
?>
<script type="text/javascript">
//<![CDATA[
function fnHighlightCoworkers(area) {
var cwid=$("#cwid"+area);
var div=$("#cw"+area);
var ctlbar=$("#coworker_ctlbar");
cwid.attr("checked",(cwid.is(":checked")?"":"checked"));
if (cwid.is(":checked")) {
div.css("background-color", "#ffffdd");
if(ctlbar.is(":hidden"))ctlbar.slideDown("fast");
} else {
div.css("background-color", "#ffffff");
if($("input:checked").length==0)ctlbar.slideUp("fast");
}
}
function setContactForCoworker(){
$("#do_contact_sharing__eventShareContactsMultiple").submit();
}
$(document).ready(function() {
$("div[id^=invite]").hover(function(){$("div[id^=trashcan]",this).show("slow");},function(){$("div[id^=trashcan]",this).hide("slow");});
});
function showSharedDetail(divid){
$("#"+divid).slideToggle("slow");
}
function hideSharedDetail(divid){
$("#"+divid).fadeOut("slow");
}
//]]>
</script>
<table class="layout_columns"><tr><td class="layout_lmargin"></td><td>
<div class="layout_content">
<?php $GLOBALS['thistab'] = _('Co-Workers'); include_once('includes/ofuz_navtabs.php'); ?>
<?php $do_breadcrumb = new Breadcrumb(); $do_breadcrumb->getBreadcrumbs(); ?>
<div class="grayline1"></div>
<div class="spacerblock_20"></div>
<table class="layout_columns"><tr><td class="layout_lcolumn">
<?php
include_once('plugin_block.php');
?>
</td><td class="layout_rcolumn">
<?php
if($_SESSION['in_page_message'] != ''){
$msg = new Message();
if($_SESSION['in_page_message'] == "cw_already-have-pending-invitation-to") {
$msg->setData(Array("enc_email" => $_SESSION['in_page_message_data']['enc_email']));
$msg->getMessage($_SESSION['in_page_message']);
$msg->displayMessage();
} else{
$msg->getMessage($_SESSION['in_page_message']);
$msg->displayMessage();
}
$_SESSION['in_page_message']= '';
}
?>
<table class="mainheader pad20" width="100%">
<tr>
<td><span class="headline14">Co-Workers</span>
<td align="right">
<!--<a href="teams.php"><?php echo _('Teams'); ?></a> -->
<a href="co_workers.php"><?php echo _('All Co-Workers'); ?></a></td>
</tr>
</table>
<!--<div class="mainheader">
<div class="pad20">
<span class="headline14">Co-Workers</span>-->
<div class="contentfull">
<div class="spacerblock_20"></div>
<?php
$_SESSION['do_coworker']->getAllRequest(); //Get all the requests
if($_SESSION['do_coworker']->getNumrows()){
echo '<br /><b>'._('The following User(s) are waiting for approval from you to become Co-Workers.').'</b><br />';
while($_SESSION['do_coworker']->next()){
$user_name = $_SESSION['do_User']->getFullName($_SESSION['do_coworker']->iduser);
$e_accept = new Event("do_coworker->eventAcceptInvitation");
$e_accept->addParam("id",$_SESSION['do_coworker']->iduser_relations);
$e_accept->addParam("goto",$_SERVER['PHP_SELF']);
$e_accept->addParam("coworker",$_SESSION['do_coworker']->idcoworker);
$e_accept->addParam("user",$_SESSION['do_coworker']->iduser);
$e_reject = new Event("do_coworker->eventRejectInvitation");
$e_reject->addParam("id",$_SESSION['do_coworker']->iduser_relations);
$e_reject->addParam("goto",$_SERVER['PHP_SELF']);
echo '<div style="width:200px;float:left;">'.$user_name.'</div><div style="position:relative;">'.$e_accept->getLink("Accept").' '.$e_reject->getLink("Reject").'</div>';
}
}else{
//echo '<br /><b>You have no Invitations to be a Co-Worker.</b><br />';
}
//echo '<div class="solidline"></div>';
?>
<!-- </div>
</div>
<div class="contentfull">-->
<?php
$set_share = false;
if(isset($_POST['ck'])){
$contact_ids = $_POST['ck'];
$set_share = true; // Request comes from Contact page
}
$_SESSION['do_coworker']->getAllCoWorker(); //Get all the Co-Workers
if (!is_object($_SESSION['do_contact_sharing'])) {
$do_contact_sharing = new ContactSharing();
$do_contact_sharing->sessionPersistent("do_contact_sharing", "index.php", 36000);
}
if($_SESSION['do_coworker']->getNumrows()){
if (!is_object($_SESSION['do_Contacts'])) {
$do_Contacts = new Contact();
$do_Contacts->setRegistry("all_contacts");
$do_Contacts->sessionPersistent("do_Contacts", "index.php", 36000);
}
if(!$set_share){ // If not having POST vales
//$user_coworker = new User();
while($_SESSION['do_coworker']->next()){
//$user_coworker->getId($_SESSION['do_coworker']->idcoworker);
// Get the contacts shared for this Co-Worker
$shared_contacts = $_SESSION['do_contact_sharing']->getSharedContacts($_SESSION['do_coworker']->idcoworker);
if($shared_contacts && is_array($shared_contacts)){
$ids_shared_as_user = implode(",",$shared_contacts);
}else{$ids_shared_as_user = '';}
// Create filter event link
$e_shared_contacts_filter = new Event("do_Contacts->eventFilterContactAsCoWorker");
$e_shared_contacts_filter->addParam("ids",$ids_shared_as_user);
$e_shared_contacts_filter->addParam("goto","contacts.php");
$e_shared_contacts_filter->addParam("setShare","No");
$e_shared_contacts_filter->addParam("coworker",$_SESSION['do_coworker']->idcoworker);
// Get Contacts shared by this contact
$shared_contacts_from_coworker = $_SESSION['do_contact_sharing']->getSharedContactsByCoWorker($_SESSION['do_coworker']->idcoworker);
if($shared_contacts_from_coworker && is_array($shared_contacts_from_coworker)){
$ids_shared_from_coworker = implode(",",$shared_contacts_from_coworker);
}else{$ids_shared_from_coworker = '';}
$e_shared_contacts_from_coworker_filter = new Event("do_Contacts->eventFilterContactAsCoWorker");
$e_shared_contacts_from_coworker_filter->addParam("ids",$ids_shared_from_coworker);
$e_shared_contacts_from_coworker_filter->addParam("goto","contacts.php");
$e_shared_contacts_from_coworker_filter->addParam("setShare","Yes");
$e_shared_contacts_from_coworker_filter->addParam("coworker",$_SESSION['do_coworker']->idcoworker);
$no_cont_shared = $_SESSION['do_contact_sharing']->countSharedContacts($_SESSION['do_coworker']->idcoworker);
$no_cont_shared_by_co_worker =$_SESSION['do_contact_sharing']->countSharedContactsByCoWorker($_SESSION['do_coworker']->idcoworker);
$do_user = new User();
$do_contact = new Contact();
$do_contact->getUserContacts($_SESSION['do_coworker']->idcoworker);
if($do_contact->getNumRows()){
//while($do_contact->next()){
$co_workers[] = $do_->idcoworker;
$user_picture = $do_contact->picture;
$contact_id = $do_contact->idcontact;
// }
}
$user_name = $do_user->getUserNameByIdUser($_SESSION['do_coworker']->idcoworker);
//Get Bio Information
$do_userprofile = new UserProfile();
$profile_information = $do_userprofile->getProfileInformation($_SESSION['do_coworker']->idcoworker);
$job_description = $profile_information['job_description'];
$do_userprofile->free();
if($do_contact->picture!=''){
$thumb_name = $_SERVER['DOCUMENT_ROOT'].'/dbimage/thumbnail/'.$do_contact->picture;
if(file_exists($thumb_name)) {
$user_pic="/dbimage/thumbnail/".$do_contact->picture;
} else {
$user_pic="/images/empty_avatar.gif";
}
}else{
$user_pic='/images/empty_avatar.gif';
}
echo '<div style="position:relative;width:100%;">';
echo '<div class="feed_user_pic" style="positon:relative;float:left;overflow:hidden;">';
echo '<a href="/profile/'.$user_name.'" target="_blank"> <img height="50px" width="50px" alt="" src='.$user_pic.' > </a>';
echo '</div>';
echo '<div style="positon:relative;float:left;width:80%;margin:0px;"><a style="color:#C52EAD;" href="javascript:void(0)" onclick="showSharedDetail(\''.$_SESSION['do_coworker']->idcoworker.'\');" >'
.$_SESSION['do_coworker']->firstname.' '.$_SESSION['do_coworker']->lastname.
'</a><br />'.$job_description.'</div> ';
$num_project_shared = $do_project->getNumProjectsShared($_SESSION["do_User"]->iduser,$_SESSION['do_coworker']->idcoworker);
$no_proj_shared_by_co_worker = $do_project->getNumProjectsShared($_SESSION['do_coworker']->idcoworker,$_SESSION["do_User"]->iduser);
echo '<div style="clear:both;padding:10px;"></div>';
echo '<div class="feed_user_pic" style="overflow:hidden;"> </div><div id="'.$_SESSION['do_coworker']->idcoworker.'" style="display:none;width:80%;margin:0px;">';
if ($no_cont_shared > 0) {
echo $e_shared_contacts_filter->getLink(
'<span>
'.sprintf(_('You shared %d contacts'), $no_cont_shared).'
</span>
'.sprintf(_('and %d projects'),$num_project_shared).' ');
}else{
echo '<span>'.sprintf(_('You shared %d contacts'), $no_cont_shared).'</span> '.sprintf(_('and %d projects'),$num_project_shared).' ';
}
$do_user = new User();
$do_contact = new Contact();
$do_user->query("select idcontact from user where iduser = ".$_SESSION['do_coworker']->idcoworker);
$do_user->getValues();
if($do_user->getNumRows() > 0 ){
$contact_id = $do_user->idcontact;
if($contact_id != '' || $contact_id != 0 ){
$do_contact->getId($contact_id);
$user_picture = $do_contact->picture;
}
}
/*$do_contact->getUserContacts($_SESSION['do_coworker']->idcoworker);
if($do_contact->getNumRows()){
//while($do_contact->next()){
$co_workers[] = $do_contact->idcoworker;
$user_picture = $do_contact->picture;
$contact_id = $do_contact->idcontact;
// }
}*/
$user_name = $do_user->getUserNameByIdUser($_SESSION['do_coworker']->idcoworker);
//Get Bio Information
$do_userprofile = new UserProfile();
$profile_information = $do_userprofile->getProfileInformation($_SESSION['do_coworker']->idcoworker);
$job_description = $profile_information['job_description'];
$do_userprofile->free();
if($user_picture!=''){
$thumb_name = $_SERVER['DOCUMENT_ROOT'].'/dbimage/thumbnail/'.$user_picture;
if(file_exists($thumb_name)) {
$user_pic="/dbimage/thumbnail/".$user_picture;
} else {
$user_pic="/images/empty_avatar.gif";
}
}else{
$user_pic='/images/empty_avatar.gif';
}
echo '<div style="position:relative;width:100%;">';
echo '<div class="feed_user_pic" style="positon:relative;float:left;overflow:hidden;">';
echo '<a href="/profile/'.$user_name.'" target="_blank"> <img height="50px" alt="" src='.$user_pic.' > </a>';
echo '</div>';
echo '<div style="positon:relative;float:left;width:80%;margin:0px;"><a style="color:#C52EAD;" href="javascript:void(0)" onclick="showSharedDetail(\''.$_SESSION['do_coworker']->idcoworker.'\');" >'
.$_SESSION['do_coworker']->firstname.' '.$_SESSION['do_coworker']->lastname.
'</a><br />'.$job_description.'</div> ';
$num_project_shared = $do_project->getNumProjectsShared($_SESSION["do_User"]->iduser,$_SESSION['do_coworker']->idcoworker);
$no_proj_shared_by_co_worker = $do_project->getNumProjectsShared($_SESSION['do_coworker']->idcoworker,$_SESSION["do_User"]->iduser);
echo '<div style="clear:both;padding:10px;"></div>';
echo '<div class="feed_user_pic" style="overflow:hidden;"> </div><div id="'.$_SESSION['do_coworker']->idcoworker.'" style="display:none;width:80%;margin:0px;">';
if ($no_cont_shared > 0) {
echo $e_shared_contacts_filter->getLink('<span>'.sprintf(_('You shared %d contacts'), $no_cont_shared).'</span> '.sprintf(_('and %d projects'),$num_project_shared).' ');
}else{
echo '<span>'.sprintf(_('You shared %d contacts'), $no_cont_shared).'</span> '.sprintf(_('and %d projects'),$num_project_shared).' ';
}
$num_project_shared = $do_project->getNumProjectsShared($_SESSION["do_User"]->iduser,$_SESSION['do_coworker']->idcoworker);
$no_proj_shared_by_co_worker = $do_project->getNumProjectsShared($_SESSION['do_coworker']->idcoworker,$_SESSION["do_User"]->iduser);
echo '<div style="clear:both;padding:10px;"></div>';
echo '<div id="'.$_SESSION['do_coworker']->idcoworker.'" style="display:none;">';
if ($no_cont_shared > 0) {
echo $e_shared_contacts_filter->getLink('<span>'.sprintf(_('You shared %d contacts'), $no_cont_shared).'</span> '.sprintf(_('and %d projects'),$num_project_shared).' ');
}else{
echo '<span>'.sprintf(_('You shared %d contacts'), $no_cont_shared).'</span> '.sprintf(_('and %d projects'),$num_project_shared).' ';
}
if ($no_cont_shared_by_co_worker > 0) {
echo $e_shared_contacts_from_coworker_filter->getLink('<span>'.sprintf(_("%s shared %d contacts"), $_SESSION['do_coworker']->firstname, $no_cont_shared_by_co_worker).'</span> '.sprintf(_('and %d projects'),$no_proj_shared_by_co_worker));
}else{
echo '<span>'.sprintf(_("%s shared %d contacts"), $_SESSION['do_coworker']->firstname, $no_cont_shared_by_co_worker).'</span> '.sprintf(_('and %d projects'),$no_proj_shared_by_co_worker);
}
//if ($no_cont_shared > 0 || $no_cont_shared_by_co_worker > 0) {
//echo '<br />';
//}
echo '</div>';
echo '</div>';
echo '<div style="clear:both;padding:10px;"></div>';
echo '<br />';
}// class="co_worker_pending"
}else{ // Having some POST data from contacts.php
$e_share_cont = new Event("do_contact_sharing->eventShareContactsMultiple");
$e_share_cont->addEventAction("mydb.gotoPage", 304);
$e_share_cont->addParam("goto", "co_workers.php");
$e_share_cont->addParam("idcontacts",$contact_ids);
echo $e_share_cont->getFormHeader();
echo $e_share_cont->getFormEvent();
echo '<b>'._('Select Co-Worker you want to give access to the contact(s) and click Share to save :').'</b><br />';
echo '<div id="coworker_ctlbar" style="display: none;">';
echo '<span class="redlink"><a href="#" onclick="setContactForCoworker(); return false;" style="font-size:20px;">'._('Share').'</a></span>';
echo '</div>';
//$user_coworker = new User();
while($_SESSION['do_coworker']->next()){
//$user_coworker->getId($_SESSION['do_coworker']->idcoworker);
echo '<div class="ofuz_list_contact" id="cw'.$_SESSION['do_coworker']->idcoworker.'" onclick="fnHighlightCoworkers(\''.$_SESSION['do_coworker']->idcoworker.'\')">';
echo '<input type="checkbox" class="ofuz_list_checkbox" name="cwid[]" id="cwid'.$_SESSION['do_coworker']->idcoworker.'" value="'.$_SESSION['do_coworker']->idcoworker.'" onclick="fnHighlightCoworkers(\''.$_SESSION['do_coworker']->idcoworker.'\')" /> ';
$no_cont_shared = $_SESSION['do_contact_sharing']->countSharedContacts($_SESSION['do_coworker']->idcoworker);
$no_cont_shared_by_co_worker =$_SESSION['do_contact_sharing']->countSharedContactsByCoWorker($_SESSION['do_coworker']->idcoworker);
/*
$do_contact = new Contact();
$do_contact->getUserContacts($_SESSION['do_coworker']->idcoworker);
if($do_contact->getNumRows()){
while($do_contact->next()){
$co_workers[] = $do_->idcoworker;
$user_picture = $do_contact->picture;
$contact_id = $do_contact->idcontact;
}
}
if($user_picture ==''){
$user_pic="/images/empty_avatar.gif";
}else{
$user_pic="/dbimage/".$user_picture;
}
*/
$do_contact = new Contact();
$do_contact->getContactPictureDetails($_SESSION['do_coworker']->idcoworker);
if($do_contact->getNumRows()){
if($do_contact->picture!=''){
$thumb_name = $_SERVER['DOCUMENT_ROOT'].'/dbimage/thumbnail/'.$do_contact->picture;
if(file_exists($thumb_name)) {
$contact_picture="/dbimage/thumbnail/".$do_contact->picture;
} else {
$contact_picture="/images/empty_avatar.gif";
}
}else{
$contact_picture='/images/empty_avatar.gif';
}
$contact_id = $do_contact->idcontact;
}
$do_user = new User();
$username = $do_user->getUserLoginId($_SESSION['do_coworker']->idcoworker);
$do_user->free();
echo '<div class="feed_user_pic" style="overflow:hidden;">';
$user_first_name=$_SESSION['do_coworker']->firstname;
//echo '<a href="/profile/'.$user_first_name[0].'"> <img height="100%" alt="" src='.$contact_picture.' > </a>';
echo '<a href="'.$GLOBALS['cfg_ofuz_site_http_base'].'profile/'.$username.'" target="_blank"><img height="100%" alt="" src='.$contact_picture.'</a>';
echo '</div>';
echo $_SESSION['do_coworker']->firstname,' ',$_SESSION['do_coworker']->lastname,' ';
/** echo '<span>
'._('You have shared').' '.$no_cont_shared.' '._('contacts').'
</span>
';
echo '<span>'
.$no_cont_shared_by_co_worker.' '. _('contacts are shared by').' '.$_SESSION['do_User']->getFullName($_SESSION['do_coworker']->idcoworker).
'</span>';
**/
echo '</div>';
echo '<div class="solidline"></div>';
}
echo '</form>';
}
}else{
echo '<b>'. _('You have no Co-Workers').'</b>';
}
?>
</div>
</td></tr></table>
<div class="spacerblock_40"></div>
<div class="layout_footer"></div>
</div>
</td><td class="layout_rmargin"></td></tr></table>
<?php include_once('includes/ofuz_facebook.php'); ?>
<?php include_once('includes/ofuz_analytics.inc.php'); ?>
</body>
</html>