Exemplo n.º 1
0
 /**
  * Donada una llista i un usuari, els desvincula
  *
  */
 public static function vincula($IDU, $IDL)
 {
     $UL = new Usuarisllistes();
     $UL->setNew(true);
     $UL->setUsuarisUsuarisid($IDU);
     $UL->setLlistesIdllistes($IDL);
     $UL->save();
 }
Exemplo n.º 2
0
 public function saveUsuaris()
 {
     $USUARIS = $this->getRequestParameter('USUARIS');
     $IDL = $this->getRequestParameter('IDL');
     $ERRORS = array();
     if (isset($USUARIS)) {
         foreach ($USUARIS as $U) {
             $C = new Criteria();
             $C->add(UsuarisllistesPeer::USUARIS_USUARISID, $U);
             $C->add(UsuarisllistesPeer::LLISTES_IDLLISTES, $IDL);
             $UL = UsuarisllistesPeer::doSelectOne($C);
             $UL->delete();
         }
     }
     if ($this->getRequestParameter('DNI') != '') {
         $DNIs = explode(",", $this->getRequestParameter('DNI'));
         foreach ($DNIs as $D) {
             if ($this->ValidaDNI(trim($D), false)) {
                 $C = new Criteria();
                 $C->add(UsuarisPeer::DNI, trim($D));
                 $U = UsuarisPeer::doSelectOne($C);
                 $C = new Criteria();
                 $C->add(UsuarisllistesPeer::LLISTES_IDLLISTES, $IDL);
                 $C->add(UsuarisllistesPeer::USUARIS_USUARISID, $U->getUsuariid());
                 $COUNT = UsuarisllistesPeer::doCount($C);
                 if ($COUNT == 0) {
                     $UL = new Usuarisllistes();
                     $UL->setLlistesIdllistes($IDL);
                     $UL->setUsuarisUsuarisid($U->getUsuariid());
                     $UL->save();
                 }
             } else {
                 $ERRORS[] = 'El DNI ' . $D . ' és incorrecte.';
             }
         }
     }
     $RET['ERRORS'] = $ERRORS;
     return $RET;
 }
Exemplo n.º 3
0
 public static function saveUsuarisLlistes($LLISTA = array(), $idU = 0)
 {
     $C = new Criteria();
     $C->add(self::USUARIS_USUARISID, $idU);
     //Finalment esborrem totes les files antigues
     foreach (self::doSelect($C) as $L) {
         $L->delete();
     }
     //Entrem les noves dades
     if (isset($LLISTA)) {
         foreach ($LLISTA as $V) {
             $L = new Usuarisllistes();
             $L->setNew(true);
             $L->setUsuarisUsuarisid($idU);
             $L->setLlistesIdllistes($V);
             $L->save();
         }
     }
 }
Exemplo n.º 4
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Usuarisllistes $value A Usuarisllistes object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Usuarisllistes $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getIdusuarisllistes();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }