forked from edwardjrp/license_manager
/
customers_assessment_maintcontent_events.php
executable file
·127 lines (102 loc) · 3.88 KB
/
customers_assessment_maintcontent_events.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
<?php
// //Events @1-F81417CB
//customers_assessment_maintcontent_lbgoback_BeforeShow @4-FB3C3475
function customers_assessment_maintcontent_lbgoback_BeforeShow(& $sender)
{
$customers_assessment_maintcontent_lbgoback_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $customers_assessment_maintcontent; //Compatibility
//End customers_assessment_maintcontent_lbgoback_BeforeShow
//Custom Code @5-2A29BDB7
// -------------------------
// Write your own code here.
$remove = array("guid","locale");
$querystring = CCGetQueryString("QueryString",$remove);
if (strlen($querystring) > 0)
$newlink = "?".$querystring;
else
$newlink = $querystring;
$sender->setValue($newlink);
// -------------------------
//End Custom Code
//Close customers_assessment_maintcontent_lbgoback_BeforeShow @4-BACFEFA0
return $customers_assessment_maintcontent_lbgoback_BeforeShow;
}
//End Close customers_assessment_maintcontent_lbgoback_BeforeShow
//customers_assessment_maintcontent_BeforeShow @1-99EE8E57
function customers_assessment_maintcontent_BeforeShow(& $sender)
{
$customers_assessment_maintcontent_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $customers_assessment_maintcontent; //Compatibility
//End customers_assessment_maintcontent_BeforeShow
//Custom Code @9-2A29BDB7
// -------------------------
// Write your own code here.
global $MainPage;
$params = array();
$customers = new Customers();
$tab = CCGetFromGet("tab","tab_9");
$guid = CCGetFromGet("guid","");
$o_post = CCGetFromPost("o","");
switch ($o_post) {
case "insert":
$typeid_post = (int)CCGetFromPost("hidtype_id","0");
$option_title = trim(CCGetFromPost("title",""));
$tab = trim(CCGetFromPost("hidtab",""));
$params["type_id"] = $typeid_post;
$params["title"] = $option_title;
$newOption = $customers->addAssessmentType($params);
$newOption = $newOption["options"];
$guid = $newOption["guid"];
//Will show saved pop and disable button
CCSetSession("showalert","show");
//Redirect after submit
header("Location: customers_assessment.php?tab=$tab");
break;
case "update":
$typeid_post = (int)CCGetFromPost("hidtype_id","0");
$option_title = trim(CCGetFromPost("title",""));
$tab = trim(CCGetFromPost("hidtab",""));
$guid = trim(CCGetFromPost("hidguid",""));
$params["type_id"] = $typeid_post;
$params["title"] = $option_title;
$params["guid"] = $guid;
$customers->editAssessmentType($params);
//Will show saved pop and disable button
CCSetSession("showalert","show");
//Redirect after submit
header("Location: customers_assessment.php?tab=$tab");
break;
}
$guid = trim($guid,"guid=");
$type_id = trim($tab,"tab_");
if (strlen($guid) > 0) {
$params["guid"] = $guid;
$option = $customers->getAssessmentOptionsByGuid($params);
$option = $option["options"][0];
$customers_assessment_maintcontent->hidguid->SetValue($option["guid"]);
$customers_assessment_maintcontent->title->SetValue($option["title"]);
$customers_assessment_maintcontent->o->SetValue("update");
}
$customers_assessment_maintcontent->hidtype_id->SetValue($type_id);
$customers_assessment_maintcontent->hidtab->SetValue($tab);
$params["type_id"] = $type_id;
$type_detail = $customers->getAssessmentTypeByID($params);
$type_detail = $type_detail["types"][0];
$typeid_title = $type_detail["type"];
$customers_assessment_maintcontent->lbtype->setvalue($typeid_title);
//Settingup saved message popup
$showalert = CCGetSession("showalert","hide");
$MainPage->Attributes->SetValue("showalert",$showalert);
if ($showalert == "show")
CCSetSession("showalert","hide");
// -------------------------
//End Custom Code
//Close customers_assessment_maintcontent_BeforeShow @1-BC8E08EE
return $customers_assessment_maintcontent_BeforeShow;
}
//End Close customers_assessment_maintcontent_BeforeShow
?>