Esempio n. 1
0
 public function executeSandbox()
 {
     $this->forward404Unless($this->project = ProjectPeer::retrieveByPk('5'));
     //echo $this->project->getTitle();
     $this->user = sfGuardUserPeer::retrieveByUsername('*****@*****.**');
     $form = $this->project->getForm('main');
     if ($form == null) {
         $this->project->setForm('main', 'default');
     }
     $campuses[] = array("id" => "085d234b-9cce-6414-2df5-c902c4d1b2da", "rank" => "1", "name" => "UC Berkeley");
     $campuses[] = array("id" => "544655f7-64fd-6a34-b535-8a9ebb3c2816", "rank" => "2", "name" => "Other");
     $campuses[] = array("id" => "62bbecdf-f338-c6e4-d986-dbea5bdf856f", "rank" => "3", "name" => "UC Los Angeles");
     $campuses[] = array("id" => "d3cb5d6b-cadb-9ff4-a1ef-53fe6760dc14", "rank" => "4", "name" => "Orange Coast College");
     $campuses[] = array("id" => "c39f272a-a4bb-b414-7514-a7ed6572056b", "rank" => "5", "name" => "Cothink Campus");
     $campuses[] = array("id" => "923fc92a-45b1-93f4-2d4b-fcce698f8a49", "rank" => "6", "name" => "Any Campus");
     $campuses[] = array("id" => "c43340c1-5bb6-6134-ede4-a9a134e986cb", "rank" => "7", "name" => "UC Santa Barbara");
     $campuses[] = array("id" => "ea0b9d54-8206-d334-9d47-c15b69b6c5ba", "rank" => "8", "name" => "UC Santa Cruz");
     $campuses[] = array("id" => "0d3cd035-8640-7584-85fe-45df2e4756ce", "rank" => "9", "name" => "Saddleback College");
     $campuses[] = array("id" => "13d97531-a57d-9a24-3971-13fd35db51fb", "rank" => "10", "name" => "UC San Francisco");
     $campuses[] = array("id" => "1a5cc505-0f46-9c74-bd05-e966c891e43d", "rank" => "11", "name" => "UC San Diego");
     $campuses[] = array("id" => "844fbc24-0600-a484-1996-ee8df871ac3d", "rank" => "12", "name" => "UC Riverside");
     $campuses[] = array("id" => "ef059e4f-4463-d924-15c5-ed99fb6ea085", "rank" => "13", "name" => "UC Merced");
     $campuses[] = array("id" => "7be5b4e4-5a6f-7d84-49ef-f000ecf0ade4", "rank" => "14", "name" => "UC Los Angeles");
     $campuses[] = array("id" => "ad73ea61-2374-d1a4-955a-59891021d533", "rank" => "15", "name" => "UC Davis");
     $campuses[] = array("id" => "9c85ebc8-a936-58c4-ad85-af60991fbd18", "rank" => "16", "name" => "UC Irvine");
     $campuses[] = array("id" => "cbad54e6-d87a-cef4-c9ad-d5a9776639ac", "rank" => "17", "name" => "Google Campus");
     $this->getUser()->setAttribute('campus_list', $campuses);
     $this->campuses = CampusPeer::doSelect(new Criteria());
     //$this->project = new Project();
 }
