Created
April 26, 2012 18:02
-
-
Save patie/2501465 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Base class for all application presenters. | |
* | |
* @author John Doe | |
* @package MyApplication | |
*/ | |
abstract class BasePresenter extends Nette\Application\UI\Presenter | |
{ | |
protected function createComponentNavigation($name) | |
{ | |
$navigacia = new NavigationControl($this, $name); | |
return $navigacia; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Author: Patrik Gmitter <[email protected]> | |
* Date: 4/24/12 | |
*/ | |
namespace Model; | |
use Doctrine\ORM\Mapping as ORM, | |
Doctrine\ORM\Proxy, | |
Doctrine\Common\Collections; | |
/** | |
* @ORM\Entity | |
* @ORM\Table(name="blogcategory") | |
*/ | |
class BlogCategory extends \Nette\Object | |
{ | |
/** | |
* @ORM\Id | |
* @ORM\Column(type="integer") | |
* @ORM\GeneratedValue | |
*/ | |
protected $id; | |
/** | |
* @ORM\Column(type="integer", nullable=true) | |
*/ | |
protected $blogcategory_id; | |
/** | |
* @ORM\Column(type="string") | |
*/ | |
protected $title; | |
/** | |
* @ORM\Column(type="string") | |
*/ | |
protected $slug; | |
/** | |
* @ORM\Column(type="text") | |
*/ | |
protected $description; | |
/** | |
* @ORM\Column(type="integer") | |
*/ | |
protected $status; | |
/** | |
* @ORM\ManyToOne(targetEntity="BlogCategory", inversedBy="id", cascade={"persist", "remove"}) | |
* @ORM\JoinColumn(name="blogcategory_id", referencedColumnName="id", onDelete="CASCADE") | |
*/ | |
protected $parent; | |
/** | |
* @ORM\OneToMany(targetEntity="BlogCategory", mappedBy="parent", cascade={"persist", "remove"}, orphanRemoval=true) | |
* @ORM\OrderBy({"id" = "ASC"}) | |
*/ | |
protected $childrens; | |
public function __construct($name = "") | |
{ | |
parent::__construct(); | |
$this->childrens = new \Doctrine\Common\Collections\ArrayCollection(); | |
} | |
public function getId() | |
{ | |
return $this->id; | |
} | |
public function getTitle() | |
{ | |
return $this->title; | |
} | |
public function getChildrens() | |
{ | |
return $this->childrens; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* kategoria 1 | |
** podkategoria 1.1 | |
** podpodkategoria 1.2 | |
* kategoria 2 | |
* kategoria 3 | |
* kategoria 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{block #menu} | |
<ul class="control menu"> | |
<li n:foreach="$navigation as $item"> | |
{if count($item->childrens)>0 } | |
<span class="active"><strong>{$item->title}</strong></span> | |
{include #menu, navigation => $item->childrens} | |
{else} | |
<span class="active"><strong>{$item->title}</strong></span> | |
{/if} | |
</li> | |
</ul> | |
{/block} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment