本文整理汇总了PHP中Category::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::getList方法的具体用法?PHP Category::getList怎么用?PHP Category::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Category
的用法示例。
在下文中一共展示了Category::getList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getcategory
/**
* 分类列表
*/
public function getcategory()
{
import("ORG.Util.Category");
$cat = new Category('Shopcategory', array('cid', 'pid', 'cname', 'fullname'));
$temp = $cat->getList("", 0, "cid asc");
//获取分类结构
return $temp;
}
示例2: getHref
public function getHref()
{
$href = !empty(\App::$primary->config['defaultModule']) && \App::$primary->config['defaultModule'] == 'Materials' ? '' : '/materials';
$treePath = array_filter(explode('/', $this->tree_path));
if ($treePath) {
$categorys = Category::getList(['where' => ['id', implode(',', $treePath), 'IN']]);
foreach ($categorys as $category) {
$href .= "/{$category->alias}";
}
}
return $href . "/" . ($this->alias ? $this->alias : $this->pk());
}
示例3: homepage
function homepage()
{
$results = array();
$data = Article::getList(HOMEPAGE_NUM_ARTICLES);
$results['articles'] = $data['results'];
$results['totalRows'] = $data['totalRows'];
$data = Category::getList();
$results['categories'] = array();
foreach ($data['results'] as $category) {
$results['categories'][$category->id] = $category;
}
$results['pageTitle'] = "SystemBolaget";
require TEMPLATE_PATH . "/homepage.php";
}
示例4: browse
function browse($p, $pagesize, $pos)
{
$c = new Category($this->db_conn);
$rows = $c->getList($p);
$total = mysql_num_rows($rows);
$limit_str = $this->limit($total, $pagesize, $pos);
$lists = $c->getListArray($p, $limit_str);
$query_str = "";
$this->assign('p', $p);
$this->assign('data', $c);
$this->assign('lists', $lists);
$this->assign('content_page', $this->template . $this->list_tpl);
$this->pager($lists, $query_str);
$this->output();
}
示例5: nodeList
public function nodeList()
{
import("Category");
$cat = new Category('Node', array('id', 'pid', 'title', 'fullname'));
$temp = $cat->getList();
//获取分类结构
$level = array("1" => "项目(GROUP_NAME)", "2" => "模块(MODEL_NAME)", "3" => "操作(ACTION_NAME)");
foreach ($temp as $k => $v) {
$temp[$k]['statusTxt'] = $v['status'] == 1 ? "启用" : "禁用";
$temp[$k]['chStatusTxt'] = $v['status'] == 0 ? "启用" : "禁用";
$temp[$k]['level'] = $level[$v['level']];
$list[$v['id']] = $temp[$k];
}
unset($temp);
return $list;
}
示例6: editForm
function editForm($id = null)
{
if (!is_login()) {
msg_page('After login you can use.', _BASE_URL_ . "/users/loginForm");
exit;
}
$this->set('title', 'Edit Post - GJboard App');
$post = $this->Post->getPost("*", array("id" => $id));
$category = new Category();
$categories = $category->getList(array('register_date' => 'asc'), "1000");
if ($_SESSION['LOGIN_ID'] != $post['user_id']) {
msg_page('You do not have permission to access.', _BASE_URL_ . "/posts/view/" . $id);
exit;
}
$this->set('categories', $categories);
$this->set('post', $post);
}
示例7: array
function view_all($filter = null, $category_id = null, $thispage = 1)
{
$where = null;
if (is_null($thispage)) {
$thispage = 1;
}
$limit = array(($thispage - 1) * 10, 10);
$category = new Category();
$categories = $category->getList(array('register_date' => 'asc'), "1000");
if (!is_null($filter)) {
$where = array("category_id" => $category_id);
}
$posts = $this->Post->getList(array('publish_date' => 'desc'), $limit, $where);
$this->set('title', 'All Posts - GJboard Manager App');
$this->set('categories', $categories);
$this->set('filter_category_id', $category_id);
$this->set('posts', $posts);
}
示例8: getSitemap
public function getSitemap()
{
$urls = [];
$urlPrefix = 'http://' . \Difra\Envi::getHost();
$categories = Category::getList(true);
if (!empty($categories)) {
foreach ($categories as $category) {
$urls[] = ['loc' => $urlPrefix . $category->getFullLink()];
}
}
$items = Item::getList(null, -1, 1, null, true);
if (!empty($items)) {
foreach ($items as $item) {
$urls[] = ['loc' => $urlPrefix . $item->getFullLink()];
}
}
if (empty($urls)) {
return false;
}
return $urls;
}
示例9: category
public function category()
{
if (IS_POST) {
$act = $_POST[act];
$data = $_POST['data'];
$data['name'] = addslashes($data['name']);
$M = M("Category");
if ($act == "add") {
//添加分类
unset($data[cid]);
if ($M->where($data)->count() == 0) {
return $M->add($data) ? array('status' => 1, 'info' => '分类 ' . $data['name'] . ' 已经成功添加到系统中', 'url' => U('News/category', array('time' => time()))) : array('status' => 0, 'info' => '分类 ' . $data['name'] . ' 添加失败');
} else {
return array('status' => 0, 'info' => '系统中已经存在分类' . $data['name']);
}
} else {
if ($act == "edit") {
//修改分类
if (empty($data['name'])) {
unset($data['name']);
}
if ($data['pid'] == $data['cid']) {
unset($data['pid']);
}
return $M->save($data) ? array('status' => 1, 'info' => '分类 ' . $data['name'] . ' 已经成功更新', 'url' => U('News/category', array('time' => time()))) : array('status' => 0, 'info' => '分类 ' . $data['name'] . ' 更新失败');
} else {
if ($act == "del") {
//删除分类
unset($data['pid'], $data['name']);
return $M->where($data)->delete() ? array('status' => 1, 'info' => '分类 ' . $data['name'] . ' 已经成功删除', 'url' => U('News/category', array('time' => time()))) : array('status' => 0, 'info' => '分类 ' . $data['name'] . ' 删除失败');
}
}
}
} else {
import("Category");
$cat = new Category('Category', array('cid', 'pid', 'name', 'fullname'));
return $cat->getList();
//获取分类结构
}
}
示例10: array
echo $form->dropDownList($model, 'author_id', Author::getList('Author'));
?>
<?php
echo $form->error($model, 'author_id');
?>
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'category_id');
?>
<?php
//echo $form->textField($model, 'category_id');
?>
<?php
echo $form->dropDownList($model, 'category_id', Category::getList('Category'));
?>
<?php
echo $form->error($model, 'category_id');
?>
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'name');
?>
<?php
echo $form->textField($model, 'name', array('size' => 60, 'maxlength' => 255));
?>
<?php
echo $form->error($model, 'name');
示例11: array
array_push($checkups, array('success', _t('분류연관 테이블을 추가했습니다.')));
}
if ($db->exists("DESC {$prefix}FeedItems `category`")) { // ncloud 0.1.8
$result = $db->queryAll("SELECT * FROM {$prefix}FeedItems WHERE `category` != 0", MYSQL_ASSOC);
foreach($result as $item) {
$db->execute("INSERT INTO {$prefix}CategoryRelations (`item`,`category`,`linked`,`custom`) VALUES ({$item['id']},{$item['category']},UNIX_TIMESTAMP(),'y')");
}
$db->execute("ALTER TABLE {$prefix}FeedItems DROP `category`");
requireComponent('Bloglounge.Data.Category');
$result = Category::getList();
foreach($result as $item) {
Category::rebuildCount($item);
}
array_push($checkups, array('success', _t('피드아이템 테이블에 카데고리필드를 삭제했습니다.')));
}
if(!$db->exists("SHOW INDEX FROM {$prefix}CategoryRelations WHERE `Key_name` = 'item'")) {
$db->execute("ALTER TABLE {$prefix}CategoryRelations ADD INDEX ( `item` )");
array_push($checkups, array('success', _t('분류연관 테이블에 아이템 필드를 인덱스로 추가했습니다.')));
}
if (!$db->exists("DESC {$prefix}FeedItems `feedVisibility`")) { // 0.2.1
$db->execute("ALTER TABLE {$prefix}FeedItems ADD `feedVisibility` enum('y','n','d') NOT NULL default 'y' AFTER `visibility`");
示例12: Category
<?php
$category = new Category();
$list = $category->getList()[0];
?>
<table class="table-hovered tableSearch">
<thead>
<tr>
<th>Nombre</th>
<th width="30px"></th>
<th width="30px"></th>
</tr>
</thead>
<tbody>
<?php
foreach ($list as $key => $value) {
if (!empty($value)) {
?>
<tr>
<td><?php
echo $value['name'];
?>
</td>
<td>
<form action="{SELECT}" method="GET">
<input type="hidden" name="id" value="<?php
echo $value['id'];
?>
">
<button><i class="fa fa-pencil"></i></button>
示例13: getPid
private function getPid($info)
{
$arr = array("请选择", "项目", "模块", "操作");
for ($i = 1; $i < 4; $i++) {
$selected = $info['level'] == $i ? " selected='selected'" : "";
$info['levelOption'] .= '<option value="' . $i . '" ' . $selected . '>' . $arr[$i] . '</option>';
}
$level = $info['level'] - 1;
import("ORG.Util.Category");
$cat = new Category('Node', array('id', 'pid', 'title', 'fullname'));
$list = $cat->getList();
//获取分类结构
$option = $level == 0 ? '<option value="0" level="-1">根节点</option>' : '<option value="0" disabled="disabled">根节点</option>';
foreach ($list as $k => $v) {
$disabled = $v['level'] == $level ? "" : ' disabled="disabled"';
$selected = $v['id'] != $info['pid'] ? "" : ' selected="selected"';
$option .= '<option value="' . $v['id'] . '"' . $disabled . $selected . ' level="' . $v['level'] . '">' . $v['fullname'] . '</option>';
}
$info['pidOption'] = $option;
return $info;
}
示例14: category
/**
* News category Function
* @author linxinliang<109760455@qq.com>
*/
public function category()
{
if (IS_POST) {
$act = $_POST['act'];
$data = $_POST['data'];
$data['name'] = addslashes(trim($data['name']));
$data['order'] = intval($data['order']);
$M = M("news_category");
/** ADD **/
if ($act == "add") {
if (empty($data['name'])) {
return array('status' => 0, 'info' => '分类名字不能为空');
}
unset($data['id']);
$_WHERE_D['name'] = $data['name'];
if ($M->where($_WHERE_D)->count() == 0) {
$data['is_deleted'] = '1';
$data['create_time'] = time();
$_RS = $M->add($data);
/** LOG **/
if ($_RS) {
D('Oplog')->addLog('添加资讯分类 ID:' . $_RS);
}
return $_RS ? array('status' => 1, 'info' => '分类 ' . $data['name'] . ' 已经成功添加到系统中', 'url' => U('News/category', array('time' => time()))) : array('status' => 0, 'info' => '分类 ' . $data['name'] . ' 添加失败');
} else {
return array('status' => 0, 'info' => '系统中已经存在分类:' . $data['name']);
}
/** EDIT **/
} else {
if ($act == "edit") {
if (empty($data['name'])) {
unset($data['name']);
return array('status' => 0, 'info' => '分类名字不能为空');
}
if ($data['parent_id'] == $data['id']) {
unset($data['parent_id']);
}
$data['update_time'] = time();
$_RS = $M->save($data);
/** LOG **/
if ($_RS) {
D('Oplog')->addLog('修改资讯分类 ID:' . $data['id']);
}
return $_RS ? array('status' => 1, 'info' => '分类 ' . $data['name'] . ' 已经成功更新', 'url' => U('News/category', array('time' => time()))) : array('status' => 0, 'info' => '分类 ' . $data['name'] . ' 更新失败');
/** DEL **/
} else {
if ($act == "del") {
unset($data['parent_id'], $data['name']);
/** LOG **/
$_RS = $M->where($data)->delete();
if ($_RS) {
D('Oplog')->addLog('删除资讯分类 ID:' . $data['id']);
}
return $_RS ? array('status' => 1, 'info' => '分类 ' . $data['name'] . ' 已经成功删除', 'url' => U('News/category', array('time' => time()))) : array('status' => 0, 'info' => '分类 ' . $data['name'] . ' 删除失败');
}
}
}
} else {
import("Category");
$cat = new Category('news_category', array('id', 'parent_id', 'name', 'fullname'));
return $cat->getList();
}
}
示例15: listCategories
function listCategories()
{
$results = array();
$data = Category::getList();
$results['categories'] = $data['results'];
$results['totalRows'] = $data['totalRows'];
$results['pageTitle'] = "Article Categories";
if (isset($_GET['error'])) {
if ($_GET['error'] == "categoryNotFound") {
$results['errorMessage'] = "<div class='alert alert-danger'> <strong>Error!</strong> Category not found.</div>";
}
if ($_GET['error'] == "categoryContainsArticles") {
$results['errorMessage'] = "<div class='alert alert-danger'> <strong>Error!</strong> Category contains articles. Delete the articles, or assign them to another category, before deleting this category.</div>";
}
}
if (isset($_GET['status'])) {
if ($_GET['status'] == "changesSaved") {
$results['statusMessage'] = "<div class='alert alert-success'> <strong>Success!</strong> Your changes have been saved.</div>";
}
if ($_GET['status'] == "categoryDeleted") {
$results['statusMessage'] = "<div class='alert alert-info'> <strong>Info!</strong> Category deleted.</div>";
}
}
require TEMPLATE_PATH . "/admin/listCategories.php";
}