本文整理汇总了PHP中AZLib::getNewsCats方法的典型用法代码示例。如果您正苦于以下问题:PHP AZLib::getNewsCats方法的具体用法?PHP AZLib::getNewsCats怎么用?PHP AZLib::getNewsCats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AZLib
的用法示例。
在下文中一共展示了AZLib::getNewsCats方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
Form::Form('NewsAdminEditForm');
$id = Url::get('id', 0);
if ($id) {
$this->news = DB::select("news", "id=" . $id, __LINE__ . __FILE__);
}
if (!$this->news) {
Url::redirect_current();
}
AZLib::getNewsCats();
}
示例2: draw
function draw()
{
global $display;
$cat_newss = array();
$news_cat_id = Url::get('news_catid', 'id', 0);
AZLib::getNewsCats();
$display->add('news_cat_id', $news_cat_id);
if (CGlobal::$allNewsCategories) {
foreach (CGlobal::$allNewsCategories as $news_cat) {
if ($news_cat['public']) {
$news_cat['url'] = URL::build('news_list', array('news_catid' => $news_cat['id'], 'azname' => AZLib::safe_title($news_cat['name'])));
$cat_newss[$news_cat['id']] = $news_cat;
}
}
}
$display->add('cat_newss', $cat_newss);
$display->add('is_admin', User::have_permit(ADMIN_NEWS));
$display->output("NewsMenu");
}
示例3: on_submit
function on_submit()
{
$name = Url::get('name');
$public = Url::get('public', 1);
$position = Url::get('position', 'int', 0);
$keywords = Url::get('keywords');
$description = Url::get('description');
if ($public != 1) {
$public = 0;
}
$this->checkFormInput("Tên danh mục tin", 'name', $name, 'str', true, '', 2, 100);
$this->checkFormInput("Vị trí", 'position', $position, 'int', true, '', 1, DB::count("news_categories") + 1);
if (!$this->errNum) {
$id = DB::insert('news_categories', array('name' => $name, 'keywords' => $keywords, 'description' => $description, 'position' => $position, 'public' => $public, 'user_modify' => User::user_name(), 'time_modify' => TIME_NOW, 'user_create' => User::user_name(), 'time_create' => TIME_NOW));
DB::query("UPDATE news_categories SET position=position+1 WHERE id!=" . $id . " AND position>=" . $position);
AZLib::getNewsCats(1);
Url::redirect_current();
}
}
示例4: draw
function draw()
{
global $display;
$home_newss = array();
$display->add('is_admin', User::have_permit(ADMIN_NEWS));
$display->add('url_home', WEB_DIR);
$display->add('time_now', News::displayTime());
$one_cart = '';
AZLib::getNewsCats();
if (CGlobal::$allNewsCategories) {
foreach (CGlobal::$allNewsCategories as $news_catid => $news_cat) {
if ($news_cat['public']) {
$newss = array();
$re = DB::query("SELECT * FROM news WHERE status=1 AND news_catid={$news_catid} ORDER BY id DESC LIMIT 0,4");
if ($re) {
$i = 1;
while ($news = mysql_fetch_assoc($re)) {
if ($i == 1) {
if ($news['image']) {
$news['image'] = AZLib::getImageThumb($news['image'], 150, 0, 0, $news['img_server']);
}
$i++;
}
$news['url'] = URL::build('news_detail', array('news_catid' => $news['news_catid'], 'news_id' => $news['id'], 'azname' => AZLib::safe_title($news['title'])));
$news['news_h'] = date('H:i', $news['time_created']);
$news['news_d'] = date('d-m-Y', $news['time_created']);
$newss[$news['id']] = $news;
}
}
if ($newss) {
$home_newss[$news_catid] = array('name' => $news_cat['name'], 'url' => URL::build('news_list', array('news_catid' => $news_catid, 'azname' => AZLib::safe_title($news_cat['name']))), 'newss' => $newss);
}
}
}
}
$display->add('home_newss', $home_newss);
$display->output("NewsHome");
}
示例5: __construct
function __construct()
{
Form::Form('NewsListForm');
$news_cat_id = Url::get('news_catid', 'id', 0);
AZLib::getNewsCats();
if ($news_cat_id && isset(CGlobal::$allNewsCategories[$news_cat_id]) && (CGlobal::$allNewsCategories[$news_cat_id]['public'] || User::have_permit(ADMIN_NEWS))) {
$this->news_cat = CGlobal::$allNewsCategories[$news_cat_id];
} else {
Url::redirect('news');
}
$news_title = '';
$catid = $news_cat_id;
$str_keywords = '';
$str_catSub = '';
$meta_keywords = '';
$meta_desc = '';
if (isset(CGlobal::$allNewsCategories[$catid])) {
$news_title .= CGlobal::$allNewsCategories[$catid]['name'];
$curMainCat = CGlobal::$allNewsCategories[$catid];
$str_catSub .= $curMainCat['name'];
if ($curMainCat['keywords']) {
$meta_keywords .= ($meta_keywords ? ', ' : '') . $curMainCat['keywords'];
}
if ($curMainCat['description']) {
$meta_desc .= ($meta_desc ? ', ' : '') . $curMainCat['description'];
}
}
if ($meta_desc != '') {
CGlobal::$meta_desc = $meta_desc;
}
if ($meta_keywords != '') {
CGlobal::$keywords = $meta_keywords;
} elseif ($str_catSub != '') {
CGlobal::$keywords = $str_catSub;
}
CGlobal::$website_title = stripslashes($news_title) . " - Tin tức";
}
示例6: __construct
function __construct()
{
Form::Form('DeleteNewsForm');
$id = Url::get('id', 0);
if ($id) {
$row = DB::select('news', "id={$id}");
if ($row) {
DB::delete('news_categories', "id=" . $row['id']);
DB::query("UPDATE news_categories SET position=position-1 WHERE id!=" . $row['id'] . " AND position>=" . $row['position']);
AZLib::getNewsCats(1);
}
}
Url::redirect_current();
}
示例7: draw
//.........这里部分代码省略.........
$yahoo_open_id_href = OID_URL . 'index.html?openid_identifier=http://me.yahoo.com/&long_redirect=' . base64_encode(CGlobal::$query_string);
$google_open_id_href = OID_URL . 'index.html?openid_identifier=https://www.google.com/users/o8/id&long_redirect=' . base64_encode(CGlobal::$query_string);
$display->add('show_openid', TRUE);
}
$display->add('OID_URL', $yahoo_open_id_href);
$display->add('OID_URL_GOG', $google_open_id_href);
$display->add('referer_login_url', $referer_login_url);
$display->add('google_open_id_href', $google_open_id_href);
$display->add('yahoo_open_id_href', $yahoo_open_id_href);
$display->add('openid_on', OPENID_ON);
$display->add('num_mess', $num_mess);
$display->add('is_login', (int) User::is_login());
$display->add('is_admin', (int) User::is_az_team());
$display->add('is_admin_item', (int) User::have_permit(ADMIN_ITEM));
$display->add('is_root', User::is_root());
//End Top menu
$display->add('category_id', CGlobal::$curCategory);
$display->add('keywords', AZLib::cleanHtml(Url::get('keywords', '')));
$display->add('not_error_page', (int) (AZNet::$page['name'] != 'error'));
$display->add('is_load_page_first', $_SESSION['is_load_page_first']);
// Tỷ giá
AZLib::get_config();
//$exchange = CGlobal::$configs['exchange']['conf_val'];
//$display->add('exchange', number_format($exchange, 0, ',', '.'));
// End Tỷ giá
if ($_SESSION['is_load_page_first'] == 1) {
$_SESSION['is_load_page_first'] = 0;
}
//End of top menu
$curMainCat = CGlobal::$curMainCat;
$curLevel2Cat = CGlobal::$curLevel2Cat;
//Cat menu
$sub_menu = FALSE;
$sub_menu = $curMainCat && isset(CGlobal::$allCategories[$curMainCat['id']]) && isset(CGlobal::$subCategories[$curMainCat['id']]);
$display->add('CURENT_TOP_CATID', (int) @$curMainCat['id']);
$display->add('CURENT_LEVEL2_CATID', (int) @$curLevel2Cat['id']);
$display->add('CURENT_CITY_ID', CGlobal::$curCity);
$display->add('cur_page', Url::get('page'));
$display->add('sub_menu', $sub_menu);
$display->add('block_id', Module::$block_id);
// System::debug($display->get_template_vars());
//End Cat menu
if (User::is_root()) {
$display->add("DEBUG", DEBUG);
$display->add("show_bug_url", AZRewrite::formatUrl(Url::build_all(array(), "ebug=" . (int) (!DEBUG))));
}
################################################################################################################
#Event config
$event_on = @CGlobal::$configs['event_on']['conf_val'];
$submit = Url::get('submit', '');
if (User::is_admin()) {
if ($submit == 'Cập nhật') {
$display->add('msg', $this->showFormErrorMessages(1));
}
$status_arr = array(0 => 'Tắt', 1 => 'Bật');
$display->add('status_option', AZLib::getOption($status_arr, $event_on));
}
$display->add('event', $event_on);
$display->add("data_path", DATA_PATH);
#Event config
################################################################################################################
################################################################################################################
#Search
$search_catid = (int) Url::get('search_catid');
$search_cat_arr = array(-1 => '--Tất cả danh mục--');
foreach (CGlobal::$subCategories as $top_id => $sub_cats) {
if (isset(CGlobal::$allCategories[$top_id]) && CGlobal::$allCategories[$top_id]['parent_id'] == 0) {
$topcat = CGlobal::$allCategories[$top_id];
if ($topcat['status'] != "HIDE") {
$search_cat_arr[$top_id] = $topcat['name'];
if ($sub_cats) {
foreach ($sub_cats as $sid => $subcat) {
if ($subcat['status'] != "HIDE") {
$search_cat_arr[$sid] = "-----" . $subcat['name'];
}
}
}
}
}
}
$display->add('search_cat_option', AZLib::getOption($search_cat_arr, $search_catid));
#Search
################################################################################################################
/* System::debug($topcats);*/
$cat_newss = array();
$news_cat_id = Url::get('news_catid', 'id', 0);
AZLib::getNewsCats();
$display->add('news_cat_id', $news_cat_id);
if (CGlobal::$allNewsCategories) {
foreach (CGlobal::$allNewsCategories as $news_cat) {
if ($news_cat['public']) {
$news_cat['url'] = URL::build('news_list', array('news_catid' => $news_cat['id'], 'azname' => AZLib::safe_title($news_cat['name'])));
$cat_newss[$news_cat['id']] = $news_cat;
}
}
}
$display->add('cat_newss', $cat_newss);
$display->output("Header");
// $display->output("header_old");
}
示例8: __construct
function __construct()
{
Form::Form('NewsAdminAddForm');
AZLib::getNewsCats();
}
示例9: draw
function draw()
{
global $display;
AZLib::getNewsCats();
$display->add('url_add', Url::build_current(array('cmd' => 'add')));
$display->add('msg', $this->showFormErrorMessages(1));
$news_catid = Url::get('news_catid', 0);
$status = Url::get('status', 3);
$date_begin = Url::get('date_begin');
$date_end = Url::get('date_end');
$keyword = Url::get('searchtext');
$hot = Url::get('hot', 1);
for ($i = 1; $i <= 3; $i++) {
$display->add('selected_' . $i, '');
}
$display->add('selected_' . Url::get('status', 3), 'selected');
for ($i = 1; $i <= 2; $i++) {
$display->add('tinnhanh_' . $i, '');
}
$display->add('tinnhanh_' . Url::get('tinnhanh', 2), 'selected');
$condition = ' 1 ';
if ($news_catid) {
$condition .= " AND news_catid ={$news_catid} ";
}
if ($keyword != '') {
$condition .= " AND ((title like '%{$keyword}%') OR (brief like '%{$keyword}%')) ";
}
$created_time_from = 0;
$created_time_to = 0;
if ($date_begin) {
$date_arr = explode("-", $date_begin);
if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
$created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]);
}
}
if ($date_end) {
$date_arr = explode("-", $date_end);
if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
$created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]);
}
}
if ($created_time_from) {
$condition .= ' AND time_created >=' . $created_time_from;
}
if ($date_end) {
$condition .= " AND time_created <={$created_time_to}";
}
if ($status != 3) {
$condition .= ' and status=' . $status;
}
if ($hot == 2) {
$condition .= ' and hot=' . $hot;
}
$cat_arr = array(0 => "--Danh mục tin--");
if (CGlobal::$allNewsCategories) {
foreach (CGlobal::$allNewsCategories as $news_cat) {
$cat_arr[$news_cat['id']] = "[{$news_cat['id']}] " . $news_cat['name'] . ($news_cat['public'] == 0 ? ' (Đã ẩn)' : '');
}
}
//$news_catid
$display->add('news_cat_option', AZLib::getOption($cat_arr, $news_catid));
$display->add('hot_option', AZLib::getOption(array('1' => "Tất cả", 2 => "Tin Hot"), $hot));
$display->add('status_option', AZLib::getOption(array(3 => "Tất cả", 1 => "Hiện", 2 => "Ẩn"), $status));
$display->add('keyword', $keyword);
$display->add('date_begin', $date_begin);
$display->add('date_end', $date_end);
$totalRows = DB::count("news", $condition);
$limit = '';
$pagging = AZPagging::pagingSE($limit, $totalRows, 20, 10, 'page_no', "tin");
//$pagging = AZPagging::paging_list($limit,20,'page_no');
$items = array();
$re = DB::query('SELECT * FROM news WHERE ' . $condition . " ORDER BY id DESC " . $limit, __LINE__ . __FILE__, false, false, false, true);
if ($re) {
while ($item = mysql_fetch_assoc($re)) {
$item['admin_link'] = News::admin_link($item);
if ($item['image']) {
$item['image'] = AZLib::getImageThumb($item['image'], 150, 0, 0, $item['img_server']);
}
$item['cat'] = "[{$item['news_catid']}] " . @CGlobal::$allNewsCategories[$item['news_catid']]['name'];
$item['time_created'] = date('d/m/Y', $item['time_created']);
$item['brief'] = stripslashes($item['brief']);
$item['title'] = stripslashes($item['title']);
$item['url'] = Url::build('news_detail', array('news_catid' => $item['news_catid'], 'news_id' => $item['id']));
$items[$item['id']] = $item;
}
}
$display->add('items', $items);
$display->add('pagging', $pagging);
$this->beginForm();
$display->output("NewsAdmin");
$this->endForm();
}