diff --git a/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc
index 575626165251341721be9b18f95388cc4bf8fef2..5dc1d254d956f6c082a76d3cc77fe95bc5699a87 100644 (file)
protected $visible_for = HIDDEN_EVENT;
+ protected $periodType = "days";
+ protected $periodValue = 7;
+ protected $activate_periodical_job = FALSE;
+
protected $attributes = array("timestamp");
function set_type($type)
$this->timestamp = $this->_event_to_timestamp($data['TIMESTAMP']);
}
}
+
+ if(isset($data['PERIODIC']) && !preg_match("/none/i",$data['PERIODIC'])){
+ $tmp = explode("_",$data['PERIODIC']);
+ if(count($tmp) == 2){
+ $this->activate_periodical_job = TRUE;
+ $this->periodValue = $tmp[0];
+ $this->periodType = $tmp[1];
+ }
+ }
}
$seconds[$e] = $e;
}
+ $periodTypes = array(
+ "minutes" => _("Minutes"),
+ "hours" => _("Hours"),
+ "days" => _("Days"),
+ "weeks" => _("Weeks"),
+ "months" => _("Months"));
+
+
+ $smarty->assign("periodTypes", $periodTypes);
+ $smarty->assign("periodType", $this->periodType);
+ $smarty->assign("periodValue", $this->periodValue);
+ $smarty->assign("activate_periodical_job", $this-> activate_periodical_job);
+
$smarty->assign("years", $years);
$smarty->assign("months", $months);
$smarty->assign("days", $days);
/*! \brief Returns HTML content, displaying a dialog which allows to add new targets.
- @return String HTML content. (EventTargetAddList)
+ @return String HTML content. (EventAddSystemDialog)
*/
public function get_target_add_list()
{
$this->target_add_list_used = TRUE;
if($this->target_divlist == NULL){
- $this->target_divlist = new EventTargetAddList($this->config,$this);
+ $this->target_divlist = new EventAddSystemDialog($this->config,$this);
}
- $this->target_divlist->execute();
$smarty = get_smarty();
- $smarty->assign("divlist",$this->target_divlist->Draw());
+ $smarty->assign("divlist",$this->target_divlist->execute());
return($smarty->fetch(get_template_path('target_list.tpl', TRUE, dirname(__FILE__))));
}
$_POST['time_month'],
$_POST['time_day'],
$_POST['time_year']);
+
+ if(isset($_POST['periodValue'])) $this->periodValue = get_post('periodValue');
+ if(isset($_POST['periodType'])) $this->periodType = get_post('periodType');
+
+ if(isset($_POST['activate_periodical_job'])){
+ $this->activate_periodical_job = TRUE;
+ }else{
+ $this->activate_periodical_job = FALSE;
+ }
}
}
}
+ /*! \brief Returns a complete list of all available events.
+ @return Array Containing $this->get_event_info() for all available events.
+ */
+ static function get_event_types_by_category($categories)
+ {
+ $types= array();
+
+ foreach ($categories as $category) {
+ if (preg_match('/^users$/', $category)) {
+ $types= array_merge($types, DaemonEvent::get_event_types(USER_EVENT));
+ }
+ if (preg_match('/^systems$/', $category)) {
+ $types= array_merge($types, DaemonEvent::get_event_types(SYSTEM_EVENT));
+ }
+ }
+
+ return $types;
+ }
+
+
/*! \brief Returns a complete list of all available events.
@return Array Containing $this->get_event_info() for all available events.
*/
}elseif(isset($ret['timestamp'])){
unset($ret['timestamp']);
}
+
+ if(isset($ret['periodic'])){
+ unset($ret['periodic']);
+ }
+ if($this->activate_periodical_job){
+ $ret['periodic']= $this->periodValue."_".$this->periodType;
+ }
+
return($ret);
}
public function set_value($name,$value)
{
$name = strtolower($name);
- if(isset($this->$name) && in_array($name,$this->attributes)){
+ if(isset($this->$name) && in_array_strict($name,$this->attributes)){
$this->$name = $value;
}
}