<?php if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } // @todo convert to template $project_id = (int) w2PgetParam($_GET, 'project_id', 0); $project = new CProject(); if (!$project->load($project_id)) { $AppUI->redirect(ACCESS_DENIED); } $canEdit = $project->canEdit(); $canDelete = $project->canDelete(); $tab = $AppUI->processIntState('ProjVwTab', $_GET, 'tab', 0); //TODO: is this different from the above checks for some reason? // Now check if the project is editable/viewable. $denied = $project->getDeniedRecords($AppUI->user_id); if (in_array($project_id, $denied)) { $AppUI->redirect(ACCESS_DENIED); } // get critical tasks (criteria: task_end_date) $criticalTasks = $project_id > 0 ? $project->getCriticalTasks($project_id) : null; // create Date objects from the datetime fields $end_date = intval($project->project_end_date) ? new w2p_Utilities_Date($project->project_end_date) : null; $actual_end_date = null; if (isset($criticalTasks)) { $actual_end_date = intval($criticalTasks[0]['task_end_date']) ? new w2p_Utilities_Date($criticalTasks[0]['task_end_date']) : null; } $style = $actual_end_date > $end_date && !empty($end_date) ? 'style="color:red; font-weight:bold"' : ''; // setup the title block $titleBlock = new w2p_Theme_TitleBlock('View Project', 'icon.png', $m);