Skip to content
Snippets Groups Projects
Commit b8047b83 authored by Erik Hommel's avatar Erik Hommel
Browse files

added minutes delay

parent 6c98c680
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.
Finish editing this message first!
Please register or to comment