5 include_once
"Services/Cron/classes/class.ilCronJob.php";
19 return "lp_object_statistics";
26 $lng->loadLanguageModule(
"trac");
27 return $lng->txt(
"trac_object_statistics");
34 $lng->loadLanguageModule(
"trac");
35 return $lng->txt(
"trac_object_statistics_info");
62 $this->date = strtotime(
"yesterday");
94 $trashed_objects = $tree->getSavedNodeObjIds($all_courses);
96 include_once
'Services/Object/classes/class.ilObjectLP.php';
97 include_once
"Modules/Course/classes/class.ilCourseParticipants.php";
98 include_once
"Services/Tracking/classes/class.ilLPStatusWrapper.php";
99 foreach($all_courses as $crs_id)
102 if(!in_array($crs_id, $trashed_objects))
106 if(!$olp->isActive())
112 $ilDB->manipulate(
"DELETE FROM obj_lp_stat WHERE".
113 " obj_id = ".$ilDB->quote($crs_id,
"integer").
114 " AND fulldate = ".$ilDB->quote(date(
"Ymd", $this->date),
"integer"));
117 $members = $members->getMembers();
124 $not_attempted = count($members) - $in_progress - $completed -
$failed;
127 "type" => array(
"text",
"crs"),
128 "obj_id" => array(
"integer", $crs_id),
129 "yyyy" => array(
"integer", date(
"Y", $this->date)),
130 "mm" => array(
"integer", date(
"m", $this->date)),
131 "dd" => array(
"integer", date(
"d", $this->date)),
132 "fulldate" => array(
"integer", date(
"Ymd", $this->date)),
133 "mem_cnt" => array(
"integer", count($members)),
134 "in_progress" => array(
"integer", $in_progress),
135 "completed" => array(
"integer", $completed),
136 "failed" => array(
"integer", $failed),
137 "not_attempted" => array(
"integer", $not_attempted)
140 $ilDB->insert(
"obj_lp_stat", $set);
159 include_once
"Services/Tracking/classes/class.ilTrQuery.php";
161 foreach($data as $type => $item)
164 $ilDB->manipulate(
"DELETE FROM obj_type_stat WHERE".
165 " type = ".$ilDB->quote($type,
"text").
166 " AND fulldate = ".$ilDB->quote(date(
"Ymd", $this->date),
"integer"));
169 "type" => array(
"text", $type),
170 "yyyy" => array(
"integer", date(
"Y", $this->date)),
171 "mm" => array(
"integer", date(
"m", $this->date)),
172 "dd" => array(
"integer", date(
"d", $this->date)),
173 "fulldate" => array(
"integer", date(
"Ymd", $this->date)),
174 "cnt_references" => array(
"integer", (
int)$item[
"references"]),
175 "cnt_objects" => array(
"integer", (
int)$item[
"objects"]),
176 "cnt_deleted" => array(
"integer", (
int)$item[
"deleted"])
179 $ilDB->insert(
"obj_type_stat", $set);
196 $to = mktime(23, 59, 59, date(
"m", $this->date), date(
"d", $this->date), date(
"Y", $this->date));
198 $sql =
"SELECT COUNT(DISTINCT(usr_id)) counter,obj_id FROM read_event".
199 " WHERE last_access >= ".$ilDB->quote($this->date,
"integer").
200 " AND last_access <= ".$ilDB->quote($to,
"integer").
202 $set = $ilDB->query($sql);
203 while(
$row = $ilDB->fetchAssoc($set))
206 $ilDB->manipulate(
"DELETE FROM obj_user_stat".
207 " WHERE fulldate = ".$ilDB->quote(date(
"Ymd", $this->date),
"integer").
208 " AND obj_id = ".$ilDB->quote(
$row[
"obj_id"],
"integer"));
211 "obj_id" => array(
"integer",
$row[
"obj_id"]),
212 "yyyy" => array(
"integer", date(
"Y", $this->date)),
213 "mm" => array(
"integer", date(
"m", $this->date)),
214 "dd" => array(
"integer", date(
"d", $this->date)),
215 "fulldate" => array(
"integer", date(
"Ymd", $this->date)),
216 "counter" => array(
"integer",
$row[
"counter"])
219 $ilDB->insert(
"obj_user_stat", $iset);