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


PHP Category::getAllCategories方法代码示例

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


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

示例1: getAllCategoriesDT

function getAllCategoriesDT()
{
    global $bdd, $_TABLES;
    if (!is_null($bdd) && !is_null($_TABLES)) {
        $content = '<thead>';
        $content .= '<tr>';
        $content .= '<th>Id</th>';
        $content .= '<th>Category</th>';
        $content .= '<th>Action</th>';
        $content .= '</tr>';
        $content .= '</thead>';
        $content .= '<tbody>';
        $objCategory = new Category($bdd, $_TABLES);
        $items = $objCategory->getAllCategories();
        if ($items) {
            foreach ($items as $key => $item) {
                $content .= '<tr categoryId=' . $item->id . '>';
                $content .= '<td>' . $item->id . '</td>';
                $content .= '<td><input type="text" class="input_dt input_dt_category" value="' . $item->category . '" /></td>';
                $content .= "<td><input type='button' class='edit edit_category_dt' value='Save' />\n\t\t\t\t    <input type='button' class='delete delete_category_dt' value='Supprimer' /></td>";
                $content .= '</tr>';
            }
        }
        $content .= '</tbody>';
        return $content;
    } else {
        error_log("BDD ERROR : " . json_encode($bdd));
        error_log("TABLES ERROR : " . json_encode($_TABLES));
    }
}
开发者ID:xXNoceboXx,项目名称:WUS,代码行数:30,代码来源:category.controller.php

示例2: getCategory

 public static function getCategory($categoryid)
 {
     $categoryarray = Category::getAllCategories();
     if (array_key_exists($categoryid, $categoryarray)) {
         //get Key from array
         $name = $categoryarray[$categoryid];
         return $name;
     } else {
         return FALSE;
     }
 }
开发者ID:OHDMax,项目名称:OHDM-SDC,代码行数:11,代码来源:category.php

