Skip to content

Instantly share code, notes, and snippets.

View michalhisim's full-sized avatar
💭
Nutella

Michal Šimon michalhisim

💭
Nutella
View GitHub Profile
<?php
require_once(Application::MODELS . 'Menu.php');
/**
* Návrhový vzor Singleton => může existovat pouze jedna jediná instance.
*/
class Application{
private static $instance = false;
const APP = WEB_ROOT . 'app/';
@michalhisim
michalhisim / Tom.php
Last active December 12, 2015 02:18
Happy birthday Tom!
<?php
// Happy birthday Tom
class Tom extends Person{
public function runBirthday(){
$this->age++;
if($this->age == 18){
$this->acl->allow('doing own decisions');
@michalhisim
michalhisim / CathegoryPesenter.php
Created September 5, 2012 13:54
Nette formulář pro editaci a přidávání
<?php
class CathegoryPresenter extends BasePresenter{
protected function createComponentCathegoryForm() {
if ($this->params['id'] && $this->params['view'] == "edit") {
$values = $this->context->model->getCathegories(0, true)->where("id", $this->params['id'])->fetch()->toArray();
} else {
$values = array("id" => 0, "alias" => "", "name" => "", "root_id" => 0, "description" => "", "key_words" => "", "alt_names" => "");
}
@michalhisim
michalhisim / live-form-validation.js
Created December 8, 2011 18:56 — forked from redhead/live-form-validation.js
Live Form Validation for Nette 2.0
/**
* Live Form Validation for Nette 2.0
*
* @author Radek Ježdík, David Grudl
* @license New BSD License
*/
var LiveForm = {
options: {
controlErrorClass: 'form-control-error',