Example #1
0
if ($profile_names) {
    $count = count($profile_names);
    $n = new OptimizedListInfos($profile_names, _T("Fileset", "backuppc"));
    $n->setItemCount($count);
    $n->setNavBar(new AjaxNavBar($count, $filter1));
    $n->start = 0;
    $n->end = 50;
    $n->setParamInfo($params);
    // Setting url params
    $n->addActionItem($editAction);
    $n->addActionItemArray($delActions);
    $n->display();
}
// =========== PERIOD PROFILES =================================
print "<br/><h2>" . _T('Schedules', 'backuppc') . "</h2>";
$response = get_period_profiles();
$editAction = new ActionItem(_T("Edit profile", "backuppc"), "EditPeriodProfile", "edit", "profile", "backuppc", "backuppc");
$delAction = new ActionPopupItem(_T("Delete profile", "backuppc"), "deleteProfile", "delete", "profile", "backuppc", "backuppc");
$profile_names = array();
$editActions = array();
$delActions = array();
$params = array();
foreach ($response as $profile) {
    $profile_names[$profile['id']] = _T($profile['profilename'], 'backuppc');
}
asort($profile_names);
foreach ($profile_names as $pid => $pname) {
    $params[] = array('id' => $pid, 'type' => 1);
    // Delete and edit only for user defined profiles [id>=1000]
    //$editActions[] = ($pid<1000)? $emptyAction:$editAction;
    $delActions[] = $pid < 1000 ? $emptyAction : $delAction;
Example #2
0
$host = $_GET['objectUUID'];
$backup_profile_id = get_host_backup_profile($host);
$period_profile_id = get_host_period_profile($host);
if ($backup_profile_id == -1) {
    print _T("Host backup is not set.", 'backuppc');
    return;
}
$response = get_host_config($host);
// Check if error occured
if ($response['err']) {
    new NotifyWidgetFailure(nl2br($response['errtext']));
    return;
}
// Getting all avavaible profiles
$backup_profiles = get_backup_profiles();
$period_profiles = get_period_profiles();
// BackupPC config for this host
$host_config = $response['host_config'];
$f->add(new HiddenTpl("host"), array("value" => $host, "hide" => True));
// Backup Active
$f->add(new TrFormElement(_T("Enabled", "backuppc"), new CheckboxTpl('active')), array("value" => $host_config['BackupsDisable'] == '0' ? 'checked' : ''));
// BACKUP PROFILE SELECT FIELD
$sel = new SelectItem("backup_profile");
$list = array();
$list[0] = _T('Custom', 'backuppc');
foreach ($backup_profiles as $profile) {
    $list[intval($profile['id'])] = _T($profile['profilename'], 'backuppc');
}
$sel->setElements(array_values($list));
$sel->setElementsVal(array_keys($list));
$sel->setSelected($backup_profile_id);