示例3: actionList

    public function actionList()
    {
        $categories = Category::getAllCategories();
        if (isset($_GET['cat'])) {
            $cat = $_GET['cat'];
            //$shops=Blogshop::model()->with(array('categories'=>array('condition'=>'name="'.$cat.'"')))->findAll();
            $page = 0;
            if (isset($_GET['page'])) {
                $page = $_GET['page'];
            }
            $limit = $this->global_limit;
            $offset = $page * $limit;
            $shops_count = Blogshop::model()->countBySql('SELECT count(*) FROM blogshop, category, blogshop_categories 
			WHERE blogshop.id = blogshop_categories.blogshopid 
			AND category.id = blogshop_categories.categoryid 
			AND category.name = :cat', array(":cat" => $cat));
            $shops = Blogshop::model()->findAllBySql('SELECT * FROM blogshop, category, blogshop_categories 
			WHERE blogshop.id = blogshop_categories.blogshopid 
			AND category.id = blogshop_categories.categoryid 
			AND category.name = :cat 
			limit :limit offset :offset', array(":cat" => $cat, ":limit" => (int) $limit, ':offset' => (int) $offset));
            /*
            $pages_count=ceil($shops_count/$limit);
            
            $front_page_limit=$this->getFrontLimitPage($pages_count,$page,5);
            $back_page_limit=$this->getBackLimitPage($pages_count,$page,5);									
            
            $this->render('list',array('categories'=>$categories,
            					'shops'=>$shops,								
            					'page'=>$page,								
            					'front_limit_pages'=>$front_page_limit,
            					'back_limit_pages'=>$back_page_limit));
            */
            $viewArray = $this->getViewArray($shops_count, $limit, $page, 5);
            $viewArray['shops'] = $shops;
            $viewArray['categories'] = $categories;
            $this->render('list', $viewArray);
            return;
        }
        $this->render('list', array('categories' => $categories, 'shops' => array(), 'front_limit_pages' => 0, 'back_limit_pages' => 0, 'page' => 0));
    }
开发者ID:sljm12,项目名称:TestDrive,代码行数:41,代码来源:BlogShopController.php

示例4: getAllWebsiteCategoriesDT

function getAllWebsiteCategoriesDT()
{
    global $bdd, $_TABLES;
    if (!is_null($bdd) && !is_null($_TABLES)) {
        $content = '<thead>';
        $content .= '<tr>';
        $content .= '<th>Id</th>';
        $content .= '<th>Category</th>';
        $content .= '<th>Website</th>';
        $content .= '<th>Website Category</th>';
        $content .= '<th>Url</th>';
        $content .= '<th>Use Url</th>';
        $content .= '<th>Url Pagination</th>';
        $content .= '<th>Use Pagination</th>';
        $content .= '<th>Action</th>';
        $content .= '</tr>';
        $content .= '</thead>';
        $content .= '<tbody>';
        $objWebsiteCategory = new WebsiteCategory($bdd, $_TABLES);
        $items = $objWebsiteCategory->getAllWebsiteCategories();
        if ($items) {
            foreach ($items as $key => $item) {
                $content .= '<tr website_category_id=' . $item->id . '>';
                $content .= '<td>' . $item->id . '</td>';
                $content .= '<td><select class="select_dt select_dt_category_id">';
                $objCategory = new Category($bdd, $_TABLES);
                $categories_items = $objCategory->getAllCategories();
                if ($categories_items) {
                    foreach ($categories_items as $key_c => $category_item) {
                        $temp_content = '';
                        $temp_content .= '<option value="' . $category_item->id . '" ';
                        if ($category_item->id == $item->category_id) {
                            $temp_content .= 'selected>';
                        } else {
                            $temp_content .= '>';
                        }
                        $temp_content .= $category_item->category . '</option>';
                        $content .= $temp_content;
                    }
                }
                $content .= '</select></td>';
                $content .= '<td><select class="select_dt select_dt_website_id">';
                $objWebsite = new Website($bdd, $_TABLES);
                $websites_items = $objWebsite->getAllWebsites();
                if ($websites_items) {
                    foreach ($websites_items as $key_w => $website_item) {
                        $temp_content = '';
                        $temp_content .= '<option value="' . $website_item->id . '" ';
                        if ($website_item->id == $item->website_id) {
                            $temp_content .= 'selected>';
                        } else {
                            $temp_content .= '>';
                        }
                        $temp_content .= $website_item->website . '</option>';
                        $content .= $temp_content;
                    }
                }
                $content .= '</select></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_website_category" value="' . $item->category . '" /></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_url" value="' . $item->url . '" /></td>';
                $content .= '<td><input type="checkbox" class="input_dt input_dt_use_url" value="' . $item->use_url . '"></input></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_url_pagination" value="' . $item->url_pagination . '" /></td>';
                $content .= '<td><input type="checkbox" class="input_dt input_dt_use_pagination" value="' . $item->use_pagination . '"></input></td>';
                $content .= "<td><input type='button' class='edit edit_website_category_dt' value='Save' />\n\t\t\t\t    <input type='button' class='delete delete_website_category_dt' value='Supprimer' /></td>";
                $content .= '</tr>';
            }
        }
        $content .= '</tbody>';
        return $content;
    } else {
        error_log("BDD ERROR : " . json_encode($bdd));
        error_log("TABLES ERROR : " . json_encode($_TABLES));
    }
}
开发者ID:xXNoceboXx,项目名称:WUS,代码行数:74,代码来源:website_category.controller.php

示例5: elseif

        }
    } else {
        //不能删除
        admin_redirect('category.php', $res);
    }
} elseif ($act == 'edit') {
    //删除商品分类
    //获取要删除商品分类id
    $c_id = isset($_GET['id']) ? $_GET['id'] : 0;
    $category = new Category();
    $res = $category->getCategoryById($c_id);
    if (!$res) {
        //没有获取到数据
        admin_redirect('category.php', '获取商品信息失败');
    }
    $categories = $category->getAllCategories($res['c_id']);
    //加载编辑表单
    include_once ADMIN_TEMP . '/category_edit.html';
} elseif ($act == 'update') {
    //更新商品分类
    //接受商品分类数据
    $c_name = isset($_POST['category_name']) ? $_POST['category_name'] : '';
    $c_parent_id = isset($_POST['parent_id']) ? $_POST['parent_id'] : 0;
    $c_sort = isset($_POST['sort_order']) ? $_POST['sort_order'] : 50;
    $c_id = isset($_POST['c_id']) ? $_POST['c_id'] : 0;
    //数据合法性验证
    if (empty($c_id)) {
        admin_redirect('category.php', '没有要更新的商品分类信息');
    }
    if (empty($c_name)) {
        admin_redirect("category.php?act=edit&id={$c_id}", '商品名不能为空');
开发者ID:billywl,项目名称:shop,代码行数:31,代码来源:category.php

示例6: Database

<?php

include 'includes/header.php';
$db = new Database();
$ca = new Category();
$st = new Story();
$categories = $db->select($ca->getAllCategories());
if (isset($_POST['submit'])) {
    //assign post variables
    $title = mysqli_real_escape_string($db->link, $_POST['title']);
    $body = mysqli_real_escape_string($db->link, $_POST['body']);
    $category = mysqli_real_escape_string($db->link, $_POST['category']);
    $author = mysqli_real_escape_string($db->link, $_POST['author']);
    // simple validation
    if ($title == '' || $body == '' || $category == '' || $author == '') {
        // set error
        $error = 'Please fill out all required fields.';
    } else {
        $insert_row = $db->insert($st->setStory($submitter, $category, $title, $author, $body));
    }
}
?>

<h2 class="page-header">Add Story</h2>
<form method="post" action="add_story.php">
  <div class="form-group">
    <label>Story Title</label>
    <input name="title" type="text" class="form-control" placeholder="Enter title">
  </div>
  <div class="form-group">
    <label>Story Body</label>
开发者ID:Owlnofeathers,项目名称:hansennorthforkranch.ajamesb.com,代码行数:31,代码来源:add_story.php

示例7: array_push

     }
     array_push($users_array, $avail_user);
 }
 // We need to set a form value for the current department so that
 // it can be pre-selected on the form
 $avail_departments = Department::getAllDepartments($pdo);
 $departments_array = array();
 foreach ($avail_departments as $avail_department) {
     if ($avail_department['id'] == $current_user_dept) {
         $avail_department['selected'] = 'selected';
     } else {
         $avail_department['selected'] = '';
     }
     array_push($departments_array, $avail_department);
 }
 $avail_categories = Category::getAllCategories($pdo);
 $cats_array = array();
 foreach ($avail_categories as $avail_category) {
     array_push($cats_array, $avail_category);
 }
 //////Populate department perm list/////////////////
 $dept_perms_array = array();
 foreach ($departments_array as $dept) {
     $avail_dept_perms['name'] = $dept['name'];
     $avail_dept_perms['id'] = $dept['id'];
     array_push($dept_perms_array, $avail_dept_perms);
 }
 $allDepartments = Department::getAllDepartments($pdo);
 $GLOBALS['smarty']->assign('allDepartments', $allDepartments);
 $GLOBALS['smarty']->assign('current_user_dept', $current_user_dept);
 $GLOBALS['smarty']->assign('t_name', $t_name);
