public function executeIndex(sfWebRequest $request) { $this->menu = MenuPeer::doSelect(new Criteria()); $this->photos_list = PhotosPeer::doSelect(new Criteria()); $this->id = $request->getParameter('id'); $c = new Criteria(); $c->add(PhotosPeer::ID, $this->id); $this->item = PhotosPeer::doSelect($c); $this->item = $this->item[0]; unset($c); $part_id = $this->item->getPartId(); $c2 = new Criteria(); $c2->add(PartsPeer::IS_ACTIVE, 1); $c2->add(PartsPeer::ID, $part_id); $this->part = PartsPeer::doSelect($c2); unset($c2); $this->partName = $this->part[0]->getName(); $c0 = new Criteria(); $c0->add(PartsPeer::IS_ACTIVE, 1); $this->parts = PartsPeer::doSelect($c0); unset($c0); $c1 = new Criteria(); $c1->add(PartsPeer::ID, $this->item->getPartId()); $this->part = PartsPeer::doSelect($c1); $this->part = $this->part[0]; unset($c1); $response = $this->getResponse(); $response->setTitle("Фото постеры. Купить фото постер. Каталог. " . $this->partName . ". " . $this->item->getName()); $response->addMeta("robots", "Фото постеры. Купить фото постер. Каталог. " . $this->partName . ". " . $this->item->getName()); $response->addMeta("keywords", "Фото постеры. Купить фото постер. Каталог. " . $this->partName . ". " . $this->item->getName()); }
public function executeIndex(sfWebRequest $request) { $response = $this->getResponse(); $response->setTitle('Фото постеры. Купить фото постер. Корзина.'); $response->addMeta('robots', 'Фото постеры. Купить фото постер. Корзина.'); $response->addMeta('keywords', 'Фото постеры. Купить фото постер. Корзина.'); $c = new Criteria(); $c->add(PartsPeer::IS_ACTIVE, 1); $this->parts = PartsPeer::doSelect($c); $this->menu = MenuPeer::doSelect(new Criteria()); if (isset($_COOKIE["sfCart"])) { $arr = explode(":", $_COOKIE["sfCart"]); } $cr = new Criteria(); foreach ($arr as $k => $v) { $cr->add(PhotosPeer::ID, $v); $c = PhotosPeer::doSelect($cr); $items[$k] = $c[0]; } $this->items = $items; }
include_partial('default/logo0'); include_partial('default/menu', array('menu' => $menu, 'parts' => $parts)); ?> <div id="basket" alt="Корзина" title="Корзина"><img src="/images/i-cart.png" width="18" height="15" alt="Корзина" title="Корзина" /> <div id="basketInner"> <?php if (isset($_COOKIE["sfCart"])) { $positions = explode(":", $_COOKIE["sfCart"]); $countPositions = sizeOf($positions); } $totalPrice = 0; foreach ($positions as $k => $v) { $posC = new Criteria(); $posC->add(PhotosPeer::ID, $v); $photo = PhotosPeer::doSelect($posC); if (sizeOf($photo) > 0) { $totalPrice = $totalPrice + $photo[0]->getPrice(); } } ?> <a href="http://p-poster.com/cart">В корзине <strong><?php echo $countPositions; ?> </strong> постеров<br /> на сумму <strong><?php echo $totalPrice; ?> </strong> руб.</a> <div id="basketOrder"> <a style="text-decoration: none;" href="http://p-poster.com/cart/clear/" title="очистить корзину">[ x ] очистить</a><br /> <strong id="order"><a href="http://p-poster.com/cart/order/" title="оформить заказ">оформить заказ</a></strong>
/** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this Meta is new, it will return * an empty collection; or if this Meta has previously * been saved, it will retrieve related Photoss from storage. * * This method is protected by default in order to keep the public * api reasonable. You can provide public methods for those you * actually need in Meta. */ public function getPhotossJoinAuthors($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { if ($criteria === null) { $criteria = new Criteria(MetaPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collPhotoss === null) { if ($this->isNew()) { $this->collPhotoss = array(); } else { $criteria->add(PhotosPeer::META_ID, $this->id); $this->collPhotoss = PhotosPeer::doSelectJoinAuthors($criteria, $con, $join_behavior); } } else { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return the collection. $criteria->add(PhotosPeer::META_ID, $this->id); if (!isset($this->lastPhotosCriteria) || !$this->lastPhotosCriteria->equals($criteria)) { $this->collPhotoss = PhotosPeer::doSelectJoinAuthors($criteria, $con, $join_behavior); } } $this->lastPhotosCriteria = $criteria; return $this->collPhotoss; }
public function executeParts(sfWebRequest $request) { $response = $this->getResponse(); $response->setTitle('Фото постеры. Купить фото постер. Каталог'); $response->addMeta('robots', 'Фото постеры. Купить фото постер. Каталог'); $response->addMeta('keywords', 'Фото постеры. Купить фото постер. Каталог'); $part_id = $request->getParameter('id'); $this->p = $part_id; $this->menu = MenuPeer::doSelect(new Criteria()); $c = new Criteria(); $c->add(PartsPeer::IS_ACTIVE, 1); $this->parts = PartsPeer::doSelect($c); $c1 = new Criteria(); $this->items = PhotosPeer::doSelect($c1); if ($part_id) { $c1 = new Criteria(); $c1->add(PhotosPeer::PART_ID, $part_id); $pager = new sfPropelPager('Photos', 5); $pager->setCriteria($c1); $pager->setPage($this->getRequestParameter('page', 1)); $pager->init(); $this->pager = $pager; $c2 = new Criteria(); $c2->add(PartsPeer::ID, $part_id); $this->part = PartsPeer::doSelect($c2); } }
" alt="<?php echo $item->getName(); ?> " /></a> <a href="http://p-poster.com/parts/id/<?php echo $item->getId(); ?> /" title="<?php echo $item->getName(); ?> "> <span class="descr"> <?php $cc = new Criteria(); $cc->add(PhotosPeer::PART_ID, $item->getID()); $count = PhotosPeer::doSelect($cc); $count = sizeOf($count); echo $item->getName(); ?> (<?php echo $count; ?> )</span></a> </div><?php $i++; } ?> </div><?php } ?> </div>
/** * 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 = PhotosPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setMetaId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setName($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setDescription($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setPartId($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setAuthorId($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setPhotoS($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setPhotoB($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setSize($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setPrice($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setOrd($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setIsNew($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { $this->setIsSpec($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { $this->setIsActive($arr[$keys[13]]); } if (array_key_exists($keys[14], $arr)) { $this->setCreatedAt($arr[$keys[14]]); } }
/** * 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(PhotosPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(PhotosPeer::DATABASE_NAME); $criteria->add(PhotosPeer::ID, $pks, Criteria::IN); $objs = PhotosPeer::doSelect($criteria, $con); } return $objs; }