Exemplo n.º 1
0
 public function getTeachingCompetencysJoinSubject($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseTeachingCompetencyPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collTeachingCompetencys === null) {
         if ($this->isNew()) {
             $this->collTeachingCompetencys = array();
         } else {
             $criteria->add(TeachingCompetencyPeer::EMPLOYEE_ID, $this->getId());
             $this->collTeachingCompetencys = TeachingCompetencyPeer::doSelectJoinSubject($criteria, $con);
         }
     } else {
         $criteria->add(TeachingCompetencyPeer::EMPLOYEE_ID, $this->getId());
         if (!isset($this->lastTeachingCompetencyCriteria) || !$this->lastTeachingCompetencyCriteria->equals($criteria)) {
             $this->collTeachingCompetencys = TeachingCompetencyPeer::doSelectJoinSubject($criteria, $con);
         }
     }
     $this->lastTeachingCompetencyCriteria = $criteria;
     return $this->collTeachingCompetencys;
 }
Exemplo n.º 2
0
 public function executeDelete()
 {
     $emp_id = $this->getRequestParameter('employee_id');
     $emp = EmployeePeer::retrieveByPK($emp_id);
     $this->forward404Unless($emp);
     $this->employee = $emp;
     $teaching_competency = TeachingCompetencyPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($teaching_competency);
     $ref_error = 0;
     foreach ($teaching_competency->getRefCountMethods() as $ref) {
         $method = "count" . $ref['affix'];
         $count = $teaching_competency->{$method}();
         if ($count > 0) {
             ++$ref_error;
             $this->getRequest()->setError('teaching_competency/delete/' . sfInflector::camelize($ref['table']), $count);
         }
     }
     if ($ref_error > 0) {
         $this->getRequest()->setError('teaching_competency/delete', '_ERR_DELETE_ (' . $teaching_competency->toString() . ' - id:' . $teaching_competency->getId() . ')');
     } else {
         $teaching_competency->delete();
     }
     $this->getRequest()->setParameter('employee_id', $emp_id);
     return $this->forward('teaching_competency', 'list');
 }
Exemplo n.º 3
0
 public function executeGetLectors()
 {
     $subject_curr_id = $this->getRequestParameter('subject_curr_id');
     $subject_curr = SubjectCurrPeer::retrieveByPk($subject_curr_id);
     $c = new Criteria();
     $c->add(TeachingCompetencyPeer::SUBJECT_ID, $subject_curr->getSubjectId());
     $objs = TeachingCompetencyPeer::doSelect($c);
     $lectors = array();
     foreach ($objs as $o) {
         $lectors[$o->getEmployeeId()] = $o->getEmployee()->getName();
     }
     $this->content = $lectors;
     $this->setTemplate('buildOptions');
 }
Exemplo n.º 4
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(TeachingCompetencyPeer::ID, $pks, Criteria::IN);
         $objs = TeachingCompetencyPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Exemplo n.º 5
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = TeachingCompetencyPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setEmployeeId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setSubjectId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setStatus($arr[$keys[3]]);
     }
 }