本文整理汇总了PHP中Categorie::del_type方法的典型用法代码示例。如果您正苦于以下问题:PHP Categorie::del_type方法的具体用法?PHP Categorie::del_type怎么用?PHP Categorie::del_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Categorie
的用法示例。
在下文中一共展示了Categorie::del_type方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Adherent
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
$tmpobject = new Adherent($db);
$result = $tmpobject->fetch($removeelem);
$elementtype = 'member';
} else {
if ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) {
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);
示例2: setCategories
/**
* Sets object to supplied categories.
*
* Deletes object from existing categories not supplied.
* Adds it to non existing supplied categories.
* Existing categories are left untouch.
*
* @param int[]|int $categories Category or categories IDs
*/
public function setCategories($categories)
{
// Handle single category
if (!is_array($categories)) {
$categories = array($categories);
}
// Get current categories
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$c = new Categorie($this->db);
$existing = $c->containing($this->id, Categorie::TYPE_PRODUCT, 'id');
// Diff
if (is_array($existing)) {
$to_del = array_diff($existing, $categories);
$to_add = array_diff($categories, $existing);
} else {
$to_del = array();
// Nothing to delete
$to_add = $categories;
}
// Process
foreach ($to_del as $del) {
$c->fetch($del);
$c->del_type($this, 'product');
}
foreach ($to_add as $add) {
$c->fetch($add);
$c->add_type($this, 'product');
}
return;
}
示例3: Adherent
}
if ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer) {
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
$object = new Adherent($db);
$result = $object->fetch($objectid);
$elementtype = 'member';
}
if ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) {
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
$object = new Contact($db);
$result = $object->fetch($objectid);
$elementtype = 'contact';
}
$cat = new Categorie($db);
$result = $cat->fetch($removecat);
$result = $cat->del_type($object, $elementtype);
if ($result < 0) {
setEventMessages($cat->error, $cat->errors, 'errors');
}
}
// Add object into a category
if ($parent > 0) {
if ($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer)) {
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
$object = new Product($db);
$result = $object->fetch($id, $ref);
$elementtype = 'product';
}
if ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) {
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php';
$object = new Fournisseur($db);
示例4: setCategories
/**
* Sets object to supplied categories.
*
* Deletes object from existing categories not supplied.
* Adds it to non existing supplied categories.
* Existing categories are left untouch.
*
* @param int[]|int $categories Category or categories IDs
* @param string $type Category type (customer or supplier)
*/
public function setCategories($categories, $type)
{
// Decode type
if ($type == 'customer') {
$type_id = Categorie::TYPE_CUSTOMER;
$type_text = 'customer';
} elseif ($type == 'supplier') {
$type_id = Categorie::TYPE_SUPPLIER;
$type_text = 'supplier';
} else {
dol_syslog(__METHOD__ . ': Type ' . $type . 'is an unknown company category type. Done nothing.', LOG_ERR);
return;
}
// Handle single category
if (!is_array($categories)) {
$categories = array($categories);
}
// Get current categories
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$c = new Categorie($this->db);
$existing = $c->containing($this->id, $type_id, 'id');
// Diff
if (is_array($existing)) {
$to_del = array_diff($existing, $categories);
$to_add = array_diff($categories, $existing);
} else {
$to_del = array(); // Nothing to delete
$to_add = $categories;
}
// Process
foreach ($to_del as $del) {
if ($c->fetch($del) > 0) {
$c->del_type($this, $type_text);
}
}
foreach ($to_add as $add) {
if ($c->fetch($add) > 0) {
$c->add_type($this, $type_text);
}
}
return;
}
示例5: Societe
}
if ($_REQUEST["type"]==2 && $user->rights->societe->creer)
{
$object = new Societe($db);
$result = $object->fetch($objectid);
}
if ($_REQUEST["type"] == 3 && $user->rights->adherent->creer)
{
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
$object = new Adherent($db);
$result = $object->fetch($objectid);
}
$cat = new Categorie($db);
$result=$cat->fetch($_REQUEST["removecat"]);
$result=$cat->del_type($object,$type);
}
// Add object into a category
if (isset($_REQUEST["catMere"]) && $_REQUEST["catMere"]>=0)
{
$_GET["id"]=$_REQUEST["id"];
$_GET["type"]=$_REQUEST["type"];
if ($_REQUEST["type"]==0 && ($user->rights->produit->creer || $user->rights->service->creer))
{
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
$object = new Product($db);
if ($_REQUEST["ref"]) $result = $object->fetch('',$_REQUEST["ref"]);
if ($_REQUEST["id"]) $result = $object->fetch($_REQUEST["id"]);
$type = 'product';