ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjUserTrackingGUI Class Reference
+ Inheritance diagram for ilObjUserTrackingGUI:
+ Collaboration diagram for ilObjUserTrackingGUI:

Public Member Functions

 ilObjUserTrackingGUI ($a_data, $a_id, $a_call_by_reference)
executeCommand ()
 execute command
 getAdminTabs (&$tabs_gui)
 administration tabs show only permissions and trash folder
 getTabs (&$tabs_gui)
 get tabs abstract method.
 settingsObject ()
 display tracking settings form
 saveSettingsObject ()
 save user tracking settings
 manageDataObject ()
 display tracking settings form
 confirmDeletionDataObject ()
 confirm delete tracking data
 cancelDeleteDataObject ()
 cancel deletion of tracking data
 deleteDataObject ()
 delete tracking data
 trackingDataQueryFormObject ()
 display tracking query form
 showForm ()
 outputTrackingDataObject ()
 output tracking data
 getCondition ()
 get complete condition string
 getObjectCondition ()
 get object condition string
 getLanguageCondition ()
 get language condition string
 getSearchTermsCondition ()
 get language condition string
 setConditions ($con)
 getConditions ()
 numDay ($from, $to)
 Return the nums of days between 'from' and 'to'.
 numHour ($from, $to)
 Return the nums of hours between 'from' and 'to'.
 addHour ($time)
 Add one hour to the 'time' and return it.
 addDay ($time)
 Add one day to the 'time' and return it.
 selectTime ($from, $to, $condition, $searchTermsCondition="", $objectCondition="")
 Get the access time between 'from' to 'to' and under the 'condition'.
 countNum ($from, $from1, $condition, $searchTermsCondition="", $objectCondition="")
 Get the access num between 'from' to 'from1' and under the 'condition'.
- Public Member Functions inherited from ilObjectGUI
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor public.
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not)
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui
 getCreationMode ()
 get creation mode
 getHTML ()
 undeleteObject ()
 Get objects back from trash.
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled
 cancelDeleteObject ()
 cancel deletion of object
 removeFromSystemObject ()
 remove objects from trash bin and all entries therefore every object needs a specific deleteObject() method
 cancelObject ($in_rep=false)
 cancel action and go back to previous page public
 createObject ()
 create new object form
 cancelCreation ()
 cancel create action and go back to repository parent
 saveObject ()
 save object
 editObject ()
 edit object
 updateObject ()
 updates object entry in object_data
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g.
 isVisible ($a_ref_id, $a_type)
 viewObject ()
 list childs of current object
 deleteObject ($a_error=false)
 Display deletion confirmation screen.
 trashObject ()
 Show trash content of object.
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl.
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI.
 copyWizardHasOptions ($a_mode)
 Check if there is any modules specific option.

Data Fields

 $conditions
 Constructor public.
 $tpl = null
 $ilErr = null
 $lng = null
 $ctrl = null
- Data Fields inherited from ilObjectGUI
const COPY_WIZARD_NEEDS_PAGE = 1
 $ilias
 $objDefinition
 $tpl
 $tree
 $lng
 $data
 $object
 $ref_id
 $obj_id
 $maxcount
 $formaction
 $return_location
 $target_frame
 $tab_target_script
 $actions
 $sub_objects
 $omit_locator = false
const CFORM_NEW = 1
const CFORM_IMPORT = 2
const CFORM_CLONE = 3

Additional Inherited Members

- Protected Member Functions inherited from ilObjectGUI
 assignObject ()
 prepareOutput ()
 prepare output
 setTitleAndDescription ()
 called by prepare output
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu.
 insertHeaderAction ($a_list_gui)
 Insert header action into main template.
 addHeaderAction ()
 Add header action menu.
 redrawHeaderActionObject ()
 Ajax call: redraw action header only.
 showUpperIcon ()
 setTabs ()
 set admin tabs public
 setAdminTabs ()
 set admin tabs public
 setLocator ()
 set Locator
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded)
 omitLocator ($a_omit=true)
 addAdminLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded)
 initCreationForms ($a_new_type)
 Init creation froms.
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion)
 initCreateForm ($a_new_type)
 Init object creation form.
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types.
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates.
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen.
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position.
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook.
 initEditForm ()
 Init object edit form.
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form.
 getEditFormValues ()
 Get values for edit form.
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields.
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object.
 afterUpdate ()
 Post (successful) object update hook.
 initImportForm ($a_new_type)
 Init object import form.
 importFileObject ($parent_id=null)
 Import.
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook.
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g.
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g.
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu)
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste
 __showButton ($a_cmd, $a_text, $a_target= '')
 hitsperpageObject ()
