Skip to content

Commit

Permalink
odstanenie zavislosti na Nette\Object
Browse files Browse the repository at this point in the history
  • Loading branch information
Kollarovic committed May 26, 2019
1 parent 4827261 commit 98458a0
Show file tree
Hide file tree
Showing 7 changed files with 287 additions and 61 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"require": {
"php": ">=5.4.0",
"nette/nette": "~2.2",
"kollarovic/navigation": "~1.0",
"kollarovic/navigation": "~2.0",
"janmarek/webloader": "~2.4.0",
"nextras/forms": "~1.4.1"
},
Expand Down
213 changes: 182 additions & 31 deletions src/Kollarovic/Admin/AdminControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,6 @@
use Nette\Security\User;


/**
* @method AdminControl setTemplateFile(string $templateFile)
* @method AdminControl setPageTitle(string $pageTitle)
* @method AdminControl setSkin(string $skin)
* @method AdminControl setAdminName(string $adminName)
* @method AdminControl setUserName(string $userName)
* @method AdminControl setUserImage(string $userImage)
* @method AdminControl setPageName(string $pageName)
* @method AdminControl setContent(string $content)
* @method AdminControl setHeader(string $header)
* @method AdminControl setFooter(string $footer)
* @method AdminControl setNavbar(string $navbar)
* @method AdminControl setNavigationName(string $navigationName)
* @method AdminControl setProfileUrl(string $profileUrl)
* @method AdminControl setAjaxRequest($ajaxRequest)
*
* @method string getTemplateFile()
* @method string getPageTitle()
* @method string getSkin()
* @method string getAdminName()
* @method string getUserName()
* @method string getUserImage()
* @method string getPageName()
* @method string getContent()
* @method string getHeader()
* @method string getFooter()
* @method string getNavbar()
* @method string getNavigationName()
* @method string getProfileUrl()
* @method boolean isAjaxRequest()
*/
class AdminControl extends Control
{

Expand Down Expand Up @@ -110,6 +79,188 @@ function __construct(ItemsFactory $itemsFactory, ILoaderFactory $loaderFactory,
}


public function getTemplateFile()
{
return $this->templateFile;
}


public function setTemplateFile($templateFile)
{
$this->templateFile = $templateFile;
return $this;
}


public function getPageTitle()
{
return $this->pageTitle;
}


public function setPageTitle($pageTitle)
{
$this->pageTitle = $pageTitle;
return $this;
}


public function getSkin()
{
return $this->skin;
}


public function setSkin($skin)
{
$this->skin = $skin;
return $this;
}


public function getAdminName()
{
return $this->adminName;
}


public function setAdminName($adminName)
{
$this->adminName = $adminName;
return $this;
}


public function getUserName()
{
return $this->userName;
}


public function setUserName($userName)
{
$this->userName = $userName;
return $this;
}


public function getUserImage()
{
return $this->userImage;
}


public function setUserImage($userImage)
{
$this->userImage = $userImage;
return $this;
}


public function getPageName()
{
return $this->pageName;
}


public function setPageName($pageName)
{
$this->pageName = $pageName;
return $this;
}


public function getContent()
{
return $this->content;
}


public function setContent($content)
{
$this->content = $content;
return $this;
}


public function getHeader()
{
return $this->header;
}


public function setHeader($header)
{
$this->header = $header;
return $this;
}


public function getFooter()
{
return $this->footer;
}


public function setFooter($footer)
{
$this->footer = $footer;
return $this;
}


public function getNavbar()
{
return $this->navbar;
}


public function setNavbar($navbar)
{
$this->navbar = $navbar;
return $this;
}


public function getNavigationName()
{
return $this->navigationName;
}


public function setNavigationName($navigationName)
{
$this->navigationName = $navigationName;
return $this;
}


public function getProfileUrl()
{
return $this->profileUrl;
}


public function setProfileUrl($profileUrl)
{
$this->profileUrl = $profileUrl;
return $this;
}


public function isAjaxRequest()
{
return $this->ajaxRequest;
}


public function setAjaxRequest($ajaxRequest)
{
$this->ajaxRequest = $ajaxRequest;
return $this;
}


public function render(array $options = [])
{
$this->template->setFile($this->getTemplateFile());
Expand Down
3 changes: 1 addition & 2 deletions src/Kollarovic/Admin/Form/BaseFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

namespace Kollarovic\Admin\Form;

use Nette\Object;
use Nette\Forms\IFormRenderer;
use Nette\Localization\ITranslator;
use Nette\Application\UI\Form;


class BaseFormFactory extends Object implements IBaseFormFactory
class BaseFormFactory implements IBaseFormFactory
{

/** @var IFormRenderer */
Expand Down
30 changes: 22 additions & 8 deletions src/Kollarovic/Admin/LoaderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@

namespace Kollarovic\Admin;

use Nette\Object;
use Nette\Http\IRequest;
use WebLoader\Compiler;
use WebLoader\FileCollection;
use WebLoader\Nette\CssLoader;
use WebLoader\Nette\JavaScriptLoader;


/**
* @method array getFiles()
*
* @method LoaderFactory setOutputDir(string $outputDir)
* @method LoaderFactory setRoot(string $root)
*/
class LoaderFactory extends Object implements ILoaderFactory
class LoaderFactory implements ILoaderFactory
{


Expand All @@ -38,6 +31,7 @@ class LoaderFactory extends Object implements ILoaderFactory
/** @var array */
private $files = [];


function __construct($wwwDir, IRequest $httpRequest)
{
$this->wwwDir = $wwwDir;
Expand All @@ -46,6 +40,20 @@ function __construct($wwwDir, IRequest $httpRequest)
}


public function setOutputDir($outputDir)
{
$this->outputDir = $outputDir;
return $this;
}


public function setRoot($root)
{
$this->root = $root;
return $this;
}


public function addFile($file)
{
$this->files[$file] = $file;
Expand All @@ -60,6 +68,12 @@ public function removeFile($file)
}


public function getFiles()
{
return $this->files;
}


public function createCssLoader()
{
$fileCollection = $this->createFileCollection(array_filter($this->files, [$this, 'isCss']));
Expand Down
Loading

0 comments on commit 98458a0

Please sign in to comment.