31
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-05-29 03:40:47 +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:
Daniel Dimitrov 2012-06-24 09:50:50 +02:00
parent 02e00f92ba
commit 8572baf028
2 changed files with 23 additions and 3 deletions

View File

@ -17,7 +17,7 @@ class jedcheckerControllerUploads extends JController
public function __construct()
{
$this->path = JFactory::getConfig()->get('tmp_path') . '/jed_checker';
$this->pathArchive = $this->path . '/arhives';
$this->pathArchive = $this->path . '/archives';
$this->pathUnzipped = $this->path . '/unzipped';
parent::__construct();
}

View File

@ -34,8 +34,28 @@ class jedcheckerViewUploads extends JView
public function setToolbar()
{
JToolBarHelper::custom('uploads.unzip', 'unzip', 'unzip', 'unzip', false);
JToolBarHelper::custom('police.check', 'police-check', 'police-check', 'check', false);
if($this->filesExist('archives')) {
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');
}
/**
* 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;
}
}