public function setup() { $this->WEB_IMATGE = 'images/espais/'; $Sino = array(0 => 'No', 1 => 'SÃ'); $this->IDS = $this->getOption('IDS'); $this->setWidgets(array('EspaiID' => new sfWidgetFormChoice(array('choices' => EspaisPeer::select($this->IDS, true)), array()), 'Nom' => new sfWidgetFormInputText(array(), array('style' => 'width:400px')), 'Ordre' => new sfWidgetFormInputText(array(), array('style' => 'width:50px')), 'site_id' => new sfWidgetFormInputHidden(), 'actiu' => new sfWidgetFormInputHidden(), 'isLlogable' => new sfWidgetFormChoice(array('choices' => $Sino)), 'descripcio' => new sfWidgetFormTextareaTinyMCE(array(), array()))); $this->setValidators(array('EspaiID' => new sfValidatorPass(), 'Nom' => new sfValidatorString(array('max_length' => 50, 'required' => false)), 'Ordre' => new sfValidatorInteger(array('min' => -32768, 'max' => 32767)), 'site_id' => new sfValidatorInteger(array('min' => -128, 'max' => 127, 'required' => false)), 'actiu' => new sfValidatorInteger(array('min' => -128, 'max' => 127)), 'isLlogable' => new sfValidatorPass(array(), array()), 'descripcio' => new sfValidatorString(array('required' => false), array()))); $this->widgetSchema->setNameFormat('espais[%s]'); $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); $this->widgetSchema->setLabels(array('EspaiID' => 'Espai ', 'Nom' => 'Nom ', 'Ordre' => 'Ordre ', 'isLlogable' => 'Es lloga?', 'descripcio' => 'Descripció ')); }
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); } }
function formCercaEspais($CERCA, $IDS) { ?> <form action="<?php echo url_for('gestio/gEstadistiques'); ?> " id="FESPAIS" method="POST"> <table class="FORMULARI" width="100%"> <tr><td> <div class="TITOL">Cerca espais</div> <div class="CERCA"> <div style="margin-bottom:10px;"> <?php echo select_tag("cerca[ANY]", options_for_select(selectAnys(), $CERCA['ANY']), array('class' => 'cinquanta')); ?> <?php echo select_tag('cerca[MES]', options_for_select(selectMesos(), $CERCA['MES'], array()), array('class' => 'cinquanta')); ?> </div> <?php foreach (EspaisPeer::select($IDS, false) as $K => $V) { echo '<div style="float:left; width:210px;">' . checkbox_tag('cerca[ESPAI][' . $K . ']', $K, isset($CERCA['ESPAI'][$K]), array()) . $V . ' (E' . $K . ')</div>'; } ?> </div> </td></tr> <tr> <td colspan="2"> <input type="submit" name="BCERCA_ESP" value="Prem per buscar" /> </td> </tr> </table> </form> <?php }
foreach ($LINIA as $K => $L) { echo '<TR>'; echo '<TD>'; if (isset($ERRORS[$K]['DATA'])) { echo '<div class="ERRORS">' . $ERRORS[$K]['DATA'] . '</DIV><br />'; } if (isset($ERRORS[$K]['DIA'])) { echo '<div class="ERRORS">' . $ERRORS[$K]['DIA'] . '</DIV>'; } echo input_tag("D[{$K}][DIA]", $L['DIA'], array('id' => 'DIA')) . '<br />' . input_tag("D[{$K}][HORAPRE]", $L['HORAPRE'], array('id' => 'HORA')) . ' - ' . input_tag("D[{$K}][HORAI]", $L['HORAI'], array('id' => 'HORA')) . ' - ' . input_tag("D[{$K}][HORAF]", $L['HORAF'], array('id' => 'HORA')) . ' - ' . input_tag("D[{$K}][HORAPOST]", $L['HORAPOST'], array('id' => 'HORA')) . '</TD>'; echo '<TD>'; if (isset($ERRORS[$K]['ESPAIS'])) { echo '<div class="ERRORS">' . $ERRORS[$K]['ESPAIS'] . '</DIV><br />'; } foreach ($L['ESPAIS'] as $E) { echo select_tag("D[{$K}][ESPAIS][]", options_for_select(EspaisPeer::select(), $E, array('include_blank' => true)), array('multiple' => false)) . '<br />'; } echo '</TD>'; echo '<TD>'; foreach ($L['MATERIAL'] as $M) { echo select_tag("D[{$K}][MATERIAL][]", options_for_select(MaterialgenericPeer::select(), $M, array('include_blank' => true)), array('multiple' => false)) . '<BR />'; } echo '</TD>'; echo '</TR>'; } echo '</table>'; echo submit_tag('Afegir extres', array('name' => 'Extra')); echo submit_tag('Guardar', array('name' => 'Save')); } ?>