Пример #1
0
 /**
  * Tests getActivity() method
  */
 public function testGetActivity()
 {
     // Verify that invalid project ids throw exceptions
     try {
         ProjectActivity::getActivity("");
         $this->fail("Exception not thrown");
     } catch (ProjectActivityException $e) {
         // Expected
     }
     // Verify that invalid project ids throw exceptions
     try {
         ProjectActivity::getActivity("xfe");
         $this->fail("Exception not thrown");
     } catch (ProjectActivityException $e) {
         // Expected
     }
     // Verify that invalid project ids throw exceptions
     try {
         ProjectActivity::getActivity(null);
         $this->fail("Exception not thrown");
     } catch (ProjectActivityException $e) {
         // Expected
     }
     // non existant activity id.
     $obj = ProjectActivity::getActivity(1);
     $this->assertNull($obj);
     // create some activities
     $actList = $this->_getTestActivities();
     $this->_createActivites($actList);
     $obj = ProjectActivity::getActivity(2);
     $this->assertNotNull($obj);
     $this->assertTrue($obj instanceof ProjectActivity);
     $this->assertEquals($actList[$obj->getId()], $obj);
     // verify that deleted activites are returned as well
     $obj = ProjectActivity::getActivity(3);
     $this->assertNotNull($obj);
     $this->assertTrue($obj instanceof ProjectActivity);
     $this->assertTrue($obj->isDeleted());
     $this->assertEquals($actList[$obj->getId()], $obj);
     // non existant activity id (with entries in table)
     $obj = ProjectActivity::getActivity(5);
     $this->assertNull($obj);
 }
	    	<th></th>
	    	<th></th>
	    	<th></th>
			<th></th>
		</tr>
	</thead>
	<tbody>
		<?php 
    $customerObj = new Customer();
    $projectObj = new Projects();
    $projectActivityObj = new ProjectActivity();
    foreach ($pendingTimeEvents as $pendingTimeEvent) {
        $projectId = $pendingTimeEvent->getProjectId();
        $projectDet = $projectObj->fetchProject($projectId);
        $customerDet = $customerObj->fetchCustomer($projectDet->getCustomerId(), true);
        $projectActivities = $projectActivityObj->getActivity($pendingTimeEvent->getActivityId());
        ?>
		<tr>
			<td></td>
			<td ><?php 
        echo LocaleUtil::getInstance()->formatDateTime($pendingTimeEvent->getStartTime());
        ?>
</td>
			<td ><?php 
        echo "{$customerDet->getCustomerName()} - {$projectDet->getProjectName()}";
        ?>
</td>
			<td ><?php 
        echo "{$projectActivities->getName()}";
        ?>
</td>
echo $lang_Time_Timesheet_Decription;
?>
</th>
			<th class="tableMiddleRight"></th>
		</tr>
	</thead>
	<tbody>
		<?php 
$customerObj = new Customer();
$projectObj = new Projects();
$projectActivityObj = new ProjectActivity();
if (isset($timeExpenses) && is_array($timeExpenses)) {
    foreach ($timeExpenses as $timeExpense) {
        $projectId = $timeExpense->getProjectId();
        $projectDet = $projectObj->fetchProject($projectId);
        $projectActivity = $projectActivityObj->getActivity($timeExpense->getActivityId());
        $customerDet = $customerObj->fetchCustomer($projectDet->getCustomerId(), true);
        ?>
			<tr>
				<td class="tableMiddleLeft"></td>
				<td><?php 
        echo "{$customerDet->getCustomerName()} - {$projectDet->getProjectName()}";
        ?>
</td>
				<td><?php 
        echo $projectActivity->getName();
        ?>
</td>
				<td><?php 
        echo LocaleUtil::getInstance()->formatDate($timeExpense->getReportedDate());
        ?>
Пример #4
0
			<th width="80px" class="tableMiddleMiddle"><?php 
echo "{$lang_Common_Time} {$lang_Time_Timesheet_DurationUnits}";
?>
</th>
			<th class="tableMiddleRight"></th>
		</tr>
	</thead>
	<tbody>
		<?php 
if (is_array($report)) {
    $totalTime = 0;
    foreach ($report as $projectId => $projectTimeCost) {
        foreach ($projectTimeCost as $activityId => $activityTimeCost) {
            $projectDet = $projectObj->fetchProject($projectId);
            $customerDet = $customerObj->fetchCustomer($projectDet->getCustomerId(), true);
            $projectActivity = $projectActivityObj->getActivity($activityId);
            $totalTime += $activityTimeCost;
            ?>
		<tr>
			<td class="tableMiddleLeft"></td>
			<td ><?php 
            echo "{$customerDet->getCustomerName()} - {$projectDet->getProjectName()}";
            ?>
</td>
			<td ><?php 
            echo $projectActivity->getName();
            ?>
</td>
			<td ><?php 
            echo round($activityTimeCost / 36) / 100;
            ?>
Пример #5
0
 /**
  * View activity report
  */
 public function viewActivityReport()
 {
     $path = "/templates/time/activityReport.php";
     $timeEventObj = $this->objTime[0];
     $startDate = $this->objTime[1];
     $endDate = $this->objTime[2];
     $pageNo = $this->objTime[3];
     $projectId = $timeEventObj->getProjectId();
     $activityId = $timeEventObj->getActivityId();
     $time = $timeEventObj->getDuration();
     $returnUrl = '?timecode=Time&action=Project_Report_Define';
     if (!$this->authorizeObj->isAdmin() && !$this->authorizeObj->isProjectAdminOf($projectId)) {
         $this->redirect('UNAUTHORIZED_FAILURE', $returnUrl);
     }
     $projectObj = new Projects();
     $project = $projectObj->fetchProject($projectId);
     if (empty($project)) {
         $this->redirect('PROJECT_NOT_FOUND_FAILURE', $returnUrl);
     }
     $activity = ProjectActivity::getActivity($activityId);
     if (empty($activity)) {
         $this->redirect('ACTIVITY_NOT_FOUND_FAILURE', $returnUrl);
     }
     if ($projectId != $activity->getProjectId()) {
         $this->redirect('UNAUTHORIZED_FAILURE', $returnUrl);
     }
     $report = new ProjectReport();
     $count = $report->countEmployeesInActivity($projectId, $activityId, $startDate, $endDate);
     $empTimeArray = $report->getEmployeeActivityTime($projectId, $activityId, $startDate, $endDate, $pageNo);
     $dataArr[0] = $project;
     $dataArr[1] = $activity;
     $dataArr[2] = $startDate;
     $dataArr[3] = $endDate;
     $dataArr[4] = $empTimeArray;
     $dataArr[5] = $count;
     $dataArr[6] = $time;
     $dataArr[7] = $pageNo;
     $template = new TemplateMerger($dataArr, $path);
     $template->display();
 }