<?php

class wpPersistenceManagerActions extends sfActions {
    public function executeAjaxAddItemToSelection($request) {
        wpPersistenceManager::addItemToSelection($request->getParameter('type'), $request->getParameter('id'));
        return sfView::NONE;
    }

    public function executeAjaxRemoveItemFromSelection($request) {
        wpPersistenceManager::removeItemFromSelection($request->getParameter('type'), $request->getParameter('id'));
        return sfView::NONE;
    }

    public function executeCleanSelection($request) {
        wpPersistenceManager::cleanSelection($request->getParameter('type'));
        return sfView::NONE;
    }

    public function executeAjaxIsItemSelected($request) {
        $this->is_item_selected = wpPersistenceManager::isItemSelected($request->getParameter('type'), $request->getParameter('id'));
    }

    public function executeAjaxGetSelectedItemCount($request) {
        $this->selected_item_count = wpPersistenceManager::getSelectedItemCount($request->getParameter('type'));
    }

    public function executeJs($request) {
        $this->getResponse()->setContentType('text/javascript');
        $this->setLayout(false);
    }
}