require 'includes/application_top.php';
// Check if user is logged in. If not, redirect to login page
if (!tep_not_null($_SESSION['employee'])) {
    tep_redirect(tep_href_link(FILENAME_LOGIN));
}
// Check if the user is allowed to view this page
if (!$_SESSION['employee']->profile->right['administration']) {
    tep_redirect(tep_href_link(FILENAME_DEFAULT));
}
switch ($_POST['action']) {
    case 'unlock_timesheet':
        $administration_timesheet = new timesheet($_POST['timesheets_id'], 0, null, false);
        $administration_timesheet->unlock();
        break;
    case 'lock_timesheet':
        $administration_timesheet = new timesheet($_POST['timesheets_id'], 0, null, false);
        $administration_timesheet->confirm();
        break;
}
// Clear all values except mPath and employees_id
foreach ($_POST as $key => $value) {
    if ($key != 'mPath' && $key != 'employees_id') {
        unset($_POST[$key]);
    }
}
// Create a new timesheet object with id == 0 (default)
$_SESSION['timesheet'] = new timesheet(0, $_POST['employees_id']);
// header //
require DIR_WS_INCLUDES . 'header.php';
?>
<!-- body //-->
Beispiel #2
0
		'theme' =>'white',
		'alpha_first' => 2005,
		'omega_base' => 12,
		'format' => $format
		);

$works = new timesheet($alpha, $args, $data );
$works->display();
</code></div>
<br>
<h3>Week</h3>
<?php 
$alpha = array('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun');
$data = array('free' => array(array('start' => '06-09', 'end' => '07-24')), 'work meeting' => array(array('start' => '01-09', 'end' => '01-12'), array('start' => '03-13', 'end' => '03-17'), array('start' => '05-13', 'end' => '05-16')), 'personnal work' => array(array('start' => '01-13', 'end' => '01-17'), array('start' => '02-13', 'end' => '02-17'), array('start' => '04-09', 'end' => '04-12')), 'sport' => array(array('start' => '04-13', 'end' => '04-18')), 'tv' => array(array('start' => '01-19', 'end' => '01-24'), array('start' => '02-19', 'end' => '02-24'), array('start' => '03-19', 'end' => '03-24'), array('start' => '04-19', 'end' => '04-24'), array('start' => '05-19', 'end' => '05-24')));
$args = array('id' => 'week', 'theme' => 'white', 'alpha_first' => 1, 'omega_base' => 15, 'omega_first' => 9, 'format' => null);
$week = new timesheet($alpha, $args, $data);
$week->display();
?>
<div class="code">
<code class="language-php">
$alpha =array('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun');

$data = array(
		'free' => array(
					array('start' => '06-09','end' => '07-24'),
					),
		'work meeting' => array(
					array('start' => '01-09','end' => '01-12'),
					array('start' => '03-13','end' => '03-17'),
					array('start' => '05-13','end' => '05-16'),
					),
Beispiel #3
0
            array_push($alpha, $date);
            $nbYear++;
        }
        $alpha_first = $firstYear;
        $omega_base = 12;
        $date_format = 'd M Y';
        $timesheet_format = 'Y-m-d';
    } else {
        $alpha = array('Janv', 'Fev', 'Mar', 'Avr', 'Mai', 'Jun', 'Juil', 'Août', 'Sept', 'Oct', 'Nov', 'Dec');
        $alpha_first = 1;
        $omega_base = 31;
        $date_format = 'd M';
        $timesheet_format = 'm-d';
    }
    $args = array('id' => 'year', 'theme' => 'white', 'alpha_first' => $alpha_first, 'omega_base' => $omega_base, 'format' => array("segment_des" => 'du %s au %s', "timesheet_format" => $timesheet_format, "date_format" => $date_format));
    $timeline = new timesheet($alpha, $args, $data);
    $timeline->display();
    ?>
		
	</div>
	<?php 
} else {
    ?>

		<div id="infoPodOrga" class="padding-10">
					<blockquote> 
					Create Gantt
						<br>Tasks 
						<br>Deadlines
						<br>Follows
						<br>To think, develop, build and shows next steps of the project to everyone
function postActualsSecured($db, $user, $tabPost, $timestamp)
{
    $storedTab = array();
    $storedTab = $_SESSION["timestamps"][$timestamp];
    if (isset($storedTab["YearWeek"])) {
        $yearWeek = $storedTab["YearWeek"];
    } else {
        return -1;
    }
    $storedTasks = array();
    if (isset($storedTab['tasks'])) {
        $storedTasks = $storedTab['tasks'];
    } else {
        return -1;
    }
    if (isset($storedTab['weekDays'])) {
        $storedWeekdays = $storedTab['weekDays'];
    } else {
        return -1;
    }
    $ret = 0;
    $_SESSION['timeSpendCreated'] = 0;
    $_SESSION['timeSpendDeleted'] = 0;
    $_SESSION['timeSpendModified'] = 0;
    /*
     * For each task store in matching the session timestamp
     */
    foreach ($storedTasks as $taskId => $taskItem) {
        //  $taskId=$taskItem["id"];
        $tasktimeIds = array();
        $tasktimeIds = $taskItem["taskTimeId"];
        $tasktime = new timesheet($db, $taskId);
        $tasktime->timespent_fk_user = $user;
        $tasktime->fetch($taskId);
        dol_syslog("Timesheet::Submit.php::postActualsSecured  task=" . $tasktime->id, LOG_DEBUG);
        //use the data stored
        //$tasktime->initTimeSheet($taskItem['weekWorkLoad'], $taskItem['taskTimeId']);
        //refetch actuals
        $tasktime->getActuals($yearWeek, $user);
        /*
         * for each day of the task store in matching the session timestamp
         */
        //foreach($taskItem['taskTimeId'] as $dayKey => $tasktimeid)
        foreach ($tabPost[$taskId] as $dayKey => $wkload) {
            dol_syslog("Timesheet::Submit.php::postActualsSecured  task = " . $taskId . " tabPost[" . $dayKey . "]=" . $wkload, LOG_DEBUG);
            $tasktimeid = $tasktimeIds[$dayKey];
            $ret += postTaskTimeActual($user, $tasktime, $tasktimeid, $wkload, $storedWeekdays[$dayKey]);
        }
    }
    unset($_SESSION["timestamps"][$timestamp]);
    return $ret;
}