20        if (
sizeof($obj_refs)) {
 
   21            $obj_ids = array_keys($obj_refs);
 
   24            include_once 
"Services/Object/classes/class.ilObjectLP.php";
 
   25            include_once 
"Services/Tracking/classes/class.ilLPStatus.php";
 
   28            include_once 
'Modules/Course/classes/class.ilObjCourse.php';
 
   29            $view_modes = array();
 
   30            $query = 
"SELECT obj_id, view_mode FROM crs_settings" .
 
   31                " WHERE " . 
$ilDB->in(
"obj_id", $obj_ids, 
false, 
"integer");
 
   33            while ($rec = 
$ilDB->fetchAssoc($set)) {
 
   34                $view_modes[(int) $rec[
"obj_id"]] = (
int) $rec[
"view_mode"];
 
   40                " status_changed, percentage, read_count+childs_read_count AS read_count, spent_seconds+childs_spent_seconds AS spent_seconds," .
 
   41                " u_mode, type, visits, mark, u_comment" .
 
   43                " LEFT JOIN ut_lp_settings ON (ut_lp_settings.obj_id = object_data.obj_id)" .
 
   44                " LEFT JOIN read_event ON (read_event.obj_id = object_data.obj_id AND read_event.usr_id = " . 
$ilDB->quote($a_user_id, 
"integer") . 
")" .
 
   45                " LEFT JOIN ut_lp_marks ON (ut_lp_marks.obj_id = object_data.obj_id AND ut_lp_marks.usr_id = " . 
$ilDB->quote($a_user_id, 
"integer") . 
")" .
 
   47                " WHERE " . 
$ilDB->in(
"object_data.obj_id", $obj_ids, 
false, 
"integer") .
 
   51            while ($rec = 
$ilDB->fetchAssoc($set)) {
 
   52                $rec[
"comment"] = $rec[
"u_comment"];
 
   53                unset($rec[
"u_comment"]);
 
   55                $rec[
"ref_ids"] = $obj_refs[(int) $rec[
"obj_id"]];
 
   56                $rec[
"status"] = (int) $rec[
"status"];
 
   57                $rec[
"percentage"] = (int) $rec[
"percentage"];
 
   58                $rec[
"read_count"] = (int) $rec[
"read_count"];
 
   59                $rec[
"spent_seconds"] = (int) $rec[
"spent_seconds"];
 
   60                $rec[
"u_mode"] = (int) $rec[
"u_mode"];
 
   62                if ($rec[
"type"] == 
"sess") {
 
   63                    $session = $sessions[$rec[
"obj_id"]];
 
   71                } elseif (!$rec[
"u_mode"]) {
 
   73                    $rec[
"u_mode"] = $olp->getCurrentMode();
 
   91        include_once 
"Modules/Course/classes/Objectives/class.ilLOUserResults.php";
 
   94        $query = 
"SELECT crs_id, crs_objectives.objective_id AS obj_id, title," . 
$ilDB->quote(
"lobj", 
"text") . 
" AS type" .
 
   95            " FROM crs_objectives" .
 
   96            " WHERE " . 
$ilDB->in(
"crs_objectives.objective_id", $a_objective_ids, 
false, 
"integer") .
 
   97            " AND active = " . 
$ilDB->quote(1, 
"integer") .
 
  101        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
  102            if (array_key_exists($rec[
"obj_id"], $lo_lp_status)) {
 
  103                $rec[
"status"] = $lo_lp_status[$rec[
"obj_id"]];
 
  118        $scores_raw = $scores = array();
 
  119        include_once 
'./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
 
  125                include_once 
'./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php';
 
  127                $scores_raw = $module->getTrackingDataAgg($a_user_id);
 
  131                include_once 
'./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php';
 
  133                $scores_raw = $module->getTrackingDataAgg($a_user_id);
 
  137            foreach ($scores_raw as $item) {
 
  138                $scores[$item[
"sco_id"]] = $item[
"score"];
 
  144        include_once 
'Services/Tracking/classes/class.ilLPStatusWrapper.php';
 
  148        foreach ($a_sco_ids as $sco_id) {
 
  150            if (in_array($a_user_id, $status_info[
"failed"][$sco_id])) {
 
  152            } elseif (in_array($a_user_id, $status_info[
"completed"][$sco_id])) {
 
  154            } elseif (in_array($a_user_id, $status_info[
"in_progress"][$sco_id])) {
 
  160            $items[$sco_id] = array(
 
  161                "title" => $status_info[
"scos_title"][$sco_id],
 
  164                "score" => (
int) $scores[$sco_id]
 
  185                include_once 
'./Services/Object/classes/class.ilObjectLP.php';
 
  187                $collection = $olp->getCollectionInstance();
 
  190                    $ref_id = end($ref_ids);
 
  191                    $item_data = $collection->getPossibleItems($ref_id);
 
  199        include_once 
'Services/Tracking/classes/class.ilLPStatusWrapper.php';
 
  203        foreach ($a_item_ids as $item_id) {
 
  204            if (!isset($item_data[$item_id])) {
 
  208            if (in_array($a_user_id, $status_info[
"completed"][$item_id])) {
 
  210            } elseif (in_array($a_user_id, $status_info[
"in_progress"][$item_id])) {
 
  216            $items[$item_id] = array(
 
  217                "title" => $item_data[$item_id][
"title"],
 
  219                "type" => self::getSubItemType($a_parent_obj_id)
 
  246        array $a_filters = 
null,
 
  247        array $a_additional_fields = 
null,
 
  248        $check_agreement = 
false,
 
  249        $privacy_fields = 
null 
  255        $fields = array(
"usr_data.usr_id", 
"login", 
"active");
 
  259        $where[] = 
"usr_data.usr_id <> " . 
$ilDB->quote(ANONYMOUS_USER_ID, 
"integer");
 
  268        if (is_array($a_users)) {
 
  270            $where[] = 
$ilDB->in(
"usr_data.usr_id", $a_users, 
false, 
"integer");
 
  273        $query = 
" FROM usr_data " . $left . 
" JOIN read_event ON (read_event.usr_id = usr_data.usr_id" .
 
  274            " AND read_event.obj_id = " . 
$ilDB->quote($obj_id, 
"integer") . 
")" .
 
  275            " LEFT JOIN ut_lp_marks ON (ut_lp_marks.usr_id = usr_data.usr_id " .
 
  276            " AND ut_lp_marks.obj_id = " . 
$ilDB->quote($obj_id, 
"integer") . 
")" .
 
  277            " LEFT JOIN usr_pref ON (usr_pref.usr_id = usr_data.usr_id AND keyword = " . 
$ilDB->quote(
"language", 
"text") . 
")" .
 
  280        $queries = array(array(
"fields" => $fields, 
"query" => 
$query));
 
  283        if ($a_order_field == 
"language") {
 
  284            $a_order_field = 
"usr_pref.value";
 
  289        if (!$a_order_field) {
 
  290            $a_order_field = 
"login";
 
  291        } elseif (substr($a_order_field, 0, 4) == 
"udf_") {
 
  292            $udf_order = $a_order_field;
 
  293            $a_order_field = 
null;
 
  303            include_once 
"Services/Utilities/classes/class.ilStr.php";
 
  326        $a_check_agreement = 
null,
 
  327        array $a_privacy_fields = 
null,
 
  328        array $a_filters = 
null 
  334        if (!$a_result[
"cnt"]) {
 
  338        if (is_array($a_udf) && count($a_udf) > 0) {
 
  339            $query = 
"SELECT usr_id, field_id, value FROM udf_text WHERE " . 
$ilDB->in(
"field_id", $a_udf, 
false, 
"integer");
 
  342            while ($row = 
$ilDB->fetchAssoc($set)) {
 
  343                $udf[$row[
"usr_id"]][
"udf_" . $row[
"field_id"]] = $row[
"value"];
 
  348        if ($a_check_agreement) {
 
  350            include_once 
"Services/Membership/classes/class.ilMemberAgreement.php";
 
  354            $query = 
"SELECT usr_id FROM usr_pref WHERE keyword = " . 
$ilDB->quote(
"public_profile", 
"text") .
 
  355                " AND value = " . 
$ilDB->quote(
"y", 
"text") . 
" OR value = " . 
$ilDB->quote(
"g", 
"text");
 
  357            $all_public = array();
 
  358            while ($row = 
$ilDB->fetchAssoc($set)) {
 
  359                $all_public[] = $row[
"usr_id"];
 
  361            $query = 
"SELECT usr_id,keyword FROM usr_pref WHERE " . 
$ilDB->like(
"keyword", 
"text", 
"public_%", 
false) .
 
  362                " AND value = " . 
$ilDB->quote(
"y", 
"text") . 
" AND " . 
$ilDB->in(
"usr_id", $all_public, 
"", 
"integer");
 
  365            while ($row = 
$ilDB->fetchAssoc($set)) {
 
  366                $public[$row[
"usr_id"]][] = substr($row[
"keyword"], 7);
 
  371        foreach ($a_result[
"set"] as $idx => $row) {
 
  373            if (isset($udf[$row[
"usr_id"]])) {
 
  374                $a_result[
"set"][$idx] = $row = array_merge($row, $udf[$row[
"usr_id"]]);
 
  378            if (
sizeof($a_privacy_fields) && $a_check_agreement && !in_array($row[
"usr_id"], $agreements)) {
 
  379                foreach ($a_privacy_fields as $field) {
 
  381                    if (isset($row[$field]) && (!isset($public[$row[
"usr_id"]]) ||
 
  382                        !in_array($field, $public[$row[
"usr_id"]]))) {
 
  384                        if (isset($a_filters[$field])) {
 
  386                            foreach (array_keys($row) as $col_id) {
 
  387                                $a_result[
"set"][$idx][$col_id] = 
null;
 
  389                            $a_result[
"set"][$idx][
"privacy_conflict"] = 
true;
 
  395                            $a_result[
"set"][$idx][$field] = 
false;
 
  428        array $a_filters = 
null,
 
  429        array $a_additional_fields = 
null,
 
  430        $use_collection = 
true 
  436        $fields = array(
"object_data.obj_id", 
"title", 
"type");
 
  439        $objects = 
self::getObjectIds($a_parent_obj_id, $a_parent_ref_id, $use_collection, 
true, array($a_user_id));
 
  441        $query = 
" FROM object_data LEFT JOIN read_event ON (object_data.obj_id = read_event.obj_id AND" .
 
  442            " read_event.usr_id = " . 
$ilDB->quote($a_user_id, 
"integer") . 
")" .
 
  443            " LEFT JOIN ut_lp_marks ON (ut_lp_marks.usr_id = " . 
$ilDB->quote($a_user_id, 
"integer") . 
" AND" .
 
  444            " ut_lp_marks.obj_id = object_data.obj_id)" .
 
  445            " WHERE " . 
$ilDB->in(
"object_data.obj_id", $objects[
"object_ids"], 
false, 
"integer") .
 
  449        $queries[] = array(
"fields" => $fields, 
"query" => 
$query);
 
  451        if (!in_array($a_order_field, $fields)) {
 
  452            $a_order_field = 
"title";
 
  460            foreach (
$result[
"set"] as $idx => $item) {
 
  461                if ($item[
"type"] == 
"sess") {
 
  462                    $session = $sessions[$item[
"obj_id"]];
 
  468                $result[
"set"][$idx][
"ref_id"] = $objects[
"ref_ids"][$item[
"obj_id"]];
 
  472            if ($objects[
"scorm"]) {
 
  473                include_once(
"./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php");
 
  475                if ($subtype == 
"scorm2004") {
 
  476                    include_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
 
  478                    $scos_tracking = $sobj->getTrackingDataAgg($a_user_id, 
true);
 
  480                    include_once(
"./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
 
  482                    $scos_tracking = array();
 
  483                    foreach ($sobj->getTrackingDataAgg($a_user_id) as $item) {
 
  486                            $time = explode(
":", $item[
"time"]);
 
  487                            $item[
"time"] = $time[0] * 60 * 60 + $time[1] * 60 + $time[2];
 
  489                        $scos_tracking[$item[
"sco_id"]] = array(
"session_time" => $item[
"time"]);
 
  493                foreach ($objects[
"scorm"][
"scos"] as $sco) {
 
  494                    $row = array(
"title" => $objects[
"scorm"][
"scos_title"][$sco],
 
  498                    if (in_array($a_user_id, $objects[
"scorm"][
"completed"][$sco])) {
 
  500                    } elseif (in_array($a_user_id, $objects[
"scorm"][
"failed"][$sco])) {
 
  502                    } elseif (in_array($a_user_id, $objects[
"scorm"][
"in_progress"][$sco])) {
 
  505                    $row[
"status"] = $status;
 
  508                    if (isset($scos_tracking[$sco])) {
 
  509                        if (isset($scos_tracking[$sco][
"last_access"])) {
 
  513                        $row[
"spent_seconds"] = $scos_tracking[$sco][
"session_time"];
 
  522            if ($objects[
"objectives_parent_id"]) {
 
  523                include_once 
"Modules/Course/classes/class.ilCourseObjective.php";
 
  524                include_once 
"Modules/Course/classes/Objectives/class.ilLOUserResults.php";
 
  526                foreach (self::getObjectivesStatusForUser($a_user_id, $objects[
"objectives_parent_id"], $objtv_ids) as $item) {
 
  533            if ($objects[
"subitems"]) {
 
  535                foreach ($objects[
"subitems"][
"items"] as $item_id) {
 
  536                    $row = array(
"title" => $objects[
"subitems"][
"item_titles"][$item_id],
 
  537                        "type" => $sub_type);
 
  540                    if (in_array($a_user_id, $objects[
"subitems"][
"completed"][$item_id])) {
 
  543                    $row[
"status"] = $status;
 
  582        $query = 
"SELECT obj_id, title, e_start, e_end, CASE WHEN participated = 1 THEN 2 WHEN registered = 1 THEN 1 ELSE NULL END AS status," .
 
  585            " JOIN event_appointment ON (event.obj_id = event_appointment.event_id)" .
 
  586            " LEFT JOIN event_participants ON (event_participants.event_id = event.obj_id AND usr_id = " . 
$ilDB->quote($a_user_id, 
"integer") . 
")" .
 
  587            " WHERE " . 
$ilDB->in(
"obj_id", $obj_ids, 
false, 
"integer");
 
  590        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
  591            $rec[
"comment"] = $rec[
"e_comment"];
 
  592            unset($rec[
"e_comment"]);
 
  600                $rec[
"title"] = $date . 
': ' . $rec[
"title"];
 
  602                $rec[
"title"] = $date;
 
  604            $sessions[$rec[
"obj_id"]] = $rec;
 
  632        array $a_filters = 
null,
 
  633        array $a_additional_fields = 
null,
 
  634        $a_preselected_obj_ids = 
null 
  644        if ($a_preselected_obj_ids === 
null) {
 
  647            foreach ($a_preselected_obj_ids as $obj_id => $ref_ids) {
 
  648                $objects[
"object_ids"][] = $obj_id;
 
  649                $objects[
"ref_ids"][$obj_id] = array_pop($ref_ids);
 
  656            $set = 
$ilDB->query(
"SELECT obj_id,title,type FROM object_data" .
 
  657                " WHERE " . 
$ilDB->in(
"obj_id", $objects[
"object_ids"], 
false, 
"integer"));
 
  658            while ($rec = 
$ilDB->fetchAssoc($set)) {
 
  659                $object_data[$rec[
"obj_id"]] = $rec;
 
  660                if ($a_preselected_obj_ids) {
 
  661                    $object_data[$rec[
"obj_id"]][
"ref_ids"] = $a_preselected_obj_ids[$rec[
"obj_id"]];
 
  663                    $object_data[$rec[
"obj_id"]][
"ref_ids"] = array($objects[
"ref_ids"][$rec[
"obj_id"]]);
 
  667            foreach ($objects[
"ref_ids"] as $object_id => $ref_id) {
 
  669                if (
sizeof($object_result)) {
 
  670                    if ($object_data[$object_id]) {
 
  671                        $result[] = array_merge($object_data[$object_id], $object_result);
 
  677            if ($objects[
"objectives_parent_id"]) {
 
  699        $where[] = 
"usr_data.usr_id <> " . 
$ilDB->quote(ANONYMOUS_USER_ID, 
"integer");
 
  705        if (is_array($a_users)) { 
 
  707            $where[] = 
$ilDB->in(
"usr_data.usr_id", $a_users, 
false, 
"integer");
 
  713        $query = 
" FROM usr_data " . $left . 
" JOIN read_event ON (read_event.usr_id = usr_data.usr_id" .
 
  714            " AND obj_id = " . 
$ilDB->quote($obj_id, 
"integer") . 
")" .
 
  715            " LEFT JOIN ut_lp_marks ON (ut_lp_marks.usr_id = usr_data.usr_id " .
 
  716            " AND ut_lp_marks.obj_id = " . 
$ilDB->quote($obj_id, 
"integer") . 
")" .
 
  717            " LEFT JOIN usr_pref ON (usr_pref.usr_id = usr_data.usr_id AND keyword = " . 
$ilDB->quote(
"language", 
"text") . 
")" .
 
  720        $fields[] = 
'COUNT(usr_data.usr_id) AS user_count';
 
  723        $queries[] = array(
"fields" => $fields, 
"query" => 
$query, 
"count" => 
"*");
 
  727        $users_no = 
$result[
"user_count"];
 
  732        } elseif (isset($a_filters[
"user_total"])) {
 
  733            if ($a_filters[
"user_total"][
"from"] && $users_no < $a_filters[
"user_total"][
"from"]) {
 
  735            } elseif ($a_filters[
"user_total"][
"to"] && $users_no > $a_filters[
"user_total"][
"to"]) {
 
  753            $result[
"user_total"] = $users_no;
 
  774            $field_alias = $field;
 
  776            $field_alias = $alias;
 
  777            $alias = 
" AS " . $alias;
 
  782        if (preg_match(
"/" . preg_quote(
" [[--HAVING") . 
"(.+)" . preg_quote(
"HAVING--]]") . 
"/", $base_query, $hits)) {
 
  783            $having = 
" HAVING " . $hits[1];
 
  784            $base_query = str_replace($hits[0], 
"", $base_query);
 
  787        $query = 
"SELECT COUNT(*) AS counter, " . $field . $alias . 
" " . $base_query . 
" GROUP BY " . $field . $having . 
" ORDER BY counter DESC";
 
  790        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
  791            $result[$rec[$field_alias]] = (int) $rec[
"counter"];
 
  806        $tree = 
$DIC[
'tree'];
 
  814        $members_read = 
false;
 
  817                $members_read = 
true;
 
  819                $members = $olp->getMembers();
 
  824                $members_read = 
true;
 
  826                $members = $member_obj->getMembers();
 
  834                $members_read = 
true;
 
  835                include_once(
"Modules/IndividualAssessment/classes/class.ilObjIndividualAssessment.php");
 
  837                $members = $iass->loadMembers()->membersIds();
 
  842                $path = $tree->getPathId($a_ref_id);
 
  844                foreach (array_reverse($path) as $path_ref_id) {
 
  847                        $members_read = 
true;
 
  856            return $GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
 
  857                'read_learning_progress',
 
  858                'read_learning_progress',
 
  869                include_once(
"./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php");
 
  871                if ($subtype == 
"scorm2004") {
 
  873                    include_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
 
  875                    $all = $mod->getTrackedUsers(
"");
 
  878                        foreach ($all as $item) {
 
  879                            $a_users[] = $item[
"user_id"];
 
  883                    include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php");
 
  889                include_once(
"./Modules/Exercise/classes/class.ilObjExercise.php");
 
  892                $a_users = $members->getMembers();
 
  896                include_once 
"Services/Tracking/classes/class.ilLPStatusFactory.php";
 
  898                $a_users = $class::getParticipants($obj_id);
 
  902                include_once 
"Services/Tracking/classes/class.ilLPStatusFactory.php";
 
  904                $a_users = $class::getParticipants($obj_id);
 
  908                include_once(
"Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
 
  910                $a_users = $prg->getIdsOfUsersWithRelevantProgress();
 
  917        if (is_null($a_users)) {
 
  922        return $GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
 
  923            'read_learning_progress',
 
  924            'read_learning_progress',
 
  938    protected static function buildFilters(array $where, array $a_filters = 
null, $a_aggregate = 
false)
 
  946        if (is_array($a_filters) && 
sizeof($a_filters) > 0) {
 
  947            foreach ($a_filters as $id => $value) {
 
  956                    case "matriculation":
 
  960                        $where[] = 
$ilDB->like(
"usr_data." . $id, 
"text", 
"%" . $value . 
"%");
 
  966                        $where[] = 
"usr_data." . $id . 
" = " . 
$ilDB->quote($value, 
"text");
 
  970                        $where[] = 
$ilDB->like(
"ut_lp_marks." . $id, 
"text", 
"%" . $value . 
"%");
 
  977                                " OR ut_lp_marks.status IS NULL)";
 
  984                        $where[] = 
"ut_lp_marks." . $id . 
" = " . 
$ilDB->quote($value, 
"text");
 
  989                            if ($value[
"from"]) {
 
  990                                $where[] = 
"ut_lp_marks." . $id . 
" >= " . 
$ilDB->quote($value[
"from"], 
"integer");
 
  993                                $where[] = 
"(ut_lp_marks." . $id . 
" <= " . 
$ilDB->quote($value[
"to"], 
"integer") .
 
  994                                    " OR ut_lp_marks." . $id . 
" IS NULL)";
 
  997                            if ($value[
"from"]) {
 
  998                                $having[] = 
"ROUND(AVG(ut_lp_marks." . $id . 
")) >= " . 
$ilDB->quote($value[
"from"], 
"integer");
 
 1001                                $having[] = 
"ROUND(AVG(ut_lp_marks." . $id . 
")) <= " . 
$ilDB->quote($value[
"to"], 
"integer");
 
 1007                        $where[] = 
"usr_pref.value = " . 
$ilDB->quote($value, 
"text");
 
 1012                        if ($value[
"from"]) {
 
 1013                            $value[
"from"] = substr($value[
"from"], 0, -2) . 
"00";
 
 1015                            $value[
"from"] = $value[
"from"]->get(
IL_CAL_UNIX);
 
 1018                            if (strlen($value[
"to"]) == 19) {
 
 1019                                $value[
"to"] = substr($value[
"to"], 0, -2) . 
"59"; 
 
 1027                    case 'status_changed':
 
 1030                    case "registration":
 
 1031                        if ($id == 
"registration") {
 
 1032                            $id = 
"create_date";
 
 1038                    case "first_access":
 
 1040                        if ($value[
"from"]) {
 
 1041                            $where[] = $id . 
" >= " . 
$ilDB->quote($value[
"from"], 
"date");
 
 1044                            if (strlen($value[
"to"]) == 19) {
 
 1045                                $value[
"to"] = substr($value[
"to"], 0, -2) . 
"59"; 
 
 1047                            $where[] = $id . 
" <= " . 
$ilDB->quote($value[
"to"], 
"date");
 
 1052                        if (!$a_aggregate) {
 
 1053                            if ($value[
"from"]) {
 
 1054                                $where[] = 
"(read_event." . $id . 
"+read_event.childs_" . $id . 
") >= " . 
$ilDB->quote($value[
"from"], 
"integer");
 
 1057                                $where[] = 
"((read_event." . $id . 
"+read_event.childs_" . $id . 
") <= " . 
$ilDB->quote($value[
"to"], 
"integer") .
 
 1058                                    " OR (read_event." . $id . 
"+read_event.childs_" . $id . 
") IS NULL)";
 
 1061                            if ($value[
"from"]) {
 
 1062                                $having[] = 
"SUM(read_event." . $id . 
"+read_event.childs_" . $id . 
") >= " . 
$ilDB->quote($value[
"from"], 
"integer");
 
 1065                                $having[] = 
"SUM(read_event." . $id . 
"+read_event.childs_" . $id . 
") <= " . 
$ilDB->quote($value[
"to"], 
"integer");
 
 1070                    case "spent_seconds":
 
 1071                        if (!$a_aggregate) {
 
 1072                            if ($value[
"from"]) {
 
 1073                                $where[] = 
"(read_event." . $id . 
"+read_event.childs_" . $id . 
") >= " . 
$ilDB->quote($value[
"from"], 
"integer");
 
 1076                                $where[] = 
"((read_event." . $id . 
"+read_event.childs_" . $id . 
") <= " . 
$ilDB->quote($value[
"to"], 
"integer") .
 
 1077                                    " OR (read_event." . $id . 
"+read_event.childs_" . $id . 
") IS NULL)";
 
 1080                            if ($value[
"from"]) {
 
 1081                                $having[] = 
"ROUND(AVG(read_event." . $id . 
"+read_event.childs_" . $id . 
")) >= " . 
$ilDB->quote($value[
"from"], 
"integer");
 
 1084                                $having[] = 
"ROUND(AVG(read_event." . $id . 
"+read_event.childs_" . $id . 
")) <= " . 
$ilDB->quote($value[
"to"], 
"integer");
 
 1097        if (
sizeof($where)) {
 
 1098            $sql .= 
" WHERE " . implode(
" AND ", $where);
 
 1100        if (
sizeof($having)) {
 
 1102            $sql .= 
" [[--HAVING " . implode(
" AND ", $having) . 
"HAVING--]]";
 
 1116    protected static function buildColumns(array &$a_fields, array $a_additional_fields = 
null, $a_aggregate = 
false)
 
 1118        if (
sizeof($a_additional_fields)) {
 
 1120            foreach ($a_additional_fields as $field) {
 
 1121                if (substr($field, 0, 4) != 
"udf_") {
 
 1124                        $pos = strrpos($field, 
"_");
 
 1125                        if ($pos === 
false) {
 
 1128                        $function = strtoupper(substr($field, $pos + 1));
 
 1129                        $field = substr($field, 0, $pos);
 
 1130                        if (!in_array($function, array(
"MIN", 
"MAX", 
"SUM", 
"AVG", 
"COUNT"))) {
 
 1141                                $a_fields[] = $function . 
"(value) " . $field . 
"_" . strtolower($function);
 
 1143                                $a_fields[] = 
"value as " . $field;
 
 1148                        case "spent_seconds":
 
 1150                                $a_fields[] = 
"(" . $field . 
"+childs_" . $field . 
") " . $field;
 
 1152                                if ($function == 
"AVG") {
 
 1153                                    $a_fields[] = 
"ROUND(AVG(" . $field . 
"+childs_" . $field . 
"), 2) " . $field . 
"_" . strtolower($function);
 
 1155                                    $a_fields[] = $function . 
"(COALESCE(" . $field . 
", 0) + COALESCE(childs_" . $field . 
", 0)) " . $field . 
"_" . strtolower($function);
 
 1160                        case "read_count_spent_seconds":
 
 1161                            if ($function == 
"AVG") {
 
 1162                                $a_fields[] = 
"ROUND(AVG((spent_seconds+childs_spent_seconds)/(read_count+childs_read_count)), 2) " . $field . 
"_" . strtolower($function);
 
 1168                                if ($function == 
"AVG") {
 
 1169                                    $a_fields[] = 
"ROUND(AVG(" . $field . 
"), 2) " . $field . 
"_" . strtolower($function);
 
 1171                                    $a_fields[] = $function . 
"(" . $field . 
") " . $field . 
"_" . strtolower($function);
 
 1174                                $a_fields[] = $field;
 
 1179                    $udf[] = substr($field, 4);
 
 1184            $a_fields = array_unique($a_fields);
 
 1185            if (is_array($udf)) {
 
 1186                $udf = array_unique($udf);
 
 1203    public static function getObjectIds($a_parent_obj_id, $a_parent_ref_id = 
false, $use_collection = 
true, $a_refresh_status = 
true, $a_user_ids = 
null)
 
 1205        include_once 
"Services/Object/classes/class.ilObjectLP.php";
 
 1207        $object_ids = array($a_parent_obj_id);
 
 1208        $ref_ids = array($a_parent_obj_id => $a_parent_ref_id);
 
 1209        $objectives_parent_id = $scorm = $subitems = 
false;
 
 1212        $mode = $olp->getCurrentMode();
 
 1216                include_once 
"Services/Tracking/classes/class.ilLPStatusFactory.php";
 
 1218                $scorm = $status_scorm::_getStatusInfo($a_parent_obj_id);
 
 1223                    $objectives_parent_id = $a_parent_obj_id;
 
 1230                include_once 
"Services/Tracking/classes/class.ilLPStatusFactory.php";
 
 1232                $subitems = $status_coll_tlt::_getStatusInfo($a_parent_obj_id);
 
 1237                if ($use_collection) {
 
 1238                    $collection = $olp->getCollectionInstance();
 
 1240                        foreach ($collection->getItems() as $child_ref_id) {
 
 1242                            $object_ids[] = $child_id;
 
 1243                            $ref_ids[$child_id] = $child_ref_id;
 
 1250                    $object_ids = array_unique($object_ids);
 
 1253                foreach ($object_ids as $idx => $object_id) {
 
 1255                        unset($object_ids[$idx]);
 
 1261        if ($a_refresh_status) {
 
 1265        return array(
"object_ids" => $object_ids,
 
 1266            "ref_ids" => $ref_ids,
 
 1267            "objectives_parent_id" => $objectives_parent_id,
 
 1269            "subitems" => $subitems);
 
 1279    protected static function getSubTree($a_parent_ref_id, array &$a_object_ids, array &$a_ref_ids)
 
 1283        $tree = 
$DIC[
'tree'];
 
 1285        $children = $tree->getChilds($a_parent_ref_id);
 
 1287            foreach ($children as $child) {
 
 1288                if ($child[
"type"] == 
"adm" || $child[
"type"] == 
"rolf") {
 
 1296                $cmode = $olp->getCurrentMode();
 
 1312                    $a_object_ids[] = $child[
"obj_id"];
 
 1313                    $a_ref_ids[$child[
"obj_id"]] = $child[
"ref_id"];
 
 1331    public static function executeQueries(array $queries, $a_order_field = 
"", $a_order_dir = 
"", $a_offset = 0, $a_limit = 9999)
 
 1338        $subqueries = array();
 
 1339        foreach ($queries as $item) {
 
 1341            $item = str_replace(
"[[--HAVING", 
"HAVING", $item);
 
 1342            $item = str_replace(
"HAVING--]]", 
"", $item);
 
 1344            if (!isset($item[
"count"])) {
 
 1345                $count_field = $item[
"fields"];
 
 1346                $count_field = array_shift($count_field);
 
 1348                $count_field = $item[
"count"];
 
 1350            $count_query = 
"SELECT COUNT(" . $count_field . 
") AS cnt" . $item[
"query"];
 
 1351            $set = 
$ilDB->query($count_query);
 
 1352            if ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1353                $cnt += $rec[
"cnt"];
 
 1356            $subqueries[] = 
"SELECT " . implode(
",", $item[
"fields"]) . $item[
"query"];
 
 1362            if (
sizeof($subqueries) > 1) {
 
 1363                $base = array_shift($subqueries);
 
 1364                $query = 
$base . 
" UNION (" . implode(
") UNION (", $subqueries) . 
")";
 
 1369            if ($a_order_dir != 
"asc" && $a_order_dir != 
"desc") {
 
 1370                $a_order_dir = 
"asc";
 
 1372            if ($a_order_field) {
 
 1373                $query .= 
" ORDER BY " . $a_order_field . 
" " . strtoupper($a_order_dir);
 
 1376            $offset = (int) $a_offset;
 
 1377            $limit = (int) $a_limit;
 
 1378            $ilDB->setLimit($limit, $offset);
 
 1381            while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1386        return array(
"cnt" => $cnt, 
"set" => 
$result);
 
 1403        $a_user_filter = 
null,
 
 1404        array $a_additional_fields = 
null,
 
 1405        array $a_privacy_fields = 
null,
 
 1406        $a_check_agreement = 
null 
 1412        $result = array(
"cnt" => 0, 
"set" => 
null);
 
 1413        if (
sizeof($a_obj_ids)) {
 
 1415            $where[] = 
"usr_data.usr_id <> " . 
$ilDB->quote(ANONYMOUS_USER_ID, 
"integer");
 
 1416            if ($a_user_filter) {
 
 1417                $where[] = 
$ilDB->like(
"usr_data.login", 
"text", 
"%" . $a_user_filter . 
"%");
 
 1423            if (is_array($a_users)) {
 
 1425                $where[] = 
$ilDB->in(
"usr_data.usr_id", $a_users, 
false, 
"integer");
 
 1431            $fields = array(
"usr_data.usr_id", 
"login", 
"active");
 
 1434            include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
 
 1437            $fields[] = 
"percentage";
 
 1440            foreach ($a_obj_ids as $obj_id) {
 
 1442                $query = 
" FROM usr_data " . $left . 
" JOIN read_event ON (read_event.usr_id = usr_data.usr_id" .
 
 1443                    " AND read_event.obj_id = " . 
$ilDB->quote($obj_id, 
"integer") . 
")" .
 
 1444                    " LEFT JOIN ut_lp_marks ON (ut_lp_marks.usr_id = usr_data.usr_id " .
 
 1445                    " AND ut_lp_marks.obj_id = " . 
$ilDB->quote($obj_id, 
"integer") . 
")" .
 
 1446                    " LEFT JOIN usr_pref ON (usr_pref.usr_id = usr_data.usr_id AND keyword = " . 
$ilDB->quote(
"language", 
"text") . 
")" .
 
 1452                    foreach ($raw[
"set"] as $row) {
 
 1453                        $result[
"set"][$row[
"usr_id"]][
"login"] = $row[
"login"];
 
 1454                        $result[
"set"][$row[
"usr_id"]][
"usr_id"] = $row[
"usr_id"];
 
 1457                        $result[
"set"][$row[
"usr_id"]][
"obj_" . $obj_id] = $row[
"status"];
 
 1458                        $result[
"set"][$row[
"usr_id"]][
"obj_" . $obj_id . 
"_perc"] = $row[
"percentage"];
 
 1459                        if ($obj_id == $parent_obj_id) {
 
 1460                            $result[
"set"][$row[
"usr_id"]][
"status_changed"] = $row[
"status_changed"];
 
 1461                            $result[
"set"][$row[
"usr_id"]][
"last_access"] = $row[
"last_access"];
 
 1462                            $result[
"set"][$row[
"usr_id"]][
"spent_seconds"] = $row[
"spent_seconds"];
 
 1463                            $result[
"set"][$row[
"usr_id"]][
"read_count"] = $row[
"read_count"];
 
 1466                        foreach ($fields as $field) {
 
 1468                            if (stristr($field, 
"language")) {
 
 1469                                $field = 
"language";
 
 1472                            if (isset($row[$field])) {
 
 1474                                if ($obj_id == $parent_obj_id ||
 
 1475                                    !in_array($field, array(
"mark", 
"u_comment"))) {
 
 1476                                    $result[
"set"][$row[
"usr_id"]][$field] = $row[$field];
 
 1485            if (is_array(
$result[
"set"])) {
 
 1501        if ($a_parent_obj_id && $a_users) {
 
 1504            include_once 
"Services/Tracking/classes/class.ilLPStatus.php";
 
 1505            include_once 
"Modules/Course/classes/Objectives/class.ilLOUserResults.php";
 
 1506            include_once 
"Modules/Course/classes/class.ilCourseObjective.php";
 
 1510            include_once 
"Modules/Course/classes/Objectives/class.ilLOSettings.php";
 
 1512            $initial_qualifying = $lo_set->isInitialTestQualifying();
 
 1515            foreach ($objective_ids as $objective_id) {
 
 1516                foreach ($a_users as $user_id) {
 
 1521            $query = 
"SELECT * FROM loc_user_results" .
 
 1522                " WHERE " . 
$ilDB->in(
"objective_id", $objective_ids, 
"", 
"integer") .
 
 1523                " AND " . 
$ilDB->in(
"user_id", $a_users, 
"", 
"integer");
 
 1524            if (!(
bool) $initial_qualifying) {
 
 1527            $query .= 
" ORDER BY type"; 
 
 1529            while ($row = 
$ilDB->fetchAssoc($set)) {
 
 1530                $objective_id = $row[
"objective_id"];
 
 1531                $user_id = $row[
"user_id"];
 
 1539                    $res[$user_id][$objective_id] = $row[
"is_final"]
 
 1555        $obj_ids = array_keys($a_ref_ids);
 
 1564        $sql = 
"SELECT obj_id," . $column . 
",SUM(read_count) read_count,SUM(childs_read_count) childs_read_count," .
 
 1565            "SUM(spent_seconds) spent_seconds,SUM(childs_spent_seconds) childs_spent_seconds" .
 
 1567            " WHERE " . 
$ilDB->in(
"obj_id", $obj_ids, 
"", 
"integer") .
 
 1568            " AND yyyy = " . 
$ilDB->quote($a_year, 
"integer");
 
 1570            $sql .= 
" AND mm = " . 
$ilDB->quote($a_month, 
"integer");
 
 1572        $sql .= 
" GROUP BY obj_id," . $column;
 
 1573        $set = 
$ilDB->query($sql);
 
 1574        while ($row = 
$ilDB->fetchAssoc($set)) {
 
 1575            $row[
"read_count"] += $row[
"childs_read_count"];
 
 1576            $row[
"spent_seconds"] += $row[
"childs_spent_seconds"];
 
 1577            $res[$row[
"obj_id"]][$row[$column]][
"read_count"] += $row[
"read_count"];
 
 1578            $res[$row[
"obj_id"]][$row[$column]][
"spent_seconds"] += $row[
"spent_seconds"];
 
 1584        $sql = 
"SELECT obj_id," . $column . 
",SUM(counter) counter" .
 
 1585            " FROM obj_user_stat" .
 
 1586            " WHERE " . 
$ilDB->in(
"obj_id", $obj_ids, 
"", 
"integer") .
 
 1587            " AND yyyy = " . 
$ilDB->quote($a_year, 
"integer");
 
 1589            $sql .= 
" AND mm = " . 
$ilDB->quote($a_month, 
"integer");
 
 1591        $sql .= 
" GROUP BY obj_id," . $column;
 
 1592        $set = 
$ilDB->query($sql);
 
 1593        while ($row = 
$ilDB->fetchAssoc($set)) {
 
 1594            $res[$row[
"obj_id"]][$row[$column]][
"users"] += $row[
"counter"];
 
 1605        $objDefinition = 
$DIC[
'objDefinition'];
 
 1611        include_once 
"Services/Tree/classes/class.ilTree.php";
 
 1613        $sql = 
"SELECT " . $tree->table_obj_data . 
".obj_id," . $tree->table_obj_data . 
".type," .
 
 1614            $tree->table_tree . 
"." . $tree->tree_pk . 
"," . $tree->table_obj_reference . 
".ref_id" .
 
 1615            " FROM " . $tree->table_tree .
 
 1616            " " . $tree->buildJoin() .
 
 1617            " WHERE " . 
$ilDB->in($tree->table_obj_data . 
".type", $types, 
"", 
"text");
 
 1618        $set = 
$ilDB->query($sql);
 
 1620        while ($row = 
$ilDB->fetchAssoc($set)) {
 
 1621            $res[$row[
"type"]][
"type"] = $row[
"type"];
 
 1622            $res[$row[
"type"]][
"references"]++;
 
 1623            $res[$row[
"type"]][
"objects"][] = $row[
"obj_id"];
 
 1624            if ($row[$tree->tree_pk] < 0) {
 
 1625                $res[$row[
"type"]][
"deleted"]++;
 
 1630            $res[
$type][
"objects"] = 
sizeof(array_unique($values[
"objects"]));
 
 1634        foreach (self::getPortfolios() as $obj_id) {
 
 1635            $res[
"prtf"][
"type"] = 
"prtf";
 
 1636            $res[
"prtf"][
"references"]++;
 
 1637            $res[
"prtf"][
"objects"]++;
 
 1640        foreach (self::getWorkspaceBlogs() as $obj_id) {
 
 1641            $res[
"blog"][
"type"] = 
"blog";
 
 1642            $res[
"blog"][
"references"]++;
 
 1643            $res[
"blog"][
"objects"]++;
 
 1658        $sql = 
"SELECT od.obj_id,oref.wsp_id,od.type" .
 
 1659            " FROM tree_workspace wst" .
 
 1660            " JOIN object_reference_ws oref ON (oref.wsp_id = wst.child)" .
 
 1661            " JOIN object_data od ON (oref.obj_id = od.obj_id)" .
 
 1662            " WHERE od.type = " . 
$ilDB->quote(
"blog", 
"text");
 
 1665            $sql .= 
" AND " . 
$ilDB->like(
"od.title", 
"text", 
"%" . $a_title . 
"%");
 
 1668        $set = 
$ilDB->query($sql);
 
 1669        while ($row = 
$ilDB->fetchAssoc($set)) {
 
 1670            $res[] = $row[
"obj_id"];
 
 1684        $sql = 
"SELECT od.obj_id" .
 
 1685            " FROM usr_portfolio prtf" .
 
 1686            " JOIN object_data od ON (od.obj_id = prtf.id)";
 
 1689            $sql .= 
" WHERE " . 
$ilDB->like(
"od.title", 
"text", 
"%" . $a_title . 
"%");
 
 1692        $set = 
$ilDB->query($sql);
 
 1693        while ($row = 
$ilDB->fetchAssoc($set)) {
 
 1694            $res[] = $row[
"obj_id"];
 
 1706        $obj_ids = array_keys($a_ref_ids);
 
 1709        $sql = 
"SELECT obj_id,hh,SUM(read_count) read_count,SUM(childs_read_count) childs_read_count," .
 
 1710            "SUM(spent_seconds) spent_seconds,SUM(childs_spent_seconds) childs_spent_seconds" .
 
 1712            " WHERE " . 
$ilDB->in(
"obj_id", $obj_ids, 
"", 
"integer") .
 
 1713            " AND yyyy = " . 
$ilDB->quote($a_year, 
"integer");
 
 1715            $sql .= 
" AND mm = " . 
$ilDB->quote($a_month, 
"integer");
 
 1717        $sql .= 
" GROUP BY obj_id,hh";
 
 1718        $set = 
$ilDB->query($sql);
 
 1719        while ($row = 
$ilDB->fetchAssoc($set)) {
 
 1720            $row[
"read_count"] += $row[
"childs_read_count"];
 
 1721            $row[
"spent_seconds"] += $row[
"childs_spent_seconds"];
 
 1722            $res[$row[
"obj_id"]][(int) $row[
"hh"]][
"read_count"] += $row[
"read_count"];
 
 1723            $res[$row[
"obj_id"]][(int) $row[
"hh"]][
"spent_seconds"] += $row[
"spent_seconds"];
 
 1734        $set = 
$ilDB->query(
"SELECT COUNT(*) AS COUNTER,yyyy,mm" .
 
 1736            " GROUP BY yyyy, mm" .
 
 1737            " ORDER BY yyyy DESC, mm DESC");
 
 1739        while ($row = 
$ilDB->fetchAssoc($set)) {
 
 1740            $res[] = array(
"month" => $row[
"yyyy"] . 
"-" . $row[
"mm"],
 
 1741                "count" => $row[
"counter"]);
 
 1753        $date_compare = 
$ilDB->in(
$ilDB->concat(array(array(
"yyyy", 
""),
 
 1754                        array(
$ilDB->quote(
"-", 
"text"), 
""),
 
 1755                        array(
"mm", 
""))), $a_months, 
"", 
"text");
 
 1756        $sql = 
"DELETE FROM obj_stat" .
 
 1757            " WHERE " . $date_compare;
 
 1758        $ilDB->manipulate($sql);
 
 1761        $tables = array(
"obj_lp_stat", 
"obj_type_stat", 
"obj_user_stat");
 
 1762        foreach ($a_months as $month) {
 
 1763            $year = substr($month, 0, 4);
 
 1764            $month = substr($month, 5);
 
 1765            $from = $year . str_pad($month, 2, 
"0", STR_PAD_LEFT) . 
"01";
 
 1766            $to = $year . str_pad($month, 2, 
"0", STR_PAD_LEFT) . 
"31";
 
 1768            foreach ($tables as $table) {
 
 1769                $sql = 
"DELETE FROM " . $table .
 
 1770                    " WHERE fulldate >= " . 
$ilDB->quote($from, 
"integer") .
 
 1771                    " AND fulldate <= " . 
$ilDB->quote($to, 
"integer");
 
 1772                $ilDB->manipulate($sql);
 
 1777    public static function searchObjects(
$a_type, $a_title = 
null, $a_root = 
null, $a_hidden = 
null, $a_preset_obj_ids = 
null)
 
 1782        $tree = 
$DIC[
'tree'];
 
 1785            $a_type = array(
'lm',
'sahs',
'htlm');
 
 1788        $sql = 
"SELECT r.ref_id,r.obj_id" .
 
 1789            " FROM object_data o" .
 
 1790            " JOIN object_reference r ON (o.obj_id = r.obj_id)" .
 
 1791            " JOIN tree t ON (t.child = r.ref_id)" .
 
 1792            " WHERE t.tree = " . 
$ilDB->quote(1, 
"integer");
 
 1795            $sql .= 
" AND o.type = " . 
$ilDB->quote(
$a_type, 
"text");
 
 1797            $sql .= 
" AND " . 
$ilDB->in(
"o.type", 
$a_type, 
"", 
"text");
 
 1801            $sql .= 
" AND (" . 
$ilDB->like(
"o.title", 
"text", 
"%" . $a_title . 
"%") .
 
 1802                " OR " . 
$ilDB->like(
"o.description", 
"text", 
"%" . $a_title . 
"%") . 
")";
 
 1805        if (is_array($a_hidden)) {
 
 1806            $sql .= 
" AND " . 
$ilDB->in(
"o.obj_id", $a_hidden, 
true, 
"integer");
 
 1809        if (is_array($a_preset_obj_ids)) {
 
 1810            $sql .= 
" AND " . 
$ilDB->in(
"o.obj_id", $a_preset_obj_ids, 
false, 
"integer");
 
 1813        $set = 
$ilDB->query($sql);
 
 1815        while ($row = 
$ilDB->fetchAssoc($set)) {
 
 1816            if ($a_root && $a_root != ROOT_FOLDER_ID) {
 
 1818                    if ($tree->isGrandChild($a_root, $ref_id)) {
 
 1819                        $res[$row[
"obj_id"]][] = $row[
"ref_id"];
 
 1824                $res[$row[
"obj_id"]][] = $row[
"ref_id"];
 
 1838        include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
 
 1839        foreach ($a_obj_ids as $obj_id) {
 
 1855        $set = 
$ilDB->query(
"SELECT COUNT(*) counter, MIN(tstamp) tstamp" .
 
 1856            " FROM obj_stat_log");
 
 1857        return $ilDB->fetchAssoc($set);
 
 1866        if ($a_group_by_day) {
 
 1869            $column = 
"mm,yyyy";
 
 1873        $sql = 
"SELECT obj_id," . $column . 
"," .
 
 1874            "MIN(mem_cnt) mem_cnt_min,AVG(mem_cnt) mem_cnt_avg, MAX(mem_cnt) mem_cnt_max," .
 
 1875            "MIN(in_progress) in_progress_min,AVG(in_progress) in_progress_avg,MAX(in_progress) in_progress_max," .
 
 1876            "MIN(completed) completed_min,AVG(completed) completed_avg,MAX(completed) completed_max," .
 
 1877            "MIN(failed) failed_min,AVG(failed) failed_avg,MAX(failed) failed_max," .
 
 1878            "MIN(not_attempted) not_attempted_min,AVG(not_attempted) not_attempted_avg,MAX(not_attempted) not_attempted_max" .
 
 1879            " FROM obj_lp_stat" .
 
 1880            " WHERE " . 
$ilDB->in(
"obj_id", $a_obj_ids, 
"", 
"integer") .
 
 1881            " AND yyyy = " . 
$ilDB->quote($a_year, 
"integer");
 
 1883            $sql .= 
" AND mm = " . 
$ilDB->quote($a_month, 
"integer");
 
 1885        $sql .= 
" GROUP BY obj_id," . $column;
 
 1886        $set = 
$ilDB->query($sql);
 
 1887        while ($row = 
$ilDB->fetchAssoc($set)) {
 
 1901            $a_year = date(
"Y");
 
 1904        $agg = strtoupper($a_aggregation);
 
 1907        $sql = 
"SELECT type,yyyy,mm," . $agg . 
"(cnt_objects) cnt_objects," . $agg . 
"(cnt_references) cnt_references," .
 
 1908            "" . $agg . 
"(cnt_deleted) cnt_deleted FROM obj_type_stat" .
 
 1909            " WHERE yyyy = " . 
$ilDB->quote($a_year, 
"integer") .
 
 1910            " GROUP BY type,yyyy,mm";
 
 1911        $set = 
$ilDB->query($sql);
 
 1912        while ($row = 
$ilDB->fetchAssoc($set)) {
 
 1913            $row[
"mm"] = str_pad($row[
"mm"], 2, 
"0", STR_PAD_LEFT);
 
 1914            $res[$row[
"type"]][$row[
"yyyy"] . 
"-" . $row[
"mm"]] = array(
 
 1915                "objects" => (
int) $row[
"cnt_objects"],
 
 1916                "references" => (
int) $row[
"cnt_references"],
 
 1917                "deleted" => (
int) $row[
"cnt_deleted"]
 
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
An exception for terminatinating execution or to throw for unit testing.
const IL_CRS_VIEW_OBJECTIVE
static _getObjectiveIds($course_id, $a_activated_only=false)
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
@classDescription Date and time handling
static getInstanceByObjId($a_obj_id)
get singleton instance
static getObjectiveStatusForLP($a_user_id, $a_obj_id, array $a_objective_ids)
const LP_MODE_COLLECTION_TLT
const LP_MODE_SURVEY_FINISHED
const LP_MODE_TEST_FINISHED
const LP_MODE_COLLECTION_MANUAL
const LP_MODE_COLLECTION_MOBS
static _getClassById($a_obj_id, $a_mode=null)
static _getInstance($a_obj_id, $a_mode=null)
static _getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_COMPLETED
const LP_STATUS_IN_PROGRESS_NUM
static checkStatusForObject($a_obj_id, $a_users=false)
This function checks whether the status for a given number of users is dirty and must be recalculated...
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_FAILED_NUM
const LP_STATUS_NOT_ATTEMPTED
const LP_STATUS_IN_PROGRESS
static lookupAcceptedAgreements($a_obj_id)
Lookup users who have accepted the agreement.
For the purpose of streamlining the grading and learning-process status definition outside of tests,...
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
Class ilObjSCORM2004LearningModule.
Class ilObjSCORMLearningModule.
static _getTrackedUsers($a_obj_id)
Get all tracked users.
static getInstance($a_obj_id)
static _lookupObjId($a_id)
static _lookupObjectId($a_ref_id)
lookup object id
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
static getInstance($a_ref_id)
Get instance by ref_id.
static getObjectTypeStatisticsPerMonth($a_aggregation, $a_year=null)
static getObjectDailyStatistics(array $a_ref_ids, $a_year, $a_month=null)
static getObjectsDataForUser( $a_user_id, $a_parent_obj_id, $a_parent_ref_id, $a_order_field="", $a_order_dir="", $a_offset=0, $a_limit=9999, array $a_filters=null, array $a_additional_fields=null, $use_collection=true)
Get all object-based tracking data for user and parent object.
static getObjectivesStatusForUser($a_user_id, $a_obj_id, array $a_objective_ids)
static getUDFAndHandlePrivacy(array &$a_result, array $a_udf=null, $a_check_agreement=null, array $a_privacy_fields=null, array $a_filters=null)
Handle privacy and add udf data to (user) result data.
static getUserObjectMatrix( $a_parent_ref_id, $a_obj_ids, $a_user_filter=null, array $a_additional_fields=null, array $a_privacy_fields=null, $a_check_agreement=null)
Get status matrix for users on objects.
static getUserDataForObject( $a_ref_id, $a_order_field="", $a_order_dir="", $a_offset=0, $a_limit=9999, array $a_filters=null, array $a_additional_fields=null, $check_agreement=false, $privacy_fields=null)
Get all user-based tracking data for object.
static getUserObjectiveMatrix($a_parent_obj_id, $a_users)
static getObjectTypeStatistics()
static getObjectIds($a_parent_obj_id, $a_parent_ref_id=false, $use_collection=true, $a_refresh_status=true, $a_user_ids=null)
Get (sub)objects for given object, also handles learning objectives (course only)
static getSubItemsStatusForUser($a_user_id, $a_parent_obj_id, array $a_item_ids)
Get subitems status.
static getObjectsStatusForUser($a_user_id, array $obj_refs)
static getObjectsSummaryForObject( $a_parent_obj_id, $a_parent_ref_id, $a_order_field="", $a_order_dir="", $a_offset=0, $a_limit=9999, array $a_filters=null, array $a_additional_fields=null, $a_preselected_obj_ids=null)
Get all aggregated tracking data for parent object.
static getObjectStatisticsMonthlySummary()
static refreshObjectsStatus(array $a_obj_ids, $a_users=null)
check whether status (for all relevant users) exists
static getObjectAccessStatistics(array $a_ref_ids, $a_year, $a_month=null)
static getSessionData($a_user_id, array $obj_ids)
Get session data for given objects and user.
static getObjectLPStatistics(array $a_obj_ids, $a_year, $a_month=null, $a_group_by_day=false)
static buildFilters(array $where, array $a_filters=null, $a_aggregate=false)
Build sql from filter definition.
static buildColumns(array &$a_fields, array $a_additional_fields=null, $a_aggregate=false)
Build sql from field definition.
static searchObjects($a_type, $a_title=null, $a_root=null, $a_hidden=null, $a_preset_obj_ids=null)
static getParticipantsForObject($a_ref_id)
Get participant ids for given object.
static getSummaryDataForObject($a_ref_id, array $fields, array $a_filters=null)
Get all aggregated tracking data for object.
static getObjectStatisticsLogInfo()
Get last update info for object statistics.
static getSubItemType($a_parent_obj_id)
Get sub-item object type for parent.
static getWorkspaceBlogs($a_title=null)
static getSummaryPercentages($field, $base_query, $alias=null)
Get aggregated data for field.
static getSCOsStatusForUser($a_user_id, $a_parent_obj_id, array $a_sco_ids)
static getPortfolios($a_title=null)
static getSubTree($a_parent_ref_id, array &$a_object_ids, array &$a_ref_ids)
Get complete branch of tree (recursively)
static executeQueries(array $queries, $a_order_field="", $a_order_dir="", $a_offset=0, $a_limit=9999)
Execute given queries, including count query.
static deleteObjectStatistics(array $a_months)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static stableSortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false)
Sort an aray using a stable sort algorithm, which preveserves the sequence of array elements which ha...
foreach($_POST as $key=> $value) $res