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

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

File diff suppressed because it is too large Load Diff

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

@ -49,6 +49,9 @@ class Login extends CI_Controller {
//站点切换 //站点切换
public function change_site($site_code) { 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->permission->is_admin();
$this->load->library('Accesscheck'); $this->load->library('Accesscheck');
@ -70,7 +73,6 @@ class Login extends CI_Controller {
} else { } else {
redirect(site_url()); redirect(site_url());
} }
return TRUE; return TRUE;
} }
@ -126,7 +128,7 @@ class Login extends CI_Controller {
$this->session->set_userdata('session_site', $site_item); $this->session->set_userdata('session_site', $site_item);
$this->session->set_userdata('session_color', ''); $this->session->set_userdata('session_color', '');
$data[] = array('name' => 'go', 'value' => site_url()); $data[] = array('name' => 'go', 'value' => site_url());
echo json_encode($data); echo json_encode($data);
return TRUE; return TRUE;
} }
@ -146,7 +148,7 @@ class Login extends CI_Controller {
//用户名和密码不正确,或者没有管理权限 //用户名和密码不正确,或者没有管理权限
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')); $data[] = array('name' => 'login_warning', 'value' => $this->lang->line('login_warning'));
echo json_encode($data); echo json_encode($data);
} }

@ -1,320 +1,286 @@
<?php <?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;
var $order_by = false;
var $t_status = false;
var $t_ht_op_code = false;
var $t_a_id = false;
var $t_td_type = false;
var $t_datetime = false;
var $t_title = false;
function __construct() var $insert_id = -1;
{ var $top_num = false;
var $t_id = false;
var $order_by = false;
var $t_status = false;
var $t_ht_op_code = false;
var $t_a_id = false;
var $t_td_type = false;
var $t_datetime = false;
var $t_title = false;
function __construct() {
parent::__construct(); parent::__construct();
$this->HT = $this->load->database('HT', TRUE); $this->HT = $this->load->database('HT', TRUE);
} }
function init() function init() {
{ $this->top_num = false;
$this->top_num=false; $this->t_id = false;
$this->t_id=false; $this->order_by = " ORDER BY t.t_id DESC ";
$this->order_by=" ORDER BY t.t_id DESC "; $this->t_status = false;
$this->t_status=false; $this->t_a_id = false;
$this->t_a_id=false; $this->t_td_type = false;
$this->t_td_type=false; $this->t_title = false;
$this->t_title = false; }
//正在编辑的任务
function in_edit($t_ht_op_code = false) {
$this->init();
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);
}
}
$this->t_status = " AND t.t_status= 'edit' ";
return $this->get_list();
}
//待审核任务
function in_review($t_ht_op_code = false) {
$this->init();
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);
}
}
$this->t_status = " AND t.t_status= 'review' ";
return $this->get_list();
}
//待结算任务
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)) {
$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_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' ";
return $this->get_list();
}
//已完成任务
function in_complete($t_ht_op_code = false) {
$this->init();
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);
}
}
$this->t_status = " AND (t.t_status= 'complete' OR t.t_status= 'published')";
return $this->get_list();
}
//待审核投稿
function in_wait($t_ht_op_code = false) {
$this->init();
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);
}
}
$this->t_status = " AND t.t_status= 'wait' ";
return $this->get_list();
}
//大厅任务
function in_hall() {
$this->init();
$this->t_a_id = " AND t.t_a_id= 0 ";
return $this->get_list();
}
//获取单个任务详细信息
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 in_edit($t_ht_op_code=false)
{
$this->init();
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);
}
}
$this->t_status=" AND t.t_status= 'edit' ";
return $this->get_list();
}
//待审核任务
function in_review($t_ht_op_code=false)
{
$this->init();
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);
}
}
$this->t_status=" AND t.t_status= 'review' ";
return $this->get_list();
}
//待结算任务
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))
{
$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_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' ";
return $this->get_list();
}
//已完成任务
function in_complete($t_ht_op_code=false)
{
$this->init();
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);
}
}
$this->t_status=" AND (t.t_status= 'complete' OR t.t_status= 'published')";
return $this->get_list();
}
//待审核投稿 function get_list($page_flag = false) {
function in_wait($t_ht_op_code=false) $this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT ";
{ $sql .= " t.t_id, \n"
$this->init(); . " t.t_title, \n"
if(!empty($t_ht_op_code)) . " t.t_content, \n"
{ . " t.t_status, \n"
if(is_numeric($t_ht_op_code)) . " t.t_a_id, \n"
{ . " t.t_ht_op_code, \n"
$this->t_a_id=" AND t.t_a_id= ".$this->HT->escape($t_ht_op_code); . " t.t_td_type, \n"
} . " t.t_expires, \n"
else . " t.t_datetime, \n"
{ . " t.t_rating_total, \n"
$this->t_ht_op_code=" AND t.t_ht_op_code=".$this->HT->escape($t_ht_op_code); . " t.t_active_author, \n"
} . " t.t_attach, \n"
} . " t.t_rating, \n"
$this->t_status=" AND t.t_status= 'wait' "; . " t.t_delete \n"
return $this->get_list(); . "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";
function in_hall() $this->t_id ? $sql.=$this->t_id : false;
{ $this->t_status ? $sql.=$this->t_status : false;
$this->init(); $this->t_ht_op_code ? $sql.=$this->t_ht_op_code : false;
$this->t_a_id=" AND t.t_a_id= 0 "; $this->t_td_type ? $sql.=$this->t_td_type : false;
return $this->get_list(); $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');
function detail($t_id) if ($site_code == 'cht') { //早期的任务没有设置站点默认是cht
{ $sql.=" AND ( t.t_sitecode= '$site_code' OR t.t_sitecode is null )";
$this->init(); } else {
$this->top_num=1; $sql.=" AND t.t_sitecode= '$site_code' ";
$this->t_id=" AND t.t_id=".$this->HT->escape($t_id); }
return $this->get_list(); $this->order_by ? $sql.=$this->order_by : false;
} $query = $this->HT->query($sql);
if ($this->top_num == 1) {
function get_list($page_flag=false) if ($query->num_rows() > 0) {
{ $row = $query->row();
$this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT "; return $row;
$sql .= " t.t_id, \n" } else {
. " t.t_title, \n" return FALSE;
. " t.t_content, \n" }
. " t.t_status, \n" } else {
. " t.t_a_id, \n" return $query->result();
. " t.t_ht_op_code, \n" }
. " t.t_td_type, \n" }
. " t.t_expires, \n"
. " t.t_datetime, \n"
. " t.t_rating_total, \n"
. " t.t_active_author, \n"
. " t.t_attach, \n"
. " t.t_rating, \n"
. " 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";
$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;
$this->t_td_type ? $sql.=$this->t_td_type : false;
$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;
$this->order_by ? $sql.=$this->order_by : false;
$query=$this->HT->query($sql);
if($this->top_num==1)
{
if ($query->num_rows() > 0)
{
$row = $query->row();
return $row;
}
else
{
return FALSE;
}
}
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"
$sql = "INSERT INTO infotasks \n" . " ( \n"
. " ( \n" . " t_title, \n"
. " t_title, \n" . " t_content, \n"
. " t_content, \n" . " t_a_id, \n"
. " t_a_id, \n" . " t_ht_op_code, \n"
. " t_ht_op_code, \n" . " t_td_type, \n"
. " t_td_type, \n" . " t_expires, \n"
. " t_expires, \n" . " t_sitecode, \n"
. " t_sitecode, \n" . " t_status, \n"
. " t_status, \n" . " t_delete, \n"
. " t_delete, \n" . " t_datetime \n"
. " t_datetime \n" . " ) \n"
. " ) \n" . "VALUES \n"
. "VALUES \n" . " ( \n"
. " ( \n" . " N?,N?,?,?,?,?,?,'edit',0,GETDATE() \n"
. " N?,N?,?,?,?,?,?,'edit',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_sitecode));
$query=$this->HT->query($sql, array($t_title, $t_content, $t_a_id, $t_ht_op_code, $t_td_type, $t_expires,$t_sitecode));
$this->insert_id = $this->HT->last_id('infotasks'); $this->insert_id = $this->HT->last_id('infotasks');
return $query; return $query;
//print_r($this->HT->queries); //print_r($this->HT->queries);
} }
//更新 //更新
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"
$sql = "UPDATE infotasks \n" . "SET t_title = N?, \n"
. "SET t_title = N?, \n" . " t_content = N?, \n"
. " t_content = N?, \n" . " t_a_id = ?, \n"
. " t_a_id = ?, \n" . " t_td_type = ?, \n"
. " t_td_type = ?, \n" . " t_expires = ?, \n"
. " t_expires = ?, \n" . " t_datetime = GETDATE() \n"
. " t_datetime = GETDATE() \n" . "WHERE t_id = ?";
. "WHERE t_id = ?"; $query = $this->HT->query($sql, array($t_title, $t_content, $t_a_id, $t_td_type, $t_expires, $t_id));
$query=$this->HT->query($sql, array($t_title, $t_content, $t_a_id, $t_td_type, $t_expires,$t_id)); return $query;
return $query; //print_r($this->HT->queries);
//print_r($this->HT->queries); }
//删除
function delete($t_id) {
$sql = "UPDATE infotasks \n"
. "SET t_delete = 1 \n"
. "WHERE t_id = ?";
$query = $this->HT->query($sql, array($t_id));
return $query;
}
//审核
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 = ?";
$query = $this->HT->query($sql, array($t_status, $t_rating, $t_rating_total, $t_id));
return $query;
}
//承接任务
function undertake($t_id, $a_id) {
$sql = "UPDATE infotasks \n"
. "SET t_a_id = ? \n"
. "WHERE t_id = ?";
$query = $this->HT->query($sql, array($a_id, $t_id));
return $query;
} }
//删除
function delete($t_id)
{
$sql = "UPDATE infotasks \n"
. "SET t_delete = 1 \n"
. "WHERE t_id = ?";
$query=$this->HT->query($sql, array($t_id));
return $query;
}
//审核
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 = ?";
$query=$this->HT->query($sql, array($t_status,$t_rating,$t_rating_total,$t_id));
return $query;
}
//承接任务
function undertake($t_id,$a_id)
{
$sql = "UPDATE infotasks \n"
. "SET t_a_id = ? \n"
. "WHERE t_id = ?";
$query=$this->HT->query($sql, array($a_id,$t_id));
return $query;
}
//取消任务
function canceltake($t_id)
{
$sql = "UPDATE infotasks \n"
. "SET t_a_id = 0 \n"
. "WHERE t_id = ?";
$query=$this->HT->query($sql, array($t_id));
return $query;
}
//根据不同状态获取任务列表 //取消任务
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) function canceltake($t_id) {
{ $sql = "UPDATE infotasks \n"
$this->init(); . "SET t_a_id = 0 \n"
if(!empty($t_ht_op_code)){ . "WHERE t_id = ?";
if(is_numeric($t_ht_op_code)){ $query = $this->HT->query($sql, array($t_id));
$this->t_a_id=" AND t.t_a_id= ".$this->HT->escape($t_ht_op_code); return $query;
}else{ }
$this->t_ht_op_code=" AND t.t_ht_op_code=".$this->HT->escape($t_ht_op_code);
}
}
//已发布的和已完成的任务计算在已完成的任务里
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)
{
$this->t_status = " AND t.t_status = '$t_status' ";
}
if($t_a_id=='-1'){
$this->t_a_id = " AND t.t_a_id = '' ";
}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' ";
return $this->get_list($page_flag);
}
//根据给定id字符串获取任务列表 //根据不同状态获取任务列表
function get_list_by_taskids($taskids,$order=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();
$ordermap=" ORDER BY t.t_datetime DESC "; if (!empty($t_ht_op_code)) {
if ($order) { if (is_numeric($t_ht_op_code)) {
$ordermap=" ORDER BY t.t_rating_total DESC,t.t_datetime DESC "; $this->t_a_id = " AND t.t_a_id= " . $this->HT->escape($t_ht_op_code);
} } else {
$sql = "SELECT t.t_id, $this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code);
}
}
//已发布的和已完成的任务计算在已完成的任务里
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) {
$this->t_status = " AND t.t_status = '$t_status' ";
}
if ($t_a_id == '-1') {
$this->t_a_id = " AND t.t_a_id = '' ";
} 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' ";
return $this->get_list($page_flag);
}
//根据给定id字符串获取任务列表
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 ";
}
$sql = "SELECT t.t_id,
t.t_title, t.t_title,
t.t_content, t.t_content,
t.t_status, t.t_status,
@ -330,129 +296,143 @@ class Infotasks_model extends CI_Model
FROM infotasks t FROM infotasks t
WHERE t.t_id IN ($taskids) WHERE t.t_id IN ($taskids)
$ordermap"; $ordermap";
$query=$this->HT->query($sql); $query = $this->HT->query($sql);
return $query->result(); return $query->result();
} }
//评选最活跃作者 //评选最活跃作者
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"
$sql = "UPDATE infotasks \n" . "SET t_active_author = ? \n"
. "SET t_active_author = ? \n" . "WHERE t_id = ?";
. "WHERE t_id = ?"; $query = $this->HT->query($sql, array($t_active_author, $t_id));
$query=$this->HT->query($sql, array($t_active_author, $t_id));
//给活跃作者添加奖励 //给活跃作者添加奖励
if ($query) { if ($query) {
$sql = "UPDATE infotaskarticles \n" $sql = "UPDATE infotaskarticles \n"
. "SET ta_charge = ta_charge+150 \n" . "SET ta_charge = ta_charge+150 \n"
. "WHERE ta_id = ?"; . "WHERE ta_id = ?";
$query2= $this->HT->query($sql,array($ta_id)); $query2 = $this->HT->query($sql, array($ta_id));
return $query2; return $query2;
}else{ } else {
return false; return false;
} }
} }
//获取作者总字数排行榜 //获取作者总字数排行榜
public function get_author_count(){ public function get_author_count() {
$sql="SELECT t_id,t_a_id,(SELECT top 1 ta_count FROM infotaskarticles WHERE ta_t_id=t_id order by ta_datetime desc) as ta_count,(SELECT top 1 ta_id FROM infotaskarticles WHERE ta_t_id=t_id order by ta_datetime desc) as ta_id FROM infotasks WHERE t_status = 'reviewed'"; $sql = "SELECT t_id,t_a_id,(SELECT top 1 ta_count FROM infotaskarticles WHERE ta_t_id=t_id order by ta_datetime desc) as ta_count,(SELECT top 1 ta_id FROM infotaskarticles WHERE ta_t_id=t_id order by ta_datetime desc) as ta_id FROM infotasks WHERE t_status = 'reviewed'";
$query= $this->HT->query($sql); $query = $this->HT->query($sql);
$result=$query->result(); $result = $query->result();
$rank=array(); $rank = array();
$rank_author=array(); $rank_author = array();
$active_author=array(); $active_author = array();
foreach ($result as $item) { foreach ($result as $item) {
if(!isset($rank_author[$item->t_a_id]))$rank_author[$item->t_a_id]=$item; if (!isset($rank_author[$item->t_a_id]))
if(!isset($rank[$item->t_a_id]))$rank[$item->t_a_id]=0; $rank_author[$item->t_a_id] = $item;
$rank[$item->t_a_id]+=$item->ta_count; if (!isset($rank[$item->t_a_id]))
} $rank[$item->t_a_id] = 0;
//获取第一名的数据 $rank[$item->t_a_id]+=$item->ta_count;
arsort($rank); }
//获取第一名的数据
arsort($rank);
foreach ($rank as $key => $v) { foreach ($rank as $key => $v) {
$active_author['author_num']=count($rank); $active_author['author_num'] = count($rank);
$active_author['count']=$v; $active_author['count'] = $v;
$active_author['task_id']=$rank_author[$key]->t_id; $active_author['task_id'] = $rank_author[$key]->t_id;
$active_author['ta_id']=$rank_author[$key]->ta_id; $active_author['ta_id'] = $rank_author[$key]->ta_id;
$active_author['t_a_id']=$key; $active_author['t_a_id'] = $key;
break; break;
} }
return $active_author; return $active_author;
} }
//查询是否已设置当月活跃作者 //查询是否已设置当月活跃作者
public function is_active_author(){ public function is_active_author() {
$datetime=date('Y-m-01'); $datetime = date('Y-m-01');
$sql="SELECT TOP 1 t_active_author FROM infotasks WHERE t_active_author>'$datetime'"; $sql = "SELECT TOP 1 t_active_author FROM infotasks WHERE t_active_author>'$datetime'";
$query=$this->HT->query($sql); $query = $this->HT->query($sql);
$result=$query->result(); $result = $query->result();
if (!empty($result)) { if (!empty($result)) {
return 1; return 1;
} }
return 0; return 0;
} }
public function get_tasks_rank($top=5){ public function get_tasks_rank($top = 5) {
$sql=" SELECT TOP $top * FROM infotasks $sql = " SELECT TOP $top * FROM infotasks
WHERE t_status='reviewed' WHERE t_status='reviewed'
ORDER BY t_rating_total DESC"; ORDER BY t_rating_total DESC";
$query=$this->HT->query($sql); $query = $this->HT->query($sql);
$result=$query->result(); $result = $query->result();
return $result; return $result;
} }
//获取不同任务状态的任务数量 //获取不同任务状态的任务数量
public function get_task_count_by_status(){ public function get_task_count_by_status() {
$admin_info = $this->session->userdata('session_admin'); $admin_info = $this->session->userdata('session_admin');
$t_ht_op_code=$admin_info['OPI_Code']; $t_ht_op_code = $admin_info['OPI_Code'];
if(is_numeric($t_ht_op_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{ } 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";
$query=$this->HT->query($sql); $site_code = $this->config->item('site_code');
$result=$query->result(); if ($site_code == 'cht') { //早期的任务没有设置站点默认是cht
$counts=array(); $where.=" AND ( t_sitecode= '$site_code' OR t_sitecode is null )";
if (!empty($result)) { } else {
foreach ($result as $v) { $where.=" AND t_sitecode= '$site_code' ";
$counts[$v->t_status]=$v->task_count; }
}
//已完成数量=完成数量+已发布的数量 $sql = "SELECT t_status, count(0) as task_count FROM infotasks WHERE $where AND t_delete=0 group by t_status";
$complete_count=$published_count=0; $query = $this->HT->query($sql);
if(isset($counts['complete']))$complete_count=$counts['complete']; $result = $query->result();
if(isset($counts['published']))$published_count=$counts['published']; $counts = array();
$counts['complete']=$complete_count+$published_count; if (!empty($result)) {
foreach ($result as $v) {
$counts[$v->t_status] = $v->task_count;
}
//已完成数量=完成数量+已发布的数量
$complete_count = $published_count = 0;
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+unreviewed的数量
$edit_count=$unreviewed_count=0; $edit_count = $unreviewed_count = 0;
if(isset($counts['edit']))$edit_count=$counts['edit']; if (isset($counts['edit']))
if(isset($counts['unreviewed']))$unreviewed_count=$counts['unreviewed']; $edit_count = $counts['edit'];
$counts['edit']=$edit_count+$unreviewed_count; if (isset($counts['unreviewed']))
return $counts; $unreviewed_count = $counts['unreviewed'];
} $counts['edit'] = $edit_count + $unreviewed_count;
return false; return $counts;
}
return false;
} }
//判断任务是否已上线 //判断任务是否已上线
public function is_in_used($ta_id){ public function is_in_used($ta_id) {
$sql="SELECT TOP 1 t_status,ic_status $sql = "SELECT TOP 1 t_status,ic_status
FROM infoTaskArticles FROM infoTaskArticles
INNER JOIN infoContents ON ic_id=ta_ic_id INNER JOIN infoContents ON ic_id=ta_ic_id
LEFT JOIN infotasks ON t_id=ta_t_id LEFT JOIN infotasks ON t_id=ta_t_id
WHERE ta_id=?"; WHERE ta_id=?";
$query=$this->HT->query($sql, array($ta_id)); $query = $this->HT->query($sql, array($ta_id));
$result=$query->result(); $result = $query->result();
if (empty($result)) { if (empty($result)) {
return 0; return 0;
}else{ } else {
$result=$result[0]; $result = $result[0];
//信息平台和作者平台同时是发布状态时 //信息平台和作者平台同时是发布状态时
if ($result->t_status=='complete' AND $result->ic_status==1) { if ($result->t_status == 'complete' AND $result->ic_status == 1) {
return 1; return 1;
}else{ } else {
return 0; return 0;
} }
} }
} }
}
}

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

