|
@@ -160,26 +160,32 @@ class Pages extends Controller
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function Templates($f3)
|
|
|
|
|
|
|
+ public function Templates($f3, $args)
|
|
|
{
|
|
{
|
|
|
- $tplNameList = [];
|
|
|
|
|
|
|
+ global $frameworkUtils;
|
|
|
|
|
|
|
|
$fb_template = $this->findBoxCore->CallAPI('/1.0.0/index.php/smartesl.gettemplates/1.0.0/', '[]');
|
|
$fb_template = $this->findBoxCore->CallAPI('/1.0.0/index.php/smartesl.gettemplates/1.0.0/', '[]');
|
|
|
$templates = $this->findBoxCore->getLabelsFromResponse($fb_template);
|
|
$templates = $this->findBoxCore->getLabelsFromResponse($fb_template);
|
|
|
|
|
|
|
|
|
|
+ if ($args['clearcache'] == 1)
|
|
|
|
|
+ $frameworkUtils->rrmdir("fbtpl");
|
|
|
|
|
+
|
|
|
$tplFileNames = [];
|
|
$tplFileNames = [];
|
|
|
if ($templates != null) {
|
|
if ($templates != null) {
|
|
|
foreach($templates as $item) {
|
|
foreach($templates as $item) {
|
|
|
- $tplFileNames[] = "{$item['name']}.svg";
|
|
|
|
|
- if (!file_exists("fbtpl/{$item['name']}.svg"))
|
|
|
|
|
- $this->findBoxCore->GetTemplateImage($item['name']);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ $DTs = explode(',', $item['labeltypes']);
|
|
|
|
|
+ if (($args['dt'] != 0) && !in_array($args['dt'], $DTs))
|
|
|
|
|
+ continue;
|
|
|
|
|
+
|
|
|
|
|
+ if (!file_exists("fbtpl/{$item['template_id']}.svg"))
|
|
|
|
|
+ $this->findBoxCore->GetTemplateImage($item['template_id']);
|
|
|
|
|
+
|
|
|
|
|
+ $tplFileNames[$item['template_id']] = file_get_contents("fbtpl/{$item['template_id']}.svg");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
$f3->set('TPLPATH', $tplFileNames);
|
|
$f3->set('TPLPATH', $tplFileNames);
|
|
|
- $f3->set('PAGENAME', 'ESL Templates');
|
|
|
|
|
- $f3->set('CONTENT', 'templates.tpl');
|
|
|
|
|
- echo Template::instance()->render('masterpage.tpl');
|
|
|
|
|
|
|
+ echo Template::instance()->render('templates.tpl');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|