OpenCart 🇺🇦

Схема

protected mixed getForm ( )

Аргументы

Аргумент Возможный тип Описание
У метода нет аргументов

Описание

Метод пока еще не документирован.

Исходный код

$this->data['heading_title'] = $this->language->get('heading_title');

$this->data['text_select_all'] = $this->language->get('text_select_all');
$this->data['text_unselect_all'] = $this->language->get('text_unselect_all');

$this->data['entry_name'] = $this->language->get('entry_name');
$this->data['entry_access'] = $this->language->get('entry_access');
$this->data['entry_modify'] = $this->language->get('entry_modify');

$this->data['button_save'] = $this->language->get('button_save');
$this->data['button_cancel'] = $this->language->get('button_cancel');

if (isset($this->error['warning'])) {
	$this->data['error_warning'] = $this->error['warning'];
} else {
	$this->data['error_warning'] = '';
}

if (isset($this->error['name'])) {
	$this->data['error_name'] = $this->error['name'];
} else {
	$this->data['error_name'] = '';
}

$url = '';

if (isset($this->request->get['sort'])) {
	$url .= '&sort=' . $this->request->get['sort'];
}

if (isset($this->request->get['order'])) {
	$url .= '&order=' . $this->request->get['order'];
}

if (isset($this->request->get['page'])) {
	$url .= '&page=' . $this->request->get['page'];
}

$this->data['breadcrumbs'] = array();

$this->data['breadcrumbs'][] = array(
	'text'      => $this->language->get('text_home'),
	'href'      => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
	'separator' => false
);

$this->data['breadcrumbs'][] = array(
	'text'      => $this->language->get('heading_title'),
	'href'      => $this->url->link('user/user_permission', 'token=' . $this->session->data['token'] . $url, 'SSL'),
	'separator' => ' :: '
);

if (!isset($this->request->get['user_group_id'])) {
	$this->data['action'] = $this->url->link('user/user_permission/insert', 'token=' . $this->session->data['token'] . $url, 'SSL');
} else {
	$this->data['action'] = $this->url->link('user/user_permission/update', 'token=' . $this->session->data['token'] . '&user_group_id=' . $this->request->get['user_group_id'] . $url, 'SSL');
}

$this->data['cancel'] = $this->url->link('user/user_permission', 'token=' . $this->session->data['token'] . $url, 'SSL');

if (isset($this->request->get['user_group_id']) && $this->request->server['REQUEST_METHOD'] != 'POST') {
	$user_group_info = $this->model_user_user_group->getUserGroup($this->request->get['user_group_id']);
}

if (isset($this->request->post['name'])) {
	$this->data['name'] = $this->request->post['name'];
} elseif (!empty($user_group_info)) {
	$this->data['name'] = $user_group_info['name'];
} else {
	$this->data['name'] = '';
}

$ignore = array(
	'common/home',
	'common/startup',
	'common/login',
	'common/logout',
	'common/forgotten',
	'common/reset',			
	'error/not_found',
	'error/permission',
	'common/footer',
	'common/header'
);

$this->data['permissions'] = array();

$files = glob(DIR_APPLICATION . 'controller/*/*.php');

foreach ($files as $file) {
	$data = explode('/', dirname($file));

	$permission = end($data) . '/' . basename($file, '.php');

	if (!in_array($permission, $ignore)) {
		$this->data['permissions'][] = $permission;
	}
}

if (isset($this->request->post['permission']['access'])) {
	$this->data['access'] = $this->request->post['permission']['access'];
} elseif (isset($user_group_info['permission']['access'])) {
	$this->data['access'] = $user_group_info['permission']['access'];
} else { 
	$this->data['access'] = array();
}

if (isset($this->request->post['permission']['modify'])) {
	$this->data['modify'] = $this->request->post['permission']['modify'];
} elseif (isset($user_group_info['permission']['modify'])) {
	$this->data['modify'] = $user_group_info['permission']['modify'];
} else { 
	$this->data['modify'] = array();
}

$this->template = 'user/user_group_form.tpl';
$this->children = array(
	'common/header',
	'common/footer'
);

$this->response->setOutput($this->render());