开发者ID:PramodhKG,项目名称:dms,代码行数:31,代码来源:add.php

示例8: Goods

    }
    //删除操作
    $goods = new Goods();
    if ($goods->deleteGoodsById($g_id)) {
        //成功
        admin_redirect('goods.php?act=trash', '商品删除成功!', 2);
    } else {
        //失败
        admin_redirect('goods.php?act=trash', '商品删除失败!', 3);
    }
} elseif ($act == 'add') {
    //新增商品
    //获取所有的商品分类
    $category = new Category();
    //当前项目比较简单,获取全部之后,全部类别都可以使用。
    $categories = $category->getAllCategories();
    //添加模板
    include_once ADMIN_TEMP . '/goods_add.html';
} elseif ($act == 'insert') {
    //保存商品信息
    //接收数据
    $goodsinfo['g_name'] = isset($_POST['goods_name']) ? $_POST['goods_name'] : '';
    $goodsinfo['g_sn'] = isset($_POST['goods_sn']) ? $_POST['goods_sn'] : '';
    $goodsinfo['c_id'] = isset($_POST['category_id']) ? $_POST['category_id'] : 0;
    $goodsinfo['g_price'] = isset($_POST['shop_price']) ? $_POST['shop_price'] : 0;
    $goodsinfo['g_desc'] = isset($_POST['goods_desc']) ? $_POST['goods_desc'] : '';
    $goodsinfo['g_inv'] = isset($_POST['goods_number']) ? $_POST['goods_number'] : 0;
    $goodsinfo['g_is_pro'] = isset($_POST['is_promote']) ? $_POST['is_promote'] : 0;
    $goodsinfo['g_is_new'] = isset($_POST['is_new']) ? $_POST['is_new'] : 0;
    $goodsinfo['g_is_hot'] = isset($_POST['is_hot']) ? $_POST['is_hot'] : 0;
    $goodsinfo['g_is_sale'] = isset($_POST['is_on_sale']) ? $_POST['is_on_sale'] : 0;
开发者ID:lushizijizoude,项目名称:phpstarty,代码行数:31,代码来源:goods.php

示例9: MySQLi

require_once './lib/alert.class.php';
require_once './lib/user.class.php';
require_once './lib/category.class.php';
$db = new MySQLi($config['database']['host'], $config['database']['username'], $config['database']['password'], $config['database']['database']);
if ($db->connect_errno) {
    die('Ei tietokantayhteyttä.');
}
$alertClass = new Alert();
$userClass = new User($db);
if (!$userClass->isLoggedIn()) {
    $alertClass->addAlert('Sinun täytyy olla kirjautuneen sisään katsellaksesi kategorioita', 'error');
    $alertClass->redirect('/login.php');
}
$user = $userClass->getCurrentUser();
$categoryClass = new Category($db);
$categories = $categoryClass->getAllCategories($user['id']);
$active = 'categories';
require_once 'header.php';
?>

		<table class="table">
			<thead>
				<tr>
					<th>ID</th>
					<th>Nimi</th>
					<th>Kokonaissumma</th>
					<th></th>
				</tr>
			</thead>
			<tbody>
				<?php 
开发者ID:AntiPaste,项目名称:kuitinseuranta,代码行数:31,代码来源:list_categories.php

示例10: isset

             admin_redirect('category.php', '删除失败!' . $res, 3);
         }
     } else {
         admin_redirect('category.php', '不能删除商品分类!因为' . $res, 3);
     }
 } else {
     if ($act == 'edit') {
         $c_id = isset($_GET['id']) ? $_GET['id'] : 0;
         if ($c_id == 0) {
             admin_redirect('category.php', '没有要编辑的商品分类!', 3);
         }
         $category = new Category();
         if (!($cat = $category->getCategoryByParentId($c_id))) {
             admin_redirect('category.php', '编辑失败!', 3);
         }
         $categories = $category->getAllCategories($c_id);
         include_once ADMIN_TEMP . '/category_edit.html';
     } else {
         if ($act = 'update') {
             $c_name = isset($POST['category_name']) ? $_POST['category_name'] : '';
             $c_parent_id = isset($POST['c_parent_id']) ? $_POST['c_parent_id'] : 0;
             $c_sort = isset($POST['c_sort']) ? $_POST['c_sort'] : 50;
             $c_id = isset($POST['c_id']) ? $_POST['c_id'] : 0;
             if ($c_id == 0) {
                 //没有要更新的数据
                 admin_redirect('category.php', '没有要更新的商品分类信息!', 3);
             }
             if (empty($c_name)) {
                 //商品分类的名字不能为空
                 admin_redirect('category.php?act=edit&id=' . $c_id, '商品分类名字不能为空!', 3);
             }
开发者ID:lushizijizoude,项目名称:phpstarty,代码行数:31,代码来源:category.php

示例11: mysql_query

 $query = "SELECT table_name FROM {$GLOBALS['CONFIG']['db_prefix']}udf WHERE field_type = '4'";
 $result = mysql_query($query) or die("Error in query163: {$query}. " . mysql_error());
 $num_rows = mysql_num_rows($result);
 $t_name = array();
 $i = 0;
 while ($data = mysql_fetch_array($result)) {
     $explode_v = explode('_', $data['table_name']);
     $t_name = $explode_v[2];
     $i++;
 }
 // For the User dropdown
 $avail_users = $user_perms_obj->user_obj->getAllUsers();
 // We need to set a form value for the current department so that
 // it can be pre-selected on the form
 $avail_departments = Department::getAllDepartments();
 $avail_categories = Category::getAllCategories();
 $cats_array = array();
 foreach ($avail_categories as $avail_category) {
     array_push($cats_array, $avail_category);
 }
 //////Populate department perm list/////////////////
 $dept_perms_array = array();
 foreach ($avail_departments as $dept) {
     $avail_dept_perms['name'] = $dept['name'];
     $avail_dept_perms['id'] = $dept['id'];
     $avail_dept_perms['rights'] = $filedata->getDeptRights($dept['id']);
     array_push($dept_perms_array, $avail_dept_perms);
 }
 //////Populate users perm list/////////////////
 $user_perms_array = array();
 foreach ($avail_users as $user) {
开发者ID:tejdeeps,项目名称:tejcs.com,代码行数:31,代码来源:edit.php

示例12: getAllCategories

 function getAllCategories()
 {
     $result = $this->Category->getAllCategories();
     return $result;
 }
开发者ID:johnulist,项目名称:ecommerce,代码行数:5,代码来源:categories_controller.php

示例13: getAllCategoryPreferencesDT

function getAllCategoryPreferencesDT()
{
    global $bdd, $_TABLES;
    if (!is_null($bdd) && !is_null($_TABLES)) {
        $content = '<thead>';
        $content .= '<tr>';
        $content .= '<th>Id</th>';
        $content .= '<th>User</th>';
        $content .= '<th>Category</th>';
        $content .= '<th>Action</th>';
        $content .= '</tr>';
        $content .= '</thead>';
        $content .= '<tbody>';
        $objCategoryPreference = new CategoryPreference($bdd, $_TABLES);
        $category_preferences = $objCategoryPreference->getAllCategoryPreferences();
        if ($category_preferences) {
            foreach ($category_preferences as $key => $category_preference) {
                $content .= '<tr category_preference_id=' . $category_preference->id . '>';
                $content .= '<td>' . $category_preference->id . '</td>';
                $content .= '<td><select class="select_dt select_dt_user_id">';
                $objUser = new User($bdd, $_TABLES);
                $users_items = $objUser->getAllUsers();
                if ($users_items) {
                    foreach ($users_items as $key_u => $user_item) {
                        $temp_content = '';
                        $temp_content .= '<option value="' . $user_item->id . '" ';
                        if ($user_item->id == $category_preference->user_id) {
                            $temp_content .= 'selected>';
                        } else {
                            $temp_content .= '>';
                        }
                        $temp_content .= $user_item->name . '</option>';
                        $content .= $temp_content;
                    }
                }
                $content .= '</select></td>';
                $content .= '<td><select class="select_dt select_dt_category_id">';
                $objCategory = new Category($bdd, $_TABLES);
                $categories_items = $objCategory->getAllCategories();
                if ($categories_items) {
                    foreach ($categories_items as $key_u => $category_item) {
                        $temp_content = '';
                        $temp_content .= '<option value="' . $category_item->id . '" ';
                        if ($category_item->id == $category_preference->category_id) {
                            $temp_content .= 'selected>';
                        } else {
                            $temp_content .= '>';
                        }
                        $temp_content .= $category_item->category . '</option>';
                        $content .= $temp_content;
                    }
                }
                $content .= '</select></td>';
                $content .= "<td><input type='button' class='edit edit_category_preference_dt' value='Save' />\n\t\t\t\t    <input type='button' class='delete delete_category_preference_dt' value='Supprimer' /></td>";
                $content .= '</tr>';
            }
        }
        $content .= '</tbody>';
        return $content;
    } else {
        error_log("BDD ERROR : " . json_encode($bdd));
        error_log("TABLES ERROR : " . json_encode($_TABLES));
    }
}
开发者ID:xXNoceboXx,项目名称:WUS,代码行数:64,代码来源:category_preference.controller.php


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