Пример #1
0
 function draw()
 {
     global $display;
     $keyword = Url::get('keyword');
     $display->add('keyword', $keyword);
     $display->add('export_link', Url::build_current(array('cmd' => 'export')));
     $where = '1';
     if ($keyword != '') {
         $where .= ' AND email LIKE "%' . $keyword . '%"';
     }
     $total_item = DB::count('news_letter_email', $where);
     $limit = '';
     $item_per_page = 40;
     $page_no = (int) Url::get('page_no');
     $pagging = AZPagging::paging_list($limit, $total_item, $item_per_page, 10);
     $re = DB::query('SELECT * FROM news_letter_email WHERE ' . $where . ' ORDER BY id ' . $limit);
     $news_letter_emails = array();
     $i = 0;
     if ($page_no <= 0) {
         $page_no = 1;
     }
     if ($re) {
         while ($item = mysql_fetch_assoc($re)) {
             $item['time_add'] = date('H:i', $item['time_add']) . ' ngày ' . date('d/m/Y', $item['time_add']) . '<br />Cách đây ' . AZLib::duration_time($item['time_add']);
             $item['delete'] = AZLib::buttonDel(Url::build_current(array('cmd' => 'delete', 'id' => $item['id'])), 'style/images/admin/delete.gif', 'Loại bỏ Email này khỏi danh sách!');
             $i++;
             $item['i'] = $i + ($page_no - 1) * $item_per_page;
             $news_letter_emails[$item['id']] = $item;
         }
     }
     $display->add('pagging', $pagging);
     $display->add('news_letter_emails', $news_letter_emails);
     $display->add('count', $total_item);
     $this->beginForm();
     $display->output("NewsLetterAdmin");
     $this->endForm();
 }
Пример #2
0
 function draw()
 {
     global $display;
     $status_arr = array('0' => 'Chưa trả lời / phản hồi', '1' => 'Đã phản hồi / phản hồi', '2' => 'Tất cả');
     $status = (int) Url::get('status', 0);
     $display->add('url_admin', Url::build_current());
     $display->add('status_option', AZLib::getOption($status_arr, $status));
     $item_per_page_arr = array('20' => '20', '50' => '50', '100' => '100', '150' => '150', '200' => '200', '300' => '300', '500' => '500');
     $item_per_page = (int) Url::get('row_per_page', 20);
     $display->add('row_per_page_option', AZLib::getOption($item_per_page_arr, $item_per_page));
     $from_date_arr[-1] = '--Từ ngày--';
     for ($i = 30; $i >= 0; $i--) {
         $time_from = mktime(0, 0, 0, date('m', TIME_NOW), date('d', TIME_NOW), date('Y', TIME_NOW)) - $i * 24 * 3600;
         $from_date_arr[$time_from] = date('d/m/Y', $time_from);
     }
     $to_date_arr[-1] = '--Đến ngày--';
     for ($i = 0; $i <= 30; $i++) {
         $time_to = mktime(23, 59, 59, date('m', TIME_NOW), date('d', TIME_NOW), date('Y', TIME_NOW)) - $i * 24 * 3600;
         $to_date_arr[$time_to] = date('d/m/Y', $time_to);
     }
     $from_date = Url::get('from_date', -1);
     $to_date = Url::get('to_date', -1);
     $display->add('from_date_option', AZLib::getOption($from_date_arr, $from_date));
     $display->add('to_date_option', AZLib::getOption($to_date_arr, $to_date));
     $sql = ' 1 ';
     if ($from_date > -1) {
         $sql .= " AND time>=" . $from_date;
     }
     if ($to_date > -1) {
         $sql .= " AND time<=" . $to_date;
     }
     $txt_ykien = Url::get('txt_ykien', '');
     if ($txt_ykien != '') {
         $sql .= " AND content like '%{$txt_ykien}%'";
     }
     $display->add('txt_ykien', $txt_ykien);
     if ($status != 2) {
         $sql .= ' AND  status=' . $status;
     }
     $num_of_row = DB::count('feedback', $sql);
     $limit = '';
     $display->add('pagging', AZPagging::paging_list($limit, $num_of_row, $item_per_page, 10, 'page_no', '', true, 'Liên hệ'));
     $page_no = (int) Url::get('page_no', 1);
     if ($page_no <= 0) {
         $page_no = 1;
     }
     $i = 0;
     $all_feedbacks = array();
     $sql = "SELECT * FROM feedback WHERE {$sql} ORDER BY id DESC {$limit}";
     $re = DB::query($sql);
     if ($re) {
         while ($row = mysql_fetch_assoc($re)) {
             $email = '';
             if ($row['name']) {
                 $email = stripslashes($row['name']) . " ";
             }
             if ($row['address']) {
                 $email .= "( " . stripslashes($row['address']) . ") ";
             }
             $email .= '<a href="mailto:' . $row['email'] . '"><font color=blue>' . $row['email'] . "</font></a>";
             $row['email'] = $email;
             $row['date'] = date("d/m/Y H:i:s", $row['time']);
             $row['date2'] = AZLib::duration_time($row['time']);
             $row['url_del'] = AZLib::buttonDel(Url::build_current(array('id' => $row['id'], 'cmd' => 'delete')), 'style/images/delete.gif', 'Xóa ý kiến');
             $row['url_reply'] = Url::build_current(array('id' => $row['id'], 'cmd' => 'reply'));
             if ($row['reply_content']) {
                 $row['reply_content'] = stripslashes($row['reply_content']);
             } else {
                 $row['reply_content'] = "Chưa có";
             }
             if (!$row['status']) {
                 $row['exam'] = AZLib::button(Url::build_current(array('id' => $row['id'], 'cmd' => 'exam')), 'style/images/exam.gif', 'Duyệt liên hệ');
             } else {
                 $row['exam'] = AZLib::button(Url::build_current(array('id' => $row['id'], 'cmd' => 'unexam')), 'style/images/unexam.gif', 'Bỏ duyệt liên hệ');
             }
             if ($i % 2 == 0) {
                 $row['bgcolor'] = '#FFFFFF';
             } else {
                 $row['bgcolor'] = '#CCFF99';
             }
             $i++;
             $row['i'] = ($page_no - 1) * $item_per_page + $i;
             $all_feedbacks[$row['id']] = $row;
         }
     }
     $display->add('all_feedbacks', $all_feedbacks);
     $this->beginForm();
     $display->output("FeedbackAdmin");
     $this->endForm();
 }
