* code for task #5387.

This commit is contained in:
wangyidong
2019-04-25 09:10:42 +08:00
parent 1daead8b6c
commit 75ebcb18dc
18 changed files with 272 additions and 238 deletions
-39
View File
@@ -1939,45 +1939,6 @@ class bugModel extends model
foreach($commonOption->graph as $key => $value) if(!isset($chartOption->graph->$key)) $chartOption->graph->$key = $value;
}
/**
* Get bug templates of a user.
*
* @param string $account
* @access public
* @return array
*/
public function getUserBugTemplates($account)
{
$templates = $this->dao->select('id,account,title,content,public')
->from(TABLE_USERTPL)
->where('type')->eq('bug')
->andwhere('account', true)->eq($account)
->orWhere('public')->eq('1')
->markRight(1)
->orderBy('id')
->fetchAll();
return $templates;
}
/**
* Save user template.
*
* @access public
* @return void
*/
public function saveUserBugTemplate()
{
$template = fixer::input('post')
->setDefault('account', $this->app->user->account)
->setDefault('type', 'bug')
->stripTags('content', $this->config->allowedTags)
->get();
$condition = "`type`='bug' and account='{$this->app->user->account}'";
$this->dao->insert(TABLE_USERTPL)->data($template)->batchCheck('title, content', 'notempty')->check('title', 'unique', $condition)->exec();
if(!dao::isError()) $this->loadModel('score')->create('bug', 'saveTplModal', $this->dao->lastInsertID());
}
/**
* Return the file => label pairs of some fields.
*