public function getParentName() { if ($this->getParent() != null && $this->getParent() != 0) { return CounselingSpecPeer::retrieveByPk($this->getParent())->getDescription(); } return '-'; }
public static function getParents() { $parents = array(); foreach (CounselingSpecPeer::doSelect(new Criteria()) as $d) { if (count($d->getCounselingSpecsRelatedByParent()) > 0) { $parents[] = $d->getId(); } } return $parents; }
public function countCounselingSpecsRelatedByParent($criteria = null, $distinct = false, $con = null) { include_once 'lib/model/om/BaseCounselingSpecPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } $criteria->add(CounselingSpecPeer::PARENT, $this->getId()); return CounselingSpecPeer::doCount($criteria, $distinct, $con); }
public function executeDelete() { $counseling_spec = CounselingSpecPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($counseling_spec); $ref_error = 0; foreach ($counseling_spec->getRefCountMethods() as $ref) { $method = "count" . $ref['affix']; $count = $counseling_spec->{$method}(); if ($count > 0) { ++$ref_error; $this->getRequest()->setError('counseling_spec/delete/' . sfInflector::camelize($ref['table']), $count); } } if ($ref_error > 0) { $this->getRequest()->setError('counseling_spec/delete', '_ERR_DELETE_ (' . $counseling_spec->toString() . ' - id:' . $counseling_spec->getId() . ')'); } else { $counseling_spec->delete(); } return $this->forward('counseling_spec', 'list'); }
public function getCounselingSpec($con = null) { include_once 'lib/model/om/BaseCounselingSpecPeer.php'; if ($this->aCounselingSpec === null && $this->counseling_spec_id !== null) { $this->aCounselingSpec = CounselingSpecPeer::retrieveByPK($this->counseling_spec_id, $con); } return $this->aCounselingSpec; }
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(CounselingSpecPeer::ID, $pks, Criteria::IN); $objs = CounselingSpecPeer::doSelect($criteria, $con); } return $objs; }
public static function doSelectJoinAllExceptSubjectCurr(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } CounselingRaportPeer::addSelectColumns($c); $startcol2 = CounselingRaportPeer::NUM_COLUMNS - CounselingRaportPeer::NUM_LAZY_LOAD_COLUMNS + 1; StudentAccalPeer::addSelectColumns($c); $startcol3 = $startcol2 + StudentAccalPeer::NUM_COLUMNS; CounselingSpecPeer::addSelectColumns($c); $startcol4 = $startcol3 + CounselingSpecPeer::NUM_COLUMNS; $c->addJoin(CounselingRaportPeer::STUDENT_ACCAL_ID, StudentAccalPeer::ID); $c->addJoin(CounselingRaportPeer::COUNSELING_SPEC_ID, CounselingSpecPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = CounselingRaportPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = StudentAccalPeer::getOMClass(); $cls = Propel::import($omClass); $obj2 = new $cls(); $obj2->hydrate($rs, $startcol2); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj2 = $temp_obj1->getStudentAccal(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addCounselingRaport($obj1); break; } } if ($newObject) { $obj2->initCounselingRaports(); $obj2->addCounselingRaport($obj1); } $omClass = CounselingSpecPeer::getOMClass(); $cls = Propel::import($omClass); $obj3 = new $cls(); $obj3->hydrate($rs, $startcol3); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj3 = $temp_obj1->getCounselingSpec(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addCounselingRaport($obj1); break; } } if ($newObject) { $obj3->initCounselingRaports(); $obj3->addCounselingRaport($obj1); } $results[] = $obj1; } return $results; }
<td colspan="2" width="100%" align="left" valign="top"> <table width="100%" class="list_content"> <tr> <th align="center" ><?php echo $counseling_spec->getDescription() ? $counseling_spec->getDescription() : ''; ?> </th> <th align="center" width="5%">S</th> <th align="center" width="5%">PP</th> <th align="center" width="5%">B</th> </tr> <?php $ct = new Criteria(); $ct->add(CounselingSpecPeer::PARENT, $counseling_spec->getId()); $ct->addAscendingOrderByColumn(CounselingSpecPeer::ID); $specs = CounselingSpecPeer::doSelect($ct); $i = 0; foreach ($specs as $spec) { $i++; ?> <tr> <th align="left" style="font-weight: normal; padding: 0px 2px; "><?php echo $i . '. '; echo $spec->getDescription() ? $spec->getDescription() : ''; ?> </th> <th style="font-style: normal; padding: 0px 2px;"> <?php if ($stu_coun[$spec->getId()] == 10) { echo 'v'; } else {