Exemplo n.º 1
0
 public static function getAllForParentNodeId($parentId, PropelPDO $propelConnection = null)
 {
     $c = new Criteria();
     $c->add(EnumItemPeer::PARENT_ID, $parentId);
     $c->addAscendingOrderByColumn(EnumItemPeer::DESCR);
     return EnumItemPeer::doselect($c, $propelConnection);
 }
Exemplo n.º 2
0
 protected function getDisciplineList(Criteria $c = null)
 {
     if ($c === null) {
         return EnumItemPeer::doSelect(new Criteria());
     } else {
         return EnumItemPeer::doSelect($c);
     }
 }
Exemplo n.º 3
0
 /**
  * Returns the largest available ID for a given parent id
  * If none available, returns 0
  * @param PropelPDO $parentId
  * @param $conn
  * @return unknown_type
  */
 public static function getLargestAvailableIdForNodeId($parentId, PropelPDO $conn = null)
 {
     if (!isset($conn)) {
         $conn = Propel::getConnection();
     }
     $query = "SELECT MAX(%s) FROM %s WHERE %s=%s";
     $query = sprintf($query, EnumItemPeer::ID, EnumItemPeer::TABLE_NAME, EnumItemPeer::PARENT_ID, $parentId);
     $statement = $conn->prepare($query);
     $statement->execute();
     $resultset = $statement->fetchAll(PDO::FETCH_COLUMN, 0);
     $id = $resultset[0] + 1;
     $item = EnumItemPeer::retrieveByPK($id, $conn);
     if (!isset($item)) {
         return $id;
     } else {
         return 0;
     }
 }
Exemplo n.º 4
0
 public function executeRatingfields(sfWebRequest $request)
 {
     if (helperFunctions::isLoggedIn($request)) {
         $this->buildSubmenu();
         $this->form = new skuleForm("frm", "maintenance/ratingfields", $request);
         $conn = Propel::getConnection();
         $this->ratingTypeList = array();
         $ratingTypeList = EnumItemPeer::getAllForParentNodeId(EnumItemPeer::RATING_TYPES_NODE_ID, $conn);
         foreach ($ratingTypeList as $enumObj) {
             $this->ratingTypeList[$enumObj->getId()] = $enumObj->getDescr();
             //TODO
             $this->selectedRatingType = $enumObj->getId();
         }
     } else {
         // redirect to log in page
         $this->buildSubmenu();
     }
 }
Exemplo n.º 5
0
 public function executeDelete(sfWebRequest $request)
 {
     $request->checkCSRFProtection();
     $this->forward404Unless($discipline = EnumItemPeer::retrieveByPk($request->getParameter('id')), sprintf('Object enum_item does not exist (%s).', $request->getParameter('id')));
     try {
         $discipline->delete();
         $par = "";
         if ($request->hasParameter("page")) {
             $par = "?page=" . $request->getParameter("page");
         }
         $this->redirect('admindiscipline/index' . $par);
     } catch (Exception $e) {
         $this->globalErrors = $e->getMessage();
         $this->enum_item_list = $this->getDisciplineList();
         $values = array('discipline' => 1);
         $this->form = new DisciplineForm($discipline, $values);
         $this->getDisAssocListFromDB($discipline);
         $this->setTemplate('index');
     }
 }
 /**
  * Executes query and hydrate this object
  *
  * @param       string $query the query being searched for
  */
 public function query($query, $propelConnection)
 {
     $refQuery = trim($query);
     if (strlen($refQuery) < 3) {
         throw new Exception("Too few characters in the query string");
     } elseif (helperFunctions::isMaliciousString($refQuery)) {
         throw new Exception("Malicious string detected. Are you trying to wreck our system?");
     } else {
         // search for courses
         $c = new Criteria();
         $idCrit = $c->getNewCriterion(CoursePeer::ID, $refQuery . "%", Criteria::LIKE);
         $nameCrit = $c->getNewCriterion(CoursePeer::DESCR, "%" . $refQuery . "%", Criteria::LIKE);
         $idCrit->addOr($nameCrit);
         $c->addAnd($idCrit);
         $c->setDistinct();
         $c->addAscendingOrderByColumn(CoursePeer::ID);
         $this->_courseList = CoursePeer::doselect($c, $propelConnection);
         // search for professors
         $c = new Criteria();
         $firstNameCrit = $c->getNewCriterion(InstructorPeer::FIRST_NAME, "%" . $refQuery . "%", Criteria::LIKE);
         $lastNameCrit = $c->getNewCriterion(InstructorPeer::LAST_NAME, "%" . $refQuery . "%", Criteria::LIKE);
         $firstNameCrit->addOr($lastNameCrit);
         $c->addAnd($firstNameCrit);
         $c->setDistinct();
         $c->addAscendingOrderByColumn(InstructorPeer::LAST_NAME);
         $this->_profList = InstructorPeer::doSelect($c, $propelConnection);
         // search for programs
         $c = new Criteria();
         $descrCrit = $c->getNewCriterion(EnumItemPeer::DESCR, "%" . $refQuery . "%", Criteria::LIKE);
         $parentCrit = $c->getNewCriterion(EnumItemPeer::PARENT_ID, EnumItemPeer::DISCIPLINES_NODE_ID);
         $c->addAnd($parentCrit);
         $c->addAnd($descrCrit);
         $c->setDistinct();
         $c->addAscendingOrderByColumn(EnumItemPeer::DESCR);
         $this->_programList = EnumItemPeer::doSelect($c, $propelConnection);
     }
 }
