function update() { $disciplina = new Disciplina(); $disciplina->setNome($_POST['nome']); //$disciplina->setTutor($tutor->getById()); $curso = new Curso(); $curso->setId($_POST['curso']); $disciplina->setCurso($curso->getById()); $disciplina->setId($_POST['id']); $disciplina->update(); if (isset($_POST['tutor']) && $_POST['tutor']) { $tutor = new Tutor(); $tutor->setId($_POST['tutor']); $tutor->addTutorDisciplina($tutor->getId(), $disciplina->getId()); } header("location: ../view/index.php"); }
/** * Método que retorna os conteúdos do livro informado com o seu andamento * @param Livro $livro O livro alvo da busca * @param Disciplina $disciplina A disciplina referente ao conteúdo * @throws Exception */ public function deLivroComAcompanhamento(Livro $livro, Disciplina $disciplina) { $select = new Select(); return $this->tg->selectObj($select->distinct("sequencial_topico")->columns("*, apostilas.acompanhamento.status " . "as topico_status, " . "data_aula as topico_data_aula ")->join("apostilas.capitulo", array("pk_capitulo" => "fk_capitulo"))->join("public.materia_vin", array("pk_materia_vin" => "fk_materia_vin"))->join("public.materia", array("pk_materia" => "fk_materia"))->join("public.materia_mae", array("pk_materia_mae" => "fk_materia_mae"))->join("public.area", array("pk_area" => "fk_area"))->join("apostilas.acompanhamento", array("fk_conteudo" => "pk_conteudo"))->where("fk_livro={$livro->getId()} " . "and pk_materia={$disciplina->getId()} " . "and (status=" . Topico::STATUS_EM_ANDAMENTO . " " . "or status=" . Topico::STATUS_CONCLUIDO . ") " . "and id=(select max(id) from apostilas.acompanhamento " . "where fk_conteudo=pk_conteudo and status!=" . Topico::STATUS_REVISADO . ") " . "and extract(year from data_aula)={$this->anoLetivo}")->order("sequencial_topico")); }
/** * 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 Disciplina $value A Disciplina object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(Disciplina $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }
/** * Declares an association between this object and a Disciplina object. * * @param Disciplina $v * @return Gradeunit The current object (for fluent API support) * @throws PropelException */ public function setDisciplina(Disciplina $v = null) { if ($v === null) { $this->setDisciplinaId(NULL); } else { $this->setDisciplinaId($v->getId()); } $this->aDisciplina = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Disciplina object, it will not be re-added. if ($v !== null) { $v->addGradeunit($this); } return $this; }