* Finish task #96499.

This commit is contained in:
sunguangming
2023-07-04 13:54:15 +08:00
parent fda1dee258
commit a98d1e00f3
3 changed files with 93 additions and 11 deletions
+34
View File
@@ -954,6 +954,40 @@ class programModel extends model
}
}
/**
* Activate a program.
*
* @param int $programID
* @access public
* @return array|false
*/
public function activate(int $programID) :array|false
{
$oldProgram = $this->getByID($programID);
$now = helper::now();
$program = fixer::input('post')
->setDefault('realEnd','')
->setDefault('status', 'doing')
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->setIF(!helper::isZeroDate($oldProgram->realBegan), 'realBegan', helper::today())
->stripTags($this->config->program->editor->activate['id'], $this->config->allowedTags)
->remove('comment')
->get();
$program = $this->loadModel('file')->processImgURL($program, $this->config->program->editor->activate['id'], $this->post->uid);
$this->dao->update(TABLE_PROJECT)->data($program)
->autoCheck()
->checkFlow()
->where('id')->eq((int)$programID)
->exec();
if(dao::isError()) return false;
return common::createChanges($oldProgram, $program);
}
/*
* Get program swapper.
*