mirror of
https://github.com/joomla-extensions/jedchecker.git
synced 2024-12-25 11:40:00 +00:00
#1 - now there is a check if archives or tmp files have been uploaded and we don't show the
unzip or check buttons until we have files to work on!
This commit is contained in:
parent
02e00f92ba
commit
8572baf028
@ -17,7 +17,7 @@ class jedcheckerControllerUploads extends JController
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->path = JFactory::getConfig()->get('tmp_path') . '/jed_checker';
|
$this->path = JFactory::getConfig()->get('tmp_path') . '/jed_checker';
|
||||||
$this->pathArchive = $this->path . '/arhives';
|
$this->pathArchive = $this->path . '/archives';
|
||||||
$this->pathUnzipped = $this->path . '/unzipped';
|
$this->pathUnzipped = $this->path . '/unzipped';
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,28 @@ class jedcheckerViewUploads extends JView
|
|||||||
|
|
||||||
public function setToolbar()
|
public function setToolbar()
|
||||||
{
|
{
|
||||||
JToolBarHelper::custom('uploads.unzip', 'unzip', 'unzip', 'unzip', false);
|
if($this->filesExist('archives')) {
|
||||||
JToolBarHelper::custom('police.check', 'police-check', 'police-check', 'check', false);
|
JToolBarHelper::custom('uploads.unzip', 'unzip', 'unzip', 'unzip', false);
|
||||||
|
}
|
||||||
|
if($this->filesExist('unzipped')) {
|
||||||
|
JToolBarHelper::custom('police.check', 'police-check', 'police-check', 'check', false);
|
||||||
|
}
|
||||||
|
|
||||||
JToolBarHelper::title('JED checker');
|
JToolBarHelper::title('JED checker');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if folder + files exist in the jed_checker tmp path
|
||||||
|
* @param $type
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function filesExist($type) {
|
||||||
|
$path = JFactory::getConfig()->get('tmp_path') . '/jed_checker/'.$type;
|
||||||
|
if(JFolder::exists($path)) {
|
||||||
|
if(JFolder::folders($path, '.', false) || JFolder::files($path, '.', false)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user