多个网站可以使用作者平台

hotfix/远程访问多媒体中心
尹诚诚 8 years ago
parent 71f58fbf0d
commit 515b265b23

@ -20,17 +20,19 @@ class Author extends CI_Controller {
$this->load->model('Infoauthors_model');
$this->load->model('InfoSMS_model');
}
public function index($loadexcel = 'notexcel', $page = 1) {
$this->load->library('accesscheck');
$this->accesscheck->check_access();
//获取任务状态
$request_form = 'get';
if($loadexcel=='loadexcel')$request_form='post';
if ($loadexcel == 'loadexcel')
$request_form = 'post';
$t_status = $this->input->$request_form('taskstatus');
if($t_status=="-")$t_status=false;
if ($t_status == "-")
$t_status = false;
//根据任务状态加载视图模板
switch (trim($t_status))
{
switch (trim($t_status)) {
case 'edit':
$this->in_edit_tasks($loadexcel);
break;
@ -167,15 +169,21 @@ class Author extends CI_Controller {
public function _get_tasks_list($t_status = false, $loadexcel = false, $page = false, $pageurl = false) {
//异步获取任务列表时数据提交方式为get导出数据时则为post
$request_form = 'get';
if($loadexcel=='loadexcel')$request_form='post';
if ($loadexcel == 'loadexcel')
$request_form = 'post';
//任务过滤参数初始化
$t_a_id = $t_td_type = $start_date = $tasktitle = false;
$end_date = date('Y-m-d');
if($this->input->$request_form('author') && $this->input->$request_form('author')!=0) $t_a_id=$this->input->$request_form('author');
if($this->input->$request_form('tasktype') && $this->input->$request_form('tasktype')!='-') $t_td_type=$this->input->$request_form('tasktype');
if($this->input->$request_form('startdate') && $this->input->$request_form('startdate')!='') $start_date=$this->input->$request_form('startdate');
if($this->input->$request_form('enddate') && $this->input->$request_form('enddate')!='') $end_date=$this->input->$request_form('enddate');
if($this->input->$request_form('tasktitle') && $this->input->$request_form('tasktitle')!='') $tasktitle=$this->input->$request_form('tasktitle');
if ($this->input->$request_form('author') && $this->input->$request_form('author') != 0)
$t_a_id = $this->input->$request_form('author');
if ($this->input->$request_form('tasktype') && $this->input->$request_form('tasktype') != '-')
$t_td_type = $this->input->$request_form('tasktype');
if ($this->input->$request_form('startdate') && $this->input->$request_form('startdate') != '')
$start_date = $this->input->$request_form('startdate');
if ($this->input->$request_form('enddate') && $this->input->$request_form('enddate') != '')
$end_date = $this->input->$request_form('enddate');
if ($this->input->$request_form('tasktitle') && $this->input->$request_form('tasktitle') != '')
$tasktitle = $this->input->$request_form('tasktitle');
$admin_info = $this->session->userdata('session_admin');
//获取任务列表
if ($loadexcel == 'loadexcel') {
@ -193,12 +201,14 @@ class Author extends CI_Controller {
//获取任务列表
$task_id_str = 0;
if($page) $page_task=array_slice($page_task,$pages['pageSize']*($page-1),$pages['pageSize']);
if ($page)
$page_task = array_slice($page_task, $pages['pageSize'] * ($page - 1), $pages['pageSize']);
foreach ($page_task as $v) {
$task_id_str.=',' . $v->t_id;
}
$flag = false;
if($t_status=='reviewed') $flag=TRUE;
if ($t_status == 'reviewed')
$flag = TRUE;
$task_list['task_list'] = $this->Infotasks_model->get_list_by_taskids($task_id_str, $flag);
return $task_list;
}
@ -272,8 +282,7 @@ class Author extends CI_Controller {
return false;
} else {
$flag = false;
if ($this->input->post('ispublish')==1)
{
if ($this->input->post('ispublish') == 1) {
$ispublished = $this->publish_task($task);
$flag = $ispublished;
//发布失败
@ -286,12 +295,12 @@ class Author extends CI_Controller {
$this->Infotasks_model->reviwed($t_id, $reviewed, $t_rating, $t_rating_total);
//保存审核字数和金额
if($reviewed=='reviewed')
{
if ($reviewed == 'reviewed') {
$this->Infotaskarticles_model->update_review($t_id, $this->input->post('ta_count'), $this->input->post('ta_charge'));
}
$msg = '';
if($flag!=false) $msg = ' <a target="_blank" href="'.$flag.'"> 跳转到信息平台发布页</a>';
if ($flag != false)
$msg = ' <a target="_blank" href="' . $flag . '"> 跳转到信息平台发布页</a>';
$data[] = array('name' => 'ok_modal', 'value' => $this->lang->line('task_review_submit') . $msg);
$data[] = array('name' => 'ok_go', 'value' => site_url('author/in_review_tasks'));
echo json_encode($data);
@ -300,12 +309,9 @@ class Author extends CI_Controller {
$admin_info = $this->session->userdata('session_admin');
$author = $this->Infoauthors_model->detail_by_id($task->t_a_id);
//通过审核
if($reviewed=='reviewed')
{
if ($reviewed == 'reviewed') {
$this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_review_task_success_subject'), $task->t_title), $this->lang->line('author_email_review_task_success_body'));
}
else
{
} else {
$this->Infotasks_model->reviwed($t_id, 'unreviewed', $t_rating, $t_rating_total);
$this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_review_task_failed_subject'), $task->t_title), $this->lang->line('author_email_review_task_failed_body'));
}
@ -372,7 +378,8 @@ class Author extends CI_Controller {
$task_last_version = $this->Infotaskarticles_model->version_last($task->t_id);
$information = false;
if (!empty($task_last_version->ta_ic_id)) $information = $this->Information_model->detail_by_ic_id($task_last_version->ta_ic_id);
if (!empty($task_last_version->ta_ic_id))
$information = $this->Information_model->detail_by_ic_id($task_last_version->ta_ic_id);
if (empty($task_last_version->ta_ic_id) or ! $information) {
$selected_name = $this->input->post('selected_is_ic_name');
$is_id = mb_substr($selected_name, strpos($selected_name, '{') + 1, -1);
@ -444,9 +451,7 @@ class Author extends CI_Controller {
//设置月度活跃作者
if ($this->input->post('isset_active_author') == 0) {
$this->Infotasks_model->set_active_author(
$this->input->post('active_t_id'),
date('Y-m-d H:i:s'),
$this->input->post('active_ta_id')
$this->input->post('active_t_id'), date('Y-m-d H:i:s'), $this->input->post('active_ta_id')
);
}
$data[] = array('name' => 'ok', 'value' => $this->lang->line('task_complete_success'));
@ -510,8 +515,7 @@ class Author extends CI_Controller {
//获取该任务审核次数并计算奖励的百分比
$review_count = $this->Infotaskarticles_model->get_review_count($t_id);
switch ($review_count)
{
switch ($review_count) {
case 1:
$data['discount'] = array('1.1', '110%');
break;
@ -538,14 +542,7 @@ class Author extends CI_Controller {
//修改任务详细信息
public function save_task_datailinfo() {
$result = $this->Infotaskarticles_model->update(
$this->input->post('ta_id'),
$this->input->post('ta_title'),
$this->input->post('ta_content'),
$this->input->post('ta_summary'),
$this->input->post('ta_seo_title'),
$this->input->post('ta_seo_description'),
$this->input->post('ta_seo_keywords'),
$this->input->post('ta_photo'));
$this->input->post('ta_id'), $this->input->post('ta_title'), $this->input->post('ta_content'), $this->input->post('ta_summary'), $this->input->post('ta_seo_title'), $this->input->post('ta_seo_description'), $this->input->post('ta_seo_keywords'), $this->input->post('ta_photo'));
if ($result) {
$data[] = array('name' => 'ok', 'value' => 'success!');
} else {
@ -564,16 +561,14 @@ class Author extends CI_Controller {
$admin_info = $this->session->userdata('session_admin');
$author = $this->Infoauthors_model->detail_by_id($t_a_id);
if ($t_status == 'edit' && $this->Infotasks_model->reviwed($t_id, $t_status)) {
if(!empty($author))
{
if (!empty($author)) {
$this->InfoSMS_model->add('task', $t_id, $t_a_id, $admin_info['OPI_Code'], 'Your proposal has been approved');
$this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, 'Your proposal has been approved.', 'Your proposal has been approvedPlease log in at <a href="http://a.cdnch.com/author.php" target="_blank">http://a.cdnch.com/author.php</a>');
}
$data[] = array('name' => 'ok', 'value' => 'success');
} elseif ($t_status == 'refuse' && $this->Infotasks_model->reviwed($t_id, $t_status)) {
//如果指定用户则发送邮件通知
if(!empty($author))
{
if (!empty($author)) {
$this->InfoSMS_model->add('task', $t_id, $t_a_id, $admin_info['OPI_Code'], $refuse_msg);
$this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, 'Your proposal has been rejected.', 'Your proposal has been rejected: ' . $refuse_msg . ' Please log in at <a href="http://a.cdnch.com/author.php" target="_blank">http://a.cdnch.com/author.php</a>');
}
@ -601,25 +596,14 @@ class Author extends CI_Controller {
//$t_id 查找一次任务详细,用来判断当前用户是否有权限修改,暂时省略
$this->Infotasks_model->update(
$t_id,
$this->input->post('t_title'),
$this->input->post('t_content'),
$this->input->post('t_a_id'),
$this->input->post('t_td_type'),
$this->input->post('t_expires')
$t_id, $this->input->post('t_title'), $this->input->post('t_content'), $this->input->post('t_a_id'), $this->input->post('t_td_type'), $this->input->post('t_expires')
);
$data[] = array('name' => 'ok', 'value' => $this->lang->line('task_success_submit'));
echo json_encode($data);
} else {
$admin_info = $this->session->userdata('session_admin');
$this->Infotasks_model->add(
$this->input->post('t_title'),
$this->input->post('t_content'),
$this->input->post('t_a_id'),
$admin_info['OPI_Code'],
$this->input->post('t_td_type'),
$this->input->post('t_expires'),
$this->config->item('site_code')
$this->input->post('t_title'), $this->input->post('t_content'), $this->input->post('t_a_id'), $admin_info['OPI_Code'], $this->input->post('t_td_type'), $this->input->post('t_expires'), $this->config->item('site_code')
);
//新建
$is_id = $this->input->post('is_id');
@ -641,7 +625,8 @@ class Author extends CI_Controller {
add_meta($this->Infotasks_model->insert_id, 'meta_author_related_info', $meta_related_info);
}
if(empty($information->ic_summary))$information->ic_summary='';
if (empty($information->ic_summary))
$information->ic_summary = '';
$this->Infotaskarticles_model->add($this->Infotasks_model->insert_id, $information->ic_id, $information->ic_title
, $information->ic_content, $information->ic_summary, $information->ic_seo_title, $information->ic_seo_description
, $information->ic_seo_keywords, $information->ic_photo);
@ -659,17 +644,29 @@ class Author extends CI_Controller {
}
//如果指定用户则发送邮件通知
$t_a_id = $this->input->post('t_a_id');
$author=$this->Infoauthors_model->detail_by_id($t_a_id);
if(!empty($author))
{
$this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_new_task_subject'),$this->input->post('t_title')), $this->lang->line('author_email_new_task_body'));
}else{
//给所有作者发送一封邮件
//所有作者
$author_list = $this->Infoauthors_model->active_list();
switch ($t_a_id) {
case 0://cht所有用户
foreach ($author_list as $a) {
if ($a->a_sitecode == 'cht' || empty($a->a_sitecode)) {
$this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $a->a_name, $a->a_email, sprintf($this->lang->line('author_email_new_task_subject'), $this->input->post('t_title')), $this->lang->line('author_email_new_task_body2'));
}
}
break;
case -1://ah所有用户
foreach ($author_list as $a) {
if ($a->a_sitecode == 'ah') {
$this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $a->a_name, $a->a_email, sprintf($this->lang->line('author_email_new_task_subject'), $this->input->post('t_title')), $this->lang->line('author_email_new_task_body2'));
}
}
break;
default://指定用户
$author = $this->Infoauthors_model->detail_by_id($t_a_id);
if (!empty($author)) {
$this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_new_task_subject'), $this->input->post('t_title')), $this->lang->line('author_email_new_task_body'));
}
}
$data[] = array('name' => 'ok', 'value' => $this->lang->line('task_success_submit'));
$data[] = array('name' => 'ok_go', 'value' => site_url('author'));
@ -734,8 +731,7 @@ class Author extends CI_Controller {
echo json_encode($data);
$admin_info = $this->session->userdata('session_admin');
$author = $this->Infoauthors_model->detail_by_id($task->t_a_id);
if(!empty($author))
{
if (!empty($author)) {
$this->InfoSMS_model->send_mail($admin_info['OPI_Name'], $admin_info['OPI_Email'], $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_message_subject'), $task->t_title), $this->lang->line('author_email_message_body'));
}
return true;
@ -756,8 +752,7 @@ class Author extends CI_Controller {
}
//编辑作者资料
public function profile_submit()
{
public function profile_submit() {
$a_id = $this->input->post('a_id');
if (empty($a_id)) {
show_404();
@ -767,18 +762,14 @@ class Author extends CI_Controller {
$this->form_validation->set_rules('a_name', 'lang:signup_a_name', 'required');
$this->form_validation->set_rules('a_bank', 'lang:a_bank', 'required');
$this->form_validation->set_rules('a_bank_card', 'lang:a_bank_card', 'required');
if ($this->form_validation->run() == FALSE)
{
if ($this->form_validation->run() == FALSE) {
$data = array();
foreach ($this->form_validation->_error_array as $key => $value)
{
foreach ($this->form_validation->_error_array as $key => $value) {
$data[] = array('name' => $key, 'value' => $value);
}
echo json_encode($data);
return FALSE;
}
else
{
} else {
//头像处理
$a_photo = $this->input->post('a_photo');
if ($this->input->post('profile_url') != '') {
@ -787,7 +778,8 @@ class Author extends CI_Controller {
$profile_array = explode('.', $profile_url);
$profile_ext = 'jpg'; //end($profile_array);
$new_profile = $profile_file_path . '/profile_' . $this->input->post('a_email') . '.' . $profile_ext;
if(file_exists($new_profile))unlink($new_profile);
if (file_exists($new_profile))
unlink($new_profile);
rename($profile_file_path . '/' . $profile_url, $new_profile);
rename($profile_file_path . '/' . str_replace('_thumb', '', $profile_url), $profile_file_path . '/profile_' . $this->input->post('a_email') . '_org.' . $profile_ext);
$a_photo = 'profile_' . $this->input->post('a_email') . '.' . $profile_ext;
@ -800,17 +792,14 @@ class Author extends CI_Controller {
$file_array = explode('.', $a_id_file);
$ext = 'jpg'; //end($file_array);
$new_file = $ID_file_path . '/id_card_' . $this->input->post('a_email') . '.' . $ext;
if(file_exists($new_file))unlink($new_file);
if (file_exists($new_file))
unlink($new_file);
rename($ID_file_path . '/' . $a_id_file, $new_file);
}
$a_name = trim($this->input->post('a_name'));
$a_name_cn = trim($this->input->post('a_name_cn'));
$this->Infoauthors_model->update($a_id, $this->input->post('a_email'),
$a_name, $a_name_cn, $a_photo,
$this->input->post('a_mobile_phone'),$this->input->post('a_phone'), $this->input->post('a_id_card'),
$this->input->post('a_gender'),$this->input->post('a_address'), $this->input->post('a_school'),
$this->input->post('a_bank'),$this->input->post('a_bank_card'), $this->input->post('a_resume'));
$this->Infoauthors_model->update($a_id, $this->input->post('a_email'), $a_name, $a_name_cn, $a_photo, $this->input->post('a_mobile_phone'), $this->input->post('a_phone'), $this->input->post('a_id_card'), $this->input->post('a_gender'), $this->input->post('a_address'), $this->input->post('a_school'), $this->input->post('a_bank'), $this->input->post('a_bank_card'), $this->input->post('a_resume'));
$this->Infoauthors_model->set_title($a_id, $this->input->post('a_title'));
@ -836,13 +825,10 @@ class Author extends CI_Controller {
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
if (!$this->upload->do_upload($upload_id))
{
if (!$this->upload->do_upload($upload_id)) {
$error = array('error' => $this->upload->display_errors());
var_dump($error);
}
else
{
} else {
$data = array('upload_data' => $this->upload->data());
$file_name = $data['upload_data']['file_name'];
if ($profile) {
@ -864,8 +850,7 @@ class Author extends CI_Controller {
}
//修改职称
public function submit_author_title()
{
public function submit_author_title() {
$a_id = $this->input->post('a_id');
if (empty($a_id)) {
show_404();
@ -884,6 +869,7 @@ class Author extends CI_Controller {
$this->load->view('bootstrap/author/announce_list');
$this->load->view('bootstrap/footer');
}
//公告详情
public function announce_detail($announce_id, $type = 'notice') {
$announce = $this->Infotaskarticles_model->get_announce($announce_id, $type);
@ -893,6 +879,7 @@ class Author extends CI_Controller {
$this->load->view('bootstrap/author/announce_list');
$this->load->view('bootstrap/footer');
}
//编辑公告
public function announce_edit($announce_id = "", $type = 'notice') {
if ($announce_id != "") {
@ -904,6 +891,7 @@ class Author extends CI_Controller {
$this->load->view('bootstrap/author/announce_edit');
$this->load->view('bootstrap/footer');
}
//公告更新
public function add_announce() {
$title = $this->input->post('title');
@ -1014,7 +1002,8 @@ class Author extends CI_Controller {
$excel_str.="\n"; //添加行结束符
}
$filetype = $this->input->post('filetype');
if($filetype==2) $excel_str=iconv('UTF-8','GB2312',$excel_str);//excel简体中文版使用gb2312编码
if ($filetype == 2)
$excel_str = iconv('UTF-8', 'GB2312', $excel_str); //excel简体中文版使用gb2312编码
echo "$excel_str";
}
@ -1043,7 +1032,8 @@ class Author extends CI_Controller {
$enddate = strtotime($enddate);
}
if ($startdate > $enddate) {
echo "请选择正确的日期";die();
echo "请选择正确的日期";
die();
}
//查取google分析数据
$data['analytics_list'] = $this->Infotaskarticles_model->get_analytics_list($pagepath, $sitecode, 50, $startdate, $enddate);
@ -1065,5 +1055,5 @@ class Author extends CI_Controller {
$this->load->view('bootstrap/author/analytics', $data);
}
}
}

@ -27,8 +27,6 @@ class Information extends CI_Controller {
public function index() {
echo '信息首页';
$this->load->model('pictureUseStat_model');
$this->pictureUseStat_model->test();
}
public function add($is_parent_id) {

@ -49,6 +49,9 @@ class Login extends CI_Controller {
//站点切换
public function change_site($site_code) {
//来源页面,成功切换站点之后转到原始页面去 ,如果在各编辑界面切换则会导致站点错误比如ch的文章id=100切换到gm下就没有id=100只能切换的某个板块
// $referer = empty($_SERVER['HTTP_REFERER']) ? false : $_SERVER['HTTP_REFERER'];
$this->permission->is_admin();
$this->load->library('Accesscheck');
@ -70,7 +73,6 @@ class Login extends CI_Controller {
} else {
redirect(site_url());
}
return TRUE;
}

@ -1,7 +1,7 @@
<?php
class Infotasks_model extends CI_Model
{
class Infotasks_model extends CI_Model {
var $insert_id = -1;
var $top_num = false;
var $t_id = false;
@ -13,14 +13,12 @@ class Infotasks_model extends CI_Model
var $t_datetime = false;
var $t_title = false;
function __construct()
{
function __construct() {
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
}
function init()
{
function init() {
$this->top_num = false;
$this->t_id = false;
$this->order_by = " ORDER BY t.t_id DESC ";
@ -31,17 +29,12 @@ class Infotasks_model extends CI_Model
}
//正在编辑的任务
function in_edit($t_ht_op_code=false)
{
function in_edit($t_ht_op_code = false) {
$this->init();
if(!empty($t_ht_op_code))
{
if(is_numeric($t_ht_op_code))
{
if (!empty($t_ht_op_code)) {
if (is_numeric($t_ht_op_code)) {
$this->t_a_id = " AND t.t_a_id= " . $this->HT->escape($t_ht_op_code);
}
else
{
} else {
$this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code);
}
}
@ -50,17 +43,12 @@ class Infotasks_model extends CI_Model
}
//待审核任务
function in_review($t_ht_op_code=false)
{
function in_review($t_ht_op_code = false) {
$this->init();
if(!empty($t_ht_op_code))
{
if(is_numeric($t_ht_op_code))
{
if (!empty($t_ht_op_code)) {
if (is_numeric($t_ht_op_code)) {
$this->t_a_id = " AND t.t_a_id= " . $this->HT->escape($t_ht_op_code);
}
else
{
} else {
$this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code);
}
}
@ -69,39 +57,32 @@ class Infotasks_model extends CI_Model
}
//待结算任务
function in_reviewed($t_ht_op_code=false,$t_a_id=false,$t_td_type=false,$start_date=false,$end_date=false)
{
function in_reviewed($t_ht_op_code = false, $t_a_id = false, $t_td_type = false, $start_date = false, $end_date = false) {
$this->init();
if(!empty($t_ht_op_code))
{
if(is_numeric($t_ht_op_code))
{
if (!empty($t_ht_op_code)) {
if (is_numeric($t_ht_op_code)) {
$this->t_a_id = " AND t.t_a_id= " . $this->HT->escape($t_ht_op_code);
}
else
{
} else {
$this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code);
}
}
if($t_a_id)$this->t_a_id=" AND t.t_a_id = $t_a_id ";
if($t_td_type)$this->t_td_type=" AND t.t_td_type = '$t_td_type' ";
if ($t_a_id)
$this->t_a_id = " AND t.t_a_id = $t_a_id ";
if ($t_td_type)
$this->t_td_type = " AND t.t_td_type = '$t_td_type' ";
$this->t_status = " AND t.t_status = 'reviewed' ";
if($start_date) $this->t_datetime = " AND t.t_datetime BETWEEN '$start_date' AND '$end_date' ";
if ($start_date)
$this->t_datetime = " AND t.t_datetime BETWEEN '$start_date' AND '$end_date' ";
return $this->get_list();
}
//已完成任务
function in_complete($t_ht_op_code=false)
{
function in_complete($t_ht_op_code = false) {
$this->init();
if(!empty($t_ht_op_code))
{
if(is_numeric($t_ht_op_code))
{
if (!empty($t_ht_op_code)) {
if (is_numeric($t_ht_op_code)) {
$this->t_a_id = " AND t.t_a_id= " . $this->HT->escape($t_ht_op_code);
}
else
{
} else {
$this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code);
}
}
@ -110,17 +91,12 @@ class Infotasks_model extends CI_Model
}
//待审核投稿
function in_wait($t_ht_op_code=false)
{
function in_wait($t_ht_op_code = false) {
$this->init();
if(!empty($t_ht_op_code))
{
if(is_numeric($t_ht_op_code))
{
if (!empty($t_ht_op_code)) {
if (is_numeric($t_ht_op_code)) {
$this->t_a_id = " AND t.t_a_id= " . $this->HT->escape($t_ht_op_code);
}
else
{
} else {
$this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code);
}
}
@ -129,24 +105,21 @@ class Infotasks_model extends CI_Model
}
//大厅任务
function in_hall()
{
function in_hall() {
$this->init();
$this->t_a_id = " AND t.t_a_id= 0 ";
return $this->get_list();
}
//获取单个任务详细信息
function detail($t_id)
{
function detail($t_id) {
$this->init();
$this->top_num = 1;
$this->t_id = " AND t.t_id=" . $this->HT->escape($t_id);
return $this->get_list();
}
function get_list($page_flag=false)
{
function get_list($page_flag = false) {
$this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT ";
$sql .= " t.t_id, \n"
. " t.t_title, \n"
@ -164,7 +137,8 @@ class Infotasks_model extends CI_Model
. " t.t_delete \n"
. "FROM infotasks t \n"
. "WHERE t.t_delete = 0 \n";
if($page_flag)$sql="SELECT t.t_id FROM infotasks t WHERE t.t_delete = 0";
if ($page_flag)
$sql = "SELECT t.t_id FROM infotasks t WHERE t.t_delete = 0";
$this->t_id ? $sql.=$this->t_id : false;
$this->t_status ? $sql.=$this->t_status : false;
$this->t_ht_op_code ? $sql.=$this->t_ht_op_code : false;
@ -172,29 +146,28 @@ class Infotasks_model extends CI_Model
$this->t_a_id ? $sql.=$this->t_a_id : false;
$this->t_title ? $sql.=$this->t_title : false;
$this->t_datetime ? $sql.=$this->t_datetime : false;
$site_code = $this->config->item('site_code');
if ($site_code == 'cht') { //早期的任务没有设置站点默认是cht
$sql.=" AND ( t.t_sitecode= '$site_code' OR t.t_sitecode is null )";
} else {
$sql.=" AND t.t_sitecode= '$site_code' ";
}
$this->order_by ? $sql.=$this->order_by : false;
$query = $this->HT->query($sql);
if($this->top_num==1)
{
if ($query->num_rows() > 0)
{
if ($this->top_num == 1) {
if ($query->num_rows() > 0) {
$row = $query->row();
return $row;
}
else
{
} else {
return FALSE;
}
}
else
{
} else {
return $query->result();
}
}
//写入
function add($t_title, $t_content, $t_a_id, $t_ht_op_code, $t_td_type, $t_expires,$t_sitecode='cht')
{
function add($t_title, $t_content, $t_a_id, $t_ht_op_code, $t_td_type, $t_expires, $t_sitecode = 'cht') {
$sql = "INSERT INTO infotasks \n"
. " ( \n"
. " t_title, \n"
@ -219,8 +192,7 @@ class Infotasks_model extends CI_Model
}
//更新
function update($t_id,$t_title, $t_content, $t_a_id, $t_td_type, $t_expires)
{
function update($t_id, $t_title, $t_content, $t_a_id, $t_td_type, $t_expires) {
$sql = "UPDATE infotasks \n"
. "SET t_title = N?, \n"
. " t_content = N?, \n"
@ -235,8 +207,7 @@ class Infotasks_model extends CI_Model
}
//删除
function delete($t_id)
{
function delete($t_id) {
$sql = "UPDATE infotasks \n"
. "SET t_delete = 1 \n"
. "WHERE t_id = ?";
@ -245,8 +216,7 @@ class Infotasks_model extends CI_Model
}
//审核
function reviwed($t_id,$t_status,$t_rating='',$t_rating_total='')
{
function reviwed($t_id, $t_status, $t_rating = '', $t_rating_total = '') {
$sql = "UPDATE infotasks \n"
. "SET t_status = ?, t_rating=?, t_rating_total=? \n"
. "WHERE t_id = ?";
@ -255,8 +225,7 @@ class Infotasks_model extends CI_Model
}
//承接任务
function undertake($t_id,$a_id)
{
function undertake($t_id, $a_id) {
$sql = "UPDATE infotasks \n"
. "SET t_a_id = ? \n"
. "WHERE t_id = ?";
@ -265,8 +234,7 @@ class Infotasks_model extends CI_Model
}
//取消任务
function canceltake($t_id)
{
function canceltake($t_id) {
$sql = "UPDATE infotasks \n"
. "SET t_a_id = 0 \n"
. "WHERE t_id = ?";
@ -275,8 +243,7 @@ class Infotasks_model extends CI_Model
}
//根据不同状态获取任务列表
public function get_tasks_list($t_status=false,$t_ht_op_code=false,$t_a_id=false,$t_td_type=false,$start_date=false,$end_date=false,$tasktitle=false,$page_flag=false)
{
public function get_tasks_list($t_status = false, $t_ht_op_code = false, $t_a_id = false, $t_td_type = false, $start_date = false, $end_date = false, $tasktitle = false, $page_flag = false) {
$this->init();
if (!empty($t_ht_op_code)) {
if (is_numeric($t_ht_op_code)) {
@ -286,14 +253,11 @@ class Infotasks_model extends CI_Model
}
}
//已发布的和已完成的任务计算在已完成的任务里
if($t_status=='complete')
{
if ($t_status == 'complete') {
$this->t_status = " AND (t.t_status= 'complete' OR t.t_status= 'published') ";
} elseif ($t_status == 'edit') {
$this->t_status = " AND (t.t_status= 'edit' OR t.t_status= 'unreviewed') ";
}
else if($t_status)
{
} else if ($t_status) {
$this->t_status = " AND t.t_status = '$t_status' ";
}
if ($t_a_id == '-1') {
@ -301,15 +265,17 @@ class Infotasks_model extends CI_Model
} elseif ($t_a_id) {
$this->t_a_id = " AND t.t_a_id = $t_a_id ";
}
if($t_td_type) $this->t_td_type = " AND t.t_td_type = '$t_td_type' ";
if($tasktitle) $this->t_title = " AND t.t_title like '%$tasktitle%' ";
if($start_date) $this->t_datetime = " AND t.t_datetime BETWEEN '$start_date' AND '$end_date' ";
if ($t_td_type)
$this->t_td_type = " AND t.t_td_type = '$t_td_type' ";
if ($tasktitle)
$this->t_title = " AND t.t_title like '%$tasktitle%' ";
if ($start_date)
$this->t_datetime = " AND t.t_datetime BETWEEN '$start_date' AND '$end_date' ";
return $this->get_list($page_flag);
}
//根据给定id字符串获取任务列表
function get_list_by_taskids($taskids,$order=false)
{
function get_list_by_taskids($taskids, $order = false) {
$ordermap = " ORDER BY t.t_datetime DESC ";
if ($order) {
$ordermap = " ORDER BY t.t_rating_total DESC,t.t_datetime DESC ";
@ -335,8 +301,7 @@ class Infotasks_model extends CI_Model
}
//评选最活跃作者
function set_active_author($t_id,$t_active_author,$ta_id)
{
function set_active_author($t_id, $t_active_author, $ta_id) {
//设置活跃作者标识
$sql = "UPDATE infotasks \n"
. "SET t_active_author = ? \n"
@ -363,8 +328,10 @@ class Infotasks_model extends CI_Model
$rank_author = array();
$active_author = array();
foreach ($result as $item) {
if(!isset($rank_author[$item->t_a_id]))$rank_author[$item->t_a_id]=$item;
if(!isset($rank[$item->t_a_id]))$rank[$item->t_a_id]=0;
if (!isset($rank_author[$item->t_a_id]))
$rank_author[$item->t_a_id] = $item;
if (!isset($rank[$item->t_a_id]))
$rank[$item->t_a_id] = 0;
$rank[$item->t_a_id]+=$item->ta_count;
}
//获取第一名的数据
@ -406,11 +373,19 @@ class Infotasks_model extends CI_Model
$admin_info = $this->session->userdata('session_admin');
$t_ht_op_code = $admin_info['OPI_Code'];
if (is_numeric($t_ht_op_code)) {
$map=" t_a_id= ".$this->HT->escape($t_ht_op_code);
$where = " t_a_id= " . $this->HT->escape($t_ht_op_code);
} else {
$where = " t_ht_op_code=" . $this->HT->escape($t_ht_op_code);
}
$site_code = $this->config->item('site_code');
if ($site_code == 'cht') { //早期的任务没有设置站点默认是cht
$where.=" AND ( t_sitecode= '$site_code' OR t_sitecode is null )";
} else {
$map=" t_ht_op_code=".$this->HT->escape($t_ht_op_code);
$where.=" AND t_sitecode= '$site_code' ";
}
$sql="SELECT t_status, count(0) as task_count FROM infotasks WHERE $map AND t_delete=0 group by t_status";
$sql = "SELECT t_status, count(0) as task_count FROM infotasks WHERE $where AND t_delete=0 group by t_status";
$query = $this->HT->query($sql);
$result = $query->result();
$counts = array();
@ -420,14 +395,18 @@ class Infotasks_model extends CI_Model
}
//已完成数量=完成数量+已发布的数量
$complete_count = $published_count = 0;
if(isset($counts['complete']))$complete_count=$counts['complete'];
if(isset($counts['published']))$published_count=$counts['published'];
if (isset($counts['complete']))
$complete_count = $counts['complete'];
if (isset($counts['published']))
$published_count = $counts['published'];
$counts['complete'] = $complete_count + $published_count;
//正在进行中的任务=edit+unreviewed的数量
$edit_count = $unreviewed_count = 0;
if(isset($counts['edit']))$edit_count=$counts['edit'];
if(isset($counts['unreviewed']))$unreviewed_count=$counts['unreviewed'];
if (isset($counts['edit']))
$edit_count = $counts['edit'];
if (isset($counts['unreviewed']))
$unreviewed_count = $counts['unreviewed'];
$counts['edit'] = $edit_count + $unreviewed_count;
return $counts;
}
@ -455,4 +434,5 @@ class Infotasks_model extends CI_Model
}
}
}
}

@ -10,12 +10,13 @@
<table class="table table-striped">
<thead>
<tr>
<th class="span2">用户ID</th>
<th class="span1">用户ID</th>
<th class="span2">名字</th>
<th class="span2">中文名</th>
<th class="span1">性别</th>
<th class="span2">邮箱</th>
<th class="span2">注册时间</th>
<th class="span1">站点</th>
<th class="span1">操作</th>
</tr>
</thead>
@ -28,6 +29,7 @@
<td><?php echo $a->a_gender; ?></td>
<td><a href="mailto:<?php echo $a->a_email; ?>"><?php echo $a->a_email; ?></a></td>
<td><?php echo date('m/d/Y',strtotime($a->a_datetime)); ?></td>
<td><?php echo $a->a_sitecode; ?></td>
<td><a href="<?php echo site_url('author/edit_author/'.$a->a_id); ?>">查看</a></td>
</tr>
<?php } ?>
@ -39,12 +41,13 @@
<table class="table table-striped">
<thead>
<tr>
<th class="span2">用户ID</th>
<th class="span1">用户ID</th>
<th class="span2">名字</th>
<th class="span2">中文名</th>
<th class="span1">性别</th>
<th class="span2">邮箱</th>
<th class="span2">注册时间</th>
<th class="span1">站点</th>
<th class="span1">操作</th>
</tr>
</thead>
@ -57,6 +60,7 @@
<td><?php echo $author->a_gender; ?></td>
<td><a href="mailto:<?php echo $author->a_email; ?>"><?php echo $author->a_email; ?></a></td>
<td><?php echo date('m/d/Y',strtotime($author->a_datetime)); ?></td>
<td><?php echo $author->a_sitecode; ?></td>
<td><a href="<?php echo site_url('author/edit_author/'.$author->a_id); ?>">查看</a></td>
</tr>
<?php } ?>

@ -113,14 +113,6 @@
});
});
function get_analytics_ajax(formid,contentid,loadtotal){
var url= $("#"+formid).attr('action')+'/'+loadtotal;
var data = $("#"+formid).serialize();
$("#"+contentid).html('<img src="/css/images/loading.gif" >');
$.post(url,data,function(result){
$("#"+contentid).html(result);
});
}
function set_rate() {
var rating_str = '';
@ -129,7 +121,8 @@ function set_rate(){
var rating = $("#start-rating" + i).val();
rating_str = rating_str + rating + ',';
totalrating = Number(totalrating) + Number(rating);
};
}
;
$("#t_rating").val(rating_str);
$("#t_rating_total").val(totalrating);
}
@ -181,8 +174,10 @@ function submitsms(formID){
var other_html = '';
if (data_short != smstext) {
other_html = '<a href="javascript:void(0);" onclick="show_msg(this,\'data-long\');"> &gt;&gt; </a>';
};
var sms='<blockquote><p style="word-wrap:break-word;" data-long="'+smstext+'" data-short="'+data_short+'">'+data_short+other_html+'</p><small>'+myDate.toLocaleString();+'</small></blockquote>';
}
;
var sms = '<blockquote><p style="word-wrap:break-word;" data-long="' + smstext + '" data-short="' + data_short + '">' + data_short + other_html + '</p><small>' + myDate.toLocaleString();
+'</small></blockquote>';
$("#short_sms_container").prepend(sms);
$("#m_content").val('');
} else if (json_data[key].name == 'no') {
@ -199,18 +194,22 @@ function submitsms(formID){
}
</script>
<style>
.nav-list{border-right: none !important;}
</style>
<div class="row-fluid">
<div class="span2 well" style="min-height:700px;">
<?php echo $nav_view; isset($task_detail_list) ? $version_count = count($task_detail_list) : false; ?>
<div class="span2 ">
<?php
echo $nav_view;
isset($task_detail_list) ? $version_count = count($task_detail_list) : false;
?>
</div>
<div class="span10">
<div class="row-fluid">
<div class="span9">
<ul id="myTab" class="nav nav-tabs">
<li class="<?php echo ($nav_active!='create_task' and $nav_active!='in_wait' and !empty($task->t_a_id) and !empty($version_count))?'active':'';echo ($nav_active=='create_task')?' hide ':''; ?>"><a href="#home" data-toggle="tab">任务详情</a></li>
<li class="<?php
echo ($nav_active != 'create_task' and $nav_active != 'in_wait' and ! empty($task->t_a_id) and ! empty($version_count)) ? 'active' : '';
echo ($nav_active == 'create_task') ? ' hide ' : '';
?>"><a href="#home" data-toggle="tab">任务详情</a></li>
<li class="<?php echo ($nav_active == 'create_task' or $nav_active == 'in_wait' or empty($task->t_a_id) or empty($version_count)) ? 'active' : ''; ?>"><a href="#profile" data-toggle="tab">任务要求</a></li>
<div class="btn-group pull-right" >
<?php if (!empty($task) && $task->t_status == 'wait') { ?>
@ -222,9 +221,13 @@ function submitsms(formID){
<?php (!empty($task) && ($task->t_status == 'reviewed' or $task->t_status == 'complete' or $task->t_status == 'published') ) ? $disabled = '' : $disabled = ' hide '; ?>
<button class="btn btn-info <?php echo $disabled; ?>" <?php echo $disabled; ?> data-toggle="modal" data-target="#publish_modal">发布</button>
<?php //if (empty($task->t_a_id) or $task->t_status == 'complete' or $task->t_status == 'published') { ?>
<button class="btn btn-info <?php if($nav_active=='create_task' or $task->t_status == 'review' or $task->t_status == 'reviewed') echo 'hide'; ?>" onclick="$('#form_create_task').attr('action', '<?php echo site_url('author/delete_task') ?>');if (confirm('是否把删除任务?')) {submitForm('form_create_task');}">删除任务</button>
<button class="btn btn-info <?php if ($nav_active == 'create_task' or $task->t_status == 'review' or $task->t_status == 'reviewed') echo 'hide'; ?>" onclick="$('#form_create_task').attr('action', '<?php echo site_url('author/delete_task') ?>');
if (confirm('是否把删除任务?')) {
submitForm('form_create_task');
}">删除任务</button>
<?php (!empty($task) && ($task->t_status == 'complete' or $task->t_status == 'published' or $task->t_status == 'reviewed')) ? $disabled = 'hide' : $disabled = ''; ?>
<button class="btn btn-primary <?php echo $disabled; ?>" onclick="$('#form_create_task').attr('action', '<?php echo site_url('author/create_task_submit') ?>');submitForm('form_create_task');">提交要求</button>
<button class="btn btn-primary <?php echo $disabled; ?>" onclick="$('#form_create_task').attr('action', '<?php echo site_url('author/create_task_submit') ?>');
submitForm('form_create_task');">提交要求</button>
<?php //} ?>
<?php } ?>
</div>
@ -240,9 +243,6 @@ function submitsms(formID){
<?php if (!empty($information)) { ?>
<a href="<?php echo site_url('/information/edit/' . $information->is_id); ?>" class="btn" target="_blank"><?php echo $information->ic_title; ?></a>
<?php } ?>
<span class="<?php if(!isset($task_status) or $task_status==0) echo 'hide';?>" id="total-analytics">
<a href="javascript:void(0);" onClick="get_analytics_ajax('get-analytic-form','total-analytics','1');">获取google分析汇总数据</a>
</span>
</div>
</div>
<p></p>
@ -338,7 +338,9 @@ function submitsms(formID){
<li class="<?php echo $active; ?>"><a href="#task_version_<?php echo $task_detail->ta_id; ?>" data-toggle="tab">版本<?php echo ($version_count - $task_key) ?></a></li>
<?php } ?>
</ul>
<button type="button" class="btn btn-primary pull-right" onclick="editor.sync();$('#form_save_task').attr('action', '<?php echo site_url("author/save_task_datailinfo"); ?>');submitForm('form_save_task');"> 保存修改 </button>
<button type="button" class="btn btn-primary pull-right" onclick="editor.sync();
$('#form_save_task').attr('action', '<?php echo site_url("author/save_task_datailinfo"); ?>');
submitForm('form_save_task');"> 保存修改 </button>
</div>
<?php } ?>
</form>
@ -376,7 +378,8 @@ function submitsms(formID){
<div class="span3">
<label class="control-label">指定作者</label>
<select class="span12" id="t_a_id" name="t_a_id">
<option value="0">任务大厅</option>
<option value="0" <?php echo (isset($task) && ($task->t_a_id == 0)) ? ' selected ' : false; ?>>CHT任务大厅</option>
<option value="-1" <?php echo (isset($task) && ($task->t_a_id == -1)) ? ' selected ' : false; ?> >AH任务大厅</option>
<?php
foreach ($author_list as $author) {
$selected = '';
@ -384,7 +387,10 @@ function submitsms(formID){
$task->t_a_id == $author->a_id ? $selected = 'selected' : false;
}
?>
<option value="<?php echo $author->a_id; ?>" <?php echo $selected; ?> ><?php echo $author->a_name; ?></option>
<option value="<?php echo $author->a_id; ?>" <?php echo $selected; ?> ><?php
echo $author->a_name . ' -';
echo empty($author->a_sitecode) ? 'cht' : $author->a_sitecode;
?></option>
<?php } ?>
</select>
</div>
@ -467,7 +473,8 @@ function submitsms(formID){
<?php
if (!empty($sms_list)) {
foreach ($sms_list as $k => $sms) {
if ($k>2) break;
if ($k > 2)
break;
$content = get_text_short(htmlspecialchars($sms->m_content), 50);
if ($sms->m_sender == $task->t_a_id) {
?>
@ -493,9 +500,13 @@ function submitsms(formID){
<?php
}
}
}?>
}
?>
<?php if (!empty($sms_list)) { ?>
<?php $avatar['me']=get_author_photo();$other_sender=''; ?>
<?php
$avatar['me'] = get_author_photo();
$other_sender = '';
?>
<a data-toggle="modal" href="#sms-modal" id="sms-modal-trigger" class="btn btn-block" data-backdrop="static">更多消息..</a>
<div id="sms-modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;width: 75%;left: 32%;">
<div class="modal-header">
@ -503,7 +514,11 @@ function submitsms(formID){
<h3 id="myModalLabel">短消息历史记录</h3>
</div>
<div class="modal-body" id="sms-modal-body" style="height:520px;">
<?php if (!empty($sms_list)) { krsort($sms_list); foreach ($sms_list as $sms) { ?>
<?php
if (!empty($sms_list)) {
krsort($sms_list);
foreach ($sms_list as $sms) {
?>
<?php if ($sms->m_sender == $task->t_a_id) { ?>
<?php if ($other_sender == '') $other_sender = get_author_photo($sms->m_sender); ?>
<div class="media">
@ -531,7 +546,11 @@ function submitsms(formID){
</div>
</div>
</div>
<?php } } } ?>
<?php
}
}
}
?>
</div>
<div class="modal-footer"></div>
</div>
@ -551,7 +570,6 @@ function submitsms(formID){
</div>
</div>
<a id="rrr" href="http://localhost:9999/info.php/author/edit_task/206000154" target="_blank">f</a>
<?php if (!empty($task)) { ?>
<!-- 审核界面 -->
<div class="modal fade hide" id="review_modal" tabindex="-1" role="dialog" data-backdrop="false" style="width:700px; left:45%;">
@ -689,24 +707,4 @@ function submitsms(formID){
</div>
<!-- 发布界面 end -->
<!--成效信息展示modal-->
<div id="myModal" class="modal fade" style="width:90%;left:25%;" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<div id="myModalLabel" style="line-height:30px;">
<h3 class="span5 pull-left">页面访问量明细表</h3>
<form style="margin-bottom:0px;" id="get-analytic-form" method="post" action="<?php echo site_url('author/get_analytics_by_date'); ?>">
<input class="span2 pull-left" style="margin-bottom:0;" size="16" id="startdate" name="startdate" type="text" value="开始时间">
<input class="span2 pull-left" style="margin-bottom:0;" size="16" id="enddate" name="enddate" type="text" value="结束时间">
<input type="hidden" name="pagepath" value="<?php if (!empty($information)) echo $information->ic_url; ?>">
<input type="hidden" name="sitecode" value="<?php if (!empty($information)) echo $information->ic_sitecode; ?>">
<button type="button" class="btn" onClick="get_analytics_ajax('get-analytic-form','analytics-content','0');">查询</button>
</form>
</div>
</div>
<div class="modal-body" id="analytics-content">
</div>
</div>
<?php } ?>

@ -381,6 +381,7 @@ $config['site'] = array(
'gl' => array('site_code' => 'gl', 'site_id' => 90, 'site_lgc' => '1', 'site_url' => 'http://www.guilinchina.net'),
'mbj' => array('site_code' => 'mbj', 'site_id' => 98, 'site_lgc' => '1', 'site_url' => 'http://www.mybeijingchina.com'),
'ct' => array('site_code' => 'ct', 'site_id' => 1000, 'site_lgc' => '104', 'site_url' => 'http://www.chinatravel.com'),
'ah' => array('site_code' => 'ah', 'site_id' => 141, 'site_lgc' => '1', 'site_url' => 'https://www.asiahighlights.com/'),
'dct' => array('site_code' => 'dct', 'site_id' => 99, 'site_lgc' => '1', 'site_url' => 'http://www.diychinatours.com')
);
@ -390,3 +391,6 @@ $config['auhtor_task_type'] = array(
'审核' => 'review',
'投稿' => 'contribute'
);
//当前站点代号默认是cht用户登录之后修改
$config['site_code']='cht';

@ -1,10 +0,0 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

@ -1,34 +1,30 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Login extends CI_Controller {
function __construct()
{
function __construct() {
parent::__construct();
$this->load->model('Infoauthors_model');
}
public function index()
{
if($this->permission->is_admin(false)===false)
{
public function index() {
if ($this->permission->is_admin(false) === false) {
$data = array();
$this->load->view('header', $data);
$this->load->view('login');
$this->load->view('footer');
}
else
{
} else {
redirect(site_url());
}
}
//登录检测
public function login_submit()
{
public function login_submit() {
//如果已经登陆则跳到管理首页
if ($this->session->userdata('session_admin'))
{
if ($this->session->userdata('session_admin')) {
$data[] = array('name' => 'go', 'value' => site_url());
echo json_encode($data);
return TRUE;
@ -37,42 +33,33 @@ class Login extends CI_Controller {
$this->form_validation->set_rules('email', 'lang:login_email', 'required');
$this->form_validation->set_rules('password', 'lang:login_password', 'required');
if ($this->form_validation->run() == FALSE)
{
if ($this->form_validation->run() == FALSE) {
$data = array();
foreach ($this->form_validation->_error_array as $key => $value)
{
foreach ($this->form_validation->_error_array as $key => $value) {
$data[] = array('name' => $key, 'value' => $value);
}
echo json_encode($data);
return FALSE;
}
else
{
if ($this->Infoauthors_model->check_login($this->input->post('email'), $this->input->post('password')))
{
} else {
if ($this->Infoauthors_model->check_login($this->input->post('email'), $this->input->post('password'))) {
$this->session->set_userdata('session_admin', $this->Infoauthors_model->detail($this->input->post('email')));
//记住账号密码
$this->input->set_cookie("user_email", $this->input->post('email'), 7776000);
$this->input->set_cookie("user_pwd", $this->input->post('password'), 7776000);
$data[] = array('name' => 'go', 'value' => site_url());
echo json_encode($data);
return TRUE;
}
//用户名和密码不正确,或者没有管理权限
if ($this->session->userdata('session_admin') === false)
{
if ($this->session->userdata('session_admin') === false) {
$data[] = array('name' => 'login_warning', 'value' => $this->lang->line('login_warning'));
echo json_encode($data);
}
}
}
public function signup()
{
public function signup() {
$data = array();
$data['signup_step'] = 1;
$data['author_field'] = $this->load->view('author_field', $data, true);
@ -81,8 +68,7 @@ class Login extends CI_Controller {
$this->load->view('footer');
}
public function signup_vpn()
{
public function signup_vpn() {
$data = array();
$data['signup_step'] = 1;
$data['terms'] = 'vpn';
@ -93,28 +79,22 @@ class Login extends CI_Controller {
$this->load->view('footer');
}
public function signup_submit()
{
public function signup_submit() {
$this->form_validation->set_rules('a_email', 'lang:signup_a_email', 'required');
$this->form_validation->set_rules('a_password', 'lang:signup_a_password', 'required');
$this->form_validation->set_rules('a_name', 'lang:signup_a_name', 'required');
$this->form_validation->set_rules('a_bank', 'lang:a_bank', 'required');
$this->form_validation->set_rules('a_bank_card', 'lang:a_bank_card', 'required');
$this->form_validation->set_rules('terms', 'You must choose this option!', 'required');
if ($this->form_validation->run() == FALSE)
{
if ($this->form_validation->run() == FALSE) {
$data = array();
foreach ($this->form_validation->_error_array as $key => $value)
{
foreach ($this->form_validation->_error_array as $key => $value) {
$data[] = array('name' => $key, 'value' => $value);
}
echo json_encode($data);
return FALSE;
}
else
{
if ($this->Infoauthors_model->check_signup($this->input->post('a_email')))
{
} else {
if ($this->Infoauthors_model->check_signup($this->input->post('a_email'))) {
$data[] = array('name' => 'a_email', 'value' => 'Someone already has that email. Try another?');
echo json_encode($data);
return FALSE;
@ -142,20 +122,7 @@ class Login extends CI_Controller {
$a_name = trim($this->input->post('a_name'));
$a_name_cn = trim($this->input->post('a_name_cn'));
$this->Infoauthors_model->add(
$this->input->post('a_email'),
$this->input->post('a_password'),
$a_name,
$a_name_cn,
$a_photo,
$this->input->post('a_mobile_phone'),
$this->input->post('a_phone'),
$this->input->post('a_id_card'),
$this->input->post('a_gender'),
$this->input->post('a_address'),
$this->input->post('a_school'),
$this->input->post('a_bank'),
$this->input->post('a_bank_card'),
$this->input->post('a_resume')
$this->input->post('a_email'), $this->input->post('a_password'), $a_name, $a_name_cn, $a_photo, $this->input->post('a_mobile_phone'), $this->input->post('a_phone'), $this->input->post('a_id_card'), $this->input->post('a_gender'), $this->input->post('a_address'), $this->input->post('a_school'), $this->input->post('a_bank'), $this->input->post('a_bank_card'), $this->input->post('a_resume')
);
$data[] = array('name' => 'go', 'value' => site_url('login/signup_success'));
@ -164,9 +131,7 @@ class Login extends CI_Controller {
}
}
public function signup_success()
{
public function signup_success() {
$data['title'] = $this->lang->line('signup_success_title');
$data['content'] = $this->lang->line('signup_success');
$this->load->view('header', $data);
@ -188,13 +153,10 @@ class Login extends CI_Controller {
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
if (!$this->upload->do_upload($upload_id))
{
if (!$this->upload->do_upload($upload_id)) {
$error = array('error' => $this->upload->display_errors());
var_dump($error);
}
else
{
} else {
$data = array('upload_data' => $this->upload->data());
$file_name = $data['upload_data']['file_name'];
if ($profile) {
@ -214,8 +176,7 @@ class Login extends CI_Controller {
}
}
public function findpwd()
{
public function findpwd() {
$data = array();
$this->load->view('header', $data);
$this->load->view('findpwd');
@ -223,11 +184,9 @@ class Login extends CI_Controller {
}
//找回密码发送邮件
public function do_findpwd()
{
public function do_findpwd() {
$this->form_validation->set_rules('email', 'lang:login_email', 'required');
if ($this->form_validation->run() == FALSE)
{
if ($this->form_validation->run() == FALSE) {
$data = array();
$data[] = array('name' => 'email', 'value' => 'Please fill in your email address!');
echo json_encode($data);
@ -235,8 +194,7 @@ class Login extends CI_Controller {
}
$userdata = $this->Infoauthors_model->detail($this->input->post('email'));
if ($userdata)
{
if ($userdata) {
$fromName = 'author site';
$fromEmail = 'noreply02@chinahighlights.net';
$toName = $userdata->a_name;
@ -252,9 +210,7 @@ class Login extends CI_Controller {
echo json_encode($data);
return FALSE;
}
}
else
{
} else {
$data[] = array('name' => 'no', 'value' => 'Error: Your email is incorrect!');
echo json_encode($data);
return FALSE;
@ -262,8 +218,7 @@ class Login extends CI_Controller {
}
//退出登录清空session
public function out()
{
public function out() {
$this->session->unset_userdata('session_admin');
$this->load->helper('cookie');
//delete_cookie("user_email");

@ -1,9 +1,11 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Taskhall extends CI_Controller {
function __construct()
{
function __construct() {
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
@ -12,18 +14,21 @@ class Taskhall extends CI_Controller {
$this->load->model('InfoSMS_model');
}
public function index($page=1)
{
public function index($page = 1) {
$data = array();
$data['author_rank_list'] = $this->Infotasks_model->get_author_rank_list();
$data['article_rank_list'] = $this->Infotasks_model->get_article_rank_list();
$t_td_type = $start_date = $tasktitle = false;
$end_date = date('Y-m-d');
if($this->input->get('tasktype') && $this->input->get('tasktype')!='-') $t_td_type=$this->input->get('tasktype');
if($this->input->get('startdate') && $this->input->get('startdate')!='') $start_date=$this->input->get('startdate');
if($this->input->get('enddate') && $this->input->get('enddate')!='') $end_date=$this->input->get('enddate');
if($this->input->get('tasktitle') && $this->input->get('tasktitle')!='') $tasktitle=$this->input->get('tasktitle');
if ($this->input->get('tasktype') && $this->input->get('tasktype') != '-')
$t_td_type = $this->input->get('tasktype');
if ($this->input->get('startdate') && $this->input->get('startdate') != '')
$start_date = $this->input->get('startdate');
if ($this->input->get('enddate') && $this->input->get('enddate') != '')
$end_date = $this->input->get('enddate');
if ($this->input->get('tasktitle') && $this->input->get('tasktitle') != '')
$tasktitle = $this->input->get('tasktitle');
//分页
$page_task = $this->Infotasks_model->get_tasks_list(false, 0, $t_td_type, $start_date, $end_date, $tasktitle, $page);
@ -50,11 +55,9 @@ class Taskhall extends CI_Controller {
$this->load->view('footer');
}
public function view($t_id)
{
public function view($t_id) {
$data['task'] = $this->Infotasks_model->detail($t_id);
if(empty($data['task']))
{
if (empty($data['task'])) {
show_404();
return false;
}
@ -67,28 +70,23 @@ class Taskhall extends CI_Controller {
}
//?н?????
public function undertake()
{
public function undertake() {
$admin_info = $this->session->userdata('session_admin');
$t_id = $this->input->post('t_id');
$task = $this->Infotasks_model->detail($t_id);
if(empty($task))
{
if (empty($task)) {
$data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_error_notfound'));
echo json_encode($data);
return false;
}
if(empty($task->t_a_id))
{
if (empty($task->t_a_id)) {
//?н?????
$this->Infotasks_model->undertake($t_id, $admin_info->a_id);
$data[] = array('name' => 'ok_modal', 'value' => $this->lang->line('task_undertake_success'));
$data[] = array('name' => 'ok_go', 'value' => site_url('welcome/view/' . $t_id));
echo json_encode($data);
return true;
}
else
{
} else {
$data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_has_undertake'));
echo json_encode($data);
return false;
@ -96,36 +94,30 @@ class Taskhall extends CI_Controller {
}
//ȡ??????
public function canceltake()
{
public function canceltake() {
$admin_info = $this->session->userdata('session_admin');
$t_id = $this->input->post('t_id');
$task = $this->Infotasks_model->detail($t_id);
if(empty($task))
{
if (empty($task)) {
$data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_error_notfound'));
echo json_encode($data);
return false;
}
if($task->t_a_id==$admin_info->a_id)
{
if ($task->t_a_id == $admin_info->a_id) {
//ȡ??????
$this->Infotasks_model->canceltake($t_id);
$data[] = array('name' => 'ok_modal', 'value' => $this->lang->line('task_canceltake_success'));
$data[] = array('name' => 'ok_go', 'value' => site_url('welcome/view/' . $t_id));
echo json_encode($data);
return true;
}
else
{
} else {
$data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_canceltake_error'));
echo json_encode($data);
return false;
}
}
public function notice($announce_id='',$announce_type='notice')
{
public function notice($announce_id = '', $announce_type = 'notice') {
$data = array();
$data['type'] = $announce_type;
if ($announce_id == '') {
@ -150,8 +142,7 @@ class Taskhall extends CI_Controller {
$this->notice($announce_id, 'announce');
}
public function help()
{
public function help() {
$data = array();
$data['nav_view'] = $this->load->view('nav_hall', array('nav_active' => 'help') + $data, true);
$this->load->view('header', array('navbar_active' => 'notice') + $data);

@ -1,10 +1,13 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Welcome extends CI_Controller {
public $all_unread_sms;
function __construct()
{
function __construct() {
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
@ -16,8 +19,7 @@ class Welcome extends CI_Controller {
}
//所有任务
public function index($page=1)
{
public function index($page = 1) {
$data = array();
$data = $this->_get_home_base_data();
//已完成任务使用另一模板
@ -33,9 +35,9 @@ class Welcome extends CI_Controller {
$this->load->view('tasklist');
$this->load->view('footer');
}
//正在编辑的任务
public function in_edit_tasks($page=1)
{
public function in_edit_tasks($page = 1) {
$data = array();
$data = $this->_get_home_base_data();
$task_list = $this->_get_task_list('edit', $page, site_url("welcome/in_edit_tasks"));
@ -46,9 +48,9 @@ class Welcome extends CI_Controller {
$this->load->view('welcome');
$this->load->view('footer');
}
//已经完成的任务
public function in_complete_tasks($page=1)
{
public function in_complete_tasks($page = 1) {
$data = array();
$data = $this->_get_home_base_data();
$task_list = $this->_get_task_list('complete', $page, site_url("welcome/in_complete_tasks"));
@ -64,9 +66,9 @@ class Welcome extends CI_Controller {
$this->load->view('in_complete');
$this->load->view('footer');
}
//未通过审核的投稿申请
public function in_refuse_tasks($page=1)
{
public function in_refuse_tasks($page = 1) {
$data = array();
$data = $this->_get_home_base_data();
$task_list = $this->_get_task_list('refuse', $page, site_url("welcome/in_refuse_tasks"));
@ -97,11 +99,16 @@ class Welcome extends CI_Controller {
function _get_task_list($t_status = false, $page = false, $pageurl = false) {
$t_td_type = $start_date = $tasktitle = false;
$end_date = date('Y-m-d');
if($this->input->get('tasktype') && $this->input->get('tasktype')!='-') $t_td_type=$this->input->get('tasktype');
if($this->input->get('startdate') && $this->input->get('startdate')!='') $start_date=$this->input->get('startdate');
if($this->input->get('enddate') && $this->input->get('enddate')!='') $end_date=$this->input->get('enddate');
if($this->input->get('tasktitle') && $this->input->get('tasktitle')!='') $tasktitle=$this->input->get('tasktitle');
if(!$t_status && $this->input->get('taskstatus') && $this->input->get('taskstatus')!='-') $t_status=$this->input->get('taskstatus');
if ($this->input->get('tasktype') && $this->input->get('tasktype') != '-')
$t_td_type = $this->input->get('tasktype');
if ($this->input->get('startdate') && $this->input->get('startdate') != '')
$start_date = $this->input->get('startdate');
if ($this->input->get('enddate') && $this->input->get('enddate') != '')
$end_date = $this->input->get('enddate');
if ($this->input->get('tasktitle') && $this->input->get('tasktitle') != '')
$tasktitle = $this->input->get('tasktitle');
if (!$t_status && $this->input->get('taskstatus') && $this->input->get('taskstatus') != '-')
$t_status = $this->input->get('taskstatus');
$admin_info = $this->session->userdata('session_admin');
//分页
@ -130,7 +137,8 @@ class Welcome extends CI_Controller {
//最新公告
$announce = $this->Infotaskarticles_model->get_announce('', 'announce');
$data['announce'] = array();
if(!empty($announce))$data['announce']=$announce;
if (!empty($announce))
$data['announce'] = $announce;
$data['notice_list'] = $this->Infotaskarticles_model->get_announce();
$data['avatar'] = get_author_photo();
$data['rank_view'] = $this->load->view('rank', $data, true);
@ -139,20 +147,17 @@ class Welcome extends CI_Controller {
return $data;
}
public function view($t_id)
{
public function view($t_id) {
$data = array();
$data['task'] = $this->Infotasks_model->detail($t_id);
$admin_info = $this->session->userdata('session_admin');
if(empty($data['task']))
{
if (empty($data['task'])) {
show_404();
return false;
}
$data['task_detail'] = $this->Infotaskarticles_model->detail($data['task']->t_id);
$data['task_last_version'] = $this->Infotaskarticles_model->version_last($data['task']->t_id);
if(!empty($data['task_detail']))
{
if (!empty($data['task_detail'])) {
$data['information'] = $this->Infotaskarticles_model->get_information($data['task_detail']->ta_ic_id);
if (isset($data['information']->ic_sitecode)) {
$sitedata = $this->config->item('site');
@ -167,8 +172,7 @@ class Welcome extends CI_Controller {
return false;
}
switch ($data['task']->t_status)
{
switch ($data['task']->t_status) {
case 'published':
case 'complete':
$data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_complete') + $data, true);
@ -196,10 +200,8 @@ class Welcome extends CI_Controller {
//获取短消息列表
$data['sms_list'] = $this->InfoSMS_model->get_task_sms($data['task']->t_id);
$admin_info = $this->session->userdata('session_admin');
foreach($data['sms_list'] as $sms)
{
if($sms->m_receiver==$admin_info->a_id)
{
foreach ($data['sms_list'] as $sms) {
if ($sms->m_receiver == $admin_info->a_id) {
$this->InfoSMS_model->readed($sms->m_id);
}
}
@ -213,8 +215,7 @@ class Welcome extends CI_Controller {
$this->load->view('footer');
}
public function edit_submit($task_submit=false)
{
public function edit_submit($task_submit = false) {
$t_id = $this->input->post('t_id');
$task = $this->Infotasks_model->detail($t_id);
$admin_info = $this->session->userdata('session_admin');
@ -233,8 +234,7 @@ class Welcome extends CI_Controller {
} */
$task_original = $this->Infotaskarticles_model->detail_original($t_id);
if(empty($task_original))
{
if (empty($task_original)) {
if (!empty($task_used)) {
//把原始任务状态改为original防止原始任务信息被删除
$this->Infotaskarticles_model->set_original($task_used->ta_id);
@ -249,11 +249,8 @@ class Welcome extends CI_Controller {
echo json_encode($data);
}
return true;
}
else
{
if(empty($task_used))
{
} else {
if (empty($task_used)) {
$data[] = array('name' => 'no', 'value' => $this->lang->line('task_error_notfound'));
echo json_encode($data);
return false;
@ -270,10 +267,8 @@ class Welcome extends CI_Controller {
}
}
public function review_submit()
{
if($this->edit_submit(true))
{
public function review_submit() {
if ($this->edit_submit(true)) {
$this->Infotaskarticles_model->add($this->input->post('t_id'), $this->input->post('ta_ic_id'), $this->input->post('ta_title')
, $this->input->post('ta_content'), $this->input->post('ta_summary'), $this->input->post('ta_seo_title')
, $this->input->post('ta_seo_description'), $this->input->post('ta_seo_keywords')
@ -288,29 +283,23 @@ class Welcome extends CI_Controller {
}
//发送短消息给管理员
public function send_to_admin()
{
public function send_to_admin() {
$t_id = $this->input->post('t_id');
$task = $this->Infotasks_model->detail($t_id);
if(empty($task))
{
if (empty($task)) {
$data[] = array('name' => 'no', 'value' => $this->lang->line('task_error_notfound'));
echo json_encode($data);
return false;
}
$this->form_validation->set_rules('m_content', 'lang:task_m_content', 'required');
if ($this->form_validation->run() == FALSE)
{
if ($this->form_validation->run() == FALSE) {
$data = array();
foreach ($this->form_validation->_error_array as $key => $value)
{
foreach ($this->form_validation->_error_array as $key => $value) {
$data[] = array('name' => $key, 'value' => $value);
}
echo json_encode($data);
return false;
}
else
{
} else {
$this->InfoSMS_model->add('task', $task->t_id, $task->t_ht_op_code, $task->t_a_id, $this->input->post('m_content'));
$data[] = array('name' => 'ok', 'value' => $this->lang->line('send_sms_success'));
echo json_encode($data);
@ -323,8 +312,7 @@ class Welcome extends CI_Controller {
}
}
public function create_task()
{
public function create_task() {
$data = array();
$data = $this->_get_home_base_data();
$data['nav_view'] = $this->load->view('nav_hall', array('nav_active' => 'create_task') + $data, true);
@ -333,34 +321,22 @@ class Welcome extends CI_Controller {
$this->load->view('footer');
}
public function create_task_submit()
{
public function create_task_submit() {
$this->form_validation->set_rules('t_title', 'lang:t_title', 'required');
$this->form_validation->set_rules('t_content', 'lang:t_content', 'required');
$this->form_validation->set_rules('t_expires', 'lang:t_expires', 'required');
if ($this->form_validation->run() == FALSE)
{
if ($this->form_validation->run() == FALSE) {
$data = array();
foreach ($this->form_validation->_error_array as $key => $value)
{
foreach ($this->form_validation->_error_array as $key => $value) {
$data[] = array('name' => $key, 'value' => $value);
}
echo json_encode($data);
return false;
}
else
{
} else {
//TODO:暂时把稿件全部发给RURU(zzy),今后会读取各站点的管理员名单
$admin_info = $this->session->userdata('session_admin');
$this->Infotasks_model->add(
$this->input->post('t_title'),
$this->input->post('t_content'),
$admin_info->a_id,
'Gavin',
'contribute',
$this->input->post('t_expires'),
'wait',
$this->input->post('t_attach')
$this->input->post('t_title'), $this->input->post('t_content'), $admin_info->a_id, 'Gavin', 'contribute', $this->input->post('t_expires'), 'wait', $this->config->item('site_code'), $this->input->post('t_attach')
);
$this->Infotaskarticles_model->add($this->Infotasks_model->insert_id, 0, '', '', '', '', '', '', '');
$this->InfoSMS_model->add('task', $this->Infotasks_model->insert_id, 'Gavin', $admin_info->a_id, 'I have submitted a proposal; please check!');
@ -383,13 +359,10 @@ class Welcome extends CI_Controller {
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
if (!$this->upload->do_upload($upload_id))
{
if (!$this->upload->do_upload($upload_id)) {
$error = array('error' => $this->upload->display_errors());
var_dump($error);
}
else
{
} else {
$data = array('upload_data' => $this->upload->data());
$file_name = $data['upload_data']['file_name'];
echo "<script>parent.$jsfunction('$file_name');</script>";
@ -401,11 +374,9 @@ class Welcome extends CI_Controller {
$this->form_validation->set_rules('t_title', 'lang:t_title', 'required');
$this->form_validation->set_rules('t_content', 'lang:t_content', 'required');
$this->form_validation->set_rules('t_expires', 'lang:t_expires', 'required');
if ($this->form_validation->run() == FALSE)
{
if ($this->form_validation->run() == FALSE) {
$data = array();
foreach ($this->form_validation->_error_array as $key => $value)
{
foreach ($this->form_validation->_error_array as $key => $value) {
$data[] = array('name' => $key, 'value' => $value);
}
echo json_encode($data);
@ -413,14 +384,7 @@ class Welcome extends CI_Controller {
} else {
//更新任务状态
$result = $this->Infotasks_model->update(
$this->input->post('t_id'),
$this->input->post('t_title'),
$this->input->post('t_content'),
$this->input->post('t_a_id'),
'contribute',
$this->input->post('t_expires'),
'wait',
$this->input->post('t_attach')
$this->input->post('t_id'), $this->input->post('t_title'), $this->input->post('t_content'), $this->input->post('t_a_id'), 'contribute', $this->input->post('t_expires'), 'wait', $this->input->post('t_attach')
);
if ($result) {
$this->InfoSMS_model->add('task', $this->input->post('t_id'), 'Gavin', $this->input->post('t_a_id'), 'I have submitted a proposal; please check!');
@ -469,7 +433,8 @@ class Welcome extends CI_Controller {
$enddate = strtotime($enddate);
}
if ($startdate > $enddate) {
echo "please check your date";die();
echo "please check your date";
die();
}
//查取google分析数据
$data['analytics_list'] = $this->Infotaskarticles_model->get_analytics_list($pagepath, $sitecode, 50, $startdate, $enddate);
@ -492,8 +457,7 @@ class Welcome extends CI_Controller {
$this->load->view('analytics', $data);
}
public function set_readed($m_id)
{
public function set_readed($m_id) {
$this->InfoSMS_model->readed($m_id);
echo 'ok';
}
@ -521,27 +485,20 @@ class Welcome extends CI_Controller {
}
//保存自定义配置
function save_meta()
{
function save_meta() {
$this->load->model('InfoMetas_model');
$im_ic_id = $this->input->post('im_ic_id');
$im_key = $this->input->post('im_key');
$im_value = $this->input->post('im_value');
if($im_ic_id && $im_key && $im_value!==false)
{
if ($im_ic_id && $im_key && $im_value !== false) {
$meta = $this->InfoMetas_model->get($im_ic_id, $im_key);
if($meta===false)
{
if ($meta === false) {
$this->InfoMetas_model->add($im_ic_id, $im_key, $im_value);
}
else
{
} else {
$this->InfoMetas_model->update($im_ic_id, $im_key, $im_value);
}
$data[] = array('name' => 'ok', 'value' => 'success');
}
else
{
} else {
$data[] = array('name' => 'no', 'value' => 'error');
}
echo json_encode($data);
@ -549,18 +506,14 @@ class Welcome extends CI_Controller {
}
//保存自定义配置
function delete_meta()
{
function delete_meta() {
$this->load->model('InfoMetas_model');
$im_ic_id = $this->input->post('im_ic_id');
$im_key = $this->input->post('im_key');
if($im_ic_id && $im_key)
{
if ($im_ic_id && $im_key) {
$this->InfoMetas_model->delete($im_ic_id, $im_key);
$data[] = array('name' => 'ok', 'value' => 'success');
}
else
{
} else {
$data[] = array('name' => 'no', 'value' => 'error');
}
echo json_encode($data);

@ -6,28 +6,26 @@ if (!defined('BASEPATH'))
* 访问权限管理
*/
class Permission
{
class Permission {
var $CI;
public function __construct()
{
public function __construct() {
$this->CI = & get_instance();
log_message('debug', "Access permission Class Initialized");
}
function is_admin($auto_redirect=true)
{
if ($this->CI->session->userdata('session_admin') === FALSE)
{
function is_admin($auto_redirect = true) {
$session_admin = $this->CI->session->userdata('session_admin');
if (empty($session_admin)) {
if ($auto_redirect) {
redirect(site_url('login'));
}
else
{
} else {
return false;
}
} else {
//设置站点代号为用户所属站点
$this->CI->config->set_item('site_code', isset($session_admin->a_sitecode) ? $session_admin->a_sitecode : 'cht');
}
}

@ -1,7 +1,6 @@
<?php
class Infoauthors_model extends CI_Model
{
class Infoauthors_model extends CI_Model {
var $top_num = false;
var $a_active = false;
@ -9,14 +8,12 @@ class Infoauthors_model extends CI_Model
var $a_email = false;
var $order_by = false;
function __construct()
{
function __construct() {
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
}
function init()
{
function init() {
$this->top_num = false;
$this->a_active = false;
$this->a_id = false;
@ -25,8 +22,7 @@ class Infoauthors_model extends CI_Model
}
//输入用户名和密码,检查是否可以正确
function check_login($email, $password)
{
function check_login($email, $password) {
$sql = "SELECT TOP 1 1 \n"
. "FROM infoAuthors ia \n"
. "WHERE ia.a_email = ? \n"
@ -34,12 +30,9 @@ class Infoauthors_model extends CI_Model
. " AND ia.a_active = 1 ";
$query = $this->HT->query($sql, array($email, $password));
//print_r($this->HT->queries);
if ($query->num_rows() > 0)
{
if ($query->num_rows() > 0) {
return TRUE;
}
else
{
} else {
return FALSE;
}
}
@ -51,35 +44,29 @@ class Infoauthors_model extends CI_Model
. "WHERE ia.a_email = ? \n"
. " AND ia.a_active != 2 ";
$query = $this->HT->query($sql, array($email));
if ($query->num_rows() > 0)
{
if ($query->num_rows() > 0) {
return TRUE;
}
else
{
} else {
return FALSE;
}
}
//已激活作者列表
function active_list()
{
function active_list() {
$this->init();
$this->a_active = " AND ia.a_active = 1 ";
return $this->get_list();
}
//待激活作者列表
function un_active_list()
{
function un_active_list() {
$this->init();
$this->a_active = " AND ia.a_active = 0 ";
return $this->get_list();
}
//获取登录用户详细信息
function detail($email)
{
function detail($email) {
$this->init();
$this->top_num = 1;
$this->a_active = " AND ia.a_active <> 2 ";
@ -88,8 +75,7 @@ class Infoauthors_model extends CI_Model
}
//获取登录用户详细信息
function detail_by_id($a_id)
{
function detail_by_id($a_id) {
$this->init();
$this->top_num = 1;
$this->a_active = " AND ia.a_active <> 2 ";
@ -97,10 +83,8 @@ class Infoauthors_model extends CI_Model
return $this->get_list();
}
//获取用户列表
function get_list()
{
function get_list() {
$this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT ";
$sql .= " ia.a_id, \n"
. " ia.a_email, \n"
@ -118,7 +102,7 @@ class Infoauthors_model extends CI_Model
. " ia.a_bank_card, \n"
. " ia.a_resume, \n"
. " ia.a_datetime, \n"
. " ia.a_sitecode, \n"
. " ISNULL(ia.a_sitecode,'cht') as a_sitecode, \n"
. " ia.a_active \n"
. "FROM infoAuthors ia \n"
. "WHERE 1 = 1 \n";
@ -127,27 +111,20 @@ class Infoauthors_model extends CI_Model
$this->a_email ? $sql.=$this->a_email : false;
$this->order_by ? $sql.=$this->order_by : false;
$query = $this->HT->query($sql);
if($this->top_num==1)
{
if ($query->num_rows() > 0)
{
if ($this->top_num == 1) {
if ($query->num_rows() > 0) {
$row = $query->row();
return $row;
}
else
{
} else {
return FALSE;
}
}
else
{
} else {
return $query->result();
}
}
//用户注册
function add($a_email, $a_password, $a_name, $a_name_cn,$a_photo, $a_mobile_phone, $a_phone, $a_id_card, $a_gender, $a_address, $a_school, $a_bank, $a_bank_card, $a_resume)
{
function add($a_email, $a_password, $a_name, $a_name_cn, $a_photo, $a_mobile_phone, $a_phone, $a_id_card, $a_gender, $a_address, $a_school, $a_bank, $a_bank_card, $a_resume) {
$sql = "INSERT INTO infoAuthors \n"
. " ( \n"
. " a_email, \n"
@ -176,8 +153,7 @@ class Infoauthors_model extends CI_Model
}
//更新用户资料
function update($a_id,$a_email, $a_name, $a_name_cn,$a_photo, $a_mobile_phone, $a_phone, $a_id_card, $a_gender, $a_address, $a_school, $a_bank, $a_bank_card, $a_resume)
{
function update($a_id, $a_email, $a_name, $a_name_cn, $a_photo, $a_mobile_phone, $a_phone, $a_id_card, $a_gender, $a_address, $a_school, $a_bank, $a_bank_card, $a_resume) {
$sql = "UPDATE infoAuthors \n"
. "SET a_email = ?, \n"
. " a_name = ?, \n"
@ -198,8 +174,7 @@ class Infoauthors_model extends CI_Model
}
//设置密码
function set_password($a_id,$a_password)
{
function set_password($a_id, $a_password) {
$sql = "UPDATE infoAuthors \n"
. "SET a_password = ? \n"
. "WHERE a_id = ?";
@ -208,8 +183,7 @@ class Infoauthors_model extends CI_Model
}
//修改用户审核状态
function reviwed($a_id,$a_active)
{
function reviwed($a_id, $a_active) {
$sql = "UPDATE infoAuthors \n"
. "SET a_active = ? \n"
. "WHERE a_id = ? ";

@ -1,7 +1,7 @@
<?php
class Infotaskarticles_model extends CI_Model
{
class Infotaskarticles_model extends CI_Model {
var $insert_id = -1;
var $top_num = false;
var $ta_id = false;
@ -9,14 +9,12 @@ class Infotaskarticles_model extends CI_Model
var $order_by = false;
var $ta_status = false;
function __construct()
{
function __construct() {
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
}
function init()
{
function init() {
$this->top_num = false;
$this->ta_id = false;
$this->ta_t_id = false;
@ -25,8 +23,7 @@ class Infotaskarticles_model extends CI_Model
}
//获取版本列表
function version_list($ta_t_id)
{
function version_list($ta_t_id) {
$this->init();
$this->ta_status = " AND i.ta_status= 'version' ";
$this->ta_t_id = " AND i.ta_t_id= " . $this->HT->escape($ta_t_id);
@ -34,8 +31,7 @@ class Infotaskarticles_model extends CI_Model
}
//获取最后的版本
function version_last($ta_t_id)
{
function version_last($ta_t_id) {
$sql = "SELECT TOP 1
i.ta_id,
i.ta_t_id,
@ -57,20 +53,16 @@ class Infotaskarticles_model extends CI_Model
LEFT JOIN infoContents ic ON ic.ic_id=i.ta_ic_id
WHERE 1 = 1 AND i.ta_status= 'version' AND i.ta_t_id= " . $this->HT->escape($ta_t_id) . "ORDER BY i.ta_id DESC";
$query = $this->HT->query($sql);
if ($query->num_rows() > 0)
{
if ($query->num_rows() > 0) {
$row = $query->row();
return $row;
}
else
{
} else {
return FALSE;
}
}
//获取当前编辑版本
function detail($ta_t_id)
{
function detail($ta_t_id) {
$this->init();
$this->top_num = 1;
$this->ta_status = " AND i.ta_status= 'used' ";
@ -79,10 +71,8 @@ class Infotaskarticles_model extends CI_Model
}
//获取原始版本版本
function detail_original($ta_t_id)
{
if(empty($ta_t_id))
{
function detail_original($ta_t_id) {
if (empty($ta_t_id)) {
return false;
}
$this->init();
@ -93,8 +83,7 @@ class Infotaskarticles_model extends CI_Model
}
//设置审核字数和金额
function update_review($ta_t_id,$ta_count,$ta_charge)
{
function update_review($ta_t_id, $ta_count, $ta_charge) {
$sql = "UPDATE infotaskarticles \n"
. "SET ta_count = ? , \n"
. " ta_charge = ? \n"
@ -109,8 +98,7 @@ class Infotaskarticles_model extends CI_Model
return $this->HT->query($sql, array($ta_count, $ta_charge, $ta_t_id));
}
function get_list()
{
function get_list() {
$this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT ";
$sql .= " i.ta_id, \n"
. " i.ta_t_id, \n"
@ -134,27 +122,20 @@ class Infotaskarticles_model extends CI_Model
$this->ta_status ? $sql.=$this->ta_status : false;
$this->order_by ? $sql.=$this->order_by : false;
$query = $this->HT->query($sql);
if($this->top_num==1)
{
if ($query->num_rows() > 0)
{
if ($this->top_num == 1) {
if ($query->num_rows() > 0) {
$row = $query->row();
return $row;
}
else
{
} else {
return FALSE;
}
}
else
{
} else {
return $query->result();
}
}
//写入
function add($ta_t_id,$ta_ic_id, $ta_title, $ta_content, $ta_summary, $ta_seo_title, $ta_seo_description, $ta_seo_keywords, $ta_photo,$ta_status='used')
{
function add($ta_t_id, $ta_ic_id, $ta_title, $ta_content, $ta_summary, $ta_seo_title, $ta_seo_description, $ta_seo_keywords, $ta_photo, $ta_status = 'used') {
$sql = " INSERT INTO infotaskarticles \n"
. " ( \n"
. " ta_t_id, \n"
@ -181,8 +162,7 @@ class Infotaskarticles_model extends CI_Model
//print_r($this->HT->queries);
}
function update($ta_id, $ta_title, $ta_content, $ta_summary, $ta_seo_title, $ta_seo_description, $ta_seo_keywords, $ta_photo)
{
function update($ta_id, $ta_title, $ta_content, $ta_summary, $ta_seo_title, $ta_seo_description, $ta_seo_keywords, $ta_photo) {
$sql = "UPDATE infotaskarticles \n"
. "SET ta_title = N?, \n"
. " ta_content = N?, \n"
@ -196,10 +176,8 @@ class Infotaskarticles_model extends CI_Model
return $this->HT->query($sql, array($ta_title, $ta_content, $ta_summary, $ta_seo_title, $ta_seo_description, $ta_seo_keywords, $ta_photo, $ta_id));
}
//设置任务为原始版本状态
function set_original($ta_id)
{
function set_original($ta_id) {
$sql = "UPDATE infotaskarticles \n"
. "SET ta_status = 'original' \n"
. "WHERE ta_id = ? ";
@ -208,8 +186,7 @@ class Infotaskarticles_model extends CI_Model
//关联任务到信息平台
//把所有任务都关联到新的信息中
function link($ta_id,$ta_ic_id)
{
function link($ta_id, $ta_ic_id) {
$sql = "UPDATE infotaskarticles \n"
. "SET ta_ic_id = ? \n"
. "WHERE ta_t_id IN (SELECT TOP 1 ita.ta_t_id \n"
@ -220,8 +197,7 @@ class Infotaskarticles_model extends CI_Model
}
//获取网前url和标题等
function get_information($ta_id)
{
function get_information($ta_id) {
$sql = "SELECT TOP 1 \n"
. " ic.ic_url, \n"
. " ic.ic_sitecode, \n"
@ -230,13 +206,10 @@ class Infotaskarticles_model extends CI_Model
. "WHERE ic_status = 1 \n"
. " AND ic.ic_id = ?";
$query = $this->HT->query($sql, array($ta_id));
if ($query->num_rows() > 0)
{
if ($query->num_rows() > 0) {
$row = $query->row();
return $row;
}
else
{
} else {
return FALSE;
}
}
@ -262,7 +235,8 @@ class Infotaskarticles_model extends CI_Model
//根据页面路径获取指定信息页的成效信息
public function get_analytics_list($kwa_pagepath, $kwa_sitecode, $top = 50, $startdate = '', $enddate = '') {
$topsql = '';
if($top!=0) $topsql="TOP $top";
if ($top != 0)
$topsql = "TOP $top";
if ($startdate == '') {
$startdate = time() - 7 * 24 * 60 * 60;
}
@ -299,4 +273,5 @@ class Infotaskarticles_model extends CI_Model
}
return $num;
}
}

@ -1,7 +1,7 @@
<?php
class Infotasks_model extends CI_Model
{
class Infotasks_model extends CI_Model {
var $insert_id = -1;
var $top_num = false;
var $t_id = false;
@ -13,14 +13,12 @@ class Infotasks_model extends CI_Model
var $t_title = false;
var $t_td_type = false;
function __construct()
{
function __construct() {
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
}
function init()
{
function init() {
$this->top_num = false;
$this->t_id = false;
$this->order_by = " ORDER BY t.t_id DESC ";
@ -32,17 +30,12 @@ class Infotasks_model extends CI_Model
}
//正在编辑的任务
function in_edit($t_ht_op_code=false)
{
function in_edit($t_ht_op_code = false) {
$this->init();
if(!empty($t_ht_op_code))
{
if(is_numeric($t_ht_op_code))
{
if (!empty($t_ht_op_code)) {
if (is_numeric($t_ht_op_code)) {
$this->t_a_id = " AND t.t_a_id= " . $this->HT->escape($t_ht_op_code);
}
else
{
} else {
$this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code);
}
}
@ -51,34 +44,29 @@ class Infotasks_model extends CI_Model
}
//根据任务状态获取任务列表
function get_task_by_status($t_ht_op_code=false,$t_status=false)
{
function get_task_by_status($t_ht_op_code = false, $t_status = false) {
$this->init();
if(!empty($t_ht_op_code))
{
if (!empty($t_ht_op_code)) {
if (is_numeric($t_ht_op_code)) {
$this->t_a_id = " AND t.t_a_id= " . $this->HT->escape($t_ht_op_code);
} else {
$this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code);
}
}
if($t_status) $this->t_status=" AND t.t_status= '$t_status' ";
if($t_status=='review') $this->t_status=" AND (t.t_status= 'review' OR t.t_status= 'wait')";
if ($t_status)
$this->t_status = " AND t.t_status= '$t_status' ";
if ($t_status == 'review')
$this->t_status = " AND (t.t_status= 'review' OR t.t_status= 'wait')";
return $this->get_list();
}
//待审核任务
function in_review($t_ht_op_code=false)
{
function in_review($t_ht_op_code = false) {
$this->init();
if(!empty($t_ht_op_code))
{
if(is_numeric($t_ht_op_code))
{
if (!empty($t_ht_op_code)) {
if (is_numeric($t_ht_op_code)) {
$this->t_a_id = " AND t.t_a_id= " . $this->HT->escape($t_ht_op_code);
}
else
{
} else {
$this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code);
}
}
@ -87,17 +75,12 @@ class Infotasks_model extends CI_Model
}
//待结算任务
function in_reviewed($t_ht_op_code=false)
{
function in_reviewed($t_ht_op_code = false) {
$this->init();
if(!empty($t_ht_op_code))
{
if(is_numeric($t_ht_op_code))
{
if (!empty($t_ht_op_code)) {
if (is_numeric($t_ht_op_code)) {
$this->t_a_id = " AND t.t_a_id= " . $this->HT->escape($t_ht_op_code);
}
else
{
} else {
$this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code);
}
}
@ -106,38 +89,30 @@ class Infotasks_model extends CI_Model
}
//已完成任务
function in_complete($t_ht_op_code=false,$start_date=false,$end_date=false,$t_title=false)
{
function in_complete($t_ht_op_code = false, $start_date = false, $end_date = false, $t_title = false) {
$this->init();
if(!empty($t_ht_op_code))
{
if(is_numeric($t_ht_op_code))
{
if (!empty($t_ht_op_code)) {
if (is_numeric($t_ht_op_code)) {
$this->t_a_id = " AND t.t_a_id= " . $this->HT->escape($t_ht_op_code);
}
else
{
} else {
$this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code);
}
}
if($t_title) $this->t_title = " AND t.t_title like '%$t_title%' ";
if($start_date) $this->t_datetime = " AND t.t_datetime BETWEEN '$start_date' AND '$end_date' ";
if ($t_title)
$this->t_title = " AND t.t_title like '%$t_title%' ";
if ($start_date)
$this->t_datetime = " AND t.t_datetime BETWEEN '$start_date' AND '$end_date' ";
$this->t_status = " AND (t.t_status= 'complete' OR t.t_status= 'published')";
return $this->get_list();
}
//正在编辑的任务
function in_refuse($t_ht_op_code=false)
{
function in_refuse($t_ht_op_code = false) {
$this->init();
if(!empty($t_ht_op_code))
{
if(is_numeric($t_ht_op_code))
{
if (!empty($t_ht_op_code)) {
if (is_numeric($t_ht_op_code)) {
$this->t_a_id = " AND t.t_a_id= " . $this->HT->escape($t_ht_op_code);
}
else
{
} else {
$this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code);
}
}
@ -146,24 +121,21 @@ class Infotasks_model extends CI_Model
}
//大厅任务
function in_hall()
{
function in_hall() {
$this->init();
$this->t_a_id=" AND t.t_a_id= 0 ";
$this->t_a_id = " AND t.t_a_id<= 0 ";
return $this->get_list();
}
//获取单个任务详细信息
function detail($t_id)
{
function detail($t_id) {
$this->init();
$this->top_num = 1;
$this->t_id = " AND t.t_id=" . $this->HT->escape($t_id);
return $this->get_list();
}
function get_list($get_count=false)
{
function get_list($get_count = false) {
$this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT ";
$sql .= " t.t_id, \n"
. " t.t_title, \n"
@ -176,10 +148,12 @@ class Infotasks_model extends CI_Model
. " t.t_datetime, \n"
. " t.t_rating, \n"
. " t.t_attach, \n"
. " t.t_sitecode, \n"
. " t.t_delete \n"
. "FROM infotasks t \n"
. "WHERE t.t_delete = 0 \n";
if($get_count)$sql="SELECT t.t_id FROM infotasks t WHERE t.t_delete = 0";
if ($get_count)
$sql = "SELECT t.t_id FROM infotasks t WHERE t.t_delete = 0";
$this->t_id ? $sql.=$this->t_id : false;
$this->t_status ? $sql.=$this->t_status : false;
$this->t_ht_op_code ? $sql.=$this->t_ht_op_code : false;
@ -187,33 +161,29 @@ class Infotasks_model extends CI_Model
$this->t_td_type ? $sql.=$this->t_td_type : false;
$this->t_title ? $sql.=$this->t_title : false;
$admin_info=$this->session->userdata('session_admin');
if(!empty($admin_info->a_sitecode) && trim($this->t_a_id)=="AND t.t_a_id= 0") $sql.= " AND (t.t_sitecode= '$admin_info->a_sitecode' or t.t_sitecode is null) ";
// $admin_info = $this->session->userdata('session_admin');
// if (!empty($admin_info->a_sitecode) && trim($this->t_a_id) == "AND t.t_a_id= 0")
// $sql.= " AND (t.t_sitecode= '$admin_info->a_sitecode' or t.t_sitecode is null) ";
$sql.= " AND t.t_sitecode= " . $this->HT->escape($this->config->item('site_code'));
$this->t_datetime ? $sql.=$this->t_datetime : false;
$this->order_by ? $sql.=$this->order_by : false;
$query = $this->HT->query($sql);
if($this->top_num==1)
{
if ($query->num_rows() > 0)
{
//print_r($this->HT->queries);
if ($this->top_num == 1) {
if ($query->num_rows() > 0) {
$row = $query->row();
return $row;
}
else
{
} else {
return FALSE;
}
}
else
{
} else {
return $query->result();
}
}
//根据给定id字符串获取任务列表
function get_list_by_taskids($taskids)
{
function get_list_by_taskids($taskids) {
$sql = "SELECT t.t_id,
t.t_title,
t.t_content,
@ -234,8 +204,7 @@ class Infotasks_model extends CI_Model
}
//根据不同状态获取任务列表
public function get_tasks_list($t_status=false,$t_ht_op_code=false,$t_td_type=false,$start_date=false,$end_date=false,$tasktitle=false,$page_flag=false)
{
public function get_tasks_list($t_status = false, $t_ht_op_code = false, $t_td_type = false, $start_date = false, $end_date = false, $tasktitle = false, $page_flag = false) {
$this->init();
if (!empty($t_ht_op_code)) {
if (is_numeric($t_ht_op_code)) {
@ -244,31 +213,27 @@ class Infotasks_model extends CI_Model
$this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code);
}
} else {
$this->t_a_id=" AND t.t_a_id= 0";
$this->t_a_id = " AND t.t_a_id<= 0";
}
//已发布的和已完成的任务计算在已完成的任务里
if($t_status=='complete')
{
if ($t_status == 'complete') {
$this->t_status = " AND (t.t_status= 'complete' OR t.t_status= 'published') ";
}
else if($t_status=='review')
{
} else if ($t_status == 'review') {
$this->t_status = " AND (t.t_status= 'review' OR t.t_status= 'wait')";
}
else if($t_status)
{
} else if ($t_status) {
$this->t_status = " AND t.t_status = '$t_status' ";
}
if($t_td_type) $this->t_td_type = " AND t.t_td_type = '$t_td_type' ";
if($tasktitle) $this->t_title = " AND t.t_title like '%$tasktitle%' ";
if($start_date) $this->t_datetime = " AND t.t_datetime BETWEEN '$start_date' AND '$end_date' ";
if ($t_td_type)
$this->t_td_type = " AND t.t_td_type = '$t_td_type' ";
if ($tasktitle)
$this->t_title = " AND t.t_title like '%$tasktitle%' ";
if ($start_date)
$this->t_datetime = " AND t.t_datetime BETWEEN '$start_date' AND '$end_date' ";
return $this->get_list($page_flag);
}
//写入
function add($t_title, $t_content, $t_a_id, $t_ht_op_code, $t_td_type, $t_expires,$t_status='edit',$t_attach=NULL)
{
function add($t_title, $t_content, $t_a_id, $t_ht_op_code, $t_td_type, $t_expires, $t_status = 'edit', $t_sitecode, $t_attach = NULL) {
$sql = "INSERT INTO infotasks \n"
. " ( \n"
. " t_title, \n"
@ -278,23 +243,23 @@ class Infotasks_model extends CI_Model
. " t_td_type, \n"
. " t_expires, \n"
. " t_status, \n"
. " t_sitecode, \n"
. " t_delete, \n"
. " t_datetime, \n"
. " t_attach \n"
. " ) \n"
. "VALUES \n"
. " ( \n"
. " N?,N?,?,?,?,?,?,0,GETDATE(),? \n"
. " N?,N?,?,?,?,?,?,?,0,GETDATE(),? \n"
. " )";
$query=$this->HT->query($sql, array($t_title, $t_content, $t_a_id, $t_ht_op_code, $t_td_type, $t_expires,$t_status,$t_attach));
$query = $this->HT->query($sql, array($t_title, $t_content, $t_a_id, $t_ht_op_code, $t_td_type, $t_expires, $t_status, $t_sitecode, $t_attach));
$this->insert_id = $this->HT->last_id('infotasks');
return $query;
//print_r($this->HT->queries);
}
//更新
function update($t_id,$t_title, $t_content, $t_a_id, $t_td_type, $t_expires,$t_status='',$t_attach=false)
{
function update($t_id, $t_title, $t_content, $t_a_id, $t_td_type, $t_expires, $t_status = '', $t_attach = false) {
$t_status_sql = '';
if ($t_status != '') {
$t_status_sql = "t_status='$t_status',";
@ -317,8 +282,7 @@ class Infotasks_model extends CI_Model
}
//删除
function delete($t_id)
{
function delete($t_id) {
$sql = "UPDATE infotasks \n"
. "SET t_delete = 1 \n"
. "WHERE t_id = ?";
@ -327,8 +291,7 @@ class Infotasks_model extends CI_Model
}
//审核
function reviwed($t_id,$t_status)
{
function reviwed($t_id, $t_status) {
$sql = "UPDATE infotasks \n"
. "SET t_status = ? \n"
. "WHERE t_id = ?";
@ -337,8 +300,7 @@ class Infotasks_model extends CI_Model
}
//承接任务
function undertake($t_id,$a_id)
{
function undertake($t_id, $a_id) {
$sql = "UPDATE infotasks \n"
. "SET t_a_id = ? \n"
. "WHERE t_id = ?";
@ -347,8 +309,7 @@ class Infotasks_model extends CI_Model
}
//取消任务
function canceltake($t_id)
{
function canceltake($t_id) {
$sql = "UPDATE infotasks \n"
. "SET t_a_id = 0 \n"
. "WHERE t_id = ?";
@ -422,11 +383,19 @@ class Infotasks_model extends CI_Model
$admin_info = $this->session->userdata('session_admin');
$t_ht_op_code = $admin_info->a_id;
if (is_numeric($t_ht_op_code)) {
$map=" t_a_id= ".$this->HT->escape($t_ht_op_code);
$where = " t_a_id= " . $this->HT->escape($t_ht_op_code);
} else {
$map=" t_ht_op_code=".$this->HT->escape($t_ht_op_code);
$where = " t_ht_op_code=" . $this->HT->escape($t_ht_op_code);
}
$sql="SELECT t_status, count(0) as task_count FROM infotasks WHERE $map AND t_delete=0 group by t_status";
$site_code = $this->config->item('site_code');
if ($site_code == 'cht') { //早期的任务没有设置站点默认是cht
$where.=" AND ( t_sitecode= '$site_code' OR t_sitecode is null )";
} else {
$where.=" AND t_sitecode= '$site_code' ";
}
$sql = "SELECT t_status, count(0) as task_count FROM infotasks WHERE $where AND t_delete=0 group by t_status";
$query = $this->HT->query($sql);
$result = $query->result();
$counts = array();
@ -436,18 +405,23 @@ class Infotasks_model extends CI_Model
}
//已完成数量=完成数量+已发布的数量
$complete_count = $published_count = 0;
if(isset($counts['complete']))$complete_count=$counts['complete'];
if(isset($counts['published']))$published_count=$counts['published'];
if (isset($counts['complete']))
$complete_count = $counts['complete'];
if (isset($counts['published']))
$published_count = $counts['published'];
$counts['complete'] = $complete_count + $published_count;
//正在进行中的任务=edit+unreviewed的数量
$edit_count = $unreviewed_count = 0;
if(isset($counts['edit']))$edit_count=$counts['edit'];
if (isset($counts['edit']))
$edit_count = $counts['edit'];
$counts['edit'] = $edit_count;
$review_count = $wait_count = 0;
if(isset($counts['review']))$review_count=$counts['review'];
if(isset($counts['wait']))$wait_count=$counts['wait'];
if (isset($counts['review']))
$review_count = $counts['review'];
if (isset($counts['wait']))
$wait_count = $counts['wait'];
$counts['review'] = $review_count + $wait_count;
return $counts;

@ -87,14 +87,6 @@
}
}
function get_analytics_ajax(formid,contentid,loadtotal){
var url= $("#"+formid).attr('action')+'/'+loadtotal;
var data = $("#"+formid).serialize();
$("#"+contentid).html('<img src="/css/images/loading.gif" >');
$.post(url,data,function(result){
$("#"+contentid).html(result);
});
}
</script>
<div class="row-fluid">
@ -128,9 +120,6 @@
<legend class="<?php if ($task_detail->ta_content == '') echo 'hide'; ?>">
<span>Task details</span>
<span class="pull-right <?php if(!isset($task_status) or $task_status==0) echo 'hide';?>" style="font-size:14px;" id="total-analytics">
<a href="javascript:void(0);" onClick="get_analytics_ajax('get-analytic-form','total-analytics','1');">获取google分析汇总数据</a>
</span>
</legend>
<form action="#" class="<?php if ($task_detail->ta_content == '') echo 'hide'; ?>" name="form_article" id="form_article" method="post">
<label class="control-label" >Title</label>
@ -156,7 +145,8 @@
</div>
<div class="media-body">
<button type="button" onclick="openKCFinder_ta_photo();" class="btn" style="margin:25px 0;">Choose</button><br>
<button type="button" onclick="$('#ta_photo').val('');$('#ta_photo_img').attr('src','/css/images/uploadPic.jpg');" class="btn" style="margin-bottom:12px;"> Reset </button>
<button type="button" onclick="$('#ta_photo').val('');
$('#ta_photo_img').attr('src', '/css/images/uploadPic.jpg');" class="btn" style="margin-bottom:12px;"> Reset </button>
<p>Click the “Choose” button<br> to choose a photo from our Photo Galleries.</p>
</div>
<input type="hidden" name="ta_photo" id="ta_photo" value="<?php if (isset($task_detail->ta_photo)) echo $task_detail->ta_photo; ?>" />
@ -167,12 +157,8 @@
</div>
</form>
<div class="btn-group pull-right" style="margin-bottom:50px;">
<?php empty($task->t_a_id)?$disabled='':$disabled=' style="display:none;" ';?>
<?php ($task->t_a_id<=0) ? $disabled = '' : $disabled = ' style="display:none;" '; ?>
<button class="btn btn-info" <?php echo $disabled; ?> data-toggle="modal" data-target="#undertake_modal">Accept the task</button>
<?php (!empty($task->t_a_id) && $task->t_status=='edit' )?$disabled='':$disabled=' style="display:none;" ';?>
<?php if(false){ // 不允许放弃任务 ?>
<button class="btn btn-info" <?php echo $disabled; ?> data-toggle="modal" data-target="#canceltake_modal">Give up the tasks</button>
<?php } ?>
<p> </p>
</div>

@ -730,6 +730,12 @@ class Index extends CI_Controller {
continue;
}
//检测是否是APP订单,默认不处理
if ((strpos($item->pn_memo, 'China Train Booking') !== false) || (strpos($item->pn_memo, 'ChinaTrainBooking') !== false)) { //APP自动出票的订单不需要处理
$this->Note_model->update_send($item->pn_txn_id, 'send');
continue;
}
//根据note信息找到订单号
$orderid_info = $this->analysis_orderid($item->pn_invoice);
if (empty($orderid_info)) {
@ -742,6 +748,7 @@ class Index extends CI_Controller {
$orderid_info = $this->analysis_orderid($item->pn_item_number);
}
//找不到订单号,设置为发送失败标示
if (empty($orderid_info)) {
$this->Note_model->update_send($item->pn_txn_id, 'sendfail');
@ -761,6 +768,7 @@ class Index extends CI_Controller {
//更新正确的订单信息到记录中,以这个为主
$this->Note_model->set_invoice($item->pn_txn_id, $orderid_info->orderid . '_' . $orderid_info->ordertype);
//检测是否是APP订单,默认不处理
if ($orderid_info->ordertype == 'A') { //APP自动出票的订单不需要处理
$this->Note_model->update_send($item->pn_txn_id, 'send');
continue;

Loading…
Cancel
Save