<?php

/**
 * Generated: 2014-03-24 15:01:35
 * @author Rtn_Module_Tool
 */
class Forms_Jqgrid_Admin_Index extends Rtn_JqGrid {

	public $beanName = 'forms';
	public $actions = array(
	    'add' => null,
	    'remove' => null,
	    'edit' => null,
	    'active' => null,
	    'show' => null,
	);
    public $sortname = 'data';
    public $url_create;

	protected function _renderColmodel() {
		$columns[] = [
		    'name' => 'name',
		    'label' => __('Nazwa'),
		];
		$columns[] = [
		    'name' => 'data',
		    'label' => __('Data'),
		];
		$columns[] = [
		    'name' => 'emails',
		    'label' => __('Emaile'),
		];
		$columns[] = [
		    'name' => 'store',
		    'label' => __('Zapis do BD'),
		];
		return $columns;
	}
	
	protected function _extraTransformRow($row, $bean) {
		$row['store'] = $row['store'] ? 'Tak' : 'Nie';
		
		return $row;
	}
	
	protected function setUrls() {
		$module = $this->controller->getRequest()->getModuleName();
		$controller = $this->controller->getRequest()->getControllerName();

		$helper = new Zend_View_Helper_Url();

		if (array_key_exists('add', $this->actions))
			$this->url_add = $helper->url(array('module' => $module, 'controller' => $controller, 'action' => 'add'));
		if (array_key_exists('clone', $this->actions))
			$this->url_clone = $helper->url(array('module' => $module, 'controller' => $controller, 'action' => 'clone', 'id' => false));
		if (array_key_exists('remove', $this->actions))
			$this->url_remove = $helper->url(array('module' => $module, 'controller' => $controller, 'action' => 'ajax-remove', 'id' => false), 'default', true);
		if (array_key_exists('show', $this->actions))
			$this->url_show = $helper->url(array('module' => $module, 'controller' => 'admin_history', 'action' => 'index', 'id' => false));
		if (array_key_exists('edit', $this->actions))
			$this->url_edit = $helper->url(array('module' => $module, 'controller' => $controller, 'action' => 'edit', 'id' => false));
		if (array_key_exists('export', $this->actions))
			$this->url_export = $helper->url(array('module' => $module, 'controller' => $controller, 'action' => 'export', 'id' => false));
		if (array_key_exists('active', $this->actions))
			$this->url_active = $helper->url(array('module' => $module, 'controller' => $controller, 'action' => 'ajax-toggle-active', 'id' => false));
		if (array_key_exists('refresh', $this->actions))
			$this->url_refresh = $helper->url(array('module' => $module, 'controller' => $controller, 'action' => 'ajax-refresh', 'id' => false));
		if (array_key_exists('reorder', $this->actions))
			$this->url_reorder = $helper->url(array('module' => $module, 'controller' => $controller, 'action' => 'ajax-reorder'));
		if (array_key_exists('replace', $this->actions))
			$this->url_replace = $helper->url(array('module' => $module, 'controller' => $controller, 'action' => 'ajax-replace'));
		$this->url = $helper->url(array('module' => $module, 'controller' => $controller, 'action' => 'ajax-load-datagrid'));
	}

}