File diff suppressed because it is too large Load Diff

@ -381,6 +381,7 @@ $config['site'] = array(
'gl' => array('site_code' => 'gl', 'site_id' => 90, 'site_lgc' => '1', 'site_url' => 'http://www.guilinchina.net'), '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'), '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'), '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') 'dct' => array('site_code' => 'dct', 'site_id' => 99, 'site_lgc' => '1', 'site_url' => 'http://www.diychinatours.com')
); );
@ -389,4 +390,7 @@ $config['auhtor_task_type'] = array(
'修改' => 'modify', '修改' => 'modify',
'审核' => 'review', '审核' => 'review',
'投稿' => 'contribute' '投稿' => '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 { class Login extends CI_Controller {
function __construct() function __construct() {
{
parent::__construct(); parent::__construct();
$this->load->model('Infoauthors_model'); $this->load->model('Infoauthors_model');
} }
public function index() public function index() {
{ if ($this->permission->is_admin(false) === false) {
if($this->permission->is_admin(false)===false) $data = array();
{ $this->load->view('header', $data);
$data=array(); $this->load->view('login');
$this->load->view('header', $data); $this->load->view('footer');
$this->load->view('login'); } else {
$this->load->view('footer'); redirect(site_url());
} }
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()); $data[] = array('name' => 'go', 'value' => site_url());
echo json_encode($data); echo json_encode($data);
return TRUE; return TRUE;
@ -36,241 +32,200 @@ class Login extends CI_Controller {
$this->form_validation->set_rules('email', 'lang:login_email', 'required'); $this->form_validation->set_rules('email', 'lang:login_email', 'required');
$this->form_validation->set_rules('password', 'lang:login_password', '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(); $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); $data[] = array('name' => $key, 'value' => $value);
} }
echo json_encode($data); echo json_encode($data);
return FALSE; return FALSE;
} } else {
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')));
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_email", $this->input->post('email'), 7776000);
$this->input->set_cookie("user_pwd",$this->input->post('password'),7776000); $this->input->set_cookie("user_pwd", $this->input->post('password'), 7776000);
$data[] = array('name' => 'go', 'value' => site_url()); $data[] = array('name' => 'go', 'value' => site_url());
echo json_encode($data); echo json_encode($data);
return TRUE; 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')); $data[] = array('name' => 'login_warning', 'value' => $this->lang->line('login_warning'));
echo json_encode($data); echo json_encode($data);
} }
} }
} }
public function signup() {
public function signup() $data = array();
{
$data=array();
$data['signup_step'] = 1; $data['signup_step'] = 1;
$data['author_field'] = $this->load->view('author_field',$data,true); $data['author_field'] = $this->load->view('author_field', $data, true);
$this->load->view('header', $data); $this->load->view('header', $data);
$this->load->view('signup'); $this->load->view('signup');
$this->load->view('footer'); $this->load->view('footer');
} }
public function signup_vpn() public function signup_vpn() {
{ $data = array();
$data=array();
$data['signup_step'] = 1; $data['signup_step'] = 1;
$data['terms']='vpn'; $data['terms'] = 'vpn';
$data['navbar_active'] = false; $data['navbar_active'] = false;
$data['author_field'] = $this->load->view('author_field',$data,true); $data['author_field'] = $this->load->view('author_field', $data, true);
$this->load->view('header', $data); $this->load->view('header', $data);
$this->load->view('signup'); $this->load->view('signup');
$this->load->view('footer'); $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_email', 'lang:signup_a_email', 'required');
$this->form_validation->set_rules('a_password', 'lang:signup_a_password', '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_name', 'lang:signup_a_name', 'required');
$this->form_validation->set_rules('a_bank', 'lang:a_bank', '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('a_bank_card', 'lang:a_bank_card', 'required');
$this->form_validation->set_rules('terms', 'You must choose this option!', '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(); $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); $data[] = array('name' => $key, 'value' => $value);
} }
echo json_encode($data); echo json_encode($data);
return FALSE; return FALSE;
} } else {
else if ($this->Infoauthors_model->check_signup($this->input->post('a_email'))) {
{
if ($this->Infoauthors_model->check_signup($this->input->post('a_email')))
{
$data[] = array('name' => 'a_email', 'value' => 'Someone already has that email. Try another?'); $data[] = array('name' => 'a_email', 'value' => 'Someone already has that email. Try another?');
echo json_encode($data); echo json_encode($data);
return FALSE; return FALSE;
} }
//头像处理 //头像处理
$a_photo=''; $a_photo = '';
if ($this->input->post('profile_url')!='') { if ($this->input->post('profile_url') != '') {
$profile_file_path=APPPATH.'document/profile_photo'; $profile_file_path = APPPATH . 'document/profile_photo';
$profile_url=$this->input->post('profile_url'); $profile_url = $this->input->post('profile_url');
$profile_array=explode('.', $profile_url); $profile_array = explode('.', $profile_url);
$profile_ext='jpg';//end($profile_array); $profile_ext = 'jpg'; //end($profile_array);
rename($profile_file_path.'/'.$profile_url,$profile_file_path.'/profile_'.$this->input->post('a_email').'.'.$profile_ext); rename($profile_file_path . '/' . $profile_url, $profile_file_path . '/profile_' . $this->input->post('a_email') . '.' . $profile_ext);
rename($profile_file_path.'/'.str_replace('_thumb', '', $profile_url),$profile_file_path.'/profile_'.$this->input->post('a_email').'_org.'.$profile_ext); 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; $a_photo = 'profile_' . $this->input->post('a_email') . '.' . $profile_ext;
} }
//处理上传的身份证复印件 //处理上传的身份证复印件
if ($this->input->post('ID_file_name')!='') { if ($this->input->post('ID_file_name') != '') {
$ID_file_path=APPPATH.'document/ID_CARD'; $ID_file_path = APPPATH . 'document/ID_CARD';
$a_id_file=$this->input->post('ID_file_name'); $a_id_file = $this->input->post('ID_file_name');
$file_array=explode('.', $a_id_file); $file_array = explode('.', $a_id_file);
$ext='jpg';//end($file_array); $ext = 'jpg'; //end($file_array);
rename($ID_file_path.'/'.$a_id_file,$ID_file_path.'/id_card_'.$this->input->post('a_email').'.'.$ext); rename($ID_file_path . '/' . $a_id_file, $ID_file_path . '/id_card_' . $this->input->post('a_email') . '.' . $ext);
} }
$a_name=trim($this->input->post('a_name')); $a_name = trim($this->input->post('a_name'));
$a_name_cn=trim($this->input->post('a_name_cn')); $a_name_cn = trim($this->input->post('a_name_cn'));
$this->Infoauthors_model->add( $this->Infoauthors_model->add(
$this->input->post('a_email'), $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_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')); $data[] = array('name' => 'go', 'value' => site_url('login/signup_success'));
echo json_encode($data); echo json_encode($data);
return TRUE; return TRUE;
} }
} }
public function signup_success() {
public function signup_success() $data['title'] = $this->lang->line('signup_success_title');
{ $data['content'] = $this->lang->line('signup_success');
$data['title']=$this->lang->line('signup_success_title');
$data['content']=$this->lang->line('signup_success');
$this->load->view('header', $data); $this->load->view('header', $data);
$this->load->view('message'); $this->load->view('message');
$this->load->view('footer'); $this->load->view('footer');
} }
public function upload_ID_file($profile=false){ public function upload_ID_file($profile = false) {
$save_path='ID_CARD'; $save_path = 'ID_CARD';
$jsfunction='get_id_card_file'; $jsfunction = 'get_id_card_file';
$upload_id='ID_file'; $upload_id = 'ID_file';
if ($profile) { if ($profile) {
$save_path='profile_photo'; $save_path = 'profile_photo';
$jsfunction='get_photo_url'; $jsfunction = 'get_photo_url';
$upload_id='Profile_file'; $upload_id = 'Profile_file';
} }
$config['upload_path'] = APPPATH.'document/'.$save_path; $config['upload_path'] = APPPATH . 'document/' . $save_path;
$config['allowed_types'] = 'gif|jpg|png'; $config['allowed_types'] = 'gif|jpg|png';
$config['encrypt_name'] = true; $config['encrypt_name'] = true;
$this->load->library('upload', $config); $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()); $error = array('error' => $this->upload->display_errors());
var_dump($error); var_dump($error);
} } else {
else
{
$data = array('upload_data' => $this->upload->data()); $data = array('upload_data' => $this->upload->data());
$file_name=$data['upload_data']['file_name']; $file_name = $data['upload_data']['file_name'];
if ($profile) { if ($profile) {
$baseurls=str_replace('controllers', '', dirname(__FILE__)); $baseurls = str_replace('controllers', '', dirname(__FILE__));
$config['image_library'] = 'gd2'; $config['image_library'] = 'gd2';
$config['source_image'] = $baseurls.'document/profile_photo/'.$file_name; $config['source_image'] = $baseurls . 'document/profile_photo/' . $file_name;
$config['create_thumb'] = TRUE; $config['create_thumb'] = TRUE;
$config['maintain_ratio'] = false; $config['maintain_ratio'] = false;
$config['width'] = 175; $config['width'] = 175;
$config['height'] = 175; $config['height'] = 175;
$this->load->library('image_lib', $config); $this->load->library('image_lib', $config);
$this->image_lib->resize(); $this->image_lib->resize();
$profile_array=explode('.', $file_name); $profile_array = explode('.', $file_name);
$file_name=$profile_array[0].'_thumb.'.$profile_array[1]; $file_name = $profile_array[0] . '_thumb.' . $profile_array[1];
} }
echo "<script>parent.$jsfunction('$file_name');</script>"; echo "<script>parent.$jsfunction('$file_name');</script>";
} }
} }
public function findpwd() public function findpwd() {
{ $data = array();
$data=array();
$this->load->view('header', $data); $this->load->view('header', $data);
$this->load->view('findpwd'); $this->load->view('findpwd');
$this->load->view('footer'); $this->load->view('footer');
} }
//找回密码发送邮件 //找回密码发送邮件
public function do_findpwd() public function do_findpwd() {
{
$this->form_validation->set_rules('email', 'lang:login_email', 'required'); $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();
$data[] = array('name' => 'email', 'value' => 'Please fill in your email address!'); $data[] = array('name' => 'email', 'value' => 'Please fill in your email address!');
echo json_encode($data); echo json_encode($data);
return FALSE; return FALSE;
} }
$userdata=$this->Infoauthors_model->detail($this->input->post('email')); $userdata = $this->Infoauthors_model->detail($this->input->post('email'));
if ($userdata) if ($userdata) {
{ $fromName = 'author site';
$fromName='author site'; $fromEmail = 'noreply02@chinahighlights.net';
$fromEmail='noreply02@chinahighlights.net'; $toName = $userdata->a_name;
$toName=$userdata->a_name; $toEmail = $userdata->a_email;
$toEmail=$userdata->a_email; $subject = 'Your password for "http://a.chtcdn.com"';
$subject='Your password for "http://a.chtcdn.com"'; $body = 'Your password for "http://a.chtcdn.com" : ' . $userdata->a_password . '<br><br><br><br>For security please change your password once logged in.';
$body='Your password for "http://a.chtcdn.com" : '.$userdata->a_password.'<br><br><br><br>For security please change your password once logged in.'; $is_sendmail = $this->Infoauthors_model->SendMail($fromName, $fromEmail, $toName, $toEmail, $subject, $body);
$is_sendmail=$this->Infoauthors_model->SendMail($fromName, $fromEmail, $toName, $toEmail, $subject, $body);
if ($is_sendmail) { if ($is_sendmail) {
$data[] = array('name' => 'ok', 'value' => 'Action successful. Your password has been emailed to you.'); $data[] = array('name' => 'ok', 'value' => 'Action successful. Your password has been emailed to you.');
echo json_encode($data); echo json_encode($data);
}else{ } else {
$data[] = array('name' => 'no', 'value' => 'Action unsuccessful. Try again later.!'); $data[] = array('name' => 'no', 'value' => 'Action unsuccessful. Try again later.!');
echo json_encode($data); echo json_encode($data);
return FALSE; return FALSE;
} }
} } else {
else
{
$data[] = array('name' => 'no', 'value' => 'Error: Your email is incorrect!'); $data[] = array('name' => 'no', 'value' => 'Error: Your email is incorrect!');
echo json_encode($data); echo json_encode($data);
return FALSE; return FALSE;
} }
} }
//退出登录清空session //退出登录清空session
public function out() public function out() {
{
$this->session->unset_userdata('session_admin'); $this->session->unset_userdata('session_admin');
$this->load->helper('cookie'); $this->load->helper('cookie');
//delete_cookie("user_email"); //delete_cookie("user_email");
delete_cookie("user_pwd"); delete_cookie("user_pwd");
redirect(site_url('login')); redirect(site_url('login'));
} }
} }
/* End of file welcome.php */ /* End of file welcome.php */

