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);
156 include_once
"Services/Tracking/classes/class.ilTrQuery.php";
158 foreach($data as $type => $item)
161 $ilDB->manipulate(
"DELETE FROM obj_type_stat WHERE".
162 " type = ".$ilDB->quote($type,
"text").
163 " AND fulldate = ".$ilDB->quote(date(
"Ymd", $this->date),
"integer"));
166 "type" => array(
"text", $type),
167 "yyyy" => array(
"integer", date(
"Y", $this->date)),
168 "mm" => array(
"integer", date(
"m", $this->date)),
169 "dd" => array(
"integer", date(
"d", $this->date)),
170 "fulldate" => array(
"integer", date(
"Ymd", $this->date)),
171 "cnt_references" => array(
"integer", (
int)$item[
"references"]),
172 "cnt_objects" => array(
"integer", (
int)$item[
"objects"]),
173 "cnt_deleted" => array(
"integer", (
int)$item[
"deleted"])
176 $ilDB->insert(
"obj_type_stat", $set);
190 $to = mktime(23, 59, 59, date(
"m", $this->date), date(
"d", $this->date), date(
"Y", $this->date));
192 $sql =
"SELECT COUNT(DISTINCT(usr_id)) counter,obj_id FROM read_event".
193 " WHERE last_access >= ".$ilDB->quote($this->date,
"integer").
194 " AND last_access <= ".$ilDB->quote($to,
"integer").
196 $set = $ilDB->query($sql);
197 while(
$row = $ilDB->fetchAssoc($set))
200 $ilDB->manipulate(
"DELETE FROM obj_user_stat".
201 " WHERE fulldate = ".$ilDB->quote(date(
"Ymd", $this->date),
"integer").
202 " AND obj_id = ".$ilDB->quote(
$row[
"obj_id"],
"integer"));
205 "obj_id" => array(
"integer",
$row[
"obj_id"]),
206 "yyyy" => array(
"integer", date(
"Y", $this->date)),
207 "mm" => array(
"integer", date(
"m", $this->date)),
208 "dd" => array(
"integer", date(
"d", $this->date)),
209 "fulldate" => array(
"integer", date(
"Ymd", $this->date)),
210 "counter" => array(
"integer",
$row[
"counter"])
213 $ilDB->insert(
"obj_user_stat", $iset);