function draw() { global $display; $this->beginForm(); $sql = "SELECT COUNT(*) AS total_row FROM spam_mail"; $total = DB::fetch($sql, 'total_row', 0); $spam_content = DB::select('spam_content', 'status=1'); $pagging = ''; $spam_emails = array(); if ($total) { $limit = ''; $pagging = AZPagging::pagingSE($limit, $total, 50, 10, 'page_no', true); $sql = "SELECT id, email_list, time, time_modify, spam_id, status FROM spam_mail ORDER BY id DESC {$limit}"; $re = DB::query($sql); if ($re) { while ($email = mysql_fetch_assoc($re)) { if ($email['time'] != $email['time_modify']) { $email['time'] = "<b>Tạo:</b> " . date('H\\hi d.m.Y', $email['time']); $email['time'] .= "<br /><b>Sửa:</b> " . date('H\\hi d.m.Y', $email['time_modify']); } else { $email['time'] = "<b>Tạo:</b> " . date('H\\hi d.m.Y', $email['time']); } if ($spam_content && $spam_content['id'] == $email['spam_id']) { $email['spam_id'] = '<font color="green">Đã spam</font>'; $email['reset'] = AZLib::button(Url::build_current(array('cmd' => 'reset_email', 'id' => $email['id'])), 'icon-reload.gif', 'Spam lại'); } else { $email['spam_id'] = '<font color="orange">Chưa được Spam</font>'; $email['reset'] = ''; } if ($email['status']) { $email['status'] = '<font color="green">Có</font>'; $email['check'] = AZLib::button(Url::build_current(array('cmd' => 'deactive_email', 'id' => $email['id'])), 'admin/delete_button_dis.gif', 'Không cho phép spam'); } else { $email['status'] = '<font color="orange">Không</font>'; $email['check'] = AZLib::button(Url::build_current(array('cmd' => 'active_email', 'id' => $email['id'])), 'admin/check.gif', 'Cho phép spam'); } if ($email['email_list']) { $email['email_list'] = count(explode("\n", $email['email_list'])); } else { $email['email_list'] = 0; } $email['edit_link'] = Url::build_current(array('cmd' => 'edit_email', 'id' => $email['id'])); $email['del_link'] = Url::build_current(array('cmd' => 'delete_email', 'id' => $email['id'])); $spam_emails[$email['id']] = $email; } } } $display->add('check_all', AZLib::button(Url::build_current(array('cmd' => 'active_all_email')), 'admin/check.gif', 'Cho phép spam tất cả các mail')); $display->add('check_none', AZLib::button(Url::build_current(array('cmd' => 'deactive_all_email')), 'admin/delete_button_dis.gif', 'Không phép spam tất cả các mail')); $display->add('items', $spam_emails); $display->add('pagging', $pagging); $display->output('ManageEmail'); $this->endForm(); }
function draw() { global $display; $this->beginForm(); $sql = "SELECT COUNT(*) AS total_row FROM spam_content"; $total = DB::fetch($sql, 'total_row', 0); $pagging = ''; $spam_contents = array(); if ($total) { $limit = ''; $pagging = AZPagging::pagingSE($limit, $total, 50, 10, 'page_no', true); $sql = "SELECT id, des, subject, content, time, time_modify, status FROM spam_content ORDER BY id DESC {$limit}"; $re = DB::query($sql); if ($re) { while ($spam = mysql_fetch_assoc($re)) { if ($spam['time'] != $spam['time_modify']) { $spam['time'] = "<b>Tạo:</b> " . date('H\\hi d.m.Y', $spam['time']); $spam['time'] .= "<br /><b>Sửa:</b> " . date('H\\hi d.m.Y', $spam['time_modify']); } else { $spam['time'] = "<b>Tạo:</b> " . date('H\\hi d.m.Y', $spam['time']); } if ($spam['status'] == 0) { $spam['status'] = '<font color="orange">Chưa kích hoạt</font>'; $spam['check'] = AZLib::button(Url::build_current(array('cmd' => 'active_content', 'id' => $spam['id'])), 'admin/check.gif', 'Kích hoạt'); } elseif ($spam['status'] == 1) { $spam['status'] = '<font color="red"><b>Kích hoạt</b></font>'; $spam['check'] = AZLib::button(Url::build_current(array('cmd' => 'deactive_content', 'id' => $spam['id'])), 'admin/delete_button_dis.gif', 'Bỏ kích hoạt'); } $spam['edit_link'] = Url::build_current(array('cmd' => 'edit_content', 'id' => $spam['id'])); $spam['del_link'] = Url::build_current(array('cmd' => 'delete_content', 'id' => $spam['id'])); $spam['onclick'] = Url::open_popup('spam_preview.php?spam_id=' . $spam['id'], '600', 400, false, false, false, true, false, false, true); $spam_contents[] = $spam; } } } $display->add('items', $spam_contents); $display->add('pagging', $pagging); $display->output('ManageSpam'); $this->endForm(); }
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(); }
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'); }
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(); }
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(); }
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(); }