コード例 #1
0
 public function executeGEstadistiques(sfWebRequest $request)
 {
     $this->setLayout('gestio');
     $this->IDS = $this->getUser()->getSessionPar('idS');
     $this->CERCA = $request->getParameter('cerca', $this->CERCA);
     $this->CERCA = $this->getCercaEstadistiquesComplet($this->CERCA);
     if ($request->hasParameter('BCERCA_ESP')) {
         $this->ESPAIS = EspaisPeer::select($this->IDS);
         $dit = mktime(0, 0, 0, $this->CERCA['MES'], 1, $this->CERCA['ANY']);
         $month = date('m', $dit);
         $year = date('Y', $dit);
         $site = $this->IDS;
         $Espais = $this->CERCA['ESPAI'];
         if (empty($this->CERCA['ESPAI'])) {
             foreach ($this->ESPAIS as $K => $V) {
                 $Espais[$K] = $K;
             }
         }
         $this->DATA = mktime(0, 0, 0, $month, 1, $year);
         $this->OCUPACIO_ESPAIS = EspaisPeer::getEstadistiquesEspais($Espais, $site, $month, $year);
     } elseif ($request->hasParameter('BCERCA_MAT')) {
         $this->MATERIAL = MaterialPeer::selectGeneric($this->CERCA['MATERIAL_GENERIC'], $this->IDS, null);
         $dit = mktime(0, 0, 0, $this->CERCA['MES'], 1, $this->CERCA['ANY']);
         $month = date('m', $dit);
         $year = date('Y', $dit);
         $site = $this->IDS;
         $this->OCUPACIO_MATERIAL = MaterialPeer::getEstadistiquesMaterial($this->CERCA['MATERIAL'], $site, $month, $year);
     }
 }
コード例 #2
0
ファイル: actions.class.php プロジェクト: nagiro/intra
 /**
  * hospiciActions::executeEspais()
  * 
  * Part de mostra dels espais per reservar a l'hospici
  * 
  * @param mixed $request
  * @return void
  */
 public function executeEspais(sfWebRequest $request)
 {
     $this->setLayout('hospici');
     $this->setTemplate('indexReservaEspais');
     $this->accio = $request->getParameter('accio', 'index');
     //Carrego la cerca
     $this->CERCA = $this->getUser()->getSessionPar('cerca', array());
     $this->DESPLEGABLES = array();
     $this->AUTH = $this->getUser()->isAuthenticated();
     if ($this->accio == 'cerca_espais' || $this->accio == 'inici') {
         //Agafo els paràmetres
         if ($request->getMethod() == 'POST') {
             $C = $request->getParameter('cerca', array());
         }
         $C['P'] = $request->getParameter('P', 1);
         //Si em trobo el paràmetre SITE, impilca que he entrat per llistat d'entitats i vull veure tot el d'una.
         if ($request->hasParameter('SITE')) {
             $C['SITE'] = $request->getParameter('SITE');
         }
         $C2 = $this->getCercaEspaisComplet($C);
         //Faig la cerca dels cursos de l'Hospici i ho retorno amb valors
         //La cerca hauria de tornar els cursos, segons els paràmetres i a més els llistats amb els valors.
         $this->LLISTAT_ESPAIS = EspaisPeer::getEspaisCercaHospici($C2);
         $this->DESPLEGABLES['SELECT_POBLACIONS'] = EspaisPeer::getPoblacionsHospici($C2);
         $this->DESPLEGABLES['SELECT_ENTITATS'] = EspaisPeer::getEntitatsHospici($C2);
         $this->DESPLEGABLES['SELECT_CATEGORIES'] = EspaisPeer::getCategoriesHospici($C2);
         //Guardem a sessió la cerca "actual"
         $this->CERCA = $C2;
         $this->getUser()->setSessionPar('cerca', $this->CERCA);
         $this->MODE = 'CERCA';
     } elseif ($this->accio == 'detall_espai') {
         $this->ESPAI = EspaisPeer::retrieveByPK($request->getParameter('idE'));
         $this->DATA = $request->getParameter('data', time());
         $month = date('m', $this->DATA);
         $year = date('Y', $this->DATA);
         $this->OCUPACIO = EspaisPeer::getEstadistiquesEspais(array($request->getParameter('idE')), $this->ESPAI->getSiteId(), $month, $year);
         $d = mktime(0, 0, 0, $month + 1, 1, $year);
         $month = date('m', $d);
         $year = date('Y', $d);
         $this->OCUPACIO2 = EspaisPeer::getEstadistiquesEspais(array($request->getParameter('idE')), $this->ESPAI->getSiteId(), $month, $year);
         $this->MODE = 'DETALL';
     }
 }