Beispiel #1
0
 public function executeIndex()
 {
     $this->tab = 'home';
     $this->pages = array(array('label' => 'Home'));
     $this->announcements = ProjectAnnouncementPeer::getRecent(5);
     $this->projects = ProjectPeer::doSelect(new Criteria());
 }
Beispiel #2
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;
 }
Beispiel #3
0
 public function executeListDevelopers()
 {
     $this->tab = 'projects';
     $this->project = ProjectPeer::retrieveByTag($this->getRequestParameter('id'));
     $this->pages = array(array('label' => 'Home', 'url' => '@homepage'), array('label' => 'Projects', 'url' => 'project/list'), array('label' => $this->project->getName(), 'url' => 'project/show?id=' . $this->project->getTag()), array('label' => 'Project Team'));
     $this->developers = $this->project->getDevelopers();
 }
Beispiel #4
0
 public function getProject()
 {
     if (strtolower($this->getModel()) == 'project') {
         $project = ProjectPeer::retrieveByPk($this->getModelId());
         if ($project != null) {
             return $project;
         }
     }
     return false;
 }
Beispiel #5
0
 public function executeAjaxCloneAndAcceptApplicant()
 {
     $project = ProjectPeer::retrieveByUuid($this->getRequestParameter('project'));
     $this->forward404Unless($project, 'Project not found, unable to accept applicant');
     if ($project->clonePositionAcceptApplicant($this->getRequestParameter('position'), $this->getRequestParameter('user')) == false) {
         $this->forward404('Unable to add position, error.');
     }
     $this->setTemplate('ajaxAddPosition');
     $this->newPosition = new ProjectPosition();
     $this->project = $project;
 }
 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;
 }
Beispiel #7
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;
 }
Beispiel #8
0
 public function preExecute()
 {
     $this->logMessage('Action: [' . $this->getContext()->getActionName() . ']');
     //if ($this->getContext()->getActionName() != 'userLatestPosts')
     //{
     $this->project = ProjectPeer::retrieveBySlug($this->getRequestParameter('project'));
     $this->forward404Unless($this->project, 'Project not found, unable to retrieve forums');
     //}
     $this->anonymousPosting = sfConfig::get('app_nahoWikiPlugin_allow_anonymous_edit', false);
     $this->startPage = sfConfig::get('app_nahoWikiPlugin_start_page', 'index');
     $this->credentialsPost = sfConfig::get('app_nahoWikiPlugin_credentials_edit', array());
     $this->tab = sfConfig::get('app_tab_project_forums');
 }
 public static function getPager($page, $project_id = null)
 {
     $c = new Criteria();
     $c->addDescendingOrderByColumn(ProjectAnnouncementPeer::CREATED_AT);
     if ($project_id) {
         $c->add(ProjectAnnouncementPeer::PROJECT_ID, ProjectPeer::retrieveByTag($project_id)->getId());
     }
     $pager = new sfPropelPager('ProjectAnnouncement', sfConfig::get('app_pager_max'));
     $pager->setCriteria($c);
     $pager->setPage($page);
     $pager->init();
     return $pager;
 }
Beispiel #10
0
 public function executeUpdate()
 {
     $jira = new sfJiraPlugin($this->getUser()->getProfile()->getJiraLogin(), $this->getUser()->getProfile()->getJiraPassword());
     $aProjects = $jira->getProjects();
     foreach ($aProjects as $project) {
         #var_dump( $project );
         $c = new Criteria();
         $c->add(ProjectPeer::USER_ID, $this->getUser()->getProfile()->getId());
         $c->add(ProjectPeer::KEY, $project->key);
         $p = ProjectPeer::doSelectOne($c);
         $c = new Criteria();
         $c->add(UserPeer::JIRA_LOGIN, $project->lead);
         $u = UserPeer::doSelectOne($c);
         if (empty($p)) {
             $p = new Project();
             $p->setKey($project->key);
             $p->setLeadId(!empty($u) ? $u->getId() : null);
             $p->setUserId($this->getUser()->getProfile()->getId());
             $p->setName($project->name);
             $p->setUpdated(date('r'));
             $p->save();
         }
         $issues = $jira->getIssuesForProject($p->getKey());
         foreach ($issues as $issue) {
             #die($p->getKey());
             if ($issue->assignee == $this->getUser()->getProfile()->getJiraLogin()) {
                 $c = new Criteria();
                 $c->add(TaskPeer::KEY, $issue->key);
                 $t = TaskPeer::doSelectOne($c);
                 if (empty($t)) {
                     $c = new Criteria();
                     $c->add(UserPeer::JIRA_LOGIN, $issue->reporter);
                     $u = UserPeer::doSelectOne($c);
                     $t = new Task();
                     $t->setProjectId($p->getId());
                     $t->setTitle($issue->summary);
                     $t->setDescription($issue->description);
                     $t->setKey($issue->key);
                     $t->setUpdated(date('r'));
                     $t->setStatusId($issue->status);
                     $t->setPriorityId($issue->priority);
                     $t->setLeadId(!empty($u) ? $u->getId() : null);
                     $t->save();
                 }
             }
         }
     }
     $this->redirect('@homepage');
     return sfView::NONE;
 }
