Merge branch 'master' of https://gitlab.zcorp.cc/easycorp/zentaopms into cyy_fixbug
This commit is contained in:
+3
-22
@@ -540,10 +540,10 @@ class doc extends control
|
||||
if(!empty($changes))
|
||||
{
|
||||
$newType = $_POST['status'];
|
||||
if($doc->status == 'draft' and $newType == 'draft') $action = 'savedDraft';
|
||||
if($doc->status == 'draft' and $newType == 'normal') $action = 'releasedDoc';
|
||||
if($doc->status == 'normal' and $newType == 'normal') $action = 'Edited';
|
||||
if($doc->status == $newType) $action = 'Edited';
|
||||
}
|
||||
|
||||
$fileAction = '';
|
||||
if(!empty($files)) $fileAction = $this->lang->addFiles . join(',', $files) . "\n";
|
||||
$actionID = $this->action->create('doc', $docID, $action, $fileAction . $this->post->comment);
|
||||
@@ -1221,26 +1221,7 @@ class doc extends control
|
||||
}
|
||||
}
|
||||
|
||||
$doc = $docID ? $doc : '';
|
||||
|
||||
/* Crumbs links array. */
|
||||
$moduleName = 'doc';
|
||||
$methodName = in_array($type, array('product', 'project')) ? $objectType . 'Space' : 'teamSpace';
|
||||
$linkParams = "objectID={$objectID}&libID={$lib->id}";
|
||||
if($this->app->tab == 'execution')
|
||||
{
|
||||
$moduleName = 'execution';
|
||||
$methodName = 'doc';
|
||||
$linkParams = "executionID=$objectID";
|
||||
}
|
||||
elseif($type == 'mine')
|
||||
{
|
||||
$linkParams = "type=mine&libID={$lib->id}";
|
||||
$methodName = 'mySpace';
|
||||
}
|
||||
|
||||
$spaceType = $objectType . 'Space';
|
||||
$this->view->title = isset($this->lang->doc->{$spaceType}) ? $this->lang->doc->{$spaceType} : $this->lang->doc->common;
|
||||
$this->view->title = $this->lang->doc->common . $this->lang->colon . $doc->title;
|
||||
$this->view->docID = $docID;
|
||||
$this->view->doc = $doc;
|
||||
$this->view->version = $version;
|
||||
|
||||
+19
-12
@@ -735,7 +735,7 @@ class docModel extends model
|
||||
{
|
||||
$modules = $module && $mode == 'children' ? $this->loadModel('tree')->getAllChildID($module) : $module;
|
||||
$stmt = $this->dao->select('*')->from(TABLE_DOC)
|
||||
->where('1=1')
|
||||
->where('vision')->eq($this->config->vision)
|
||||
->beginIF(!empty($modules))->andWhere('module')->in($modules)->fi()
|
||||
->beginIF($mode == 'normal')->andWhere('deleted')->eq(0)->fi()
|
||||
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
|
||||
@@ -2161,19 +2161,26 @@ class docModel extends model
|
||||
*/
|
||||
public function getStatisticInfo()
|
||||
{
|
||||
$allLibs = array_keys($this->getLibs('all'));
|
||||
$docIdList = $this->getPrivDocs($allLibs);
|
||||
$myDocList = $this->dao->select('id')->from(TABLE_DOC)->where('addedBy')->eq($this->app->user->account)->fetchPairs('id');
|
||||
|
||||
$today = date('Y-m-d');
|
||||
$statistic = $this->dao->select("count(id) as totalDocs, count(IF(editedDate like '{$today}%', 1, null)) as todayEditedDocs,
|
||||
count(IF(editedBy = '{$this->app->user->account}', 1, null)) as myEditedDocs, count(IF(addedBy = '{$this->app->user->account}', 1, null)) as myDocs")->from(TABLE_DOC)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('vision')->eq($this->config->vision)
|
||||
->andWhere('id')->in($docIdList)
|
||||
->fetch();
|
||||
$statistic = new stdclass();
|
||||
$statistic->totalDocs = $this->dao->select('count(*) as count')->from(TABLE_DOC)->where('deleted')->eq('0')->fetch('count');
|
||||
$statistic->todayEditedDocs = $this->dao->select('count(DISTINCT objectID) as count')->from(TABLE_ACTION)
|
||||
->where('objectType')->eq('doc')
|
||||
->andWhere('action')->eq('edited')
|
||||
->andWhere('actor')->eq($this->app->user->account)
|
||||
->andWhere('LEFT(date, 10)')->eq($today)
|
||||
->fetch('count');
|
||||
$statistic->myEditedDocs = $this->dao->select('count(DISTINCT objectID) as count')->from(TABLE_ACTION)
|
||||
->where('objectType')->eq('doc')
|
||||
->andWhere('action')->eq('edited')
|
||||
->andWhere('actor')->eq($this->app->user->account)
|
||||
->fetch('count');
|
||||
|
||||
$statistic->myDoc = $this->dao->select("count(IF(`action` = 'view', 1, null)) as docViews, count(IF(`action` = 'collect', 1, null)) as docCollects")->from(TABLE_DOCACTION)->where('doc')->in($myDocList)->fetch();
|
||||
$my = $this->dao->select("count(*) as myDocs, SUM(views) as docViews, SUM(collects) as docCollects")->from(TABLE_DOC)->where('addedBy')->eq($this->app->user->account)->andWhere('deleted')->eq(0)->fetch();
|
||||
$statistic->myDocs = $my->myDocs;
|
||||
$statistic->myDoc = new stdclass();
|
||||
$statistic->myDoc->docViews = $my->docViews;
|
||||
$statistic->myDoc->docCollects = $my->docCollects;
|
||||
|
||||
return $statistic;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user