@ -1,164 +1,155 @@
<?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 { class Taskhall extends CI_Controller {
function __construct() function __construct() {
{
parent::__construct(); parent::__construct();
$this->permission->is_admin(); $this->permission->is_admin();
//$this->output->enable_profiler(TRUE); //$this->output->enable_profiler(TRUE);
$this->load->model('Infotasks_model'); $this->load->model('Infotasks_model');
$this->load->model('Infotaskarticles_model'); $this->load->model('Infotaskarticles_model');
$this->load->model('InfoSMS_model'); $this->load->model('InfoSMS_model');
} }
public function index($page=1) public function index($page = 1) {
{ $data = array();
$data=array(); $data['author_rank_list'] = $this->Infotasks_model->get_author_rank_list();
$data['author_rank_list']=$this->Infotasks_model->get_author_rank_list(); $data['article_rank_list'] = $this->Infotasks_model->get_article_rank_list();
$data['article_rank_list']=$this->Infotasks_model->get_article_rank_list();
$t_td_type = $start_date = $tasktitle = false;
$t_td_type=$start_date=$tasktitle=false; $end_date = date('Y-m-d');
$end_date=date('Y-m-d'); if ($this->input->get('tasktype') && $this->input->get('tasktype') != '-')
if($this->input->get('tasktype') && $this->input->get('tasktype')!='-') $t_td_type=$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('startdate') && $this->input->get('startdate') != '')
if($this->input->get('enddate') && $this->input->get('enddate')!='') $end_date=$this->input->get('enddate'); $start_date = $this->input->get('startdate');
if($this->input->get('tasktitle') && $this->input->get('tasktitle')!='') $tasktitle=$this->input->get('tasktitle'); 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); $page_task = $this->Infotasks_model->get_tasks_list(false, 0, $t_td_type, $start_date, $end_date, $tasktitle, $page);
$pages['total']=count($page_task); $pages['total'] = count($page_task);
$pages['pageSize']= 20; $pages['pageSize'] = 20;
$pages['url'] = site_url('taskhall/index'); $pages['url'] = site_url('taskhall/index');
$pages['current']=$page; $pages['current'] = $page;
//$this->load->library('mypage',$pages); //$this->load->library('mypage',$pages);
//$data['page']=$this->mypage->pages_html(); //$data['page']=$this->mypage->pages_html();
$data['page']=show_page($pages); $data['page'] = show_page($pages);
//获取任务列表 //获取任务列表
$task_id_str=0; $task_id_str = 0;
$page_task=array_slice($page_task,$pages['pageSize']*($page-1),$pages['pageSize']); $page_task = array_slice($page_task, $pages['pageSize'] * ($page - 1), $pages['pageSize']);
foreach ($page_task as $v) { foreach ($page_task as $v) {
$task_id_str.=','.$v->t_id; $task_id_str.=',' . $v->t_id;
} }
$data['task_list'] = $this->Infotasks_model->get_list_by_taskids($task_id_str); $data['task_list'] = $this->Infotasks_model->get_list_by_taskids($task_id_str);
$data['nav_view']=$this->load->view('nav_hall',array('nav_active'=>'hall')+$data,true); $data['nav_view'] = $this->load->view('nav_hall', array('nav_active' => 'hall') + $data, true);
$data['rank_view']=$this->load->view('rank',$data,true); $data['rank_view'] = $this->load->view('rank', $data, true);
$this->load->view('header', array('navbar_active'=>'taskhall')+$data); $this->load->view('header', array('navbar_active' => 'taskhall') + $data);
$this->load->view('task_hall'); $this->load->view('task_hall');
$this->load->view('footer'); $this->load->view('footer');
} }
public function view($t_id) public function view($t_id) {
{ $data['task'] = $this->Infotasks_model->detail($t_id);
$data['task']=$this->Infotasks_model->detail($t_id); if (empty($data['task'])) {
if(empty($data['task'])) show_404();
{ return false;
show_404(); }
return false; $data['task_detail'] = $this->Infotaskarticles_model->detail($data['task']->t_id);
}
$data['task_detail']=$this->Infotaskarticles_model->detail($data['task']->t_id); $data['nav_view'] = $this->load->view('nav_hall', array('nav_active' => 'hall') + $data, true);
$this->load->view('header', array('navbar_active' => 'taskhall') + $data);
$data['nav_view']=$this->load->view('nav_hall',array('nav_active'=>'hall')+$data,true);
$this->load->view('header', array('navbar_active'=>'taskhall')+$data);
$this->load->view('read_task'); $this->load->view('read_task');
$this->load->view('footer'); $this->load->view('footer');
} }
//?н????? //?н?????
public function undertake() public function undertake() {
{ $admin_info = $this->session->userdata('session_admin');
$admin_info=$this->session->userdata('session_admin'); $t_id = $this->input->post('t_id');
$t_id=$this->input->post('t_id'); $task = $this->Infotasks_model->detail($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);
$data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_error_notfound')); return false;
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));
$this->Infotasks_model->undertake($t_id,$admin_info->a_id); echo json_encode($data);
$data[] = array('name' => 'ok_modal', 'value' => $this->lang->line('task_undertake_success')); return true;
$data[] = array('name'=>'ok_go','value'=>site_url('welcome/view/'.$t_id)); } else {
echo json_encode($data); $data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_has_undertake'));
return true; echo json_encode($data);
} return false;
else }
{ }
$data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_has_undertake'));
echo json_encode($data); //ȡ??????
return false; 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)) {
public function canceltake() $data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_error_notfound'));
{ echo json_encode($data);
$admin_info=$this->session->userdata('session_admin'); return false;
$t_id=$this->input->post('t_id'); }
$task=$this->Infotasks_model->detail($t_id); if ($task->t_a_id == $admin_info->a_id) {
if(empty($task)) //ȡ??????
{ $this->Infotasks_model->canceltake($t_id);
$data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_error_notfound')); $data[] = array('name' => 'ok_modal', 'value' => $this->lang->line('task_canceltake_success'));
echo json_encode($data); $data[] = array('name' => 'ok_go', 'value' => site_url('welcome/view/' . $t_id));
return false; echo json_encode($data);
} return true;
if($task->t_a_id==$admin_info->a_id) } else {
{ $data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_canceltake_error'));
//ȡ?????? echo json_encode($data);
$this->Infotasks_model->canceltake($t_id); return false;
$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; public function notice($announce_id = '', $announce_type = 'notice') {
} $data = array();
else $data['type'] = $announce_type;
{ if ($announce_id == '') {
$data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_canceltake_error')); $data['announce_list'] = $this->Infotaskarticles_model->get_announce($announce_id, $announce_type);
echo json_encode($data); } else {
return false; $announce = $this->Infotaskarticles_model->get_announce($announce_id, $announce_type);
} $data['announce_detail'] = $announce[0];
} }
$data['author_rank_list'] = $this->Infotasks_model->get_author_rank_list();
public function notice($announce_id='',$announce_type='notice') $data['article_rank_list'] = $this->Infotasks_model->get_article_rank_list();
{ $data['avatar'] = get_author_photo();
$data=array(); $data['suer_weburl'] = get_user_web_url();
$data['type']=$announce_type;
if ($announce_id=='') { $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'notice') + $data, true);
$data['announce_list'] = $this->Infotaskarticles_model->get_announce($announce_id,$announce_type); $data['rank_view'] = $this->load->view('rank', $data, true);
}else{ $this->load->view('header', array('navbar_active' => 'notice') + $data);
$announce=$this->Infotaskarticles_model->get_announce($announce_id,$announce_type);
$data['announce_detail']=$announce[0];
}
$data['author_rank_list']=$this->Infotasks_model->get_author_rank_list();
$data['article_rank_list']=$this->Infotasks_model->get_article_rank_list();
$data['avatar']=get_author_photo();
$data['suer_weburl']=get_user_web_url();
$data['nav_view']=$this->load->view('nav',array('nav_active'=>'notice')+$data,true);
$data['rank_view']=$this->load->view('rank',$data,true);
$this->load->view('header', array('navbar_active'=>'notice')+$data);
$this->load->view('notice'); $this->load->view('notice');
$this->load->view('footer'); $this->load->view('footer');
} }
public function announce($announce_id=''){ public function announce($announce_id = '') {
$this->notice($announce_id,'announce'); $this->notice($announce_id, 'announce');
} }
public function help() public function help() {
{ $data = array();
$data=array(); $data['nav_view'] = $this->load->view('nav_hall', array('nav_active' => 'help') + $data, true);
$data['nav_view']=$this->load->view('nav_hall',array('nav_active'=>'help')+$data,true); $this->load->view('header', array('navbar_active' => 'notice') + $data);
$this->load->view('header', array('navbar_active'=>'notice')+$data);
$this->load->view('help'); $this->load->view('help');
$this->load->view('footer'); $this->load->view('footer');
} }
} }
/* End of file welcome.php */ /* End of file welcome.php */