Exemplo n.º 7
0
 /**
  * Returns the number of related EnumItem objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      PropelPDO $con
  * @return     int Count of related EnumItem objects.
  * @throws     PropelException
  */
 public function countEnumItemsRelatedByParentId(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(EnumItemPeer::DATABASE_NAME);
     } else {
         $criteria = clone $criteria;
     }
     if ($distinct) {
         $criteria->setDistinct();
     }
     $count = null;
     if ($this->collEnumItemsRelatedByParentId === null) {
         if ($this->isNew()) {
             $count = 0;
         } else {
             $criteria->add(EnumItemPeer::PARENT_ID, $this->id);
             $count = EnumItemPeer::doCount($criteria, $con);
         }
     } else {
         // criteria has no effect for a new object
         if (!$this->isNew()) {
             // 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 count of the collection.
             $criteria->add(EnumItemPeer::PARENT_ID, $this->id);
             if (!isset($this->lastEnumItemRelatedByParentIdCriteria) || !$this->lastEnumItemRelatedByParentIdCriteria->equals($criteria)) {
                 $count = EnumItemPeer::doCount($criteria, $con);
             } else {
                 $count = count($this->collEnumItemsRelatedByParentId);
             }
         } else {
             $count = count($this->collEnumItemsRelatedByParentId);
         }
     }
     return $count;
 }
 /**
  * Selects a collection of RatingField objects pre-filled with all related objects.
  *
  * @param      Criteria  $c
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of RatingField objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     foreach (sfMixer::getCallables('BaseRatingFieldPeer:doSelectJoinAll:doSelectJoinAll') as $callable) {
         call_user_func($callable, 'BaseRatingFieldPeer', $c, $con);
     }
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     RatingFieldPeer::addSelectColumns($c);
     $startcol2 = RatingFieldPeer::NUM_COLUMNS - RatingFieldPeer::NUM_LAZY_LOAD_COLUMNS;
     EnumItemPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (EnumItemPeer::NUM_COLUMNS - EnumItemPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(RatingFieldPeer::TYPE_ID), array(EnumItemPeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = RatingFieldPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = RatingFieldPeer::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 {
             $omClass = RatingFieldPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             RatingFieldPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined EnumItem rows
         $key2 = EnumItemPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = EnumItemPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = EnumItemPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 EnumItemPeer::addInstanceToPool($obj2, $key2);
             }
             // if obj2 loaded
             // Add the $obj1 (RatingField) to the collection in $obj2 (EnumItem)
             $obj2->addRatingField($obj1);
         }
         // if joined row not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Exemplo n.º 9
0
 /**
  * Get the associated EnumItem object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     EnumItem The associated EnumItem object.
  * @throws     PropelException
  */
 public function getEnumItem(PropelPDO $con = null)
 {
     if ($this->aEnumItem === null && $this->type_id !== null) {
         $c = new Criteria(EnumItemPeer::DATABASE_NAME);
         $c->add(EnumItemPeer::ID, $this->type_id);
         $this->aEnumItem = EnumItemPeer::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->aEnumItem->addRatingFields($this);
         		 */
     }
     return $this->aEnumItem;
 }
