public function insert(Category $category, Subcategory $subcategory, Brand $brand, Item $item) { // $sql = "INSERT INTO item values (null, 'aalluu', 'asdfasd',true,true, '2015-10-10','asdfasf', 'asdfasd', 1, 1 ,1, 1)"; $sql = "INSERT INTO item values (null, '" . $item->getTitle() . "','" . $item->getDetail() . "',true,false, '" . $item->getDate() . "', '" . $item->getLocation() . "','asfasf'," . $category->getId() . "," . $subcategory->getId() . ", 1 ," . $brand->getId() . ")"; echo $sql; if ($this->conn->query($sql) === TRUE) { echo "Insert operation successful"; } else { echo "Error inserting: "; } }
public function testSetTitle() { $item = new Item(); $item->setTitle('<a>my link</li>'); $this->assertEquals('my link', $item->getTitle()); $this->assertContains('title', $item->getUpdatedFields()); }
/** * @covers Debril\RssAtomBundle\Protocol\Parser\Item::setTitle * * @todo Implement testSetTitle(). */ public function testSetTitle() { $newTitle = 'A brand new title'; $this->object->setTitle($newTitle); $this->assertEquals($newTitle, $this->object->getTitle()); }
/** * @brief Save the feed and all its items into the database * @returns The id of the feed in the database table. */ public function save(Item $item, $feedid) { $guid = $item->getGuid(); $guid_hash = md5($guid); $status = $item->getStatus(); $itemid = $this->findIdFromGuid($guid_hash, $guid, $feedid); if ($itemid == null) { $title = $item->getTitle(); $body = $item->getBody(); $author = $item->getAuthor(); $stmt = \OCP\DB::prepare(' INSERT INTO ' . self::tableName . '(url, title, body, author, guid, guid_hash, pub_date, feed_id, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) '); if (empty($title)) { $l = \OC_L10N::get('news'); $title = $l->t('no title'); } if (empty($body)) { $l = \OC_L10N::get('news'); $body = $l->t('no body'); } $pub_date = Utils::unixtimeToDbtimestamp($item->getDate()); $params = array($item->getUrl(), $title, $body, $author, $guid, $guid_hash, $pub_date, $feedid, $status); $stmt->execute($params); $itemid = \OCP\DB::insertid(self::tableName); } else { $this->update($item); } $item->setId($itemid); return $itemid; }
/** * Prints the metadata and prices for an item * @param Item|Book $item an Item (Section mode) or Book (ISBN mode) object * @param int $requiredStatus */ function printItemRow($item, $status = null) { global $app; ?> <tr> <th> <span class="tooltip" style="display: none;"> <img src="<?php echo $item->getImageUrl(); ?> "> <h1><?php echo $item->getTitle(); ?> </h1> <h2><?php echo $item->getAuthor(); ?> </h2> <?php if ($edition = $item->getEdition()) { ?> <div class="edition"><strong>Edition:</strong> <?php echo $edition; ?> </div> <?php } if ($publisher = $item->getPublisher()) { ?> <div class="publisher"><strong>Publisher:</strong> <?php echo $publisher; ?> </div> <?php } if ($isbn = $item->getIsbn()) { ?> <div class="isbn"><strong>ISBN:</strong> <span class="isbn"><?php echo $isbn; ?> </span></div> <?php } ?> </span> <?php $indented = $item->isPackageComponent() || $status === SectionHasItem::BOOKSTORE_RECOMMENDED; $class = $indented ? " packageComponent" : ""; ?> <span class="bookdata <?php echo $class; ?> "> <span class="title"><?php echo $item->getTitle(); ?> </span><br> <?php if ($edition || $item->getAuthor()) { ?> <span class="minimetadata"><?php echo ($edition ? "{$edition}, " : "") . $item->getAuthor(); ?> </span> <?php } ?> <?php // e.g. (Recommended) if ($stat = Item::getStatusText($status)) { ?> <br/><span class="minimetadata"><?php echo $stat; ?> </span> <?php } // sentence about being a package or component if ($description = $item->getDescription($status)) { ?> <br/><span class="minimetadata important"><?php echo $description; ?> </span> <?php } ?> </span> </th> <?php foreach ($item->prices as $v => $p) { if ($p === null) { if ($v === $GLOBALS['results']->bookstore) { ?> <td data-price="-1" class="empty" data-unknown="true">unknown</td> <?php } else { ?> <td data-price="-1" class="empty">—</td> <?php } } else { ?> <td data-price="<?php echo money($p->total); ?> " <?php if ($p->asteriskPrice) { ?> data-used="<?php echo money($p->asteriskPrice); ?> " <?php } ?> data-subtotal="<?php echo money($p->subtotal); ?> " data-shipping="<?php echo money($p->shipping + $p->tax); ?> "> <a href="<?php echo $app->urlFor('redirect', array('url' => '', 'type' => 'single', 'vendor' => $p->vendorName)) . $p->url; ?> " data-confirm="<?php echo $p->getDescription(); ?> "> <?php if ($p->total == 0) { ?> unknown <?php } else { ?> $<?php echo money($p->total); echo $p->asteriskPrice ? '*' : ''; ?> <?php } ?> </a> </td> <?php } ?> <?php } // end: foreach $item->prices ?> </tr> <?php if ($item->getIsPackage()) { $components = Item::getComponents(array($item->getId())); foreach ($components as $c) { printItemRow($c); } } }