8 require_once(
"$admLibrary/userSearch.i");
9 require_once(
"$admLibrary/aMemberSupport.i");
10 $parameters = array(
"a" => array(
"operation" =>
"",
"payload" =>
"",
"ft" =>
"",
"userId" =>
""));
11 $string = array(
"filter" => HCUFILTER_INPUT_STRING);
12 HCU_ImportVars($parameters,
"a", array(
"operation" => $string,
"payload" => $string,
"ft" => $string,
"userId" => $string));
13 extract($parameters[
"a"]);
15 $operation = is_null($operation) ?
"" : trim($operation);
16 $showSQL = $SYSENV[
"devmode"];
19 $userId = HCU_PayloadDecode($Cu, $payload);
20 }
catch(exception $e) { ?>
21 <div
class=
'noUserFound'><div>No
User Found</div></div>
24 printPage(
"$menu_link?ft=$ft", $userId[
"user_id"], getShowRelated($SYSENV, $dbh, $Cu, $userId[
"user_id"], $showSQL));
37 function getShowRelated($pEnv, $dbh, $Cu, $userId, $showSQL) {
41 $sql =
"select a.user_id, a.user_name, a.email, a.name, g.group_name, p.profile_code, g.group_id, p.profile_id, p.description as profile_desc, 42 a.is_group_primary, a.lastlogin, a.employee from ${Cu}user u 43 left join ${Cu}group g on u.group_id = g.group_id 44 inner join ${Cu}user a on g.group_id = a.group_id 45 left join cu_profile p on g.profile_id = p.profile_id 46 where u.user_id = $userId and a.user_id is not null and u.user_id <> a.user_id order by a.user_name";
49 $sth = db_query($sql, $dbh);
51 throw new exception(
"Show Related query failed.", 1);
54 $relatedData = array();
55 for($i = 0; $row = db_fetch_assoc($sth, $i); $i++) {
56 $row[
"isPrimary"] = isset($row[
"is_group_primary"]) ? trim($row[
"is_group_primary"]) ==
"t" :
false;
57 $row[
"subUsers"] = array();
59 $row[
"name"] = isset($row[
"name"]) ? trim($row[
"name"]) :
"";
60 $row[
"profile_code"] = isset($row[
"profile_code"]) ? trim($row[
"profile_code"]) :
"";
61 $row[
"group_name"] = isset($row[
"group_name"]) ? trim($row[
"group_name"]) :
"";
62 $row[
"email"] = isset($row[
"email"]) ? trim($row[
"email"]) :
"";
63 $row[
"employee"] = isset($row[
"employee"]) ? trim($row[
"employee"]) :
"";
66 $encryptedUser = encryptUser($Cu, $row,
false);
67 $encryptedUser = urlencode($encryptedUser);
68 $row[
"encryption"] = $encryptedUser;
70 $relatedData[intval($row[
"user_id"])] = $row;
72 $returnArray = array(
"sql" => $sqls,
"code" => 0,
"error" => array(),
"relatedData" => array_values($relatedData));
73 }
catch(exception $e) {
74 $returnArray = array(
"sql" => $sqls,
"code" => $e->getCode(),
"error" => array($e->getMessage()));
78 unset($returnArray[
"sql"]);
87 function printPage($self, $userId, $readData) { ?>
88 <script type=
"text/javascript">
98 $.homecuValidator.setup({formValidate:
'showRelatedDiv', formStatusField:
'formValidateDiv'});
99 $(
"#externalTabWindow").data(
"preferredHeight",
"auto");
100 var showRelatedData = [];
102 {headerTemplate:
" ", headerAttributes: {
"class":
"hierarchyCell"}, width: 45},
103 {field:
"user_name", title:
"User", attributes: {
"class":
"showEllipsis"}},
104 {field:
"name", title:
"Name", attributes: {
"class":
"hidden-xs hidden-sm showEllipsis"}, headerAttributes: {
"class":
"hidden-xs hidden-sm"}},
105 {field:
"email", title:
"Email", attributes: {
"class":
"showEllipsis"}},
106 {field:
"lastlogin", title:
"Last Sign in", attributes: {
"class":
"hidden-xs hidden-sm"}, headerAttributes: {
"class":
"hidden-xs hidden-sm"}}
109 var showRelatedGrid = $(
"#showRelatedGrid").kendoGrid({
112 read:
function (options) {
113 options.success(showRelatedData);
120 user_id: {type:
"number"},
121 user_name: {type:
"string"},
122 name: {type:
"string"},
123 email: {type:
"email"},
124 lastlogin: {type:
"string"},
125 isPrimary: {type:
"boolean"},
126 subUsers: {type:
"odata"},
127 group_name: {type:
"string"},
128 profile_code: {type:
"string"},
129 encryption: {type:
"string"},
135 rowTemplate: $(
"#rowTemplate").html(),
137 template:
"<tr><td colspan='5'><span class='hcu-secondary'><span class='vsgSecondary'>No Records Found</span></span></td></tr>" 140 dataBound:
function() {
141 $(
"#showRelatedGrid").css({height:
"initial", maxHeight: 400, overflowY:
"auto", overflowX:
"initial"});
142 $(
"#showRelatedGrid .k-grid-content").css({height:
"initial"});
145 }).data(
"kendoGrid");
147 $(
"#showRelatedGrid colgroup").each(
function() {
148 $(
this).find(
"col").each(
function(index) {
149 if ([2,5].indexOf(index) != -1) {
150 $(
this).addClass(
"hidden-xs hidden-sm");
155 var data = <?php echo HCU_JsonEncode($readData); ?>;
156 if (data.error.length > 0) {
157 $.homecuValidator.displayMessage(data.error, $.homecuValidator.settings.statusError );
159 showRelatedData =
new kendo.data.ObservableArray(data.relatedData);
160 showRelatedGrid.dataSource.read();
163 $(
".showRelatedDiv").on(
"click",
".cancelBtn",
function() {
168 <?php printExtendShowOverflown(); ?>
170 var toolTipProps = homecuTooltip.defaults;
171 toolTipProps.filter =
".showEllipsis:visible:overflown";
172 toolTipProps.content =
function(e) {
173 return $(e.target).text().trim();
176 $(
"#showRelatedGrid").kendoTooltip(toolTipProps);
185 function postPostPostPost() {
186 $(
"#externalTabWindow").data(
"isClosing",
true);
187 $(
"#externalTabWindow").data(
"kendoWindow").close();
188 $(
"#externalTabWindow").data(
"isClosing",
false);
193 <script type=
"text/x-kendo-template" id=
"rowTemplate">
194 <tr data-uid=
"#: uid #">
195 <td>#
if (isPrimary) { # <i
class=
"fa fa-asterisk"></i> # }
else { # # } #</td>
196 <td
class=
"showEllipsis">#
if (user_name ==
null) { # # }
else { # <a href=
"main.prg?ft=22&payload=#: encryption #">#: user_name #<i
class=
"fa fa-user fa-fw"></i></a>
198 <td
class=
"hidden-xs hidden-sm showEllipsis">#
if (name ==
null) { # # }
else { # #: name # # } #</td>
199 <td
class=
"showEllipsis">#
if (email ==
null) { # # }
else { # #: email # # } #</td>
200 <td
class=
"hidden-xs hidden-sm showEllipsis">#
if (lastlogin ==
null) { # # }
else { # #: lastlogin # # } #</td>
203 <div
class=
"container hcu-all-100 showRelatedDiv vsgPrimary hcu-template" id=
"showRelatedDiv">
205 <div
id=
"formValidateDiv" class=
"k-block k-error-colored" style=
"display:none"></div>
207 <div
class=
"hcu-secondary">
208 <div
class=
"row small vsgSecondary">
209 Click a row to select. <i
class=
"fa fa-asterisk"></i> means that user is primary
for the group.
210 <div
class=
"visible-xs-inline visible-sm-inline"> Rotate device to see more columns.</div>
214 <div
id=
"showRelatedGrid" class=
"overrideGridHeight"></div>
216 <div
class=
"hcu-edit-buttons k-state-default row">
217 <a
class=
"cancelBtn" href=
"#">Cancel</a>