-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
70fd479
commit 05400f6
Showing
11 changed files
with
202 additions
and
3 deletions.
There are no files selected for viewing
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
17 changes: 17 additions & 0 deletions
17
app/WebModule/components/ILectorsContentControlFactory.php
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace App\WebModule\Components; | ||
|
||
|
||
/** | ||
* Factory komponenty s přehledem lektorů. | ||
* | ||
* @author Jan Staněk <[email protected]> | ||
*/ | ||
interface ILectorsContentControlFactory | ||
{ | ||
/** | ||
* @return LectorsContentControl | ||
*/ | ||
public function create(); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace App\WebModule\Components; | ||
|
||
use App\Model\ACL\Role; | ||
use App\Model\ACL\RoleRepository; | ||
use App\Model\User\UserRepository; | ||
use Nette\Application\UI\Control; | ||
|
||
|
||
/** | ||
* Komponenta s přehledem lektorů. | ||
* | ||
* @author Jan Staněk <[email protected]> | ||
*/ | ||
class LectorsContentControl extends Control | ||
{ | ||
/** @var UserRepository */ | ||
private $userRepository; | ||
|
||
/** @var RoleRepository */ | ||
private $roleRepository; | ||
|
||
|
||
/** | ||
* UsersContentControl constructor. | ||
* @param UserRepository $userRepository | ||
* @param RoleRepository $roleRepository | ||
*/ | ||
public function __construct(UserRepository $userRepository, RoleRepository $roleRepository) | ||
{ | ||
parent::__construct(); | ||
|
||
$this->userRepository = $userRepository; | ||
$this->roleRepository = $roleRepository; | ||
} | ||
|
||
/** | ||
* @param $content | ||
*/ | ||
public function render($content) | ||
{ | ||
$template = $this->template; | ||
$template->setFile(__DIR__ . '/templates/lectors_content.latte'); | ||
|
||
$template->heading = $content->getHeading(); | ||
$template->lectors = $this->userRepository->findAllInRole($this->roleRepository->findBySystemName(Role::LECTOR)); | ||
|
||
$template->render(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<div class="lectors-content"> | ||
<div class="row"> | ||
<div class="col-sm-12"> | ||
<h3 n:ifcontent>{$heading}</h3> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col-sm-12"> | ||
{foreach $lectors as $lector} | ||
<h4>{$lector->getDisplayName()}</h4> | ||
<div class="well"> | ||
<table class="table table-form"> | ||
<tr> | ||
<td> | ||
{if $lector->getPhoto()} | ||
<img src="{$basePath}/files/user_photos/{$lector->getPhoto()}"/> | ||
{/if} | ||
</td> | ||
<td> | ||
<table class="table table-form" style="background-color: transparent"> | ||
<col class="col-sm-3 col-xs-3"> | ||
<col class="col-sm-9 col-xs-9"> | ||
|
||
{if $lector->getAbout()} | ||
<tr> | ||
<th >{_web.lectors_content.about_me}</th> | ||
<td>{$lector->getAbout()}</td> | ||
</tr> | ||
{/if} | ||
|
||
{if $lector->getLecturersBlocks()->count() > 0} | ||
<tr> | ||
<th>{_web.lectors_content.blocks}</th> | ||
<td> | ||
<ul class="no-bullets no-margin"> | ||
{foreach $lector->getLecturersBlocks() as $block} | ||
<li> | ||
<strong>{$block->getName()}</strong> | ||
{if $block->getPerex()} | ||
- | ||
{$block->getPerex()} | ||
{/if} | ||
</li> | ||
{/foreach} | ||
</ul> | ||
</td> | ||
</tr> | ||
{/if} | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
</div> | ||
{/foreach} | ||
</div> | ||
</div> | ||
</div> |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace App\Model\CMS\Content; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
|
||
/** | ||
* Entita obsahu se seznamem lektorů. | ||
* | ||
* @author Jan Staněk <[email protected]> | ||
* @ORM\Entity | ||
* @ORM\Table(name="lectors_content") | ||
*/ | ||
class LectorsContent extends Content implements IContent | ||
{ | ||
protected $type = Content::LECTORS; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace Migrations; | ||
|
||
use Doctrine\DBAL\Migrations\AbstractMigration; | ||
use Doctrine\DBAL\Schema\Schema; | ||
|
||
/** | ||
* Auto-generated Migration: Please modify to your needs! | ||
*/ | ||
class Version20170823205705 extends AbstractMigration | ||
{ | ||
/** | ||
* @param Schema $schema | ||
*/ | ||
public function up(Schema $schema) | ||
{ | ||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); | ||
|
||
$this->addSql('CREATE TABLE lectors_content (id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); | ||
$this->addSql('ALTER TABLE lectors_content ADD CONSTRAINT FK_5B02C449BF396750 FOREIGN KEY (id) REFERENCES content (id) ON DELETE CASCADE'); | ||
} | ||
|
||
/** | ||
* @param Schema $schema | ||
*/ | ||
public function down(Schema $schema) | ||
{ | ||
} | ||
} |