Пример #3
0
 function draw()
 {
     global $display;
     $survey_config = @CGlobal::$configs['survey_config']['conf_val'];
     if ($survey_config != '') {
         $survey_config = unserialize(stripslashes($survey_config));
     } else {
         $survey_config = array();
     }
     $id_survey = @(int) $survey_config[Module::$block_id];
     $admin = '';
     if (User::is_admin()) {
         $admin = '<a href="' . Url::build('admin_survey', array('href' => urlencode(Url::build_all()), 'block_id' => Module::$block_id)) . '"><img src="style/images/nav_right_arrow.gif"  border="0" title="Chọn thăm dò ý kiến" /></a>';
         $display->add('is_admin', 1);
     }
     $public_survey = DB::select("public_survey", "id={$id_survey}");
     if ($public_survey) {
         if ($public_survey['view'] == 1) {
             $display->add('show_survey', 1);
             $display->add('title', stripslashes($public_survey['title']));
             $display->add('question', stripslashes($public_survey['question']));
             $display->add('id', $public_survey['id']);
             $opts = array();
             $re = DB::query('SELECT * FROM public_survey_opinion WHERE `id_survey`=' . $public_survey['id']);
             $i = 0;
             if ($re) {
                 while ($opt = mysql_fetch_assoc($re)) {
                     $i++;
                     if ($public_survey['type'] == 1) {
                         $opt['control'] = '<input name="survey_id[]" type="radio" value="' . $opt['id'] . '" id="survey_id_' . $opt['id'] . '">';
                     } else {
                         $opt['control'] = '<input name="survey_id[]" type="checkbox" value="' . $opt['id'] . '" id="survey_id_' . $opt['id'] . '">';
                     }
                     $opts[$opt['id']] = $opt;
                 }
             }
             $display->add('opts', $opts);
             $url_detail = Url::build('view_survey', array('id' => $public_survey['id']));
             $display->add('onclick_rate', Url::open_popup($url_detail . "&ids='+survey_list('survey_id[]')+'", 600, 100 + 50 * $i, false, false, false, false, false, 1, false, false, false));
             $display->add('onclick_view', Url::open_popup($url_detail, 600, 100 + 50 * $i, false, false, false, false, false, 1, false, false, false));
         }
         $display->add('edit', AZLib::button(Url::build('admin_survey', array('cmd' => 'edit', 'id_survey' => $public_survey['id'])), 'style/images/edit.gif', "Sửa Thăm dò ý kiến"));
         $display->add('delete', AZLib::buttonDel(Url::build_current(array('cmd' => 'remove_survey', 'id_survey' => $public_survey['id'], 'block_id' => Module::$block_id)), 'style/images/delete.gif', "Bỏ chọn dò ý kiến"));
     }
     $display->add('admin', $admin);
     $display->output('PublicSurvey');
 }
Пример #4
0
 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);
     $display->output('DocumentAdmin');
     $this->endForm();
 }