@ -1,179 +1,183 @@
<?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 { class Welcome extends CI_Controller {
public $all_unread_sms;
function __construct() public $all_unread_sms;
{
function __construct() {
parent::__construct(); parent::__construct();
$this->permission->is_admin(); $this->permission->is_admin();
//$this->output->enable_profiler(TRUE); //$this->output->enable_profiler(TRUE);
$this->load->model('Infotasks_model'); $this->load->model('Infotasks_model');
$this->load->model('Infotaskarticles_model'); $this->load->model('Infotaskarticles_model');
$this->load->model('InfoSMS_model'); $this->load->model('InfoSMS_model');
$this->load->model('Operator_model'); $this->load->model('Operator_model');
$this->load->model('Infoauthors_model'); $this->load->model('Infoauthors_model');
} }
//所有任务 //所有任务
public function index($page=1) public function index($page = 1) {
{ $data = array();
$data=array(); $data = $this->_get_home_base_data();
$data=$this->_get_home_base_data(); //已完成任务使用另一模板
//已完成任务使用另一模板 if ($this->input->get('taskstatus') == 'complete') {
if($this->input->get('taskstatus')=='complete'){ $this->in_complete_tasks();
$this->in_complete_tasks(); return;
return; }
} $task_list = $this->_get_task_list(false, $page, site_url("welcome/index"));
$task_list = $this->_get_task_list(false,$page,site_url("welcome/index"));
$data['task_list'] = $task_list['task_list']; $data['task_list'] = $task_list['task_list'];
$data['page']=$task_list['page']; $data['page'] = $task_list['page'];
$data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_all')+$data,true); $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_all') + $data, true);
$this->load->view('header', array('navbar_active'=>'mytask')+$data); $this->load->view('header', array('navbar_active' => 'mytask') + $data);
$this->load->view('tasklist'); $this->load->view('tasklist');
$this->load->view('footer'); $this->load->view('footer');
} }
//正在编辑的任务
public function in_edit_tasks($page=1) //正在编辑的任务
{ public function in_edit_tasks($page = 1) {
$data=array(); $data = array();
$data=$this->_get_home_base_data(); $data = $this->_get_home_base_data();
$task_list = $this->_get_task_list('edit',$page,site_url("welcome/in_edit_tasks")); $task_list = $this->_get_task_list('edit', $page, site_url("welcome/in_edit_tasks"));
$data['task_list_in_edit'] = $task_list['task_list']; $data['task_list_in_edit'] = $task_list['task_list'];
$data['page']=$task_list['page']; $data['page'] = $task_list['page'];
$data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_edit')+$data,true); $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_edit') + $data, true);
$this->load->view('header', array('navbar_active'=>'mytask')+$data); $this->load->view('header', array('navbar_active' => 'mytask') + $data);
$this->load->view('welcome'); $this->load->view('welcome');
$this->load->view('footer'); $this->load->view('footer');
} }
//已经完成的任务
public function in_complete_tasks($page=1) //已经完成的任务
{ public function in_complete_tasks($page = 1) {
$data=array(); $data = array();
$data=$this->_get_home_base_data(); $data = $this->_get_home_base_data();
$task_list = $this->_get_task_list('complete',$page,site_url("welcome/in_complete_tasks")); $task_list = $this->_get_task_list('complete', $page, site_url("welcome/in_complete_tasks"));
$data['task_list'] = $task_list['task_list']; $data['task_list'] = $task_list['task_list'];
$data['page']=$task_list['page']; $data['page'] = $task_list['page'];
foreach ($data['task_list'] as $task) { foreach ($data['task_list'] as $task) {
$task->last_version = $this->Infotaskarticles_model->version_last($task->t_id); $task->last_version = $this->Infotaskarticles_model->version_last($task->t_id);
} }
$data['site_config']=$this->config->item('site'); $data['site_config'] = $this->config->item('site');
$data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_complete')+$data,true); $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_complete') + $data, true);
$this->load->view('header', array('navbar_active'=>'mytask')+$data); $this->load->view('header', array('navbar_active' => 'mytask') + $data);
$this->load->view('in_complete'); $this->load->view('in_complete');
$this->load->view('footer'); $this->load->view('footer');
} }
//未通过审核的投稿申请
public function in_refuse_tasks($page=1) //未通过审核的投稿申请
{ public function in_refuse_tasks($page = 1) {
$data=array(); $data = array();
$data=$this->_get_home_base_data(); $data = $this->_get_home_base_data();
$task_list = $this->_get_task_list('refuse',$page,site_url("welcome/in_refuse_tasks")); $task_list = $this->_get_task_list('refuse', $page, site_url("welcome/in_refuse_tasks"));
$data['task_list'] = $task_list['task_list']; $data['task_list'] = $task_list['task_list'];
$data['page']=$task_list['page']; $data['page'] = $task_list['page'];
$data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_refuse')+$data,true); $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_refuse') + $data, true);
$this->load->view('header', array('navbar_active'=>'mytask')+$data); $this->load->view('header', array('navbar_active' => 'mytask') + $data);
$this->load->view('in_refuse'); $this->load->view('in_refuse');
$this->load->view('footer'); $this->load->view('footer');
} }
//根据任务状态获取任务列表 //根据任务状态获取任务列表
public function task_lists($t_status=false,$page=1){ public function task_lists($t_status = false, $page = 1) {
$data=array(); $data = array();
$data=$this->_get_home_base_data(); $data = $this->_get_home_base_data();
$admin_info=$this->session->userdata('session_admin'); $admin_info = $this->session->userdata('session_admin');
$task_list = $this->_get_task_list($t_status,$page,site_url("welcome/task_lists/$t_status")); $task_list = $this->_get_task_list($t_status, $page, site_url("welcome/task_lists/$t_status"));
$data['task_list'] = $task_list['task_list']; $data['task_list'] = $task_list['task_list'];
$data['page']=$task_list['page']; $data['page'] = $task_list['page'];
$data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_'.$t_status)+$data,true); $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_' . $t_status) + $data, true);
$this->load->view('header', array('navbar_active'=>'mytask')+$data); $this->load->view('header', array('navbar_active' => 'mytask') + $data);
$this->load->view('in_refuse'); $this->load->view('in_refuse');
$this->load->view('footer'); $this->load->view('footer');
} }
//获取任务列表 //获取任务列表
function _get_task_list($t_status=false,$page=false,$pageurl=false){ function _get_task_list($t_status = false, $page = false, $pageurl = false) {
$t_td_type=$start_date=$tasktitle=false; $t_td_type = $start_date = $tasktitle = false;
$end_date=date('Y-m-d'); $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('tasktype') && $this->input->get('tasktype') != '-')
if($this->input->get('startdate') && $this->input->get('startdate')!='') $start_date=$this->input->get('startdate'); $t_td_type = $this->input->get('tasktype');
if($this->input->get('enddate') && $this->input->get('enddate')!='') $end_date=$this->input->get('enddate'); if ($this->input->get('startdate') && $this->input->get('startdate') != '')
if($this->input->get('tasktitle') && $this->input->get('tasktitle')!='') $tasktitle=$this->input->get('tasktitle'); $start_date = $this->input->get('startdate');
if(!$t_status && $this->input->get('taskstatus') && $this->input->get('taskstatus')!='-') $t_status=$this->input->get('taskstatus'); 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'); $admin_info = $this->session->userdata('session_admin');
//分页 //分页
$page_task=$this->Infotasks_model->get_tasks_list($t_status,$admin_info->a_id,$t_td_type,$start_date,$end_date,$tasktitle,$page); $page_task = $this->Infotasks_model->get_tasks_list($t_status, $admin_info->a_id, $t_td_type, $start_date, $end_date, $tasktitle, $page);
$pages['total']=count($page_task); $pages['total'] = count($page_task);
$pages['pageSize']= 20; $pages['pageSize'] = 20;
$pages['url'] = $pageurl; $pages['url'] = $pageurl;
$pages['current']=$page; $pages['current'] = $page;
$task_list['page']=show_page($pages); $task_list['page'] = show_page($pages);
//获取任务列表 //获取任务列表
$task_id_str=0; $task_id_str = 0;
$page_task=array_slice($page_task,$pages['pageSize']*($page-1),$pages['pageSize']); $page_task = array_slice($page_task, $pages['pageSize'] * ($page - 1), $pages['pageSize']);
foreach ($page_task as $v) { foreach ($page_task as $v) {
$task_id_str.=','.$v->t_id; $task_id_str.=',' . $v->t_id;
} }
$task_list['task_list'] = $this->Infotasks_model->get_list_by_taskids($task_id_str); $task_list['task_list'] = $this->Infotasks_model->get_list_by_taskids($task_id_str);
return $task_list; return $task_list;
} }
public function _get_home_base_data(){ public function _get_home_base_data() {
$user_data=$this->session->userdata('session_admin'); $user_data = $this->session->userdata('session_admin');
$data['author_rank_list']=$this->Infotasks_model->get_author_rank_list(); $data['author_rank_list'] = $this->Infotasks_model->get_author_rank_list();
$data['article_rank_list']=$this->Infotasks_model->get_article_rank_list(); $data['article_rank_list'] = $this->Infotasks_model->get_article_rank_list();
//最新公告 //最新公告
$announce=$this->Infotaskarticles_model->get_announce('','announce'); $announce = $this->Infotaskarticles_model->get_announce('', 'announce');
$data['announce']=array(); $data['announce'] = array();
if(!empty($announce))$data['announce']=$announce; if (!empty($announce))
$data['notice_list']=$this->Infotaskarticles_model->get_announce(); $data['announce'] = $announce;
$data['avatar']=get_author_photo(); $data['notice_list'] = $this->Infotaskarticles_model->get_announce();
$data['rank_view']=$this->load->view('rank',$data,true); $data['avatar'] = get_author_photo();
//获取作者网前url名字组成部分 $data['rank_view'] = $this->load->view('rank', $data, true);
$data['suer_weburl']=get_user_web_url(); //获取作者网前url名字组成部分
return $data; $data['suer_weburl'] = get_user_web_url();
} return $data;
}
public function view($t_id)
{ public function view($t_id) {
$data=array(); $data = array();
$data['task']=$this->Infotasks_model->detail($t_id); $data['task'] = $this->Infotasks_model->detail($t_id);
$admin_info=$this->session->userdata('session_admin'); $admin_info = $this->session->userdata('session_admin');
if(empty($data['task'])) if (empty($data['task'])) {
{ show_404();
show_404(); return false;
return false; }
} $data['task_detail'] = $this->Infotaskarticles_model->detail($data['task']->t_id);
$data['task_detail']=$this->Infotaskarticles_model->detail($data['task']->t_id); $data['task_last_version'] = $this->Infotaskarticles_model->version_last($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)) {
$data['information']=$this->Infotaskarticles_model->get_information($data['task_detail']->ta_ic_id); $sitedata = $this->config->item('site');
if (isset($data['information']->ic_sitecode)) { $data['sitedata'] = $sitedata[$data['information']->ic_sitecode];
$sitedata=$this->config->item('site'); }
$data['sitedata']=$sitedata[$data['information']->ic_sitecode]; //判断任务是否已上线
} $data['task_status'] = $this->Infotasks_model->is_in_used($data['task_detail']->ta_id);
//判断任务是否已上线 }
$data['task_status']=$this->Infotasks_model->is_in_used($data['task_detail']->ta_id);
} if ($data['task']->t_a_id != $admin_info->a_id and $data['task_detail']->ta_isbest == NULL) {
show_404();
if ($data['task']->t_a_id!=$admin_info->a_id and $data['task_detail']->ta_isbest==NULL) { return false;
show_404(); }
return false;
} switch ($data['task']->t_status) {
case 'published':
switch ($data['task']->t_status) case 'complete':
{ $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_complete') + $data, true);
case 'published': break;
case 'complete': case 'review':
$data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_complete')+$data,true);
break;
case 'review':
$data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_review') + $data, true); $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_review') + $data, true);
break; break;
case 'reviewed': case 'reviewed':
@ -182,299 +186,260 @@ class Welcome extends CI_Controller {
case 'unreviewed': case 'unreviewed':
$data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_unreviewed') + $data, true); $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_unreviewed') + $data, true);
break; break;
case 'refuse': case 'refuse':
$data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_refuse')+$data,true); $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_refuse') + $data, true);
break; break;
case 'wait': case 'wait':
$data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_refuse')+$data,true); $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_refuse') + $data, true);
break; break;
default: default:
$data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_edit')+$data,true); $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_edit') + $data, true);
break; break;
}
//获取短消息列表
$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)
{
$this->InfoSMS_model->readed($sms->m_id);
}
}
$data['admin_info_user']=$admin_info->a_id;
$this->load->view('header', array('navbar_active'=>'mytask')+$data);
if ($data['task']->t_status=='refuse') {
$this->load->view('edit_refuse_task');//未通过审核的投稿
}else{
$this->load->view('task_detail');
} }
$this->load->view('footer');
} //获取短消息列表
$data['sms_list'] = $this->InfoSMS_model->get_task_sms($data['task']->t_id);
public function edit_submit($task_submit=false) $admin_info = $this->session->userdata('session_admin');
{ foreach ($data['sms_list'] as $sms) {
$t_id=$this->input->post('t_id'); if ($sms->m_receiver == $admin_info->a_id) {
$task=$this->Infotasks_model->detail($t_id); $this->InfoSMS_model->readed($sms->m_id);
$admin_info=$this->session->userdata('session_admin'); }
if ($admin_info->a_id!=$task->t_a_id) { }
$data[] = array('name' => 'no', 'value' => 'error:it\'s not your task!'); $data['admin_info_user'] = $admin_info->a_id;
echo json_encode($data); $this->load->view('header', array('navbar_active' => 'mytask') + $data);
return false; if ($data['task']->t_status == 'refuse') {
} $this->load->view('edit_refuse_task'); //未通过审核的投稿
} else {
$task_used=$this->Infotaskarticles_model->detail($t_id); $this->load->view('task_detail');
/*if(empty($task_used)) }
{ $this->load->view('footer');
$data[] = array('name' => 'no', 'value' => $this->lang->line('task_error_notfound')); }
echo json_encode($data);
return false; public function edit_submit($task_submit = false) {
}*/ $t_id = $this->input->post('t_id');
$task = $this->Infotasks_model->detail($t_id);
$task_original=$this->Infotaskarticles_model->detail_original($t_id); $admin_info = $this->session->userdata('session_admin');
if(empty($task_original)) if ($admin_info->a_id != $task->t_a_id) {
{ $data[] = array('name' => 'no', 'value' => 'error:it\'s not your task!');
if (!empty($task_used)) { echo json_encode($data);
//把原始任务状态改为original防止原始任务信息被删除 return false;
$this->Infotaskarticles_model->set_original($task_used->ta_id); }
}
//新建一个任务状态改为used $task_used = $this->Infotaskarticles_model->detail($t_id);
$this->Infotaskarticles_model->add($t_id,$this->input->post('ta_ic_id'), $this->input->post('ta_title') /* if(empty($task_used))
, $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') $data[] = array('name' => 'no', 'value' => $this->lang->line('task_error_notfound'));
, $this->input->post('ta_photo')); echo json_encode($data);
if (!$task_submit) { return false;
$data[] = array('name' => 'ok', 'value' => $this->lang->line('script_success_save')); } */
echo json_encode($data);
} $task_original = $this->Infotaskarticles_model->detail_original($t_id);
return true; if (empty($task_original)) {
} if (!empty($task_used)) {
else //把原始任务状态改为original防止原始任务信息被删除
{ $this->Infotaskarticles_model->set_original($task_used->ta_id);
if(empty($task_used)) }
{ //新建一个任务状态改为used
$data[] = array('name' => 'no', 'value' => $this->lang->line('task_error_notfound')); $this->Infotaskarticles_model->add($t_id, $this->input->post('ta_ic_id'), $this->input->post('ta_title')
echo json_encode($data); , $this->input->post('ta_content'), $this->input->post('ta_summary'), $this->input->post('ta_seo_title')
return false; , $this->input->post('ta_seo_description'), $this->input->post('ta_seo_keywords')
} , $this->input->post('ta_photo'));
$this->Infotaskarticles_model->update($task_used->ta_id, $this->input->post('ta_title'), $this->input->post('ta_content') if (!$task_submit) {
, $this->input->post('ta_summary'), $this->input->post('ta_seo_title') $data[] = array('name' => 'ok', 'value' => $this->lang->line('script_success_save'));
, $this->input->post('ta_seo_description'), $this->input->post('ta_seo_keywords') echo json_encode($data);
, $this->input->post('ta_photo')); }
if (!$task_submit) { return true;
$data[] = array('name' => 'ok', 'value' => $this->lang->line('script_success_save')); } else {
echo json_encode($data); if (empty($task_used)) {
} $data[] = array('name' => 'no', 'value' => $this->lang->line('task_error_notfound'));
return true; echo json_encode($data);
} return false;
} }
$this->Infotaskarticles_model->update($task_used->ta_id, $this->input->post('ta_title'), $this->input->post('ta_content')
public function review_submit() , $this->input->post('ta_summary'), $this->input->post('ta_seo_title')
{ , $this->input->post('ta_seo_description'), $this->input->post('ta_seo_keywords')
if($this->edit_submit(true)) , $this->input->post('ta_photo'));
{ if (!$task_submit) {
$this->Infotaskarticles_model->add($this->input->post('t_id'),$this->input->post('ta_ic_id'), $this->input->post('ta_title') $data[] = array('name' => 'ok', 'value' => $this->lang->line('script_success_save'));
, $this->input->post('ta_content'), $this->input->post('ta_summary'), $this->input->post('ta_seo_title') echo json_encode($data);
, $this->input->post('ta_seo_description'), $this->input->post('ta_seo_keywords') }
, $this->input->post('ta_photo'),'version'); return true;
$this->Infotasks_model->reviwed($this->input->post('t_id'),'review'); }
//发送消息 }
$this->InfoSMS_model->add('task',$this->input->post('t_id'),$this->input->post('ht_user'),$this->input->post('t_a_id'),'Task submitted; please check!');
$data[] = array('name' => 'ok', 'value' => $this->lang->line('task_success_submit')); public function review_submit() {
echo json_encode($data); if ($this->edit_submit(true)) {
return 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')
, $this->input->post('ta_photo'), 'version');
//发送短消息给管理员 $this->Infotasks_model->reviwed($this->input->post('t_id'), 'review');
public function send_to_admin() //发送消息
{ $this->InfoSMS_model->add('task', $this->input->post('t_id'), $this->input->post('ht_user'), $this->input->post('t_a_id'), 'Task submitted; please check!');
$t_id=$this->input->post('t_id'); $data[] = array('name' => 'ok', 'value' => $this->lang->line('task_success_submit'));
$task=$this->Infotasks_model->detail($t_id); echo json_encode($data);
if(empty($task)) return true;
{ }
$data[] = array('name' => 'no', 'value' => $this->lang->line('task_error_notfound')); }
echo json_encode($data);
return false; //发送短消息给管理员
} public function send_to_admin() {
$this->form_validation->set_rules('m_content', 'lang:task_m_content', 'required'); $t_id = $this->input->post('t_id');
if ($this->form_validation->run() == FALSE) $task = $this->Infotasks_model->detail($t_id);
{ 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) {
$data = array(); $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); $data[] = array('name' => $key, 'value' => $value);
} }
echo json_encode($data); echo json_encode($data);
return false; 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'));
$this->InfoSMS_model->add('task',$task->t_id,$task->t_ht_op_code,$task->t_a_id,$this->input->post('m_content')); echo json_encode($data);
$data[] = array('name' => 'ok', 'value' => $this->lang->line('send_sms_success'));
echo json_encode($data); //发送邮件通知
$admin_info = $this->session->userdata('session_admin');
//发送邮件通知 $author_admin = $this->Operator_model->get_user($task->t_ht_op_code);
$admin_info=$this->session->userdata('session_admin'); $this->InfoSMS_model->send_mail($admin_info->a_name, $admin_info->a_email, 'gavin', 'gavin@chinahighlights.com', sprintf($this->lang->line('author_email_message_subject'), $task->t_title), $this->lang->line('author_email_message_body'));
$author_admin=$this->Operator_model->get_user($task->t_ht_op_code); return true;
$this->InfoSMS_model->send_mail($admin_info->a_name, $admin_info->a_email, 'gavin', 'gavin@chinahighlights.com', sprintf($this->lang->line('author_email_message_subject'),$task->t_title), $this->lang->line('author_email_message_body')); }
return true; }
}
} public function create_task() {
$data = array();
public function create_task() $data = $this->_get_home_base_data();
{ $data['nav_view'] = $this->load->view('nav_hall', array('nav_active' => 'create_task') + $data, true);
$data=array(); $this->load->view('header', array('navbar_active' => 'create_task') + $data);
$data=$this->_get_home_base_data();
$data['nav_view']=$this->load->view('nav_hall',array('nav_active'=>'create_task')+$data,true);
$this->load->view('header', array('navbar_active'=>'create_task')+$data);
$this->load->view('create_task'); $this->load->view('create_task');
$this->load->view('footer'); $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_title', 'lang:t_title', 'required'); $this->form_validation->set_rules('t_content', 'lang:t_content', 'required');
$this->form_validation->set_rules('t_content', 'lang:t_content', 'required'); $this->form_validation->set_rules('t_expires', 'lang:t_expires', '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(); $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); $data[] = array('name' => $key, 'value' => $value);
} }
echo json_encode($data); echo json_encode($data);
return false; return false;
} } else {
else //TODO:暂时把稿件全部发给RURU(zzy),今后会读取各站点的管理员名单
{ $admin_info = $this->session->userdata('session_admin');
//TODO:暂时把稿件全部发给RURU(zzy),今后会读取各站点的管理员名单 $this->Infotasks_model->add(
$admin_info=$this->session->userdata('session_admin'); $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->Infotasks_model->add( );
$this->input->post('t_title'), $this->Infotaskarticles_model->add($this->Infotasks_model->insert_id, 0, '', '', '', '', '', '', '');
$this->input->post('t_content'), $this->InfoSMS_model->add('task', $this->Infotasks_model->insert_id, 'Gavin', $admin_info->a_id, 'I have submitted a proposal; please check!');
$admin_info->a_id,
'Gavin', $data[] = array('name' => 'ok', 'value' => $this->lang->line('task_create_success'));
'contribute', $data[] = array('name' => 'ok_go', 'value' => site_url('welcome'));
$this->input->post('t_expires'),
'wait',
$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!');
$data[] = array('name' => 'ok', 'value' => $this->lang->line('task_create_success'));
$data[] = array('name'=>'ok_go','value'=>site_url('welcome'));
echo json_encode($data); echo json_encode($data);
return true;
}
}
public function upload_task_attach(){ return true;
$save_path='task_attach'; }
$jsfunction='upload_task_attach'; }
$upload_id='task_attach';
public function upload_task_attach() {
$save_path = 'task_attach';
$jsfunction = 'upload_task_attach';
$upload_id = 'task_attach';
$config['upload_path'] = APPPATH.'document/'.$save_path; $config['upload_path'] = APPPATH . 'document/' . $save_path;
$config['allowed_types'] = 'gif|jpg|png|rar|zip|docx|doc|xls|xlsx|ppt'; $config['allowed_types'] = 'gif|jpg|png|rar|zip|docx|doc|xls|xlsx|ppt';
$config['encrypt_name'] = true; $config['encrypt_name'] = true;
$this->load->library('upload', $config); $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()); $error = array('error' => $this->upload->display_errors());
var_dump($error); var_dump($error);
} } else {
else
{
$data = array('upload_data' => $this->upload->data()); $data = array('upload_data' => $this->upload->data());
$file_name=$data['upload_data']['file_name']; $file_name = $data['upload_data']['file_name'];
echo "<script>parent.$jsfunction('$file_name');</script>"; echo "<script>parent.$jsfunction('$file_name');</script>";
} }
} }
//修改后重新提交投稿申请 //修改后重新提交投稿申请
public function update_task(){ public function update_task() {
$this->form_validation->set_rules('t_title', 'lang:t_title', 'required'); $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_content', 'lang:t_content', 'required');
$this->form_validation->set_rules('t_expires', 'lang:t_expires', '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(); $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); $data[] = array('name' => $key, 'value' => $value);
} }
echo json_encode($data); echo json_encode($data);
return false; return false;
}else{ } else {
//更新任务状态 //更新任务状态
$result=$this->Infotasks_model->update( $result = $this->Infotasks_model->update(
$this->input->post('t_id'), $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_title'), );
$this->input->post('t_content'), if ($result) {
$this->input->post('t_a_id'), $this->InfoSMS_model->add('task', $this->input->post('t_id'), 'Gavin', $this->input->post('t_a_id'), 'I have submitted a proposal; please check!');
'contribute', $data[] = array('name' => 'ok', 'value' => 'success');
$this->input->post('t_expires'), } else {
'wait', $data[] = array('name' => 'no', 'value' => 'error');
$this->input->post('t_attach') }
); echo json_encode($data);
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!');
$data[] = array('name' => 'ok', 'value' => 'success');
}else{
$data[] = array('name' => 'no', 'value' => 'error');
}
echo json_encode($data);
} }
return true; return true;
} }
//删除任务 //删除任务
public function delete_task($t_id){ public function delete_task($t_id) {
$this->Infotasks_model->delete($t_id); $this->Infotasks_model->delete($t_id);
if ($this->Infotasks_model->delete($t_id)) { if ($this->Infotasks_model->delete($t_id)) {
redirect(site_url('welcome/in_refuse_tasks')); redirect(site_url('welcome/in_refuse_tasks'));
}else{ } else {
header('Location: '.$_SERVER['HTTP_REFERER']); header('Location: ' . $_SERVER['HTTP_REFERER']);
} }
return true; return true;
} }
//返回指定页面路径pagepath在指定时间内的成效信息 //返回指定页面路径pagepath在指定时间内的成效信息
public function get_analytics_by_date($loadtotal=0){ public function get_analytics_by_date($loadtotal = 0) {
$data=array(); $data = array();
//获取请求的日期范围以及请求的页面路径 //获取请求的日期范围以及请求的页面路径
$startdate=$this->input->post('startdate'); $startdate = $this->input->post('startdate');
$enddate=$this->input->post('enddate'); $enddate = $this->input->post('enddate');
$pagepath=$this->input->post('pagepath'); $pagepath = $this->input->post('pagepath');
$sitecode=$this->input->post('sitecode'); $sitecode = $this->input->post('sitecode');
if (empty($pagepath)) { if (empty($pagepath)) {
echo ''; echo '';
return false; return false;
} }
//如果开始时间为空则把开始时间设为往前七天 //如果开始时间为空则把开始时间设为往前七天
if ($startdate == '') { if ($startdate == '') {
$startdate = time()-7*24*60*60; $startdate = time() - 7 * 24 * 60 * 60;
}else{ } else {
$startdate = strtotime($startdate); $startdate = strtotime($startdate);
} }
//如果结束时间为空,则把结束时间设为当天 //如果结束时间为空,则把结束时间设为当天
if ($enddate == '') { if ($enddate == '') {
$enddate = time(); $enddate = time();
}else{ } else {
$enddate = strtotime($enddate); $enddate = strtotime($enddate);
} }
if ($startdate>$enddate) { if ($startdate > $enddate) {
echo "please check your date";die(); echo "please check your date";
die();
} }
//查取google分析数据 //查取google分析数据
$data['analytics_list'] = $this->Infotaskarticles_model->get_analytics_list($pagepath,$sitecode,50,$startdate,$enddate); $data['analytics_list'] = $this->Infotaskarticles_model->get_analytics_list($pagepath, $sitecode, 50, $startdate, $enddate);
$total_visit['pv'] = $total_visit['uv']=$total_visit['agv_time']=$total_visit['entrances']=0; $total_visit['pv'] = $total_visit['uv'] = $total_visit['agv_time'] = $total_visit['entrances'] = 0;
$analytics_count=0; $analytics_count = 0;
//访问量汇总 //访问量汇总
foreach ($data['analytics_list'] as $v) { foreach ($data['analytics_list'] as $v) {
$total_visit['pv']+=$v->kwa_pageviews; $total_visit['pv']+=$v->kwa_pageviews;
@ -483,88 +448,76 @@ class Welcome extends CI_Controller {
$total_visit['entrances']+=$v->kwa_entrances; $total_visit['entrances']+=$v->kwa_entrances;
$analytics_count++; $analytics_count++;
} }
$analytics_count==0 ? $analytics_count=1 : null; $analytics_count == 0 ? $analytics_count = 1 : null;
$total_visit['agv_time']=ceil($total_visit['agv_time']/$analytics_count); $total_visit['agv_time'] = ceil($total_visit['agv_time'] / $analytics_count);
$data['total_visit']=$total_visit; $data['total_visit'] = $total_visit;
//如果loadtotal==1,则只返回google分析的汇总数据;如果loadtotal==0则返回明细数据表 //如果loadtotal==1,则只返回google分析的汇总数据;如果loadtotal==0则返回明细数据表
$data['loadtotal']=$loadtotal; $data['loadtotal'] = $loadtotal;
$this->load->view('analytics',$data); $this->load->view('analytics', $data);
} }
public function set_readed($m_id) public function set_readed($m_id) {
{ $this->InfoSMS_model->readed($m_id);
$this->InfoSMS_model->readed($m_id); echo 'ok';
echo 'ok';
} }
public function search_by_icid(){ public function search_by_icid() {
$ic_id_list=$this->input->post('ic_id_list'); $ic_id_list = $this->input->post('ic_id_list');
$ic_id_list=rtrim(trim($ic_id_list),',').','; $ic_id_list = rtrim(trim($ic_id_list), ',') . ',';
$this->load->model('InfoContents_model'); $this->load->model('InfoContents_model');
$data['search_list'] = $this->InfoContents_model->get_ic_contents_by_list($ic_id_list); $data['search_list'] = $this->InfoContents_model->get_ic_contents_by_list($ic_id_list);
$data['search_type'] = 'recommended'; $data['search_type'] = 'recommended';
$this->load->view('recommendlist',$data); $this->load->view('recommendlist', $data);
} }
public function search() { public function search() {
$this->load->model('Information_model'); $this->load->model('Information_model');
$data['keywords'] = $this->input->post('keywords'); $data['keywords'] = $this->input->post('keywords');
$search_url = str_replace($this->config->item('site_url'), "", $data['keywords']); $search_url = str_replace($this->config->item('site_url'), "", $data['keywords']);
$data['search_list'] = $this->Information_model->search_url($search_url); $data['search_list'] = $this->Information_model->search_url($search_url);
if (count($data['search_list']) === 0) { if (count($data['search_list']) === 0) {
$data['search_list'] = $this->Information_model->search($data['keywords']); $data['search_list'] = $this->Information_model->search($data['keywords']);
} }
$data['ic_id_list']=$this->input->post('ic_id_list')==''?'0':$this->input->post('ic_id_list'); $data['ic_id_list'] = $this->input->post('ic_id_list') == '' ? '0' : $this->input->post('ic_id_list');
$this->load->view('recommendlist',$data); $this->load->view('recommendlist', $data);
return TRUE; return TRUE;
} }
//保存自定义配置 //保存自定义配置
function save_meta() function save_meta() {
{ $this->load->model('InfoMetas_model');
$this->load->model('InfoMetas_model'); $im_ic_id = $this->input->post('im_ic_id');
$im_ic_id=$this->input->post('im_ic_id'); $im_key = $this->input->post('im_key');
$im_key=$this->input->post('im_key'); $im_value = $this->input->post('im_value');
$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) {
$meta=$this->InfoMetas_model->get($im_ic_id, $im_key);
if($meta===false)
{
$this->InfoMetas_model->add($im_ic_id, $im_key, $im_value); $this->InfoMetas_model->add($im_ic_id, $im_key, $im_value);
} } else {
else
{
$this->InfoMetas_model->update($im_ic_id, $im_key, $im_value); $this->InfoMetas_model->update($im_ic_id, $im_key, $im_value);
} }
$data[] = array('name' => 'ok', 'value' => 'success'); $data[] = array('name' => 'ok', 'value' => 'success');
} } else {
else
{
$data[] = array('name' => 'no', 'value' => 'error'); $data[] = array('name' => 'no', 'value' => 'error');
} }
echo json_encode($data); echo json_encode($data);
return true; return true;
} }
//保存自定义配置 //保存自定义配置
function delete_meta() function delete_meta() {
{ $this->load->model('InfoMetas_model');
$this->load->model('InfoMetas_model'); $im_ic_id = $this->input->post('im_ic_id');
$im_ic_id=$this->input->post('im_ic_id'); $im_key = $this->input->post('im_key');
$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); $this->InfoMetas_model->delete($im_ic_id, $im_key);
$data[] = array('name' => 'ok', 'value' => 'success'); $data[] = array('name' => 'ok', 'value' => 'success');
} } else {
else
{
$data[] = array('name' => 'no', 'value' => 'error'); $data[] = array('name' => 'no', 'value' => 'error');
} }
echo json_encode($data); echo json_encode($data);
return true; return true;
} }
} }

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