Exemplo n.º 10
0
 private function getMenuStud()
 {
     $conn = Propel::getConnection();
     $arr = EnumItemPeer::getAllForParentNodeId(EnumItemPeer::EXAM_TYPES_NODE_ID);
     $str = "<div class='grayout_dialog' id='submitExam'>\n    <script type='text/javascript'>\n    \tfunction securityFrameOnLoad(){\n    \t\tif (hidSecurityFrame.document.getElementById('status')) {\n    \t\t\tvar status = hidSecurityFrame.document.getElementById('status').value; \n    \t\t\tif (status == 'Success'){\n    \t\t\t\tdocument.getElementById('inputButtons').style.display = 'none';\n    \t\t\t\tdocument.getElementById('successButtons').style.display = 'block';\n    \t\t\t\tdispStatus('Submission Successful');\n    \t\t\t} else if (status == 'Security'){\n    \t\t\t\tdispStatus('Security string does not match.');\n    \t\t\t} else {\n    \t\t\t\tdispStatus('An error occurred. Please try again later.');\n    \t\t\t}\n    \t\t}\n    \t}\n    \t\n    \tfunction submitExamOnSubmit(){\n    \t\t// check that everything has been filled in before submission\n    \t\tvar year = trim(document.exam_submission.year.value);\n    \t\tif (year == ''){\n    \t\t\tdispStatus('You must specify a year.');\n    \t\t\treturn false;\n    \t\t}\n    \t\tif (isNaN(year) || year < 1990 || year > 2020){\n    \t\t\tdispStatus('Year must be bigger than 1990 and smaller than 2020.');\n    \t\t\treturn false;\n    \t\t}\n    \t\tif (trim(document.exam_submission.security.value) == ''){\n    \t\t\tdispStatus('You must type in the security string.');\n    \t\t\treturn false;\n    \t\t}\n    \t\tif (trim(document.exam_submission.descr.value) == ''){\n    \t\t\tdispStatus('You must type in the display title.');\n    \t\t\treturn false;\n    \t\t}\n    \t\tvar fileName = trim(document.exam_submission.file.value);\n    \t\tif (fileName == ''){\n    \t\t\tdispStatus('No file has been selected.');\n    \t\t\treturn false;\n    \t\t}\n    \t\tif (fileName.lastIndexOf('pdf')==-1 && fileName.lastIndexOf('PDF')==-1){\n    \t\t\tdispStatus('Only a PDF file can be submitted.');\n    \t\t\treturn false;\n    \t\t}\n\n    \t\treturn true;\n    \t}\n    \t\n    \tfunction dispStatus(msg){\n    \t\tdocument.getElementById('statusSpan').style.display = 'block';\n    \t\tdocument.getElementById('statusSpan').innerHTML = msg;\n    \t}\n    \t\n    \tfunction cancelAction(){\n    \t\tgrayout('submitExam');\n    \t\tdocument.getElementById('statusSpan').style.display = 'none';\n    \t\tdocument.getElementById('inputButtons').style.display = 'block';\n    \t\tdocument.getElementById('successButtons').style.display = 'none';\n    \t\tdocument.exam_submission.security.value='';\n    \t}\n    </script>\n    <h3>Submit Exam</h3>\n    <form name='exam_submission' method='post' enctype='multipart/form-data' action='" . url_for("invisible/submitExam") . "' target='hidSecurityFrame'>\n\t    <table>\n\t\t    <tr><td width='100'>Course:</td><td align='left'>{$this->_courseId}\n\t\t    <input type='hidden' name='course' value='{$this->_courseId}'/></td></tr>\n\t\t    <tr><td>Type:</td><td align='left'><select name='type' style='width:100px'>";
     foreach ($arr as $enum) {
         $str .= "<option value='{$enum->getId()}'>{$enum->getDescr()}</option>";
     }
     $str .= "</select></td></tr>\n\t\t    <tr><td>Year:</td><td align='left'><input type='text' name='year' style='width:100px'/></td></tr>\n\t\t    <tr><td>Term:</td><td>\n\t\t    \t<input type='radio' name='term' id='radioFall' value='9' CHECKED><label for='radioFall'>Fall</label>\n\t\t    \t<input type='radio' name='term' id='radioSummer' value='5'><label for='radioSummer'>Summer</label>\n\t\t    \t<input type='radio' name='term' id='radioWinter' value='1'><label for='radioWinter'>Winter</label>\n\t\t    </td></tr>\n\t\t    <tr><td>Display Title:</td><td align='left'><input type='text' name='descr' /></td></tr>\n\t\t    <tr><td>File:</td><td align='left'><input type='file' name='file' /></td></tr>\n\t\t    <tr><td>&nbsp;</td></tr>\n\t\t    <tr><td></td><td align='left'><img src='" . url_for('invisible/securityImage') . "'/></td></tr>\n\t\t    <tr><td>Security String:</td><td><input type='text' name='security' /></td></tr>\n\t    </table><br/>\n    \t<div id='inputButtons'><input type='submit' onclick='return submitExamOnSubmit();' value='Submit'/><input type='button' onclick='cancelAction()' value='Cancel'/></div>\n    \t<div id='successButtons' style='display:none'><input type='button' onclick='cancelAction()' value='Close'/></div>\n    </form>\n    <iframe name='hidSecurityFrame' style='display:none' onload='securityFrameOnLoad()';></iframe>\n    <br/><span style='display:none' id='statusSpan'>Please wait...</span>\n    </div>";
     if ($this->_menuOption == subMenuOptions::SEARCH) {
         $str .= "<dl><dt>Search</dt></dl>";
     } else {
         $str .= "<dl><dt>" . link_to("Search", "search/index") . "</dt></dl>";
     }
     return $str;
 }
