当前位置: 首页>>代码示例>>PHP>>正文


PHP Categorie::delete方法代码示例

本文整理汇总了PHP中Categorie::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Categorie::delete方法的具体用法?PHP Categorie::delete怎么用?PHP Categorie::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Categorie的用法示例。


在下文中一共展示了Categorie::delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 /**
  * Delete category
  *
  * @param int $id   Category ID
  * @return array
  * 
  * @url	DELETE category/{id}
  */
 function delete($id)
 {
     if (!DolibarrApiAccess::$user->rights->categorie->supprimer) {
         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);
     }
     if (!$this->category->delete(DolibarrApiAccess::$user)) {
         throw new RestException(401, 'error when delete category');
     }
     return array('success' => array('code' => 200, 'message' => 'Category deleted'));
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:25,代码来源:api_category.class.php

示例2: Contact

                        require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
                        $tmpobject = new Contact($db);
                        $result = $tmpobject->fetch($removeelem);
                        $elementtype = 'contact';
                    }
                }
            }
        }
    }
    $result = $object->del_type($tmpobject, $elementtype);
    if ($result < 0) {
        dol_print_error('', $object->error);
    }
}
if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confirm == 'yes') {
    if ($object->delete($user) >= 0) {
        header("Location: " . DOL_URL_ROOT . '/categories/index.php?type=' . $type);
        exit;
    } else {
        setEventMessages($object->error, $object->errors, 'errors');
    }
}
if ($type == Categorie::TYPE_PRODUCT && $elemid && $action == 'addintocategory' && ($user->rights->produit->creer || $user->rights->service->creer)) {
    require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
    $newobject = new Product($db);
    $result = $newobject->fetch($elemid);
    $elementtype = 'product';
    // TODO Add into categ
    $result = $object->add_type($newobject, $elementtype);
    if ($result >= 0) {
        setEventMessages($langs->trans("WasAddedSuccessfully", $newobject->ref), null, 'mesgs');
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:viewcat.php

示例3: testCategorieDelete

    /**
     * @depends	testCategorieOther
     * The depends says test is run only if previous is ok
     */
    public function testCategorieDelete($id)
    {
    	global $conf,$user,$langs,$db;
		$conf=$this->savconf;
		$user=$this->savuser;
		$langs=$this->savlangs;
		$db=$this->savdb;

		$localobject=new Categorie($this->savdb);
    	$result=$localobject->fetch($id);
		$result=$localobject->delete($id);

		print __METHOD__." id=".$id." result=".$result."\n";
    	$this->assertLessThan($result, 0);
    	return $result;
    }
开发者ID:remyyounes,项目名称:dolibarr,代码行数:20,代码来源:CategorieTest.php

示例4: catch

    try {
        $topic = $categorie->create($_POST['titreTopic']);
    } catch (Exception $exception) {
        $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());
开发者ID:jmgerber,项目名称:forum,代码行数:31,代码来源:traitement-topic.php


注:本文中的Categorie::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。