Newer
Older
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
<?php
$core = new core_tools();
$core->test_user();
$core->load_lang();
require_once('modules/entities/class/class_manage_listdiff.php');
$diff_list = new diffusion_list();
$diff_list->connect();
$roles = $diff_list->list_difflist_roles();
$listinstance = array();
# Load header
$query =
"SELECT distinct coll_id, res_id, difflist_type"
. " FROM listinstance_history_details WHERE listinstance_history_id = ".$_REQUEST['listinstance_history_id']." GROUP BY coll_id, res_id, difflist_type";
$diff_list->query($query);
$listinstance = $diff_list->fetch_assoc();
if($listinstance['difflist_type'] == "")
$listinstance['difflist_type'] = 'entity_id';
# OTHER ROLES USERS
#**********************************************************************
$diff_list->query(
"select l.item_id, u.firstname, u.lastname, e.entity_id, "
. "e.entity_label, l.visible, l.viewed, l.item_mode, l.difflist_type from listinstance_history_details l, " . USERS_TABLE
. " u, " . ENT_ENTITIES . " e, " . ENT_USERS_ENTITIES
. " ue where l.listinstance_history_id = ".$_REQUEST['listinstance_history_id']
. " and l.item_type = 'user_id' and l.item_id = u.user_id "
. " and l.item_id = ue.user_id and ue.user_id=u.user_id "
. " and e.entity_id = ue.entity_id"
. " and ue.primary_entity = 'Y' order by l.sequence "
);
//$diff_list->show();
while ($res = $diff_list->fetch_object()) {
if($res->item_mode == 'cc')
$role_id = 'copy';
else
$role_id = $res->item_mode;
if(!isset($listinstance[$role_id]['users']))
$listinstance[$role_id]['users'] = array();
array_push(
$listinstance[$role_id]['users'],
array(
'user_id' => $diff_list->show_string($res->item_id),
'lastname' => $diff_list->show_string($res->lastname),
'firstname' => $diff_list->show_string($res->firstname),
'entity_id' => $diff_list->show_string($res->entity_id),
'entity_label' => $diff_list->show_string($res->entity_label),
'visible' => $diff_list->show_string($res->visible),
'viewed' => $diff_list->show_string($res->viewed),
'difflist_type' => $diff_list->show_string($res->difflist_type)
)
);
}
# OTHER ROLES ENTITIES
#**********************************************************************
$diff_list->query(
"select l.item_id, e.entity_label, l.visible, l.viewed, l.item_mode, l.difflist_type from listinstance_history_details l, "
. ENT_ENTITIES . " e where l.listinstance_history_id = ".$_REQUEST['listinstance_history_id']
. " and l.item_type = 'entity_id' and l.item_id = e.entity_id "
. "order by l.sequence "
);
while ($res = $diff_list->fetch_object()) {
if($res->item_mode == 'cc')
$role_id = 'copy';
else
$role_id = $res->item_mode;
if(!isset($listinstance[$role_id]['entities']))
$listinstance[$role_id]['entities'] = array();
array_push(
$listinstance[$role_id]['entities'],
array(
'entity_id' => $diff_list->show_string($res->item_id),
'entity_label' => $diff_list->show_string($res->entity_label),
'visible' => $diff_list->show_string($res->visible),
'viewed' => $diff_list->show_string($res->viewed),
'difflist_type' => $diff_list->show_string($res->difflist_type)
)
);
}
$difflist = $listinstance;
// $diff_list->get_difflist_type($listinstance['difflist_type']);
$return = '';
foreach($roles as $role_id => $role_label) {
if($role_id == 'dest' && $onlyCC) continue;
if(count($difflist[$role_id]['users']) > 0
|| count($difflist[$role_id]['entities']) > 0
) {
$return .= '<h3 class="sstit">'.$role_label.'</h3>';
if(count($difflist[$role_id]['users']) > 0) {
$return .= '<table cellpadding="0" cellspacing="0" border="0" class="listingsmall liste_diff spec" style="width:100%;margin:0;">';
$color = ' class="col"';
for($i=0, $l=count($difflist[$role_id]['users']);
$i<$l;
$i++
) {
$user = $difflist[$role_id]['users'][$i];
if ($color == ' class="col"') $color = ' ';
else $color = ' class="col"';
$return .= '<tr '. $color.' >';
$return .= '<td style="width:15%;text-align:center;">';
$return .= '<i class="fa fa-user fa-2x" title="'._USER.' '.$role_label.'"></i>';
$return .= '</td>';
$return .= '<td style="width:10%;">';
if($user['visible'] == 'Y') {
$return .= '<i class="fa fa-check fa-2x" title="'._VISIBLE.'"></i>';
$return .= '<i class="fa fa-times fa-2x" title="'._NOT_VISIBLE.'"></i>';
}
$return .= '</td>';
$return .= '<td style="width:37%;">'. $user['lastname'] . ' ' . $user['firstname'].'</td>';
$return .= '<td style="width:38%;">'. $user['entity_label'].'</td>';
$return .= '</tr>';
}
$return .= '</table>';
}
if(count($difflist[$role_id]['entities']) > 0) {
$return .= '<table cellpadding="0" cellspacing="0" border="0" class="listingsmall liste_diff spec" style="width:100%;margin:0;">';
$color = ' class="col"';
for ($i=0, $l=count($difflist[$role_id]['entities']);
$i<$l;
$i++
) {
$entity = $difflist[$role_id]['entities'][$i];
if ($color == ' class="col"') $color = '';
else $color = ' class="col"';
$return .= '<tr'. $color.'>';
$return .= '<td style="width:15%;text-align:center;">';
$return .= '<i class="fa fa-sitemap fa-2x" title="'._ENTITY . ' ' . $role_label.'" ></i>';
$return .= '</td>';
$return .= '<td style="width:10%;">';
if($entity['visible'] == 'Y') {
$return .= '<i class="fa fa-check fa-2x" title="'._VISIBLE.'"></i>';
$return .= '<i class="fa fa-times fa-2x" title="'._NOT_VISIBLE.'"></i>';
}
$return .= '</td>';
$return .= '<td style="width:37%;">'. $entity['entity_id'].'</td>';
$return .= '<td style="width:38%;">'. $entity['entity_label'].'</td>';
$return .= '</tr>';
}
$return .= '</table>';
}
$return .= '<br/>';
}
}
echo "{status : 0, toShow : '" . addslashes($return) . "'}";
exit ();