<?PHP
// Pushok's SEMA (Small Enterprise Management Application)
//
// Copyright (C) 2004 Pushok Software http://www.pushok.com
//
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
//! validate user's data and transmit it to kernel
function web_TimeTrackCreate(&$oIn, &$oOut)
{
if ( !is_array($oIn) )
return false;
if ( $oIn['step'] == 1 )
{
if ( !isset($oIn['post']['start']) || !strlen($oIn['post']['start']) )
web_AddErrorMsg($oOut, "You must specify 'Start'!");
if ( !isset($oIn['post']['work_volume']) || !strlen($oIn['post']['work_volume']) )
web_AddErrorMsg($oOut, "You must specify 'Work volume'!");
}
elseif ( $oIn['step'] == 2 )
{
$oIn['post']['idcontact_current'] = $_SESSION['iduser'];
$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_TIMETRACK_CREATE", $oIn['post'], $oOut);
}
return true;
}
function web_TimeTrackMenuCreate(&$oIn, &$oOut)
{
if ( !is_array($oIn) || !isset($oIn['idobject']) || !isset($oIn['type']) )
return false;
if ( $oIn['type'] == ID_SEMA_PROJECT || $oIn['type'] == ID_SEMA_TASK || $oIn['type'] == ID_SEMA_ISSUE )
{
$_oIn = array('idcontact'=>$_SESSION['iduser'], 'idobject'=>$oIn['idobject'], 'type'=>$oIn['type'], 'mask'=>'R');
$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_CONTACT_HAS_MASK", $_oIn, $_oOut);
if ( isset($_oOut['result']) && $_oOut['result'] )
$oOut[5][_LW('View time')] = "?page=/web/time_track/time_track_main.php&idparent=".$oIn['idobject'];
$_oIn = array('idcontact'=>$_SESSION['iduser'], 'idobject'=>$oIn['idobject'], 'type'=>$oIn['type'], 'mask'=>'2');
$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_CONTACT_HAS_MASK", $_oIn, $_oOut);
if ( isset($_oOut['result']) && $_oOut['result'] )
$oOut[10][_LW('Book time')] = "?page=/web/time_track/time_track_form.php&idparent=".$oIn['idobject'];
}
return true;
}
function web_TimeTrackActionMenuCreate(&$oIn, &$oOut)
{
if ( !is_array($oIn) || !isset($oIn['idobject']) || !isset($oIn['type']) )
return false;
if ( $oIn['type'] != ID_SEMA_TASK && $oIn['type'] != ID_SEMA_PROJECT && $oIn['type'] != ID_SEMA_ISSUE)
return true;
$_oIn = array('idcontact'=>$_SESSION['iduser'], 'idobject'=>$oIn['idobject'], 'type'=>$oIn['type'], 'mask'=>'2');
$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_CONTACT_HAS_MASK", $_oIn, $_oOut);
if ( isset($_oOut['result']) && $_oOut['result'] )
$oOut[10][_LW('+time')] = array('href'=>"?page=/web/time_track/time_track_form.php&idparent=".$oIn['idobject']);
return true;
}
?>