Merge branch feature/php8.4 of zentao/zentaopms (#10225)

This commit is contained in:
刘刚
2025-07-07 15:13:29 +08:00
committed by Gitfox
27 changed files with 109 additions and 74 deletions
+2 -2
View File
@@ -57,7 +57,7 @@ class baseHelper
if(!is_object(${$objName}) or empty($key)) return false;
$key = str_replace('.', '->', $key);
$value = serialize($value);
$code = ("\$${objName}->{$key}=unserialize(<<<EOT\n$value\nEOT\n);");
$code = ("\${$objName}->{$key}=unserialize(<<<EOT\n$value\nEOT\n);");
eval($code);
return true;
}
@@ -885,7 +885,7 @@ class baseHelper
* @access public
* @return bool
*/
public static function setcookie(string $name, string|int|bool $value = '', int $expire = null, string $path = null, string $domain = '', bool $secure = null, bool $httponly = true)
public static function setcookie(string $name, string|int|bool $value = '', ?int $expire = null, ?string $path = null, string $domain = '', ?bool $secure = null, bool $httponly = true)
{
if(defined('RUN_MODE') && RUN_MODE == 'test')
{
+7 -11
View File
@@ -853,7 +853,7 @@ class baseRouter
*/
public function setDebug()
{
if(!empty($this->config->debug)) error_reporting(E_ALL & ~ E_STRICT);
if(!empty($this->config->debug)) error_reporting(E_ALL);
}
/**
@@ -1229,15 +1229,9 @@ class baseRouter
if(is_writable($savePath))
{
session_save_path($this->getTmpRoot() . 'session');
$ztSessionHandler = new ztSessionHandler();
session_set_save_handler(
array($ztSessionHandler, 'open'),
array($ztSessionHandler, 'close'),
array($ztSessionHandler, 'read'),
array($ztSessionHandler, 'write'),
array($ztSessionHandler, 'destroy'),
array($ztSessionHandler, 'gc')
);
session_set_save_handler($ztSessionHandler, true);
}
}
@@ -3359,7 +3353,7 @@ class baseRouter
}
/* Show non-serious errors to classic page. */
if($level == E_NOTICE or $level == E_WARNING or $level == E_STRICT or $level == 8192)
if($level == E_NOTICE or $level == E_WARNING or $level == 8192)
{
$cmd = "vim +$line $file";
$size = strlen($cmd);
@@ -3596,6 +3590,7 @@ else
*
* @package framework
*/
#[AllowDynamicProperties]
class language
{
/**
@@ -3640,6 +3635,7 @@ class language
*
* @package framework
*/
#[AllowDynamicProperties]
class super
{
/**
@@ -3811,7 +3807,7 @@ class EndResponseException extends \Exception
*
* @package framework
*/
class ztSessionHandler
class ztSessionHandler implements SessionHandlerInterface
{
public $sessSavePath;
public $sessionFile;
+5 -3
View File
@@ -18,6 +18,8 @@
* @package framework
*/
include __DIR__ . '/base/control.class.php';
#[AllowDynamicProperties]
class control extends baseControl
{
/**
@@ -515,7 +517,7 @@ class control extends baseControl
* @access public
* @return zin\fieldList
*/
public function appendExtendFields(zin\fieldList $fields, string $moduleName = '', string $methodName = '', object $object = null): zin\fieldList
public function appendExtendFields(zin\fieldList $fields, string $moduleName = '', string $methodName = '', ?object $object = null): zin\fieldList
{
if($this->config->edition == 'open') return $fields;
if(!empty($this->app->installing) || !empty($this->app->upgrading)) return $fields;
@@ -557,7 +559,7 @@ class control extends baseControl
* @access public
* @return string
*/
public function appendExtendCssAndJS(string $moduleName = '', string $methodName = '', object $object = null): string
public function appendExtendCssAndJS(string $moduleName = '', string $methodName = '', ?object $object = null): string
{
if($this->config->edition == 'open') return '';
if(!empty($this->app->installing) || !empty($this->app->upgrading)) return '';
@@ -598,7 +600,7 @@ class control extends baseControl
* @access public
* @return array
*/
public function appendExtendForm(string $position = 'info', object $object = null, string $moduleName = '', string $methodName = ''): array
public function appendExtendForm(string $position = 'info', ?object $object = null, string $moduleName = '', string $methodName = ''): array
{
if($this->config->edition == 'open') return array();
if(!empty($this->app->installing) || !empty($this->app->upgrading)) return array();
+1 -1
View File
@@ -509,7 +509,7 @@ function initPageEntity(object $object): array
* @access public
* @return array
*/
function initTableData(array $items, array &$fieldList, object $model = null, string $moduleName = ''): array
function initTableData(array $items, array &$fieldList, ?object $model = null, string $moduleName = ''): array
{
if(!empty($_GET['orderBy']) && strpos($_GET['orderBy'], '-') !== false) list($orderField, $orderValue) = explode('_', $_GET['orderBy']);
if(!empty($orderField) && !empty($orderValue) && !empty($fieldList[$orderField]))
+2
View File
@@ -18,6 +18,8 @@
* @package framework
*/
include __DIR__ . '/base/model.class.php';
#[AllowDynamicProperties]
class model extends baseModel
{
/**
+3
View File
@@ -18,6 +18,9 @@
* @package framework
*/
include __DIR__ . '/base/router.class.php';
#[AllowDynamicProperties]
class router extends baseRouter
{
/**
+1 -1
View File
@@ -441,7 +441,7 @@ class baseDAO
* @access public
* @return void
*/
public function setCache($key, $sql = '', $value = null, int $ttl = null)
public function setCache($key, $sql = '', $value = null, ?int $ttl = null)
{
if(!$this->app->isServing() || empty($this->cache)) return false;
+9
View File
@@ -50,6 +50,15 @@ class cache
*/
private $dao;
/**
* 全局数据库操作句柄。
* Global database operation handler.
*
* @access private
* @var object
*/
private $dbh;
/**
* 全局配置对象。
* Global configuration object.
+2 -2
View File
@@ -68,7 +68,7 @@ class form extends fixer
* @param int $objectID
* @return form
*/
public static function data(array $configObject = null, int $objectID = 0): form
public static function data(?array $configObject = null, int $objectID = 0): form
{
global $app, $config;
@@ -85,7 +85,7 @@ class form extends fixer
* @param array|null $configObject
* @return form
*/
public static function batchData(array $configObject = null): form
public static function batchData(?array $configObject = null): form
{
global $app, $config;
+7
View File
@@ -7,6 +7,13 @@
*/
class pinyin
{
/**
* Segments.
* @var array
*
*/
protected array $segments = array();
/**
* Constructor.
*
-2
View File
@@ -17,8 +17,6 @@ require_once __DIR__ . DS . 'zin.func.php';
class item extends node
{
public bool $notRenderInGlobal = true;
public function build(): array|node|directive
{
if($this->parent instanceof node && method_exists($this->parent, 'onBuildItem'))
+8
View File
@@ -47,6 +47,14 @@ class jsCallback extends jsHelper
*/
public bool $isArrowFunc = false;
/**
* Parent node
*
* @access public
* @var node
*/
public $parent = null;
/**
* 构造函数。
*
+2
View File
@@ -57,6 +57,8 @@ class node implements \JsonSerializable
public array $eventBindings = array();
public ?bool $notRenderInGlobal = null;
public function __construct(mixed ...$args)
{
$this->gid = static::nextGid();
+10 -2
View File
@@ -25,6 +25,14 @@ class dataset implements \JsonSerializable
*/
protected array $storedData = array();
/**
* Parent node
*
* @access public
* @var node
*/
public $parent = null;
/**
* Create an instance, the initialed data can be passed.
*
@@ -32,7 +40,7 @@ class dataset implements \JsonSerializable
* @param array|object|string $data Properties list array.
* @param mixed $value Property value.
*/
public function __construct(array|string $data = null, mixed $value = null)
public function __construct($data = null, $value = null)
{
if($data !== null) $this->set($data, $value);
}
@@ -191,7 +199,7 @@ class dataset implements \JsonSerializable
* @param mixed $defaultValue Optional default value if actual value is null.
* @return mixed
*/
public function get(string|array $prop = null, mixed $defaultValue = null): mixed
public function get($prop = null, mixed $defaultValue = null): mixed
{
if(is_null($prop)) return $this->storedData;
+2
View File
@@ -4,6 +4,8 @@ namespace zin;
class floatToolbar extends wg
{
protected ?object $object = null;
protected static array $defineProps = array(
'prefix?:array',
'main?:array',
-2
View File
@@ -22,8 +22,6 @@ class field extends setting
{
public ?fieldList $fieldList;
public ?field $parent;
public ?string $dataType;
public mixed $default;
+1 -1
View File
@@ -3499,7 +3499,7 @@ class blockZen extends block
* @access protected
* @return object
*/
protected function buildProjectStatistic(object $project, array $data, object $pager = null): object
protected function buildProjectStatistic(object $project, array $data, ?object $pager = null): object
{
extract($data);
$projectID = $project->id;
+6 -6
View File
@@ -1303,7 +1303,7 @@ eof;
* @access public
* @return bool
*/
public static function hasPriv(string $module, string $method, mixed $object = null, string $vars = '')
public static function hasPriv(string $module, string $method, $object = null, string $vars = '')
{
/* If the user is doing a tutorial, have all privileges. */
if(commonModel::isTutorialMode()) return true;
@@ -1347,7 +1347,7 @@ eof;
* @access public
* @return bool
*/
public static function getUserPriv(string $module, string $method, mixed $object = null, string $vars = ''): bool
public static function getUserPriv(string $module, string $method, $object = null, string $vars = ''): bool
{
global $app,$config;
$module = strtolower($module);
@@ -1846,7 +1846,7 @@ eof;
* @access public
* @return bool
*/
public static function canBeChanged(string $module, mixed $object = null): bool
public static function canBeChanged(string $module, $object = null): bool
{
if(defined('RUN_MODE') && RUN_MODE == 'api') return true;
@@ -1980,7 +1980,7 @@ eof;
* @access public
* @return string|array|bool
*/
public static function http(string $url, string|array|object|null $data = null, array $options = array(), array $headers = array(), string $dataType = 'data', string $method = 'POST', int $timeout = 30, bool $httpCode = false, bool $log = true): string|array|bool
public static function http(string $url, $data = null, array $options = array(), array $headers = array(), string $dataType = 'data', string $method = 'POST', int $timeout = 30, bool $httpCode = false, bool $log = true): string|array|bool
{
global $lang, $app;
@@ -2469,7 +2469,7 @@ eof;
* @access public
* @return void
*/
public static function buildActionItem(string $module, string $method, string $params, object|null $object = null, array $attrs = array()): array
public static function buildActionItem(string $module, string $method, string $params, ?object $object = null, array $attrs = array()): array
{
if(!commonModel::hasPriv($module, $method, $object)) return array();
@@ -3819,7 +3819,7 @@ eof;
* @access public
* @return mixed
*/
public static function printCommentIcon(string $commentFormLink, object $object = null)
public static function printCommentIcon(string $commentFormLink, ?object $object = null)
{
global $lang;
+1 -1
View File
@@ -335,7 +335,7 @@ class deptModel extends model
* @access public
* @return array
*/
public function getUsers(string $browseType = 'inside', array $depts = array(), string $orderBy = 'id', object $pager = null): array
public function getUsers(string $browseType = 'inside', array $depts = array(), string $orderBy = 'id', ?object $pager = null): array
{
return $this->dao->select('*')->from(TABLE_USER)
->where('deleted')->eq(0)
+8 -8
View File
@@ -1051,7 +1051,7 @@ class executionModel extends model
* @access public
* @return bool
*/
public function checkWorkload(string $type = '', float $percent = 0, object $oldExecution = null): bool
public function checkWorkload(string $type = '', float $percent = 0, ?object $oldExecution = null): bool
{
/* Check whether the workload is positive. */
if(!preg_match("/^[0-9]+(.[0-9]{1,3})?$/", (string)$percent))
@@ -1230,7 +1230,7 @@ class executionModel extends model
* @access public
* @return array
*/
public function getList(int $projectID = 0, string $type = 'all',string $status = 'all', int $limit = 0, int $productID = 0, int $branch = 0, object|null $pager = null, bool $withChildren = true)
public function getList(int $projectID = 0, string $type = 'all',string $status = 'all', int $limit = 0, int $productID = 0, int $branch = 0, ?object $pager = null, bool $withChildren = true)
{
if(common::isTutorialMode()) return $this->loadModel('tutorial')->getExecutionStats($type);
@@ -1400,7 +1400,7 @@ class executionModel extends model
* @access public
* @return array
*/
public function getStatData(int $projectID = 0, string $browseType = 'undone', int $productID = 0, int $branch = 0, bool $withTasks = false, string|int $param = '', string $orderBy = 'id_asc', object|null $pager = null): array
public function getStatData(int $projectID = 0, string $browseType = 'undone', int $productID = 0, int $branch = 0, bool $withTasks = false, string|int $param = '', string $orderBy = 'id_asc', ?object $pager = null): array
{
if(commonModel::isTutorialMode()) return $this->loadModel('tutorial')->getExecutionStats($browseType);
@@ -1501,7 +1501,7 @@ class executionModel extends model
* @access public
* @return array
*/
public function fetchExecutionList(int $projectID = 0, string $browseType = 'undone', int $productID = 0, int $param = 0, string $orderBy = 'id_asc', object|null $pager = null): array
public function fetchExecutionList(int $projectID = 0, string $browseType = 'undone', int $productID = 0, int $param = 0, string $orderBy = 'id_asc', ?object $pager = null): array
{
/* Construct the query SQL at search executions. */
$executionQuery = $browseType == 'bySearch' ? $this->getExecutionQuery($param) : '';
@@ -1973,7 +1973,7 @@ class executionModel extends model
* @access public
* @return array
*/
public function getTasks(int $productID, int|array $executionID, array $executions, string $browseType, int $queryID, int $moduleID, string $sort, object $pager = null): array
public function getTasks(int $productID, int|array $executionID, array $executions, string $browseType, int $queryID, int $moduleID, string $sort, ?object $pager = null): array
{
if(common::isTutorialMode()) return $this->loadModel('tutorial')->getTasks();
@@ -2279,7 +2279,7 @@ class executionModel extends model
* @access public
* @return void
*/
public function buildStorySearchForm(array $products, array $branchGroups, array $modules, int $queryID, string $actionURL, string $type = 'executionStory', object $execution = null): void
public function buildStorySearchForm(array $products, array $branchGroups, array $modules, int $queryID, string $actionURL, string $type = 'executionStory', ?object $execution = null): void
{
$this->loadModel('productplan');
$this->app->loadLang('branch');
@@ -3763,7 +3763,7 @@ class executionModel extends model
* @access public
* @return array
*/
public function getSearchTasks(string $condition, string $orderBy, object $pager = null, string $queryKey = 'task'): array
public function getSearchTasks(string $condition, string $orderBy, ?object $pager = null, string $queryKey = 'task'): array
{
/* 按指派人搜索的时候,可以搜索到参与的多人任务。 */
if(strpos($condition, '`assignedTo`') !== false)
@@ -4209,7 +4209,7 @@ class executionModel extends model
* @access public
* @return array
*/
public function getKanbanTasks(int $executionID, string $orderBy = 'status_asc, id_desc', array $excludeTasks = array(), object|null $pager = null): array
public function getKanbanTasks(int $executionID, string $orderBy = 'status_asc, id_desc', array $excludeTasks = array(), ?object $pager = null): array
{
$excludeTasks = array_filter($excludeTasks);
$tasks = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t2.version AS latestStoryVersion, t2.status AS storyStatus, t3.realname AS assignedToRealName')
+5 -5
View File
@@ -104,7 +104,7 @@ class kanbanModel extends model
* @access public
* @return int
*/
public function createRegion(object $kanban, object $fromRegion = null, int $copyRegionID = 0, string $from = 'kanban', string $param = '')
public function createRegion(object $kanban, ?object $fromRegion = null, int $copyRegionID = 0, string $from = 'kanban', string $param = '')
{
$account = $this->app->user->account;
$order = 1;
@@ -355,7 +355,7 @@ class kanbanModel extends model
* @access public
* @return int|false
*/
public function createColumn(int $regionID, object $column = null, string $from = 'kanban', string $mode = 'new'): int|false
public function createColumn(int $regionID, ?object $column = null, string $from = 'kanban', string $mode = 'new'): int|false
{
if($mode == 'new')
{
@@ -1865,7 +1865,7 @@ class kanbanModel extends model
* @access public
* @return array
*/
public function getSpaceList(string $browseType, object $pager = null): array
public function getSpaceList(string $browseType, ?object $pager = null): array
{
$account = $this->app->user->account;
$spaceIdList = $this->getCanViewObjects('kanbanspace', $browseType);
@@ -2155,7 +2155,7 @@ class kanbanModel extends model
* @access public
* @return int|bool
*/
public function createLane(int $kanbanID, int $regionID, object $lane = null, string $mode = 'new'): int|bool
public function createLane(int $kanbanID, int $regionID, ?object $lane = null, string $mode = 'new'): int|bool
{
$laneType = isset($_POST['laneType']) ? $_POST['laneType'] : 'common';
if($laneType == 'common')
@@ -3665,7 +3665,7 @@ class kanbanModel extends model
* @access public
* @return array
*/
public function getCards2Import(int $kanbanID = 0, int $excludedID = 0, object $pager = null): array
public function getCards2Import(int $kanbanID = 0, int $excludedID = 0, ?object $pager = null): array
{
$kanbanIdList = $this->getCanViewObjects();
+10 -10
View File
@@ -262,7 +262,7 @@ class myModel extends model
* @access public
* @return array
*/
public function getAssignedByMe(string $account, object $pager = null, string $orderBy = 'id_desc', string $objectType = ''): array
public function getAssignedByMe(string $account, ?object $pager = null, string $orderBy = 'id_desc', string $objectType = ''): array
{
$module = $objectType == 'requirement' ? 'story' : $objectType;
$objectIdList = $this->dao->select('objectID')->from(TABLE_ACTION)
@@ -315,7 +315,7 @@ class myModel extends model
* @access private
* @return array
*/
private function getTaskAssignedByMe(object $pager = null, string $orderBy = 'id_desc', array $objectIdList = array()): array
private function getTaskAssignedByMe(?object $pager = null, string $orderBy = 'id_desc', array $objectIdList = array()): array
{
// 处理优先级排序
if(strpos($orderBy, 'pri_') !== false) $orderBy = str_replace('pri_', 'priOrder_', $orderBy);
@@ -391,7 +391,7 @@ class myModel extends model
* @access public
* @return array
*/
public function getTestcasesBySearch(int $queryID, string $type, string $orderBy, object $pager = null): array
public function getTestcasesBySearch(int $queryID, string $type, string $orderBy, ?object $pager = null): array
{
$queryName = $type == 'contribute' ? 'contributeTestcaseQuery' : 'workTestcaseQuery';
$queryForm = $type == 'openedbyme' ? 'contributeTestcaseForm' : 'workTestcaseForm';
@@ -494,7 +494,7 @@ class myModel extends model
* @access public
* @return array
*/
public function getTasksBySearch(string $account, int $limit = 0, object $pager = null, string $orderBy = 'id_desc', int $queryID = 0): array
public function getTasksBySearch(string $account, int $limit = 0, ?object $pager = null, string $orderBy = 'id_desc', int $queryID = 0): array
{
$moduleName = $this->app->rawMethod == 'work' ? 'workTask' : 'contributeTask';
$queryName = $moduleName . 'Query';
@@ -619,7 +619,7 @@ class myModel extends model
* @access public
* @return array
*/
public function getRisksBySearch(int $queryID, string $type, string $orderBy, object $pager = null): array
public function getRisksBySearch(int $queryID, string $type, string $orderBy, ?object $pager = null): array
{
$queryName = $type == 'contribute' ? 'contributeRiskQuery' : 'workRiskQuery';
if($queryID && $queryID != 'myQueryID')
@@ -715,7 +715,7 @@ class myModel extends model
* @access public
* @return array
*/
public function getStoriesBySearch(int $queryID, string $type, string $orderBy, object $pager = null): array
public function getStoriesBySearch(int $queryID, string $type, string $orderBy, ?object $pager = null): array
{
$queryName = $type == 'contribute' ? 'contributeStoryQuery' : 'workStoryQuery';
$queryForm = $type == 'contribute' ? 'contributeStoryForm' : 'workStoryForm';
@@ -865,7 +865,7 @@ class myModel extends model
* @access public
* @return array
*/
public function getEpicsBySearch(int $queryID, string $type, string $orderBy, object $pager = null): array
public function getEpicsBySearch(int $queryID, string $type, string $orderBy, ?object $pager = null): array
{
$queryName = $type == 'contribute' ? 'contributeEpicQuery' : 'workEpicQuery';
$queryForm = $type == 'contribute' ? 'contributeEpicForm' : 'workEpicForm';
@@ -907,7 +907,7 @@ class myModel extends model
* @access public
* @return array
*/
public function getRequirementsBySearch(int $queryID, string $type, string $orderBy, object $pager = null): array
public function getRequirementsBySearch(int $queryID, string $type, string $orderBy, ?object $pager = null): array
{
$queryName = $type == 'contribute' ? 'contributeRequirementQuery' : 'workRequirementQuery';
$queryForm = $type == 'contribute' ? 'contributeRequirementForm' : 'workRequirementForm';
@@ -981,7 +981,7 @@ class myModel extends model
* @access public
* @return array
*/
public function getReviewingList(string $browseType, string $orderBy = 'time_desc', object $pager = null): array
public function getReviewingList(string $browseType, string $orderBy = 'time_desc', ?object $pager = null): array
{
$vision = $this->config->vision;
$reviewList = array();
@@ -1370,7 +1370,7 @@ class myModel extends model
* @access public
* @return array
*/
public function getReviewedList(string $browseType, string $orderBy = 'time_desc', object $pager = null): array
public function getReviewedList(string $browseType, string $orderBy = 'time_desc', ?object $pager = null): array
{
$field = $orderBy;
$direction = 'asc';
+5 -5
View File
@@ -23,7 +23,7 @@ class myTao extends myModel
* @access protected
* @return array
*/
protected function getProductRelatedAssignedByMe(array $objectIdList, string $objectType, string $module, string $orderBy, object $pager = null): array
protected function getProductRelatedAssignedByMe(array $objectIdList, string $objectType, string $module, string $orderBy, ?object $pager = null): array
{
$nameField = $objectType == 'bug' ? 'productName' : 'productTitle';
$orderBy = strpos($orderBy, 'priOrder') !== false || strpos($orderBy, 'severityOrder') !== false || strpos($orderBy, $nameField) !== false ? $orderBy : "t1.{$orderBy}";
@@ -63,7 +63,7 @@ class myTao extends myModel
* @access protected
* @return array
*/
protected function fetchTasksBySearch(string $query, string $moduleName, string $account, array $taskIdList, string $orderBy, int $limit, object $pager = null): array
protected function fetchTasksBySearch(string $query, string $moduleName, string $account, array $taskIdList, string $orderBy, int $limit, ?object $pager = null): array
{
$query = preg_replace('/`(\w+)`/', 't1.`$1`', $query);
$query = str_replace('t1.`project`', 't2.`project`', $query);
@@ -133,7 +133,7 @@ class myTao extends myModel
* @access protected
* @return array
*/
protected function fetchStoriesBySearch(string $myStoryQuery, string $type, string $orderBy, object $pager = null, array $storiesAssignedByMe = array()): array
protected function fetchStoriesBySearch(string $myStoryQuery, string $type, string $orderBy, ?object $pager = null, array $storiesAssignedByMe = array()): array
{
if($type == 'contribute')
{
@@ -188,7 +188,7 @@ class myTao extends myModel
* @access protected
* @return array
*/
protected function fetchEpicsBySearch(string $myEpicQuery, string $type, string $orderBy, object $pager = null, array $epicIDList = array()): array
protected function fetchEpicsBySearch(string $myEpicQuery, string $type, string $orderBy, ?object $pager = null, array $epicIDList = array()): array
{
if($type == 'contribute')
{
@@ -245,7 +245,7 @@ class myTao extends myModel
* @access protected
* @return array
*/
protected function fetchRequirementsBySearch(string $myRequirementQuery, string $type, string $orderBy, object $pager = null, array $requirementIDList = array()): array
protected function fetchRequirementsBySearch(string $myRequirementQuery, string $type, string $orderBy, ?object $pager = null, array $requirementIDList = array()): array
{
if($type == 'contribute')
{
+5 -5
View File
@@ -651,7 +651,7 @@ class productModel extends model
* @access public
* @return array
*/
public function getStories(int|array $productID, string $branch, string $browseType, int $queryID, int $moduleID, string $type = 'story', string $sort = 'id_desc', object|null$pager = null): array
public function getStories(int|array $productID, string $branch, string $browseType, int $queryID, int $moduleID, string $type = 'story', string $sort = 'id_desc', ?object $pager = null): array
{
if(commonModel::isTutorialMode()) return $this->loadModel('tutorial')->getStories();
@@ -909,7 +909,7 @@ class productModel extends model
* @access public
* @return array
*/
public function getProjectListByProduct(int $productID, string $browseType = 'all', string $branch = '0', bool $involved = false, string $orderBy = 'order_desc', object|null $pager = null): array
public function getProjectListByProduct(int $productID, string $browseType = 'all', string $branch = '0', bool $involved = false, string $orderBy = 'order_desc', ?object $pager = null): array
{
$branch = $branch ? $branch : '0';
if(!$involved) $projectList = $this->productTao->fetchAllProductProjects($productID, $browseType, $branch, $orderBy, $pager);
@@ -939,7 +939,7 @@ class productModel extends model
* @access public
* @return int[]
*/
public function getProjectStatsByProduct(int $productID, string $browseType = 'all', string $branch = '0', bool $involved = false, string $orderBy = 'order_desc', object|null $pager = null): array
public function getProjectStatsByProduct(int $productID, string $browseType = 'all', string $branch = '0', bool $involved = false, string $orderBy = 'order_desc', ?object $pager = null): array
{
$projects = $this->getProjectListByProduct($productID, $browseType, $branch, $involved, $orderBy, $pager);
if(empty($projects)) return array();
@@ -1103,7 +1103,7 @@ class productModel extends model
* @access public
* @return array
*/
public function getStats(array $productIdList, string $orderBy = 'order_asc', object|null $pager = null, string $storyType = 'story', int $programID = 0): array
public function getStats(array $productIdList, string $orderBy = 'order_asc', ?object $pager = null, string $storyType = 'story', int $programID = 0): array
{
/* Call the getProductStats method of the tutorial module if you are in tutorial mode.*/
if(commonModel::isTutorialMode()) return $this->loadModel('tutorial')->getProductStats();
@@ -1673,7 +1673,7 @@ class productModel extends model
* @access public
* @return array
*/
public function getStatsProducts(array $productIdList, bool $appendProgram, string $orderBy, object|null $pager = null): array
public function getStatsProducts(array $productIdList, bool $appendProgram, string $orderBy, ?object $pager = null): array
{
if($orderBy == 'program_asc')
{
+2 -2
View File
@@ -336,7 +336,7 @@ class projectModel extends model
* @access public
* @return array
*/
public function getList(string $status = 'undone', string $orderBy = 'order_desc', bool $involved = false, object|null $pager = null): array
public function getList(string $status = 'undone', string $orderBy = 'order_desc', bool $involved = false, ?object $pager = null): array
{
/* Get project list by status. */
$projects = $this->projectTao->fetchProjectList($status, $orderBy, $involved, $pager);
@@ -1463,7 +1463,7 @@ class projectModel extends model
* @access public
* @return array|false
*/
public function update(object $project, object $oldProject, object $postProductData = null): array|false
public function update(object $project, object $oldProject, ?object $postProductData = null): array|false
{
/* 通过主键查老项目信息, 处理父节点和图片字段。*/
/* Fetch old project's info and dispose parent and file info. */
+3 -3
View File
@@ -464,7 +464,7 @@ class userModel extends model
* @access public
* @return array
*/
public function getByQuery(string $browseType = 'inside', string $query = '', object $pager = null, string $orderBy = 'id'): array
public function getByQuery(string $browseType = 'inside', string $query = '', ?object $pager = null, string $orderBy = 'id'): array
{
return $this->dao->select('*')->from(TABLE_USER)
->where('deleted')->eq('0')
@@ -1296,7 +1296,7 @@ class userModel extends model
* @access public
* @return array
*/
public function getProjects(string $account, string $status = 'all', string $orderBy = 'id_desc', object $pager = null): array
public function getProjects(string $account, string $status = 'all', string $orderBy = 'id_desc', ?object $pager = null): array
{
$this->loadModel('project');
$projects = $this->userTao->fetchProjects($account, $status, $orderBy, $pager);
@@ -1336,7 +1336,7 @@ class userModel extends model
* @access public
* @return array
*/
public function getExecutions(string $account, string $status = 'all', string $orderBy = 'id_desc', object $pager = null): array
public function getExecutions(string $account, string $status = 'all', string $orderBy = 'id_desc', ?object $pager = null): array
{
$executions = $this->userTao->fetchExecutions($account, $status, $orderBy, $pager);
if(!$executions) return array();
+2 -2
View File
@@ -22,7 +22,7 @@ class userTao extends userModel
* @access public
* @return array
*/
public function fetchProjects(string $account, string $status = 'all', string $orderBy = 'id_desc', object $pager = null): array
public function fetchProjects(string $account, string $status = 'all', string $orderBy = 'id_desc', ?object $pager = null): array
{
return $this->dao->select('t1.role, t1.join, t1.days, t1.hours, t2.*')->from(TABLE_TEAM)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.root = t2.id')
@@ -97,7 +97,7 @@ class userTao extends userModel
* @access public
* @return array
*/
public function fetchExecutions(string $account, string $status = 'all', string $orderBy = 'id_desc', object $pager = null): array
public function fetchExecutions(string $account, string $status = 'all', string $orderBy = 'id_desc', ?object $pager = null): array
{
return $this->dao->select('t1.role, t1.join, t1.days, t1.hours, t2.*')->from(TABLE_TEAM)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.root = t2.id')