Code

Put each class in a single file.
[gosa.git] / include / sieve / class_sieveElement_Redirect.inc
1 <?php
2 class sieve_redirect 
3 {
4   var $data = array();
5   var $object_id = -1;
7   function save_object()
8   {
9     if(isset($_POST['redirect_to_'.$this->object_id])){
10       $rt = stripslashes($_POST['redirect_to_'.$this->object_id]);
12       $rt = "\"".trim(preg_replace("/\"/","",$rt))."\"";
13       $this->data = $rt;
14     }
15   }
18   function sieve_redirect($data,$object_id)
19   {
20     foreach($data['ELEMENTS'] as $node ){
21       if(in_array($node['class'],array("quoted-string","text"))){
22         $this->data = $node['text'];
23       }
24     }
25   }
28   function get_sieve_script_part()
29   {
30     return("redirect ".sieve_create_strings($this->data).";\n");
31   } 
32    
33  
34   function execute()
35   {
36     $values = $this->data;
38     $smarty = get_smarty();
39     $smarty->assign("ID", $this->object_id);
40     $smarty->assign("Destinations" , $values);
41     $object_container = $smarty->fetch(get_template_path("templates/object_container.tpl",TRUE,dirname(__FILE__)));
42     $object= $smarty->fetch(get_template_path("templates/element_redirect.tpl",TRUE,dirname(__FILE__)));
43     $str = preg_replace("/%%OBJECT_CONTENT%%/",$object,$object_container);
44     return($str);
45   }
46 }
47 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
48 ?>