__initTableGUI ()
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table
 __showClipboardTable ($a_result_set, $a_from="")
 redirectToRefId ($a_ref_id, $a_cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current $_GET["ref_id"] value
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning.
 getCenterColumnHTML ()
 Get center column.
 getRightColumnHTML ()
 Display right column.
 setColumnSettings ($column_gui)
 May be overwritten in subclasses.
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error.
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission.

Detailed Description

Definition at line 20 of file class.ilObjUserTrackingGUI.php.

Member Function Documentation

ilObjUserTrackingGUI::addDay (   $time)

Add one day to the 'time' and return it.

Definition at line 1504 of file class.ilObjUserTrackingGUI.php.

References $ret.

Referenced by outputTrackingDataObject().

{
$time = strtotime($time);
$day = date("d",$time);
$month = date("m",$time);
$year = date("y",$time);
$min = date("i",$time);
$hour = date("h",$time);
$sec = date("s",$time);
$day = $day + 1;
$ret = date ("Y-m-d", mktime($hour,$min,$sec,$month,$day,$year));
return $ret;
}

+ Here is the caller graph for this function:

ilObjUserTrackingGUI::addHour (   $time)

Add one hour to the 'time' and return it.

Definition at line 1487 of file class.ilObjUserTrackingGUI.php.

References $ret.

{
$time = strtotime($time);
$day = date("d",$time);
$month = date("m",$time);
$year = date("Y",$time);
$hour = date("H",$time);
$min = date("i",$time);
$sec = date("s",$time);
$hour = $hour+1;
$ret = date("H:i:s", mktime($hour,$min,$sec,$month,$day,$year));
return $ret;
}
ilObjUserTrackingGUI::cancelDeleteDataObject ( )

cancel deletion of tracking data

Definition at line 370 of file class.ilObjUserTrackingGUI.php.

{
$this->ctrl->redirect($this,'manageData');
}
ilObjUserTrackingGUI::confirmDeletionDataObject ( )

confirm delete tracking data

Definition at line 337 of file class.ilObjUserTrackingGUI.php.

References $_POST, $lng, and $tpl.

{
global $tpl, $lng, $rbacsystem;
if (!$rbacsystem->checkAccess('delete',$this->object->getRefId()))
{
$this->ilias->raiseError($this->lng->txt("msg_no_perm_delete_track"),$this->ilias->error_obj->WARNING);
}
if (!isset($_POST["month"]))
{
$this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
}
$nr = $this->object->getTotalOlderThanMonth($_POST["month"]);
$tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tracking_confirm_data_deletion.html");
#$tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
# "&cmd=gateway&month=".$_POST["month"]);
$this->ctrl->setParameter($this,'month',$_POST['month']);
$tpl->setVariable("FORMACTION",$this->ctrl->getFormaction($this,'gateway'));
$tpl->setVariable("TXT_CONFIRMATION", $this->lng->txt("tracking_data_del_confirm"));
$tpl->setVariable("TXT_MONTH", $lng->txt("month"));
$tpl->setVariable("VAL_MONTH", $_POST["month"]);
$tpl->setVariable("TXT_NUMBER_OF_RECORDS", $lng->txt("number_of_records"));
$tpl->setVariable("VAL_NUMBER_OF_RECORDS", $nr);
$tpl->setVariable("TXT_NUMBER_OF_ACC", $lng->txt("number_of_accesses"));
$tpl->setVariable("TXT_DELETE_DATA", $lng->txt("delete_tr_data"));
$tpl->setVariable("TXT_CANCEL", $lng->txt("cancel"));
}
ilObjUserTrackingGUI::countNum (   $from,
  $from1,
  $condition,
  $searchTermsCondition = "",
  $objectCondition = "" 
)

Get the access num between 'from' to 'from1' and under the 'condition'.

Definition at line 1543 of file class.ilObjUserTrackingGUI.php.

References $ilDB, and $res.

Referenced by outputTrackingDataObject().

{
global $ilDB;
$q = "SELECT id FROM ut_access"
.($searchTermsCondition != "" ? $searchTermsCondition : " WHERE ")
." (acc_time >= ".$ilDB->quote($from." 00:00:00", "timestamp")
." AND acc_time <= ".$ilDB->quote($from1." 00:00:00", "timestamp").")"
." AND ".$condition
.$objectCondition
." GROUP BY id";
$res = $this->ilias->db->query($q);
return $res->numRows();
}

+ Here is the caller graph for this function:

ilObjUserTrackingGUI::deleteDataObject ( )

delete tracking data

Definition at line 378 of file class.ilObjUserTrackingGUI.php.

References $_GET, and ilUtil\sendInfo().

{
global $rbacsystem;
if (!$rbacsystem->checkAccess('read',$this->object->getRefId()))
{
$this->ilias->raiseError($this->lng->txt("msg_no_perm_delete_track"),$this->ilias->error_obj->WARNING);
}
$this->object->deleteTrackingDataBeforeMonth($_GET["month"]);
ilUtil::sendInfo($this->lng->txt("tracking_data_deleted"),true);
$this->ctrl->redirect($this,'manageData');
#ilUtil::redirect("adm_object.php?ref_id=".$_GET["ref_id"]."&cmd=manageData");
}

+ Here is the call graph for this function:

& ilObjUserTrackingGUI::executeCommand ( )

execute command

Reimplemented from ilObjectGUI.

Definition at line 48 of file class.ilObjUserTrackingGUI.php.

References $cmd, $ret, LP_MODE_ADMINISTRATION, and ilObjectGUI\prepareOutput().

{
$next_class = $this->ctrl->getNextClass();
$this->ctrl->setReturn($this, "show");
$this->prepareOutput();
switch($next_class)
{
case 'ilpermissiongui':
include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
$perm_gui =& new ilPermissionGUI($this);
$ret =& $this->ctrl->forwardCommand($perm_gui);
break;
case 'illearningprogressgui':
$this->tabs_gui->setTabActive('learning_progress');
include_once("./Services/Tracking/classes/class.ilLearningProgressGUI.php");
$ret =& $this->ctrl->forwardCommand($lp_gui);
break;
case 'illpobjectstatisticsgui':
$this->tabs_gui->setTabActive('statistics');
include_once("./Services/Tracking/classes/class.ilLPObjectStatisticsGUI.php");
$ret =& $this->ctrl->forwardCommand($os_gui);
break;
default:
$cmd = $this->ctrl->getCmd();
if ($cmd == "view" || $cmd == "")
{
$cmd = "settings";
}
$cmd .= "Object";
$this->$cmd();
break;
}
return true;
}

+ Here is the call graph for this function:

ilObjUserTrackingGUI::getAdminTabs ( $tabs_gui)

administration tabs show only permissions and trash folder

Reimplemented from ilObjectGUI.

Definition at line 90 of file class.ilObjUserTrackingGUI.php.

References getTabs().

{
$this->getTabs($tabs_gui);
}

+ Here is the call graph for this function:

ilObjUserTrackingGUI::getCondition ( )

get complete condition string

Definition at line 1260 of file class.ilObjUserTrackingGUI.php.

References getLanguageCondition(), getObjectCondition(), and setConditions().

Referenced by outputTrackingDataObject().

{
$lang_cond = $this->getLanguageCondition();
//echo ":$lang_cond:";
if ($lang_cond == "")
{
return $this->getObjectCondition();
}
else
{
$this->setConditions($lang_cond." AND ".$this->getObjectCondition());
return $lang_cond." AND ".$this->getObjectCondition();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjUserTrackingGUI::getConditions ( )

Definition at line 1429 of file class.ilObjUserTrackingGUI.php.

References $conditions.

Referenced by outputTrackingDataObject().

{
}

+ Here is the caller graph for this function:

ilObjUserTrackingGUI::getLanguageCondition ( )

get language condition string

Definition at line 1389 of file class.ilObjUserTrackingGUI.php.

References $_POST, and $ilDB.

Referenced by getCondition().

{
global $ilDB;
if ($_POST["language"] != "0")
{
return "ut_access.language =".$ilDB->quote($_POST["language"], "text");
}
return "";
}

+ Here is the caller graph for this function:

ilObjUserTrackingGUI::getObjectCondition ( )

get object condition string

Definition at line 1280 of file class.ilObjUserTrackingGUI.php.

References $_POST, $ilDB, ilObjUserTracking\allAuthor(), and ilObjUserTracking\authorLms().

Referenced by getCondition().

{
global $ilDB;
$type = $_POST["object_type"];
$condition = "";
if($_POST["object_type"]=="lm")
{
if($_POST["author"]=="0")
{
return " acc_obj_type = 'lm'";
}
elseif($_POST["lm"]=="0" or $_POST["lm"]=="")
{
if (is_array($authors = ilObjUserTracking::allAuthor("usr","lm")))
{
foreach ($authors as $author)
{
if($author["title"]==$_POST["author"])
{
if (is_array($lms = ilObjUserTracking::authorLms($author["obj_id"],"lm")))
{
foreach ($lms as $lm)
{
$condition = $condition." or acc_obj_id = ".$lm["obj_id"];
}
}
}
}
}
return " ( 0 ".$condition." ) ";
}
else
{
$condition.= " acc_obj_id = ".ilObjUserTracking::getObjId($_POST["lm"],$type);
return $condition;
}
}
else if($_POST["object_type"]=="htlm")
{
if($_POST["author"]=="0")
{
return " acc_obj_type = 'htlm'";
}
elseif($_POST["htlm"]=="0" or $_POST["htlm"]=="")
{
if (is_array($authors = ilObjUserTracking::allAuthor("usr","htlm")))
{
foreach ($authors as $author)
{
if($author["title"]==$_POST["author"])
{
if (is_array($htlms = ilObjUserTracking::authorLms($author["obj_id"],"htlm")))
{
foreach ($htlms as $htlm)
{
$condition = $condition." or acc_obj_id = ".$htlm["obj_id"];
}
}
}
}
}
return " ( 0 ".$condition." ) ";
}
else
{
$condition.= " acc_obj_id = ".ilObjUserTracking::getObjId($_POST["htlm"],$type);
return $condition;
}
}
else
{
if($_POST["author1"]=="0")
{
return " acc_obj_type = 'tst'";
}
elseif($_POST["tst"]=="0" or $_POST["tst"]=="")
{
if (is_array($authors = ilObjUserTracking::allAuthor("usr","tst")))
{
foreach ($authors as $author)
{
if($author["title"]==$_POST["author1"])
{
if (is_array($lms = ilObjUserTracking::authorLms($author["obj_id"],"tst")))
{
foreach ($lms as $lm)
{
$condition = $condition." or acc_obj_id = ".$lm["obj_id"];
}
}
}
}
}
return " ( 0 ".$condition." ) ";
}
else
{
$condition.= " acc_obj_id = ".ilObjUserTracking::getObjId($_POST["tst"],$type);
return $condition;
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjUserTrackingGUI::getSearchTermsCondition ( )

get language condition string

Definition at line 1404 of file class.ilObjUserTrackingGUI.php.

References $_POST, $ilDB, and ilUtil\addSlashes().

Referenced by outputTrackingDataObject().

{
global $ilDB;
if (trim($_POST["search_terms"]) != "")
{
$sub_ret = "";
$terms = explode(" ", $_POST["search_terms"]);
for ($i = 0; $i < count($terms); $i++)
{
if (trim($terms[$i]) != "") $sub_ret .= "oa.title LIKE '%".ilUtil::addSlashes(trim($terms[$i]))."%' OR ";
}
if ($sub_ret != "")
{
return " INNER JOIN object_data oa ON oa.obj_id = acc_obj_id WHERE (".substr($sub_ret, 0, strlen($sub_ret)-4) . ") AND ";
}
}
return "";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjUserTrackingGUI::getTabs ( $tabs_gui)

get tabs abstract method.

overwrite in derived GUI class of your object type public

Parameters
objectinstance of ilTabsGUI

Reimplemented from ilObjectGUI.

Definition at line 95 of file class.ilObjUserTrackingGUI.php.

References ilObjUserTracking\_enabledLearningProgress(), and ilObjUserTracking\_enabledObjectStatistics().

Referenced by getAdminTabs().

{
global $rbacsystem;
$this->ctrl->setParameter($this,"ref_id",$this->ref_id);
if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
{
$tabs_gui->addTarget("settings",
$this->ctrl->getLinkTarget($this,
"settings"),
"settings",
get_class($this));
{
$tabs_gui->addTarget("statistics",
$this->ctrl->getLinkTargetByClass("illpobjectstatisticsgui",
"access"),
"",
"illpobjectstatisticsgui");
}
{
$tabs_gui->addTarget("learning_progress",
$this->ctrl->getLinkTargetByClass("illearningprogressgui",
"show"),
"",
"illearningprogressgui");
}
/*
$tabs_gui->addTarget("tracking_data",
$this->ctrl->getLinkTarget($this,
"trackingDataQueryForm"),
"trackingDataQueryForm",
get_class($this));
$tabs_gui->addTarget("manage_tracking_data",
$this->ctrl->getLinkTarget($this,
"manageData"),
"manageData",
get_class($this));
*/
$tabs_gui->addTarget("perm_settings",
$this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
array("perm","info","owner"),
'ilpermissiongui');
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjUserTrackingGUI::ilObjUserTrackingGUI (   $a_data,
  $a_id,
  $a_call_by_reference 
)

Definition at line 33 of file class.ilObjUserTrackingGUI.php.

References $ilCtrl, $ilErr, $lng, $tpl, and ilObjectGUI\ilObjectGUI().

{
$this->type = "trac";
$this->ilObjectGUI($a_data,$a_id,$a_call_by_reference, false);
$this->tpl =& $tpl;
$this->ilErr =& $ilErr;
$this->lng =& $lng;
$this->lng->loadLanguageModule('trac');
$this->ctrl =& $ilCtrl;
}

+ Here is the call graph for this function:

ilObjUserTrackingGUI::manageDataObject ( )

display tracking settings form

Definition at line 310 of file class.ilObjUserTrackingGUI.php.

References ilObjectGUI\$ilias, $lng, and $tpl.

{
global $tpl,$lng,$ilias;
// tracking settings
$tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tracking_manage_data.html");
$tpl->setVariable("FORMACTION",$this->ctrl->getFormaction($this,'gateway'));
$tpl->setVariable("TXT_TRACKING_DATA", $this->lng->txt("tracking_data"));
$tpl->setVariable("TXT_MONTH", $lng->txt("month"));
$tpl->setVariable("TXT_NUMBER_OF_ACC", $lng->txt("number_of_accesses"));
$tpl->setVariable("TXT_DELETE_OLDER", $lng->txt("delete"));
$overw = $this->object->getMonthTotalOverview();
foreach($overw as $month)
{
$tpl->setCurrentBlock("load_row");
$rcol = ($rcol != "tblrow1") ? "tblrow1" : "tblrow2";
$tpl->setVariable("ROWCOL", $rcol);
$tpl->setVariable("VAL_MONTH", $month["month"]);
$tpl->setVariable("VAL_NUMBER_OF_ACC", $month["cnt"]);
$tpl->parseCurrentBlock();
}
// $tpl->parseCurrentBlock();
}
ilObjUserTrackingGUI::numDay (   $from,
  $to 
)

Return the nums of days between 'from' and 'to'.

Definition at line 1437 of file class.ilObjUserTrackingGUI.php.

References $ret.

Referenced by outputTrackingDataObject().

{
$from = strtotime($from);
$to = strtotime($to);
$dayf = date ("d",$from);
$dayt = date ("d",$to);
$yearf = date ("Y",$from);
$yeart = date ("Y",$to);
$montht = date ("m",$to);
$monthf = date ("m",$from);
# $ret = ( mktime(0,0,0,$montht,$dayt,$yeart) - mktime(0,0,0,$monthf,$dayf,$yearf))/(3600*24);
# return $ret;
$from = mktime(12,0,0,$monthf,$dayf,$yearf);
$to = mktime(12,0,0,$montht,$dayt,$yeart);
$ret = (round(($to - $from) / 86400) + 1);
return $ret;
# $x0 = gregoriantojd($monthf,$dayf,$yearf);
# $x1 = gregoriantojd($montht,$dayt,$yeart);
# return (($x1 - $x0)+1);
}

+ Here is the caller graph for this function:

ilObjUserTrackingGUI::numHour (   $from,
  $to 
)

Return the nums of hours between 'from' and 'to'.

Definition at line 1467 of file class.ilObjUserTrackingGUI.php.

References $ret.

{
$from = strtotime($from);
$to = strtotime($to);
$dayf = date ("d",$from);
$dayt = date ("d",$to);
$yearf = date ("Y",$from);
$yeart = date ("Y",$to);
$montht = date ("m",$to);
$monthf = date ("m",$from);
$hourt = date ("h",$to);
$hourf = date ("h",$from);
$ret = (mktime($hourt,0,0,$montht,$dayt,$yeart)-mktime($hourf,0,0,$monthf,$dayf,$yearf))/3600;
$ret = strftime($ret);
return $ret;
}
ilObjUserTrackingGUI::outputTrackingDataObject ( )

output tracking data

Definition at line 653 of file class.ilObjUserTrackingGUI.php.

References $_POST, $_SESSION, ilObjectGUI\$data, ilObjectGUI\$ilias, $ilSetting, $lng, $tpl, ilFormat\_secondsToString(), addDay(), countNum(), getCondition(), getConditions(), getSearchTermsCondition(), numDay(), ilUtil\prepareFormOutput(), selectTime(), showForm(), and ilUtil\stripSlashes().

{
$TYPES = array(
'lm' => $lng->txt("lm"),
'htlm' => $lng->txt("htlm"),
'tst' => $lng->txt("test")
);
include_once "./Services/Table/classes/class.ilTableGUI.php";
if(!in_array($_POST["stat"], array("d", "h", "o", "u")))
{
$_POST["stat"] = "d";
}
if ($_POST["author"] == "") $_POST["author"] = "0";
if ($_POST["author1"] == "") $_POST["author1"] = "0";
// save selected values in session
$_SESSION["il_track_search_terms"] = ilUtil::stripSlashes($_POST["search_terms"]);
$_SESSION["il_track_yearf"] = $_POST["yearf"];
$_SESSION["il_track_yeart"] = $_POST["yeart"];
$_SESSION["il_track_monthf"] = $_POST["monthf"];
$_SESSION["il_track_montht"] = $_POST["montht"];
$_SESSION["il_track_dayf"] = $_POST["dayf"];
$_SESSION["il_track_dayt"] = $_POST["dayt"];
$_SESSION["il_track_stat"] = $_POST["stat"];
$_SESSION["il_track_language"] = $_POST["language"];
$_SESSION["il_track_author"] = $_POST["author"];
$_SESSION["il_track_author1"] = $_POST["author1"];
$_SESSION["il_track_lm"] = $_POST["lm"];
$_SESSION["il_track_htlm"] = $_POST["htlm"];
$_SESSION["il_track_tst"] = $_POST["tst"];
$_SESSION["il_object_type"] = $_POST["object_type"];
$yearf = $_POST["yearf"];
$monthf = $_POST["monthf"];
$dayf = $_POST["dayf"];
$yeart = $_POST["yeart"];
$montht= $_POST["montht"];
$dayt = $_POST["dayt"];
$from = date("Y-m-d", mktime(12, 0, 0, $monthf, $dayf, $yearf));
$to = date("Y-m-d", mktime(12, 0, 0, $montht, $dayt, $yeart));
if(($yearf > $yeart)or($yearf==$yeart and $monthf>$montht)or($yearf==$yeart and $monthf==$montht and $dayf>$dayt))
{
$this->ilias->raiseError($lng->txt("msg_err_search_time"),
$this->ilias->error_obj->MESSAGE);
}
$condition = $this->getCondition()." and acc_time >= '".$from." 00:00:00' and acc_time <= '".$to." 23:59:59'";
/*
if($_POST["stat"]!='h' and $_POST["stat"]!='d')
{
$this->ilias->raiseError($lng->txt("msg_no_search_time"),
$this->ilias->error_obj->MESSAGE);
}*/
$tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.tracking_result.html");
$tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
$tpl->setVariable("FORM", $this->showForm());
$objectCondition = "";
if (($max_acc_objects = $this->object->countResults($condition)) == 0)
{
$this->ilias->raiseError($lng->txt("msg_no_search_result"),
$this->ilias->error_obj->MESSAGE);
}
$max_hits = $ilias->getSetting('search_max_hits', 50);
if ($_POST["search_terms"] != "")
{
$tplTable =& new ilTemplate("tpl.table.html", true, true);
$tplTable->addBlockFile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html");
$tbl = new ilTableGUI(0, false);
$tbl->setTemplate($tplTable);
$searchTermsCondition = $this->getSearchTermsCondition();
$acc_object = $this->object->getAccessTotalPerObj($condition,$searchTermsCondition);
$max_acc_objects = count($acc_object);
if ($max_acc_objects < 1)
{
$this->ilias->raiseError($lng->txt("msg_no_search_result"),
$this->ilias->error_obj->MESSAGE);
}
else
{
$info = sprintf($lng->txt("info_found_objects"), $TYPES[$_POST["object_type"]]);
if ($max_hits < $max_acc_objects)
{
$info .= " ".sprintf($lng->txt("found_too_much_objects"), $max_hits);
unset($tmp);
for ($i = 0; $i < count($acc_object) && $i < $max_hits; $i++)
{
$tmp[$i] = $acc_object[$i];
}
$acc_object = $tmp;
$max_acc_objects = $max_hits;
}
$tpl->setVariable("INFO", $info);
}
$tbl->setTitle($lng->txt("found_objects"),0,0);
# if(($_POST["object_type"]=="lm" and $_POST["author"] == "0") or ($_POST["object_type"]=="tst" and $_POST["author1"] == "0"))
# {
$title_new = array("author", "subject", "total_dwell_time", "count","");
$tbl->setColumnWidth(array("20%", "30%", "20%", "10%", "*"));
# }
# else
# {
# $title_new = array("subject", "count","");
# $tbl->setColumnWidth(array("30%", "10%", "*"));
# }
foreach ($title_new as $val)
{
$header_names[] = $lng->txt($val);
}
$tbl->disable("sort");
$tbl->setHeaderNames($header_names);
$tbl->setMaxCount($max_acc_objects);
# $tbl->setStyle("table", "std");
$max = 0;
unset($ids);
for ($i = 0; $i < count($acc_object); $i++)
{
$max = ($max > $acc_object[$i]["cnt"]) ? $max : $acc_object[$i]["cnt"];
$ids[$i] = $acc_object[$i]["id"];
}
if (is_array($ids))
{
$objectCondition = " AND acc_obj_id IN (".implode(",", $ids).") ";
}
for ($i = 0; $i < count($acc_object); $i++)
{
unset($data);
# if(($_POST["object_type"]=="lm" and $_POST["author"]=="0") or ($_POST["object_type"]=="tst" and $_POST["author1"]=="0"))
# {
$data[0] = $acc_object[$i]["author"];
$data[1] = $acc_object[$i]["title"];
$data[2] = ilFormat::_secondsToString($acc_object[$i]["duration"]);
$data[3] = $acc_object[$i]["cnt"];
$width = ($max > 0)
? round($data[3] / $max * 100)
: 0;
$data[4] = "<img src=\"".ilUtil::getImagePath("ray.gif")."\" border=\"0\" ".
"width=\"".$width."\" height=\"10\"/>";
/* }
else
{
$data[0] = $obj["title"];
$data[1] = $obj["cnt"];
$width = ($max > 0)
? round($data[1] / $max * 100)
: 0;
$data[2] = "<img src=\"".ilUtil::getImagePath("ray.gif")."\" border=\"0\" ".
"width=\"".$width."\" height=\"10\"/>";
}*/
$css_row = $i%2==0?"tblrow1":"tblrow2";
foreach ($data as $key => $val)
{
if($val=="")
{
$val=0;
}
$tplTable->setCurrentBlock("text");
$tplTable->setVariable("TEXT_CONTENT", $val);
$tplTable->parseCurrentBlock();
$tplTable->setCurrentBlock("table_cell");
$tplTable->parseCurrentBlock();
} //foreach
$tplTable->setCurrentBlock("tbl_content");
$tplTable->setVariable("CSS_ROW", $css_row);
$tplTable->parseCurrentBlock();
} //for
$tbl->render();
$tpl->setVariable("OBJECTS_TABLE", $tplTable->get());
$tpl->setVariable("TXT_INFO_DWELL_TIME", $lng->txt("info_dwell_time"));
unset($tplTable);
unset($tbl);
}
else
{
$tpl->setVariable("INFO", sprintf($lng->txt("info_all_objects"), $TYPES[$_POST["object_type"]]));
}
if ($max_acc_objects > 0)
{
$tplTable =& new ilTemplate("tpl.table.html", true, true);
$tplTable->addBlockFile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html");
$tbl = new ilTableGUI(0, false);
$tbl->setTemplate($tplTable);
// user access statistic
if($_POST["stat"] == "u") // user access
{
if($_POST["mode"] == "user")
{
$tpl->setCurrentBlock("user_mode");
#$tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
#"&cmd=gateway");
$tpl->setVariable("FORMACTION",$this->ctrl->getFormaction($this,'gateway'));
if($_POST["object_type"]=="lm")
{
$tpl->setVariable("AUTHOR", "author");
$tpl->setVariable("AUTHORS", $_POST["author"]);
$tpl->setVariable("OBJECT", "lm");
$tpl->setVariable("OBJECTS", $_POST["lm"]);
}
else if($_POST["object_type"]=="htlm")
{
$tpl->setVariable("AUTHOR", "author");
$tpl->setVariable("AUTHORS", $_POST["author"]);
$tpl->setVariable("OBJECT", "htlm");
$tpl->setVariable("OBJECTS", $_POST["htlm"]);
}
else
{
$tpl->setVariable("AUTHOR", "author1");
$tpl->setVariable("AUTHORS", $_POST["author1"]);
$tpl->setVariable("OBJECT", "tst");
$tpl->setVariable("OBJECTS", $_POST["tst"]);
}
$tpl->setVariable("YEARF",$_POST["yearf"]);
$tpl->setVariable("MONTHF",$_POST["monthf"]);
$tpl->setVariable("DAYF",$_POST["dayf"]);
$tpl->setVariable("YEART",$_POST["yeart"]);
$tpl->setVariable("MONTHT",$_POST["montht"]);
$tpl->setVariable("DAYT",$_POST["dayt"]);
$tpl->setVariable("LAN", $_POST["language"]);
$tpl->setVariable("TYPE", $_POST["object_type"]);
$tpl->setVariable("SEARCH_TERMS", ilUtil::prepareFormOutput($_POST["search_terms"]));
$tpl->setVariable("FROM", $from);
$tpl->setVariable("TO", $to);
$tpl->setVariable("TXT_SHOW_USER_DATA", $lng->txt("user_statistics"));
$tpl->parseCurrentBlock();
$title_new = array("user","client_ip","language","object","time");
$condition = $this->getConditions()." and acc_time >= '".$from." 00:00:00' and acc_time <= '".$to." 23:59:59'";
$searchTermsCondition = $this->getSearchTermsCondition();
$user_acc = $this->object->getAccessPerUserDetail($condition, $searchTermsCondition, $objectCondition);
$this->maxcount = count($user_acc);
if ($this->maxcount < 1)
{
$this->ilias->raiseError($lng->txt("msg_no_search_result"),
$this->ilias->error_obj->MESSAGE);
}
# $tbl->setTitle($lng->txt("search_result"),0,0);
$tbl->setTitle($lng->txt("obj_trac").": ".$lng->txt("vm_access_of_users")." [".$lng->txt("details")."]",0,0);
unset($header_names);
foreach ($title_new as $val)
{
$header_names[] = $lng->txt($val);
}
$tbl->disable("sort");
$tbl->setHeaderNames($header_names);
$tbl->setColumnWidth(array("20%", "15%", "15%", "30%", "*"));
$tbl->setMaxCount($this->maxcount);
# $tbl->setStyle("table", "std");
$max = 0;
$i = 0;
foreach ($user_acc as $user)
{
unset($data);
$data[0] = $user["name"];
$data[1] = $user["client_ip"];
$data[2] = $user["language"];
$data[3] = $user["acc_obj_id"];
$data[4] = $user["acc_time"];
$css_row = $i%2==0?"tblrow1":"tblrow2";
foreach ($data as $key => $val)
{
if($val=="")
{
$val=0;
}
$tplTable->setCurrentBlock("text");
$tplTable->setVariable("TEXT_CONTENT", $val);
$tplTable->parseCurrentBlock();
$tplTable->setCurrentBlock("table_cell");
$tplTable->parseCurrentBlock();
} //foreach
$tplTable->setCurrentBlock("tbl_content");
$tplTable->setVariable("CSS_ROW", $css_row);
$tplTable->parseCurrentBlock();
$i++;
} //for
}
else
{
$tpl->setCurrentBlock("user_mode");
#$tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
#"&cmd=gateway");
$tpl->setVariable("FORMACTION",$this->ctrl->getFormaction($this,'gateway'));
if($_POST["object_type"]=="lm")
{
$tpl->setVariable("AUTHOR", "author");
$tpl->setVariable("AUTHORS", $_POST["author"]);
$tpl->setVariable("OBJECT", "lm");
$tpl->setVariable("OBJECTS", $_POST["lm"]);
}
else if($_POST["object_type"]=="htlm")
{
$tpl->setVariable("AUTHOR", "author");
$tpl->setVariable("AUTHORS", $_POST["author"]);
$tpl->setVariable("OBJECT", "htlm");
$tpl->setVariable("OBJECTS", $_POST["htlm"]);
}
else
{
$tpl->setVariable("AUTHOR", "author1");
$tpl->setVariable("AUTHORS", $_POST["author1"]);
$tpl->setVariable("OBJECT", "tst");
$tpl->setVariable("OBJECTS", $_POST["tst"]);
}
$tpl->setVariable("YEARF",$_POST["yearf"]);
$tpl->setVariable("MONTHF",$_POST["monthf"]);
$tpl->setVariable("DAYF",$_POST["dayf"]);
$tpl->setVariable("YEART",$_POST["yeart"]);
$tpl->setVariable("MONTHT",$_POST["montht"]);
$tpl->setVariable("DAYT",$_POST["dayt"]);
$tpl->setVariable("USER", "user");
$tpl->setVariable("LAN", $_POST["language"]);
$tpl->setVariable("TYPE", $_POST["object_type"]);
$tpl->setVariable("SEARCH_TERMS", ilUtil::prepareFormOutput($_POST["search_terms"]));
$tpl->setVariable("FROM", $from);
$tpl->setVariable("TO", $to);
$tpl->setVariable("TXT_SHOW_USER_DATA", $lng->txt("user_detail"));
$tpl->parseCurrentBlock();
$title_new = array("user", "count", "");
$searchTermsCondition = $this->getSearchTermsCondition();
$user_acc = $this->object->getAccessTotalPerUser($condition, $searchTermsCondition, $objectCondition);
$this->maxcount = count($user_acc);
// check if result is given
if ($this->maxcount < 1)
{
$this->ilias->raiseError($lng->txt("msg_no_search_result"),
$this->ilias->error_obj->MESSAGE);
}
# $tbl->setTitle($lng->txt("search_result"),0,0);
$tbl->setTitle($lng->txt("obj_trac").": ".$lng->txt("vm_access_of_users"),0,0);
unset($header_names);
foreach ($title_new as $val)
{
$header_names[] = $lng->txt($val);
}
$tbl->disable("sort");
$tbl->setHeaderNames($header_names);
$tbl->setColumnWidth(array("20%", "10%", "*"));
$tbl->setMaxCount($this->maxcount);
# $tbl->setStyle("table", "std");
$max = 0;
foreach ($user_acc as $user)
{
$max = ($max > $user["cnt"]) ? $max : $user["cnt"];
}
$i = 0;
foreach ($user_acc as $user)
{
unset($data);
$data[0] = $user["name"];
$data[1] = $user["cnt"];
$width = ($max > 0)
? round($data[1] / $max * 100)
: 0;
$data[2] = "<img src=\"".ilUtil::getImagePath("ray.gif")."\" border=\"0\" ".
"width=\"".$width."\" height=\"10\"/>";
$css_row = $i%2==0?"tblrow1":"tblrow2";
foreach ($data as $key => $val)
{
if($val=="")
{
$val=0;
}
$tplTable->setCurrentBlock("text");
$tplTable->setVariable("TEXT_CONTENT", $val);
$tplTable->parseCurrentBlock();
$tplTable->setCurrentBlock("table_cell");
$tplTable->parseCurrentBlock();
} //foreach
$tplTable->setCurrentBlock("tbl_content");
$tplTable->setVariable("CSS_ROW", $css_row);
$tplTable->parseCurrentBlock();
$i++;
} //for
}
}
else //user not selected
{
$title_new = array("time", "count", "");
# $tbl->setTitle($lng->txt("obj_trac"),0,0);
unset($header_names);
foreach ($title_new as $val)
{
$header_names[] = $lng->txt($val);
}
$tbl->disable("sort");
$tbl->setHeaderNames($header_names);
if($_POST["stat"]=='h') //hours of day
{
$tbl->setTitle($lng->txt("obj_trac").": ".$lng->txt("vm_times_of_day"),0,0);
$tbl->setColumnWidth(array("30%", "10%", "*"));
}
else
{
$tbl->setTitle($lng->txt("obj_trac").": ".$lng->txt("vm_days_of_period"),0,0);
$tbl->setColumnWidth(array("15%", "10%", "*"));
}
if($_POST["stat"]=='h')
{
$num = 24;
$tbl->setMaxCount($num);
}
else
{
$num = $this->numDay($from,$to);
$from1 = $this->addDay($from);
$tbl->setMaxCount($num);
}
# $tbl->setStyle("table", "std");
// contition
$condition = $this->getCondition();
if($_POST["stat"]=='h') //hours of day
{
$searchTermsCondition = $this->getSearchTermsCondition();
$time = $this->selectTime($from,$to,$condition,$searchTermsCondition,$objectCondition);
$max = 0;
for($i=0;$i<24;$i++)
{
$k = $i+1;
// count number of accesses in hour $i
$cou = 0;
for($j=0;$j<count($time);$j++)
{
$time1 = strtotime($time[$j][0]);
$day = date("d",$time1);
$month = date("m",$time1);
$year = date("Y",$time1);
$hour = date("H",$time1);
$min = date("i",$time1);
$sec = date("s",$time1);
$numb = date("H",mktime($hour,$min,$sec,$month,$day,$year));
$numb = intval($numb);
if($numb >=$i and $numb <$k)
{
$cou=$cou+1;
}
}
$count[$i] = $cou;
$max = ($cou > $max) ? $cou : $max;
}
for($i=0;$i<24;$i++)
{
$k = $i+1;
unset($data);
$data[0] = ($i < 10 ? "0".$i : $i).":00:00 ~ ".($k < 10 ? "0".$k : $k).":00:00";
$data[1] = $count[$i];
$width = ($max > 0)
? round($count[$i] / $max * 100)
: 0;
$data[2] = "<img src=\"".ilUtil::getImagePath("ray.gif")."\" border=\"0\" ".
"width=\"".$width."\" height=\"10\"/>";
$css_row = $i%2==0?"tblrow1":"tblrow2";
foreach ($data as $key => $val)
{
$tplTable->setCurrentBlock("text");
$tplTable->setVariable("TEXT_CONTENT", $val);
$tplTable->parseCurrentBlock();
$tplTable->setCurrentBlock("table_cell");
$tplTable->parseCurrentBlock();
}
$tplTable->setCurrentBlock("tbl_content");
$tplTable->setVariable("CSS_ROW", $css_row);
$tplTable->parseCurrentBlock();
} //for
}
else //day selected
{
$max = 0;
$searchTermsCondition = $this->getSearchTermsCondition();
for($i=0;$i<$num;$i++)
{
$fro[$i] = $from;
$cou[$i] = $this->countNum($from,$from1,$condition,$searchTermsCondition,$objectCondition);
$from = $from1;
$from1 = $this->addDay($from);
$max = ($max > $cou[$i]) ? $max : $cou[$i];
}
for($i=0;$i<$num;$i++)
{
unset($data);
$data[0] = $fro[$i];
$data[1] = $cou[$i];
$width = ($max > 0)
? round($cou[$i] / $max * 100)
: 0;
$data[2] = "<img src=\"".ilUtil::getImagePath("ray.gif")."\" border=\"0\" ".
"width=\"".$width."\" height=\"10\"/>";
$css_row = $i%2==0?"tblrow1":"tblrow2";
foreach ($data as $key => $val)
{
$tplTable->setCurrentBlock("text");
$tplTable->setVariable("TEXT_CONTENT", $val);
$tplTable->parseCurrentBlock();
$tplTable->setCurrentBlock("table_cell");
$tplTable->parseCurrentBlock();
}
$tplTable->setCurrentBlock("tbl_content");
$tplTable->setVariable("CSS_ROW", $css_row);
$tplTable->parseCurrentBlock();
} //for
}
}//else
$tbl->render();
$tpl->setVariable("TRACK_TABLE", $tplTable->get());
unset($tplTable);
unset($tbl);
}
// output statistic settings
/* $tpl->setCurrentBlock("adm_content");
$tpl->setVariable("TXT_TIME_PERIOD", $lng->txt("time_segment"));
switch ($_POST["stat"])
{
case "h":
$tpl->setVariable("TXT_STATISTIC", $lng->txt("hours_of_day"));
break;
case "u":
$tpl->setVariable("TXT_STATISTIC", $lng->txt("user_access"));
break;
case "d":
$tpl->setVariable("TXT_STATISTIC", $lng->txt("days_of_period"));
break;
case "o":
$tpl->setVariable("TXT_STATISTIC", $lng->txt("per_object"));
break;
}
$tpl->setVariable("VAL_DATEF", date("Y-m-d", mktime(0,0,0,$monthf,$dayf,$yearf)));
$tpl->setVariable("TXT_SEARCH_TERMS", $lng->txt("search_terms"));
$tpl->setVariable("VAL_SEARCH_TERMS", ilUtil::stripSlashes($_POST["search_terms"]));
$tpl->setVariable("TXT_TO", $lng->txt("to"));
$tpl->setVariable("VAL_DATET", date("Y-m-d", mktime(0,0,0,$montht,$dayt,$yeart)));
$tpl->setVariable("TXT_USER_LANGUAGE", $lng->txt("user_language"));
if ($_POST["language"] == "0")
{
$tpl->setVariable("VAL_LANGUAGE", $lng->txt("any_language"));
}
else
{
$tpl->setVariable("VAL_LANGUAGE", $lng->txt("lang_".$_POST["language"]));
}
$tpl->setVariable("TXT_TRACKED_OBJECTS", $lng->txt("tracked_objects"));
if ($_POST[$_POST["object_type"]] != 0)
{
$tpl->setVariable("VAL_TRACKED_OBJECTS",
ilObject::_lookupTitle($_POST[$_POST["object_type"]]));
}
else
{
$tpl->setVariable("VAL_TRACKED_OBJECTS",
$lng->txt("all_".$_POST["object_type"]."s"));
}
$tpl->parseCurrentBlock();*/
}

+ Here is the call graph for this function:

ilObjUserTrackingGUI::saveSettingsObject ( )

save user tracking settings

Definition at line 255 of file class.ilObjUserTrackingGUI.php.

References $_POST, ilObjUserTracking\EXTENDED_DATA_LAST_ACCESS, ilObjUserTracking\EXTENDED_DATA_READ_COUNT, ilObjUserTracking\EXTENDED_DATA_SPENT_SECONDS, ilUtil\sendFailure(), ilUtil\sendSuccess(), settingsObject(), UT_ACTIVE_BOTH, UT_ACTIVE_LP, UT_ACTIVE_UT, and UT_INACTIVE_BOTH.

{
// BEGIN ChangeEvent
if ($_POST['user_tracking'] == '1')
{
$activation_status = ($_POST['learning_progress_tracking'] == '1') ? UT_ACTIVE_BOTH : UT_ACTIVE_UT;
}
else
{
$activation_status = ($_POST['learning_progress_tracking'] == '1') ? UT_ACTIVE_LP : UT_INACTIVE_BOTH;
}
$this->object->setActivationStatus($activation_status);
$this->object->setChangeEventTrackingEnabled($_POST['change_event_tracking'] == '1');
// END ChangeEvent
if($_POST['learning_progress_tracking'] == '1')
{
$code = 0;
if($_POST['lp_access'] == '1')
{
}
if($_POST['lp_count'] == '1')
{
}
if($_POST['lp_spent'] == '1')
{
}
$this->object->setExtendedData($code);
}
$this->object->setObjectStatisticsEnabled((bool)$_POST["object_statistics"]);
$this->object->enableUserRelatedData((int) !$_POST['user_related']);
$this->object->setValidTimeSpan($_POST['valid_request']);
if(!$this->object->validateSettings())
{
ilUtil::sendFailure($this->lng->txt('tracking_time_span_not_valid'));
$this->settingsObject();
return false;
}
$this->object->updateSettings();
ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
$this->ctrl->redirect($this, "settings");
return true;
}

+ Here is the call graph for this function:

ilObjUserTrackingGUI::selectTime (   $from,
  $to,
  $condition,
  $searchTermsCondition = "",
  $objectCondition = "" 
)

Get the access time between 'from' to 'to' and under the 'condition'.

Definition at line 1521 of file class.ilObjUserTrackingGUI.php.

References $ilDB, $res, and $result.

Referenced by outputTrackingDataObject().

{
global $ilDB;
$q = "SELECT acc_time from ut_access "
.($searchTermsCondition != "" ? $searchTermsCondition : " WHERE ")
." (acc_time >= ".$ilDB->quote($from." 00:00:00", "timestamp")
." AND acc_time <= ".$ilDB->quote($to." 23:59:59", "timestamp").")"
." AND ".$condition
.$objectCondition
." GROUP BY acc_time";
$res = $this->ilias->db->query($q);
for($i=0;$i<$res->numRows();$i++)
{
$result[$i]=$res->fetchRow();
}
return $result;
}

+ Here is the caller graph for this function:

ilObjUserTrackingGUI::setConditions (   $con)

Definition at line 1425 of file class.ilObjUserTrackingGUI.php.

Referenced by getCondition().

{
$this->conditions = $con;
}

+ Here is the caller graph for this function:

ilObjUserTrackingGUI::settingsObject ( )

display tracking settings form

Definition at line 153 of file class.ilObjUserTrackingGUI.php.

References $ilErr, $valid, ilSubEnabledFormPropertyGUI\addSubItem(), ilObjUserTracking\EXTENDED_DATA_LAST_ACCESS, ilObjUserTracking\EXTENDED_DATA_READ_COUNT, ilObjUserTracking\EXTENDED_DATA_SPENT_SECONDS, ilCheckboxInputGUI\setChecked(), ilFormPropertyGUI\setInfo(), UT_ACTIVE_BOTH, and UT_ACTIVE_LP.

Referenced by saveSettingsObject().

{
global $rbacsystem;
if (!$rbacsystem->checkAccess('read',$this->object->getRefId()))
{
$ilErr->raiseError($this->lng->txt("msg_no_perm_read_track"),$ilErr->WARNING);
}
$this->tabs_gui->setTabActive('settings');
include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->lng->txt('tracking_settings'));
$activate = new ilCheckboxGroupInputGUI($this->lng->txt('activate_tracking'));
$form->addItem($activate);
$lp = new ilCheckboxInputGUI($this->lng->txt('trac_learning_progress'), 'learning_progress_tracking');
$lp->setInfo($this->lng->txt('trac_learning_progress_settings_info'));
$activate->addSubItem($lp);
/*
$tracking = new ilCheckboxInputGUI($this->lng->txt('trac_user_activities'), 'user_tracking');
$activate->addSubItem($tracking);
*/
$event = new ilCheckboxInputGUI($this->lng->txt('trac_repository_changes'), 'change_event_tracking');
$activate->addSubItem($event);
$objstat = new ilCheckboxInputGUI($this->lng->txt('trac_object_statistics'), 'object_statistics');
$activate->addSubItem($objstat);
/*
if($this->object->getActivationStatus() == UT_ACTIVE_BOTH ||
$this->object->getActivationStatus() == UT_ACTIVE_UT)
{
$tracking->setChecked(true);
}
*/
if($this->object->getActivationStatus() == UT_ACTIVE_BOTH ||
$this->object->getActivationStatus() == UT_ACTIVE_LP)
{
$lp->setChecked(true);
}
if($this->object->isChangeEventTrackingEnabled())
{
$event->setChecked(true);
}
if($this->object->isObjectStatisticsEnabled())
{
$objstat->setChecked(true);
}
$access = new ilCheckboxInputGUI($this->lng->txt('trac_first_and_last_access'), 'lp_access');
if($this->object->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_LAST_ACCESS))
{
$access->setChecked(true);
}
$lp->addSubItem($access);
$read = new ilCheckboxInputGUI($this->lng->txt('trac_read_count'), 'lp_count');
if($this->object->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_READ_COUNT))
{
$read->setChecked(true);
}
$lp->addSubItem($read);
$spent = new ilCheckboxInputGUI($this->lng->txt('trac_spent_seconds'), 'lp_spent');
if($this->object->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_SPENT_SECONDS))
{
$spent->setChecked(true);
}
$lp->addSubItem($spent);
// Anonymized
$user = new ilCheckboxInputGUI($this->lng->txt('trac_anonymized'), 'user_related');
$user->setInfo($this->lng->txt('trac_anonymized_info'));
$user->setChecked(!$this->object->_enabledUserRelatedData());
$form->addItem($user);
// Max time gap
$valid = new ilNumberInputGUI($this->lng->txt('trac_valid_request'), 'valid_request');
$valid->setMaxLength(4);
$valid->setSize(4);
$valid->setSuffix($this->lng->txt('seconds'));
$valid->setInfo($this->lng->txt('info_valid_request'));
$valid->setValue($this->object->getValidTimeSpan());
$form->addItem($valid);
$form->addCommandButton('saveSettings', $this->lng->txt('save'));
$this->tpl->setContent($form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjUserTrackingGUI::showForm ( )

Definition at line 405 of file class.ilObjUserTrackingGUI.php.

References $_SESSION, ilObjectGUI\$ilias, $lng, $tpl, ilObjUserTracking\_enabledUserRelatedData(), and ilUtil\prepareFormOutput().

Referenced by outputTrackingDataObject(), and trackingDataQueryFormObject().

{
global $lng,$ilias;
for ($i = 2004; $i <= date("Y"); $i++) $year[] = $i;
$month = array(1,2,3,4,5,6,7,8,9,10,11,12);
$day = array(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);
//subject module
$tpl = new ilTemplate("tpl.tracking_form.html", true, true);
// Tabs gui
$this->tabs_gui->setTabActive('tracking_data');
{
$tpl->setCurrentBlock("user_stat");
$tpl->setVariable("TXT_VIEW_MODE_U", $lng->txt("vm_access_of_users"));
if ($_SESSION["il_track_stat"] == "u")
{
$tpl->setVariable("U_SEL", "selected");
}
$tpl->parseCurrentBlock();
}
//$tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
#$tpl->setVariable("SEARCH_ACTION", "adm_object.php?ref_id=".$_GET["ref_id"].
# "&cmd=gateway");
$tpl->setVariable("SEARCH_ACTION",$this->ctrl->getFormaction($this,'gateway'));
$tpl->setVariable("TXT_TRACKING_DATA", $lng->txt("tracking_data"));
$tpl->setVariable("TXT_SEARCH_TERMS", $lng->txt("search_terms"));
$tpl->setVariable("VAL_SEARCH_TERMS", ilUtil::prepareFormOutput($_SESSION["il_track_search_terms"], true));
$tpl->setVariable("TXT_TIME_SEGMENT", $lng->txt("time_segment"));
$tpl->setVariable("TXT_VIEW_MODE", $lng->txt("view_mode"));
$tpl->setVariable("TXT_VIEW_MODE_H", $lng->txt("vm_times_of_day"));
$tpl->setVariable("TXT_VIEW_MODE_D", $lng->txt("vm_days_of_period"));
$tpl->setVariable("TXT_USER_LANGUAGE",$lng->txt("user_language"));
$tpl->setVariable("TXT_LM",$lng->txt("lm"));
$tpl->setVariable("TXT_HTLM",$lng->txt("htlm"));
# $tpl->setVariable("TXT_TST",$lng->txt("test"));
$tpl->setVariable("TXT_SHOW_TR_DATA",$lng->txt("query_data"));
$tpl->setVariable("TXT_TRACKED_OBJECTS",$lng->txt("tracked_objects"));
$tpl->setVariable("TXT_FILTER_AREA",$lng->txt("trac_filter_area"));
$tpl->setVariable("TXT_CHANGE",$lng->txt("change"));
$languages = $lng->getInstalledLanguages();
// get all learning modules
// $lms = ilObject::_getObjectsDataForType("lm", true);
/* $authors = ilObjUserTracking::allAuthor("usr","lm");
if(count($authors)>0)
{
$tpl->setCurrentBlock("javascript");
$tpl->setVariable("ALL_LMS", $this->lng->txt("all_lms"));
foreach ($authors as $author)
{
$lms = ilObjUserTracking::authorLms($author["obj_id"],"lm");
//echo count($lms);
foreach ($lms as $lm)
{
$tpl->setCurrentBlock("select_value");
$tpl->setVariable("VALUE", $author["title"]);
$tpl->setVariable("LMVALUE", $lm["title"]);
$tpl->parseCurrentBlock();
}
}
$tpl->parseCurrentBlock();
}
$authors1 = ilObjUserTracking::allAuthor("usr","tst");
if(count($authors1)>0)
{
$tpl->setCurrentBlock("javascript1");
$tpl->setVariable("ALL_TSTS", $this->lng->txt("all_tsts"));
foreach ($authors1 as $author1)
{
$tsts = ilObjUserTracking::authorLms($author1["obj_id"],"tst");
foreach ($tsts as $tst)
{
$tpl->setCurrentBlock("select_value1");
$tpl->setVariable("VALUE1", $author1["title"]);
$tpl->setVariable("TSTVALUE", $tst["title"]);
$tpl->parseCurrentBlock();
}
}
$tpl->parseCurrentBlock();
}*/
if ($_SESSION["il_track_yearf"] == "") $_SESSION["il_track_yearf"] = date("Y");
if ($_SESSION["il_track_yeart"] == "") $_SESSION["il_track_yeart"] = date("Y");
if ($_SESSION["il_track_montht"] == "") $_SESSION["il_track_montht"] = date("m");
if ($_SESSION["il_track_dayt"] == "") $_SESSION["il_track_dayt"] = date("d");
foreach($year as $key)
{
$tpl->setCurrentBlock("fromyear_selection");
$tpl->setVariable("YEARFR", $key);
$tpl->setVariable("YEARF", $key);
if ($_SESSION["il_track_yearf"] == $key)
{
$tpl->setVariable("YEARF_SEL", " selected=\"1\" ");
}
$tpl->parseCurrentBlock();
}
foreach($month as $key)
{
$tpl->setCurrentBlock("frommonth_selection");
$tpl->setVariable("MONTHFR", $key);
$tpl->setVariable("MONTHF", $key);
if ($_SESSION["il_track_monthf"] == $key)
{
$tpl->setVariable("MONTHF_SEL", " selected=\"1\" ");
}
$tpl->parseCurrentBlock();
}
foreach($day as $key)
{
$tpl->setCurrentBlock("fromday_selection");
$tpl->setVariable("DAYFR", $key);
$tpl->setVariable("DAYF", $key);
if ($_SESSION["il_track_dayf"] == $key)
{
$tpl->setVariable("DAYF_SEL", " selected=\"1\" ");
}
$tpl->parseCurrentBlock();
}
foreach($day as $key)
{
$tpl->setCurrentBlock("today_selection");
$tpl->setVariable("DAYTO", $key);
$tpl->setVariable("DAYT", $key);
if ($_SESSION["il_track_dayt"] == $key)
{
$tpl->setVariable("DAYT_SEL", " selected=\"1\" ");
}
$tpl->parseCurrentBlock();
}
foreach($month as $key)
{
$tpl->setCurrentBlock("tomonth_selection");
$tpl->setVariable("MONTHTO", $key);
$tpl->setVariable("MONTHT", $key);
if ($_SESSION["il_track_montht"] == $key)
{
$tpl->setVariable("MONTHT_SEL", " selected=\"1\" ");
}
$tpl->parseCurrentBlock();
}
foreach($year as $key)
{
$tpl->setCurrentBlock("toyear_selection");
$tpl->setVariable("YEARTO", $key);
$tpl->setVariable("YEART", $key);
if ($_SESSION["il_track_yeart"] == $key)
{
$tpl->setVariable("YEART_SEL", " selected=\"1\" ");
}
$tpl->parseCurrentBlock();
}
// language selection
$tpl->setCurrentBlock("language_selection");
$tpl->setVariable("LANG", $lng->txt("any_language"));
$tpl->setVariable("LANGSHORT", "0");
$tpl->parseCurrentBlock();
foreach ($languages as $lang_key)
{
$tpl->setCurrentBlock("language_selection");
$tpl->setVariable("LANG", $lng->txt("lang_".$lang_key));
$tpl->setVariable("LANGSHORT", $lang_key);
if ($_SESSION["il_track_language"] == $lang_key)
{
$tpl->setVariable("LANG_SEL", " selected=\"1\" ");
}
$tpl->parseCurrentBlock();
}
// statistic type
if (!in_array($_SESSION["il_track_stat"], array("d", "h", "o", "u"))) $_SESSION["il_track_stat"] = "d";
if ($_SESSION["il_track_stat"] == "d")
{
$tpl->setVariable("D_SEL", "selected");
}
elseif ($_SESSION["il_track_stat"] == "h")
{
$tpl->setVariable("H_SEL", "selected");
}
// tracked object type
$tpl->setVariable(strtoupper($_SESSION["il_object_type"])."_SEL", "selected");
// author selection
/* $tpl->setCurrentBlock("author_selection");
$tpl->setVariable("AUTHOR", 0);
$tpl->setVariable("AUTHOR_SELECT", $this->lng->txt("all_authors"));
$tpl->parseCurrentBlock();
foreach ($authors as $author)
{
$tpl->setCurrentBlock("author_selection");
$tpl->setVariable("AUTHOR", $author["title"]);
$tpl->setVariable("AUTHOR_SELECT", $author["title"]);
if ($_SESSION["il_track_author"] == $author["title"])
{
$tpl->setVariable("AUTHOR_SEL", " selected=\"1\" ");
}
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("author_selection_tst");
$tpl->setVariable("AUTHOR1", 0);
$tpl->setVariable("AUTHOR1_SELECT", $this->lng->txt("all_authors"));
$tpl->parseCurrentBlock();
foreach ($authors1 as $author1)
{
$tpl->setCurrentBlock("author_selection_tst");
$tpl->setVariable("AUTHOR1", $author1["title"]);
$tpl->setVariable("AUTHOR1_SELECT", $author1["title"]);
if ($_SESSION["il_track_author1"] == $author1["title"])
{
$tpl->setVariable("AUTHOR1_SEL", " selected=\"1\" ");
}
$tpl->parseCurrentBlock();
}
//test module
$result_test = ilObjUserTracking::getTestId($_SESSION["AccountId"]);
//$test = $tracking->TestTitle($_SESSION["AccountId"]);
$tsts = ilObject::_getObjectsDataForType($type, true);
$tpl->setCurrentBlock("test_selection");
$tpl->setVariable("TEST", 0);
$tpl->setVariable("TEST_SELECT", $this->lng->txt("all_tsts"));
$tpl->parseCurrentBlock();
foreach($tsts as $tst)
{
$tpl->setCurrentBlock("test_selection");
$tpl->setVariable("TEST", $tst["id"]);
$tpl->setVariable("TEST_SELECT", $tst["title"]." [".$tst["id"]."]");
$tpl->parseCurrentBlock();
}*/
return $tpl->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjUserTrackingGUI::trackingDataQueryFormObject ( )

display tracking query form

Definition at line 398 of file class.ilObjUserTrackingGUI.php.

References $tpl, and showForm().

{
global $tpl;
$tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.usr_tracking.html");
$tpl->setVariable("FORM", $this->showForm());
}

+ Here is the call graph for this function:

Field Documentation

ilObjUserTrackingGUI::$conditions

Constructor public.

Definition at line 26 of file class.ilObjUserTrackingGUI.php.

Referenced by getConditions().

ilObjUserTrackingGUI::$ctrl = null

Definition at line 31 of file class.ilObjUserTrackingGUI.php.

ilObjUserTrackingGUI::$ilErr = null

Definition at line 29 of file class.ilObjUserTrackingGUI.php.

Referenced by ilObjUserTrackingGUI(), and settingsObject().

ilObjUserTrackingGUI::$lng = null

The documentation for this class was generated from the following file: