public function setup()
 {
     $this->setWidgets(array('AgendaTelefonicaDadesID' => new sfWidgetFormInputHidden(), 'AgendaTelefonica_AgendaTelefonicaID' => new sfWidgetFormPropelChoice(array('model' => 'Agendatelefonica', 'add_empty' => false, 'method' => 'hola')), 'Tipus' => new sfWidgetFormChoice(array('choices' => AgendatelefonicadadesPeer::select())), 'Dada' => new sfWidgetFormInputText(), 'Notes' => new sfWidgetFormInputText()));
     $this->setValidators(array('AgendaTelefonicaDadesID' => new sfValidatorPropelChoice(array('model' => 'Agendatelefonicadades', 'column' => 'AgendaTelefonicaDadesID', 'required' => false)), 'AgendaTelefonica_AgendaTelefonicaID' => new sfValidatorPropelChoice(array('model' => 'Agendatelefonica', 'column' => 'AgendaTelefonicaID')), 'Tipus' => new sfValidatorString(array('required' => false)), 'Dada' => new sfValidatorString(array('required' => false)), 'Notes' => new sfValidatorString(array('required' => false))));
     $this->widgetSchema->setNameFormat("agendatelefonicadades[%s]");
     $this->widgetSchema->setFormFormatterName('Span');
     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
     unset($this['AgendaTelefonica_AgendaTelefonicaID']);
     //    parent::setup();
 }
 /**
  * Returns the number of related Agendatelefonicadades objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      PropelPDO $con
  * @return     int Count of related Agendatelefonicadades objects.
  * @throws     PropelException
  */
 public function countAgendatelefonicadadess(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(AgendatelefonicaPeer::DATABASE_NAME);
     } else {
         $criteria = clone $criteria;
     }
     if ($distinct) {
         $criteria->setDistinct();
     }
     $count = null;
     if ($this->collAgendatelefonicadadess === null) {
         if ($this->isNew()) {
             $count = 0;
         } else {
             $criteria->add(AgendatelefonicadadesPeer::AGENDATELEFONICA_AGENDATELEFONICAID, $this->agendatelefonicaid);
             $count = AgendatelefonicadadesPeer::doCount($criteria, false, $con);
         }
     } else {
         // criteria has no effect for a new object
         if (!$this->isNew()) {
             // the following code is to determine if a new query is
             // called for.  If the criteria is the same as the last
             // one, just return count of the collection.
             $criteria->add(AgendatelefonicadadesPeer::AGENDATELEFONICA_AGENDATELEFONICAID, $this->agendatelefonicaid);
             if (!isset($this->lastAgendatelefonicadadesCriteria) || !$this->lastAgendatelefonicadadesCriteria->equals($criteria)) {
                 $count = AgendatelefonicadadesPeer::doCount($criteria, false, $con);
             } else {
                 $count = count($this->collAgendatelefonicadadess);
             }
         } else {
             $count = count($this->collAgendatelefonicadadess);
         }
     }
     return $count;
 }
									'<input style="width:10px" type="button" onClick="esborraLinia('+id+');" id="mesmaterial" value="-"></input>' +
								'</span>' +							
							'</div>' +
						'</div>';		

}

function creaNovaDada()
{
	
	var id = $("#id").val();		
	id = (parseInt(id) + parseInt(1));
	$("#id").val(id);		
				
	var select  = '<?php 
echo AgendatelefonicadadesPeer::getSelectHTML();
?>
';
	$("#taula").append(linia(id, 1,'','',select, 0));
																					
}

