Esempio n. 1
0
 public function executeDelete(sfWebRequest $request)
 {
     $request->checkCSRFProtection();
     $this->forward404Unless($Test = TestsPeer::retrieveByPk($request->getParameter('id')), sprintf('Object Test does not exist (%s).', $request->getParameter('id')));
     $Test->delete();
     $this->redirect('tests/index');
 }
Esempio n. 2
0
 public function setPruebas()
 {
     // seteo todas las pruebas de una evaluacion
     $pruebas = PruebasPeer::getPruebas($this->getAttribute('evaluacion')->getId());
     $tests = TestsPeer::getTestHijos($pruebas);
     $this->setAttribute('pruebas', $tests);
     $this->setResultadoInicial($pruebas);
     $this->setInitprueba(sfConfig::get('app_init_prueba'));
 }
Esempio n. 3
0
 public function executeAgregarTest(sfWebRequest $request)
 {
     $this->forward404Unless($Evaluacion = EvaluacionesPeer::retrieveByPk($request->getParameter('id')), sprintf('Object Evaluacion does not exist (%s).', $request->getParameter('id')));
     $this->forward404Unless($Test = TestsPeer::retrieveByPk($request->getParameter('tests_id')), sprintf('Object Test does not exist (%s).', $request->getParameter('tests_id')));
     $Prueba = new Pruebas();
     $Prueba->setEvaluaciones($Evaluacion);
     $Prueba->setTests($Test);
     $Prueba->setEstadopruebasId(sfConfig::get('app_prueba_inicializada'));
     // Estado Inicializado
     $Prueba->save();
     $this->redirect(url_for('evaluaciones/testList?id=' . $Evaluacion->getId()));
 }
Esempio n. 4
0
 /**
  * Selects a collection of Preguntas objects pre-filled with all related objects.
  *
  * @param      Criteria  $criteria
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of Preguntas objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $criteria = clone $criteria;
     // Set the correct dbName if it has not been overridden
     if ($criteria->getDbName() == Propel::getDefaultDB()) {
         $criteria->setDbName(self::DATABASE_NAME);
     }
     PreguntasPeer::addSelectColumns($criteria);
     $startcol2 = PreguntasPeer::NUM_COLUMNS - PreguntasPeer::NUM_LAZY_LOAD_COLUMNS;
     TestsPeer::addSelectColumns($criteria);
     $startcol3 = $startcol2 + (TestsPeer::NUM_COLUMNS - TestsPeer::NUM_LAZY_LOAD_COLUMNS);
     $criteria->addJoin(PreguntasPeer::TESTS_ID, TestsPeer::ID, $join_behavior);
     // symfony_behaviors behavior
     foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) {
         call_user_func($sf_hook, 'BasePreguntasPeer', $criteria, $con);
     }
     $stmt = BasePeer::doSelect($criteria, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = PreguntasPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = PreguntasPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://propel.phpdb.org/trac/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $cls = PreguntasPeer::getOMClass(false);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             PreguntasPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Tests rows
         $key2 = TestsPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = TestsPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $cls = TestsPeer::getOMClass(false);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 TestsPeer::addInstanceToPool($obj2, $key2);
             }
             // if obj2 loaded
             // Add the $obj1 (Preguntas) to the collection in $obj2 (Tests)
             $obj2->addPreguntas($obj1);
         }
         // if joined row not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Esempio n. 5
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(TestsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(TestsPeer::DATABASE_NAME);
         $criteria->add(TestsPeer::ID, $pks, Criteria::IN);
         $objs = TestsPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Esempio n. 6
0
 /**
  * Get the associated Tests object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Tests The associated Tests object.
  * @throws     PropelException
  */
 public function getTests(PropelPDO $con = null)
 {
     if ($this->aTests === null && $this->tests_id !== null) {
         $this->aTests = TestsPeer::retrieveByPk($this->tests_id);
         /* The following can be used additionally to
         		   guarantee the related object contains a reference
         		   to this object.  This level of coupling may, however, be
         		   undesirable since it could result in an only partially populated collection
         		   in the referenced object.
         		   $this->aTests->addPruebass($this);
         		 */
     }
     return $this->aTests;
 }
Esempio n. 7
0
 /**
  * If this collection has already been initialized with
  * an identical criteria, it returns the collection.
  * Otherwise if this Tests is new, it will return
  * an empty collection; or if this Tests has previously
  * been saved, it will retrieve related TestssRelatedByTestsId from storage.
  *
  * This method is protected by default in order to keep the public
  * api reasonable.  You can provide public methods for those you
  * actually need in Tests.
  */
 public function getTestssRelatedByTestsIdJoinTipoopcion($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     if ($criteria === null) {
         $criteria = new Criteria(TestsPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collTestssRelatedByTestsId === null) {
         if ($this->isNew()) {
             $this->collTestssRelatedByTestsId = array();
         } else {
             $criteria->add(TestsPeer::TESTS_ID, $this->id);
             $this->collTestssRelatedByTestsId = TestsPeer::doSelectJoinTipoopcion($criteria, $con, $join_behavior);
         }
     } else {
         // 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 the collection.
         $criteria->add(TestsPeer::TESTS_ID, $this->id);
         if (!isset($this->lastTestsRelatedByTestsIdCriteria) || !$this->lastTestsRelatedByTestsIdCriteria->equals($criteria)) {
             $this->collTestssRelatedByTestsId = TestsPeer::doSelectJoinTipoopcion($criteria, $con, $join_behavior);
         }
     }
     $this->lastTestsRelatedByTestsIdCriteria = $criteria;
     return $this->collTestssRelatedByTestsId;
 }