本文整理汇总了PHP中AZLib::getOptionNum方法的典型用法代码示例。如果您正苦于以下问题:PHP AZLib::getOptionNum方法的具体用法?PHP AZLib::getOptionNum怎么用?PHP AZLib::getOptionNum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AZLib
的用法示例。
在下文中一共展示了AZLib::getOptionNum方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: draw
function draw()
{
global $display;
$this->beginForm();
$display->add('name', Url::get('name', ''));
$max_pos = DB::count("news_categories") + 1;
$display->add('position_option', AZLib::getOptionNum(1, $max_pos, Url::get('position', $max_pos)));
$display->add('public', (int) Url::get('public', 1));
$display->add('keywords', Url::get('keywords', ''));
$display->add('description', Url::get('description', ''));
$display->add('msg', $this->showFormErrorMessages(1));
$display->output("NewsAdminCatsAdd");
$this->endForm();
}
示例2: draw
function draw()
{
global $display;
$this->beginForm();
$display->add('url_add', Url::build_current(array('cmd' => 'add')));
$current_path = "<a href='" . URL::build('news_list', array('news_catid' => $this->row['id'], 'azname' => AZLib::safe_title($this->row['name']))) . "'>" . $this->row['name'] . "</a>";
$display->add('current_cat', $current_path);
$display->add('name', Url::get('name', $this->row['name']));
$display->add('position_option', AZLib::getOptionNum(1, DB::count("news_categories"), Url::get('position', $this->row['position'])));
$display->add('public', Url::get('public', $this->row['public'] ? 1 : 2));
$display->add('keywords', Url::get('keywords', $this->row['keywords']));
$display->add('description', Url::get('description', $this->row['description']));
$display->add('msg', $this->showFormErrorMessages(1));
$display->output("NewsAdminCatsEdit");
$this->endForm();
}
示例3: draw
function draw()
{
global $display;
$this->beginForm(true);
$display->add('mode', "Thêm");
$display->add('msg', $this->showFormErrorMessages(1));
$status_arr = array(1 => "OK", 2 => "Disable");
$display->add('status_option', AZLib::getOption($status_arr, Url::get('status', $this->a_row['status'])));
$display->add('h_start_option', AZLib::getOptionNum(0, 23, Url::get('h_start', date('h', $this->a_row['time_start']))));
$display->add('min_start_option', AZLib::getOptionNum(0, 59, Url::get('min_start', date('i', $this->a_row['time_start']))));
$display->add('date_start', Url::get('date_start', date('d-m-Y', $this->a_row['time_start'])));
$display->add('h_end_option', AZLib::getOptionNum(0, 23, Url::get('h_end', date('h', $this->a_row['time_end']))));
$display->add('min_end_option', AZLib::getOptionNum(0, 59, Url::get('min_end', date('i', $this->a_row['time_end']))));
$display->add('date_end', Url::get('date_end', date('d-m-Y', $this->a_row['time_end'])));
$display->add('title', Url::get('title', $this->a_row['title']));
$display->add('note', Url::get('note', $this->a_row['note']));
$display->output('e_product_add');
$this->endForm();
}
示例4: draw
function draw()
{
global $display;
$this->beginForm();
$filter_groups = array();
$max_pos_gfilter = 1;
if (CGlobal::$all_gfilters) {
foreach (CGlobal::$all_gfilters as $filter_group) {
if ($max_pos_gfilter <= $filter_group['pos']) {
$max_pos_gfilter = $filter_group['pos'] + 1;
}
$filter_group['link'] = Url::build_current(array('cmd' => 'filter', 'fgroup_id' => $filter_group['id']));
$filter_group['del'] = Url::build_current(array('cmd', 'fgroup_del' => $filter_group['id']));
$filter_groups[$filter_group['id']] = $filter_group;
}
}
$display->add('filter_groups', $filter_groups);
$display->add('option_gfilter_pos', AZLib::getOptionNum(1, $max_pos_gfilter, $max_pos_gfilter));
$display->output('FilterList');
$this->endForm();
}
示例5: draw
function draw()
{
global $display;
$this->beginForm(true);
$filters = array();
$max_pos_filter = 1;
$max_pos_filter = 1 + DB::fetch("SELECT MAX(pos) AS max_pos FROM filter WHERE fgid=" . $this->filter_group['id'], "max_pos", 0);
$re = DB::query("SELECT * FROM filter WHERE fgid=" . $this->filter_group['id'] . " ORDER BY pos");
if ($re) {
while ($filter = mysql_fetch_assoc($re)) {
$filter['del'] = Url::build_current(array('cmd', 'fgroup_id', 'f_del' => $filter['id']));
$filters[$filter['id']] = $filter;
}
}
$display->add('filters', $filters);
$display->add('group_filter_id', $this->filter_group['id']);
$display->add('group_filter_name', $this->filter_group['name']);
$cat_arr = array();
if ($this->filter_group['catids']) {
$catid_arr = explode(',', $this->filter_group['catids']);
foreach ($catid_arr as $catid) {
$cat = array('id' => $catid, 'name' => CGlobal::$allCategories[$catid]['name']);
if (isset(CGlobal::$allCategories[$catid])) {
$cat['name'] = CGlobal::$allCategories[$catid]['name'];
} else {
$cat['name'] = "<font color=red>(Đã xóa)</font>";
}
$cat_arr[$catid] = $cat;
}
}
//$display->add('group_catids', $this->filter_group['catids']);
$display->add('cat_arr', $cat_arr);
$display->add('group_pos', $this->filter_group['pos']);
$display->add('option_filter_pos', AZLib::getOptionNum(1, $max_pos_filter, $max_pos_filter));
$display->output('Filter');
$this->endForm();
}
示例6: draw
function draw()
{
global $display;
$this->beginForm(true);
$cmd = Url::get('cmd');
$display->add('cmd', $cmd);
$re = DB::query("SELECT id,name,parent_id ,position FROM category ORDER BY parent_id,position");
$all_cats = array();
$all_subcats = array();
$all_top_cat = array(0 => '-Chọn danh mục cha-');
$level1_cats = array();
$level2_cats = array();
if ($re) {
while ($cat = mysql_fetch_assoc($re)) {
$cat['name'] = "[{$cat['id']}] {$cat['name']}";
if ($cat['parent_id']) {
if (!isset($all_cats[$cat['parent_id']])) {
$level1_cats[$cat['parent_id']] = array('id' => $cat['parent_id'], 'name' => "[{$cat['parent_id']}] Đã xóa (ko tồn tại)", "max" => $cat['position']);
}
$all_subcats[$cat['parent_id']][$cat['id']] = $cat;
$cat['max'] = 0;
if ($cat['position'] > $level1_cats[$cat['parent_id']]['max']) {
$level1_cats[$cat['parent_id']]['max'] = $cat['position'];
}
$level2_cats[$cat['id']] = $cat;
} else {
$cat['max'] = 0;
$level1_cats[$cat['id']] = $cat;
if (!isset($all_subcats[$cat['id']])) {
$all_subcats[$cat['id']] = array();
}
}
$all_cats[$cat['id']] = $cat;
}
}
$display->add('level1_cats', json_encode($level1_cats));
$display->add('level2_cats', json_encode($level2_cats));
foreach ($all_subcats as $topid => $subcats) {
if (isset($level1_cats[$topid]) && $level1_cats[$topid]['max']) {
if (!isset($all_cats[$topid])) {
$all_cats[$topid] = array('id' => $topid, 'name' => "[{$topid}] Đã xóa (ko tồn tại)");
}
$all_cats[$topid]['name'] .= " ({$level1_cats[$topid]['max']})";
}
$all_top_cat[$topid] = $all_cats[$topid]['name'];
foreach ($subcats as $subcat) {
if (isset($level2_cats[$subcat['id']]) && $level2_cats[$subcat['id']]['max']) {
$subcat['name'] .= " ({$level2_cats[$subcat['id']]['max']})";
}
$all_top_cat[$subcat['id']] = "-----" . $subcat['name'];
}
}
if (!isset($this->cat['id'])) {
$this->cat['id'] = 0;
}
$display->add('cat_image', AZLib::getImageThumb('category/' . $this->cat['id'] . '.gif', 200, 200, 0, $this->cat['img_server']));
$display->add('msg', $this->showFormErrorMessages(true));
$display->add('name', Url::get('name', $this->cat['name']));
$display->add('brief_name', Url::get('brief_name', $this->cat['brief_name']));
$display->add('keywords', Url::get('keywords', $this->cat['keywords']));
$display->add('description', Url::get('description', $this->cat['description']));
$display->add('option_parent_id', AZLib::getOption($all_top_cat, Url::get('parent_id', $this->cat['parent_id'])));
$display->add('option_status', AZLib::getOption(array('HIDE' => 'Ẩn', 'SHOW' => 'SHOW', 'HOME' => 'HOME'), Url::get('status', $this->cat['status'])));
$max_pos = 1 + DB::fetch("SELECT MAX(position) AS max_pos FROM category WHERE parent_id=0", "max_pos", 0);
$display->add('max_pos', $max_pos);
if (Url::get('cmd') == 'add' || Url::get('cmd') == 'edit' && $this->cat['parent_id'] == 0) {
//Sửa danh mục
$zones = array();
if (Url::get('cmd') == 'edit' && $this->cat['parent_id'] == 0) {
//Sửa danh mục
$zones = $this->zones;
}
$re = DB::query("SELECT id,name, status FROM category_zone ORDER BY position");
$all_zone = array();
if ($re) {
while ($zone = mysql_fetch_assoc($re)) {
if ($zone['status'] == 0) {
$zone['name'] .= ' (Ẩn)';
}
$all_zone[$zone['id']] = $zone['name'];
}
}
$display->add('option_zones', AZLib::getOptionMulti($all_zone, array_keys($zones)));
}
if (Url::get('cmd') == 'edit') {
//Sửa danh mục
$display->add('option_position', AZLib::getOptionNum(1, $max_pos, Url::get('position', $this->cat['position'])));
$display->add('cur_position', $this->cat['position']);
} else {
$display->add('option_position', AZLib::getOptionNum(1, $max_pos, Url::get('position', $max_pos)));
$display->add('cur_position', 0);
}
$filter_groups = array();
$other_filter_groups = CGlobal::$all_gfilters;
$max_pos_gfilter = 1;
if ($this->cat['id']) {
/*$max_pos_gfilter = 1 + DB::fetch("SELECT MAX(pos) AS max_pos FROM filter_group WHERE catid=".$this->cat['id']."","max_pos",0);
$re = DB::query("SELECT * FROM filter_group WHERE catid=".$this->cat['id']." ORDER BY pos");
//.........这里部分代码省略.........
示例7: draw
function draw()
{
global $display;
$this->beginForm(false, "POST", false, Url::build_current());
$display->add('msg', $this->showFormErrorMessages(1));
$display->add('url_admin', Url::build_current());
$key_word = Url::get('key_word');
$display->add('key_word', $key_word);
$display->add('option_date1', AZLib::getOptionNum(1, 31, (int) Url::get('cmb_date1', 1)));
$display->add('option_month1', AZLib::getOptionNum(1, 12, (int) Url::get('cmb_month1', 1)));
$display->add('option_year1', AZLib::getOptionNum(2011, date("Y"), (int) Url::get('cmb_year1', 2011)));
$display->add('option_date2', AZLib::getOptionNum(1, 31, (int) Url::get('cmb_date2', date('d'))));
$display->add('option_month2', AZLib::getOptionNum(1, 12, (int) Url::get('cmb_month2', date('m'))));
$display->add('option_year2', AZLib::getOptionNum(2011, date("Y"), (int) Url::get('cmb_year2', date('Y'))));
$display->add('url_add', Url::build_current(array('cmd' => 'add')));
if (Url::get('cmb_date1') != '' && Url::get('cmb_month1') != '' && Url::get('cmb_year1') != '') {
$from_date = mktime(0, 0, 0, Url::get('cmb_month1'), Url::get('cmb_date1'), Url::get('cmb_year1'));
} else {
$from_date = 0;
}
if (Url::get('cmb_date2') != '' && Url::get('cmb_month2') != '' && Url::get('cmb_year2') != '') {
$to_date = mktime(23, 59, 59, Url::get('cmb_month2'), Url::get('cmb_date2'), Url::get('cmb_year2'));
} else {
$to_date = 0;
}
$condition = '';
$status = Url::get('status', 0);
$user_c = Url::get('user_c');
$user_m = Url::get('user_m');
if ($status == 1) {
$condition .= ($condition != '' ? ' AND ' : ' ') . ' status=1';
} elseif ($status == 2) {
$condition .= ($condition != '' ? ' AND ' : ' ') . ' status=0';
}
if ($user_c != '') {
$condition .= ($condition != '' ? ' AND ' : ' ') . ' user_c LIKE "%' . $user_c . '%"';
}
if ($user_m != '') {
$condition .= ($condition != '' ? ' AND ' : ' ') . ' user_m LIKE "%' . $user_m . '%"';
}
if ($from_date && $to_date) {
$condition .= ($condition != '' ? ' AND ' : ' ') . ' time_c >=' . $from_date . ' AND time_c <= ' . $to_date;
}
$display->add('user_c', $user_c);
$display->add('user_m', $user_m);
$display->add('status_option', AZLib::getOption(array(0 => "Tất cả", 1 => "Hiện", 2 => "Ẩn SP"), $status));
if ($key_word) {
$key_word_s = '';
$arr = explode(' ', $key_word);
if ($arr) {
foreach ($arr as $key) {
$key = trim($key);
if ($key != '') {
$key_word_s .= ($key_word_s == '' ? '+' : ' +') . "{$key}";
}
}
}
if ($key_word_s != '') {
$condition .= " AND MATCH(title, des) AGAINST ('{$key_word_s}' IN BOOLEAN MODE)";
}
//$condition .= ' AND (title LIKE "%'.$key_word.'%" OR des LIKE "%'.$key_word.'%")';
}
/*if(Url::get('key_word','str',''))
$condition.=($condition!=''?' AND ':' ').' (title LIKE "%'.$key_word.'%" OR des LIKE "%'.$key_word.'%")';*/
$total_item = DB::count('document', $condition);
$LIMIT = '';
$paging = AZPagging::paging_list($LIMIT, $total_item, 20, 10, 'page_no', '', true, "Tài liệu", 'Trang');
$display->add('paging', $paging);
$condition = ($condition != '' ? 'WHERE' : '') . $condition;
$documents = array();
$sql = 'SELECT * FROM document ' . $condition . ' ORDER BY id DESC ' . $LIMIT;
$re = DB::query($sql);
if ($re) {
while ($row = mysql_fetch_assoc($re)) {
$row['title'] = stripslashes($row['title']);
$row['des'] = stripslashes($row['des']);
if ($row['status'] == 1) {
$row['change'] = AZLib::button(Url::build_current(array('cmd' => 'change', 'id' => $row['id'], "href" => urlencode(Url::build_all()))), 'style/images/unexam.gif', 'Disable');
$row['bgcolor'] = "#FFFFFF";
$row['status'] = 'OK';
} else {
$row['change'] = AZLib::button(Url::build_current(array('cmd' => 'change', 'id' => $row['id'], "href" => urlencode(Url::build_all()))), 'style/images/exam.gif', 'Enable');
$row['bgcolor'] = "#FF9900";
$row['status'] = 'Disable';
}
$row['time_last'] = $row['time_last'] ? date("H\\hi:s d/m/Y", $row['time_last']) : '';
$row['time_c'] = date("H\\hi:s d/m/Y", $row['time_c']) . " bởi {$row['user_c']}";
$row['time_m'] = date("H\\hi:s d/m/Y", $row['time_m']) . " bởi {$row['user_m']}";
$row['edit'] = AZLib::button(Url::build_current(array('cmd' => 'edit', 'id' => $row['id'], "href" => urlencode(Url::build_all()))), 'style/images/edit.gif', 'Sửa tài liệu');
$row['delete'] = AZLib::buttonDel(Url::build_current(array('cmd' => 'delete', 'id' => $row['id'], "href" => urlencode('?' . $_SERVER['QUERY_STRING']))), 'style/images/delete.gif', 'Sửa tài liệu');
if ($row['url']) {
$row['document_detail'] = $row['url'];
} else {
$row['document_detail'] = WEB_DIR . "download-{$row['id']}/" . AZLib::safe_title($row['title']) . ".html";
$row['url'] = WEB_ROOT . "download-{$row['id']}/" . AZLib::safe_title($row['title']) . ".html";
}
$documents[$row['id']] = $row;
}
}
$display->add('documents', $documents);
//.........这里部分代码省略.........
示例8: draw
function draw()
{
global $display;
$this->beginForm(true);
$display->add('msg', $this->showFormErrorMessages(true));
$re = DB::query("SELECT id,name, status FROM category WHERE parent_id=0 ORDER BY position");
$all_top_cat = array();
if ($re) {
/*while($cat=mysql_fetch_assoc($re)){
if($cat['status'] == 'HOME'){
$cat['name'].=' (HOME)';
}
elseif($cat['status'] == 'HIDE'){
$cat['name'].=' (HIDE)';
}
$all_top_cat[$cat['id']]=$cat['name'];
}*/
while ($cat = mysql_fetch_assoc($re)) {
$all_top_cat[$cat['id']] = $cat;
}
}
$display->add('all_top_cat', $all_top_cat);
//$display->add('option_cat_ids',AZLib::getOptionMulti($all_top_cat,Url::get('catids',array_keys($this->cats))));
$id = (int) Url::get('id', 0);
$re1 = DB::query('SELECT category.id,name, status,category_zone_cat.position FROM category LEFT JOIN category_zone_cat ON category.id = category_zone_cat.catid WHERE category_zone_cat.zoneid=' . $id . ' ORDER BY category_zone_cat.position');
$items = array();
if ($re1) {
$last_id = 0;
while ($row = mysql_fetch_assoc($re1)) {
/*if($row['status'] == 1){
$row['status']='<b>Hiện</b>';
}
else{
$row['status']='<b>Ẩn</b>';
}
if($last_id){
$items[$last_id]['down']='<a href="'.Url::build_current(array('mod','cmd'=>'move_zonecat_down','catid'=>$last_id,'id'=>$id)).'"><img src="style/images/admin/down_arrow_.gif" /></a>';
$row['up']='<a href="'.Url::build_current(array('mod','cmd'=>'move_zonecat_up','catid'=>$row['id'],'id'=>$id)).'"><img src="style/images/admin/up_arrow_.gif" /></a>';
}
else {
$row['up']='';
}
$row['down']='';*/
$items[$row['id']] = $row;
$last_id = $row['id'];
}
/*if($last_id && $items[$last_id]['position']>1){
$items[$last_id]['up']='<a href="'.Url::build_current(array('mod','cmd'=>'move_zonecat_up','catid'=>$last_id,'id'=>$id)).'"><img src="style/images/admin/up_arrow_.gif" /></a>';
}*/
}
$display->add('items', $items);
$display->add('catids', Url::get('catids', $this->cats));
$display->add('name', Url::get('name', $this->cat_zone['name']));
$display->add('brief_name', Url::get('brief_name', $this->cat_zone['brief_name']));
$display->add('option_status', AZLib::getOption(array(0 => 'Ẩn', 1 => 'Hiện'), Url::get('status', $this->cat_zone['status'])));
$display->add('option_position', AZLib::getOptionNum(1, 100, Url::get('position', $this->cat_zone['position'])));
$display->add('class', Url::get('class', $this->cat_zone['class']));
$display->output('zone_edit');
$this->endForm();
}