function creaNovaDadaVella(t, d, n, s, idA)
{
	
	var id = $("#id").val();		
	id = (parseInt(id) + parseInt(1));
	$("#id").val(id);		
					
	$("#taula").append(linia(id, t, d, n, s, idA));
																				
 public function executeGAgenda($request)
 {
     $this->setLayout('gestio');
     $this->IDS = $this->getUser()->getSessionPar('idS');
     //Netegem cerca
     if ($request->getParameter('accio') == 'C') {
         $this->CERCA = $this->getUser()->setSessionPar('cerca', array('text' => ''));
     }
     //Inicialitzem les variables
     $this->CERCA = $this->getUser()->ParReqSesForm($request, 'cerca', array('text' => ""));
     $this->accio = $request->getParameter('accio', 'C');
     $this->MODE = "";
     $this->P = $request->getParameter('P', 1);
     //Tractem el formulari de cerca
     $this->FCerca = new CercaForm();
     $this->FCerca->bind($this->CERCA);
     //Definim l'acció segons el botó premut
     if ($this->getRequest()->hasParameter('BNOU')) {
         $this->accio = 'N';
     }
     if ($this->getRequest()->hasParameter('BSAVE')) {
         $this->accio = 'S';
     }
     if ($this->getRequest()->hasParameter('BDELETE')) {
         $this->accio = 'D';
     }
     if ($this->getRequest()->hasParameter('BCERCA')) {
         $this->accio = 'L';
     }
     $this->getUser()->setSessionPar('accio', $this->accio);
     switch ($this->accio) {
         case 'C':
             $this->getUser()->addLogAction('inside', 'gAgenda');
             $this->AGENDES = AgendatelefonicadadesPeer::doSearch($this->CERCA['text'], $this->IDS, $this->P);
             break;
         case 'N':
             $this->MODE = 'NOU';
             $this->FAgenda = AgendatelefonicaPeer::initialize(0, $this->IDS);
             break;
         case 'E':
             $this->MODE = 'EDICIO';
             $AID = $request->getParameter('AID');
             $this->FAgenda = AgendatelefonicaPeer::initialize($AID, $this->IDS);
             $OAT = $this->FAgenda->getObject();
             $this->DADES = $OAT->getAgendatelefonicadadesActiu();
             break;
         case 'S':
             $RA = $request->getParameter('agendatelefonica');
             $AID = $RA['AgendaTelefonicaID'];
             $this->FAgenda = AgendatelefonicaPeer::initialize($AID, $this->IDS);
             $this->FAgenda->bind($RA);
             if ($this->FAgenda->isValid()) {
                 $this->FAgenda->save();
                 $this->getUser()->addLogAction($this->accio, 'gAgenda', $this->FAgenda->getObject());
                 myUser::addLogTimeline('alta', 'agenda', $this->getUser()->getSessionPar('idU'), $this->IDS, $this->FAgenda->getObject()->getAgendatelefonicaId());
                 $this->AID = $this->FAgenda->getObject()->getAgendatelefonicaid();
                 AgendatelefonicadadesPeer::update($request->getParameter('Dades'), $this->AID, $this->IDS);
                 //Actualitzem també les dades relacionades
                 $this->MISSATGE = "El registre s'ha modificat correctament.";
                 $this->redirect('gestio/gAgenda?accio=L');
             } else {
                 $this->DADES = $this->FAgenda->getObject()->getAgendatelefonicadadess();
                 $this->MODE = 'EDICIO';
             }
             break;
         case 'D':
             $RA = $request->getParameter('agendatelefonica');
             $this->AID = $RA['AgendaTelefonicaID'];
             $this->FAgenda = AgendatelefonicaPeer::initialize($this->AID, $this->IDS);
             if (!$this->FAgenda->isNew()) {
                 $this->FAgenda->getObject()->setInactiu();
                 $this->getUser()->addLogAction($this->accio, 'gAgenda', $this->FAgenda->getObject());
                 myUser::addLogTimeline('baixa', 'agenda', $this->getUser()->getSessionPar('idU'), $this->IDS, $this->FAgenda->getObject()->getAgendatelefonicaId());
             }
             break;
         default:
             $this->AGENDES = AgendatelefonicadadesPeer::doSearch($this->CERCA['text'], $this->IDS, $this->P);
             break;
     }
     if (!empty($this->CERCA)) {
         $this->AGENDES = AgendatelefonicadadesPeer::doSearch($this->CERCA['text'], $this->IDS, $this->P);
     } else {
         $this->AGENDES = array();
     }
 }
Example #5
0
 public function getTipusString()
 {
     return AgendatelefonicadadesPeer::getTipus($this->tipus);
 }
 /**
  * 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 = AgendatelefonicadadesPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setAgendatelefonicadadesid($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setAgendatelefonicaAgendatelefonicaid($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setTipus($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setDada($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setNotes($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setSiteId($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setActiu($arr[$keys[6]]);
     }
 }
 /**
  * This is a method for emulating ON DELETE CASCADE for DBs that don't support this
  * feature (like MySQL or SQLite).
  *
  * This method is not very speedy because it must perform a query first to get
  * the implicated records and then perform the deletes by calling those Peer classes.
  *
  * This method should be used within a transaction if possible.
  *
  * @param      Criteria $criteria
  * @param      PropelPDO $con
  * @return     int The number of affected rows (if supported by underlying database driver).
  */
 protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
 {
     // initialize var to track total num of affected rows
     $affectedRows = 0;
     // first find the objects that are implicated by the $criteria
     $objects = AgendatelefonicaPeer::doSelect($criteria, $con);
     foreach ($objects as $obj) {
         // delete related Agendatelefonicadades objects
         $criteria = new Criteria(AgendatelefonicadadesPeer::DATABASE_NAME);
         $criteria->add(AgendatelefonicadadesPeer::AGENDATELEFONICA_AGENDATELEFONICAID, $obj->getAgendatelefonicaid());
         $affectedRows += AgendatelefonicadadesPeer::doDelete($criteria, $con);
     }
     return $affectedRows;
 }
 /**
  * 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(AgendatelefonicadadesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(AgendatelefonicadadesPeer::DATABASE_NAME);
         $criteria->add(AgendatelefonicadadesPeer::AGENDATELEFONICADADESID, $pks, Criteria::IN);
         $objs = AgendatelefonicadadesPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Example #9
0
<?php

if (empty($AGENDES)) {
    echo '<TR><TD class="LINIA" colspan="3">No s\'ha trobat cap resultat d\'entre ' . AgendatelefonicaPeer::getLinies($IDS) . ' disponibles.</TD></TR>';
} else {
    $i = 0;
    foreach ($AGENDES as $A) {
        $SPAN = '<SPAN>';
        foreach ($A->getAgendatelefonicadadesActiu() as $ATD) {
            $SPAN .= AgendatelefonicadadesPeer::getTipus($ATD->getTipus()) . ': ' . $ATD->getDada() . ' - ' . $ATD->getNotes() . '<BR />';
        }
        $SPAN .= '</SPAN>';
        $PAR = ParImpar($i++);
        echo '<TR>
		                	<TD class="' . $PAR . '"><a href="' . url_for('gestio/gAgenda?accio=E&AID=' . $A->getAgendatelefonicaid()) . '" class="tt2" >' . image_tag('template/doc_text_image.png') . $SPAN . '</TD>
		                    <TD class="' . $PAR . '"><a href="' . url_for('gestio/gAgenda?accio=E&AID=' . $A->getAgendatelefonicaid()) . '" class="tt2" >' . $A->getNom() . $SPAN . '</TD>
		                    <TD class="' . $PAR . '">' . $A->getEntitat() . '</TD>
		                    <TD class="' . $PAR . '">' . $A->getTags() . '<TD>
		                 </TR>';
    }
}
/*	
  function ParImpar($i)
  {
	if($i % 2 == 0) return "PAR";
	else return "IPAR";
  }
*/
Example #10
0
 public function getAgendatelefonicadadesActiu()
 {
     $C = new Criteria();
     $C = AgendatelefonicadadesPeer::getCriteriaActiu($C, $this->getSiteId());
     return $this->getAgendatelefonicadadess($C);
 }