public function executeTopmenu()
 {
     $options = StatusPeer::doSelect(new Criteria());
     $this->options = array("-1" => "");
     foreach ($options as $i) {
         if ($i == $this->moveToSkip) {
             continue;
         }
         $this->options[$i->getId()] = $i->getState();
     }
 }
示例#2
0
 /**
  * @return Status[]
  */
 public static function getStatusArray()
 {
     $statusArray = [];
     $c = new Criteria();
     $c->addJoin(StatusPeer::DISPLAY_NAME, ConceptPeer::PREF_LABEL);
     $c->add(ConceptPeer::VOCABULARY_ID, 31);
     StatusPeer::addSelectColumns($c);
     ConceptPeer::addSelectColumns($c);
     $stati = StatusPeer::doSelectRS($c);
     /** @var Status[] $stati */
     foreach ($stati as $stat) {
         $statusArray[$stat[0]] = $stat;
     }
     return $statusArray;
 }
示例#3
0
 public static function setJobStateIds($jobs, $stateId)
 {
     $c1 = new Criteria();
     $c2 = new Criteria();
     $c1->add(JobPeer::ID, $jobs, Criteria::IN);
     $c2->add(JobPeer::STATUS_ID, $stateId);
     BasePeer::doUpdate($c1, $c2, Propel::getConnection());
     $state = StatusPeer::retrieveByPK($stateId);
     foreach ($jobs as $id) {
         $logEntry = new Log();
         $logEntry->setWhen(time());
         $logEntry->setPropelClass("Job");
         $logEntry->setSfGuardUserProfileId(sfContext::getInstance()->getUser()->getUserId());
         $logEntry->setMessage("Changed job state to " . $state->getState());
         $logEntry->setLogMessageTypeId(sfConfig::get("app_log_type_change_status"));
         $logEntry->setPropelId($id);
         $logEntry->save();
     }
 }
 /**
  * Selects a collection of SchemaPropertyElementHistory objects pre-filled with all related objects except FileImportHistory.
  *
  * @return array Array of SchemaPropertyElementHistory objects.
  * @throws PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptFileImportHistory(Criteria $c, $con = null)
 {
     $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);
     }
     SchemaPropertyElementHistoryPeer::addSelectColumns($c);
     $startcol2 = SchemaPropertyElementHistoryPeer::NUM_COLUMNS - SchemaPropertyElementHistoryPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     UserPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + UserPeer::NUM_COLUMNS;
     SchemaPropertyElementPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + SchemaPropertyElementPeer::NUM_COLUMNS;
     SchemaPropertyPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + SchemaPropertyPeer::NUM_COLUMNS;
     SchemaPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + SchemaPeer::NUM_COLUMNS;
     ProfilePropertyPeer::addSelectColumns($c);
     $startcol7 = $startcol6 + ProfilePropertyPeer::NUM_COLUMNS;
     SchemaPropertyPeer::addSelectColumns($c);
     $startcol8 = $startcol7 + SchemaPropertyPeer::NUM_COLUMNS;
     StatusPeer::addSelectColumns($c);
     $startcol9 = $startcol8 + StatusPeer::NUM_COLUMNS;
     $c->addJoin(SchemaPropertyElementHistoryPeer::CREATED_USER_ID, UserPeer::ID);
     $c->addJoin(SchemaPropertyElementHistoryPeer::SCHEMA_PROPERTY_ELEMENT_ID, SchemaPropertyElementPeer::ID);
     $c->addJoin(SchemaPropertyElementHistoryPeer::SCHEMA_PROPERTY_ID, SchemaPropertyPeer::ID);
     $c->addJoin(SchemaPropertyElementHistoryPeer::SCHEMA_ID, SchemaPeer::ID);
     $c->addJoin(SchemaPropertyElementHistoryPeer::PROFILE_PROPERTY_ID, ProfilePropertyPeer::ID);
     $c->addJoin(SchemaPropertyElementHistoryPeer::RELATED_SCHEMA_PROPERTY_ID, SchemaPropertyPeer::ID);
     $c->addJoin(SchemaPropertyElementHistoryPeer::STATUS_ID, StatusPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = SchemaPropertyElementHistoryPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = UserPeer::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->getUser();
             //CHECKME
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addSchemaPropertyElementHistory($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initSchemaPropertyElementHistorys();
             $obj2->addSchemaPropertyElementHistory($obj1);
         }
         $omClass = SchemaPropertyElementPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getSchemaPropertyElement();
             //CHECKME
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addSchemaPropertyElementHistory($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initSchemaPropertyElementHistorys();
             $obj3->addSchemaPropertyElementHistory($obj1);
         }
         $omClass = SchemaPropertyPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj4 = new $cls();
         $obj4->hydrate($rs, $startcol4);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj4 = $temp_obj1->getSchemaPropertyRelatedBySchemaPropertyId();
             //CHECKME
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addSchemaPropertyElementHistoryRelatedBySchemaPropertyId($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initSchemaPropertyElementHistorysRelatedBySchemaPropertyId();
             $obj4->addSchemaPropertyElementHistoryRelatedBySchemaPropertyId($obj1);
         }
         $omClass = SchemaPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj5 = new $cls();
         $obj5->hydrate($rs, $startcol5);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj5 = $temp_obj1->getSchema();
             //CHECKME
             if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj5->addSchemaPropertyElementHistory($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj5->initSchemaPropertyElementHistorys();
             $obj5->addSchemaPropertyElementHistory($obj1);
         }
         $omClass = ProfilePropertyPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj6 = new $cls();
         $obj6->hydrate($rs, $startcol6);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj6 = $temp_obj1->getProfileProperty();
             //CHECKME
             if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj6->addSchemaPropertyElementHistory($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj6->initSchemaPropertyElementHistorys();
             $obj6->addSchemaPropertyElementHistory($obj1);
         }
         $omClass = SchemaPropertyPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj7 = new $cls();
         $obj7->hydrate($rs, $startcol7);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj7 = $temp_obj1->getSchemaPropertyRelatedByRelatedSchemaPropertyId();
             //CHECKME
             if ($temp_obj7->getPrimaryKey() === $obj7->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj7->addSchemaPropertyElementHistoryRelatedByRelatedSchemaPropertyId($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj7->initSchemaPropertyElementHistorysRelatedByRelatedSchemaPropertyId();
             $obj7->addSchemaPropertyElementHistoryRelatedByRelatedSchemaPropertyId($obj1);
         }
         $omClass = StatusPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj8 = new $cls();
         $obj8->hydrate($rs, $startcol8);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj8 = $temp_obj1->getStatus();
             //CHECKME
             if ($temp_obj8->getPrimaryKey() === $obj8->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj8->addSchemaPropertyElementHistory($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj8->initSchemaPropertyElementHistorys();
             $obj8->addSchemaPropertyElementHistory($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
 /**
  * Selects a collection of Profile objects pre-filled with all related objects except UserRelatedByChildUpdatedBy.
  *
  * @return array Array of Profile objects.
  * @throws PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptUserRelatedByChildUpdatedBy(Criteria $c, $con = null)
 {
     $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);
     }
     ProfilePeer::addSelectColumns($c);
     $startcol2 = ProfilePeer::NUM_COLUMNS - ProfilePeer::NUM_LAZY_LOAD_COLUMNS + 1;
     AgentPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + AgentPeer::NUM_COLUMNS;
     StatusPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + StatusPeer::NUM_COLUMNS;
     $c->addJoin(ProfilePeer::AGENT_ID, AgentPeer::ID);
     $c->addJoin(ProfilePeer::STATUS_ID, StatusPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = ProfilePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = AgentPeer::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->getAgent();
             //CHECKME
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addProfile($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initProfiles();
             $obj2->addProfile($obj1);
         }
         $omClass = StatusPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getStatus();
             //CHECKME
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addProfile($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initProfiles();
             $obj3->addProfile($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
 /**
  * Get the associated Status object
  *
  * @param      Connection Optional Connection object.
  * @return     Status The associated Status object.
  * @throws     PropelException
  */
 public function getStatus($con = null)
 {
     if ($this->aStatus === null && $this->status_id !== null) {
         // include the related Peer class
         include_once 'lib/model/om/BaseStatusPeer.php';
         $this->aStatus = StatusPeer::retrieveByPK($this->status_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 = StatusPeer::retrieveByPK($this->status_id, $con);
         		   $obj->addStatuss($this);
         		 */
     }
     return $this->aStatus;
 }
示例#7
0
 /**
  * Selects a collection of Project 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 Project 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('BaseProjectPeer:doSelectJoinAll:doSelectJoinAll') as $callable) {
         call_user_func($callable, 'BaseProjectPeer', $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);
     }
     ProjectPeer::addSelectColumns($c);
     $startcol2 = ProjectPeer::NUM_COLUMNS - ProjectPeer::NUM_LAZY_LOAD_COLUMNS;
     StatusPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (StatusPeer::NUM_COLUMNS - StatusPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(ProjectPeer::STATUS_ID), array(StatusPeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = ProjectPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = ProjectPeer::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 = ProjectPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             ProjectPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Status rows
         $key2 = StatusPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = StatusPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = StatusPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 StatusPeer::addInstanceToPool($obj2, $key2);
             }
             // if obj2 loaded
             // Add the $obj1 (Project) to the collection in $obj2 (Status)
             $obj2->addProject($obj1);
         }
         // if joined row not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
示例#8
0
 /**
  * Selects a collection of Job objects pre-filled with all related objects except Project.
  *
  * @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 Job objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptProject(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);
     }
     JobPeer::addSelectColumns($c);
     $startcol2 = JobPeer::NUM_COLUMNS - JobPeer::NUM_LAZY_LOAD_COLUMNS;
     PublicationPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (PublicationPeer::NUM_COLUMNS - PublicationPeer::NUM_LAZY_LOAD_COLUMNS);
     StatusPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + (StatusPeer::NUM_COLUMNS - StatusPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(JobPeer::PUBLICATION_ID), array(PublicationPeer::ID), $join_behavior);
     $c->addJoin(array(JobPeer::STATUS_ID), array(StatusPeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = JobPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = JobPeer::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 = JobPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             JobPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Publication rows
         $key2 = PublicationPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = PublicationPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = PublicationPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 PublicationPeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (Job) to the collection in $obj2 (Publication)
             $obj2->addJob($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) {
                 $omClass = StatusPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj3 = new $cls();
                 $obj3->hydrate($row, $startcol3);
                 StatusPeer::addInstanceToPool($obj3, $key3);
             }
             // if $obj3 already loaded
             // Add the $obj1 (Job) to the collection in $obj3 (Status)
             $obj3->addJob($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
 public function getStatusId($status)
 {
     if (is_integer($status)) {
         return $status;
     }
     //is it a known text string
     $c = new \Criteria();
     $c->add(\StatusPeer::DISPLAY_NAME, $status);
     $statusObj = \StatusPeer::doSelectOne($c);
     if (isset( $statusObj )) {
         return $statusObj->getId();
     } else {
         return false;
     }
 }
 /**
  * Selects a collection of ConceptProperty objects pre-filled with all related objects except ProfilePropertyRelatedByProfilePropertyId.
  *
  * @return array Array of ConceptProperty objects.
  * @throws PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptProfilePropertyRelatedByProfilePropertyId(Criteria $c, $con = null)
 {
     $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);
     }
     ConceptPropertyPeer::addSelectColumns($c);
     $startcol2 = ConceptPropertyPeer::NUM_COLUMNS - ConceptPropertyPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     UserPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + UserPeer::NUM_COLUMNS;
     UserPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + UserPeer::NUM_COLUMNS;
     ConceptPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + ConceptPeer::NUM_COLUMNS;
     VocabularyPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + VocabularyPeer::NUM_COLUMNS;
     ConceptPeer::addSelectColumns($c);
     $startcol7 = $startcol6 + ConceptPeer::NUM_COLUMNS;
     StatusPeer::addSelectColumns($c);
     $startcol8 = $startcol7 + StatusPeer::NUM_COLUMNS;
     $c->addJoin(ConceptPropertyPeer::CREATED_USER_ID, UserPeer::ID);
     $c->addJoin(ConceptPropertyPeer::UPDATED_USER_ID, UserPeer::ID);
     $c->addJoin(ConceptPropertyPeer::CONCEPT_ID, ConceptPeer::ID);
     $c->addJoin(ConceptPropertyPeer::SCHEME_ID, VocabularyPeer::ID);
     $c->addJoin(ConceptPropertyPeer::RELATED_CONCEPT_ID, ConceptPeer::ID);
     $c->addJoin(ConceptPropertyPeer::STATUS_ID, StatusPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = ConceptPropertyPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = UserPeer::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->getUserRelatedByCreatedUserId();
             //CHECKME
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addConceptPropertyRelatedByCreatedUserId($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initConceptPropertysRelatedByCreatedUserId();
             $obj2->addConceptPropertyRelatedByCreatedUserId($obj1);
         }
         $omClass = UserPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getUserRelatedByUpdatedUserId();
             //CHECKME
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addConceptPropertyRelatedByUpdatedUserId($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initConceptPropertysRelatedByUpdatedUserId();
             $obj3->addConceptPropertyRelatedByUpdatedUserId($obj1);
         }
         $omClass = ConceptPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj4 = new $cls();
         $obj4->hydrate($rs, $startcol4);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj4 = $temp_obj1->getConceptRelatedByConceptId();
             //CHECKME
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addConceptPropertyRelatedByConceptId($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initConceptPropertysRelatedByConceptId();
             $obj4->addConceptPropertyRelatedByConceptId($obj1);
         }
         $omClass = VocabularyPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj5 = new $cls();
         $obj5->hydrate($rs, $startcol5);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj5 = $temp_obj1->getVocabulary();
             //CHECKME
             if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj5->addConceptProperty($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj5->initConceptPropertys();
             $obj5->addConceptProperty($obj1);
         }
         $omClass = ConceptPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj6 = new $cls();
         $obj6->hydrate($rs, $startcol6);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj6 = $temp_obj1->getConceptRelatedByRelatedConceptId();
             //CHECKME
             if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj6->addConceptPropertyRelatedByRelatedConceptId($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj6->initConceptPropertysRelatedByRelatedConceptId();
             $obj6->addConceptPropertyRelatedByRelatedConceptId($obj1);
         }
         $omClass = StatusPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj7 = new $cls();
         $obj7->hydrate($rs, $startcol7);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj7 = $temp_obj1->getStatus();
             //CHECKME
             if ($temp_obj7->getPrimaryKey() === $obj7->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj7->addConceptProperty($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj7->initConceptPropertys();
             $obj7->addConceptProperty($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
示例#11
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;
 }
示例#12
0
 public static function doSelectJoinAllExceptCategory(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     EventPeer::addSelectColumns($c);
     $startcol2 = EventPeer::NUM_COLUMNS - EventPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     StatusPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + StatusPeer::NUM_COLUMNS;
     $c->addJoin(EventPeer::STATUS_ID, StatusPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = EventPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = StatusPeer::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->getStatus();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addEvent($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initEvents();
             $obj2->addEvent($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
示例#13
0
 /**
  * The default landing for project manager.
  * Lists all the active jobs.
  *
  * @param sfWebRequest $request
  */
 public function executeList(sfWebRequest $request)
 {
     if ($this->getUser()->getProfile()) {
         $credential = $this->getUser()->getProfile()->getUserType()->getType();
         $this->getUser()->addCredential($credential);
     }
     if (!$this->getUser()->hasCredential("admin")) {
         if ($this->getUser()->hasCredential("client")) {
             $url = $this->generateUrl("client_myjobs_own", array("own" => "true"));
         } else {
             if ($this->getUser()->hasCredential("photographer")) {
                 $url = $this->generateUrl("client_myjobs_own");
             } else {
                 $this->redirect404();
             }
         }
         $this->redirect($url);
     }
     if (!method_exists($this->getRoute(), "getObject")) {
         $c = new Criteria();
         $c->add(StatusPeer::ID, sfConfig::get("app_project_list_default_view", 1));
         $showType = StatusPeer::doSelectOne($c);
     } else {
         $showType = $this->getRoute()->getObject();
     }
     $this->routeObject = $showType;
     $this->createCriteria($showType->getId(), array("route" => "job_list_by", "slugOn" => "state", "slug" => $this->routeObject));
 }
示例#14
0
<!-- Status properties used in this document  -->
<?php 
foreach ($statusArray as $statusId) {
    $status = StatusPeer::retrieveByPK($statusId);
    /**
     * @todo Use the real vocabulary instead of the separate table in the DB
     **/
    ?>
    <skos:Concept rdf:about="<?php 
    echo $status->getUri();
    ?>
">
        <skos:prefLabel xml:lang="en"><?php 
    echo $status->getDisplayName();
    ?>
</skos:prefLabel>
    </skos:Concept>
<?php 
}
示例#15
0
 public function transformJobs()
 {
     $statusHash = array();
     $statusObjects = StatusPeer::doSelect(new Criteria());
     foreach ($statusObjects as $s) {
         $statusHash[$s->getState()] = $s->getId();
     }
     $this->jobKeys = array();
     $dom = DOMDocument::load("tuftsph_jm2db.xml");
     $jobs = $dom->getElementsByTagName("jobs");
     $total = $jobs->length;
     $count = 1;
     $jobList = array();
     foreach ($jobs as $job) {
         $jid = 0;
         $childNodes = $job->childNodes;
         $j = new Job();
         $del = new Delivery();
         $jid = 1;
         $startTime = null;
         $shootStart = null;
         $shootEnd = null;
         $endTime = null;
         $notes = "";
         $photog = 0;
         $slug = "";
         $childNodes = $job->childNodes;
         foreach ($childNodes as $child) {
             switch ($child->nodeName) {
                 case "id":
                     $jid = $child->textContent;
                     break;
                 case "shoot_name":
                     $j->setEvent($child->textContent);
                     break;
                 case "shoot_date":
                     $j->setDate($child->textContent);
                     break;
                 case "shoot_startT":
                     $startTime = $child->textContent;
                     break;
                 case "shoot_start":
                     $shootStart = $child->textContent;
                     break;
                 case "shoot_endT":
                     $endTime = $child->textContent;
                     break;
                 case "shoot_end":
                     $shootEnd = $child->textContent;
                     break;
                 case "shoot_duedate":
                     $j->setDueDate($child->textContent);
                     break;
                 case "submitted_at":
                     $j->setCreatedAt($child->textContent);
                     break;
                 case "requester_address":
                     $j->setStreet($child->textContent);
                     break;
                 case "requester_campus":
                     $j->setCity($child->textContent);
                     break;
                 case "requester_name":
                     $j->setContactName($child->textContent);
                     break;
                 case "requester_email":
                     $j->setContactEmail($child->textContent);
                     break;
                 case "requester_phone":
                     $j->setContactPhone($child->textContent);
                     break;
                 case "internal_notes":
                     $notes .= $child->textContent . "<br/>";
                     break;
                 case "billing_notes":
                     $notes .= $child->textContent . "<br/>";
                     break;
                 case "estimate":
                     $j->setEstimate($child->textContent);
                     break;
                 case "billing_acctnum":
                     $j->setAcctNum($child->textContent);
                     break;
                 case "billing_deptid":
                     $j->setDeptId($child->textContent);
                     break;
                 case "billing_grantid":
                     $j->setGrantId($child->textContent);
                     break;
                 case "shoot_directions":
                     $j->setOther($child->textContent);
                     break;
                 case "status":
                     $j->setStatusId($statusHash[$child->textContent]);
                     break;
                 case "photog_id":
                     $photog = $child->textContent;
                     break;
                 case "delivery_pubname":
                     $del->setPubName($child->textContent);
                     break;
                 case "delivery_pubtype":
                     $del->setPubType($child->textContent);
                     break;
                 case "delivery_other":
                     $del->setOther($child->textContent);
                     break;
                 case "delivery_format":
                     break;
                 case "delivery_color":
                     $del->setColor($child->textContent);
                     break;
                 case "delivery_format":
                     $del->setFormat($child->textContent);
                     break;
                 case "delivery_size":
                     $del->setSize($child->textContent);
                     break;
                 case "delivery_method":
                     $del->setMethod($child->textContent);
                     break;
                 case "delivery_special":
                     $del->setInstructions($child->textContent);
                     break;
                 case "slug":
                     $slug = $child->textContent;
                     break;
                 case "#text":
                 default:
                     break;
             }
         }
         if (is_null($endTime)) {
             $endTime = $shootEnd;
         }
         if (is_null($startTime)) {
             $startTime = $shootStart;
         }
         if ($j->getCity() == "Boston") {
             $j->setZip("02101");
         } else {
             $j->setZip("02155");
         }
         $j->setNotes($notes);
         $j->setState("Massachusetts");
         list($hour, $min, $sec) = explode(":", $endTime);
         list($shour, $smin, $ssec) = explode(":", $startTime);
         $t = new DateTime();
         $t->setTime($hour, $min, $sec);
         $j->setEndTime($t);
         $t = new DateTime();
         $t->setTime($shour, $smin, $ssec);
         $j->setStartTime($t);
         $j->addTag($slug);
         if (isset($this->jobProjectKeys[$jid])) {
             $j->setProjectId($this->projectKeys[$this->jobProjectKeys[$jid]]);
         }
         while (count($jobList) - 1 != $jid) {
             $jobList[] = false;
         }
         $jobList[intval($jid)] = array("job" => $j, "del" => $del, "photog" => $photog);
     }
     for ($i = 1; $i < count($jobList); $i++) {
         sleep(1);
         $obj = $jobList[$i];
         $c = new Criteria();
         $c->add(JobPeer::ID, $i);
         if (JobPeer::doCount($c) > 0) {
             continue;
         }
         echo $i . "/" . $total . "\n";
         // keep the ids lined up
         if ($obj == false) {
             $myJob = new Job();
             try {
                 $myJob->save();
             } catch (Exception $ex) {
                 echo $ex->getMessage();
             }
             $myJob->delete();
         } else {
             $j = $obj["job"];
             $del = $obj["del"];
             $photog = $obj["photog"];
             try {
                 $j->save();
             } catch (Exception $ex) {
                 echo $ex->getMessage();
                 echo $ex->getTraceAsString();
             }
             $del->setJobId($j->getId());
             $del->save();
             $this->jobKeys[$jid] = $j->getId();
             if ($photog) {
                 $jp = new JobPhotographer();
                 $jp->setPhotographerId($this->photogKeys[$photog]);
                 $jp->setJobId($j->getId());
                 try {
                     $jp->save();
                 } catch (Exception $ex) {
                     echo $ex->getMessage();
                 }
             }
             // add the requester as a client
             $c = new Criteria();
             $c->add(sfGuardUserPeer::USERNAME, $j->getContactEmail());
             if (ClientPeer::doCount($c) == 0 && trim(strlen($j->getContactEmail())) != 0) {
                 $user = new sfGuardUser();
                 $user->setUsername($j->getContactEmail());
                 $user->setPassword("admin");
                 $user->save();
                 $userProfile = new sfGuardUserProfile();
                 $userProfile->setUserId($user->getId());
                 $userProfile->setUserTypeId(sfConfig::get("app_user_type_client"));
                 $userProfile->save();
                 $clientProfile = new Client();
                 $clientProfile->setUserId($userProfile->getId());
                 $clientProfile->setName($j->getContactName());
                 $clientProfile->setEmail($j->getContactEmail());
                 $clientProfile->setPhone($j->getContactPhone());
                 $clientProfile->save();
                 $jobClient = new JobClient();
                 $jobClient->setClientId($clientProfile->getId());
                 $jobClient->setJobId($j->getId());
                 $jobClient->save();
             }
         }
         $count += 1;
     }
 }
示例#16
0
 /**
  * Get the associated Status object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Status The associated Status object.
  * @throws     PropelException
  */
 public function getStatus(PropelPDO $con = null)
 {
     if ($this->aStatus === null && $this->status_id !== null) {
         $c = new Criteria(StatusPeer::DATABASE_NAME);
         $c->add(StatusPeer::ID, $this->status_id);
         $this->aStatus = StatusPeer::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->aStatus->addProjects($this);
         		 */
     }
     return $this->aStatus;
 }
示例#17
0
 public function getStatus($con = null)
 {
     if ($this->aStatus === null && $this->status_id !== null) {
         include_once 'lib/model/om/BaseStatusPeer.php';
         $this->aStatus = StatusPeer::retrieveByPK($this->status_id, $con);
     }
     return $this->aStatus;
 }
示例#18
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 = StatusPeer::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]]);
     }
 }
示例#19
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(StatusPeer::ID, $pks, Criteria::IN);
         $objs = StatusPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
示例#20
0
 /**
  * Get the associated Status object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Status The associated Status object.
  * @throws     PropelException
  */
 public function getStatus(PropelPDO $con = null)
 {
     if ($this->aStatus === null && $this->status_id !== null) {
         $this->aStatus = StatusPeer::retrieveByPk($this->status_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->aStatus->addTasks($this);
         		 */
     }
     return $this->aStatus;
 }