Example #1
0
            Elfic::cosRedirect('index2.php?com=cursos', MSG_NOPERM_ACC);
        } else {
            if ($uperms['superusuario'] || Cursos::getTutor($_cid) == $uid) {
                $a = new Agendas();
                $a->borrarAgenda($_cid);
                Elfic::cosRedirect('index2.php?com=cursos&do=view&cid=' . $_cid);
            } else {
                Elfic::cosRedirect('index2.php?com=cursos', MSG_NOPERM_ACC);
            }
        }
        break;
    case 'view':
        $smarty->assign('id', $_cid);
        $smarty->display('cursos/cursos_menubar.tpl');
        $smarty->display('end_menubar.tpl');
        if (!$uperms['cursos_w']) {
            Elfic::cosRedirect('index2.php?com=cursos', MSG_NOPERM_ACC);
        } else {
            if (isset($do_edit) && $do_edit == "do") {
                $c = new Cursos($_cid);
                $c->save();
            } else {
                $c = new Cursos($_cid);
                $c->edit();
            }
        }
        break;
    case 'ajax':
        include 'cursos.ajax.php';
        break;
}
Example #2
0
 public static function getCopyCurs($idC)
 {
     $OC = self::retrieveByPK($idC);
     if ($OC instanceof Cursos) {
         $OCR = new Cursos();
         $OCR->setTitolcurs($OC->getTitolcurs() . "(copy)");
         $OCR->setIsactiu(true);
         $OCR->setPlaces($OC->getPlaces());
         $OCR->setCodi($OC->getCodi() . '(c)');
         $OCR->setDescripcio($OC->getDescripcio());
         $OCR->setPreu($OC->getPreu());
         $OCR->setHoraris($OC->getHoraris());
         $OCR->setCategoria($OC->getCategoria());
         $OCR->setOrdresortida($OC->getOrdresortida());
         $OCR->setDataaparicio(date('Y-m-d', time()));
         $OCR->setDatadesaparicio(date('Y-m-d', time()));
         $OCR->setDatainmatricula(date('Y-m-d', time()));
         $OCR->setDatafimatricula(date('Y-m-d', time()));
         $OCR->setDatainici(date('Y-m-d', time()));
         $OCR->setVisibleweb($OC->getVisibleweb());
         $OCR->setSiteId($OC->getSiteId());
         $OCR->setActiu(true);
         $OCR->setActivitatId($OC->getActivitatId());
         $OCR->setPdf($OC->getPdf());
         $OCR->setAdescomptes($OC->getAdescomptes());
         $OCR->setPagamentExtern($OC->getPagamentextern());
         $OCR->setPagamentIntern($OC->getPagamentintern());
         $OCR->save();
         return $OCR;
     }
 }
Example #3
0
 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      PropelPDO $con
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws     PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aUsuaris !== null) {
             if ($this->aUsuaris->isModified() || $this->aUsuaris->isNew()) {
                 $affectedRows += $this->aUsuaris->save($con);
             }
             $this->setUsuaris($this->aUsuaris);
         }
         if ($this->aCursos !== null) {
             if ($this->aCursos->isModified() || $this->aCursos->isNew()) {
                 $affectedRows += $this->aCursos->save($con);
             }
             $this->setCursos($this->aCursos);
         }
         if ($this->isNew()) {
             $this->modifiedColumns[] = MatriculesPeer::IDMATRICULES;
         }
         // If this object has been modified, then save it to the database.
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = MatriculesPeer::doInsert($this, $con);
                 $affectedRows += 1;
                 // we are assuming that there is only 1 row per doInsert() which
                 // should always be true here (even though technically
                 // BasePeer::doInsert() can insert multiple rows).
                 $this->setIdmatricules($pk);
                 //[IMV] update autoincrement primary key
                 $this->setNew(false);
             } else {
                 $affectedRows += MatriculesPeer::doUpdate($this, $con);
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }