<?
class admin_dialog_feeds extends admin_dialog {

var $params = array("target", "mode", "page", "id");


    function makeData() {
        parent::makeData();
        $this->feed = func_new("feed", $this->id);

        if($this->mode == "edit") {
            $this->form_fields = $this->feed->row;
        }
    }




    function action_update() {
        $feed = func_new("feed", $this->id);
        $feed->row["title"] = $_REQUEST["title"];
        $feed->row["icon"] = $_REQUEST["icon"];
        $feed->row["url"] = $_REQUEST["url"];
        $feed->update();
    }


    function action_add() {
        $feed = func_new("feed");
        $feed->row["title"] = $_REQUEST["title"];
        $feed->row["icon"] = $_REQUEST["icon"];
        $feed->row["url"] = $_REQUEST["url"];
        $feed->row["category_id"] = $_REQUEST["category_id"];
        $feed->create();
    }


    function action_delete() {
        if(isset($_REQUEST["ids"]) && is_array($_REQUEST["ids"])) {
            $n = func_new("feed");
            foreach($_REQUEST["ids"] as $k => $v) {
                $n->delete($k);
            }
        }
    }

}
?>