- Remove ajaxSetUnfoldID function of misc.

This commit is contained in:
zhujinyong
2021-03-04 12:29:57 +08:00
parent 1ad514e0b0
commit 08102f3151
-47
View File
@@ -235,51 +235,4 @@ class misc extends control
$this->session->set($sessionVar, $captcha->getPhrase());
$captcha->build()->output();
}
/**
* Ajax set unfoldID.
*
* @param int $objectID
* @param string $objectType
* @param string $action add|delete
* @access public
* @return void
*/
public function ajaxSetUnfoldID($objectID, $objectType, $action = 'add')
{
$account = $this->app->user->account;
if($objectType == 'project')
{
$condition = "owner={$account}&module=project&section=task&key=unfoldTasks";
$settingPath = $account . ".project.task.unfoldTasks";
}
else
{
$condition = "owner={$account}&module=product&section=browse&key=unfoldStories";
$settingPath = $account . ".product.browse.unfoldStories";
}
$this->loadModel('setting');
$setting = $this->setting->createDAO($this->setting->parseItemParam($condition), 'select')->fetch();
$newUnfoldID = $this->post->newUnfoldID;
if(empty($newUnfoldID)) die();
$newUnfoldID = json_decode($newUnfoldID);
$unfoldIdList = $setting ? json_decode($setting->value, true) : array();
foreach($newUnfoldID as $unfoldID)
{
unset($unfoldIdList[$objectID][$unfoldID]);
if($action == 'add') $unfoldIdList[$objectID][$unfoldID] = $unfoldID;
}
if(empty($setting))
{
$this->setting->setItem($settingPath, json_encode($unfoldIdList));
}
else
{
$this->dao->update(TABLE_CONFIG)->set('value')->eq(json_encode($unfoldIdList))->where('id')->eq($setting->id)->exec();
}
die('success');
}
}