Exemplo n.º 11
0
 /**
  * Selects a collection of ImportMapping objects pre-filled with all related objects except RatingField.
  *
  * @param      Criteria  $c
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of ImportMapping objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptRatingField(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     // $c->getDbName() will return the same object if not set to another value
     // so == check is okay and faster
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     ImportMappingPeer::addSelectColumns($c);
     $startcol2 = ImportMappingPeer::NUM_COLUMNS - ImportMappingPeer::NUM_LAZY_LOAD_COLUMNS;
     EnumItemPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (EnumItemPeer::NUM_COLUMNS - EnumItemPeer::NUM_LAZY_LOAD_COLUMNS);
     EnumItemPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + (EnumItemPeer::NUM_COLUMNS - EnumItemPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(ImportMappingPeer::IMPORT_FILE_TYPE), array(EnumItemPeer::ID), $join_behavior);
     $c->addJoin(array(ImportMappingPeer::MAPPING), array(EnumItemPeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = ImportMappingPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = ImportMappingPeer::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 {
             $omClass = ImportMappingPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             ImportMappingPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined EnumItem rows
         $key2 = EnumItemPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = EnumItemPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = EnumItemPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 EnumItemPeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (ImportMapping) to the collection in $obj2 (EnumItem)
             $obj2->addImportMappingRelatedByImportFileType($obj1);
         }
         // if joined row is not null
         // Add objects for joined EnumItem rows
         $key3 = EnumItemPeer::getPrimaryKeyHashFromRow($row, $startcol3);
         if ($key3 !== null) {
             $obj3 = EnumItemPeer::getInstanceFromPool($key3);
             if (!$obj3) {
                 $omClass = EnumItemPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj3 = new $cls();
                 $obj3->hydrate($row, $startcol3);
                 EnumItemPeer::addInstanceToPool($obj3, $key3);
             }
             // if $obj3 already loaded
             // Add the $obj1 (ImportMapping) to the collection in $obj3 (EnumItem)
             $obj3->addImportMappingRelatedByMapping($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Exemplo n.º 12
0
<?php

$conn = Propel::getConnection();
$arr = EnumItemPeer::getAllForParentNodeId(EnumItemPeer::EXAM_TYPES_NODE_ID, $conn);
?>

<div class='grayout_dialog' id='submitExam'>
    <script type='text/javascript'>
    	function securityFrameOnLoad(){
    		if (hidSecurityFrame.document.getElementById('status')) {
    			var status = hidSecurityFrame.document.getElementById('status').value; 
    			if (status == 'Success'){
    				document.getElementById('inputButtons').style.display = 'none';
    				document.getElementById('successButtons').style.display = 'block';
    				dispStatus('Submission Successful');
    			} else if (status == 'Security'){
    				dispStatus('Security string does not match.');
    			} else {
    				dispStatus('An error occurred. Please try again later.');
    			}
    		}
    	}
    	
    	function submitExamOnSubmit(){
    		// check that everything has been filled in before submission
    		var year = trim(document.exam_submission.year.value);
    		if (year == ''){
    			dispStatus('You must specify a year.');
    			return false;
    		}
    		if (isNaN(year) || year < 1990 || year > 2020){
Exemplo n.º 13
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(EnumItemPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(EnumItemPeer::DATABASE_NAME);
         $criteria->add(EnumItemPeer::ID, $pks, Criteria::IN);
         $objs = EnumItemPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Exemplo n.º 14
0
 public function executeSearchByProgram(sfWebRequest $request)
 {
     $conn = Propel::getConnection();
     $today = getdate();
     $this->searchType = searchActions::SEARCH_BY_PROGRAM;
     $rawProgList = EnumItemPeer::getAllForParentNodeId(EnumItemPeer::DISCIPLINES_NODE_ID, $conn);
     $this->programList = array();
     foreach ($rawProgList as $obj) {
         $this->programList[$obj->getId()] = $obj->getDescr();
     }
     $this->yearList = array("0" => "All", "1" => "First Year", "2" => "Second Year", "3" => "Third Year", "4" => "Fourth Year");
     if ($request->hasParameter("year") && $request->hasParameter("program")) {
         $this->programId = $request->getParameter("program");
         if (helperFunctions::isMaliciousString($this->programId)) {
             $this->forward404();
         }
         $this->year = $request->getParameter("year");
         if (helperFunctions::isMaliciousString($this->year)) {
             $this->forward404();
         }
         // get result set
         $enum = EnumItemPeer::retrieveByPK($this->programId, $conn);
         $this->resultTitle = "Results for " . $enum->getDescr();
         $this->results = CoursePeer::findCoursesByDisciplineIdAndYear($this->programId, $this->year, $conn);
     } else {
         $this->programId = $rawProgList[0]->getId();
         $this->year = 1;
     }
 }
Exemplo n.º 15
0
 public function executeEdit(sfWebRequest $request)
 {
     $this->scale_PID = skuleadminConst::RATING_SCALE_TYPES_PID;
     $this->forward404Unless($rating_field = RatingFieldPeer::retrieveByPk($request->getParameter('id')), sprintf('Object rating_field does not exist (%s).', $request->getParameter('id')));
     if ($rating_field->getIsReserved()) {
         $this->is_reserved = true;
         $this->rating = array('descr' => $rating_field->getDescr());
         $c = new Criteria();
         $c->add(EnumItemPeer::ID, $rating_field->getTypeId());
         $type = EnumItemPeer::doSelectOne($c);
         if ($rating_field->getTypeId() > 30 && $rating_field->getTypeId() < 40) {
             //its a scale!
             $c2 = new Criteria();
             $c2->add(EnumItemPeer::ID, $type->getParentId());
             $type_parent = EnumItemPeer::doSelectOne($c2);
             $this->rating['type_id'] = $type_parent->getDescr();
             $this->rating['scale'] = $type->getDescr();
         } else {
             $this->rating['type_id'] = $type->getDescr();
         }
     } else {
         $this->form = new RatingFieldForm($rating_field);
         if ($rating_field->getTypeId() > 30 && $rating_field->getTypeId() < 40) {
             $c = new Criteria();
             $c->add(EnumItemPeer::ID, $rating_field->getTypeId());
             $type = EnumItemPeer::doSelectOne($c);
             $this->form->setValue('type_scale', $type->getParentId());
             $this->form->setValue('scale', $rating_field->getTypeId());
         }
     }
     $this->rating_field_list = $this->getRatingCriteriaList();
     $this->setTemplate('list');
 }