* Finished product story block with zui3.

This commit is contained in:
孔令茂
2023-05-10 13:57:43 +08:00
parent 033b502cce
commit be6062bffc
3 changed files with 53 additions and 8 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
$app->loadLang('story');
if(!isset($config->block->dtable->stories)) $config->block->dtable->stories = new stdclass();
$config->block->dtable->stories->fieldList['id']['name'] = 'id';
$config->block->dtable->stories->fieldList['id']['title'] = $this->lang->story->id;
$config->block->dtable->stories->fieldList['id']['width'] = 80;
$config->block->dtable->stories->fieldList['id']['align'] = 'center';
$config->block->dtable->stories->fieldList['id']['sortType'] = true;
$config->block->dtable->stories->fieldList['title']['name'] = 'title';
$config->block->dtable->stories->fieldList['title']['title'] = $this->lang->story->title;
$config->block->dtable->stories->fieldList['title']['width'] = 80;
$config->block->dtable->stories->fieldList['title']['align'] = 'center';
$config->block->dtable->stories->fieldList['title']['sortType'] = true;
$config->block->dtable->stories->fieldList['pri']['name'] = 'pri';
$config->block->dtable->stories->fieldList['pri']['title'] = $this->lang->story->pri;
$config->block->dtable->stories->fieldList['pri']['width'] = 80;
$config->block->dtable->stories->fieldList['pri']['align'] = 'center';
$config->block->dtable->stories->fieldList['pri']['sortType'] = true;
$config->block->dtable->stories->fieldList['status']['name'] = 'status';
$config->block->dtable->stories->fieldList['status']['title'] = $this->lang->story->statusAB;
$config->block->dtable->stories->fieldList['status']['width'] = 80;
$config->block->dtable->stories->fieldList['status']['align'] = 'center';
$config->block->dtable->stories->fieldList['status']['sortType'] = true;
$config->block->dtable->stories->fieldList['estimate']['name'] = 'estimate';
$config->block->dtable->stories->fieldList['estimate']['title'] = $this->lang->story->estimateAB;
$config->block->dtable->stories->fieldList['estimate']['width'] = 80;
$config->block->dtable->stories->fieldList['estimate']['align'] = 'center';
$config->block->dtable->stories->fieldList['estimate']['sortType'] = true;
$config->block->dtable->stories->fieldList['stage']['name'] = 'stage';
$config->block->dtable->stories->fieldList['stage']['title'] = $this->lang->story->stageAB;
$config->block->dtable->stories->fieldList['stage']['width'] = 80;
$config->block->dtable->stories->fieldList['stage']['align'] = 'center';
$config->block->dtable->stories->fieldList['stage']['sortType'] = true;
+8 -2
View File
@@ -11,14 +11,20 @@ declare(strict_types=1);
namespace zin;
foreach($stories as $story)
{
$story->status = zget($this->lang->story->statusList, $story->status);
$story->stage = zget($this->lang->story->stageList, $story->stage);
}
panel
(
dtable
(
set::width('100%'),
set::height('auto'),
set::cols(array_values($config->block->dtable->project->fieldList)),
set::data(array_values($projects))
set::cols(array_values($config->block->dtable->stories->fieldList)),
set::data(array_values($stories))
)
);
+7 -6
View File
@@ -521,19 +521,20 @@ class blockZen extends block
/**
* Print story block.
*
* @params object $block
* @access protected
* @return void
*/
protected function printStoryBlock()
protected function printStoryBlock($block) :void
{
$this->session->set('storyList', $this->createLink('my', 'index'), 'product');
if(preg_match('/[^a-zA-Z0-9_]/', $this->params->type)) return;
if(preg_match('/[^a-zA-Z0-9_]/', $block->params->type)) return;
$this->app->loadClass('pager', true);
$count = isset($this->params->count) ? (int)$this->params->count : 0;
$count = isset($block->params->count) ? (int)$block->params->count : 0;
$pager = pager::init(0, $count , 1);
$type = isset($this->params->type) ? $this->params->type : 'assignedTo';
$orderBy = isset($this->params->type) ? $this->params->orderBy : 'id_asc';
$type = isset($block->params->type) ? $block->params->type : 'assignedTo';
$orderBy = isset($block->params->type) ? $block->params->orderBy : 'id_asc';
$this->view->stories = $this->loadModel('story')->getUserStories($this->app->user->account, $type, $orderBy, $this->viewType != 'json' ? $pager : '', 'story');
}
@@ -753,7 +754,7 @@ class blockZen extends block
$progress = 0;
if(isset($tasks[$projectID]) && ($tasks[$projectID]->totalConsumed + $tasks[$projectID]->totalLeft))
{
$progress = round($tasks[$projectID]->totalConsumed / ($tasks[$projectID]->totalConsumed + $tasks[$projectID]->totalLeft), 3) * 100;
$progress = round($tasks[$projectID]->totalConsumed / ($tasks[$projectID]->totalConsumed + $tasks[$projectID]->totalLeft), 3) * 100;
}
$project->current = $current;