/**
  * 分类列表
  */
 public function getcategory()
 {
     import("ORG.Util.Category");
     $cat = new Category('Shopcategory', array('cid', 'pid', 'cname', 'fullname'));
     $temp = $cat->getList("", 0, "cid asc");
     //获取分类结构
     return $temp;
 }
Example #2
0
 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());
 }
Example #3
0
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";
}
 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();
 }
 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;
 }
Example #6
0
 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);
 }
Example #7
0
 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);
 }
Example #8
0
 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;
 }
 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();
         //获取分类结构
     }
 }
Example #10
0
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');
Example #11
0
						
						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`");
						
<?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>
Example #13
0
 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;
 }
Example #14
0
 /**
  * News category Function
  * @author linxinliang<*****@*****.**>
  */
 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();
     }
 }
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";
}
Example #16
0
</td>
                <td>My comments:</td>
                <td><?php 
echo $mycomments;
?>
</td>
            </tr>
            <tr>
                <td>Users:</td>
                <td><?php 
echo User::getList()->count();
?>
</td>
                <td>Categories:</td>
                <td><?php 
echo Category::getList()->count();
?>
</td>
            </tr>
        </table>
    </div>
    <!-- .windowcontent -->
</div>
<!-- .window -->

<div class="window">
    <div class="windowtitle">
        Online users
    </div>
    <!-- .windowtitle -->
 public function edit()
 {
     $id = trim($this->_get('id'));
     $cat = new Category('Article_cat', array('acid', 'afid', 'aname', 'cname'));
     $clist = $cat->getList();
     //获取分类结构
     $this->assign('clist', $clist);
     if (!$id) {
         $this->error('id不可以为空');
     }
     $Acat = M('Article_cat');
     $item = $Acat->find($id);
     $this->assign('item', $item);
     $this->display();
 }
Example #18
0
 /**
  * @codeCoverageIgnore
  */
 public function getCategory()
 {
     foreach (Category::getList() as $category) {
         if ($category->getID() == $this->category) {
             return $category;
         }
     }
     return null;
 }
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'] = "Error: Category not found.";
        }
        if ($_GET['error'] == "categoryContainsArticles") {
            $results['errorMessage'] = "Error: Category contains articles. Delete the articles, or assign them to another category, before deleting this category.";
        }
    }
    if (isset($_GET['status'])) {
        if ($_GET['status'] == "changesSaved") {
            $results['statusMessage'] = "Your changes have been saved.";
        }
        if ($_GET['status'] == "categoryDeleted") {
            $results['statusMessage'] = "Category deleted.";
        }
    }
    require TEMPLATE_PATH . "/admin/listCategories.php";
}
Example #20
0
		// 관리자
		if (!isAdmin()) { 		
			$s_admin = $skin->cutSkinTag('admin');
			$s_admin = $skin->parseTag('admin_url', $servicePath.'/admin', $s_admin);
			$s_member = $skin->dressTag('admin', $s_admin, $s_member);
		} else {
		}

		$skin->dress('member', $s_member);
	}

	// 카테고리 ( 분류 )

	$src_category = $skin->cutSkinTag('category');
	$categories = Category::getList();
	if(count($categories) > 0) {
		$sp_category = "<ul>\n";
			foreach($categories as $category) {
				$sp_category .= "<li><a href=\"{$servicePath}/category/".func::encode($category['name'])."\">{$category['name']}</a><span class=\"count count_class_{$category['count']}\">({$category['count']})</span>\n";
			}
		$sp_category .= "</ul>\n";

		$s_category = $skin->parseTag('category_list',$sp_category, $src_category);
	} else {
		$s_category = '';
	}
	$skin->dress('category', $s_category);


	// 그룹
Example #21
0
 // check if the requested issue is a part of one of the projects
 // associated with this user
 if (!@in_array($details['iss_prj_id'], $associated_projects)) {
     $tpl->assign("auth_customer", 'denied');
 } else {
     $options = Issue::saveSearchParams();
     $sides = Issue::getSides($issue_id, $options);
     // check if scheduled release should be displayed
     $releases = Release::getAssocList($prj_id);
     if (count($releases) > 0) {
         $show_releases = 1;
     } else {
         $show_releases = 0;
     }
     // get if categories should be displayed
     $cats = Category::getList($prj_id);
     if (count($cats) > 0) {
         $show_category = 1;
     } else {
         $show_category = 0;
     }
     $cookie = Auth::getCookieInfo(APP_PROJECT_COOKIE);
     if (!empty($auto_switched_from)) {
         $tpl->assign(array("project_auto_switched" => 1, "old_project" => Project::getName($auto_switched_from)));
     }
     $setup = Setup::load();
     $tpl->assign("allow_unassigned_issues", @$setup["allow_unassigned_issues"]);
     $tpl->assign(array('next_issue' => @$sides['next'], 'previous_issue' => @$sides['previous'], 'subscribers' => Notification::getSubscribers($issue_id), 'custom_fields' => Custom_Field::getListByIssue($prj_id, $issue_id), 'files' => Attachment::getList($issue_id), 'emails' => Support::getEmailsByIssue($issue_id), 'zones' => Date_API::getTimezoneList(), 'users' => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), 'ema_id' => Email_Account::getEmailAccount(), 'max_attachment_size' => Attachment::getMaxAttachmentSize(), 'show_releases' => $show_releases, 'show_category' => $show_category, 'categories' => Category::getAssocList($prj_id), 'quarantine' => Issue::getQuarantineInfo($issue_id)));
     if ($role_id != User::getRoleID('customer')) {
         if (@$_REQUEST['show_all_drafts'] == 1) {
             $show_all_drafts = true;
Example #22
0
<?php

/**
 * Created by PhpStorm.
 * User: Hoan
 * Date: 10/27/2015
 * Time: 11:36 PM
 * *Trang danh mục sản phẩm
 */
//Khởi động session
session_start();
//Kiểm tra nếu chưa đăng nhập thì quay về trang đăng nhập
if (!isset($_SESSION['user'])) {
    header('location:../user/login.php');
}
require '../../config/Config.php';
require '../../models/Category.php';
//Lấy danh mục sản phẩm
$categoryModel = new Category();
$categoryList = $categoryModel->getList();
// Require giao diện
require '../../views/category/v_list.php';
Example #23
0
 /**
  * Get RoleListOption Function
  * @author linxinliang<*****@*****.**>
  */
 private function getRoleListOption($info = array())
 {
     import("Category");
     $cat = new Category('role', array('id', 'pid', 'name', 'fullname'));
     $list = $cat->getList();
     //获取分类结构
     $info['roleOption'] = "";
     foreach ($list as $v) {
         $disabled = $v['id'] == 1 ? ' disabled="disabled"' : "";
         $selected = $v['id'] == $info['role_id'] ? ' selected="selected"' : "";
         $info['roleOption'] .= '<option value="' . $v['id'] . '"' . $selected . $disabled . '>' . $v['fullname'] . '</option>';
     }
     return $info;
 }
Example #24
0
        if ($us->getID() == $_GET['u']) {
            $user = $us;
            break;
        }
    }
    if ($user == null) {
        // User not found
        header("Location: error.php?id=5");
    }
} else {
    if (isset($_GET['m']) && !empty($_GET['m']) && is_numeric($_GET['m']) && isset($_GET['y']) && !empty($_GET['y']) && is_numeric($_GET['y'])) {
        $type = "date";
    } else {
        if (isset($_GET['c']) && !empty($_GET['c']) && is_numeric($_GET['c'])) {
            $type = "category";
            foreach (Category::getList() as $cat) {
                if ($cat->getID() == $_GET['c']) {
                    $category = $cat;
                    break;
                }
            }
            if ($cat == null) {
                // Category not found
                header("Location: error.php?id=6");
            }
        } else {
            // Invalid arguments
            header("Location: error.php?id=4");
            exit;
        }
    }
 public function edit()
 {
     $id = $this->_get('id');
     $Article = M('Article');
     $item = $Article->find($id);
     //dump($item);
     import("ORG.Util.Category");
     $cat = new Category('Article_cat', array('acid', 'afid', 'aname', 'cname'));
     $clist = $cat->getList();
     //获取分类结构
     $this->assign('clist', $clist);
     $this->assign('item', $item);
     $this->display();
 }
Example #26
0
include_once APP_INC_PATH . "class.auth.php";
include_once APP_INC_PATH . "class.user.php";
include_once APP_INC_PATH . "class.project.php";
include_once APP_INC_PATH . "class.category.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("manage/index.tpl.html");
Auth::checkAuthentication(APP_COOKIE);
$tpl->assign("type", "categories");
$role_id = Auth::getCurrentRole();
if ($role_id == User::getRoleID('administrator') || $role_id == User::getRoleID('manager')) {
    if ($role_id == User::getRoleID('administrator')) {
        $tpl->assign("show_setup_links", true);
    }
    @($prj_id = $HTTP_POST_VARS["prj_id"] ? $HTTP_POST_VARS["prj_id"] : $HTTP_GET_VARS["prj_id"]);
    $tpl->assign("project", Project::getDetails($prj_id));
    if (@$HTTP_POST_VARS["cat"] == "new") {
        $tpl->assign("result", Category::insert());
    } elseif (@$HTTP_POST_VARS["cat"] == "update") {
        $tpl->assign("result", Category::update());
    } elseif (@$HTTP_POST_VARS["cat"] == "delete") {
        Category::remove();
    }
    if (@$HTTP_GET_VARS["cat"] == "edit") {
        $tpl->assign("info", Category::getDetails($HTTP_GET_VARS["id"]));
    }
    $tpl->assign("list", Category::getList($prj_id));
} else {
    $tpl->assign("show_not_allowed_msg", true);
}
$tpl->displayTemplate();
Example #27
0
 * please see the COPYING and AUTHORS files
 * that were distributed with this source code.
 */
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/categories.tpl.html');
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_MANAGER) {
    Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
    $tpl->displayTemplate();
    exit;
}
@($prj_id = $_POST['prj_id'] ? $_POST['prj_id'] : $_GET['prj_id']);
$tpl->assign('project', Project::getDetails($prj_id));
if (@$_POST['cat'] == 'new') {
    $res = Category::insert();
    $tpl->assign('result', $res);
    Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the category was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the category.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this new category.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
    $res = Category::update();
    $tpl->assign('result', $res);
    Misc::mapMessages($res, array(1 => array('Thank you, the category was updated successfully.', Misc::MSG_INFO), -1 => array('An error occurred while trying to update the category.', Misc::MSG_ERROR), -2 => array('Please enter the title for this category.', Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'delete') {
    Category::remove();
}
if (@$_GET['cat'] == 'edit') {
    $tpl->assign('info', Category::getDetails($_GET['id']));
}
$tpl->assign('list', Category::getList($prj_id));
$tpl->displayTemplate();
Example #28
0
function getCategoryFocus($input, $config) {
	global $database, $db, $skin, $event, $service, $accessInfo;

	// 첫페이지에만 보이기 ..
	if(!(empty($accessInfo['controller']) && ($accessInfo['page']==1))) {
		return $input;
	}

	$pluginURL = $event->pluginURL;
	requireComponent('LZ.PHP.Media');

	switch($config['categoryType']) {
		case 'random':
			$categories = Category::getRandomList($config['categoryCount']);
		break;
		case 'custom':
			$categoryNames = explode(',', $config['customCategory']);
			$categories = array();
			foreach($categoryNames as $categoryName) {
				$item = Category::getByName($categoryName);
				if($item) {
					array_push($categories, $item);
				}
			}
		break;
		case 'recent':
		default:
			$categories = Category::getList($config['categoryCount']);
		break;
	}

	$categoryCount = count($categories);

	// css
	ob_start();
?>
<style type="text/css"> 
	table.categoryFocus { width:100%; border:1px solid #dbdbdb; }
		table.categoryFocus td { width:50%; vertical-align:top;  }
			table.categoryFocus td.left { border-right:1px solid #dedede; border-bottom:1px solid #dedede;}
			table.categoryFocus td.right { border-bottom:1px solid #dedede; }

		table.categoryFocus tr.lastChild td { border-bottom:0; }

		table.categoryFocus .title { padding:10px; padding-top:8px; padding-bottom:5px; }
			table.categoryFocus .title h3 { float:left; font-size:12px; font-weight:bold; margin:0; padding:0; color:#444; }
				table.categoryFocus .title h3 a { color:#444; text-decoration:none; }
				table.categoryFocus .title h3 a:hover { text-decoration:underline; }

			table.categoryFocus .title .more { float:right; }

		table.categoryFocus ul { list-style:none; margin:0; padding:10px; background:url(<?php echo $pluginURL;?>/images/bg_title.gif) repeat-x;  }

			table.categoryFocus ul li.detail { }
				table.categoryFocus ul li.detail .thumbnail { float:left; width:60px; margin-right:10px; }
					table.categoryFocus ul li.detail .thumbnail img { width:50px; border:1px solid #ddd; padding:2px; }		

				table.categoryFocus ul li.detail .data { float:left; width:292px; }
					table.categoryFocus ul li.detail .data h3 { font-size:13px; color:#595959; font-weight:bold; margin:0; margin-bottom:4px; }
						table.categoryFocus ul li.detail .data h3 a { color:#595959; text-decoration:none; }
						table.categoryFocus ul li.detail .data h3 a:hover { text-decoration:underline; }

					table.categoryFocus ul li.detail .data .desc { color:#aaa; line-height:16px; font-size:11px; }

				table.categoryFocus ul li.detail .data_full { width:362px; }

			table.categoryFocus ul li.list { margin-top:6px; }
				table.categoryFocus ul li.list a { color:#888; text-decoration:none; font-size:11px; }
				table.categoryFocus ul li.list a:hover { text-decoration:underline;}


	.categoryFocus_shadow { height:0px; font-size:0; border-top:1px solid #f5f5f5; margin-bottom:15px; }

</style>
<?php
	$css = ob_get_contents();
	ob_end_clean();
	
	$skin->css($css);

	// content

	ob_start();
?>
	<table class="categoryFocus" cellspacing="0" cellpadding="0">
<?php
		$end = round($categoryCount / 2);
		for($i=0;$i<$end;$i++) {
			$index = $i * 2;
?>
		<tr<?php echo $i==$end-1?' class="lastChild"':'';?>>
			<td class="left">
				<?php echo printCategoryFocusView($categories, $index, $config);?>
			</td>
			<td class="right">
				<?php echo printCategoryFocusView($categories, $index+1, $config);?>
			</td>
		</tr>
<?php
		}
?>
	</table>
	<div class="categoryFocus_shadow"></div>
<?php
	$result = ob_get_contents();
	ob_end_clean();

	return $input . $result;
}