本文整理汇总了PHP中category::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP category::setId方法的具体用法?PHP category::setId怎么用?PHP category::setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类category
的用法示例。
在下文中一共展示了category::setId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* Saves an category into the database.
*
* @param \GamyGoody\Domain\category $category The category to save
*/
public function save(category $category)
{
$categoryData = array('cat_title' => $category->getTitle());
if ($category->getId()) {
// The category has already been saved : update it
$this->getDb()->update('category', $categoryData, array('cat_id' => $category->getId()));
} else {
// The category has never been saved : insert it
$this->getDb()->insert('category', $categoryData);
// Get the id of the newly created category and set it on the entity.
$id = $this->getDb()->lastInsertId();
$category->setId($id);
}
}
示例2: category
<button type="reset" name="cancel" class="red"><?php
echo $language['cancel'];
?>
</button>
</div>
</form>
<?php
} else {
if (isset($_POST['published'])) {
$_POST['published'] = true;
} else {
$_POST['published'] = false;
}
$category = new category();
$category->setId(intval($_GET['i']));
$category->setContent($_POST['title_1'], $_POST['description_1'], $_POST['title_2'], $_POST['description_2'], $_POST['title_3'], $_POST['description_3'], $_POST['title_4'], $_POST['description_4'], $_POST['title_5'], $_POST['description_5'], $_POST['title_6'], $_POST['description_6'], $_POST['code']);
$category->setUserId($account["name"]);
$category->setDateUpdate();
$category->setPublished($_POST['published']);
$category->setCategoryType($_POST['category_type']);
if ($category->update()) {
print 'sucess';
} else {
print 'failure';
}
}
} else {
print 'error';
}
?>
示例3: category
print $language["template"]["del"];
?>
</button>
</div>
<table class="db-list">
<tr>
<th>#</th>
<th>Titulo</th>
<th>Categoria</th>
<th>Pub.</th>
<th>Sel.</th>
</tr>
<?php
foreach ($article_list as $article) {
$object_category = new category();
$object_category->setId($article['category_id']);
$category = $object_category->returnOneCategory();
if ($article['published']) {
$published = '<img src="./site-assets/images/icon_on.png" alt="on" title="publicado"/>';
} else {
$published = '<img src="./site-assets/images/icon_off.png" alt="off" title="não publicado"/>';
}
print '<tr>' . '<td>' . $article['id'] . '</td>' . '<td>' . $article['title_1'] . '</td>' . '<td>' . $category['name_1'] . '</td>' . '<td>' . $published . '</td>' . '<td><input type="radio" name="article" value="' . $article['id'] . '"/></td>' . '</tr>';
}
?>
</table>
<div class="button-area">
<button onclick="goTo('./backoffice.php?pg=article-add');" class="green"><?php
print $language["template"]["add"];
?>
</button>
示例4: category
<?php
if (isset($_REQUEST['i']) && !empty($_REQUEST['i'])) {
$object_category = new category();
$object_category->setId($_REQUEST['i']);
if ($object_category->delete()) {
print 'sucess';
} else {
print 'error';
}
} else {
print 'error';
}
示例5: category
?>
</button>
</div>
<table class="db-list">
<tr>
<th>#</th>
<th>Produto</th>
<th>Categoria</th>
<th>Pub.</th>
<th>Sel.</th>
</tr>
<?php
$i_last = 0;
foreach ($product_list as $product) {
$object_category = new category();
$object_category->setId($product['category_id']);
$category = $object_category->returnOneCategory();
if ($product['published']) {
$published = '<img src="./site-assets/images/icon_on.png" alt="on" />';
} else {
$published = '<img src="./site-assets/images/icon_off.png" alt="off" />';
}
print '<tr>' . '<td>' . $product['id'] . '</td>' . '<td>' . $product['title_1'] . '</td>' . '<td>' . $category['name_1'] . '</td>' . '<td>' . $published . '</td>' . '<td><input type="radio" name="product" value="' . $product['id'] . '"/></td>' . '</tr>';
$i_last = $product['id'];
}
?>
</table>
<div class="button-area">
<button onclick="goTo('./backoffice.php?pg=product-add');" class="green"><?php
print $language["template"]["add"];
?>