<?php

/**
 * Description of User
 *
 * @author Arkadiusz Rychlik <a.rychlik at eppe.com.pl>
 */
class Users_Jqgrid_User extends Main_Users_Jqgrid_User {
	
	public $actions = array(
		'add' => null,
		'remove' => null,
		'edit' => null,
		'active' => null
	);

	protected function _renderColmodel() {
		$so = new stdClass();
		$so->defaultValue = '';
		$so->value = array('' => __('dowolnie'), 1 => __('prawda'), 0 => __('fałsz'));

		$columns = array();

		$columns[] = array(
			'name' => 'name',
			'label' => __('Nazwa')
		);

		$roles = R::$f->begin()
			->select('*')
			->from('role')
			->where('id != 1')
			->and('name != "anonymous"')
			->and('name != "user"')
			->and('name != "loggedin"')
			->order('BY id ASC')
			->get();


		foreach ($roles as $role) {
			$columns[] = array(
				'name' => $role['id'],
				'label' => __($role['name']),
				'custom_formatter' => 'boolean',
				'stype' => 'select',
				'searchoptions' => $so
			);
		}

		return $columns;
	}

}
