本文整理汇总了PHP中Item::setDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::setDescription方法的具体用法?PHP Item::setDescription怎么用?PHP Item::setDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Item
的用法示例。
在下文中一共展示了Item::setDescription方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gerateBilling
public function gerateBilling()
{
$order = null;
$customers = $this->getUserID();
$structJsonArray = array();
foreach ($customers as $customer) {
$structJson = new Json();
$structJson->setCustomerId($customer['zoho_books_contact_id']);
$structJson->setDate(date('d-m-Y'));
$invoices_per_costumer = $this->getUserInvoice($customer['zoho_books_contact_id']);
//var_dump($invoices_per_costumer);
foreach ($invoices_per_costumer as $invoice_each) {
$item = new Item();
$order++;
$item->setItemId("460000000027017");
$item->setProjectId("");
$item->setExpenseId("");
$item->setName("Print Services");
$item->setDescription($invoice_each['description']);
$item->setItemOrder($order);
$item->setRate($invoice_each['rate']);
$item->setUnit("Nos");
$item->setQuantity(1.0);
$item->setDiscount(0.0);
$item->setTaxId("460000000027005");
$structJson->setLineItems($item);
$item = null;
}
$structJson->setNotes("Thanks for your business.");
$order = null;
$structJsonArray[] = $structJson;
$structJson = null;
}
return $structJsonArray;
}
示例2: testSetGetDescription
public function testSetGetDescription()
{
// Arrange
$item = new Item();
$item->setDescription('this is an item description');
$expectedResult = 'this is an item description';
// Act
$result = $item->getDescription();
// Assert
$this->assertEquals($result, $expectedResult);
}
示例3: create
public function create(Category $category, $name, $price, $stock, $image, $description)
{
$errors = array();
$item = new Item($this->db);
try {
$item->setCategory($category);
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
try {
$item->setName($name);
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
try {
$item->setPrice($price);
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
try {
$item->setStock($stock);
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
try {
$item->setImage($image);
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
try {
$item->setDescription($description);
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
if (count($errors) == 0) {
$name = $this->db->quote($item->getName());
$price = $this->db->quote($item->getPrice());
$stock = $this->db->quote($item->getStock());
$image = $this->db->quote($item->getImage());
$description = $this->db->quote($item->getDescription());
$idCategory = $item->getCategory()->getId();
$query = ' INSERT INTO item (id_category, name, price, stock, image, description)
VALUES(' . $idCategory . ',' . $name . ',' . $price . ',' . $stock . ',' . $image . ',' . $description . ')';
$res = $this->db->exec($query);
if ($res) {
$id = $this->db->lastInsertId();
if ($id) {
return $this->readByID($id);
} else {
throw new Exception('Internal server Error');
}
}
}
}
示例4: testSetDescription
function testSetDescription()
{
//Arrange
$description = "Pliny the Elder";
$cost = 5.0;
$id = null;
$test_item = new Item($description, $cost, $id);
$new_description = "Pliny the Younger";
//Act
$test_item->setDescription($new_description);
$result = $test_item->getDescription();
//Assert
$this->assertEquals($new_description, $result);
}
示例5: updateFeed
/**
* Takes a Feed object and updates the Item table with new entries on that feed
* Returns number of new records added
**/
protected function updateFeed($feedRecord)
{
$feed = $this->getFeed($feedRecord->getLink());
echo "Feed: ", $feedRecord->getLink(), " (", count($feed->entries), " items)\n";
$itemCriteria = new Criteria();
$newItems = 0;
// Short circuit if the feed parsing failed
if (empty($feed) || empty($feed->entries)) {
echo "ERROR: Returned feed not valid, or empty\n";
return 0;
}
foreach ($feed->entries as $entry) {
//echo $entry->title, "\n";
// Check whether this entry already exists
$itemCriteria->add(ItemPeer::ATOMID, $entry->id, Criteria::EQUAL);
$num = ItemPeer::doCount($itemCriteria);
// Skip the current entry if we already have it
if ($num > 0) {
//echo "INFO: Duplicate atom id: {$entry->id}. Skipping\n";
continue;
}
// Create a new Item record, and save
$item = new Item();
$item->fromArray(array('Atomid' => $entry->id, 'Title' => $entry->title, 'Link' => $this->getLinkHref($entry->links, 'alternate'), 'Description' => '', 'Published' => $entry->published));
if (!empty($entry->content->text)) {
$item->setDescription($entry->content->text);
} elseif (!empty($entry->summary)) {
$item->setDescription($entry->summary);
}
$item->setFeed($feedRecord);
//print_r($item);
$item->save();
$newItems++;
}
return $newItems;
}
示例6: scrapeHtml
function scrapeHtml()
{
$url = "http://nivent.nicovideo.jp/";
$items = array();
$html = file_get_html($url);
foreach ($html->find('div[id=list] div[class=box clearfix]') as $key => $html_item) {
//データの元
//var_dump($html_item);
$title = $html_item->find('div[class=infoUpper] strong a');
$link = $html_item->find('div[class=infoUpper] strong a');
$description = $html_item->find('div[class=infoLower] p[class=body]');
$thumbnail = $html->find('div[class=thumb] img');
//var_dump($link);
//アイテムを格納
$item = new Item();
$item->setTitle($title[0]->innertext);
$item->setLink("http://nivent.nicovideo.jp" . $link[0]->href);
$item->setDescription(createImgTag($thumbnail[$key]->src) . $description[0]->innertext);
$items[] = $item;
}
return $items;
}
示例7: createItem
/**
* createItem
* --
* @param Item $item
* @param $sku
* @param $description
* @return ArrayOfItem|int|mixed|null
*/
public function createItem(Item $item, $sku, $description)
{
if ($item != null) {
// Instantiate a new ArrayOfItem
try {
// Set SKU & description of new item
$item->setSKU($sku);
$item->setDescription($description);
// Set array of items, inc. above item.
$aoItems = new ArrayOfItem();
$aoItems->setItem([$item]);
// return the new [items].
return $aoItems;
} catch (Exception $e) {
// Something went wrong - error_log & return error message
error_log($e->getMessage() . "-" . $e->getTraceAsString());
return $e->getCode();
}
} else {
return null;
}
}
示例8: createAction
function createAction(Request $request, Application $app)
{
if (null === ($user = $app['session']->get('user'))) {
return $app->redirect('/login');
}
$newItem = new Item();
$newItem->setName($request->get('name'));
$newItem->setDescription($request->get('description'));
$newItem->setPrice($request->get('price'));
$newItem->setCalories($request->get('calories'));
$newItem->setAllergyInformation($request->get('allergyInformation'));
$em = $app['orm.em'];
$categoryRepository = $em->getRepository('Category');
$Category = $categoryRepository->find($request->get('category'));
$newItem->setCategory($Category);
$file = $request->files->get('photo');
$newItem->setPhoto($file->getClientOriginalName());
$file = $request->files->get('photo');
$file->move(__DIR__ . '/../public/img', $file->getClientOriginalName());
$em->persist($newItem);
$em->flush();
return $app->redirect('/itemAdmin');
}
示例9: while
post_author_name,
post_date,
post_source_uri,
post_source_name,
post_category,
category_id,
category_name
FROM post
LEFT JOIN category ON category_id = post_category_id
WHERE post_valid=1
LIMIT 10');
while ($row = mysql_fetch_object($request)) {
// Creating a new feed item
$rssItem = new Item();
$rssItem->setTitle($row->post_title);
$rssItem->setDescription($row->post_description);
$rssItem->setLink('http://www.mywebsite.com/blog/post.php?id=' . $row->post_id);
$rssItem->setGuid('http://www.mywebsite.com/blog/post.php?id=' . $row->post_id, true);
$rssItem->setComments('http://www.mywebsite.com/blog/post.php?id=' . $row->post_id . '#comments');
$rssItem->setAuthor($row->post_author_email, $row->post_author_name);
$rssItem->setPubDate($row->post_date);
$rssItem->setSource($row->post_source_uri, $row->post_source_name);
$rssItem->setEnclosure('http://www.mywebsite.com/blog/images/nopicture.jpg', 2800, 'image/jpg');
$rssItem->setCategory('http://www.mywebsite.com/blog/category.php.idCat=' . $row->category_id, $row->category_name);
// Add the item to the feed
$rssFeed->appendItem($rssItem);
}
// Save the feed
$rssFeed->save();
// SQL connection closing
mysql_close();
示例10: generateInvoiceItems
protected function generateInvoiceItems()
{
for ($j = 0; $j < mt_rand(1, 10); $j++) {
$item = new Item();
$item->setDescription($this->items[array_rand($this->items)]);
$item->setUnitaryCost(mt_rand(100, 100000) / 100);
$item->setQuantity(mt_rand(1, 10));
if (mt_rand(1, 15) == 1) {
$item->setDiscount(mt_rand(1, 70));
}
$max_tax = mt_rand(1, 10) == 1 ? mt_rand(1, 3) : 1;
for ($kk = 0; $kk < $max_tax; $kk++) {
$item->Taxes[] = $this->getRandomTax();
}
$this->inv->Items[] = $item;
}
}
示例11: getItems
static function getItems(Feed &$feed)
{
$fid = $feed->getId();
$text = $feed->getMessage();
static::doParse($text);
$assocs = static::$array;
$result = array();
foreach ($assocs as $index => $assoc) {
$item = new Item();
$item->setId($fid . '_' . $index);
$item->setFeed($feed);
if (isset($assoc['type'])) {
$item->setType($assoc['type']);
} else {
$item->setType('GLOBAL');
}
if (isset($assoc['description'])) {
$item->setDescription($assoc['description']);
}
if (isset($assoc['global'])) {
$item->setGlobal($assoc['global']);
}
if (isset($assoc['name'])) {
$item->setName($assoc['name']);
}
if (isset($assoc['note'])) {
$item->setNote($assoc['note']);
}
if (isset($assoc['price_digit'])) {
$item->setPrice($assoc['price_digit']);
}
if (isset($assoc['price'])) {
$item->setPriceStr($assoc['price']);
}
if (isset($assoc['status'])) {
$item->setStatus($assoc['status']);
}
$result[] = $item;
}
if (!$result) {
$item = new Item();
$item->setId($fid . '_0');
$item->setFeed($feed);
$item->setType('GLOBAL');
$item->setGlobal($text);
$result[] = $item;
}
return $result;
}
示例12: compareByDate
$channel = $feed->getElementsByTagName('channel')->item(0);
// the whole channel element
$channelTitle = $channel->getElementsByTagName('link')->item(0)->nodeValue;
// channel title
$items = $feed->getElementsByTagName('item');
// All items in this feed
foreach ($items as $key) {
$title = $key->getElementsByTagName('title')->item(0)->nodeValue;
$link = $key->getElementsByTagName('link')->item(0)->nodeValue;
$description = $key->getElementsByTagName('description')->item(0)->nodeValue;
$pubDate = $key->getElementsByTagName('pubDate')->item(0)->nodeValue;
$item = new Item();
$item->setMedia($channelTitle);
$item->setTitle($title);
$item->setLink($link);
$item->setDescription($description);
$item->setPubDate($pubDate);
$result[] = $item;
}
}
usort($result, 'compareByDate');
function compareByDate(Item $a, Item $b)
{
$a = strtotime($a->getPubDate());
$b = strtotime($b->getPubDate());
if ($a == $b) {
return 0;
}
return $a < $b ? 1 : -1;
}
foreach ($result as $val) {
示例13: parseTransactionItem
private static function parseTransactionItem($data)
{
// <transaction> <items> <item>
$item = new Item();
// <transaction> <items> <item> <id>
if (isset($data["id"])) {
$item->setId($data["id"]);
}
// <transaction> <items> <item> <description>
if (isset($data["description"])) {
$item->setDescription($data["description"]);
}
// <transaction> <items> <item> <quantity>
if (isset($data["quantity"])) {
$item->setQuantity($data["quantity"]);
}
// <transaction> <items> <item> <amount>
if (isset($data["amount"])) {
$item->setAmount($data["amount"]);
}
// <transaction> <items> <item> <weight>
if (isset($data["weight"])) {
$item->setWeight($data["weight"]);
}
return $item;
}
示例14: testSetDescription
/**
* @covers Debril\RssAtomBundle\Protocol\Parser\Item::setDescription
*/
public function testSetDescription()
{
$newDescription = 'A brand new description';
$this->object->setDescription($newDescription);
$this->assertEquals($newDescription, $this->object->getDescription());
}
示例15: SizePrice
$item->addSizePrice(new SizePrice("M", 25.0));
$item->addSizePrice(new SizePrice("S", 25.0));
$items[] = $item;
$item = new Item();
$item->setName("Zipper");
$item->setDescription("Wer mag es nicht, das flauschige Allwetterkleidungsstück für den Nerd von heute. " . "\n\nAuf Wunsch mit eigenem Schriftzug.");
$item->setImage("zipper.jpg");
$item->addSizePrice(new SizePrice("XXL", 35.0));
$item->addSizePrice(new SizePrice("XL", 35.0));
$item->addSizePrice(new SizePrice("L", 35.0));
$item->addSizePrice(new SizePrice("M", 35.0));
$item->addSizePrice(new SizePrice("S", 35.0));
$items[] = $item;
$item = new Item();
$item->setName("Laser-Foo");
$item->setDescription("Diverse Gegenstände, die wir erfolgreich einer Laserbehandlung unterzogen haben.");
$item->setImage("pfannenwender.jpg");
$item->addSizePrice(new SizePrice("Pfannenwender mit Logo", 5.0));
$item->addSizePrice(new SizePrice("Minecraft-Spaten", 5.0));
$items[] = $item;
$item = new Item();
$item->setName("Schürze");
$item->setDescription("Es soll auch Nerds geben, die sich in die Küche trauen. Das wollen wir natürlich " . "unterstützen! Die Bestickung wird von unseren Fachkräften Unicorn oder Inte mittels " . "unserer programmierbaren Stickmaschine vorgenommen.");
$item->setImage("schuerze.jpg");
$item->addSizePrice(new SizePrice("XXL", 20.0));
$item->addSizePrice(new SizePrice("XL", 20.0));
$item->addSizePrice(new SizePrice("L", 20.0));
$item->addSizePrice(new SizePrice("M", 20.0));
$item->addSizePrice(new SizePrice("S", 20.0));
$items[] = $item;
$targetMails = array("vorstand@raumzeitlabor.de", "mail@oliverknapp.de");