/**
  * rss and atom feeds
  *
  * @return return_type
  */
 public function executeFeed()
 {
     /** @var sfWebRequest **/
     $request = $this->getContext()->getRequest();
     $IdType = $this->getRequestParameter('IdType', null);
     $id = $this->getRequestParameter('id', null);
     //Build the title
     $title = "Metadata Registry Change History";
     $filter = false;
     switch ($IdType) {
         case "property_id":
             /** @var ConceptProperty **/
             $conceptProperty = ConceptPropertyPeer::retrieveByPK($id);
             if ($conceptProperty) {
                 $vocabularyname = $conceptProperty->getVocabulary() ? $conceptProperty->getVocabulary()->getName() : "?";
                 $title .= " for Property: '" . $conceptProperty->getProfileProperty()->getName() . "' of Concept: '" . $conceptProperty->getConceptRelatedByConceptId()->getPrefLabel() . "' in Vocabulary: '" . $vocabularyname . "'";
             }
             $filter = true;
             break;
         case "concept_id":
             /** @var Concept **/
             $concept = DbFinder::from('Concept')->findPk($id);
             if ($concept) {
                 $title .= " for Concept: '" . $concept->getPrefLabel() . "' in Vocabulary: '" . $concept->getVocabulary()->getName() . "'";
             }
             $filter = true;
             break;
         case "vocabulary_id":
             /** @var Vocabulary **/
             $vocab = DbFinder::from('Vocabulary')->findPk($id);
             if ($vocab) {
                 $title .= " for Vocabulary: '" . $vocab->getName() . "'";
             }
             $filter = true;
             break;
         default:
             //the whole shebang
             $title .= " for all Vocabularies";
             break;
     }
     //special rule for property_id
     $column = "property_id" == $IdType ? "ConceptPropertyId" : sfInflector::camelize($IdType);
     //default limit to 100 if not set in config
     $limit = $request->getParameter('nb', sfConfig::get('app_frontend_feed_count', 100));
     $finder = DbFinder::from('ConceptPropertyHistory')->orderBy('ConceptPropertyHistory.CreatedAt', 'desc')->join('ConceptProperty', 'left join')->join('Concept', 'left join')->join('Vocabulary', 'left join')->join('Status', 'left join')->join('User', 'left join')->join('SkosProperty', 'left join')->with('Vocabulary', 'SkosProperty', 'User', 'Status', 'ConceptProperty', 'Concept');
     if ($filter) {
         $finder = $finder->where('ConceptPropertyHistory.' . $column, $id);
     }
     $finder = $finder->find($limit);
     $this->setTemplate('feed');
     $this->feed = sfFeedPeer::createFromObjects($finder, array('format' => $request->getParameter('format', 'atom1'), 'link' => $request->getUriPrefix() . $request->getPathInfo(), 'feedUrl' => $request->getUriPrefix() . $request->getPathInfo(), 'title' => htmlentities($title), 'methods' => array('authorEmail' => '', 'link' => 'getFeedUniqueId')));
     return;
 }
 /**
  * Set the defaults
  *
  * @param  ConceptProperty $concept_property
  */
 public function setDefaults($discuss)
 {
     $action = $this->getRequest()->getParameter('action');
     if ('create' == strtolower($action)) {
         $filter = $this->getUser()->getAttributeHolder()->getAll('sf_admin/discuss/filters');
         //we need to get all the numbers
         if ($filter && is_array($filter)) {
             $filterKey = array_keys($filter);
             try {
                 switch ($filterKey[0]) {
                     case "property":
                         $property = ConceptPropertyPeer::retrieveByPK($filter[$filterKey[0]]);
                         $concept = $property->getConceptRelatedByConceptId();
                         $vocabId = $concept->getVocabularyId();
                         $vocabulary = myActionTools::findCurrentVocabulary();
                         /** @var Discuss **/
                         $discuss->setConceptProperty($property);
                         $discuss->setConcept($concept);
                         $discuss->setVocabularyId($vocabId);
                         break;
                     case "concept_id":
                         $concept = ConceptPeer::retrieveByPK($filter[$filterKey[0]]);
                         $vocabId = $concept->getVocabularyId();
                         /** @var Discuss **/
                         $discuss->setConcept($concept);
                         $discuss->setVocabularyId($vocabId);
                     case "vocabulary_id":
                         $vocabId = VocabularyPeer::retrieveByPK($filter[$filterKey[0]]);
                         /** @var Discuss **/
                         $discuss->setVocabularyId($vocabId);
                         break;
                     default:
                 }
             } catch (Exception $e) {
             }
         }
     } else {
     }
     parent::setDefaults($discuss);
 }
     if (!isset($vocabulary)) {
         if ($concept) {
             $vocabulary = $concept->getVocabulary();
         }
     }
     $objectId = $concept->getID();
     break;
 case 'conceptprop':
     $showBc = true;
     $showVocabularyBc = true;
     $showConceptBc = true;
     $showconceptpropBc = true;
     if (!isset($concept_property)) {
         $id = 'show' == $action ? $sf_params->get('id') : $paramId;
         if ($id) {
             $concept_property = ConceptPropertyPeer::retrieveByPK($id);
         }
     }
     if (!isset($concept)) {
         if ($concept_property) {
             $concept = $concept_property->getConceptRelatedByConceptId();
         }
     }
     if (!isset($vocabulary)) {
         if ($concept) {
             $vocabulary = $concept->getVocabulary();
         }
     }
     $objectId = $concept_property->getId();
     break;
 case 'historydetail':
 /**
  * Get the associated ConceptProperty object
  *
  * @param      Connection Optional Connection object.
  * @return     ConceptProperty The associated ConceptProperty object.
  * @throws     PropelException
  */
 public function getConceptProperty($con = null)
 {
     if ($this->aConceptProperty === null && $this->pref_label_id !== null) {
         // include the related Peer class
         include_once 'lib/model/om/BaseConceptPropertyPeer.php';
         $this->aConceptProperty = ConceptPropertyPeer::retrieveByPK($this->pref_label_id, $con);
         /* The following can be used instead of the line above to
         		   guarantee the related object contains a reference
         		   to this object, but this level of coupling
         		   may be undesirable in many circumstances.
         		   As it can lead to a db query with many results that may
         		   never be used.
         		   $obj = ConceptPropertyPeer::retrieveByPK($this->pref_label_id, $con);
         		   $obj->addConceptPropertys($this);
         		 */
     }
     return $this->aConceptProperty;
 }
 /**
  * gets the current concept object
  *
  * @return mixed current concept object, or false
  */
 public static function findCurrentConcept()
 {
     $instance = sfContext::getInstance();
     $user = $instance->getUser();
     $request = $instance->getRequest();
     $action = $instance->getActionStack()->getLastEntry()->getActionInstance();
     $attributeHolder = $user->getAttributeHolder();
     //check if there's a request parameter
     $conceptId = $request->getParameter('concept_id', '');
     //concept_id's in the query string
     if ($conceptId) {
         self::updateAdminFilters($attributeHolder, 'concept_id', $conceptId, 'concept_property');
     }
     //concept_id's not in the query string, but it's in a filter
     //note: this will still return the correct value if it's in the query string
     $conceptId = $attributeHolder->get('concept_id', '', 'sf_admin/concept_property/filters');
     $concept = $user->getCurrentConcept();
     //We got here and there's a concept_id but we didn't get the stored concept object
     if ($conceptId && !$concept) {
         //we get it from the database
         $concept = self::setLatestConcept($conceptId);
     }
     //we got here and there's a concept and a conceptid (yay)
     if ($concept and $conceptId) {
         //let's check the id of the stored concept
         $currentId = $concept->getId();
         //but what if the id of that concept doesn't match the one we have
         if ($currentId != $conceptId) {
             //we set the stored object to be the one we know
             $concept = self::setLatestConcept($conceptId);
         }
     }
     //still no concept!!!
     if (!$concept) {
         $idType = $request->getParameter('IdType', null);
         $id = $request->getParameter('id', null);
         switch ($idType) {
             case "property_id":
                 $property = ConceptPropertyPeer::retrieveByPK($id);
                 $conceptId = $property->getConceptId();
                 $concept = self::setLatestConcept($conceptId);
                 self::updateAdminFilters($attributeHolder, 'concept_id', $conceptId, 'concept_property');
                 break;
             case "concept_id":
                 break;
             default:
         }
     }
     //if we get here and there's still no vocabulary then we return false
     $concept = isset($concept) ? $concept : false;
     return $concept;
 }