Beispiel #11
0
 /**
  * Executes Sandbox2 action
  *
  */
 public function executeSandbox2()
 {
     $this->forward404Unless($this->project = ProjectPeer::retrieveBySlug($this->getRequestParameter('project')), 'Project not found');
     $this->forward404Unless($this->getUser()->isAuthenticated() && $this->project->isAdmin($this->getUser()->getId()));
     $form = $this->project->getForm($this->getRequestParameter('form'));
     if ($form == null) {
         $this->project->setDefaultForm($this->getRequestParameter('form'));
     }
     $area = $this->getRequestParameter('area');
     $widget = $this->getRequestParameter('id');
     $widget = explode('_', $widget);
     $widget = $widget[0];
     $setting = $this->getRequestParameter('setting');
     switch ($area) {
         case '1':
             $form->setWidget1($widget);
             if (isset($setting)) {
                 $form->setWidget1Setting($this->getRequestParameter('setting'));
             }
             $form->save();
             break;
         case '2':
             $form->setWidget2($widget);
             if (isset($setting)) {
                 $form->setWidget2Setting($this->getRequestParameter('setting'));
             }
             $form->save();
             break;
         case '3':
             $form->setWidget3($widget);
             if (isset($setting)) {
                 $form->setWidget3Setting($this->getRequestParameter('setting'));
             }
             $form->save();
             break;
         case '4':
             $form->setWidget4($widget);
             if (isset($setting)) {
                 $form->setWidget4Setting($this->getRequestParameter('setting'));
             }
             $form->save();
             break;
     }
     $this->area = $area;
     $this->widget = $widget;
     $this->form = $form;
 }
Beispiel #12
0
 public static function setJobProjectIds($jobs, $projectId)
 {
     $c1 = new Criteria();
     $c2 = new Criteria();
     $c1->add(JobPeer::ID, $jobs, Criteria::IN);
     $c2->add(JobPeer::PROJECT_ID, $projectId);
     BasePeer::doUpdate($c1, $c2, Propel::getConnection());
     $project = ProjectPeer::retrieveByPK($projectId);
     foreach ($jobs as $id) {
         $logEntry = new Log();
         $logEntry->setWhen(time());
         $logEntry->setPropelClass("Job");
         $logEntry->setSfGuardUserProfileId(sfContext::getInstance()->getUser()->getUserId());
         $logEntry->setMessage("Moved job to project" . $project->getName());
         $logEntry->setLogMessageTypeId(sfConfig::get("app_log_type_move_to_project"));
         $logEntry->setPropelId($id);
         $logEntry->save();
     }
 }
Beispiel #13
0
 /**
  * Selects a collection of Build objects pre-filled with all related objects.
  *
  * @param      Criteria  $criteria
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of Build objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $criteria = clone $criteria;
     // Set the correct dbName if it has not been overridden
     if ($criteria->getDbName() == Propel::getDefaultDB()) {
         $criteria->setDbName(self::DATABASE_NAME);
     }
     BuildPeer::addSelectColumns($criteria);
     $startcol2 = BuildPeer::NUM_COLUMNS - BuildPeer::NUM_LAZY_LOAD_COLUMNS;
     ProjectPeer::addSelectColumns($criteria);
     $startcol3 = $startcol2 + (ProjectPeer::NUM_COLUMNS - ProjectPeer::NUM_LAZY_LOAD_COLUMNS);
     $criteria->addJoin(BuildPeer::TASK_ID, ProjectPeer::ID, $join_behavior);
     $stmt = BasePeer::doSelect($criteria, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = BuildPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = BuildPeer::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 {
             $cls = BuildPeer::getOMClass(false);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             BuildPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Project rows
         $key2 = ProjectPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = ProjectPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $cls = ProjectPeer::getOMClass(false);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 ProjectPeer::addInstanceToPool($obj2, $key2);
             }
             // if obj2 loaded
             // Add the $obj1 (Build) to the collection in $obj2 (Project)
             $obj2->addBuild($obj1);
         }
         // if joined row not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Beispiel #14
0
 /**
  * Executes handleErrorUpdateMilestone action
  *
  */
 public function handleErrorUpdateMilestone()
 {
     $this->forward404Unless($this->project = ProjectPeer::retrieveBySlug($this->getRequestParameter('project')), 'Project does not exist, using slug [' . $this->getRequestParameter('project') . ']');
     $this->tab = sfConfig::get('app_tab_project_team');
     $this->position = ProjectPositionPeer::retrieveByUuid($this->getRequestParameter('position'));
     if ($this->position == null) {
         $this->position = new ProjectPosition();
     }
     $this->setTemplate('updateMilestone');
     return sfView::SUCCESS;
 }
