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


PHP Category::delete方法代码示例

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


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

示例1: delete

 function delete($id = FALSE)
 {
     $c = new Category($id);
     $c->delete();
     $this->session->set_flashdata('msg', '<div class="alert alert-success">Category was succesfully deleted.</div>');
     redirect($this->agent->referrer());
 }
开发者ID:ricardocasares,项目名称:Eventor,代码行数:7,代码来源:categories.php

示例2: array

 /**
  * Delete category
  *
  * @param void
  * @return null
  */
 function delete_category()
 {
     if ($this->active_category->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if ($this->request->isSubmitted()) {
         $delete = $this->active_category->delete();
         if ($delete && !is_error($delete)) {
             if ($this->request->getFormat() == FORMAT_HTML) {
                 flash_success('Category :category_name has been deleted', array('category_name' => $this->active_category->getName()));
                 $this->redirectToUrl($this->smarty->get_template_vars('categories_url'));
             } else {
                 $this->serveData($this->active_category, 'category');
             }
             // if
         } else {
             if ($this->request->getFormat() == FORMAT_HTML) {
                 flash_error('Failed to delete :category_name', array('category_name' => $this->active_category->getName()));
                 $this->redirectToUrl($this->smarty->get_template_vars('categories_url'));
             } else {
                 $this->serveData($delete);
             }
             // if
         }
         // if
     } else {
         $this->httpError(HTTP_ERR_BAD_REQUEST);
     }
     // if
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:37,代码来源:ProjectController.class.php

示例3: actionDelete

 /**
  * 删除
  */
 public function actionDelete($id)
 {
     $id = (int) $id;
     $Category = new Category();
     $Category->delete(array('cid' => $id));
     WaveCommon::exportResult(true, '成功!');
 }
开发者ID:xpmozong,项目名称:wavephp2_demos,代码行数:10,代码来源:CategoriesController.php

示例4: testDelete

 public function testDelete()
 {
     $category = Category::getNewInstance(Category::getRootNode());
     $category->save();
     $field = SpecField::getNewInstance($category, SpecField::DATATYPE_TEXT, SpecField::TYPE_TEXT_SIMPLE);
     $field->handle->set('randomhandle');
     $field->save();
     $this->request->set('id', $field->getID());
     $response = $this->controller->delete();
     $this->assertIsA($response, 'JSONResponse');
     $value = $response->getValue();
     $this->assertEqual($value['status'], 'success');
     // already deleted
     $response = $this->controller->delete();
     $value = $response->getValue();
     $this->assertEqual($value['status'], 'failure');
 }
开发者ID:saiber,项目名称:livecart,代码行数:17,代码来源:SpecFieldControllerTest.php

示例5: elseif

 function admin_delete($id = null)
 {
     if (!$id) {
         $this->Session->setFlash('Invalid category id');
         $this->redirect(array('action' => 'admin_index', 'admin' => true));
     } elseif ($this->Category->delete($id)) {
         $this->Session->setFlash('Product was deleted successfully!');
         $this->redirect(array('action' => 'admin_index', 'admin' => true));
     }
 }
开发者ID:johnulist,项目名称:ecommerce,代码行数:10,代码来源:categories_controller.php

示例6: delete

 function delete($id)
 {
     if ($id) {
         $category = new Category($id);
         $module = $category->module;
         $category->delete();
         set_notify('success', lang('delete_data_complete'));
     }
     redirect('galleries/admin/categories');
 }
开发者ID:unisexx,项目名称:thaigcd2015,代码行数:10,代码来源:categories.php

示例7: delete

 function delete($id)
 {
     if ($id) {
         $category = new Category($id);
         foreach ($category->gallery as $item) {
             $item->delete();
         }
         $category->delete();
         set_notify('success', lang('delete_data_complete'));
     }
     redirect('galleries/admin/categories');
 }
开发者ID:unisexx,项目名称:imac,代码行数:12,代码来源:categories.php

示例8: init

 function init()
 {
     $obj = new Category();
     $func = array_shift($this->param);
     $id = array_shift($this->param);
     if ($func != '') {
         $_SERVER['REQUEST_METHOD'] = 'POST';
         switch ($func) {
             case 'add':
                 $data['parent_id'] = $id;
                 $data['name'] = $_POST['name'];
                 $data['active'] = true;
                 try {
                     $obj->add($data);
                 } catch (Exception $e) {
                 }
                 header('Location: /admin_categories');
                 exit;
                 break;
             case 'save':
                 $data['name'] = $_POST['name'];
                 try {
                     $obj->update($id, $data);
                 } catch (Exception $e) {
                 }
                 header('Location: /admin_categories');
                 exit;
                 break;
             case 'delete':
                 try {
                     $obj->delete($id);
                 } catch (Exception $e) {
                 }
                 header('Location: /admin_categories');
                 exit;
                 break;
             case 'activate':
                 try {
                     $obj->invert($id);
                 } catch (Exception $e) {
                 }
                 header('Location: /admin_categories');
                 exit;
                 break;
         }
     }
 }
开发者ID:jedaika,项目名称:Trainings,代码行数:47,代码来源:admin_categories.php

示例9: doDelete

 function doDelete($id)
 {
     $this->respondTo('html', function () use($id) {
         $response = $this->getResponse();
         $flash = $this->getSession()->getFlashBag();
         try {
             Category::delete($id);
             $response->redirect('App\\Admin\\Controllers\\CategoryController', 'index');
         } catch (ResourceNotFoundException $e) {
             $flash->add('errors', "Cannot find Category #{$id}");
             $response->redirect('App\\Admin\\Controllers\\CategoryController', 'index');
         } catch (\Exception $e) {
             $flash->add('errors', 'Cannot delete Category #' . $id . ' (' . $e->getMessage() . ')');
             $response->redirect('App\\Admin\\Controllers\\CategoryController', 'index');
         }
     });
 }
开发者ID:ngnmhieu,项目名称:Mybookstore,代码行数:17,代码来源:ImageController.php

示例10: delete

 public function delete()
 {
     $Category = new Category($this->db, $this->plural_resorce);
     if (isset($_REQUEST['category_id'])) {
         $user_id = $_SESSION['id'];
         $category_id = $_REQUEST['category_id'];
         // カテゴリーを検査する(本当にユーザー自身のカテゴリかどうか)
         $sql = $Category->check($category_id);
         $record = mysqli_query($this->db, $sql) or die(mysqli_error($this->db));
         $table = mysqli_fetch_assoc($record);
         // 本当にユーザー自身のカテゴリだったら
         if ($table['user_id'] == $user_id) {
             // カテゴリーの削除
             $sql = $Category->delete($category_id);
             mysqli_query($this->db, $sql) or die(mysqli_error($this->db));
             // 削除したカテゴリーが設定されていたToDoのカテゴリ情報をクリア
             $sql = $Category->clear($category_id);
             mysqli_query($this->db, $sql) or die(mysqli_error($this->db));
         }
     }
     header('Location: ../task/index');
     exit;
 }
开发者ID:hiroki0325,项目名称:geechscamp,代码行数:23,代码来源:categories_contllorer.php

示例11: workflow

	/**
	 * Handles loading, saving and deleting categories in a workflow context
	 *	 
	 * @since 1.0
	 * @return void
	 **/
	function workflow () {
		global $Ecart;
		$db =& DB::get();
		$defaults = array(
			'page' => false,
			'deleting' => false,
			'delete' => false,
			'id' => false,
			'save' => false,
			'duplicate' => false,
			'next' => false
			);
		$args = array_merge($defaults,$_REQUEST);
		extract($args,EXTR_SKIP);

		if (!defined('WP_ADMIN') || !isset($page)
			|| $page != $this->Admin->pagename('categories'))
				return false;

		$adminurl = admin_url('admin.php');

		if ($page == $this->Admin->pagename('categories')
				&& !empty($deleting)
				&& !empty($delete)
				&& is_array($delete)) {
			foreach($delete as $deletion) {
				$Category = new Category($deletion);
				if (empty($Category->id)) continue;
				$db->query("UPDATE $Category->_table SET parent=0 WHERE parent=$Category->id");
				$Category->delete();
			}
			$redirect = (add_query_arg(array_merge($_GET,array('delete'=>null,'deleting'=>null)),$adminurl));
			ecart_redirect($redirect);
		}

		if ($id && $id != "new")
			$Ecart->Category = new Category($id);
		else $Ecart->Category = new Category();

		if ($save) {
			$this->save($Ecart->Category);
			$this->Notice = '<strong>'.stripslashes($Ecart->Category->name).'</strong> '.__('has been saved.','Ecart');

			if ($next) {
				if ($next != "new")
					$Ecart->Category = new Category($next);
				else $Ecart->Category = new Category();
			} else {
				if (empty($id)) $id = $Ecart->Category->id;
				$Ecart->Category = new Category($id);
			}

		}
	}
开发者ID:robbiespire,项目名称:paQui,代码行数:60,代码来源:Categorize.php

示例12: process

 public function process()
 {
     // check if session is active
     $session = new Session($this->sessionId);
     if ($session->sessionId > 0) {
         // update session
         $session->update();
         // process restricted functions
         switch ($this->f) {
             case 'checkLogin':
                 return Login::checkLogin($session->sessionId);
             case 'getSession':
                 return $session;
             case 'getWarehouse':
                 if (isset($this->data->update)) {
                     $warehouse = new Warehouse($session->warehouseId, $this->data->update);
                 } else {
                     $warehouse = new Warehouse($session->warehouseId);
                 }
                 $warehouse->dMail = $warehouse->getMail();
                 $warehouse->dDisableLocationLess = $warehouse->isLocationLessDisabled();
                 $warehouse->dDisablePaletteLess = $warehouse->isPaletteLessDisabled();
                 return $warehouse;
             case 'editWarehouse':
                 if (!$session->restricted) {
                     $data = $this->data;
                     $warehouse = new Warehouse($session->warehouseId);
                     // update warehouse data
                     if (isset($data->name)) {
                         $warehouse->name = $data->name;
                     }
                     if (isset($data->description)) {
                         $warehouse->description = $data->description;
                     }
                     if (isset($data->country)) {
                         $warehouse->country = $data->country;
                     }
                     if (isset($data->city)) {
                         $warehouse->city = $data->city;
                     }
                     if (isset($data->password)) {
                         $warehouse->setPassword($data->password);
                     }
                     if (isset($data->passwordRestricted)) {
                         $warehouse->setPasswordRestricted($data->passwordRestricted);
                     }
                     if (isset($data->mail)) {
                         $warehouse->setMail($data->mail);
                     }
                     if (isset($data->disableLocationLess)) {
                         $warehouse->setDisableLocationLess($data->disableLocationLess);
                     }
                     if (isset($data->disablePaletteLess)) {
                         $warehouse->setDisablePaletteLess($data->disablePaletteLess);
                     }
                     // update database entry
                     return $warehouse->edit();
                 }
                 break;
             case 'deleteWarehouse':
                 if (!$session->restricted) {
                     $warehouse = new Warehouse($session->warehouseId);
                     if ($warehouse->id > 0 && $warehouse->delete()) {
                         return $session->destroy();
                     }
                 }
                 break;
             case 'addCategory':
                 if (!$session->restricted && isset($this->data->name)) {
                     $category = new Category(null, $session->warehouseId);
                     $category->name = $this->data->name;
                     if (isset($this->data->parent)) {
                         $category->parent = $this->data->parent;
                     }
                     if ($category->edit()) {
                         return $category->id;
                     }
                 }
                 break;
             case 'getCategory':
                 if (isset($this->data->id) && isset($this->data->update)) {
                     return new Category($this->data->id, $session->warehouseId, $this->data->update);
                 } elseif (isset($this->data->id)) {
                     return new Category($this->data->id, $session->warehouseId);
                 }
                 break;
             case 'deleteCategory':
                 if (!$session->restricted && isset($this->data->id)) {
                     $category = new Category($this->data->id, $session->warehouseId);
                     return $category->delete();
                 }
                 break;
             case 'editCategory':
                 if (isset($this->data->id)) {
                     $data = $this->data;
                     $category = new Category($this->data->id, $session->warehouseId);
                     if (!$session->restricted) {
                         if (isset($data->name)) {
                             $category->name = $data->name;
                         }
//.........这里部分代码省略.........
开发者ID:hanneseilers,项目名称:Social-Warehouse,代码行数:101,代码来源:DataRequest.php

示例13: uninstall

 public function uninstall()
 {
     foreach ($this->available_languages as $iso => $lang) {
         Configuration::deleteByName(TSBuyerProtection::PREFIX_TABLE . 'CERTIFICATE_' . strtoupper($iso));
     }
     $category = new Category((int) TSBuyerProtection::$CAT_ID);
     $category->delete();
     Configuration::deleteByName(TSBuyerProtection::PREFIX_TABLE . 'CAT_ID');
     Configuration::deleteByName(TSBuyerProtection::PREFIX_TABLE . 'SHOPSW');
     Configuration::deleteByName(TSBuyerProtection::PREFIX_TABLE . 'ET_CID');
     Configuration::deleteByName(TSBuyerProtection::PREFIX_TABLE . 'ET_LID');
     Configuration::deleteByName(TSBuyerProtection::PREFIX_TABLE . 'ENV_API');
     Configuration::deleteByName(TSBuyerProtection::PREFIX_TABLE . 'SECURE_KEY');
     return true;
 }
开发者ID:ricardo-rdfs,项目名称:Portal-BIP,代码行数:15,代码来源:TSBuyerProtection.php

示例14: _

                 $data['status'] = 'OK';
                 $data['data'] = _('Category added successfully');
             }
         } else {
             $data['data'] = _('Error! This category already exists');
         }
     } else {
         $data['data'] = ossim_get_error_clean();
     }
 } elseif ($action == 'delete_category') {
     $cat_id = GET('cat_id');
     ossim_valid($cat_id, OSS_DIGIT, 'illegal:' . _('Category'));
     $data['status'] = 'error';
     $data['data'] = _('Error! Category not deleted');
     if (!ossim_error()) {
         if (Category::delete($conn, $cat_id)) {
             $data['status'] = 'OK';
             $data['data'] = _('Category deleted successfully');
         }
     } else {
         $data['data'] = ossim_get_error_clean();
     }
 } elseif ($action == 'delete_subcategory') {
     $subcat_id = GET('subcat_id');
     $cat_id = GET('cat_id');
     ossim_valid($cat_id, OSS_DIGIT, 'illegal:' . _('Category'));
     ossim_valid($subcat_id, OSS_DIGIT, 'illegal:' . _('Subcategory'));
     $data['status'] = 'error';
     $data['data'] = _('Error! Subcategory not deleted');
     if (!ossim_error()) {
         if (Subcategory::delete($conn, $cat_id, $subcat_id)) {
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:category.php

示例15: foreach

        }
        foreach ($languages as $lid => $l) {
            $name = tep_db_prepare_input($_POST['categories_name'][$lid]);
            $seo_text = tep_db_input($_POST['seo_text'][$lid]);
            $cat->updateDetailLanguage($lid, $name, $seo_text);
        }
        if ($cat_id_new) {
            $hm = $hidemenuscript == '' ? '' : '&hidemenu=true';
            header('Location: ?open=setting-category&id=' . $cat->id . $hm);
            exit;
        }
    } elseif ($_POST['me_action'] == 'DELETECATEGORY') {
        $cid = tep_db_prepare_input($_POST['categories_id']);
        $cat = new Category($cid);
        $ctid = $cat->getCategoryTop()->id;
        $cat->delete();
        $messagebox->add('A Category has been succesfully deleted,' . ' please refresh the list to see the update', 'green');
        $_GET['id'] = 'new';
        $_GET['ctid'] = $ctid;
    }
}
//START TEMPLATE
$cat_id = tep_db_prepare_input($_GET['id']);
if ($cat_id == 'new') {
    $cat_id = '0';
    $cat = null;
    $parent_name = '';
    $cat_prefix = '';
    $ctid = tep_db_prepare_input($_GET['ctid']);
    $ct = new CategoryTop($ctid);
    $mod_title = 'Create New Category - ' . $ct->name;
开发者ID:blasiuscosa,项目名称:manobo-2008,代码行数:31,代码来源:setting-category.php


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