本文整理汇总了PHP中Categorie::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Categorie::update方法的具体用法?PHP Categorie::update怎么用?PHP Categorie::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Categorie
的用法示例。
在下文中一共展示了Categorie::update方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: put
/**
* Update category
*
* @param int $id Id of category to update
* @param array $request_data Datas
* @return int
*
* @url PUT category/{id}
*/
function put($id, $request_data = NULL)
{
if (!DolibarrApiAccess::$user->rights->categorie->creer) {
throw new RestException(401);
}
$result = $this->category->fetch($id);
if (!$result) {
throw new RestException(404, 'category not found');
}
if (!DolibarrApi::_checkAccessToResource('category', $this->category->id)) {
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
}
foreach ($request_data as $field => $value) {
$this->category->{$field} = $value;
}
if ($this->category->update(DolibarrApiAccess::$user)) {
return $this->get($id);
}
return false;
}
示例2: header
$error = $exception->getMessage();
}
if (empty($error)) {
header('Location: ' . str_replace('index.php', '', $_SERVER['SCRIPT_NAME']) . 'home/' . $categorie->getCategory() . '/' . urlencode($topic->getTitre()));
exit;
}
}
//Supression d'un topic
if (isset($_POST['remove'], $_GET['id'])) {
$manager = new Categorie($link);
$topic = $manager->selectById($_GET['id']);
$id = $topic->getId();
$manager->delete($id);
header('Location: ' . str_replace('index.php', '', $_SERVER['SCRIPT_NAME']) . 'home/' . $topic->getCategory()->getCategory());
exit;
}
//modification d'un topic
if (isset($_POST['validate'])) {
$manager = new Categorie($link);
$topic = $manager->selectById($_GET['id']);
try {
$topic->setTitre($_POST['titreTopic']);
} catch (Exception $e) {
$error = $e->getMessage();
}
if (empty($error)) {
$manager->update($topic);
header('Location:' . str_replace('index.php', '', $_SERVER['SCRIPT_NAME']) . '/home/' . $topic->getCategory()->getCategory());
exit;
}
}
示例3: Categorie
{
if (!in_array ($old_cat, $new_cats_meres))
{
$asupprimer[] = new Categorie ($db, $old_cat);
}
}
foreach ($new_cats_meres as $new_cat)
{
if (!in_array ($new_cat, $old_cats_meres))
{
$aajouter[] = new Categorie ($db, $new_cat);
}
}
$res = $cat->update ();
if ($res < 0)
{
print "<p>Impossible de modifier la categorie ".$cat->label.".</p>";
}
else
{
print "<p>La categorie ".$cat->label." a ete modifiee avec succes.</p>";
foreach ($asupprimer as $old_mere)
{
$res = $old_mere->del_fille ($cat);
if ($res < 0)
{
print "<p>Impossible d'enlever la categorie de \"".$old_mere->label."\" ($res).</p>\n";
}
示例4: header
$categorie->visible = $_POST["visible"];
if ($_POST['catMere'] != "-1") {
$categorie->id_mere = $_POST['catMere'];
} else {
$categorie->id_mere = "";
}
if (!$categorie->label) {
$_GET["action"] = 'create';
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"));
}
if (!$categorie->description) {
$_GET["action"] = 'create';
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Description"));
}
if (!$categorie->error) {
if ($categorie->update($user) > 0) {
header('Location: ' . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $categorie->id . '&type=' . $type);
exit;
} else {
$mesg = $categorie->error;
}
} else {
$mesg = $categorie->error;
}
}
/*
* View
*/
llxHeader("", "", $langs->trans("Categories"));
print_fiche_titre($langs->trans("ModifCat"));
dol_htmloutput_errors($mesg);
示例5: Categorie
$pubblicato_uk = "f";
if (isset($_POST["pubblicato_eur"]) and $_POST["pubblicato_eur"] == "t") {
$pubblicato_eur = "t";
}
if (isset($_POST["pubblicato_uk"]) and $_POST["pubblicato_uk"] == "t") {
$pubblicato_uk = "t";
}
$object = new Categorie();
if (isset($_POST["insert"]) and $_POST["insert"] == "si") {
$object->add($fk_classe, $categoria, $categoria_ita, $categoria_ted, $pubblicato_eur, $pubblicato_uk);
//recupero l'ultimo id inserito
$db = new Db();
$id = $db->get_last_id();
} elseif (isset($_POST["update"]) and $_POST["update"] == "si") {
$id = aggiusta_post($_GET["id"]);
$object->update($id, $fk_classe, $categoria, $categoria_ita, $categoria_ted, $pubblicato_eur, $pubblicato_uk);
//upload dei file
update_file("pr_categoria", "categorie_dettaglio.php?errore=file&id=" . $id, $id);
}
print "<script language='Javascript'>window.location.replace('categorie_dettaglio.php?id=" . $id . "&ins=si');</script>";
}
$fkclasse = "";
$categoria = "";
$categoria_ita = "";
$categoria_ted = "";
$pubblicato_eur = "";
$pubblicato_uk = "";
if (isset($_GET["id"]) and $_GET["id"] != "") {
$id = aggiusta_post($_GET["id"]);
$fkclasse = $array["cat_fkclasse"];
$categoria = $array["cat_categoria"];