Skip to content

Instantly share code, notes, and snippets.

View beinoriusju's full-sized avatar
🏠
Working from home

Justinas Bei beinoriusju

🏠
Working from home
View GitHub Profile
<?php
/*
* Empty
*/
class ControllerExtensionModuleAgeRestriction extends Controller {
private $error = array();
public function index() {
}
private function addModule() {
$this->load->model('setting/module');
$this->model_setting_module->addModule('age_restriction', [
'name' => 'Age Restriction (21)',
'message' => 'Are you %s and older?',
'age' => 21,
'redirect_url' => 'http://www.example.org',
'status' => 1 /* Enabled by default*/
]);
public function index() {
if (!isset($this->request->get['module_id'])) {
$module_id = $this->addModule();
$this->response->redirect($this->url->link('extension/module/age_restriction','&user_token='.$this->session->data['user_token'].'&module_id='.$this->db->getLastId()));
} else {
$this->editModule($this->request->get['module_id']);
}
}
<?php
class ControllerExtensionModuleAgeRestriction extends Controller {
private $error = array();
public function index() {}
public function validate() {}
public function install() {}
<?php
$_['heading_title'] = 'Age Restriction Module';
<?php
class ControllerExtensionModuleAgeRestriction extends Controller {
const DEFAULT_MODULE_SETTINGS = [
'name' => 'Age Restriction (21)',
'message' => 'Are you %s and older?',
'age' => 21,
'redirect_url' => 'http://www.example.org',
'status' => 1 /* Enabled by default*/
];
@beinoriusju
beinoriusju / age_restriction.twig
Last active April 10, 2018 12:08
age_restriction.twig
{{ header }}{{ column_left }}
<div id="content">
<h2>It works!</h2>
{#
<div>message: {{ message }}</div>
<div>age: {{ age }}</div>
<div>redirect url: {{ redirect_url }}</div>
</div> #}
{{ footer }}
<?php
// Heading
$_['heading_title'] = 'Age Restriction Module';
// Text
$_['text_extension'] = 'Extensions';
$_['text_success'] = 'Success: You have modified banner module!';
$_['text_edit'] = 'Edit Age Restriction Module';
// Entry
{{ header }}{{ column_left }}
<div id="content">
<div class="page-header">
<div class="container-fluid">
<div class="pull-right">
<button type="submit" form="form-module" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button>
<a href="{{ action.cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
<h1>{{ heading_title }}</h1>
<ul class="breadcrumb">
{% for breadcrumb in breadcrumbs %}
<?php
class ControllerExtensionModuleAgeRestriction extends Controller {
const DEFAULT_MODULE_SETTINGS = [
'name' => 'Age Restriction (21)',
'message' => 'Are you %s and older?',
'age' => 21,
'redirect_url' => 'http://www.example.org',
'status' => 1 /* Enabled by default*/
];