3131use APP \submission \Submission ;
3232use APP \template \TemplateManager ;
3333use Exception ;
34- use Illuminate \View \View ;
3534use Illuminate \Contracts \Pagination \LengthAwarePaginator ;
35+ use Illuminate \Database \Eloquent \Builder as EloquentBuilder ;
3636use Illuminate \Support \Str ;
37+ use Illuminate \View \View ;
3738use Less_Parser ;
3839use PKP \config \Config ;
3940use PKP \context \Context ;
@@ -1353,8 +1354,8 @@ public function fetch($template = null, $cache_id = null, $compile_id = null, $p
13531354
13541355 // If a blade view instance given or the template is a blade view
13551356 // just return the rendered content
1356- if ($ template instanceof View
1357- || (!str_contains ($ template , " .tpl " ) && view ()->exists ($ template ))
1357+ if ($ template instanceof View
1358+ || (!str_contains ($ template , ' .tpl ' ) && view ()->exists ($ template ))
13581359 ) {
13591360 $ this ->shareTemplateVariables ($ this ->getTemplateVars ());
13601361
@@ -1524,16 +1525,8 @@ public function display($template = null, $cache_id = null, $compile_id = null,
15241525 if ($ user ) {
15251526 // Fetch user groups where the user is assigned
15261527 $ userGroups = UserGroup::query ()
1527- ->whereHas ('userUserGroups ' , function ($ query ) use ($ user ) {
1528- $ query ->where ('user_id ' , $ user ->getId ())
1529- ->where (function ($ q ) {
1530- $ q ->whereNull ('date_end ' )
1531- ->orWhere ('date_end ' , '> ' , now ());
1532- })
1533- ->where (function ($ q ) {
1534- $ q ->whereNull ('date_start ' )
1535- ->orWhere ('date_start ' , '<= ' , now ());
1536- });
1528+ ->whereHas ('userUserGroups ' , function (EloquentBuilder $ query ) use ($ user ) {
1529+ $ query ->withUserId ($ user ->getId ())->withActive ();
15371530 })
15381531 ->get ();
15391532
@@ -1614,8 +1607,8 @@ public function display($template = null, $cache_id = null, $compile_id = null,
16141607
16151608 // If a blade view instance given or the template is a blade view
16161609 // just return the rendered content
1617- if ($ template instanceof View
1618- || (!str_contains ($ template , " .tpl " ) && view ()->exists ($ template ))
1610+ if ($ template instanceof View
1611+ || (!str_contains ($ template , ' .tpl ' ) && view ()->exists ($ template ))
16191612 ) {
16201613 $ this ->shareTemplateVariables ($ this ->getTemplateVars ());
16211614
@@ -1624,7 +1617,7 @@ public function display($template = null, $cache_id = null, $compile_id = null,
16241617 : view ($ template )->render ();
16251618 return ;
16261619 }
1627-
1620+
16281621 // Actually display the template.
16291622 parent ::display ($ template , $ cache_id , $ compile_id , $ parent );
16301623 }
@@ -1930,6 +1923,8 @@ public function flush()
19301923
19311924 /**
19321925 * Call hooks from a template. (DEPRECATED: For new hooks, {run_hook} is preferred.
1926+ *
1927+ * @param null|mixed $smarty
19331928 */
19341929 public function smartyCallHook ($ params , $ smarty = null )
19351930 {
0 commit comments