Esempio n. 2
0
function select_tag_campuses($name = 'campus', $selected = 2, $options = array())
{
    $c = new Criteria();
    $c->addAscendingOrderByColumn(CampusPeer::NAME);
    $campuses = CampusPeer::doSelect($c);
    return select_tag($name, objects_for_select($campuses, 'getId', 'getName', $selected, array()), $options);
}
Esempio n. 3
0
 public function executeDelete()
 {
     $campus = CampusPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($campus);
     $campus->delete();
     return $this->redirect('campus/list');
 }
 public static function doSelectJoinAllExceptDepartment(Criteria $c, $con = null)
 {
     foreach (sfMixer::getCallables('BaseProjectApplicationPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable) {
         call_user_func($callable, 'BaseProjectApplicationPeer', $c, $con);
     }
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     ProjectApplicationPeer::addSelectColumns($c);
     $startcol2 = ProjectApplicationPeer::NUM_COLUMNS - ProjectApplicationPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     sfGuardUserPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + sfGuardUserPeer::NUM_COLUMNS;
     sfGuardUserPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + sfGuardUserPeer::NUM_COLUMNS;
     CampusPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + CampusPeer::NUM_COLUMNS;
     $c->addJoin(ProjectApplicationPeer::CREATED_BY, sfGuardUserPeer::ID);
     $c->addJoin(ProjectApplicationPeer::OWNER_ID, sfGuardUserPeer::ID);
     $c->addJoin(ProjectApplicationPeer::CAMPUS_ID, CampusPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = ProjectApplicationPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = sfGuardUserPeer::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->getsfGuardUserRelatedByCreatedBy();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addProjectApplicationRelatedByCreatedBy($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initProjectApplicationsRelatedByCreatedBy();
             $obj2->addProjectApplicationRelatedByCreatedBy($obj1);
         }
         $omClass = sfGuardUserPeer::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->getsfGuardUserRelatedByOwnerId();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addProjectApplicationRelatedByOwnerId($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initProjectApplicationsRelatedByOwnerId();
             $obj3->addProjectApplicationRelatedByOwnerId($obj1);
         }
         $omClass = CampusPeer::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->getCampus();
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addProjectApplication($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initProjectApplications();
             $obj4->addProjectApplication($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Esempio n. 5
0
 public function getCampus($con = null)
 {
     if ($this->aCampus === null && $this->campus_preference !== null) {
         include_once 'lib/model/om/BaseCampusPeer.php';
         $this->aCampus = CampusPeer::retrieveByPK($this->campus_preference, $con);
     }
     return $this->aCampus;
 }
Esempio n. 6
0
 /**
  * Selects a collection of Term 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 Term 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);
     }
     TermPeer::addSelectColumns($criteria);
     $startcol2 = TermPeer::NUM_HYDRATE_COLUMNS;
     CampusPeer::addSelectColumns($criteria);
     $startcol3 = $startcol2 + CampusPeer::NUM_HYDRATE_COLUMNS;
     $criteria->addJoin(TermPeer::CAMPUS_ID, CampusPeer::ID, $join_behavior);
     $stmt = BasePeer::doSelect($criteria, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = TermPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = TermPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://www.propelorm.org/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $cls = TermPeer::getOMClass();
             $obj1 = new $cls();
             $obj1->hydrate($row);
             TermPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Campus rows
         $key2 = CampusPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = CampusPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $cls = CampusPeer::getOMClass();
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 CampusPeer::addInstanceToPool($obj2, $key2);
             }
             // if obj2 loaded
             // Add the $obj1 (Term) to the collection in $obj2 (Campus)
             $obj2->addTerm($obj1);
         }
         // if joined row not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Esempio n. 7
0
 public function handleErrorUpdateProfile()
 {
     $this->forward404Unless($this->getUser()->isAuthenticated(), 'not logged in, cannot edit profile, obviously');
     $this->tab = "editprofile";
     $this->profile = $this->getUser()->getProfile();
     $this->campuses = CampusPeer::doSelect(new Criteria());
     $this->departments = DepartmentPeer::doSelect(new Criteria());
     $this->subdepartments = SubdepartmentPeer::doSelect(new Criteria());
     $this->setTemplate("editProfile");
     return sfView::SUCCESS;
 }
Esempio n. 8
0
 public function handleErrorSaveNew()
 {
     //$this->project = ProjectPeer::retrieveBySlug($this->getRequestParameter('project'));
     //$this->forward404Unless($this->project, 'Project not found using slug ['.$this->getRequestParameter('project').']');
     $this->project = new Project();
     $this->campuses = CampusPeer::doSelect(new Criteria());
     $this->departments = DepartmentPeer::doSelect(new Criteria());
     $this->setTemplate('create');
     return sfView::SUCCESS;
 }
 /**
  * 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(CampusPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(CampusPeer::DATABASE_NAME);
         $criteria->add(CampusPeer::ID, $pks, Criteria::IN);
         $objs = CampusPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Esempio n. 10
0
if (!$sf_user->getAttribute('cart')) {
    ?>
  nothing yet in your shopping cart.
<?php 
} else {
    ?>
  <?php 
    foreach ($sf_user->getAttribute('cart') as $product_id => $quantity) {
        ?>
    <div style="border:1px solid white;padding:2px;margin:2px;">
      <?php 
        for ($i = 1; $i <= $quantity; $i++) {
            ?>
        <?php 
            echo image_tag('statusorb_g', array('class' => 'cart-items', 'id' => 'item_' . $product_id . '_' . $i, 'style' => ''));
            ?>
          <?php 
            echo CampusPeer::retrieveByUuid($product_id);
            ?>
          <hr class="clear" />
        <?php 
        }
        ?>
    </div>
    <hr class="clear" />
  <?php 
    }
}
?>

<hr class="clear" />
Esempio n. 11
0
 public function executeListFilter()
 {
     $this->campuses = CampusPeer::doSelect(new Criteria());
     $this->departments = DepartmentPeer::doSelect(new Criteria());
 }
Esempio n. 12
0
 public function executeListFilter()
 {
     $this->campuses = CampusPeer::retrieveAlphabetical();
     $this->departments = DepartmentPeer::retrieveAlphabetical();
 }
Esempio n. 13
0
 /**
  * This is a method for emulating ON DELETE CASCADE for DBs that don't support this
  * feature (like MySQL or SQLite).
  *
  * This method is not very speedy because it must perform a query first to get
  * the implicated records and then perform the deletes by calling those Peer classes.
  *
  * This method should be used within a transaction if possible.
  *
  * @param      Criteria $criteria
  * @param      PropelPDO $con
  * @return     int The number of affected rows (if supported by underlying database driver).
  */
 protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
 {
     // initialize var to track total num of affected rows
     $affectedRows = 0;
     // first find the objects that are implicated by the $criteria
     $objects = SchoolPeer::doSelect($criteria, $con);
     foreach ($objects as $obj) {
         // delete related Campus objects
         $criteria = new Criteria(CampusPeer::DATABASE_NAME);
         $criteria->add(CampusPeer::SCHOOL_ID, $obj->getId());
         $affectedRows += CampusPeer::doDelete($criteria, $con);
     }
     return $affectedRows;
 }
Esempio n. 14
0
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     PropelPDO $con A connection object
  *
  * @return    Campus A model object, or null if the key is not found
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT `SHALLOW_SPIDERED_AT`, `NAME`, `SLUG`, `SCHOOL_ID`, `SPIDERED_AT`, `TOUCHED`, `B_ID`, `BOOKSTORE_TYPE`, `ID`, `CREATED_AT`, `UPDATED_AT` FROM `campus` WHERE `ID` = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $obj = new Campus();
         $obj->hydrate($row);
         CampusPeer::addInstanceToPool($obj, (string) $key);
     }
     $stmt->closeCursor();
     return $obj;
 }
Esempio n. 15
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 = CampusPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setShallowSpideredAt($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setName($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setSlug($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setSchoolId($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setSpideredAt($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setTouched($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setBId($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setBookstoreType($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setId($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setCreatedAt($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setUpdatedAt($arr[$keys[10]]);
     }
 }
Esempio n. 16
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = CampusPeer::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->setName($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setSlug($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setAddress($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setCity($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setState($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setZip($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setUrl($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setPhone($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setEmail($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setAbout($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setVersion($arr[$keys[12]]);
     }
     if (array_key_exists($keys[13], $arr)) {
         $this->setDeletedAt($arr[$keys[13]]);
     }
     if (array_key_exists($keys[14], $arr)) {
         $this->setCreatedAt($arr[$keys[14]]);
     }
 }