/var
/www
/clients
/client1
/web2
/web
/private
/beautycare
/libraries
/Frontend.php
$template = 'gamma-prodotti-' . $this->templateParameters['section'];
}
//più di una gamma
if($this->templateParameters['categoriaSelezionata']['numero_gamme'] > 1 && $depthCategorie == $pathDepth) {
$this->templateParameters['categoriaSelezionata']['figlie'] = $gamme;
$template = 'gamme-prodotti';
}
} else {
//prodotto selezionato
$gammaSelezionata = $this->templateParameters['currentPath'][$pathDepth - 3];
$this->addApplicationTranslations('gamme_prodotti','gamme_prodotti.ini');
//$this->templateParameters['gammaSelezionata'] = array_shift($gamme);
foreach($gamme as $gamma) {
if($gamma->slug == $gammaSelezionata) {
$this->templateParameters['gammaSelezionata'] = $gamma;
break;
}
}
//prodotto selezionato
$this->templateParameters['prodottoSelezionato'] = isset($this->templateParameters['currentPath'][$gammaLevel + 1]) ? $this->getProdotto($this->templateParameters['currentPath'][$gammaLevel + 1], $this->templateParameters['gammaSelezionata']->gamma_prodotti_id) : false;
//$this->templateParameters['prodottiVicini'] = $this->getProdottiVicini($this->templateParameters['gammaSelezionata']->gamma_prodotti_id, $this->templateParameters['currentPath'][$gammaLevel + 1]);
if($this->templateParameters['prodottoSelezionato']) {
$this->templateParameters['prodottiVicini'] = $this->getProdottiVicini($this->templateParameters['prodottoSelezionato']->gamma_prodotti_id, $this->templateParameters['currentPath'][$gammaLevel + 1]);
}
//template
$template = 'gamma-prodotti-prodotto';
}
}
}
return $template;
}
/**
* gets artworks for gamma prodotti
* @param int $gamma_prodotti_id
* @param string $slugProdotto
*/
private function getGammaArtworks($gamma_prodotti_id)
{
$records = $this->queryBuilder
/var
/www
/clients
/client1
/web2
/web
/private
/beautycare
/libraries
/Frontend.php
$template = 'gamma-prodotti-' . $this->templateParameters['section'];
}
//più di una gamma
if($this->templateParameters['categoriaSelezionata']['numero_gamme'] > 1 && $depthCategorie == $pathDepth) {
$this->templateParameters['categoriaSelezionata']['figlie'] = $gamme;
$template = 'gamme-prodotti';
}
} else {
//prodotto selezionato
$gammaSelezionata = $this->templateParameters['currentPath'][$pathDepth - 3];
$this->addApplicationTranslations('gamme_prodotti','gamme_prodotti.ini');
//$this->templateParameters['gammaSelezionata'] = array_shift($gamme);
foreach($gamme as $gamma) {
if($gamma->slug == $gammaSelezionata) {
$this->templateParameters['gammaSelezionata'] = $gamma;
break;
}
}
//prodotto selezionato
$this->templateParameters['prodottoSelezionato'] = isset($this->templateParameters['currentPath'][$gammaLevel + 1]) ? $this->getProdotto($this->templateParameters['currentPath'][$gammaLevel + 1], $this->templateParameters['gammaSelezionata']->gamma_prodotti_id) : false;
//$this->templateParameters['prodottiVicini'] = $this->getProdottiVicini($this->templateParameters['gammaSelezionata']->gamma_prodotti_id, $this->templateParameters['currentPath'][$gammaLevel + 1]);
if($this->templateParameters['prodottoSelezionato']) {
$this->templateParameters['prodottiVicini'] = $this->getProdottiVicini($this->templateParameters['prodottoSelezionato']->gamma_prodotti_id, $this->templateParameters['currentPath'][$gammaLevel + 1]);
}
//template
$template = 'gamma-prodotti-prodotto';
}
}
}
return $template;
}
/**
* gets artworks for gamma prodotti
* @param int $gamma_prodotti_id
* @param string $slugProdotto
*/
private function getGammaArtworks($gamma_prodotti_id)
{
$records = $this->queryBuilder
/var
/www
/clients
/client1
/web2
/web
/private
/beautycare
/libraries
/Frontend.php
} else {
$logAction = 'display-login';
$logLabel = $this->translations['frontend']['main_menu']['login_link'];
}
$this->templateParameters['menu'] = [
[
'slug' => 'prodotti','nome' => $this->translations['frontend']['main_menu']['prodotti_link'],
],
/*[
'slug' => 'espositori','nome' => $this->translations['frontend']['main_menu']['display_link']
]
[
'slug' => 'artworks','nome' => $this->translations['frontend']['main_menu']['artworks_link']
],*/
[
'slug' => 'utenti/' . $logAction,'nome' => $logLabel
]
];
//handle subject
$template = $this->{'display' . ucfirst($this->subject)}();
$this->templateParameters['page_title'] = sprintf('%s - %s - %s', $this->translations['application']['marketing']['brand'], $this->translations['application']['marketing']['division'], $this->translations['application']['marketing']['area']);
//$this->setPageTitle($this->templateParameters['subject_title']);
//$this->templateParameters['translations'] = $this->translations;
$this->renderTemplate('frontend/' . $template);
}
/**
* displays prodotti
* @return string $template
*/
private function displayProdotti()
{
//locale
$this->addApplicationTranslations('prodotti','prodotti.ini');
//currently selected path
if(!isset($this->routeParameters['path'])) {
$categorieSelezionate = [];
} else {
$categorieSelezionate = explode('/', $this->routeParameters['path']);
/var
/www
/clients
/client1
/web2
/private
/vendor
/phpcraft
/subject
/src
/Subject.php
* @param string $pathToIniFile file path into private/application-name/curent-language/
* @throws InvalidArgumentException if file is not found
**/
public function addApplicationTranslations($key, $pathToIniFile)
{
$path = sprintf('private/%s/locales/%s/%s', $this->application, $this->language, $pathToIniFile);
$this->addTranslations($key, $path);
}
/**
* tries to exec current action
* @throws Exception if there is no method defined to handle action
**/
public function execAction()
{
try {
$this->templateParameters['area'] = $this->area;
$this->templateParameters['areaAuthentication'] = $this->areaAuthentication;
$this->getBackPaths();
$this->{'exec'.ucfirst($this->sanitizeAction($this->action))}();
} catch(Exception $exception) {
throw new Exception(sprintf('no method for handling %s %s %s', $this->area, $this->subject, $this->action));
}
}
/**
* Stores a path to turn back lately
**/
public function execBackPath()
{
$arguments = array(
'backId' => FILTER_SANITIZE_STRING,
'backPath' => array(
'filter' => FILTER_SANITIZE_URL,
'flags' => FILTER_FLAG_PATH_REQUIRED
),
'backLabel' => FILTER_SANITIZE_STRING,
);
$input = filter_input_array(INPUT_POST, $arguments);
$this->cookie->set('backPaths[' . $input['backId'] . '][path]', $input['backPath']);
/var
/www
/clients
/client1
/web2
/web
/private
/beautycare
/procedures
/bootstrap.php
if(!in_array(LANGUAGE, $configuration['languages'])) throw new Exception("language not into configured languages");
//load specific area configuration and procedure if needed
if($configuration['areas'][AREA]['configuration']) {
require sprintf('private/%s/configurations/%s.php', APPLICATION, AREA);
}
if($configuration['areas'][AREA]['procedure']) {
require sprintf('private/%s/procedures/%s.php', APPLICATION, AREA);
}
//require subject procedure
$subject = require sprintf('private/%s/procedures/%s/%s.php', APPLICATION, AREA, SUBJECT);
//load specific application and area translations if needed
if($configuration['locale']) {
$subject->addApplicationTranslations('application', 'application.ini');
}
if($configuration['areas'][AREA]['locale']) {
$subject->addApplicationTranslations(AREA, sprintf('%s.ini', AREA));
}
//subject action
$subject->execAction();
}
//output
// set headers
foreach ($http->response->getHeaders() as $name => $values) {
foreach ($values as $value) {
@header(sprintf('%s: %s', $name, $value), false);
}
}
//check status code
switch($http->response->getStatusCode()) {
case 200:
break;
default:
@header($_SERVER["SERVER_PROTOCOL"]." " . $http->response->getStatusCode());
break;
}
// output body
$http->response = $http->response->withBody($http->stream);
echo $http->response->getBody();
/var
/www
/clients
/client1
/web2
/web
/index.php
<?php
//application name and namesapce
define('APPLICATION','beautycare');
define('APPLICATION_NAMESPACE','Beautycare');
//bootstrap
require sprintf('private/%s/procedures/bootstrap.php', APPLICATION);