Beispiel #1
0
 public function __construct()
 {
     $this->_table = 'utente';
     $this->_key = 'numero_tel';
     $this->_return_class = 'EUtente';
     USingleton::getInstance('Fdb');
 }
Beispiel #2
0
 public function __construct()
 {
     $this->_table = 'ordine_prodotto';
     $this->_key = array("id_ordine", "id_prodotto");
     $this->_auto_increment = FALSE;
     $this->_return_class = 'EOrdineProdotto';
     USingleton::getInstance('Fdb');
 }
Beispiel #3
0
 public function __construct()
 {
     $this->_table = 'categoria';
     $this->_key = 'id';
     $this->_auto_increment = TRUE;
     $this->_return_class = 'ECategoria';
     USingleton::getInstance('Fdb');
 }
Beispiel #4
0
 public function salva()
 {
     $prodotto = $_POST;
     $prodotto->id = $_POST->id;
     $FProdotto = USingleton::getInstance('FProdotto');
     $result = $FProdotto->update($prodotto);
     if ($this->isAjax()) {
         echo $this->respondeAjaxObject($result);
     }
 }
Beispiel #5
0
 public function __construct()
 {
     parent::__construct();
     global $config;
     $this->setTemplateDir($config['smarty']['template_dir']);
     $this->setCompileDir($config['smarty']['compile_dir']);
     $this->setConfigDir($config['smarty']['config_dir']);
     $this->setCacheDir($config['smarty']['cache_dir']);
     //initalization
     $CHome = USingleton::getInstance('CHome');
     $this->assign('logged', $CHome->isLogged());
     $this->assign('admin', $CHome->isAdmin());
 }
Beispiel #6
0
 /**
  * Ritorna tutte le informazioni sull'utente
  * @return type
  */
 public function infoUtente()
 {
     $session = USingleton::getInstance('USession');
     $numero_tel = $session->leggi_valore('numero_tel');
     $FUtente = USingleton::getInstance('FUtente');
     $utente = $FUtente->load($numero_tel);
     $obj = array('nome' => $utente->getNome(), 'cognome' => $utente->getCognome(), 'numero_tel' => $utente->getNumeroTel(), 'email' => $utente->getEmail(), 'via' => $utente->getVia(), 'citta' => $utente->getCitta(), 'cap' => $utente->getCap(), 'tipo_utente' => $utente->getTipo_utente());
     if ($this->isAjax()) {
         $this->respondeAjaxObject($obj);
     } else {
         return $obj;
     }
 }
Beispiel #7
0
 public function smista()
 {
     if (!$this->getCarrello()) {
         $view = USingleton::getInstance('VCarrello');
         $view->set_layout('error');
         return $view->processaTemplate();
     }
     list($azione, $data) = explode('.', $this->getTask());
     if ($azione == 'default') {
         return $this->mostraCarrello();
     }
     if ($azione == 'aggiungi') {
         return $this->aggiungiProdotto($data);
     }
     if ($azione == 'elimina') {
         return $this->eliminaProdotto($data);
     }
 }
Beispiel #8
0
 public function totaleOrdine($id_ordine)
 {
     $FOrdine = USingleton::getInstance('FOrdine');
     $prodottiOrdinati = $FOrdine->getOrdineProdotti($id_ordine);
     if ($prodottiOrdinati == FALSE) {
         return 0;
     } else {
         $tot = 0;
         foreach ($prodottiOrdinati as $item) {
             $id_prodotto = $item->getIdProdotto();
             $quantita_prodotto = $item->getQuantita();
             $FProdotto = USingleton::getInstance('FProdotto');
             $prodotto = $FProdotto->load($id_prodotto);
             $prezzo_prodotto = $prodotto->getPrezzo();
             $subTot = $prezzo_prodotto * $quantita_prodotto;
             $tot = $tot + $subTot;
         }
         return $tot;
     }
 }
Beispiel #9
0
 /**
  * Ritorna la lista dei prodotti appartenenti a un determinato ordine.
  * @param type $id_ordine
  * @return type
  */
 public function getOrdineProdotti($id_ordine)
 {
     $FOrdineProdotto = USingleton::getInstance('FOrdineProdotto');
     return $FOrdineProdotto->getProdottiByOrdine($id_ordine);
 }
Beispiel #10
0
<?php

require_once 'include/autoload.inc.php';
require_once 'include/config.inc.php';
if (isset($_REQUEST['ajax'])) {
    $config['debug'] = false;
}
$CHome = USingleton::getInstance('CHome');
$CHome->impostaPagina();
Beispiel #11
0
 public function aggiungiModuloLogin($utente = null)
 {
     $VRegistrazione = USingleton::getInstance('VRegistrazione');
     $VRegistrazione->set_layout('default');
     if ($utente) {
         $VRegistrazione->assign('utente', $utente);
     }
     $modulo_login = $VRegistrazione->processaTemplate();
     $this->_side_content['modulo_login'] = $modulo_login;
 }
Beispiel #12
0
 /**
  * Smista le richieste ai vari controller
  * @return type
  */
 public function smista()
 {
     switch ($this->getController()) {
         case 'home':
             return $this->smistaInHome();
         case 'registrazione':
             $CRegistrazione = USingleton::getInstance('CRegistrazione');
             return $CRegistrazione->smista();
         case 'prodotto':
             $CProdotto = USingleton::getInstance('CProdotto');
             return $CProdotto->smista();
         case 'carrello':
             $CCarrello = USingleton::getInstance('CCarrello');
             return $CCarrello->smista();
         case 'ordine':
             $COrdine = USingleton::getInstance('COrdine');
             return $COrdine->smista();
         case 'utente':
             $CUtente = USingleton::getInstance('CUtente');
             return $CUtente->smista();
         default:
             $CProdotto = USingleton::getInstance('CProdotto');
             return $CProdotto->randomItems();
     }
 }
Beispiel #13
0
function SS($name)
{
    return USingleton::getInstance($name);
}
Beispiel #14
0
 /**
  * Utilizzata da ajax per capire se c'è un utente loggato
  * @return type
  */
 public function checkLog()
 {
     $sessione = USingleton::getInstance('USession');
     $numero = $sessione->leggi_valore('numero_tel');
     if ($numero) {
         return $this->respondeAjaxObject($numero);
     } else {
         return $this->respondeAjaxObject(false);
     }
 }