Пример #5
0
 function draw()
 {
     global $display;
     $this->beginForm(false, "POST", false, Url::build_current());
     $key_word = Url::get('key_word');
     $condition = " status=1";
     $display->add('key_word', $key_word);
     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.'%")';
     }
     $total_item = DB::count('document', $condition);
     $limit = '';
     $paging = AZPagging::paging_list($limit, $total_item, 10, 10, 'page_no', '', true, 'Tài liệu', 'Trang');
     $display->add('paging', $paging);
     $condition = 'WHERE' . $condition;
     $documents = array();
     $sql = 'SELECT * FROM document ' . $condition . ' ORDER BY id DESC ' . $limit;
     $re = DB::query($sql);
     if ($re) {
         $i = 1;
         while ($row = mysql_fetch_assoc($re)) {
             $row['title'] = stripslashes($row['title']);
             $row['des'] = AZLib::remove_4_js(AZLib::plainText(html_entity_decode($row['des'], ENT_QUOTES, "UTF-8")));
             $row['des'] = str_replace(array("'", "\""), array("", " "), $row['des']);
             $row['des'] = AZLib::word_limit($row['des'], 200, '');
             if (++$i % 2) {
                 $row['bgcolor'] = "#FFFFFF";
             } else {
                 $row['bgcolor'] = "#D9D9D9";
             }
             $row['time_m'] = $row['time_m'] ? date("d/m/Y", $row['time_m']) : '';
             if (User::is_admin()) {
                 $row['change'] = AZLib::button(Url::build_current(array('cmd' => 'change', 'id' => $row['id'], "href" => urlencode(Url::build_all()))), 'style/images/unexam.gif', 'Disable');
                 $row['edit'] = AZLib::button(Url::build('document', 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";
             }
             $documents[$row['id']] = $row;
         }
     }
     $display->add('documents', $documents);
     if (User::is_admin()) {
         $display->add("is_admin", 1);
     }
     $display->output('DocumentList');
     $this->endForm();
 }
Пример #6
0
 function draw()
 {
     $this->beginForm(true);
     global $display;
     $display->add('msg', $this->showFormErrorMessages(1));
     $list = scandir(ROOT_PATH . 'promotion/');
     $p_arry = array();
     if ($list) {
         foreach ($list as $promo) {
             if ($promo != '.' && $promo != '..' && is_dir(ROOT_PATH . 'promotion/' . $promo)) {
                 $item['url'] = WEB_ROOT . 'promotion/' . $promo . '/';
                 $item['name'] = $promo;
                 $item['edit'] = AZLib::button(Url::build_current(array('cmd' => 'edit', 'name' => urlencode($promo))), 'style/images/edit.gif', "Sửa tên chương trình");
                 $item['delete'] = AZLib::buttonDel(Url::build_current(array('cmd' => 'delete', 'name' => urlencode($promo))), 'style/images/delete.gif', "Xóa chương trình");
                 $p_arry[] = $item;
             }
         }
     }
     $display->add('p_arry', $p_arry);
     $display->output('AdminPromotion');
     $this->endForm();
 }
Пример #7
0
 function draw()
 {
     global $display;
     $this->beginForm(1);
     $display->add('msg', $this->showFormErrorMessages(1));
     $display->add('url_detail', Url::build('news_detail', array('news_catid' => $this->news['news_catid'], 'news_id' => $this->news['id'])));
     if ($this->news['image']) {
         $display->add('delete', AZLib::buttonDel(Url::build_current(array('cmd' => 'del_img', 'news_id' => $this->news['id'], 'href' => urlencode(Url::build_all()))), 'delete.gif', "Xóa ảnh khỏi tin"));
     } else {
         $display->add('delete', '');
     }
     $allCatArr = array(0 => "--Chọn Danh Mục Tin--");
     if (CGlobal::$allNewsCategories) {
         foreach (CGlobal::$allNewsCategories as $cat) {
             $allCatArr[$cat['id']] = "[{$cat['id']}] {$cat['name']}" . ($cat['public'] == 0 ? ' (Đã ẩn)' : '');
         }
     }
     $display->add('news_catid_option', AZLib::getOption($allCatArr, Url::get('news_catid', $this->news['news_catid'])));
     $display->add('status_option', AZLib::getOption(array(0 => "Ẩn", 1 => "Hiện"), Url::get('status', $this->news['status'])));
     if (Url::get('hot', $this->news['hot'])) {
         $display->add('checked', "checked='checked'");
     } else {
         $display->add('checked', "");
     }
     if (Url::get('focus', $this->news['focus'])) {
         $display->add('focus_checked', "checked='checked'");
     } else {
         $display->add('focus_checked', "");
     }
     $display->add('title', stripslashes(Url::get('title', $this->news['title'])));
     $display->add('brief', stripslashes(Url::get('brief', $this->news['brief'])));
     $display->add('content', stripslashes(Url::get('content', $this->news['content'])));
     $display->add('main_image_src', AZLib::getImageThumb($this->news['image'], 150, 0, 0, $this->news['img_server']));
     $display->add('image_title', stripslashes(Url::get('image_title', $this->news['image_title'])));
     $display->add('pen_name', stripslashes(Url::get('pen_name', $this->news['pen_name'])));
     $display->add('source', stripslashes(Url::get('source', $this->news['source'])));
     $display->output("NewsAdminEdit");
     $this->endForm();
 }