$gui->grants = getGrants($db, $user, $userIsBlindFolded);
$gui->hasTestCases = false;
if ($gui->grants['view_tc']) {
    $gui->hasTestCases = $tproject_mgr->count_testcases($testprojectID) > 0 ? 1 : 0;
}
$gui->hasKeywords = false;
if ($gui->hasTestCases) {
    $gui->hasKeywords = $tproject_mgr->hasKeywords($testprojectID);
}
// ----- Test Plan Section --------------------------------------------------------------
/** 
 * @TODO - franciscom - we must understand if these two calls are really needed,
 * or is enough just call to getAccessibleTestPlans()
 */
$filters = array('plan_status' => ACTIVE);
$gui->num_active_tplans = $tproject_mgr->getActiveTestPlansCount($testprojectID);
//sizeof($tproject_mgr->get_all_testplans($testprojectID,$filters));
// get Test Plans available for the user
$arrPlans = $currentUser->getAccessibleTestPlans($db, $testprojectID);
if ($testplanID > 0) {
    // if this test plan is present on $arrPlans
    //	  OK we will set it on $arrPlans as selected one.
    // else
    //    need to set test plan on session
    //
    $index = 0;
    $found = 0;
    $loop2do = count($arrPlans);
    for ($idx = 0; $idx < $loop2do; $idx++) {
        if ($arrPlans[$idx]['id'] == $testplanID) {
            $found = 1;