@@ -56,7 +56,7 @@ public function getStatistic($typeCode,$categoryCode)
56
56
*
57
57
* @return Statistic
58
58
*/
59
- public function addStatisticRaw ($ typeCode ,$ typeDesc ,$ categoryCode ,$ categoryDesc ,$ note , $ segment_type )
59
+ public function addStatisticRaw ($ typeCode ,$ typeDesc ,$ categoryCode ,$ categoryDesc ,$ segment_type , $ note )
60
60
{
61
61
# Create the new statistic object
62
62
$ stat_obj = (object ) [
@@ -76,7 +76,8 @@ public function addStatisticRaw($typeCode,$typeDesc,$categoryCode,$categoryDesc,
76
76
$ this ->data [] = $ stat_obj ;
77
77
78
78
/* Not Sure this is quite right or needed. */
79
- return Statistic::make ($ this ->client ,$ stat_obj );
79
+ #return Statistic::make($this->client,$stat_obj);
80
+ #return($this->data);
80
81
}
81
82
82
83
/**
@@ -87,7 +88,7 @@ public function addStatisticRaw($typeCode,$typeDesc,$categoryCode,$categoryDesc,
87
88
*
88
89
* @return Statistic
89
90
*/
90
- public function addStatistic ($ typeCode ,$ categoryCode )
91
+ public function addStatistic ($ typeCode ,$ categoryCode, $ segmentType , $ note )
91
92
{
92
93
//* TODO HERE *//
93
94
@@ -111,13 +112,12 @@ public function addStatistic($typeCode,$categoryCode)
111
112
#$typeDesc = $this->conf->CodeTables->getDesc('UserStatisticalTypes',$typeCode);
112
113
#$categoryDesc = $this->conf->CodeTables->getDesc('UserStatCagegories',$categoryCode);
113
114
#
114
- # These are temporary.
115
- $ segmentType = 'External ' ; # Just for now.
116
- $ note = '' ; # Just for now.
115
+ # These are temporary for testing.
116
+ $ typeDesc = 'Test ' ;
117
+ $ categoryDesc = 'Test ' ;
118
+
119
+ $ this ->addStatisticRaw ($ typeCode ,$ typeDesc ,$ categoryCode ,$ categoryDesc ,$ segmentType ,$ note );
117
120
118
- $ ret = $ this ->addStatisticRaw ($ typeCode ,$ typeDesc ,$ categoryCode ,$ categoryDesc ,$ note ,$ segmentType );
119
-
120
- return ($ ret );
121
121
}
122
122
123
123
/**
@@ -128,29 +128,26 @@ public function addStatistic($typeCode,$categoryCode)
128
128
*/
129
129
public function removeStatistic ($ typeCode ,$ categoryCode )
130
130
{
131
- foreach ($ this ->data -> user_statistic as $ statistic ) {
132
- if (( $ statistic -> category_type -> value == $ typeCode ) && ( $ statistic -> statistic_category -> value == $ categoryCode )) {
133
-
134
- //* TODO HERE *//
135
-
136
- return ;
131
+ $ max = sizeof ($ this ->data );
132
+ $ ret = false ;
133
+ for ( $ i = 0 ; $ i < $ max ; $ i ++) {
134
+ if (( $ this -> data [ $ i ]-> category_type -> value == $ typeCode ) && ( $ this -> data [ $ i ]-> statistic_category -> value == $ categoryCode )) {
135
+ unset( $ this -> data [ $ i ]);
136
+ $ ret = true ;
137
137
}
138
138
}
139
+ return ($ ret );
139
140
}
140
141
141
142
/**
142
143
* Update a user statistic.
143
144
*
144
145
*/
145
- public function updateStatistic ($ fromTypeCode ,$ fromCategoryCode ,$ toTypeCode ,$ toCategoryCode )
146
+ public function updateStatistic ($ fromTypeCode ,$ fromCategoryCode ,$ toTypeCode ,$ toCategoryCode, $ segementType , $ note )
146
147
{
147
-
148
- //* TODO HERE *//
149
-
150
148
/* Remove "from" statistic, then add "to" statistic */
151
-
152
149
$ this ->removeStatistic ($ fromTypeCode ,$ categoryCode );
153
- $ this ->addStatistic ($ toTypeCode ,$ toCategoryCode );
150
+ $ this ->addStatistic ($ toTypeCode ,$ toCategoryCode, $ segmentType , $ note );
154
151
}
155
152
156
153
/**
0 commit comments