// Exclude periods $exclude_periods = explode("\n", $profile['exclude_periods']); $z = 0; foreach ($exclude_periods as $period) { preg_match("\$([0-9.]+)=>([0-9.]+):([^:]+)\$", $period, $matches); if (count($matches) != 4) { continue; } list($period, $from, $to, $days) = $matches; $days = explode(',', $days); // DAYS SELECT $sel = new MultipleSelect('days' . $z++); $sel->setElements($daynames); $sel->setElementsVal(array('1', '2', '3', '4', '5', '6', '7')); foreach ($days as $day) { $sel->setSelected(trim($day)); } // Start hour $fields = array(new hourInputTpl('starthour[]'), new textTpl(_T('to', 'backuppc')), new hourInputTpl('endhour[]'), new textTpl(_T('on', 'backuppc')), $sel, new buttonTpl('removePeriod', _T('Remove', 'backuppc'), 'removePeriod')); $values = array(float2hhmm($from), '', float2hhmm($to), '', ''); $f->add(new TrFormElement(_T('Do not backup from', 'backuppc'), new multifieldTpl($fields)), array("value" => $values, "required" => True)); } // Add Period button $addPeriodBtn = new buttonTpl('addPeriod', _T('Add exclusion', 'backuppc')); $addPeriodBtn->setClass('btnPrimary'); $f->add(new TrFormElement('', $addPeriodBtn), array()); // If BackupProfile id is transmitten, we write it in the form if ($ID) { $f->add(new HiddenTpl("id"), array("value" => $ID, "hide" => True)); } elseif (isset($profile['id'])) { $f->add(new HiddenTpl("id"), array("value" => $profile['id'], "hide" => True));