@ -1,222 +1,196 @@
<?php <?php
class Infoauthors_model extends CI_Model class Infoauthors_model extends CI_Model {
{
var $top_num = false;
var $top_num=false; var $a_active = false;
var $a_active=false; var $a_id = false;
var $a_id=false; var $a_email = false;
var $a_email=false; var $order_by = false;
var $order_by=false;
function __construct() {
function __construct()
{
parent::__construct(); parent::__construct();
$this->HT = $this->load->database('HT', TRUE); $this->HT = $this->load->database('HT', TRUE);
} }
function init() function init() {
{ $this->top_num = false;
$this->top_num=false; $this->a_active = false;
$this->a_active=false; $this->a_id = false;
$this->a_id=false; $this->a_email = false;
$this->a_email=false; $this->order_by = " ORDER BY ia.a_name ASC ";
$this->order_by=" ORDER BY ia.a_name ASC "; }
}
//输入用户名和密码,检查是否可以正确 //输入用户名和密码,检查是否可以正确
function check_login($email, $password) function check_login($email, $password) {
{ $sql = "SELECT TOP 1 1 \n"
$sql = "SELECT TOP 1 1 \n" . "FROM infoAuthors ia \n"
. "FROM infoAuthors ia \n" . "WHERE ia.a_email = ? \n"
. "WHERE ia.a_email = ? \n" . " AND ia.a_password = ?"
. " AND ia.a_password = ?" . " AND ia.a_active = 1 ";
. " AND ia.a_active = 1 ";
$query = $this->HT->query($sql, array($email, $password)); $query = $this->HT->query($sql, array($email, $password));
//print_r($this->HT->queries); //print_r($this->HT->queries);
if ($query->num_rows() > 0) if ($query->num_rows() > 0) {
{
return TRUE; return TRUE;
} } else {
else
{
return FALSE; return FALSE;
} }
} }
//判断是否已注册 //判断是否已注册
public function check_signup($email){ public function check_signup($email) {
$sql = "SELECT TOP 1 1 \n" $sql = "SELECT TOP 1 1 \n"
. "FROM infoAuthors ia \n" . "FROM infoAuthors ia \n"
. "WHERE ia.a_email = ? \n" . "WHERE ia.a_email = ? \n"
. " AND ia.a_active != 2 "; . " AND ia.a_active != 2 ";
$query = $this->HT->query($sql, array($email)); $query = $this->HT->query($sql, array($email));
if ($query->num_rows() > 0) if ($query->num_rows() > 0) {
{
return TRUE; return TRUE;
} } else {
else
{
return FALSE; return FALSE;
} }
} }
//已激活作者列表 //已激活作者列表
function active_list() function active_list() {
{ $this->init();
$this->init(); $this->a_active = " AND ia.a_active = 1 ";
$this->a_active=" AND ia.a_active = 1 "; return $this->get_list();
return $this->get_list(); }
}
//待激活作者列表
//待激活作者列表 function un_active_list() {
function un_active_list() $this->init();
{ $this->a_active = " AND ia.a_active = 0 ";
$this->init(); return $this->get_list();
$this->a_active=" AND ia.a_active = 0 "; }
return $this->get_list();
}
//获取登录用户详细信息 //获取登录用户详细信息
function detail($email) function detail($email) {
{ $this->init();
$this->init(); $this->top_num = 1;
$this->top_num=1; $this->a_active = " AND ia.a_active <> 2 ";
$this->a_active=" AND ia.a_active <> 2 "; $this->a_email = " AND ia.a_email=" . $this->HT->escape($email);
$this->a_email=" AND ia.a_email=".$this->HT->escape($email);
return $this->get_list(); return $this->get_list();
} }
//获取登录用户详细信息 //获取登录用户详细信息
function detail_by_id($a_id) function detail_by_id($a_id) {
{ $this->init();
$this->init(); $this->top_num = 1;
$this->top_num=1; $this->a_active = " AND ia.a_active <> 2 ";
$this->a_active=" AND ia.a_active <> 2 "; $this->a_id = " AND ia.a_id=" . $this->HT->escape($a_id);
$this->a_id=" AND ia.a_id=".$this->HT->escape($a_id);
return $this->get_list(); return $this->get_list();
} }
//获取用户列表 //获取用户列表
function get_list() function get_list() {
{ $this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT ";
$this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT "; $sql .= " ia.a_id, \n"
$sql .= " ia.a_id, \n" . " ia.a_email, \n"
. " ia.a_email, \n" . " ia.a_password, \n"
. " ia.a_password, \n" . " ia.a_name, \n"
. " ia.a_name, \n" . " ia.a_name_cn, \n"
. " ia.a_name_cn, \n" . " ia.a_mobile_phone, \n"
. " ia.a_mobile_phone, \n" . " ia.a_phone, \n"
. " ia.a_phone, \n" . " ia.a_photo, \n"
. " ia.a_photo, \n" . " ia.a_id_card, \n"
. " ia.a_id_card, \n" . " ia.a_gender, \n"
. " ia.a_gender, \n" . " ia.a_address, \n"
. " ia.a_address, \n" . " ia.a_school, \n"
. " ia.a_school, \n" . " ia.a_bank, \n"
. " ia.a_bank, \n" . " ia.a_bank_card, \n"
. " ia.a_bank_card, \n" . " ia.a_resume, \n"
. " ia.a_resume, \n" . " ia.a_datetime, \n"
. " ia.a_datetime, \n" . " ISNULL(ia.a_sitecode,'cht') as a_sitecode, \n"
. " ia.a_sitecode, \n" . " ia.a_active \n"
. " ia.a_active \n" . "FROM infoAuthors ia \n"
. "FROM infoAuthors ia \n" . "WHERE 1 = 1 \n";
. "WHERE 1 = 1 \n"; $this->a_active ? $sql.=$this->a_active : false;
$this->a_active ? $sql.=$this->a_active : false; $this->a_id ? $sql.=$this->a_id : false;
$this->a_id ? $sql.=$this->a_id : false; $this->a_email ? $sql.=$this->a_email : false;
$this->a_email ? $sql.=$this->a_email : false; $this->order_by ? $sql.=$this->order_by : false;
$this->order_by ? $sql.=$this->order_by : false; $query = $this->HT->query($sql);
$query=$this->HT->query($sql); if ($this->top_num == 1) {
if($this->top_num==1) if ($query->num_rows() > 0) {
{ $row = $query->row();
if ($query->num_rows() > 0) return $row;
{ } else {
$row = $query->row(); return FALSE;
return $row; }
} } else {
else return $query->result();
{ }
return FALSE; }
}
} //用户注册
else 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"
return $query->result(); . " ( \n"
} . " a_email, \n"
. " a_password, \n"
. " a_name, \n"
. " a_name_cn, \n"
. " a_photo, \n"
. " a_mobile_phone, \n"
. " a_phone, \n"
. " a_id_card, \n"
. " a_gender, \n"
. " a_address, \n"
. " a_school, \n"
. " a_bank, \n"
. " a_bank_card, \n"
. " a_resume, \n"
. " a_active, \n"
. " a_datetime \n"
. " ) \n"
. "VALUES \n"
. " ( \n"
. " ?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,getdate() \n"
. " )";
$query = $this->HT->query($sql, array($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));
return $query;
}
//更新用户资料
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"
. " a_name_cn = ?, \n"
. " a_photo = ?, \n"
. " a_mobile_phone = ?, \n"
. " a_phone = ?, \n"
. " a_id_card = ?, \n"
. " a_gender = ?, \n"
. " a_address = ?, \n"
. " a_school = ?, \n"
. " a_bank = ?, \n"
. " a_bank_card = ?, \n"
. " a_resume = ? \n"
. "WHERE a_id = ?";
$query = $this->HT->query($sql, array($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, $a_id));
return $query;
}
//设置密码
function set_password($a_id, $a_password) {
$sql = "UPDATE infoAuthors \n"
. "SET a_password = ? \n"
. "WHERE a_id = ?";
$query = $this->HT->query($sql, array($a_password, $a_id));
return $query;
} }
//用户注册 //修改用户审核状态
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 reviwed($a_id, $a_active) {
{ $sql = "UPDATE infoAuthors \n"
$sql = "INSERT INTO infoAuthors \n" . "SET a_active = ? \n"
. " ( \n" . "WHERE a_id = ? ";
. " a_email, \n" return $this->HT->query($sql, array($a_active, $a_id));
. " a_password, \n" }
. " a_name, \n"
. " a_name_cn, \n" /*
. " a_photo, \n"
. " a_mobile_phone, \n"
. " a_phone, \n"
. " a_id_card, \n"
. " a_gender, \n"
. " a_address, \n"
. " a_school, \n"
. " a_bank, \n"
. " a_bank_card, \n"
. " a_resume, \n"
. " a_active, \n"
. " a_datetime \n"
. " ) \n"
. "VALUES \n"
. " ( \n"
. " ?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,getdate() \n"
. " )";
$query = $this->HT->query($sql,array($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));
return $query;
}
//更新用户资料
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"
. " a_name_cn = ?, \n"
. " a_photo = ?, \n"
. " a_mobile_phone = ?, \n"
. " a_phone = ?, \n"
. " a_id_card = ?, \n"
. " a_gender = ?, \n"
. " a_address = ?, \n"
. " a_school = ?, \n"
. " a_bank = ?, \n"
. " a_bank_card = ?, \n"
. " a_resume = ? \n"
. "WHERE a_id = ?";
$query = $this->HT->query($sql,array($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,$a_id));
return $query;
}
//设置密码
function set_password($a_id,$a_password)
{
$sql = "UPDATE infoAuthors \n"
. "SET a_password = ? \n"
. "WHERE a_id = ?";
$query=$this->HT->query($sql,array($a_password,$a_id));
return $query;
}
//修改用户审核状态
function reviwed($a_id,$a_active)
{
$sql = "UPDATE infoAuthors \n"
. "SET a_active = ? \n"
. "WHERE a_id = ? ";
return $this->HT->query($sql,array($a_active,$a_id));
}
/*
* 发送邮件 * 发送邮件
*/ */
@ -235,11 +209,11 @@ class Infoauthors_model extends CI_Model
} }
//判断是否有网前url //判断是否有网前url
public function get_user_weburl($ic_author){ public function get_user_weburl($ic_author) {
$sql="select top 1 a_name from infoContents left join infoAuthors on ic_author=a_id where ic_status=1 and ic_author='$ic_author'"; $sql = "select top 1 a_name from infoContents left join infoAuthors on ic_author=a_id where ic_status=1 and ic_author='$ic_author'";
$query = $this->HT->query($sql); $query = $this->HT->query($sql);
$result=$query->result(); $result = $query->result();
return $result; return $result;
} }
} }

