Skip to content
Snippets Groups Projects
Commit 78acf1b9 authored by jaapjansma's avatar jaapjansma
Browse files
parents f20608e5 b8047b83
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ class CRM_Civirules_Delay_Factory {
*/
public static function getAllDelayClasses() {
return array(
new CRM_Civirules_Delay_XMinutes(),
new CRM_Civirules_Delay_XDays(),
new CRM_Civirules_Delay_XWeekDay(),
new CRM_Civirules_Delay_XWeekDayOfMonth(),
......
<?php
class CRM_Civirules_Delay_XMinutes extends CRM_Civirules_Delay_Delay {
protected $minuteOffset;
public function delayTo(DateTime $date) {
$date->modify("+ ".$this->minuteOffset." minutes");
return $date;
}
public function getDescription() {
return ts('Delay by a number of minutes');
}
public function getDelayExplanation() {
return ts('Delay action by %1 minutes', array(1 => $this->minuteOffset));
}
public function addElements(CRM_Core_Form &$form) {
$form->add('text', 'xminutes_minuteOffset', ts('Minutes'));
}
public function validate($values, &$errors) {
if (empty($values['xminutes_minuteOffset']) || !is_numeric($values['xminutes_minuteOffset'])) {
$errors['xminutes_minuteOffset'] = ts('You need to provide a number of minutess');
}
}
public function setValues($values) {
$this->minuteOffset = $values['xminutes_minuteOffset'];
}
}
\ No newline at end of file
<div class="label">{$form.xminutes_minuteOffset.label}</div>
<div class="content">{$form.xminutes_minuteOffset.html}</div>
<div class="clear"></div>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment