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

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() {
echo '信息首页';
$this->load->model('pictureUseStat_model');
$this->pictureUseStat_model->test();
}
public function add($is_parent_id) {

@ -49,6 +49,9 @@ class Login extends CI_Controller {
//站点切换
public function change_site($site_code) {
//来源页面,成功切换站点之后转到原始页面去 ,如果在各编辑界面切换则会导致站点错误比如ch的文章id=100切换到gm下就没有id=100只能切换的某个板块
// $referer = empty($_SERVER['HTTP_REFERER']) ? false : $_SERVER['HTTP_REFERER'];
$this->permission->is_admin();
$this->load->library('Accesscheck');
@ -70,7 +73,6 @@ class Login extends CI_Controller {
} else {
redirect(site_url());
}
return TRUE;
}
@ -126,7 +128,7 @@ class Login extends CI_Controller {
$this->session->set_userdata('session_site', $site_item);
$this->session->set_userdata('session_color', '');
$data[] = array('name' => 'go', 'value' => site_url());
echo json_encode($data);
return TRUE;
}
@ -146,7 +148,7 @@ class Login extends CI_Controller {
//用户名和密码不正确,或者没有管理权限
if ($this->session->userdata('session_admin') === false) {
$data[] = array('name' => 'login_warning', 'value' => $this->lang->line('login_warning'));
echo json_encode($data);
}

@ -1,320 +1,286 @@
<?php
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;
class Infotasks_model extends CI_Model {
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();
$this->HT = $this->load->database('HT', TRUE);
}
function init()
{
$this->top_num=false;
$this->t_id=false;
$this->order_by=" ORDER BY t.t_id DESC ";
$this->t_status=false;
$this->t_a_id=false;
$this->t_td_type=false;
$this->t_title = false;
function init() {
$this->top_num = false;
$this->t_id = false;
$this->order_by = " ORDER BY t.t_id DESC ";
$this->t_status = false;
$this->t_a_id = false;
$this->t_td_type = 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 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 get_list($page_flag=false)
{
$this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT ";
$sql .= " t.t_id, \n"
. " t.t_title, \n"
. " 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_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 get_list($page_flag = false) {
$this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT ";
$sql .= " t.t_id, \n"
. " t.t_title, \n"
. " 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_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;
$site_code = $this->config->item('site_code');
if ($site_code == 'cht') { //早期的任务没有设置站点默认是cht
$sql.=" AND ( t.t_sitecode= '$site_code' OR t.t_sitecode is null )";
} else {
$sql.=" AND t.t_sitecode= '$site_code' ";
}
$this->order_by ? $sql.=$this->order_by : false;
$query = $this->HT->query($sql);
if ($this->top_num == 1) {
if ($query->num_rows() > 0) {
$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')
{
$sql = "INSERT INTO infotasks \n"
. " ( \n"
. " t_title, \n"
. " t_content, \n"
. " t_a_id, \n"
. " t_ht_op_code, \n"
. " t_td_type, \n"
. " t_expires, \n"
. " t_sitecode, \n"
. " t_status, \n"
. " t_delete, \n"
. " t_datetime \n"
. " ) \n"
. "VALUES \n"
. " ( \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));
function add($t_title, $t_content, $t_a_id, $t_ht_op_code, $t_td_type, $t_expires, $t_sitecode = 'cht') {
$sql = "INSERT INTO infotasks \n"
. " ( \n"
. " t_title, \n"
. " t_content, \n"
. " t_a_id, \n"
. " t_ht_op_code, \n"
. " t_td_type, \n"
. " t_expires, \n"
. " t_sitecode, \n"
. " t_status, \n"
. " t_delete, \n"
. " t_datetime \n"
. " ) \n"
. "VALUES \n"
. " ( \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));
$this->insert_id = $this->HT->last_id('infotasks');
return $query;
//print_r($this->HT->queries);
return $query;
//print_r($this->HT->queries);
}
//更新
function update($t_id,$t_title, $t_content, $t_a_id, $t_td_type, $t_expires)
{
$sql = "UPDATE infotasks \n"
. "SET t_title = N?, \n"
. " t_content = N?, \n"
. " t_a_id = ?, \n"
. " t_td_type = ?, \n"
. " t_expires = ?, \n"
. " t_datetime = GETDATE() \n"
. "WHERE t_id = ?";
$query=$this->HT->query($sql, array($t_title, $t_content, $t_a_id, $t_td_type, $t_expires,$t_id));
return $query;
//print_r($this->HT->queries);
function update($t_id, $t_title, $t_content, $t_a_id, $t_td_type, $t_expires) {
$sql = "UPDATE infotasks \n"
. "SET t_title = N?, \n"
. " t_content = N?, \n"
. " t_a_id = ?, \n"
. " t_td_type = ?, \n"
. " t_expires = ?, \n"
. " t_datetime = GETDATE() \n"
. "WHERE t_id = ?";
$query = $this->HT->query($sql, array($t_title, $t_content, $t_a_id, $t_td_type, $t_expires, $t_id));
return $query;
//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)
{
$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=='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);
}
//取消任务
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;
}
//根据给定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,
//根据不同状态获取任务列表
public function get_tasks_list($t_status = false, $t_ht_op_code = false, $t_a_id = false, $t_td_type = false, $start_date = false, $end_date = false, $tasktitle = false, $page_flag = false) {
$this->init();
if (!empty($t_ht_op_code)) {
if (is_numeric($t_ht_op_code)) {
$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 == '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_content,
t.t_status,
@ -330,129 +296,143 @@ class Infotasks_model extends CI_Model
FROM infotasks t
WHERE t.t_id IN ($taskids)
$ordermap";
$query=$this->HT->query($sql);
return $query->result();
}
$query = $this->HT->query($sql);
return $query->result();
}
//评选最活跃作者
function set_active_author($t_id,$t_active_author,$ta_id)
{
//设置活跃作者标识
$sql = "UPDATE infotasks \n"
. "SET t_active_author = ? \n"
. "WHERE t_id = ?";
$query=$this->HT->query($sql, array($t_active_author, $t_id));
//评选最活跃作者
function set_active_author($t_id, $t_active_author, $ta_id) {
//设置活跃作者标识
$sql = "UPDATE infotasks \n"
. "SET t_active_author = ? \n"
. "WHERE t_id = ?";
$query = $this->HT->query($sql, array($t_active_author, $t_id));
//给活跃作者添加奖励
if ($query) {
$sql = "UPDATE infotaskarticles \n"
. "SET ta_charge = ta_charge+150 \n"
. "WHERE ta_id = ?";
$query2= $this->HT->query($sql,array($ta_id));
return $query2;
}else{
return false;
$sql = "UPDATE infotaskarticles \n"
. "SET ta_charge = ta_charge+150 \n"
. "WHERE ta_id = ?";
$query2 = $this->HT->query($sql, array($ta_id));
return $query2;
} else {
return false;
}
}
//获取作者总字数排行榜
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'";
$query= $this->HT->query($sql);
$result=$query->result();
$rank=array();
$rank_author=array();
$active_author=array();
foreach ($result as $item) {
if(!isset($rank_author[$item->t_a_id]))$rank_author[$item->t_a_id]=$item;
if(!isset($rank[$item->t_a_id]))$rank[$item->t_a_id]=0;
$rank[$item->t_a_id]+=$item->ta_count;
}
//获取第一名的数据
arsort($rank);
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'";
$query = $this->HT->query($sql);
$result = $query->result();
$rank = array();
$rank_author = array();
$active_author = array();
foreach ($result as $item) {
if (!isset($rank_author[$item->t_a_id]))
$rank_author[$item->t_a_id] = $item;
if (!isset($rank[$item->t_a_id]))
$rank[$item->t_a_id] = 0;
$rank[$item->t_a_id]+=$item->ta_count;
}
//获取第一名的数据
arsort($rank);
foreach ($rank as $key => $v) {
$active_author['author_num']=count($rank);
$active_author['count']=$v;
$active_author['task_id']=$rank_author[$key]->t_id;
$active_author['ta_id']=$rank_author[$key]->ta_id;
$active_author['t_a_id']=$key;
$active_author['author_num'] = count($rank);
$active_author['count'] = $v;
$active_author['task_id'] = $rank_author[$key]->t_id;
$active_author['ta_id'] = $rank_author[$key]->ta_id;
$active_author['t_a_id'] = $key;
break;
}
return $active_author;
return $active_author;
}
//查询是否已设置当月活跃作者
public function is_active_author(){
$datetime=date('Y-m-01');
$sql="SELECT TOP 1 t_active_author FROM infotasks WHERE t_active_author>'$datetime'";
$query=$this->HT->query($sql);
$result=$query->result();
if (!empty($result)) {
return 1;
}
return 0;
public function is_active_author() {
$datetime = date('Y-m-01');
$sql = "SELECT TOP 1 t_active_author FROM infotasks WHERE t_active_author>'$datetime'";
$query = $this->HT->query($sql);
$result = $query->result();
if (!empty($result)) {
return 1;
}
return 0;
}
public function get_tasks_rank($top=5){
$sql=" SELECT TOP $top * FROM infotasks
public function get_tasks_rank($top = 5) {
$sql = " SELECT TOP $top * FROM infotasks
WHERE t_status='reviewed'
ORDER BY t_rating_total DESC";
$query=$this->HT->query($sql);
$result=$query->result();
return $result;
$query = $this->HT->query($sql);
$result = $query->result();
return $result;
}
//获取不同任务状态的任务数量
public function get_task_count_by_status(){
$admin_info = $this->session->userdata('session_admin');
$t_ht_op_code=$admin_info['OPI_Code'];
if(is_numeric($t_ht_op_code)){
$map=" t_a_id= ".$this->HT->escape($t_ht_op_code);
}else{
$map=" 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);
$result=$query->result();
$counts=array();
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;
public function get_task_count_by_status() {
$admin_info = $this->session->userdata('session_admin');
$t_ht_op_code = $admin_info['OPI_Code'];
if (is_numeric($t_ht_op_code)) {
$where = " t_a_id= " . $this->HT->escape($t_ht_op_code);
} else {
$where = " t_ht_op_code=" . $this->HT->escape($t_ht_op_code);
}
$site_code = $this->config->item('site_code');
if ($site_code == 'cht') { //早期的任务没有设置站点默认是cht
$where.=" AND ( t_sitecode= '$site_code' OR t_sitecode is null )";
} else {
$where.=" AND t_sitecode= '$site_code' ";
}
$sql = "SELECT t_status, count(0) as task_count FROM infotasks WHERE $where AND t_delete=0 group by t_status";
$query = $this->HT->query($sql);
$result = $query->result();
$counts = array();
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_count=$unreviewed_count=0;
if(isset($counts['edit']))$edit_count=$counts['edit'];
if(isset($counts['unreviewed']))$unreviewed_count=$counts['unreviewed'];
$counts['edit']=$edit_count+$unreviewed_count;
return $counts;
}
return false;
//正在进行中的任务=edit+unreviewed的数量
$edit_count = $unreviewed_count = 0;
if (isset($counts['edit']))
$edit_count = $counts['edit'];
if (isset($counts['unreviewed']))
$unreviewed_count = $counts['unreviewed'];
$counts['edit'] = $edit_count + $unreviewed_count;
return $counts;
}
return false;
}
//判断任务是否已上线
public function is_in_used($ta_id){
$sql="SELECT TOP 1 t_status,ic_status
public function is_in_used($ta_id) {
$sql = "SELECT TOP 1 t_status,ic_status
FROM infoTaskArticles
INNER JOIN infoContents ON ic_id=ta_ic_id
LEFT JOIN infotasks ON t_id=ta_t_id
WHERE ta_id=?";
$query=$this->HT->query($sql, array($ta_id));
$result=$query->result();
if (empty($result)) {
return 0;
}else{
$result=$result[0];
//信息平台和作者平台同时是发布状态时
if ($result->t_status=='complete' AND $result->ic_status==1) {
return 1;
}else{
return 0;
}
}
}
}
$query = $this->HT->query($sql, array($ta_id));
$result = $query->result();
if (empty($result)) {
return 0;
} else {
$result = $result[0];
//信息平台和作者平台同时是发布状态时
if ($result->t_status == 'complete' AND $result->ic_status == 1) {
return 1;
} else {
return 0;
}
}
}
}

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

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'),
'mbj' => array('site_code' => 'mbj', 'site_id' => 98, 'site_lgc' => '1', 'site_url' => 'http://www.mybeijingchina.com'),
'ct' => array('site_code' => 'ct', 'site_id' => 1000, 'site_lgc' => '104', 'site_url' => 'http://www.chinatravel.com'),
'ah' => array('site_code' => 'ah', 'site_id' => 141, 'site_lgc' => '1', 'site_url' => 'https://www.asiahighlights.com/'),
'dct' => array('site_code' => 'dct', 'site_id' => 99, 'site_lgc' => '1', 'site_url' => 'http://www.diychinatours.com')
);
@ -389,4 +390,7 @@ $config['auhtor_task_type'] = array(
'修改' => 'modify',
'审核' => 'review',
'投稿' => 'contribute'
);
);
//当前站点代号默认是cht用户登录之后修改
$config['site_code']='cht';

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

@ -1,34 +1,30 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Login extends CI_Controller {
function __construct()
{
function __construct() {
parent::__construct();
$this->load->model('Infoauthors_model');
}
public function index()
{
if($this->permission->is_admin(false)===false)
{
$data=array();
$this->load->view('header', $data);
$this->load->view('login');
$this->load->view('footer');
}
else
{
redirect(site_url());
}
}
public function index() {
if ($this->permission->is_admin(false) === false) {
$data = array();
$this->load->view('header', $data);
$this->load->view('login');
$this->load->view('footer');
} else {
redirect(site_url());
}
}
//登录检测
public function login_submit()
{
public function login_submit() {
//如果已经登陆则跳到管理首页
if ($this->session->userdata('session_admin'))
{
if ($this->session->userdata('session_admin')) {
$data[] = array('name' => 'go', 'value' => site_url());
echo json_encode($data);
return TRUE;
@ -36,241 +32,200 @@ class Login extends CI_Controller {
$this->form_validation->set_rules('email', 'lang:login_email', 'required');
$this->form_validation->set_rules('password', 'lang:login_password', 'required');
if ($this->form_validation->run() == FALSE)
{
if ($this->form_validation->run() == FALSE) {
$data = array();
foreach ($this->form_validation->_error_array as $key => $value)
{
foreach ($this->form_validation->_error_array as $key => $value) {
$data[] = array('name' => $key, 'value' => $value);
}
echo json_encode($data);
return FALSE;
}
else
{
if ($this->Infoauthors_model->check_login($this->input->post('email'), $this->input->post('password')))
{
$this->session->set_userdata('session_admin', $this->Infoauthors_model->detail($this->input->post('email')));
} else {
if ($this->Infoauthors_model->check_login($this->input->post('email'), $this->input->post('password'))) {
$this->session->set_userdata('session_admin', $this->Infoauthors_model->detail($this->input->post('email')));
//记住账号密码
$this->input->set_cookie("user_email",$this->input->post('email'),7776000);
$this->input->set_cookie("user_pwd",$this->input->post('password'),7776000);
$this->input->set_cookie("user_email", $this->input->post('email'), 7776000);
$this->input->set_cookie("user_pwd", $this->input->post('password'), 7776000);
$data[] = array('name' => 'go', 'value' => site_url());
echo json_encode($data);
return TRUE;
echo json_encode($data);
return TRUE;
}
//用户名和密码不正确,或者没有管理权限
if ($this->session->userdata('session_admin') === false)
{
if ($this->session->userdata('session_admin') === false) {
$data[] = array('name' => 'login_warning', 'value' => $this->lang->line('login_warning'));
echo json_encode($data);
}
}
}
public function signup()
{
$data=array();
public function signup() {
$data = array();
$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('signup');
$this->load->view('footer');
}
}
public function signup_vpn()
{
$data=array();
public function signup_vpn() {
$data = array();
$data['signup_step'] = 1;
$data['terms']='vpn';
$data['terms'] = 'vpn';
$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('signup');
$this->load->view('footer');
}
public function signup_submit()
{
public function signup_submit() {
$this->form_validation->set_rules('a_email', 'lang:signup_a_email', 'required');
$this->form_validation->set_rules('a_password', 'lang:signup_a_password', 'required');
$this->form_validation->set_rules('a_name', 'lang:signup_a_name', 'required');
$this->form_validation->set_rules('a_bank', 'lang:a_bank', 'required');
$this->form_validation->set_rules('a_bank_card', 'lang:a_bank_card', 'required');
$this->form_validation->set_rules('terms', 'You must choose this option!', 'required');
if ($this->form_validation->run() == FALSE)
{
if ($this->form_validation->run() == FALSE) {
$data = array();
foreach ($this->form_validation->_error_array as $key => $value)
{
foreach ($this->form_validation->_error_array as $key => $value) {
$data[] = array('name' => $key, 'value' => $value);
}
echo json_encode($data);
return FALSE;
}
else
{
if ($this->Infoauthors_model->check_signup($this->input->post('a_email')))
{
} else {
if ($this->Infoauthors_model->check_signup($this->input->post('a_email'))) {
$data[] = array('name' => 'a_email', 'value' => 'Someone already has that email. Try another?');
echo json_encode($data);
return FALSE;
}
//头像处理
$a_photo='';
if ($this->input->post('profile_url')!='') {
$profile_file_path=APPPATH.'document/profile_photo';
$profile_url=$this->input->post('profile_url');
$profile_array=explode('.', $profile_url);
$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.'/'.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 = '';
if ($this->input->post('profile_url') != '') {
$profile_file_path = APPPATH . 'document/profile_photo';
$profile_url = $this->input->post('profile_url');
$profile_array = explode('.', $profile_url);
$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 . '/' . 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;
}
//处理上传的身份证复印件
if ($this->input->post('ID_file_name')!='') {
$ID_file_path=APPPATH.'document/ID_CARD';
$a_id_file=$this->input->post('ID_file_name');
$file_array=explode('.', $a_id_file);
$ext='jpg';//end($file_array);
rename($ID_file_path.'/'.$a_id_file,$ID_file_path.'/id_card_'.$this->input->post('a_email').'.'.$ext);
if ($this->input->post('ID_file_name') != '') {
$ID_file_path = APPPATH . 'document/ID_CARD';
$a_id_file = $this->input->post('ID_file_name');
$file_array = explode('.', $a_id_file);
$ext = 'jpg'; //end($file_array);
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_cn=trim($this->input->post('a_name_cn'));
$a_name = trim($this->input->post('a_name'));
$a_name_cn = trim($this->input->post('a_name_cn'));
$this->Infoauthors_model->add(
$this->input->post('a_email'),
$this->input->post('a_password'),
$a_name,
$a_name_cn,
$a_photo,
$this->input->post('a_mobile_phone'),
$this->input->post('a_phone'),
$this->input->post('a_id_card'),
$this->input->post('a_gender'),
$this->input->post('a_address'),
$this->input->post('a_school'),
$this->input->post('a_bank'),
$this->input->post('a_bank_card'),
$this->input->post('a_resume')
$this->input->post('a_email'), $this->input->post('a_password'), $a_name, $a_name_cn, $a_photo, $this->input->post('a_mobile_phone'), $this->input->post('a_phone'), $this->input->post('a_id_card'), $this->input->post('a_gender'), $this->input->post('a_address'), $this->input->post('a_school'), $this->input->post('a_bank'), $this->input->post('a_bank_card'), $this->input->post('a_resume')
);
$data[] = array('name' => 'go', 'value' => site_url('login/signup_success'));
echo json_encode($data);
return TRUE;
}
}
public function signup_success()
{
$data['title']=$this->lang->line('signup_success_title');
$data['content']=$this->lang->line('signup_success');
$data[] = array('name' => 'go', 'value' => site_url('login/signup_success'));
echo json_encode($data);
return TRUE;
}
}
public function 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('message');
$this->load->view('footer');
}
}
public function upload_ID_file($profile=false){
$save_path='ID_CARD';
$jsfunction='get_id_card_file';
$upload_id='ID_file';
public function upload_ID_file($profile = false) {
$save_path = 'ID_CARD';
$jsfunction = 'get_id_card_file';
$upload_id = 'ID_file';
if ($profile) {
$save_path='profile_photo';
$jsfunction='get_photo_url';
$upload_id='Profile_file';
$save_path = 'profile_photo';
$jsfunction = 'get_photo_url';
$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['encrypt_name'] = true;
$this->load->library('upload', $config);
if (!$this->upload->do_upload($upload_id))
{
if (!$this->upload->do_upload($upload_id)) {
$error = array('error' => $this->upload->display_errors());
var_dump($error);
}
else
{
} else {
$data = array('upload_data' => $this->upload->data());
$file_name=$data['upload_data']['file_name'];
$file_name = $data['upload_data']['file_name'];
if ($profile) {
$baseurls=str_replace('controllers', '', dirname(__FILE__));
$baseurls = str_replace('controllers', '', dirname(__FILE__));
$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['maintain_ratio'] = false;
$config['width'] = 175;
$config['height'] = 175;
$this->load->library('image_lib', $config);
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$profile_array=explode('.', $file_name);
$file_name=$profile_array[0].'_thumb.'.$profile_array[1];
$profile_array = explode('.', $file_name);
$file_name = $profile_array[0] . '_thumb.' . $profile_array[1];
}
echo "<script>parent.$jsfunction('$file_name');</script>";
}
}
public function findpwd()
{
$data=array();
public function findpwd() {
$data = array();
$this->load->view('header', $data);
$this->load->view('findpwd');
$this->load->view('footer');
}
//找回密码发送邮件
public function do_findpwd()
{
public function do_findpwd() {
$this->form_validation->set_rules('email', 'lang:login_email', 'required');
if ($this->form_validation->run() == FALSE)
{
if ($this->form_validation->run() == FALSE) {
$data = array();
$data[] = array('name' => 'email', 'value' => 'Please fill in your email address!');
echo json_encode($data);
return FALSE;
}
$userdata=$this->Infoauthors_model->detail($this->input->post('email'));
if ($userdata)
{
$fromName='author site';
$fromEmail='noreply02@chinahighlights.net';
$toName=$userdata->a_name;
$toEmail=$userdata->a_email;
$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.';
$is_sendmail=$this->Infoauthors_model->SendMail($fromName, $fromEmail, $toName, $toEmail, $subject, $body);
$userdata = $this->Infoauthors_model->detail($this->input->post('email'));
if ($userdata) {
$fromName = 'author site';
$fromEmail = 'noreply02@chinahighlights.net';
$toName = $userdata->a_name;
$toEmail = $userdata->a_email;
$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.';
$is_sendmail = $this->Infoauthors_model->SendMail($fromName, $fromEmail, $toName, $toEmail, $subject, $body);
if ($is_sendmail) {
$data[] = array('name' => 'ok', 'value' => 'Action successful. Your password has been emailed to you.');
echo json_encode($data);
}else{
} else {
$data[] = array('name' => 'no', 'value' => 'Action unsuccessful. Try again later.!');
echo json_encode($data);
return FALSE;
}
}
else
{
} else {
$data[] = array('name' => 'no', 'value' => 'Error: Your email is incorrect!');
echo json_encode($data);
return FALSE;
}
}
//退出登录清空session
public function out()
{
public function out() {
$this->session->unset_userdata('session_admin');
$this->load->helper('cookie');
//delete_cookie("user_email");
delete_cookie("user_pwd");
redirect(site_url('login'));
}
}
/* 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 {
function __construct()
{
function __construct() {
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Infotasks_model');
$this->load->model('Infotaskarticles_model');
$this->load->model('InfoSMS_model');
$this->load->model('Infotasks_model');
$this->load->model('Infotaskarticles_model');
$this->load->model('InfoSMS_model');
}
public function index($page=1)
{
$data=array();
$data['author_rank_list']=$this->Infotasks_model->get_author_rank_list();
$data['article_rank_list']=$this->Infotasks_model->get_article_rank_list();
$t_td_type=$start_date=$tasktitle=false;
$end_date=date('Y-m-d');
if($this->input->get('tasktype') && $this->input->get('tasktype')!='-') $t_td_type=$this->input->get('tasktype');
if($this->input->get('startdate') && $this->input->get('startdate')!='') $start_date=$this->input->get('startdate');
if($this->input->get('enddate') && $this->input->get('enddate')!='') $end_date=$this->input->get('enddate');
if($this->input->get('tasktitle') && $this->input->get('tasktitle')!='') $tasktitle=$this->input->get('tasktitle');
public function index($page = 1) {
$data = array();
$data['author_rank_list'] = $this->Infotasks_model->get_author_rank_list();
$data['article_rank_list'] = $this->Infotasks_model->get_article_rank_list();
$t_td_type = $start_date = $tasktitle = false;
$end_date = date('Y-m-d');
if ($this->input->get('tasktype') && $this->input->get('tasktype') != '-')
$t_td_type = $this->input->get('tasktype');
if ($this->input->get('startdate') && $this->input->get('startdate') != '')
$start_date = $this->input->get('startdate');
if ($this->input->get('enddate') && $this->input->get('enddate') != '')
$end_date = $this->input->get('enddate');
if ($this->input->get('tasktitle') && $this->input->get('tasktitle') != '')
$tasktitle = $this->input->get('tasktitle');
//分页
$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['pageSize']= 20;
$pages['url'] = site_url('taskhall/index');
$pages['current']=$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['pageSize'] = 20;
$pages['url'] = site_url('taskhall/index');
$pages['current'] = $page;
//$this->load->library('mypage',$pages);
//$data['page']=$this->mypage->pages_html();
$data['page']=show_page($pages);
$data['page'] = show_page($pages);
//获取任务列表
$task_id_str=0;
$page_task=array_slice($page_task,$pages['pageSize']*($page-1),$pages['pageSize']);
$task_id_str = 0;
$page_task = array_slice($page_task, $pages['pageSize'] * ($page - 1), $pages['pageSize']);
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['nav_view']=$this->load->view('nav_hall',array('nav_active'=>'hall')+$data,true);
$data['rank_view']=$this->load->view('rank',$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);
$data['rank_view'] = $this->load->view('rank', $data, true);
$this->load->view('header', array('navbar_active' => 'taskhall') + $data);
$this->load->view('task_hall');
$this->load->view('footer');
}
public function view($t_id)
{
$data['task']=$this->Infotasks_model->detail($t_id);
if(empty($data['task']))
{
show_404();
return false;
}
$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);
}
public function view($t_id) {
$data['task'] = $this->Infotasks_model->detail($t_id);
if (empty($data['task'])) {
show_404();
return false;
}
$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);
$this->load->view('read_task');
$this->load->view('footer');
}
//?н?????
public function undertake()
{
$admin_info=$this->session->userdata('session_admin');
$t_id=$this->input->post('t_id');
$task=$this->Infotasks_model->detail($t_id);
if(empty($task))
{
$data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_error_notfound'));
echo json_encode($data);
return false;
}
if(empty($task->t_a_id))
{
//?н?????
$this->Infotasks_model->undertake($t_id,$admin_info->a_id);
$data[] = array('name' => 'ok_modal', 'value' => $this->lang->line('task_undertake_success'));
$data[] = array('name'=>'ok_go','value'=>site_url('welcome/view/'.$t_id));
echo json_encode($data);
return true;
}
else
{
$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))
{
$data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_error_notfound'));
echo json_encode($data);
return false;
}
if($task->t_a_id==$admin_info->a_id)
{
//ȡ??????
$this->Infotasks_model->canceltake($t_id);
$data[] = array('name' => 'ok_modal', 'value' => $this->lang->line('task_canceltake_success'));
$data[] = array('name'=>'ok_go','value'=>site_url('welcome/view/'.$t_id));
echo json_encode($data);
return true;
}
else
{
$data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_canceltake_error'));
echo json_encode($data);
return false;
}
}
public function notice($announce_id='',$announce_type='notice')
{
$data=array();
$data['type']=$announce_type;
if ($announce_id=='') {
$data['announce_list'] = $this->Infotaskarticles_model->get_announce($announce_id,$announce_type);
}else{
$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('footer');
}
//?н?????
public function undertake() {
$admin_info = $this->session->userdata('session_admin');
$t_id = $this->input->post('t_id');
$task = $this->Infotasks_model->detail($t_id);
if (empty($task)) {
$data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_error_notfound'));
echo json_encode($data);
return false;
}
if (empty($task->t_a_id)) {
//?н?????
$this->Infotasks_model->undertake($t_id, $admin_info->a_id);
$data[] = array('name' => 'ok_modal', 'value' => $this->lang->line('task_undertake_success'));
$data[] = array('name' => 'ok_go', 'value' => site_url('welcome/view/' . $t_id));
echo json_encode($data);
return true;
} else {
$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)) {
$data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_error_notfound'));
echo json_encode($data);
return false;
}
if ($task->t_a_id == $admin_info->a_id) {
//ȡ??????
$this->Infotasks_model->canceltake($t_id);
$data[] = array('name' => 'ok_modal', 'value' => $this->lang->line('task_canceltake_success'));
$data[] = array('name' => 'ok_go', 'value' => site_url('welcome/view/' . $t_id));
echo json_encode($data);
return true;
} else {
$data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_canceltake_error'));
echo json_encode($data);
return false;
}
}
public function notice($announce_id = '', $announce_type = 'notice') {
$data = array();
$data['type'] = $announce_type;
if ($announce_id == '') {
$data['announce_list'] = $this->Infotaskarticles_model->get_announce($announce_id, $announce_type);
} else {
$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('footer');
}
}
public function announce($announce_id=''){
$this->notice($announce_id,'announce');
}
public function announce($announce_id = '') {
$this->notice($announce_id, 'announce');
}
public function help()
{
$data=array();
$data['nav_view']=$this->load->view('nav_hall',array('nav_active'=>'help')+$data,true);
$this->load->view('header', array('navbar_active'=>'notice')+$data);
public function help() {
$data = array();
$data['nav_view'] = $this->load->view('nav_hall', array('nav_active' => 'help') + $data, true);
$this->load->view('header', array('navbar_active' => 'notice') + $data);
$this->load->view('help');
$this->load->view('footer');
}
}
}
/* 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 {
public $all_unread_sms;
function __construct()
{
public $all_unread_sms;
function __construct() {
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Infotasks_model');
$this->load->model('Infotaskarticles_model');
$this->load->model('InfoSMS_model');
$this->load->model('Operator_model');
$this->load->model('Infoauthors_model');
$this->load->model('Infotasks_model');
$this->load->model('Infotaskarticles_model');
$this->load->model('InfoSMS_model');
$this->load->model('Operator_model');
$this->load->model('Infoauthors_model');
}
//所有任务
public function index($page=1)
{
$data=array();
$data=$this->_get_home_base_data();
//已完成任务使用另一模板
if($this->input->get('taskstatus')=='complete'){
$this->in_complete_tasks();
return;
}
$task_list = $this->_get_task_list(false,$page,site_url("welcome/index"));
public function index($page = 1) {
$data = array();
$data = $this->_get_home_base_data();
//已完成任务使用另一模板
if ($this->input->get('taskstatus') == 'complete') {
$this->in_complete_tasks();
return;
}
$task_list = $this->_get_task_list(false, $page, site_url("welcome/index"));
$data['task_list'] = $task_list['task_list'];
$data['page']=$task_list['page'];
$data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_all')+$data,true);
$this->load->view('header', array('navbar_active'=>'mytask')+$data);
$data['page'] = $task_list['page'];
$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('tasklist');
$this->load->view('footer');
}
//正在编辑的任务
public function in_edit_tasks($page=1)
{
$data=array();
$data=$this->_get_home_base_data();
$task_list = $this->_get_task_list('edit',$page,site_url("welcome/in_edit_tasks"));
}
//正在编辑的任务
public function in_edit_tasks($page = 1) {
$data = array();
$data = $this->_get_home_base_data();
$task_list = $this->_get_task_list('edit', $page, site_url("welcome/in_edit_tasks"));
$data['task_list_in_edit'] = $task_list['task_list'];
$data['page']=$task_list['page'];
$data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_edit')+$data,true);
$this->load->view('header', array('navbar_active'=>'mytask')+$data);
$data['page'] = $task_list['page'];
$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('welcome');
$this->load->view('footer');
}
//已经完成的任务
public function in_complete_tasks($page=1)
{
$data=array();
$data=$this->_get_home_base_data();
$task_list = $this->_get_task_list('complete',$page,site_url("welcome/in_complete_tasks"));
}
//已经完成的任务
public function in_complete_tasks($page = 1) {
$data = array();
$data = $this->_get_home_base_data();
$task_list = $this->_get_task_list('complete', $page, site_url("welcome/in_complete_tasks"));
$data['task_list'] = $task_list['task_list'];
$data['page']=$task_list['page'];
$data['page'] = $task_list['page'];
foreach ($data['task_list'] as $task) {
$task->last_version = $this->Infotaskarticles_model->version_last($task->t_id);
}
$data['site_config']=$this->config->item('site');
$data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_complete')+$data,true);
$this->load->view('header', array('navbar_active'=>'mytask')+$data);
$data['site_config'] = $this->config->item('site');
$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('in_complete');
$this->load->view('footer');
}
//未通过审核的投稿申请
public function in_refuse_tasks($page=1)
{
$data=array();
$data=$this->_get_home_base_data();
$task_list = $this->_get_task_list('refuse',$page,site_url("welcome/in_refuse_tasks"));
}
//未通过审核的投稿申请
public function in_refuse_tasks($page = 1) {
$data = array();
$data = $this->_get_home_base_data();
$task_list = $this->_get_task_list('refuse', $page, site_url("welcome/in_refuse_tasks"));
$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);
$this->load->view('header', array('navbar_active'=>'mytask')+$data);
$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('in_refuse');
$this->load->view('footer');
}
//根据任务状态获取任务列表
public function task_lists($t_status=false,$page=1){
$data=array();
$data=$this->_get_home_base_data();
$admin_info=$this->session->userdata('session_admin');
$task_list = $this->_get_task_list($t_status,$page,site_url("welcome/task_lists/$t_status"));
}
//根据任务状态获取任务列表
public function task_lists($t_status = false, $page = 1) {
$data = array();
$data = $this->_get_home_base_data();
$admin_info = $this->session->userdata('session_admin');
$task_list = $this->_get_task_list($t_status, $page, site_url("welcome/task_lists/$t_status"));
$data['task_list'] = $task_list['task_list'];
$data['page']=$task_list['page'];
$data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_'.$t_status)+$data,true);
$this->load->view('header', array('navbar_active'=>'mytask')+$data);
$data['page'] = $task_list['page'];
$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('in_refuse');
$this->load->view('footer');
}
//获取任务列表
function _get_task_list($t_status=false,$page=false,$pageurl=false){
$t_td_type=$start_date=$tasktitle=false;
$end_date=date('Y-m-d');
if($this->input->get('tasktype') && $this->input->get('tasktype')!='-') $t_td_type=$this->input->get('tasktype');
if($this->input->get('startdate') && $this->input->get('startdate')!='') $start_date=$this->input->get('startdate');
if($this->input->get('enddate') && $this->input->get('enddate')!='') $end_date=$this->input->get('enddate');
if($this->input->get('tasktitle') && $this->input->get('tasktitle')!='') $tasktitle=$this->input->get('tasktitle');
if(!$t_status && $this->input->get('taskstatus') && $this->input->get('taskstatus')!='-') $t_status=$this->input->get('taskstatus');
}
//获取任务列表
function _get_task_list($t_status = false, $page = false, $pageurl = false) {
$t_td_type = $start_date = $tasktitle = false;
$end_date = date('Y-m-d');
if ($this->input->get('tasktype') && $this->input->get('tasktype') != '-')
$t_td_type = $this->input->get('tasktype');
if ($this->input->get('startdate') && $this->input->get('startdate') != '')
$start_date = $this->input->get('startdate');
if ($this->input->get('enddate') && $this->input->get('enddate') != '')
$end_date = $this->input->get('enddate');
if ($this->input->get('tasktitle') && $this->input->get('tasktitle') != '')
$tasktitle = $this->input->get('tasktitle');
if (!$t_status && $this->input->get('taskstatus') && $this->input->get('taskstatus') != '-')
$t_status = $this->input->get('taskstatus');
$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);
$pages['total']=count($page_task);
$pages['pageSize']= 20;
$pages['url'] = $pageurl;
$pages['current']=$page;
$task_list['page']=show_page($pages);
$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['pageSize'] = 20;
$pages['url'] = $pageurl;
$pages['current'] = $page;
$task_list['page'] = show_page($pages);
//获取任务列表
$task_id_str=0;
$page_task=array_slice($page_task,$pages['pageSize']*($page-1),$pages['pageSize']);
$task_id_str = 0;
$page_task = array_slice($page_task, $pages['pageSize'] * ($page - 1), $pages['pageSize']);
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);
return $task_list;
}
public function _get_home_base_data(){
$user_data=$this->session->userdata('session_admin');
$data['author_rank_list']=$this->Infotasks_model->get_author_rank_list();
$data['article_rank_list']=$this->Infotasks_model->get_article_rank_list();
//最新公告
$announce=$this->Infotaskarticles_model->get_announce('','announce');
$data['announce']=array();
if(!empty($announce))$data['announce']=$announce;
$data['notice_list']=$this->Infotaskarticles_model->get_announce();
$data['avatar']=get_author_photo();
$data['rank_view']=$this->load->view('rank',$data,true);
//获取作者网前url名字组成部分
$data['suer_weburl']=get_user_web_url();
return $data;
}
public function view($t_id)
{
$data=array();
$data['task']=$this->Infotasks_model->detail($t_id);
$admin_info=$this->session->userdata('session_admin');
if(empty($data['task']))
{
show_404();
return false;
}
$data['task_detail']=$this->Infotaskarticles_model->detail($data['task']->t_id);
$data['task_last_version']=$this->Infotaskarticles_model->version_last($data['task']->t_id);
if(!empty($data['task_detail']))
{
$data['information']=$this->Infotaskarticles_model->get_information($data['task_detail']->ta_ic_id);
if (isset($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);
}
if ($data['task']->t_a_id!=$admin_info->a_id and $data['task_detail']->ta_isbest==NULL) {
show_404();
return false;
}
switch ($data['task']->t_status)
{
case 'published':
case 'complete':
$data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_complete')+$data,true);
break;
case 'review':
}
public function _get_home_base_data() {
$user_data = $this->session->userdata('session_admin');
$data['author_rank_list'] = $this->Infotasks_model->get_author_rank_list();
$data['article_rank_list'] = $this->Infotasks_model->get_article_rank_list();
//最新公告
$announce = $this->Infotaskarticles_model->get_announce('', 'announce');
$data['announce'] = array();
if (!empty($announce))
$data['announce'] = $announce;
$data['notice_list'] = $this->Infotaskarticles_model->get_announce();
$data['avatar'] = get_author_photo();
$data['rank_view'] = $this->load->view('rank', $data, true);
//获取作者网前url名字组成部分
$data['suer_weburl'] = get_user_web_url();
return $data;
}
public function view($t_id) {
$data = array();
$data['task'] = $this->Infotasks_model->detail($t_id);
$admin_info = $this->session->userdata('session_admin');
if (empty($data['task'])) {
show_404();
return false;
}
$data['task_detail'] = $this->Infotaskarticles_model->detail($data['task']->t_id);
$data['task_last_version'] = $this->Infotaskarticles_model->version_last($data['task']->t_id);
if (!empty($data['task_detail'])) {
$data['information'] = $this->Infotaskarticles_model->get_information($data['task_detail']->ta_ic_id);
if (isset($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);
}
if ($data['task']->t_a_id != $admin_info->a_id and $data['task_detail']->ta_isbest == NULL) {
show_404();
return false;
}
switch ($data['task']->t_status) {
case 'published':
case 'complete':
$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);
break;
case 'reviewed':
@ -182,299 +186,260 @@ class Welcome extends CI_Controller {
case 'unreviewed':
$data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_unreviewed') + $data, true);
break;
case 'refuse':
$data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_refuse')+$data,true);
break;
case 'wait':
$data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_refuse')+$data,true);
break;
default:
$data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_edit')+$data,true);
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');
case 'refuse':
$data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_refuse') + $data, true);
break;
case 'wait':
$data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_refuse') + $data, true);
break;
default:
$data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_edit') + $data, true);
break;
}
$this->load->view('footer');
}
public function edit_submit($task_submit=false)
{
$t_id=$this->input->post('t_id');
$task=$this->Infotasks_model->detail($t_id);
$admin_info=$this->session->userdata('session_admin');
if ($admin_info->a_id!=$task->t_a_id) {
$data[] = array('name' => 'no', 'value' => 'error:it\'s not your task!');
echo json_encode($data);
return false;
}
$task_used=$this->Infotaskarticles_model->detail($t_id);
/*if(empty($task_used))
{
$data[] = array('name' => 'no', 'value' => $this->lang->line('task_error_notfound'));
echo json_encode($data);
return false;
}*/
$task_original=$this->Infotaskarticles_model->detail_original($t_id);
if(empty($task_original))
{
if (!empty($task_used)) {
//把原始任务状态改为original防止原始任务信息被删除
$this->Infotaskarticles_model->set_original($task_used->ta_id);
}
//新建一个任务状态改为used
$this->Infotaskarticles_model->add($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'));
if (!$task_submit) {
$data[] = array('name' => 'ok', 'value' => $this->lang->line('script_success_save'));
echo json_encode($data);
}
return true;
}
else
{
if(empty($task_used))
{
$data[] = array('name' => 'no', 'value' => $this->lang->line('task_error_notfound'));
echo json_encode($data);
return false;
}
$this->Infotaskarticles_model->update($task_used->ta_id, $this->input->post('ta_title'), $this->input->post('ta_content')
, $this->input->post('ta_summary'), $this->input->post('ta_seo_title')
, $this->input->post('ta_seo_description'), $this->input->post('ta_seo_keywords')
, $this->input->post('ta_photo'));
if (!$task_submit) {
$data[] = array('name' => 'ok', 'value' => $this->lang->line('script_success_save'));
echo json_encode($data);
}
return true;
}
}
public function review_submit()
{
if($this->edit_submit(true))
{
$this->Infotaskarticles_model->add($this->input->post('t_id'),$this->input->post('ta_ic_id'), $this->input->post('ta_title')
, $this->input->post('ta_content'), $this->input->post('ta_summary'), $this->input->post('ta_seo_title')
, $this->input->post('ta_seo_description'), $this->input->post('ta_seo_keywords')
, $this->input->post('ta_photo'),'version');
$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'));
echo json_encode($data);
return true;
}
}
//发送短消息给管理员
public function send_to_admin()
{
$t_id=$this->input->post('t_id');
$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['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');
}
public function edit_submit($task_submit = false) {
$t_id = $this->input->post('t_id');
$task = $this->Infotasks_model->detail($t_id);
$admin_info = $this->session->userdata('session_admin');
if ($admin_info->a_id != $task->t_a_id) {
$data[] = array('name' => 'no', 'value' => 'error:it\'s not your task!');
echo json_encode($data);
return false;
}
$task_used = $this->Infotaskarticles_model->detail($t_id);
/* if(empty($task_used))
{
$data[] = array('name' => 'no', 'value' => $this->lang->line('task_error_notfound'));
echo json_encode($data);
return false;
} */
$task_original = $this->Infotaskarticles_model->detail_original($t_id);
if (empty($task_original)) {
if (!empty($task_used)) {
//把原始任务状态改为original防止原始任务信息被删除
$this->Infotaskarticles_model->set_original($task_used->ta_id);
}
//新建一个任务状态改为used
$this->Infotaskarticles_model->add($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'));
if (!$task_submit) {
$data[] = array('name' => 'ok', 'value' => $this->lang->line('script_success_save'));
echo json_encode($data);
}
return true;
} else {
if (empty($task_used)) {
$data[] = array('name' => 'no', 'value' => $this->lang->line('task_error_notfound'));
echo json_encode($data);
return false;
}
$this->Infotaskarticles_model->update($task_used->ta_id, $this->input->post('ta_title'), $this->input->post('ta_content')
, $this->input->post('ta_summary'), $this->input->post('ta_seo_title')
, $this->input->post('ta_seo_description'), $this->input->post('ta_seo_keywords')
, $this->input->post('ta_photo'));
if (!$task_submit) {
$data[] = array('name' => 'ok', 'value' => $this->lang->line('script_success_save'));
echo json_encode($data);
}
return true;
}
}
public function review_submit() {
if ($this->edit_submit(true)) {
$this->Infotaskarticles_model->add($this->input->post('t_id'), $this->input->post('ta_ic_id'), $this->input->post('ta_title')
, $this->input->post('ta_content'), $this->input->post('ta_summary'), $this->input->post('ta_seo_title')
, $this->input->post('ta_seo_description'), $this->input->post('ta_seo_keywords')
, $this->input->post('ta_photo'), 'version');
$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'));
echo json_encode($data);
return true;
}
}
//发送短消息给管理员
public function send_to_admin() {
$t_id = $this->input->post('t_id');
$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();
foreach ($this->form_validation->_error_array as $key => $value)
{
foreach ($this->form_validation->_error_array as $key => $value) {
$data[] = array('name' => $key, 'value' => $value);
}
echo json_encode($data);
return false;
}
else
{
$this->InfoSMS_model->add('task',$task->t_id,$task->t_ht_op_code,$task->t_a_id,$this->input->post('m_content'));
$data[] = array('name' => 'ok', 'value' => $this->lang->line('send_sms_success'));
echo json_encode($data);
//发送邮件通知
$admin_info=$this->session->userdata('session_admin');
$author_admin=$this->Operator_model->get_user($task->t_ht_op_code);
$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();
$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);
return false;
} else {
$this->InfoSMS_model->add('task', $task->t_id, $task->t_ht_op_code, $task->t_a_id, $this->input->post('m_content'));
$data[] = array('name' => 'ok', 'value' => $this->lang->line('send_sms_success'));
echo json_encode($data);
//发送邮件通知
$admin_info = $this->session->userdata('session_admin');
$author_admin = $this->Operator_model->get_user($task->t_ht_op_code);
$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();
$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('footer');
}
public function create_task_submit()
{
$this->form_validation->set_rules('t_title', 'lang:t_title', 'required');
$this->form_validation->set_rules('t_content', 'lang:t_content', 'required');
$this->form_validation->set_rules('t_expires', 'lang:t_expires', 'required');
if ($this->form_validation->run() == FALSE)
{
}
public function create_task_submit() {
$this->form_validation->set_rules('t_title', 'lang:t_title', 'required');
$this->form_validation->set_rules('t_content', 'lang:t_content', 'required');
$this->form_validation->set_rules('t_expires', 'lang:t_expires', 'required');
if ($this->form_validation->run() == FALSE) {
$data = array();
foreach ($this->form_validation->_error_array as $key => $value)
{
foreach ($this->form_validation->_error_array as $key => $value) {
$data[] = array('name' => $key, 'value' => $value);
}
echo json_encode($data);
return false;
}
else
{
//TODO:暂时把稿件全部发给RURU(zzy),今后会读取各站点的管理员名单
$admin_info=$this->session->userdata('session_admin');
$this->Infotasks_model->add(
$this->input->post('t_title'),
$this->input->post('t_content'),
$admin_info->a_id,
'Gavin',
'contribute',
$this->input->post('t_expires'),
'wait',
$this->input->post('t_attach')
);
$this->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'));
return false;
} else {
//TODO:暂时把稿件全部发给RURU(zzy),今后会读取各站点的管理员名单
$admin_info = $this->session->userdata('session_admin');
$this->Infotasks_model->add(
$this->input->post('t_title'), $this->input->post('t_content'), $admin_info->a_id, 'Gavin', 'contribute', $this->input->post('t_expires'), 'wait', $this->config->item('site_code'), $this->input->post('t_attach')
);
$this->Infotaskarticles_model->add($this->Infotasks_model->insert_id, 0, '', '', '', '', '', '', '');
$this->InfoSMS_model->add('task', $this->Infotasks_model->insert_id, 'Gavin', $admin_info->a_id, 'I have submitted a proposal; please check!');
$data[] = array('name' => 'ok', 'value' => $this->lang->line('task_create_success'));
$data[] = array('name' => 'ok_go', 'value' => site_url('welcome'));
echo json_encode($data);
return true;
}
}
public function upload_task_attach(){
$save_path='task_attach';
$jsfunction='upload_task_attach';
$upload_id='task_attach';
return true;
}
}
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['encrypt_name'] = true;
$this->load->library('upload', $config);
if (!$this->upload->do_upload($upload_id))
{
if (!$this->upload->do_upload($upload_id)) {
$error = array('error' => $this->upload->display_errors());
var_dump($error);
}
else
{
} else {
$data = array('upload_data' => $this->upload->data());
$file_name=$data['upload_data']['file_name'];
$file_name = $data['upload_data']['file_name'];
echo "<script>parent.$jsfunction('$file_name');</script>";
}
}
//修改后重新提交投稿申请
public function update_task(){
$this->form_validation->set_rules('t_title', 'lang:t_title', 'required');
$this->form_validation->set_rules('t_content', 'lang:t_content', 'required');
$this->form_validation->set_rules('t_expires', 'lang:t_expires', 'required');
if ($this->form_validation->run() == FALSE)
{
}
//修改后重新提交投稿申请
public function update_task() {
$this->form_validation->set_rules('t_title', 'lang:t_title', 'required');
$this->form_validation->set_rules('t_content', 'lang:t_content', 'required');
$this->form_validation->set_rules('t_expires', 'lang:t_expires', 'required');
if ($this->form_validation->run() == FALSE) {
$data = array();
foreach ($this->form_validation->_error_array as $key => $value)
{
foreach ($this->form_validation->_error_array as $key => $value) {
$data[] = array('name' => $key, 'value' => $value);
}
echo json_encode($data);
return false;
}else{
//更新任务状态
$result=$this->Infotasks_model->update(
$this->input->post('t_id'),
$this->input->post('t_title'),
$this->input->post('t_content'),
$this->input->post('t_a_id'),
'contribute',
$this->input->post('t_expires'),
'wait',
$this->input->post('t_attach')
);
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 false;
} else {
//更新任务状态
$result = $this->Infotasks_model->update(
$this->input->post('t_id'), $this->input->post('t_title'), $this->input->post('t_content'), $this->input->post('t_a_id'), 'contribute', $this->input->post('t_expires'), 'wait', $this->input->post('t_attach')
);
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;
}
//删除任务
public function delete_task($t_id){
$this->Infotasks_model->delete($t_id);
if ($this->Infotasks_model->delete($t_id)) {
redirect(site_url('welcome/in_refuse_tasks'));
}else{
header('Location: '.$_SERVER['HTTP_REFERER']);
}
return true;
}
//返回指定页面路径pagepath在指定时间内的成效信息
public function get_analytics_by_date($loadtotal=0){
$data=array();
return true;
}
//删除任务
public function delete_task($t_id) {
$this->Infotasks_model->delete($t_id);
if ($this->Infotasks_model->delete($t_id)) {
redirect(site_url('welcome/in_refuse_tasks'));
} else {
header('Location: ' . $_SERVER['HTTP_REFERER']);
}
return true;
}
//返回指定页面路径pagepath在指定时间内的成效信息
public function get_analytics_by_date($loadtotal = 0) {
$data = array();
//获取请求的日期范围以及请求的页面路径
$startdate=$this->input->post('startdate');
$enddate=$this->input->post('enddate');
$pagepath=$this->input->post('pagepath');
$sitecode=$this->input->post('sitecode');
$startdate = $this->input->post('startdate');
$enddate = $this->input->post('enddate');
$pagepath = $this->input->post('pagepath');
$sitecode = $this->input->post('sitecode');
if (empty($pagepath)) {
echo '';
return false;
echo '';
return false;
}
//如果开始时间为空则把开始时间设为往前七天
if ($startdate == '') {
$startdate = time()-7*24*60*60;
}else{
$startdate = time() - 7 * 24 * 60 * 60;
} else {
$startdate = strtotime($startdate);
}
//如果结束时间为空,则把结束时间设为当天
if ($enddate == '') {
$enddate = time();
}else{
} else {
$enddate = strtotime($enddate);
}
if ($startdate>$enddate) {
echo "please check your date";die();
if ($startdate > $enddate) {
echo "please check your date";
die();
}
//查取google分析数据
$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;
$analytics_count=0;
$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;
$analytics_count = 0;
//访问量汇总
foreach ($data['analytics_list'] as $v) {
$total_visit['pv']+=$v->kwa_pageviews;
@ -483,88 +448,76 @@ class Welcome extends CI_Controller {
$total_visit['entrances']+=$v->kwa_entrances;
$analytics_count++;
}
$analytics_count==0 ? $analytics_count=1 : null;
$total_visit['agv_time']=ceil($total_visit['agv_time']/$analytics_count);
$data['total_visit']=$total_visit;
$analytics_count == 0 ? $analytics_count = 1 : null;
$total_visit['agv_time'] = ceil($total_visit['agv_time'] / $analytics_count);
$data['total_visit'] = $total_visit;
//如果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)
{
$this->InfoSMS_model->readed($m_id);
echo 'ok';
public function set_readed($m_id) {
$this->InfoSMS_model->readed($m_id);
echo 'ok';
}
public function search_by_icid(){
$ic_id_list=$this->input->post('ic_id_list');
$ic_id_list=rtrim(trim($ic_id_list),',').',';
public function search_by_icid() {
$ic_id_list = $this->input->post('ic_id_list');
$ic_id_list = rtrim(trim($ic_id_list), ',') . ',';
$this->load->model('InfoContents_model');
$data['search_list'] = $this->InfoContents_model->get_ic_contents_by_list($ic_id_list);
$data['search_type'] = 'recommended';
$this->load->view('recommendlist',$data);
$this->load->view('recommendlist', $data);
}
public function search() {
$this->load->model('Information_model');
$this->load->model('Information_model');
$data['keywords'] = $this->input->post('keywords');
$search_url = str_replace($this->config->item('site_url'), "", $data['keywords']);
$data['search_list'] = $this->Information_model->search_url($search_url);
if (count($data['search_list']) === 0) {
$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');
$this->load->view('recommendlist',$data);
$data['ic_id_list'] = $this->input->post('ic_id_list') == '' ? '0' : $this->input->post('ic_id_list');
$this->load->view('recommendlist', $data);
return TRUE;
}
//保存自定义配置
function save_meta()
{
$this->load->model('InfoMetas_model');
$im_ic_id=$this->input->post('im_ic_id');
$im_key=$this->input->post('im_key');
$im_value=$this->input->post('im_value');
if($im_ic_id && $im_key && $im_value!==false)
{
$meta=$this->InfoMetas_model->get($im_ic_id, $im_key);
if($meta===false)
{
function save_meta() {
$this->load->model('InfoMetas_model');
$im_ic_id = $this->input->post('im_ic_id');
$im_key = $this->input->post('im_key');
$im_value = $this->input->post('im_value');
if ($im_ic_id && $im_key && $im_value !== false) {
$meta = $this->InfoMetas_model->get($im_ic_id, $im_key);
if ($meta === false) {
$this->InfoMetas_model->add($im_ic_id, $im_key, $im_value);
}
else
{
} else {
$this->InfoMetas_model->update($im_ic_id, $im_key, $im_value);
}
$data[] = array('name' => 'ok', 'value' => 'success');
}
else
{
} else {
$data[] = array('name' => 'no', 'value' => 'error');
}
echo json_encode($data);
return true;
}
//保存自定义配置
function delete_meta()
{
$this->load->model('InfoMetas_model');
$im_ic_id=$this->input->post('im_ic_id');
$im_key=$this->input->post('im_key');
if($im_ic_id && $im_key)
{
function delete_meta() {
$this->load->model('InfoMetas_model');
$im_ic_id = $this->input->post('im_ic_id');
$im_key = $this->input->post('im_key');
if ($im_ic_id && $im_key) {
$this->InfoMetas_model->delete($im_ic_id, $im_key);
$data[] = array('name' => 'ok', 'value' => 'success');
}
else
{
} else {
$data[] = array('name' => 'no', 'value' => 'error');
}
echo json_encode($data);
return true;
}
}

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

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

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

@ -1,220 +1,190 @@
<?php
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_datetime = false;
var $t_title = false;
var $t_td_type = false;
function __construct()
{
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_datetime = false;
var $t_title = false;
var $t_td_type = false;
function __construct() {
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
}
function init()
{
$this->top_num=false;
$this->t_id=false;
$this->order_by=" ORDER BY t.t_id DESC ";
$this->t_status=false;
$this->t_a_id=false;
$this->t_datetime = false;
$this->t_title = false;
$this->t_td_type=false;
function init() {
$this->top_num = false;
$this->t_id = false;
$this->order_by = " ORDER BY t.t_id DESC ";
$this->t_status = false;
$this->t_a_id = false;
$this->t_datetime = false;
$this->t_title = 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)
{
$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_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,
//正在编辑的任务
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_sitecode, \n"
. " t.t_delete \n"
. "FROM infotasks t \n"
. "WHERE t.t_delete = 0 \n";
if ($get_count)
$sql = "SELECT t.t_id FROM infotasks t WHERE t.t_delete = 0";
$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) ";
$sql.= " AND t.t_sitecode= " . $this->HT->escape($this->config->item('site_code'));
$this->t_datetime ? $sql.=$this->t_datetime : false;
$this->order_by ? $sql.=$this->order_by : false;
$query = $this->HT->query($sql);
//print_r($this->HT->queries);
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_content,
t.t_status,
@ -229,80 +199,75 @@ class Infotasks_model extends CI_Model
FROM infotasks t
WHERE t.t_id IN ($taskids)
ORDER BY t.t_datetime DESC";
$query=$this->HT->query($sql);
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);
}
$query = $this->HT->query($sql);
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);
}
//写入
function add($t_title, $t_content, $t_a_id, $t_ht_op_code, $t_td_type, $t_expires,$t_status='edit',$t_attach=NULL)
{
$sql = "INSERT INTO infotasks \n"
. " ( \n"
. " t_title, \n"
. " t_content, \n"
. " t_a_id, \n"
. " t_ht_op_code, \n"
. " t_td_type, \n"
. " t_expires, \n"
. " t_status, \n"
. " t_delete, \n"
. " t_datetime, \n"
. " t_attach \n"
. " ) \n"
. "VALUES \n"
. " ( \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));
function add($t_title, $t_content, $t_a_id, $t_ht_op_code, $t_td_type, $t_expires, $t_status = 'edit', $t_sitecode, $t_attach = NULL) {
$sql = "INSERT INTO infotasks \n"
. " ( \n"
. " t_title, \n"
. " t_content, \n"
. " t_a_id, \n"
. " t_ht_op_code, \n"
. " t_td_type, \n"
. " t_expires, \n"
. " t_status, \n"
. " t_sitecode, \n"
. " t_delete, \n"
. " t_datetime, \n"
. " t_attach \n"
. " ) \n"
. "VALUES \n"
. " ( \n"
. " N?,N?,?,?,?,?,?,?,0,GETDATE(),? \n"
. " )";
$query = $this->HT->query($sql, array($t_title, $t_content, $t_a_id, $t_ht_op_code, $t_td_type, $t_expires, $t_status, $t_sitecode, $t_attach));
$this->insert_id = $this->HT->last_id('infotasks');
return $query;
//print_r($this->HT->queries);
return $query;
//print_r($this->HT->queries);
}
//更新
function update($t_id,$t_title, $t_content, $t_a_id, $t_td_type, $t_expires,$t_status='',$t_attach=false)
{
$t_status_sql='';
if ($t_status!='') {
$t_status_sql="t_status='$t_status',";
}
if ($t_attach) {
$t_status_sql.="t_attach = '$t_attach',";
}
$sql = "UPDATE infotasks SET
function update($t_id, $t_title, $t_content, $t_a_id, $t_td_type, $t_expires, $t_status = '', $t_attach = false) {
$t_status_sql = '';
if ($t_status != '') {
$t_status_sql = "t_status='$t_status',";
}
if ($t_attach) {
$t_status_sql.="t_attach = '$t_attach',";
}
$sql = "UPDATE infotasks SET
t_title = N?,
t_content = N?,
t_a_id = ?,
@ -311,85 +276,81 @@ class Infotasks_model extends CI_Model
$t_status_sql
t_datetime = GETDATE()
WHERE t_id = ?";
$query=$this->HT->query($sql, array($t_title, $t_content, $t_a_id, $t_td_type, $t_expires,$t_id));
return $query;
//print_r($this->HT->queries);
$query = $this->HT->query($sql, array($t_title, $t_content, $t_a_id, $t_td_type, $t_expires, $t_id));
return $query;
//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)
{
$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 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
//承接任务
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
INNER JOIN infoContents ON ic_id=ta_ic_id
LEFT JOIN infotasks ON t_id=ta_t_id
WHERE ta_id=?";
$query=$this->HT->query($sql, array($ta_id));
$result=$query->result();
if (empty($result)) {
return 0;
}else{
$result=$result[0];
//信息平台和作者平台同时是发布状态时
if ($result->t_status=='published' AND $result->ic_status==1) {
return 1;
}else{
return 0;
}
}
}
//获取任务大厅任务个数
public function task_hall_count(){
$result=$this->in_hall();
$num=count($result);
return $num;
}
//获取每月优秀文章排行榜
public function get_article_rank_list(){
$day_end = date('Y-m-01');
$day_start = date('Y-m-d', strtotime("$day_end -1 month"));
$sql="SELECT
$query = $this->HT->query($sql, array($ta_id));
$result = $query->result();
if (empty($result)) {
return 0;
} else {
$result = $result[0];
//信息平台和作者平台同时是发布状态时
if ($result->t_status == 'published' AND $result->ic_status == 1) {
return 1;
} else {
return 0;
}
}
}
//获取任务大厅任务个数
public function task_hall_count() {
$result = $this->in_hall();
$num = count($result);
return $num;
}
//获取每月优秀文章排行榜
public function get_article_rank_list() {
$day_end = date('Y-m-01');
$day_start = date('Y-m-d', strtotime("$day_end -1 month"));
$sql = "SELECT
t_id,
t_title,
t_a_id,
@ -401,58 +362,71 @@ class Infotasks_model extends CI_Model
INNER JOIN infoTaskArticles ON t_id=ta_t_id
WHERE ta_isbest between ? AND ?
ORDER BY t_rating_total DESC";
$query=$this->HT->query($sql,array($day_start,$day_end));
$result=$query->result();
return $result;
}
//获取最新活跃作者
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";
$query=$this->HT->query($sql);
$result=$query->result();
if (!empty($result) && $top==1) {
return $result[0];
}
return $result;
}
//获取不同任务状态的任务数量
public function get_task_count_by_status(){
$admin_info = $this->session->userdata('session_admin');
$t_ht_op_code=$admin_info->a_id;
if(is_numeric($t_ht_op_code)){
$map=" t_a_id= ".$this->HT->escape($t_ht_op_code);
}else{
$map=" 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);
$result=$query->result();
$counts=array();
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_count=$unreviewed_count=0;
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;
$query = $this->HT->query($sql, array($day_start, $day_end));
$result = $query->result();
return $result;
}
//获取最新活跃作者
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";
$query = $this->HT->query($sql);
$result = $query->result();
if (!empty($result) && $top == 1) {
return $result[0];
}
return $result;
}
//获取不同任务状态的任务数量
public function get_task_count_by_status() {
$admin_info = $this->session->userdata('session_admin');
$t_ht_op_code = $admin_info->a_id;
if (is_numeric($t_ht_op_code)) {
$where = " t_a_id= " . $this->HT->escape($t_ht_op_code);
} else {
$where = " t_ht_op_code=" . $this->HT->escape($t_ht_op_code);
}
$site_code = $this->config->item('site_code');
if ($site_code == 'cht') { //早期的任务没有设置站点默认是cht
$where.=" AND ( t_sitecode= '$site_code' OR t_sitecode is null )";
} else {
$where.=" AND t_sitecode= '$site_code' ";
}
$sql = "SELECT t_status, count(0) as task_count FROM infotasks WHERE $where AND t_delete=0 group by t_status";
$query = $this->HT->query($sql);
$result = $query->result();
$counts = array();
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_count = $unreviewed_count = 0;
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;
KindEditor.ready(function(K) {
editor = K.create('#ta_content', {
width : '100%',
height:'480px',
width: '100%',
height: '480px',
//fileManagerJson:'/js/kcfinder/browse.php',
//allowFileManager:true,
allowImageUpload:false,
filterMode : false,
langType : 'en',
items : [
allowImageUpload: false,
filterMode: false,
langType: 'en',
items: [
'ace', '|', 'undo', 'redo', '|', 'preview', 'cut', 'copy', 'paste', 'plainpaste', 'wordpaste', '|',
'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', '|',
'clearhtml', 'quickformat','removeformat', 'selectall', '/','fullscreen', '|',
'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', '|',
'clearhtml', 'quickformat', 'removeformat', 'selectall', '/', 'fullscreen', '|',
'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'
],
afterChange: function() {
@ -26,26 +26,26 @@
});
//加载预览样式
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(".ke-content").css({"max-width":"1024px","margin-left":"auto","margin-right":"auto"});
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(".ke-content").css({"max-width": "1024px", "margin-left": "auto", "margin-right": "auto"});
}
$(document).ready(function() {
//每隔三分钟自动保存一次任务内容
setInterval(function(){
editor.sync();
var data=$('#form_article').serialize();
var url= '<?php echo site_url('welcome/edit_submit') ?>';
$.post(url,data,function(responseText){
var responseText=eval("("+responseText+")");//转换为json对象
for (var key in responseText) {
if (responseText[key].name != 'ok') {
$("#auto-save").html('(自动保存失败...)');
setInterval(function() {
editor.sync();
var data = $('#form_article').serialize();
var url = '<?php echo site_url('welcome/edit_submit') ?>';
$.post(url, data, function(responseText) {
var responseText = eval("(" + responseText + ")");//转换为json对象
for (var key in responseText) {
if (responseText[key].name != 'ok') {
$("#auto-save").html('(自动保存失败...)');
}
}
}
});
});
}, 180000);
//ajax获取获取google分析数据的日期设置
@ -54,163 +54,149 @@
});
$("#total-analytics>a").trigger("click");
$("#rating-container>ul>li").hover(function(){
$("#rating-container>ul>li").hover(function() {
$(this).tooltip('show');
});
});
//快速图片上传
function openKCFinder_ta_photo() {
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' );
}
function openKCFinder_ta_photo_callback(result) {
if (result != null && result.Pinfo[0]) {
$('#ta_photo').val(result.Pinfo[0].PUrl);
$("#ta_photo_img").attr("src","<?php echo $this->config->item('media_image_url'); ?>"+result.Pinfo[0].PUrl);
}
}
//快速图片上传
function openKCFinder_ta_photo() {
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');
}
function openKCFinder_ta_photo_callback(result) {
if (result != null && result.Pinfo[0]) {
$('#ta_photo').val(result.Pinfo[0].PUrl);
$("#ta_photo_img").attr("src", "<?php echo $this->config->item('media_image_url'); ?>" + result.Pinfo[0].PUrl);
}
}
//选择内容图片
function openKCFinder_Content() {
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.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');
}
function openKCFinder_Content_callback(result) {
var site_image_url='<?php echo $this->config->item('media_image_url') ?>';
if (result != null){
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+'" />');
}
var site_image_url = '<?php echo $this->config->item('media_image_url') ?>';
if (result != null) {
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 + '" />');
}
}
}
function get_analytics_ajax(formid,contentid,loadtotal){
var url= $("#"+formid).attr('action')+'/'+loadtotal;
var data = $("#"+formid).serialize();
$("#"+contentid).html('<img src="/css/images/loading.gif" >');
$.post(url,data,function(result){
$("#"+contentid).html(result);
});
}
</script>
<div class="row-fluid">
<div class="span8 offset2" style="min-height:650px;">
<legend>Task requirement</legend>
<div style="background:#f5f5f5;padding:15px;margin-bottom:15px;">
<div class="row-fluid">
<div class="span12">
<strong>Task name:</strong>:
<?php echo $task->t_title; ?>
</div>
</div>
<div class="row-fluid">
<div class="span3">
<strong>Task type:</strong>
<?php echo $task->t_td_type; ?>
<div class="span8 offset2" style="min-height:650px;">
<legend>Task requirement</legend>
<div style="background:#f5f5f5;padding:15px;margin-bottom:15px;">
<div class="row-fluid">
<div class="span12">
<strong>Task name:</strong>:
<?php echo $task->t_title; ?>
</div>
</div>
<div class="row-fluid">
<div class="span3">
<strong>Task type:</strong>
<?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 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'; ?>">
<span>Task details</span>
<span class="pull-right <?php if(!isset($task_status) or $task_status==0) echo 'hide';?>" style="font-size:14px;" id="total-analytics">
<a href="javascript:void(0);" onClick="get_analytics_ajax('get-analytic-form','total-analytics','1');">获取google分析汇总数据</a>
</span>
</legend>
<form action="#" class="<?php if($task_detail->ta_content=='') echo 'hide'; ?>" name="form_article" id="form_article" method="post">
<label class="control-label" >Title</label>
<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; ?>">
<label><strong>Content</strong><em id="auto-save" class="small"></em></label>
<a href="javascript:void(0);" onclick="openKCFinder_Content();" title="Insert an image"><i class="icon-picture pull-right"></i></a>
<i class="icon-stop icon-white pull-right"> </i>
<i class="icon-stop icon-white pull-right" id="display_count">-</i>
<textarea rows="12" class="span12" id="ta_content" name="ta_content"><?php if(isset($task_detail->ta_content))echo $task_detail->ta_content; ?></textarea>
<p> </p>
<label><strong>Brief introduction</strong></label>
<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 title</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; ?>">
<label class="control-label" ><strong>SEO description</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; ?>">
<label class="control-label" ><strong>SEO Keywords</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; ?>">
<label class="control-label" ><strong>Link Picture</strong></label>
<div class="media" style="background: #f5f5f5;padding: 15px;">
<div class="pull-left">
<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>
<div class="media-body">
<button type="button" onclick="openKCFinder_ta_photo();" class="btn" style="margin:25px 0;">Choose</button><br>
<button type="button" onclick="$('#ta_photo').val('');$('#ta_photo_img').attr('src','/css/images/uploadPic.jpg');" class="btn" style="margin-bottom:12px;"> Reset </button>
<p>Click the “Choose” button<br> to choose a photo from our Photo Galleries.</p>
<legend class="<?php if ($task_detail->ta_content == '') echo 'hide'; ?>">
<span>Task details</span>
</legend>
<form action="#" class="<?php if ($task_detail->ta_content == '') echo 'hide'; ?>" name="form_article" id="form_article" method="post">
<label class="control-label" >Title</label>
<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; ?>">
<label><strong>Content</strong><em id="auto-save" class="small"></em></label>
<a href="javascript:void(0);" onclick="openKCFinder_Content();" title="Insert an image"><i class="icon-picture pull-right"></i></a>
<i class="icon-stop icon-white pull-right"> </i>
<i class="icon-stop icon-white pull-right" id="display_count">-</i>
<textarea rows="12" class="span12" id="ta_content" name="ta_content"><?php if (isset($task_detail->ta_content)) echo $task_detail->ta_content; ?></textarea>
<p> </p>
<label><strong>Brief introduction</strong></label>
<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 title</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; ?>">
<label class="control-label" ><strong>SEO description</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; ?>">
<label class="control-label" ><strong>SEO Keywords</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; ?>">
<label class="control-label" ><strong>Link Picture</strong></label>
<div class="media" style="background: #f5f5f5;padding: 15px;">
<div class="pull-left">
<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>
<div class="media-body">
<button type="button" onclick="openKCFinder_ta_photo();" class="btn" style="margin:25px 0;">Choose</button><br>
<button type="button" onclick="$('#ta_photo').val('');
$('#ta_photo_img').attr('src', '/css/images/uploadPic.jpg');" class="btn" style="margin-bottom:12px;"> Reset </button>
<p>Click the “Choose” button<br> to choose a photo from our Photo Galleries.</p>
</div>
<input type="hidden" name="ta_photo" id="ta_photo" value="<?php if (isset($task_detail->ta_photo)) echo $task_detail->ta_photo; ?>" />
<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>
<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 class="modal fade" id="undertake_modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Accept the task</h3>
</div>
<div class="modal-body">
<p>Make sure again.</p>
<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; ?>" >
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">No</button>
<button class="btn btn-primary" onclick="submitForm('form_undertake');">Yes</button>
</div>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Accept the task</h3>
</div>
<div class="modal-body">
<p>Make sure again.</p>
<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; ?>" >
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">No</button>
<button class="btn btn-primary" onclick="submitForm('form_undertake');">Yes</button>
</div>
</div>
<!-- 放弃任务 -->
<div class="modal fade" id="canceltake_modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Give up the task</h3>
</div>
<div class="modal-body">
<p>Make sure again.</p>
<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; ?>" >
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">No</button>
<button class="btn btn-primary" onclick="submitForm('form_canceltake');">Yes</button>
</div>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Give up the task</h3>
</div>
<div class="modal-body">
<p>Make sure again.</p>
<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; ?>" >
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">No</button>
<button class="btn btn-primary" onclick="submitForm('form_canceltake');">Yes</button>
</div>
</div>

@ -729,6 +729,12 @@ class Index extends CI_Controller {
$this->Note_model->update_send($item->pn_txn_id, 'sendfail');
continue;
}
//检测是否是APP订单,默认不处理
if ((strpos($item->pn_memo, 'China Train Booking') !== false) || (strpos($item->pn_memo, 'ChinaTrainBooking') !== false)) { //APP自动出票的订单不需要处理
$this->Note_model->update_send($item->pn_txn_id, 'send');
continue;
}
//根据note信息找到订单号
$orderid_info = $this->analysis_orderid($item->pn_invoice);
@ -741,6 +747,7 @@ class Index extends CI_Controller {
if (empty($orderid_info)) {
$orderid_info = $this->analysis_orderid($item->pn_item_number);
}
//找不到订单号,设置为发送失败标示
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);
//检测是否是APP订单,默认不处理
if ($orderid_info->ordertype == 'A') { //APP自动出票的订单不需要处理
$this->Note_model->update_send($item->pn_txn_id, 'send');
continue;

Loading…
Cancel
Save