@ -1,42 +1,38 @@
<?php <?php
class Infotaskarticles_model extends CI_Model class Infotaskarticles_model extends CI_Model {
{
var $insert_id = -1; var $insert_id = -1;
var $top_num=false; var $top_num = false;
var $ta_id=false; var $ta_id = false;
var $ta_t_id=false; var $ta_t_id = false;
var $order_by = false; var $order_by = false;
var $ta_status = false; var $ta_status = false;
function __construct() function __construct() {
{
parent::__construct(); parent::__construct();
$this->HT = $this->load->database('HT', TRUE); $this->HT = $this->load->database('HT', TRUE);
} }
function init() function init() {
{ $this->top_num = false;
$this->top_num=false; $this->ta_id = false;
$this->ta_id=false; $this->ta_t_id = false;
$this->ta_t_id=false; $this->order_by = " ORDER BY i.ta_id DESC ";
$this->order_by = " ORDER BY i.ta_id DESC "; $this->ta_status = false;
$this->ta_status = false; }
//获取版本列表
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);
return $this->get_list();
} }
//获取版本列表 //获取最后的版本
function version_list($ta_t_id) function version_last($ta_t_id) {
{ $sql = "SELECT TOP 1
$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);
return $this->get_list();
}
//获取最后的版本
function version_last($ta_t_id)
{
$sql = "SELECT TOP 1
i.ta_id, i.ta_id,
i.ta_t_id, i.ta_t_id,
i.ta_ic_id, i.ta_ic_id,
@ -55,199 +51,176 @@ class Infotaskarticles_model extends CI_Model
ic.ic_sitecode ic.ic_sitecode
FROM infotaskarticles i FROM infotaskarticles i
LEFT JOIN infoContents ic ON ic.ic_id=i.ta_ic_id 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"; 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); $query = $this->HT->query($sql);
if ($query->num_rows() > 0) if ($query->num_rows() > 0) {
{ $row = $query->row();
$row = $query->row(); return $row;
return $row; } else {
} return FALSE;
else }
{ }
return FALSE;
} //获取当前编辑版本
} function detail($ta_t_id) {
$this->init();
//获取当前编辑版本 $this->top_num = 1;
function detail($ta_t_id) $this->ta_status = " AND i.ta_status= 'used' ";
{ $this->ta_t_id = " AND i.ta_t_id= " . $this->HT->escape($ta_t_id);
$this->init(); return $this->get_list();
$this->top_num=1; }
$this->ta_status=" AND i.ta_status= 'used' ";
$this->ta_t_id=" AND i.ta_t_id= ".$this->HT->escape($ta_t_id); //获取原始版本版本
return $this->get_list(); function detail_original($ta_t_id) {
} if (empty($ta_t_id)) {
return false;
//获取原始版本版本 }
function detail_original($ta_t_id) $this->init();
{ $this->top_num = 1;
if(empty($ta_t_id)) $this->ta_status = " AND i.ta_status= 'original' ";
{ $this->ta_t_id = " AND i.ta_t_id= " . $this->HT->escape($ta_t_id);
return false; return $this->get_list();
} }
$this->init();
$this->top_num=1; //设置审核字数和金额
$this->ta_status=" AND i.ta_status= 'original' "; function update_review($ta_t_id, $ta_count, $ta_charge) {
$this->ta_t_id=" AND i.ta_t_id= ".$this->HT->escape($ta_t_id); $sql = "UPDATE infotaskarticles \n"
return $this->get_list(); . "SET ta_count = ? , \n"
} . " ta_charge = ? \n"
. "WHERE ta_id = ( \n"
//设置审核字数和金额 . " SELECT TOP 1 ta_id \n"
function update_review($ta_t_id,$ta_count,$ta_charge) . " FROM infotaskarticles \n"
{ . " WHERE ta_status = 'version' \n"
$sql = "UPDATE infotaskarticles \n" . " AND ta_t_id = ? \n"
. "SET ta_count = ? , \n" . " ORDER BY \n"
. " ta_charge = ? \n" . " ta_id DESC \n"
. "WHERE ta_id = ( \n" . " )";
. " SELECT TOP 1 ta_id \n" return $this->HT->query($sql, array($ta_count, $ta_charge, $ta_t_id));
. " FROM infotaskarticles \n" }
. " WHERE ta_status = 'version' \n"
. " AND ta_t_id = ? \n" function get_list() {
. " ORDER BY \n" $this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT ";
. " ta_id DESC \n" $sql .= " i.ta_id, \n"
. " )"; . " i.ta_t_id, \n"
return $this->HT->query($sql,array($ta_count,$ta_charge,$ta_t_id)); . " i.ta_ic_id, \n"
} . " i.ta_title, \n"
. " i.ta_content, \n"
function get_list() . " i.ta_summary, \n"
{ . " i.ta_seo_title, \n"
$this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT "; . " i.ta_seo_description, \n"
$sql .= " i.ta_id, \n" . " i.ta_seo_keywords, \n"
. " i.ta_t_id, \n" . " i.ta_status, \n"
. " i.ta_ic_id, \n" . " i.ta_photo, \n"
. " i.ta_title, \n" . " i.ta_count, \n"
. " i.ta_content, \n" . " i.ta_charge, \n"
. " i.ta_summary, \n" . " i.ta_isbest, \n"
. " i.ta_seo_title, \n" . " i.ta_datetime \n"
. " i.ta_seo_description, \n" . "FROM infotaskarticles i \n"
. " i.ta_seo_keywords, \n" . "WHERE 1 = 1 ";
. " i.ta_status, \n" $this->ta_id ? $sql.=$this->ta_id : false;
. " i.ta_photo, \n" $this->ta_t_id ? $sql.=$this->ta_t_id : false;
. " i.ta_count, \n" $this->ta_status ? $sql.=$this->ta_status : false;
. " i.ta_charge, \n" $this->order_by ? $sql.=$this->order_by : false;
. " i.ta_isbest, \n" $query = $this->HT->query($sql);
. " i.ta_datetime \n" if ($this->top_num == 1) {
. "FROM infotaskarticles i \n" if ($query->num_rows() > 0) {
. "WHERE 1 = 1 "; $row = $query->row();
$this->ta_id ? $sql.=$this->ta_id : false; return $row;
$this->ta_t_id ? $sql.=$this->ta_t_id : false; } else {
$this->ta_status ? $sql.=$this->ta_status : false; return FALSE;
$this->order_by ? $sql.=$this->order_by : false; }
$query=$this->HT->query($sql); } else {
if($this->top_num==1) return $query->result();
{ }
if ($query->num_rows() > 0) }
{
$row = $query->row();
return $row;
}
else
{
return FALSE;
}
}
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"
$sql = " INSERT INTO infotaskarticles \n" . " ( \n"
. " ( \n" . " ta_t_id, \n"
. " ta_t_id, \n" . " ta_ic_id, \n"
. " ta_ic_id, \n" . " ta_title, \n"
. " ta_title, \n" . " ta_content, \n"
. " ta_content, \n" . " ta_summary, \n"
. " ta_summary, \n" . " ta_seo_title, \n"
. " ta_seo_title, \n" . " ta_seo_description, \n"
. " ta_seo_description, \n" . " ta_seo_keywords, \n"
. " ta_seo_keywords, \n" . " ta_photo, \n"
. " ta_photo, \n" . " ta_status, \n"
. " ta_status, \n" . " ta_count, \n"
. " ta_count, \n" . " ta_charge, \n"
. " ta_charge, \n" . " ta_datetime \n"
. " ta_datetime \n" . " ) \n"
. " ) \n" . " VALUES \n"
. " VALUES \n" . " ( \n"
. " ( \n" . " ?,?,N?,N?,N?,N?,N?,N?,?,?,0,0,GETDATE() \n"
. " ?,?,N?,N?,N?,N?,N?,N?,?,?,0,0,GETDATE() \n" . " )";
. " )"; $query = $this->HT->query($sql, array($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));
$query=$this->HT->query($sql, array($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));
$this->insert_id = $this->HT->last_id('infotaskarticles'); $this->insert_id = $this->HT->last_id('infotaskarticles');
return $query; return $query;
//print_r($this->HT->queries); //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) {
$sql = "UPDATE infotaskarticles \n"
. "SET ta_title = N?, \n"
. " ta_content = N?, \n"
. " ta_summary = N?, \n"
. " ta_seo_title = N?, \n"
. " ta_seo_description = N?, \n"
. " ta_seo_keywords = N?, \n"
. " ta_photo = ?, \n"
. " ta_datetime = GETDATE() \n"
. "WHERE ta_id = ?";
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) {
$sql = "UPDATE infotaskarticles \n"
. "SET ta_status = 'original' \n"
. "WHERE ta_id = ? ";
return $this->HT->query($sql, array($ta_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"
. " FROM infotaskarticles ita \n"
. " WHERE ita.ta_id = ?)";
$query = $this->HT->query($sql, array($ta_ic_id, $ta_id));
return $query;
} }
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"
. " ta_summary = N?, \n"
. " ta_seo_title = N?, \n"
. " ta_seo_description = N?, \n"
. " ta_seo_keywords = N?, \n"
. " ta_photo = ?, \n"
. " ta_datetime = GETDATE() \n"
. "WHERE ta_id = ?";
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)
{
$sql = "UPDATE infotaskarticles \n"
. "SET ta_status = 'original' \n"
. "WHERE ta_id = ? ";
return $this->HT->query($sql,array($ta_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"
. " FROM infotaskarticles ita \n"
. " WHERE ita.ta_id = ?)";
$query=$this->HT->query($sql, array($ta_ic_id,$ta_id));
return $query;
}
//获取网前url和标题等
function get_information($ta_id)
{
$sql = "SELECT TOP 1 \n"
. " ic.ic_url, \n"
. " ic.ic_sitecode, \n"
. " ic.ic_title \n"
. "FROM infoContents ic \n"
. "WHERE ic_status = 1 \n"
. " AND ic.ic_id = ?";
$query=$this->HT->query($sql,array($ta_id));
if ($query->num_rows() > 0)
{
$row = $query->row();
return $row;
}
else
{
return FALSE;
}
}
//获取公告列表 //获取网前url和标题等
public function get_announce($announce_id='',$announce_type='notice'){ function get_information($ta_id) {
$map=''; $sql = "SELECT TOP 1 \n"
if ($announce_id!='') { . " ic.ic_url, \n"
$map=" AND i.ta_id = $announce_id"; . " ic.ic_sitecode, \n"
} . " ic.ic_title \n"
$sql = "SELECT i.ta_id, . "FROM infoContents ic \n"
. "WHERE ic_status = 1 \n"
. " AND ic.ic_id = ?";
$query = $this->HT->query($sql, array($ta_id));
if ($query->num_rows() > 0) {
$row = $query->row();
return $row;
} else {
return FALSE;
}
}
//获取公告列表
public function get_announce($announce_id = '', $announce_type = 'notice') {
$map = '';
if ($announce_id != '') {
$map = " AND i.ta_id = $announce_id";
}
$sql = "SELECT i.ta_id,
i.ta_title, i.ta_title,
i.ta_content, i.ta_content,
i.ta_status, i.ta_status,
@ -255,16 +228,17 @@ class Infotaskarticles_model extends CI_Model
FROM infotaskarticles i FROM infotaskarticles i
WHERE i.ta_status='announce' AND i.ta_seo_title=? $map WHERE i.ta_status='announce' AND i.ta_seo_title=? $map
ORDER BY i.ta_datetime DESC"; ORDER BY i.ta_datetime DESC";
$query=$this->HT->query($sql,array($announce_type)); $query = $this->HT->query($sql, array($announce_type));
return $query->result(); return $query->result();
} }
//根据页面路径获取指定信息页的成效信息 //根据页面路径获取指定信息页的成效信息
public function get_analytics_list($kwa_pagepath,$kwa_sitecode,$top=50,$startdate='',$enddate=''){ public function get_analytics_list($kwa_pagepath, $kwa_sitecode, $top = 50, $startdate = '', $enddate = '') {
$topsql=''; $topsql = '';
if($top!=0) $topsql="TOP $top"; if ($top != 0)
$topsql = "TOP $top";
if ($startdate == '') { if ($startdate == '') {
$startdate = time()-7*24*60*60; $startdate = time() - 7 * 24 * 60 * 60;
} }
if ($enddate == '') { if ($enddate == '') {
$enddate = time(); $enddate = time();
@ -284,19 +258,20 @@ class Infotaskarticles_model extends CI_Model
FROM infoKeywordsanalytics FROM infoKeywordsanalytics
WHERE kwa_sitecode = ? AND kwa_pagepath=? AND (kwa_datetime BETWEEN ? and ? ) WHERE kwa_sitecode = ? AND kwa_pagepath=? AND (kwa_datetime BETWEEN ? and ? )
ORDER BY kwa_pageviews DESC"; ORDER BY kwa_pageviews DESC";
$query = $this->HT->query($sql,array($kwa_sitecode,$kwa_pagepath,$startdate,$enddate)); $query = $this->HT->query($sql, array($kwa_sitecode, $kwa_pagepath, $startdate, $enddate));
return $query->result(); return $query->result();
} }
//获取任务审核次数 //获取任务审核次数
public function get_review_count($t_id){ public function get_review_count($t_id) {
$sql="select count(0) as review_count from infoTaskArticles where ta_t_id=? AND ta_status='version'"; $sql = "select count(0) as review_count from infoTaskArticles where ta_t_id=? AND ta_status='version'";
$query = $this->HT->query($sql,array($t_id)); $query = $this->HT->query($sql, array($t_id));
$result = $query->result(); $result = $query->result();
$num=0; $num = 0;
if (!empty($result)) { if (!empty($result)) {
$num=$result[0]->review_count; $num = $result[0]->review_count;
} }
return $num; return $num;
} }
}
}

@ -1,220 +1,190 @@
<?php <?php
class Infotasks_model extends CI_Model class Infotasks_model extends CI_Model {
{
var $insert_id = -1; var $insert_id = -1;
var $top_num=false; var $top_num = false;
var $t_id=false; var $t_id = false;
var $order_by = false; var $order_by = false;
var $t_status = false; var $t_status = false;
var $t_ht_op_code = false; var $t_ht_op_code = false;
var $t_a_id = false; var $t_a_id = false;
var $t_datetime = false; var $t_datetime = false;
var $t_title = false; var $t_title = false;
var $t_td_type = false; var $t_td_type = false;
function __construct() function __construct() {
{
parent::__construct(); parent::__construct();
$this->HT = $this->load->database('HT', TRUE); $this->HT = $this->load->database('HT', TRUE);
} }
function init() function init() {
{ $this->top_num = false;
$this->top_num=false; $this->t_id = false;
$this->t_id=false; $this->order_by = " ORDER BY t.t_id DESC ";
$this->order_by=" ORDER BY t.t_id DESC "; $this->t_status = false;
$this->t_status=false; $this->t_a_id = false;
$this->t_a_id=false; $this->t_datetime = false;
$this->t_datetime = false; $this->t_title = false;
$this->t_title = false; $this->t_td_type = false;
$this->t_td_type=false; }
//正在编辑的任务
function in_edit($t_ht_op_code = false) {
$this->init();
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);
}
}
$this->t_status = " AND t.t_status= 'edit' ";
return $this->get_list();
}
//根据任务状态获取任务列表
function get_task_by_status($t_ht_op_code = false, $t_status = false) {
$this->init();
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')";
return $this->get_list();
}
//待审核任务
function in_review($t_ht_op_code = false) {
$this->init();
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);
}
}
$this->t_status = " AND (t.t_status= 'review' OR t.t_status= 'wait')";
return $this->get_list();
}
//待结算任务
function in_reviewed($t_ht_op_code = false) {
$this->init();
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);
}
}
$this->t_status = " AND t.t_status= 'reviewed' ";
return $this->get_list();
}
//已完成任务
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)) {
$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_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_edit($t_ht_op_code=false) function in_refuse($t_ht_op_code = false) {
{ $this->init();
$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);
if(is_numeric($t_ht_op_code)) } else {
{ $this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code);
$this->t_a_id=" AND t.t_a_id= ".$this->HT->escape($t_ht_op_code); }
} }
else $this->t_status = " AND t.t_status= 'refuse' ";
{ return $this->get_list();
$this->t_ht_op_code=" AND t.t_ht_op_code=".$this->HT->escape($t_ht_op_code); }
}
} //大厅任务
$this->t_status=" AND t.t_status= 'edit' "; function in_hall() {
return $this->get_list(); $this->init();
} $this->t_a_id = " AND t.t_a_id<= 0 ";
return $this->get_list();
//根据任务状态获取任务列表 }
function get_task_by_status($t_ht_op_code=false,$t_status=false)
{ //获取单个任务详细信息
$this->init(); function detail($t_id) {
if(!empty($t_ht_op_code)) $this->init();
{ $this->top_num = 1;
if(is_numeric($t_ht_op_code)){ $this->t_id = " AND t.t_id=" . $this->HT->escape($t_id);
$this->t_a_id=" AND t.t_a_id= ".$this->HT->escape($t_ht_op_code); return $this->get_list();
}else{ }
$this->t_ht_op_code=" AND t.t_ht_op_code=".$this->HT->escape($t_ht_op_code);
} function get_list($get_count = false) {
} $this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT ";
if($t_status) $this->t_status=" AND t.t_status= '$t_status' "; $sql .= " t.t_id, \n"
if($t_status=='review') $this->t_status=" AND (t.t_status= 'review' OR t.t_status= 'wait')"; . " t.t_title, \n"
return $this->get_list(); . " t.t_content, \n"
} . " t.t_status, \n"
. " t.t_a_id, \n"
//待审核任务 . " t.t_ht_op_code, \n"
function in_review($t_ht_op_code=false) . " t.t_td_type, \n"
{ . " t.t_expires, \n"
$this->init(); . " t.t_datetime, \n"
if(!empty($t_ht_op_code)) . " t.t_rating, \n"
{ . " t.t_attach, \n"
if(is_numeric($t_ht_op_code)) . " t.t_sitecode, \n"
{ . " t.t_delete \n"
$this->t_a_id=" AND t.t_a_id= ".$this->HT->escape($t_ht_op_code); . "FROM infotasks t \n"
} . "WHERE t.t_delete = 0 \n";
else if ($get_count)
{ $sql = "SELECT t.t_id FROM infotasks t WHERE t.t_delete = 0";
$this->t_ht_op_code=" AND t.t_ht_op_code=".$this->HT->escape($t_ht_op_code); $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;
$this->t_status=" AND (t.t_status= 'review' OR t.t_status= 'wait')"; $this->t_a_id ? $sql.=$this->t_a_id : false;
return $this->get_list(); $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');
function in_reviewed($t_ht_op_code=false) // 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) ";
$this->init(); $sql.= " AND t.t_sitecode= " . $this->HT->escape($this->config->item('site_code'));
if(!empty($t_ht_op_code))
{ $this->t_datetime ? $sql.=$this->t_datetime : false;
if(is_numeric($t_ht_op_code)) $this->order_by ? $sql.=$this->order_by : false;
{ $query = $this->HT->query($sql);
$this->t_a_id=" AND t.t_a_id= ".$this->HT->escape($t_ht_op_code); //print_r($this->HT->queries);
} if ($this->top_num == 1) {
else if ($query->num_rows() > 0) {
{ $row = $query->row();
$this->t_ht_op_code=" AND t.t_ht_op_code=".$this->HT->escape($t_ht_op_code); return $row;
} } else {
} return FALSE;
$this->t_status=" AND t.t_status= 'reviewed' "; }
return $this->get_list(); } else {
} return $query->result();
}
//已完成任务 }
function in_complete($t_ht_op_code=false,$start_date=false,$end_date=false,$t_title=false)
{ //根据给定id字符串获取任务列表
$this->init(); function get_list_by_taskids($taskids) {
if(!empty($t_ht_op_code)) $sql = "SELECT t.t_id,
{
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_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)
{
$this->init();
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);
}
}
$this->t_status=" AND t.t_status= 'refuse' ";
return $this->get_list();
}
//大厅任务
function in_hall()
{
$this->init();
$this->t_a_id=" AND t.t_a_id= 0 ";
return $this->get_list();
}
//获取单个任务详细信息
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)
{
$this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT ";
$sql .= " t.t_id, \n"
. " t.t_title, \n"
. " t.t_content, \n"
. " t.t_status, \n"
. " t.t_a_id, \n"
. " t.t_ht_op_code, \n"
. " t.t_td_type, \n"
. " t.t_expires, \n"
. " t.t_datetime, \n"
. " t.t_rating, \n"
. " t.t_attach, \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";
$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;
$this->t_a_id ? $sql.=$this->t_a_id : false;
$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) ";
$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)
{
$row = $query->row();
return $row;
}
else
{
return FALSE;
}
}
else
{
return $query->result();
}
}
//根据给定id字符串获取任务列表
function get_list_by_taskids($taskids)
{
$sql = "SELECT t.t_id,
t.t_title, t.t_title,
t.t_content, t.t_content,
t.t_status, t.t_status,
@ -229,80 +199,75 @@ class Infotasks_model extends CI_Model
FROM infotasks t FROM infotasks t
WHERE t.t_id IN ($taskids) WHERE t.t_id IN ($taskids)
ORDER BY t.t_datetime DESC"; ORDER BY t.t_datetime DESC";
$query=$this->HT->query($sql); $query = $this->HT->query($sql);
return $query->result(); return $query->result();
} }
//根据不同状态获取任务列表
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)){
$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);
}
}else{
$this->t_a_id=" AND t.t_a_id= 0";
}
//已发布的和已完成的任务计算在已完成的任务里
if($t_status=='complete')
{
$this->t_status = " AND (t.t_status= 'complete' OR t.t_status= 'published') ";
}
else if($t_status=='review')
{
$this->t_status=" AND (t.t_status= 'review' OR t.t_status= 'wait')";
}
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' ";
return $this->get_list($page_flag);
}
//根据不同状态获取任务列表
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)) {
$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);
}
} else {
$this->t_a_id = " AND t.t_a_id<= 0";
}
//已发布的和已完成的任务计算在已完成的任务里
if ($t_status == 'complete') {
$this->t_status = " AND (t.t_status= 'complete' OR t.t_status= 'published') ";
} else if ($t_status == 'review') {
$this->t_status = " AND (t.t_status= 'review' OR t.t_status= 'wait')";
} 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' ";
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"
$sql = "INSERT INTO infotasks \n" . " ( \n"
. " ( \n" . " t_title, \n"
. " t_title, \n" . " t_content, \n"
. " t_content, \n" . " t_a_id, \n"
. " t_a_id, \n" . " t_ht_op_code, \n"
. " t_ht_op_code, \n" . " t_td_type, \n"
. " t_td_type, \n" . " t_expires, \n"
. " t_expires, \n" . " t_status, \n"
. " t_status, \n" . " t_sitecode, \n"
. " t_delete, \n" . " t_delete, \n"
. " t_datetime, \n" . " t_datetime, \n"
. " t_attach \n" . " t_attach \n"
. " ) \n" . " ) \n"
. "VALUES \n" . "VALUES \n"
. " ( \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'); $this->insert_id = $this->HT->last_id('infotasks');
return $query; return $query;
//print_r($this->HT->queries); //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 = '';
$t_status_sql=''; if ($t_status != '') {
if ($t_status!='') { $t_status_sql = "t_status='$t_status',";
$t_status_sql="t_status='$t_status',"; }
} if ($t_attach) {
if ($t_attach) { $t_status_sql.="t_attach = '$t_attach',";
$t_status_sql.="t_attach = '$t_attach',"; }
} $sql = "UPDATE infotasks SET
$sql = "UPDATE infotasks SET
t_title = N?, t_title = N?,
t_content = N?, t_content = N?,
t_a_id = ?, t_a_id = ?,
@ -311,85 +276,81 @@ class Infotasks_model extends CI_Model
$t_status_sql $t_status_sql
t_datetime = GETDATE() t_datetime = GETDATE()
WHERE t_id = ?"; WHERE t_id = ?";
$query=$this->HT->query($sql, array($t_title, $t_content, $t_a_id, $t_td_type, $t_expires,$t_id)); $query = $this->HT->query($sql, array($t_title, $t_content, $t_a_id, $t_td_type, $t_expires, $t_id));
return $query; return $query;
//print_r($this->HT->queries); //print_r($this->HT->queries);
}
//删除
function delete($t_id) {
$sql = "UPDATE infotasks \n"
. "SET t_delete = 1 \n"
. "WHERE t_id = ?";
$query = $this->HT->query($sql, array($t_id));
return $query;
}
//审核
function reviwed($t_id, $t_status) {
$sql = "UPDATE infotasks \n"
. "SET t_status = ? \n"
. "WHERE t_id = ?";
$query = $this->HT->query($sql, array($t_status, $t_id));
return $query;
} }
//删除 //承接任务
function delete($t_id) function undertake($t_id, $a_id) {
{ $sql = "UPDATE infotasks \n"
$sql = "UPDATE infotasks \n" . "SET t_a_id = ? \n"
. "SET t_delete = 1 \n" . "WHERE t_id = ?";
. "WHERE t_id = ?"; $query = $this->HT->query($sql, array($a_id, $t_id));
$query=$this->HT->query($sql, array($t_id)); return $query;
return $query; }
}
//取消任务
//审核 function canceltake($t_id) {
function reviwed($t_id,$t_status) $sql = "UPDATE infotasks \n"
{ . "SET t_a_id = 0 \n"
$sql = "UPDATE infotasks \n" . "WHERE t_id = ?";
. "SET t_status = ? \n" $query = $this->HT->query($sql, array($t_id));
. "WHERE t_id = ?"; return $query;
$query=$this->HT->query($sql, array($t_status,$t_id)); }
return $query;
} //判断任务是否已上线
public function is_in_used($ta_id) {
//承接任务 $sql = "SELECT TOP 1 t_status,ic_status
function undertake($t_id,$a_id)
{
$sql = "UPDATE infotasks \n"
. "SET t_a_id = ? \n"
. "WHERE t_id = ?";
$query=$this->HT->query($sql, array($a_id,$t_id));
return $query;
}
//取消任务
function canceltake($t_id)
{
$sql = "UPDATE infotasks \n"
. "SET t_a_id = 0 \n"
. "WHERE t_id = ?";
$query=$this->HT->query($sql, array($t_id));
return $query;
}
//判断任务是否已上线
public function is_in_used($ta_id){
$sql="SELECT TOP 1 t_status,ic_status
FROM infoTaskArticles FROM infoTaskArticles
INNER JOIN infoContents ON ic_id=ta_ic_id INNER JOIN infoContents ON ic_id=ta_ic_id
LEFT JOIN infotasks ON t_id=ta_t_id LEFT JOIN infotasks ON t_id=ta_t_id
WHERE ta_id=?"; WHERE ta_id=?";
$query=$this->HT->query($sql, array($ta_id)); $query = $this->HT->query($sql, array($ta_id));
$result=$query->result(); $result = $query->result();
if (empty($result)) { if (empty($result)) {
return 0; return 0;
}else{ } else {
$result=$result[0]; $result = $result[0];
//信息平台和作者平台同时是发布状态时 //信息平台和作者平台同时是发布状态时
if ($result->t_status=='published' AND $result->ic_status==1) { if ($result->t_status == 'published' AND $result->ic_status == 1) {
return 1; return 1;
}else{ } else {
return 0; return 0;
} }
} }
} }
//获取任务大厅任务个数 //获取任务大厅任务个数
public function task_hall_count(){ public function task_hall_count() {
$result=$this->in_hall(); $result = $this->in_hall();
$num=count($result); $num = count($result);
return $num; return $num;
} }
//获取每月优秀文章排行榜 //获取每月优秀文章排行榜
public function get_article_rank_list(){ public function get_article_rank_list() {
$day_end = date('Y-m-01'); $day_end = date('Y-m-01');
$day_start = date('Y-m-d', strtotime("$day_end -1 month")); $day_start = date('Y-m-d', strtotime("$day_end -1 month"));
$sql="SELECT $sql = "SELECT
t_id, t_id,
t_title, t_title,
t_a_id, t_a_id,
@ -401,58 +362,71 @@ class Infotasks_model extends CI_Model
INNER JOIN infoTaskArticles ON t_id=ta_t_id INNER JOIN infoTaskArticles ON t_id=ta_t_id
WHERE ta_isbest between ? AND ? WHERE ta_isbest between ? AND ?
ORDER BY t_rating_total DESC"; ORDER BY t_rating_total DESC";
$query=$this->HT->query($sql,array($day_start,$day_end)); $query = $this->HT->query($sql, array($day_start, $day_end));
$result=$query->result(); $result = $query->result();
return $result; return $result;
} }
//获取最新活跃作者 //获取最新活跃作者
public function get_author_rank_list($top=1){ public function get_author_rank_list($top = 1) {
$sql="SELECT TOP $top t_a_id,t_active_author FROM infotasks WHERE t_active_author is not null"; $sql = "SELECT TOP $top t_a_id,t_active_author FROM infotasks WHERE t_active_author is not null";
$query=$this->HT->query($sql); $query = $this->HT->query($sql);
$result=$query->result(); $result = $query->result();
if (!empty($result) && $top==1) { if (!empty($result) && $top == 1) {
return $result[0]; return $result[0];
} }
return $result; return $result;
} }
//获取不同任务状态的任务数量 //获取不同任务状态的任务数量
public function get_task_count_by_status(){ public function get_task_count_by_status() {
$admin_info = $this->session->userdata('session_admin'); $admin_info = $this->session->userdata('session_admin');
$t_ht_op_code=$admin_info->a_id; $t_ht_op_code = $admin_info->a_id;
if(is_numeric($t_ht_op_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{ } 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";
$query=$this->HT->query($sql); $site_code = $this->config->item('site_code');
$result=$query->result(); if ($site_code == 'cht') { //早期的任务没有设置站点默认是cht
$counts=array(); $where.=" AND ( t_sitecode= '$site_code' OR t_sitecode is null )";
if (!empty($result)) { } else {
foreach ($result as $v) { $where.=" AND t_sitecode= '$site_code' ";
$counts[$v->t_status]=$v->task_count; }
}
//已完成数量=完成数量+已发布的数量 $sql = "SELECT t_status, count(0) as task_count FROM infotasks WHERE $where AND t_delete=0 group by t_status";
$complete_count=$published_count=0; $query = $this->HT->query($sql);
if(isset($counts['complete']))$complete_count=$counts['complete']; $result = $query->result();
if(isset($counts['published']))$published_count=$counts['published']; $counts = array();
$counts['complete']=$complete_count+$published_count; if (!empty($result)) {
foreach ($result as $v) {
//正在进行中的任务=edit+unreviewed的数量 $counts[$v->t_status] = $v->task_count;
$edit_count=$unreviewed_count=0; }
if(isset($counts['edit']))$edit_count=$counts['edit']; //已完成数量=完成数量+已发布的数量
$counts['edit']=$edit_count; $complete_count = $published_count = 0;
if (isset($counts['complete']))
$review_count=$wait_count=0; $complete_count = $counts['complete'];
if(isset($counts['review']))$review_count=$counts['review']; if (isset($counts['published']))
if(isset($counts['wait']))$wait_count=$counts['wait']; $published_count = $counts['published'];
$counts['review']=$review_count+$wait_count; $counts['complete'] = $complete_count + $published_count;
return $counts; //正在进行中的任务=edit+unreviewed的数量
} $edit_count = $unreviewed_count = 0;
return false; 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'];
$counts['review'] = $review_count + $wait_count;
return $counts;
}
return false;
} }
} }

