array_push($watchusers, array('name' => $tmp, 'is_selected' => $sel));
             }
             if (!$foundSel) {
                 // no or invalid user, just set superadmin by default
                 $user = GetSuperAdmin();
                 foreach ($watchusers as $k => $watchuser) {
                     if ($user == $watchuser['name']) {
                         $watchusers[$k]['is_selected'] = 1;
                     }
                 }
             }
             $tmpl->setloop('watch_users', $watchusers);
             // profiles
             if ($with_profiles) {
                 $profiles = GetProfilesByUserName($user, $profile);
                 $public_profiles = GetPublicProfiles($profile);
                 $tmpl->setloop('profiles', $profiles);
                 $tmpl->setloop('public_profiles', $public_profiles);
             }
             // checkdir
             $tmpl->setvar('checkdir', !$isRefresh || $checkdir ? 1 : 0);
         }
         $tmpl->setvar('watch_job_loaded', !$wasWatchError);
         // title-bar
         tmplSetTitleBar("Administration - Fluxd Watch - " . ($isNew ? "Add" : "Edit") . " Job");
     }
     break;
 case "deleteJob":
     $jobNumber = trim(tfb_getRequestVar('job'));
     if (empty($jobNumber)) {
         setWatchError('Error : No Job-Number.');
/**
 * setProfiledVars
 */
function transfer_setProfiledVars()
{
    global $cfg, $tmpl, $transfer, $transferLabel, $ch;
    // set vars for transfer
    if ($cfg['transfer_profiles'] <= 0) {
        $with_profiles = 0;
    } else {
        if ($cfg['transfer_profiles'] >= 2) {
            $with_profiles = 1;
        } else {
            $with_profiles = $cfg['isAdmin'] ? 1 : 0;
        }
    }
    if ($with_profiles == 0) {
        // set vars for transfer from ch
        transfer_setVarsFromCHSettings();
        $tmpl->setvar('useLastSettings', 1);
    } else {
        $profile = tfb_getRequestVar('profile');
        if ($profile != "" && $profile != "last_used") {
            // set vars for transfer from profile
            transfer_setVarsFromProfileSettings($profile);
            $tmpl->setvar('useLastSettings', 0);
            $tmpl->setvar('profile', $profile);
        } else {
            // set vars for transfer from ch
            transfer_setVarsFromCHSettings();
            $tmpl->setvar('useLastSettings', 1);
        }
        // load profile lists
        $profiles = $cfg['transfer_profiles'] >= 3 || $cfg['isAdmin'] ? GetProfiles($cfg["uid"], $profile) : array();
        $public_profiles = $cfg['transfer_profiles'] >= 2 || $cfg['isAdmin'] ? GetPublicProfiles($profile) : array();
        if (count($profiles) + count($public_profiles) > 0) {
            $tmpl->setloop('profiles', $profiles);
            $tmpl->setloop('public_profiles', $public_profiles);
        } else {
            $with_profiles = 0;
        }
    }
    $tmpl->setvar('with_profiles', $with_profiles);
}