* [perf story #75384] Adjust product dynamic page.
This commit is contained in:
@@ -517,8 +517,8 @@ class product extends control
|
||||
}
|
||||
|
||||
/* Get actions. */
|
||||
list($actions, $dateGroups) = $this->productZen->getActionsForDynamic($account, $orderBy, $productID, $type, $recTotal, $date, $direction);
|
||||
if(empty($recTotal)) $recTotal = count($dateGroups) < 2 ? count($dateGroups, 1) - count($dateGroups) : $this->action->getDynamicCount();
|
||||
list($actions, $dateGroups) = $this->productZen->getActionsForDynamic($account, $orderBy, $productID, $type, $date, $direction);
|
||||
if(empty($recTotal) && $dateGroups) $recTotal = $this->action->getDynamicCount();
|
||||
|
||||
/* Assign. */
|
||||
$this->view->title = $this->products[$productID] . $this->lang->hyphen . $this->lang->product->dynamic;
|
||||
|
||||
@@ -17,6 +17,7 @@ featureBar
|
||||
(
|
||||
set::current($type),
|
||||
set::linkParams("productID={$productID}&type={key}"),
|
||||
set::labelCount($recTotal < \actionModel::MAXCOUNT ? $recTotal : (\actionModel::MAXCOUNT - 1) . '+'),
|
||||
li
|
||||
(
|
||||
setClass('w-40'),
|
||||
@@ -53,10 +54,9 @@ $firstAction = null;
|
||||
$lastAction = null;
|
||||
foreach($dateGroups as $date => $actions)
|
||||
{
|
||||
$isToday = date(DT_DATE4) == $date;
|
||||
|
||||
$lastAction = end($actions);
|
||||
$isToday = date(DT_DATE4) == $date;
|
||||
if(empty($firstAction)) $firstAction = reset($actions);
|
||||
|
||||
$dynamicsGroup[] = li
|
||||
(
|
||||
div
|
||||
@@ -84,15 +84,26 @@ foreach($dateGroups as $date => $actions)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$lastAction = end($actions);
|
||||
}
|
||||
|
||||
$content = ul
|
||||
(
|
||||
setClass('timeline list-none pl-0'),
|
||||
$dynamicsGroup
|
||||
);
|
||||
global $app;
|
||||
$hasMore = $app->control->loadModel('action')->hasMoreAction($lastAction);
|
||||
if($hasMore)
|
||||
{
|
||||
$dynamicsGroup[] = li
|
||||
(
|
||||
a
|
||||
(
|
||||
setID('showMoreDynamic'),
|
||||
setClass('block text-center'),
|
||||
setData(array('lastid' => $lastAction->id)),
|
||||
set::href('###'),
|
||||
on::click('showMore'),
|
||||
icon('chevron-double-down')
|
||||
)
|
||||
);
|
||||
}
|
||||
$content = ul(setClass('timeline list-none pl-0'), $dynamicsGroup);
|
||||
|
||||
panel($content);
|
||||
|
||||
|
||||
@@ -1322,18 +1322,17 @@ class productZen extends product
|
||||
* @param string $orderBy
|
||||
* @param int $productID
|
||||
* @param string $type
|
||||
* @param int $recTotal
|
||||
* @param string $date
|
||||
* @param string $direction next|pre
|
||||
* @access protected
|
||||
* @return [array, object]
|
||||
*/
|
||||
protected function getActionsForDynamic(string $account, string $orderBy, int $productID, string $type, int $recTotal, string $date, string $direction): array
|
||||
protected function getActionsForDynamic(string $account, string $orderBy, int $productID, string $type, string $date, string $direction): array
|
||||
{
|
||||
/* Build parameters. */
|
||||
$period = $type == 'account' ? 'all' : $type;
|
||||
$date = empty($date) ? '' : date('Y-m-d', (int)$date);
|
||||
$actions = $this->loadModel('action')->getDynamic($account, $period, $orderBy, 50, $productID, 'all', 'all', $date, $direction);
|
||||
$actions = $this->loadModel('action')->getDynamicByProduct($productID, $account, $period, $orderBy, 50, $date, $direction);
|
||||
$dateGroups = $this->action->buildDateGroup($actions, $direction);
|
||||
|
||||
return array($actions, $dateGroups);
|
||||
|
||||
Reference in New Issue
Block a user