@ -4,19 +4,19 @@
var editor; var editor;
KindEditor.ready(function(K) { KindEditor.ready(function(K) {
editor = K.create('#ta_content', { editor = K.create('#ta_content', {
width : '100%', width: '100%',
height:'480px', height: '480px',
//fileManagerJson:'/js/kcfinder/browse.php', //fileManagerJson:'/js/kcfinder/browse.php',
//allowFileManager:true, //allowFileManager:true,
allowImageUpload:false, allowImageUpload: false,
filterMode : false, filterMode: false,
langType : 'en', langType: 'en',
items : [ items: [
'ace', '|', 'undo', 'redo', '|', 'preview', 'cut', 'copy', 'paste', 'plainpaste', 'wordpaste', '|', 'ace', '|', 'undo', 'redo', '|', 'preview', 'cut', 'copy', 'paste', 'plainpaste', 'wordpaste', '|',
'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', '|',
'clearhtml', 'quickformat','removeformat', 'selectall', '/','fullscreen', '|', 'clearhtml', 'quickformat', 'removeformat', 'selectall', '/', 'fullscreen', '|',
'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
'italic', 'underline', 'strikethrough', 'lineheight', '|', 'table', 'hr', 'emoticons','image', 'map', 'pagebreak', 'italic', 'underline', 'strikethrough', 'lineheight', '|', 'table', 'hr', 'emoticons', 'image', 'map', 'pagebreak',
'link', 'unlink', '|', 'about', '|', 'source' 'link', 'unlink', '|', 'about', '|', 'source'
], ],
afterChange: function() { afterChange: function() {
@ -26,26 +26,26 @@
}); });
//加载预览样式 //加载预览样式
function load_preview_css(){ function load_preview_css() {
$("iframe.ke-edit-iframe").contents().find("head").append('<?php echo $this->config->item("css_source_".$this->config->item("site_code")); ?><style>.drop1{height:auto !important;} .photoRight img{max-width:100%;height:auto !important;}</style>'); $("iframe.ke-edit-iframe").contents().find("head").append('<?php echo $this->config->item("css_source_" . $this->config->item("site_code")); ?><style>.drop1{height:auto !important;} .photoRight img{max-width:100%;height:auto !important;}</style>');
$("iframe.ke-edit-iframe").contents().find(".ke-content").css({"max-width":"1024px","margin-left":"auto","margin-right":"auto"}); $("iframe.ke-edit-iframe").contents().find(".ke-content").css({"max-width": "1024px", "margin-left": "auto", "margin-right": "auto"});
} }
$(document).ready(function() { $(document).ready(function() {
//每隔三分钟自动保存一次任务内容 //每隔三分钟自动保存一次任务内容
setInterval(function(){ setInterval(function() {
editor.sync(); editor.sync();
var data=$('#form_article').serialize(); var data = $('#form_article').serialize();
var url= '<?php echo site_url('welcome/edit_submit') ?>'; var url = '<?php echo site_url('welcome/edit_submit') ?>';
$.post(url,data,function(responseText){ $.post(url, data, function(responseText) {
var responseText=eval("("+responseText+")");//转换为json对象 var responseText = eval("(" + responseText + ")");//转换为json对象
for (var key in responseText) { for (var key in responseText) {
if (responseText[key].name != 'ok') { if (responseText[key].name != 'ok') {
$("#auto-save").html('(自动保存失败...)'); $("#auto-save").html('(自动保存失败...)');
}
} }
} });
});
}, 180000); }, 180000);
//ajax获取获取google分析数据的日期设置 //ajax获取获取google分析数据的日期设置
@ -54,163 +54,149 @@
}); });
$("#total-analytics>a").trigger("click"); $("#total-analytics>a").trigger("click");
$("#rating-container>ul>li").hover(function(){ $("#rating-container>ul>li").hover(function() {
$(this).tooltip('show'); $(this).tooltip('show');
}); });
}); });
//快速图片上传 //快速图片上传
function openKCFinder_ta_photo() { function openKCFinder_ta_photo() {
window.CallBack=openKCFinder_ta_photo_callback; window.CallBack = openKCFinder_ta_photo_callback;
window.open('/media/popselectpicture.php?site_lgc=1', 'kcfinder_textbox', 'status=0, toolbar=0, location=0, menubar=0, directories=0,resizable=1, scrollbars=0, width=800, height=600' ); window.open('/media/popselectpicture.php?site_lgc=1', 'kcfinder_textbox', 'status=0, toolbar=0, location=0, menubar=0, directories=0,resizable=1, scrollbars=0, width=800, height=600');
} }
function openKCFinder_ta_photo_callback(result) { function openKCFinder_ta_photo_callback(result) {
if (result != null && result.Pinfo[0]) { if (result != null && result.Pinfo[0]) {
$('#ta_photo').val(result.Pinfo[0].PUrl); $('#ta_photo').val(result.Pinfo[0].PUrl);
$("#ta_photo_img").attr("src","<?php echo $this->config->item('media_image_url'); ?>"+result.Pinfo[0].PUrl); $("#ta_photo_img").attr("src", "<?php echo $this->config->item('media_image_url'); ?>" + result.Pinfo[0].PUrl);
} }
} }
//选择内容图片 //选择内容图片
function openKCFinder_Content() { function openKCFinder_Content() {
window.CallBack=openKCFinder_Content_callback; window.CallBack = openKCFinder_Content_callback;
window.open('/media/popselectpicture.php?site_lgc=1', 'kcfinder_textbox', 'status=0, toolbar=0, location=0, menubar=0, directories=0,resizable=1, scrollbars=0, width=800, height=600' ); window.open('/media/popselectpicture.php?site_lgc=1', 'kcfinder_textbox', 'status=0, toolbar=0, location=0, menubar=0, directories=0,resizable=1, scrollbars=0, width=800, height=600');
} }
function openKCFinder_Content_callback(result) { function openKCFinder_Content_callback(result) {
var site_image_url='<?php echo $this->config->item('media_image_url') ?>'; var site_image_url = '<?php echo $this->config->item('media_image_url') ?>';
if (result != null){ if (result != null) {
for(var key in result.Pinfo){ for (var key in result.Pinfo) {
editor.insertHtml('<img src="'+site_image_url+result.Pinfo[key].PUrl+'" alt="'+result.Pinfo[key].PName+'" width="'+result.Pinfo[key].Width+'" height="'+result.Pinfo[key].Height+'" />'); editor.insertHtml('<img src="' + site_image_url + result.Pinfo[key].PUrl + '" alt="' + result.Pinfo[key].PName + '" width="' + result.Pinfo[key].Width + '" height="' + result.Pinfo[key].Height + '" />');
} }
} }
} }
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> </script>
<div class="row-fluid"> <div class="row-fluid">
<div class="span8 offset2" style="min-height:650px;"> <div class="span8 offset2" style="min-height:650px;">
<legend>Task requirement</legend> <legend>Task requirement</legend>
<div style="background:#f5f5f5;padding:15px;margin-bottom:15px;"> <div style="background:#f5f5f5;padding:15px;margin-bottom:15px;">
<div class="row-fluid"> <div class="row-fluid">
<div class="span12"> <div class="span12">
<strong>Task name:</strong>: <strong>Task name:</strong>:
<?php echo $task->t_title; ?> <?php echo $task->t_title; ?>
</div> </div>
</div> </div>
<div class="row-fluid"> <div class="row-fluid">
<div class="span3"> <div class="span3">
<strong>Task type:</strong> <strong>Task type:</strong>
<?php echo $task->t_td_type; ?> <?php echo $task->t_td_type; ?>
</div>
<div class="span3">
<strong>Send by:</strong>
<?php echo get_author_name($task->t_ht_op_code); ?>
</div>
<div class="span6">
<strong>Task Deadline:</strong>
<?php echo date('m/d/Y', strtotime($task->t_expires)); ?>
</div>
</div>
<div class="row-fluid">
<p><strong>Task requirement</strong><?php echo $task->t_content; ?></p>
</div>
</div> </div>
<div class="span3">
<strong>Send by:</strong>
<?php echo get_author_name($task->t_ht_op_code); ?>
</div>
<div class="span6">
<strong>Task Deadline:</strong>
<?php echo date('m/d/Y',strtotime($task->t_expires)); ?>
</div>
</div>
<div class="row-fluid">
<p><strong>Task requirement</strong><?php echo $task->t_content; ?></p>
</div>
</div>
<legend class="<?php if($task_detail->ta_content=='') echo 'hide'; ?>"> <legend class="<?php if ($task_detail->ta_content == '') echo 'hide'; ?>">
<span>Task details</span> <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"> </legend>
<a href="javascript:void(0);" onClick="get_analytics_ajax('get-analytic-form','total-analytics','1');">获取google分析汇总数据</a> <form action="#" class="<?php if ($task_detail->ta_content == '') echo 'hide'; ?>" name="form_article" id="form_article" method="post">
</span> <label class="control-label" >Title</label>
</legend> <input type="text" class="span12" id="ta_title" name="ta_title" placeholder="Title" value="<?php if (isset($task_detail->ta_title)) echo $task_detail->ta_title; ?>">
<form action="#" class="<?php if($task_detail->ta_content=='') echo 'hide'; ?>" name="form_article" id="form_article" method="post"> <label><strong>Content</strong><em id="auto-save" class="small"></em></label>
<label class="control-label" >Title</label> <a href="javascript:void(0);" onclick="openKCFinder_Content();" title="Insert an image"><i class="icon-picture pull-right"></i></a>
<input type="text" class="span12" id="ta_title" name="ta_title" placeholder="Title" value="<?php if(isset($task_detail->ta_title))echo $task_detail->ta_title; ?>"> <i class="icon-stop icon-white pull-right"> </i>
<label><strong>Content</strong><em id="auto-save" class="small"></em></label> <i class="icon-stop icon-white pull-right" id="display_count">-</i>
<a href="javascript:void(0);" onclick="openKCFinder_Content();" title="Insert an image"><i class="icon-picture pull-right"></i></a> <textarea rows="12" class="span12" id="ta_content" name="ta_content"><?php if (isset($task_detail->ta_content)) echo $task_detail->ta_content; ?></textarea>
<i class="icon-stop icon-white pull-right"> </i> <p> </p>
<i class="icon-stop icon-white pull-right" id="display_count">-</i> <label><strong>Brief introduction</strong></label>
<textarea rows="12" class="span12" id="ta_content" name="ta_content"><?php if(isset($task_detail->ta_content))echo $task_detail->ta_content; ?></textarea> <textarea rows="3" class="span12" id="ta_summary" name="ta_summary" placeholder="Brief introduction"><?php if (isset($task_detail->ta_summary)) echo $task_detail->ta_summary; ?></textarea>
<p> </p> <label class="control-label" ><strong>SEO title</strong></label>
<label><strong>Brief introduction</strong></label> <input type="text" class="span12" id="ta_seo_title" name="ta_seo_title" placeholder="SEO title" value="<?php if (isset($task_detail->ta_seo_title)) echo $task_detail->ta_seo_title; ?>">
<textarea rows="3" class="span12" id="ta_summary" name="ta_summary" placeholder="Brief introduction"><?php if(isset($task_detail->ta_summary))echo $task_detail->ta_summary; ?></textarea> <label class="control-label" ><strong>SEO description</strong></label>
<label class="control-label" ><strong>SEO title</strong></label> <input type="text" class="span12" id="ta_seo_description" name="ta_seo_description" placeholder="SEO discription" value="<?php if (isset($task_detail->ta_seo_description)) echo $task_detail->ta_seo_description; ?>">
<input type="text" class="span12" id="ta_seo_title" name="ta_seo_title" placeholder="SEO title" value="<?php if(isset($task_detail->ta_seo_title))echo $task_detail->ta_seo_title; ?>"> <label class="control-label" ><strong>SEO Keywords</strong></label>
<label class="control-label" ><strong>SEO description</strong></label> <input type="text" class="span12" id="ta_seo_keywords" name="ta_seo_keywords" placeholder="SEO keyworkds" value="<?php if (isset($task_detail->ta_seo_keywords)) echo $task_detail->ta_seo_keywords; ?>">
<input type="text" class="span12" id="ta_seo_description" name="ta_seo_description" placeholder="SEO discription" value="<?php if(isset($task_detail->ta_seo_description))echo $task_detail->ta_seo_description; ?>"> <label class="control-label" ><strong>Link Picture</strong></label>
<label class="control-label" ><strong>SEO Keywords</strong></label> <div class="media" style="background: #f5f5f5;padding: 15px;">
<input type="text" class="span12" id="ta_seo_keywords" name="ta_seo_keywords" placeholder="SEO keyworkds" value="<?php if(isset($task_detail->ta_seo_keywords))echo $task_detail->ta_seo_keywords; ?>"> <div class="pull-left">
<label class="control-label" ><strong>Link Picture</strong></label> <img style="width:250px;" onclick="openKCFinder_ta_photo();" src="<?php echo empty($task_detail->ta_photo) ? '/css/images/uploadPic.jpg' : $this->config->item('media_image_url') . $task_detail->ta_photo; ?>" class="img-polaroid span4" name="ta_photo_img" id="ta_photo_img" >
<div class="media" style="background: #f5f5f5;padding: 15px;"> </div>
<div class="pull-left"> <div class="media-body">
<img style="width:250px;" onclick="openKCFinder_ta_photo();" src="<?php echo empty($task_detail->ta_photo)?'/css/images/uploadPic.jpg':$this->config->item('media_image_url').$task_detail->ta_photo; ?>" class="img-polaroid span4" name="ta_photo_img" id="ta_photo_img" > <button type="button" onclick="openKCFinder_ta_photo();" class="btn" style="margin:25px 0;">Choose</button><br>
</div> <button type="button" onclick="$('#ta_photo').val('');
<div class="media-body"> $('#ta_photo_img').attr('src', '/css/images/uploadPic.jpg');" class="btn" style="margin-bottom:12px;"> Reset </button>
<button type="button" onclick="openKCFinder_ta_photo();" class="btn" style="margin:25px 0;">Choose</button><br> <p>Click the “Choose” button<br> to choose a photo from our Photo Galleries.</p>
<button type="button" onclick="$('#ta_photo').val('');$('#ta_photo_img').attr('src','/css/images/uploadPic.jpg');" class="btn" style="margin-bottom:12px;"> Reset </button> </div>
<p>Click the “Choose” button<br> to choose a photo from our Photo Galleries.</p> <input type="hidden" name="ta_photo" id="ta_photo" value="<?php if (isset($task_detail->ta_photo)) echo $task_detail->ta_photo; ?>" />
<input type="hidden" name="ht_user" value="<?php echo $task->t_ht_op_code; ?>">
<input type="hidden" name="t_a_id" value="<?php echo $task->t_a_id; ?>">
<input type="hidden" id="t_id" name="t_id" value="<?php echo $task->t_id; ?>" >
<input type="hidden" id="ta_ic_id" name="ta_ic_id" value="<?php if (isset($task_detail->ta_ic_id)) echo $task_detail->ta_ic_id; ?>" >
</div>
</form>
<div class="btn-group pull-right" style="margin-bottom:50px;">
<?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>
<p> </p>
</div> </div>
<input type="hidden" name="ta_photo" id="ta_photo" value="<?php if(isset($task_detail->ta_photo))echo $task_detail->ta_photo; ?>" />
<input type="hidden" name="ht_user" value="<?php echo $task->t_ht_op_code; ?>">
<input type="hidden" name="t_a_id" value="<?php echo $task->t_a_id; ?>">
<input type="hidden" id="t_id" name="t_id" value="<?php echo $task->t_id; ?>" >
<input type="hidden" id="ta_ic_id" name="ta_ic_id" value="<?php if(isset($task_detail->ta_ic_id))echo $task_detail->ta_ic_id; ?>" >
</div>
</form>
<div class="btn-group pull-right" style="margin-bottom:50px;">
<?php empty($task->t_a_id)?$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>
</div> </div>
</div> </div>
<!-- 承接任务 --> <!-- 承接任务 -->
<div class="modal fade" id="undertake_modal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal fade" id="undertake_modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Accept the task</h3> <h3>Accept the task</h3>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p>Make sure again.</p> <p>Make sure again.</p>
<form action="<?php echo site_url('taskhall/undertake') ?>" name="form_undertake" id="form_undertake" method="post"> <form action="<?php echo site_url('taskhall/undertake') ?>" name="form_undertake" id="form_undertake" method="post">
<input type="hidden" id="t_id" name="t_id" value="<?php echo $task->t_id; ?>" > <input type="hidden" id="t_id" name="t_id" value="<?php echo $task->t_id; ?>" >
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">No</button> <button class="btn" data-dismiss="modal" aria-hidden="true">No</button>
<button class="btn btn-primary" onclick="submitForm('form_undertake');">Yes</button> <button class="btn btn-primary" onclick="submitForm('form_undertake');">Yes</button>
</div> </div>
</div> </div>
<!-- 放弃任务 --> <!-- 放弃任务 -->
<div class="modal fade" id="canceltake_modal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal fade" id="canceltake_modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Give up the task</h3> <h3>Give up the task</h3>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p>Make sure again.</p> <p>Make sure again.</p>
<form action="<?php echo site_url('taskhall/canceltake') ?>" name="form_canceltake" id="form_canceltake" method="post"> <form action="<?php echo site_url('taskhall/canceltake') ?>" name="form_canceltake" id="form_canceltake" method="post">
<input type="hidden" id="t_id" name="t_id" value="<?php echo $task->t_id; ?>" > <input type="hidden" id="t_id" name="t_id" value="<?php echo $task->t_id; ?>" >
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">No</button> <button class="btn" data-dismiss="modal" aria-hidden="true">No</button>
<button class="btn btn-primary" onclick="submitForm('form_canceltake');">Yes</button> <button class="btn btn-primary" onclick="submitForm('form_canceltake');">Yes</button>
</div> </div>
</div> </div>

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

Loading…
Cancel
Save