Documentation

Time Management

REST methods for Time Management module.


Note. Those methods are operational starting from Time Management module version 17.0.2.

Method Description Available from version
Basic methods
timeman.settings Returns current user workday settings. 17.0.2
timeman.status Returns information about current user workday. 17.0.2
timeman.open Starts new workday or continues closed or paused workday. 17.0.2
timeman.close Closes workday. 17.0.2
timeman.pause Pauses workday. 17.0.2
Office networks
timeman.networkrange.checkChecks if an IP address is included into the office network IP range. 18.5.0
timeman.networkrange.getGets the office network IP range.18.5.0
timeman.networkrange.setSets the office network IP range.18.5.0
Time Management
timeman.timecontrol.report.addSends report on detected workplace absence.18.5.0
timeman.timecontrol.reports.getGets report on detected absence cases.18.5.0
timeman.timecontrol.reports.settings.getGets user settings to create an interface for the time control report.18.5.0
timeman.timecontrol.reports.users.getGets a list of users included into the specified department.18.5.0
timeman.timecontrol.settings.getGets time control settings. 18.5.0
timeman.timecontrol.settings.setSets time control settings.18.5.0

Several examples

Examples of operating in the legacy core.

Confirmation of workday with positive rating at the page /timeman/work_report.php:

CModule::IncludeModule('timeman');

$ID = 8;
$arFields = array(
    "MARK" => "G", // "G" - positive, "B" - negative, "N" - no rating, "X" - without confirmation
);

if ($arFields["MARK"] != "X")
{
    $arFields["APPROVER"] = $USER->GetID();
    $arFields["APPROVE"] = "Y";
    $arFields["APPROVE_DATE"] = ConvertTimeStamp(time(), "FULL");
}
else
{
    $arFields["APPROVE"] = "N";
    $arFields["APPROVER"] = 0;
    $arFields["APPROVE_DATE"] = "";
}

$result = CTimeManReportFull::Update($ID, $arFields);
var_dump($result); 

Handling employee workday

CModule::IncludeModule('timeman');
$USER_ID = 1;
$report = "";
$obUser = new CTimeManUser($USER_ID);

$obUser->OpenDay($timestamp, $report); // open workday
$obUser->CloseDay($timestamp, $report); // close workday
$state = $oTimeManUser->State(); // find out workday status for user $USER_ID
$arInfo = $oTimeManUser->GetCurrentInfo(); // workday information about user $USER_ID

// Data about active task
CModule::IncludeModule('tasks');
$oTaskTimer = CTaskTimerManager::getInstance($USER_ID);
$rs = $oTaskTimer->getLastTimer(); 

© «Bitrix24», 2001-2022
Up