Example #1
0
 public static function initialize($idE = 0, $idS = 0)
 {
     $OE = EntradesPeer::retrieveByPK($idE);
     if (!$OE instanceof Entrades) {
         $OE = new Entrades();
         $OE->setTitol('TÍTOL PER DEFECTE');
         $OE->setSubtitol('SUBTÍTOL PER DEFECTE');
         $OE->setData('Dia, XX de mes, 20.00h');
         $OE->setLloc('Auditori de la Casa de Cultura de Girona');
         $OE->setPreu('Preu: 5€ / Reduït: 3€ ');
         $OE->setVenudes(0);
         $OE->setRecaptat(0);
         $OE->setLocalitats(126);
     }
     return new EntradesForm($OE, array('IDS' => $idS));
 }
Example #2
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = EntradesPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setIdentrada($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setTitol($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setSubtitol($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setData($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setLloc($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setPreu($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setVenudes($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setRecaptat($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setLocalitats($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setSiteId($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setActiu($arr[$keys[10]]);
     }
 }
Example #3
0
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(EntradesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(EntradesPeer::DATABASE_NAME);
         $criteria->add(EntradesPeer::IDENTRADA, $pks, Criteria::IN);
         $objs = EntradesPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Example #4
0
    
    <?php 
include_partial('breadcumb', array('text' => 'ENTRADES'));
?>
    

  	<div class="REQUADRE">
  	<div class="TITOL">Llistat d'entrades ( <?php 
echo link_to('Crear una nova entrada', 'gestio/gPrintEntrades?accio=NOU');
?>
 )</div>
  		<table class="DADES">
  			
                <?php 
if ($ENTRADES->getNbResults() == 0) {
    echo '<TR><TD colspan="3">No s\'ha trobat cap resultat d\'entre ' . EntradesPeer::doCount(new Criteria()) . ' disponibles.</TD></TR>';
} else {
    echo '<tr><th>Títol</th><th>Venudes</th><th>Recaptació</th><th>Opcions</th></tr>';
    foreach ($ENTRADES->getResults() as $E) {
        echo "<TR>                      \t\t\t\t\r\n                      \t\t\t\t<TD\tstyle='width:200px;'>" . link_to(image_tag('intranet/Submenu2.png') . ' ' . $E->getTitol(), 'gestio/gPrintEntrades?accio=EDITA&IDE=' . $E->getIdentrada()) . "</TD>\r\n                      \t\t\t\t<TD style='width:50px;' class=\"LINIA\">" . $E->getVenudes() . "</TD>\r\n                      \t\t\t\t<TD style='width:50px;' class=\"LINIA\">" . $E->getRecaptat() . "</TD>                      \t\t\t\t\r\n                      \t\t\t\t<TD style='width:50px;' class=\"LINIA\">" . link_to(image_tag('template/printer.png'), 'gestio/gPrintEntrades?accio=PRINT&IDE=' . $E->getIdentrada()) . "</TD>\r\n                      \t\t\t  </TR>";
    }
}
?>
     			
        <tr><td colspan="4" style="text-align:center">
         
        <?php 
if ($ENTRADES->haveToPaginate()) {
    if ($PAGINA > 1) {
        echo link_to('<-- Veure entrades anteriors', 'gestio/gPrintEntrades?PAGINA=' . $ENTRADES->getPreviousPage());
    }
Example #5
0
 public function executeGPrintEntrades(sfWebRequest $request)
 {
     $this->setLayout('gestio');
     $this->IDS = $this->getUser()->getSessionPar('idS');
     $this->IDE = $request->getParameter('IDE');
     $this->PAGINA = $this->getUser()->ParReqSesForm($request, 'PAGINA', 1);
     $this->MODE = "";
     $accio = $request->getParameter('accio');
     if ($request->hasParameter('BSAVE')) {
         $accio = 'SAVE';
     }
     if ($request->hasParameter('BDELETE')) {
         $accio = 'DELETE';
     }
     switch ($accio) {
         case 'C':
             $this->getUser()->addLogAction('inside', 'gEntrades');
             break;
         case 'NOU':
             $this->MODE = 'NOU';
             $this->FENTRADES = EntradesPeer::initialize(0, $this->IDS);
             break;
         case 'EDITA':
             $this->MODE = 'EDITA';
             $this->FENTRADES = EntradesPeer::initialize($this->IDE, $this->IDS);
             break;
         case 'SAVE':
             $PE = $request->getParameter('entrades');
             $this->FENTRADES = EntradesPeer::initialize($PE['idEntrada'], $this->IDS);
             $this->FENTRADES->bind($PE);
             if ($this->FENTRADES->isValid()) {
                 $this->FENTRADES->save();
                 $this->getUser()->addLogAction($accio, 'gEntrades', $this->FENTRADES->getObject());
             } else {
                 $this->MODE = 'EDITA';
             }
             break;
         case 'DELETE':
             $PE = $request->getParameter('entrades');
             $this->FENTRADES = EntradesPeer::initialize($PE['idEntrada'], $this->IDS);
             $this->getUser()->addLogAction($accio, 'gEntrades', $FE->getObject());
             $this->FENTRADES->getObject()->setActiu(false)->save();
             break;
         case 'PRINT':
             $FE = EntradesPeer::initialize($this->IDE, $this->IDS);
             $this->executePrintEntrades($FE->getObject());
             break;
     }
     $this->ENTRADES = EntradesPeer::getList($this->PAGINA);
 }