Beispiel #15
0
 /**
  * Get the associated Project object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Project The associated Project object.
  * @throws     PropelException
  */
 public function getProject(PropelPDO $con = null)
 {
     if ($this->aProject === null && $this->task_id !== null) {
         $this->aProject = ProjectPeer::retrieveByPk($this->task_id);
         /* 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->aProject->addBuilds($this);
         		 */
     }
     return $this->aProject;
 }
Beispiel #16
0
 public static function doSelectJoinAll(Criteria $c, $con = null)
 {
     foreach (sfMixer::getCallables('BaseUrlPeer:doSelectJoinAll:doSelectJoinAll') as $callable) {
         call_user_func($callable, 'BaseUrlPeer', $c, $con);
     }
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     UrlPeer::addSelectColumns($c);
     $startcol2 = UrlPeer::NUM_COLUMNS - UrlPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     ProjectPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + ProjectPeer::NUM_COLUMNS;
     $c->addJoin(UrlPeer::PROJECT_ID, ProjectPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = UrlPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = ProjectPeer::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->getProject();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addUrl($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initUrls();
             $obj2->addUrl($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Beispiel #17
0
 /**
  * Get the associated Project object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Project The associated Project object.
  * @throws     PropelException
  */
 public function getProject(PropelPDO $con = null)
 {
     if ($this->aProject === null && $this->project_id !== null) {
         $c = new Criteria(ProjectPeer::DATABASE_NAME);
         $c->add(ProjectPeer::ID, $this->project_id);
         $this->aProject = ProjectPeer::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->aProject->addJobs($this);
         		 */
     }
     return $this->aProject;
 }
Beispiel #18
0
 public function executeAddProject(sfWebRequest $request)
 {
     $obj = json_decode($request->getParameter("obj"), true);
     $jobs = $obj["jobs"];
     $addProjectId = $obj["addProjectId"];
     $projectName = $obj["projectName"];
     $createNew = $obj["createNew"];
     $removeFromProject = $obj["removeFromProject"];
     if (!$removeFromProject) {
         if ($createNew) {
             $project = new Project();
             $project->setName($projectName);
             $project->save();
         } else {
             $project = ProjectPeer::retrieveByPK($addProjectId);
         }
         $projectId = $project->getId();
     } else {
         $projectId = null;
     }
     if ($removeFromProject || !is_null($projectId)) {
         JobPeer::setJobProjectIds($jobs, $projectId);
     }
     $this->setTemplate("reload");
     if ($this->createCriteria() == sfView::NONE) {
         return sfView::NONE;
     }
 }
Beispiel #19
0
 public function getProjectsRelatedByOwnerIdJoinCampus($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());
             $this->collProjectsRelatedByOwnerId = ProjectPeer::doSelectJoinCampus($criteria, $con);
         }
     } else {
         $criteria->add(ProjectPeer::OWNER_ID, $this->getId());
         if (!isset($this->lastProjectRelatedByOwnerIdCriteria) || !$this->lastProjectRelatedByOwnerIdCriteria->equals($criteria)) {
             $this->collProjectsRelatedByOwnerId = ProjectPeer::doSelectJoinCampus($criteria, $con);
         }
     }
     $this->lastProjectRelatedByOwnerIdCriteria = $criteria;
     return $this->collProjectsRelatedByOwnerId;
 }
Beispiel #20
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = ProjectPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setName($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setStatusId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setSlug($arr[$keys[3]]);
     }
 }
