/** * Get the associated RatingField object * * @param PropelPDO Optional Connection object. * @return RatingField The associated RatingField object. * @throws PropelException */ public function getRatingField(PropelPDO $con = null) { if ($this->aRatingField === null && $this->field_id !== null) { $c = new Criteria(RatingFieldPeer::DATABASE_NAME); $c->add(RatingFieldPeer::ID, $this->field_id); $this->aRatingField = RatingFieldPeer::doSelectOne($c, $con); /* 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->aRatingField->addCourseRatings($this); */ } return $this->aRatingField; }
public function executeAjaxFindScales(sfWebRequest $request) { if (!$request->isXmlHttpRequest()) { $this->forward404(); } if (!$request->hasParameter("mapping_criterion")) { throw new Exception("ajax_query does not exist"); } $selCriterion = $request->getParameter("mapping_criterion"); $c = new Criteria(); $crit1 = $c->getNewCriterion(RatingFieldPeer::DESCR, $selCriterion); $c->addAnd($crit1); $selCriterion = RatingFieldPeer::doSelectOne($c); echo "<script type='text/javascript'>var selEl = document.getElementById('mapping_table').rows[parseInt(selected_row_index)+1].cells[5].children[0]; selEl.innerHTML=\""; if (!isset($selCriterion)) { echo "<option value=''></option>\";makeSelectSelection(selEl, document.getElementById('mapping_scale'));</script>"; return sfView::NONE; } $ratingType = $selCriterion->getEnumItem(); switch ($ratingType->getEnumItemRelatedByParentId()->getId()) { case EnumItemPeer::RATING_SCALE: $num = $ratingType->getDescr(); for ($i = 0; $i < $num; $i++) { echo "<option value={$i}>{$i}</option>"; } break; case EnumItemPeer::RATING_TYPES_NODE_ID: if ($ratingType->getId() == EnumItemPeer::RATING_BOOLEAN) { echo "<option value=1>Yes</option><option value=0>No</option>"; } else { echo "<option value=''></option>"; } break; } echo "\"; makeSelectSelection(selEl, document.getElementById('mapping_scale'));</script>"; return sfView::NONE; }