#427 区分管理员和数据作者的回复

This commit is contained in:
Li Jianxuan 2012-12-06 07:17:04 +00:00
parent ed5269a182
commit a92302a120
1 changed files with 34 additions and 14 deletions

View File

@ -858,8 +858,11 @@ class DataController extends Zend_Controller_Action
foreach($paginator as $c)
{
//$author=$this->view->escape($c['author']);
$sql = "SELECT cr.id,cr.content as body,cr.reply,u.username,cr.ts_created FROM comments cr
LEFT JOIN users u ON cr.userid=u.id WHERE cr.reply=?";
$sql = "SELECT cr.id,cr.content as body,cr.reply,u.username,cr.ts_created,u.usertype,
(SELECT au.uuid FROM mdauthor au WHERE au.userid=u.id AND au.uuid='$uuid') as uuid
FROM comments cr
LEFT JOIN users u ON cr.userid=u.id
WHERE cr.reply=?";
$sth = $this->db->prepare($sql);
$sth->execute(array($c['id']));
$replys = $sth->fetchAll();
@ -868,8 +871,25 @@ class DataController extends Zend_Controller_Action
{
foreach($replys as $v)
{
$usertype = "";
$color = "";
if($v['usertype'] == "administrator")
{
$usertype = "[管理员]";
$color="#009d00";
}
if($v['uuid'] == $uuid)
{
$usertype = "[数据作者]";
$color="#add2e9";
}
if(!empty($color))
{
$color = 'background:'.$color.';color:#FFFFFF;';
}
$replyhtml .= "
<div class='comment-content' style='width:90%;margin:5px auto;'><span class='title'>".$v['username']." 回复于".date('Y-m-d H:i:s',strtotime($v['ts_created']))."</span>
<div class='comment-content' style='width:90%;margin:5px auto;'><span class='title' style='$color'>".
$v['username']."$usertype 回复于".date('Y-m-d H:i:s',strtotime($v['ts_created']))."</span>
<p>".($v['body'])."</p>
</div>";
}
@ -1112,7 +1132,7 @@ class DataController extends Zend_Controller_Action
$testsql="select id,has_send_mail from onlineapp where userid='$userid' and uuid='$uuid' order by id desc";
$result=$this->db->query($testsql);
$rows = $result->fetch();
$rows = $result->fetch();
$has_send_mail=$rows['has_send_mail'];
if (empty($rows['id']))
{
@ -1137,7 +1157,7 @@ class DataController extends Zend_Controller_Action
$sql="update dataorder set onlineappid='$onlineappid',ts_approved=now() where id='{$row['id']}'";
try {$this->db->exec($sql);} catch (Exception $e) {}
}
}
}
$this->view->username='westdc'.Zend_Auth::getInstance()->getIdentity()->id;
$sql=$this->db->quoteInto("select o.* from onlineresource o left join metadata m on o.uuid=m.uuid where m.datatype=0 and m.uuid=?",$uuid);
@ -1248,17 +1268,17 @@ class DataController extends Zend_Controller_Action
if (empty($u)) {
$sql="insert into dataorder (userid,uuid,ts_created) values(?,?,now())";
$this->db->query($sql,array($userid,$uuid));
}*/
if (!empty($ftpurls) && ($updateftp || $updateftp1) && !$has_send_mail)
}*/
if (!empty($ftpurls) && ($updateftp || $updateftp1) && !$has_send_mail)
{
$data = array(
"uuid"=>$uuid,
"uuid"=>$uuid,
"title"=>$this->view->md['title']."(".$this->view->md['filesize']."MB)",
"user"=>$user->username,
"user"=>$user->username,
"ftpuser"=>$this->view->username,
"ftppwd"=>$this->view->userpass,
"ftptime"=>$this->view->ftptime,
"ftpurl"=>$this->view->ftpurls[0],
"ftptime"=>$this->view->ftptime,
"ftpurl"=>$this->view->ftpurls[0],
"note"=>$updateftp?'BTW请注意登陆后要手工进入对应的目录':''
);
$mailtp=new EmailText($this->db,'online-download',$data);
@ -1267,10 +1287,10 @@ class DataController extends Zend_Controller_Action
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
$mail->addTo($user->email);
$mail->setSubject($mailtp->getSubject());
@$mail->send();
$sql="update onlineapp set has_send_mail=true where id=?";
@$mail->send();
$sql="update onlineapp set has_send_mail=true where id=?";
$sth=$this->db->prepare($sql);
$sth->execute(array($onlineappid));
$sth->execute(array($onlineappid));
}
}
/*