Beispiel #21
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = ProjectPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setName($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setKey($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setLeadId($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setUserId($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setPriority($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setUpdated($arr[$keys[6]]);
     }
 }
Beispiel #22
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;
 }
Beispiel #23
0
 public function executeAutocomplete(sfWebRequest $request)
 {
     $q = $request->getParameter("q");
     $this->renderText(json_encode(ProjectPeer::getNamesForAutocomplete($q)));
     return sfView::NONE;
 }
Beispiel #24
0
 /**
  * Selects a collection of Task objects pre-filled with all related objects except User.
  *
  * @param      Criteria  $criteria
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of Task objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptUser(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $criteria = clone $criteria;
     // Set the correct dbName if it has not been overridden
     // $criteria->getDbName() will return the same object if not set to another value
     // so == check is okay and faster
     if ($criteria->getDbName() == Propel::getDefaultDB()) {
         $criteria->setDbName(self::DATABASE_NAME);
     }
     TaskPeer::addSelectColumns($criteria);
     $startcol2 = TaskPeer::NUM_COLUMNS - TaskPeer::NUM_LAZY_LOAD_COLUMNS;
     ProjectPeer::addSelectColumns($criteria);
     $startcol3 = $startcol2 + (ProjectPeer::NUM_COLUMNS - ProjectPeer::NUM_LAZY_LOAD_COLUMNS);
     StatusPeer::addSelectColumns($criteria);
     $startcol4 = $startcol3 + (StatusPeer::NUM_COLUMNS - StatusPeer::NUM_LAZY_LOAD_COLUMNS);
     PriorityPeer::addSelectColumns($criteria);
     $startcol5 = $startcol4 + (PriorityPeer::NUM_COLUMNS - PriorityPeer::NUM_LAZY_LOAD_COLUMNS);
     $criteria->addJoin(TaskPeer::PROJECT_ID, ProjectPeer::ID, $join_behavior);
     $criteria->addJoin(TaskPeer::STATUS_ID, StatusPeer::ID, $join_behavior);
     $criteria->addJoin(TaskPeer::PRIORITY_ID, PriorityPeer::ID, $join_behavior);
     $stmt = BasePeer::doSelect($criteria, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = TaskPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = TaskPeer::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 {
             $cls = TaskPeer::getOMClass(false);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             TaskPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Project rows
         $key2 = ProjectPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = ProjectPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $cls = ProjectPeer::getOMClass(false);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 ProjectPeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (Task) to the collection in $obj2 (Project)
             $obj2->addTask($obj1);
         }
         // if joined row is not null
         // Add objects for joined Status rows
         $key3 = StatusPeer::getPrimaryKeyHashFromRow($row, $startcol3);
         if ($key3 !== null) {
             $obj3 = StatusPeer::getInstanceFromPool($key3);
             if (!$obj3) {
                 $cls = StatusPeer::getOMClass(false);
                 $obj3 = new $cls();
                 $obj3->hydrate($row, $startcol3);
                 StatusPeer::addInstanceToPool($obj3, $key3);
             }
             // if $obj3 already loaded
             // Add the $obj1 (Task) to the collection in $obj3 (Status)
             $obj3->addTask($obj1);
         }
         // if joined row is not null
         // Add objects for joined Priority rows
         $key4 = PriorityPeer::getPrimaryKeyHashFromRow($row, $startcol4);
         if ($key4 !== null) {
             $obj4 = PriorityPeer::getInstanceFromPool($key4);
             if (!$obj4) {
                 $cls = PriorityPeer::getOMClass(false);
                 $obj4 = new $cls();
                 $obj4->hydrate($row, $startcol4);
                 PriorityPeer::addInstanceToPool($obj4, $key4);
             }
             // if $obj4 already loaded
             // Add the $obj1 (Task) to the collection in $obj4 (Priority)
             $obj4->addTask($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
 /**
  * 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;
 }
Beispiel #26
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = ProjectPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setUuid($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setCreatedBy($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setOwnerId($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setDepartmentId($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setCampusId($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setTitle($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setPicture($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setSlug($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setDescription($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setNotes($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setKeywords($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setBegin($arr[$keys[12]]);
     }
     if (array_key_exists($keys[13], $arr)) {
         $this->setFinish($arr[$keys[13]]);
     }
     if (array_key_exists($keys[14], $arr)) {
         $this->setBudget($arr[$keys[14]]);
     }
     if (array_key_exists($keys[15], $arr)) {
         $this->setStatus($arr[$keys[15]]);
     }
     if (array_key_exists($keys[16], $arr)) {
         $this->setApplications($arr[$keys[16]]);
     }
     if (array_key_exists($keys[17], $arr)) {
         $this->setSeason($arr[$keys[17]]);
     }
     if (array_key_exists($keys[18], $arr)) {
         $this->setYear($arr[$keys[18]]);
     }
     if (array_key_exists($keys[19], $arr)) {
         $this->setScale($arr[$keys[19]]);
     }
     if (array_key_exists($keys[20], $arr)) {
         $this->setCommitment($arr[$keys[20]]);
     }
     if (array_key_exists($keys[21], $arr)) {
         $this->setGoals($arr[$keys[21]]);
     }
     if (array_key_exists($keys[22], $arr)) {
         $this->setGoalsComplete($arr[$keys[22]]);
     }
     if (array_key_exists($keys[23], $arr)) {
         $this->setHoursWeekly($arr[$keys[23]]);
     }
     if (array_key_exists($keys[24], $arr)) {
         $this->setHoursTotal($arr[$keys[24]]);
     }
     if (array_key_exists($keys[25], $arr)) {
         $this->setPublished($arr[$keys[25]]);
     }
     if (array_key_exists($keys[26], $arr)) {
         $this->setFlaggedAup($arr[$keys[26]]);
     }
     if (array_key_exists($keys[27], $arr)) {
         $this->setFlaggedHelp($arr[$keys[27]]);
     }
     if (array_key_exists($keys[28], $arr)) {
         $this->setMainForm($arr[$keys[28]]);
     }
     if (array_key_exists($keys[29], $arr)) {
         $this->setIsApproved($arr[$keys[29]]);
     }
     if (array_key_exists($keys[30], $arr)) {
         $this->setHits($arr[$keys[30]]);
     }
     if (array_key_exists($keys[31], $arr)) {
         $this->setVersion($arr[$keys[31]]);
     }
     if (array_key_exists($keys[32], $arr)) {
         $this->setUpdatedAt($arr[$keys[32]]);
     }
     if (array_key_exists($keys[33], $arr)) {
         $this->setDeletedAt($arr[$keys[33]]);
     }
     if (array_key_exists($keys[34], $arr)) {
         $this->setCreatedAt($arr[$keys[34]]);
     }
 }
 public function getProject($con = null)
 {
     if ($this->aProject === null && $this->project_id !== null) {
         include_once 'lib/model/om/BaseProjectPeer.php';
         $this->aProject = ProjectPeer::retrieveByPK($this->project_id, $con);
     }
     return $this->aProject;
 }
Beispiel #28
0
 /**
  * Returns the number of related Project objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      PropelPDO $con
  * @return     int Count of related Project objects.
  * @throws     PropelException
  */
 public function countProjects(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(StatusPeer::DATABASE_NAME);
     } else {
         $criteria = clone $criteria;
     }
     if ($distinct) {
         $criteria->setDistinct();
     }
     $count = null;
     if ($this->collProjects === null) {
         if ($this->isNew()) {
             $count = 0;
         } else {
             $criteria->add(ProjectPeer::STATUS_ID, $this->id);
             $count = ProjectPeer::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(ProjectPeer::STATUS_ID, $this->id);
             if (!isset($this->lastProjectCriteria) || !$this->lastProjectCriteria->equals($criteria)) {
                 $count = ProjectPeer::doCount($criteria, $con);
             } else {
                 $count = count($this->collProjects);
             }
         } else {
             $count = count($this->collProjects);
         }
     }
     return $count;
 }
Beispiel #29
0
 public function getProjects()
 {
     $c = new Criteria();
     $c->add(ProjectPeer::USER_ID, $this->getId());
     return ProjectPeer::doSelect($c);
 }
Beispiel #30
0
 public function getProjects()
 {
     sfContext::getInstance()->getLogger()->info('Filtering user positions for projects...');
     $positions = $this->getPositionsUser();
     $projects = array();
     foreach ($positions as $position) {
         $projects[] = $position->getProjectPosition()->getProject();
     }
     foreach (ProjectPeer::retrieveByUserId($this->getUserId()) as $project) {
         $projects[] = $project;
     }
     foreach ($projects as $key => $value) {
         if ($projects[$key] == null) {
             unset($projects[$key]);
         }
     }
     return array_unique($projects);
 }