config = &$config; $this->parent = &$parent; $this->filter = $filter; } function execute() { $smarty = get_smarty(); $smarty->assign('NAME',set_post($this->filter['NAME'])); $smarty->assign('DESC',set_post($this->filter['DESC'])); $smarty->assign('filterStr', $this->renderFilter()); return($smarty->fetch(get_template_path('filterEditor.tpl',TRUE,dirname(__FILE__)))); } function renderFilter() { $filter = $this->filter; $actions = array( "MOVE" => _("move mail to"), "COPY" => _("copy mail to"), "FORWARD" => _("forward message to"), "MARK" => _("mark mail as "), "DROP" => _("remove mail"), "REPLY" => _("reply")); $fields = array( 'subject' => _("Subject"), 'from'=> _("From"), 'body'=> _("Body"), 'date'=> _("Date"), 'priority'=> _("Priority"), 'status'=> _("Status"), 'to'=> _("To"), 'cc'=> _("CC"), 'age'=> _("Age"), 'size'=> _("Size")); $comparators = array( "is" => _("is"), "is not" => _("is not"), "equal" => _("is equal"), "not equal" => _("is not equal"), "is empty" => _("is empty"), "is not empty" => _("is not empty"), "contains" => _("contains"), "contains not" => _("does not contain"), "is in addressbook" => _("is in the addressbook"), "is not in addressbook" => _("is not in the addressbook"), "greater than" => _("is greater than"), "less than" => _("smaller than")); $cnt = count($filter['CONDITIONS']); $str = "

"._("Filter conditions")."

"; $str.= ""; $str .= "
"; $str .= "

"._("Filter actions")."

"; $str.= ""; return($str); } function save_object() { foreach($this->filter['CONDITIONS'] as $id => $value){ if(isset($_POST['cField_'.$id])){ $this->filter['CONDITIONS'][$id]['FIELD'] = get_post('cField_'.$id); } if(isset($_POST['cComparator_'.$id])){ $this->filter['CONDITIONS'][$id]['COMPARATOR'] = get_post('cComparator_'.$id); } if(isset($_POST['cMatch_'.$id])){ $this->filter['CONDITIONS'][$id]['MATCH'] = get_post('cMatch_'.$id); } } foreach($this->filter['ACTION'] as $id => $value){ if(isset($_POST['cAction_'.$id])){ $this->filter['ACTION'][$id]['ACTION'] = get_post('cAction_'.$id); } if(isset($_POST['cValue_'.$id])){ $this->filter['ACTION'][$id]['VALUE'] = get_post('cValue_'.$id); } } } } ?>