Example #1
0
 public function executeSitemap()
 {
     $sitemap = new sfDefaultSitemap();
     $projects = ProjectPeer::doSelect(new Criteria());
     $priority = '0.3';
     $freq = 'weekly';
     foreach ($projects as $project) {
         $item = new sfSitemapItem();
         $item->initialize(array('loc' => '@show_project?project=' . $project->getSlug(), 'lastmod' => $project->getUpdatedAt(), 'changeFreq' => $freq, 'piority' => $priority));
         $sitemap->addItem($item);
     }
     $members = sfGuardUserProfilePeer::doSelect(new Criteria());
     foreach ($members as $member) {
         $item = new sfSitemapItem();
         $item->initialize(array('loc' => '@show_user?user='******'lastmod' => $member->getUpdatedAt(), 'changeFreq' => $freq, 'piority' => $priority));
         $sitemap->addItem($item);
     }
     $features = SuggestedFeaturePeer::doSelect(new Criteria());
     $freq = 'daily';
     foreach ($features as $feature) {
         $item = new sfSitemapItem();
         $item->initialize(array('loc' => '@show_feature?feature=' . $feature->getUuid(), 'lastmod' => $feature->getUpdatedAt(), 'changeFreq' => $freq, 'piority' => $priority));
         $sitemap->addItem($item);
     }
     $this->sitemap = $sitemap;
 }
Example #2
0
 public function executeIndex()
 {
     $this->tab = 'home';
     $this->pages = array(array('label' => 'Home'));
     $this->announcements = ProjectAnnouncementPeer::getRecent(5);
     $this->projects = ProjectPeer::doSelect(new Criteria());
 }
 public static function generate()
 {
     $urls = array();
     $urls[] = new sitemapURL('projects', date('Y-m-d\\TH:i:s\\Z'), 'weekly', 1.0);
     $projects = ProjectPeer::doSelect(new Criteria());
     foreach ($projects as $project) {
         $urls[] = new sitemapURL('projects/' . $project->getTag(), date('Y-m-d\\TH:i:s\\Z'), 'weekly', 0.8);
         $urls[] = new sitemapURL('project/listDevelopers?id=' . $project->getTag(), date('Y-m-d\\TH:i:s\\Z'), 'weekly', 0.8);
     }
     return $urls;
 }
Example #4
0
 public static function getNamesForAutocomplete($q)
 {
     $c = new Criteria();
     $c->add(ProjectPeer::NAME, $q . "%", Criteria::LIKE);
     $c->setLimit(10);
     $names = array();
     $projects = ProjectPeer::doSelect($c);
     foreach ($projects as $p) {
         $names[] = array("id" => $p->getId(), "name" => $p->getName());
     }
     return $names;
 }
Example #5
0
 public function getProjects()
 {
     $c = new Criteria();
     $c->add(ProjectPeer::USER_ID, $this->getId());
     return ProjectPeer::doSelect($c);
 }
 /**
  * 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(ProjectPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(ProjectPeer::DATABASE_NAME);
         $criteria->add(ProjectPeer::ID, $pks, Criteria::IN);
         $objs = ProjectPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Example #7
0
 public function executeAutoComplete()
 {
     $field = $this->getRequestParameter('field');
     $value = $this->getRequestParameter('project_' . $field);
     $this->forward404Unless($field, 'Either field or value missing');
     $c = new Criteria();
     switch ($field) {
         case 'title':
             $c->add(ProjectPeer::TITLE, "%" . $value . "%", Criteria::LIKE);
     }
     //$c->addLimit(3);
     $c->setIgnoreCase(true);
     $this->searchTerm = $value;
     $this->results = ProjectPeer::doSelect($c);
 }
Example #8
0
 public function getProjectsRelatedByOwnerId($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseProjectPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collProjectsRelatedByOwnerId === null) {
         if ($this->isNew()) {
             $this->collProjectsRelatedByOwnerId = array();
         } else {
             $criteria->add(ProjectPeer::OWNER_ID, $this->getId());
             ProjectPeer::addSelectColumns($criteria);
             $this->collProjectsRelatedByOwnerId = ProjectPeer::doSelect($criteria, $con);
         }
     } else {
         if (!$this->isNew()) {
             $criteria->add(ProjectPeer::OWNER_ID, $this->getId());
             ProjectPeer::addSelectColumns($criteria);
             if (!isset($this->lastProjectRelatedByOwnerIdCriteria) || !$this->lastProjectRelatedByOwnerIdCriteria->equals($criteria)) {
                 $this->collProjectsRelatedByOwnerId = ProjectPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastProjectRelatedByOwnerIdCriteria = $criteria;
     return $this->collProjectsRelatedByOwnerId;
 }
Example #9
0
 public function executeList()
 {
     $this->tab = 'projects';
     $this->pages = array(array('label' => 'Home', 'url' => '@homepage'), array('label' => 'Projects'));
     $this->projects = ProjectPeer::doSelect(new Criteria());
 }
Example #10
0
 public function executeProjects()
 {
     $this->ready();
     $criteria = new Criteria();
     $criteria->addJoin(ProjectPeer::ID, ProjectDeveloperPeer::PROJECT_ID);
     $criteria->addJoin(ProjectDeveloperPeer::DEVELOPER_ID, DeveloperPeer::ID);
     $criteria->add(DeveloperPeer::USER_ID, $this->getContext()->getUser()->getSubscriberId());
     $this->projects = ProjectPeer::doSelect($criteria);
     return sfView::SUCCESS;
 }
Example #11
0
 /**
  * Gets an array of Project objects which contain a foreign key that references this object.
  *
  * If this collection has already been initialized with an identical Criteria, it returns the collection.
  * Otherwise if this Status has previously been saved, it will retrieve
  * related Projects from storage. If this Status is new, it will return
  * an empty collection or the current collection, the criteria is ignored on a new object.
  *
  * @param      PropelPDO $con
  * @param      Criteria $criteria
  * @return     array Project[]
  * @throws     PropelException
  */
 public function getProjects($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(StatusPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collProjects === null) {
         if ($this->isNew()) {
             $this->collProjects = array();
         } else {
             $criteria->add(ProjectPeer::STATUS_ID, $this->id);
             ProjectPeer::addSelectColumns($criteria);
             $this->collProjects = ProjectPeer::doSelect($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 the collection.
             $criteria->add(ProjectPeer::STATUS_ID, $this->id);
             ProjectPeer::addSelectColumns($criteria);
             if (!isset($this->lastProjectCriteria) || !$this->lastProjectCriteria->equals($criteria)) {
                 $this->collProjects = ProjectPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastProjectCriteria = $criteria;
     return $this->collProjects;
 }