Selaa lähdekoodia

get mailinglists

andre 2 vuotta sitten
vanhempi
commit
bb65321d9d
1 muutettua tiedostoa jossa 24 lisäystä ja 14 poistoa
  1. 24 14
      app/UI/Client/DistributionList/Pages/Lists.php

+ 24 - 14
app/UI/Client/DistributionList/Pages/Lists.php

@@ -37,10 +37,10 @@ class Lists extends DataTable implements ClientArea
             ->addColumn((new Column('email'))
                 ->setOrderable(DataProvider::SORT_ASC)
                 ->setSearchable(true, Column::TYPE_STRING))
-            ->addColumn((new Column('name'))
+            ->addColumn((new Column('description'))
                 ->setOrderable()
                 ->setSearchable(true))
-            ->addColumn((new Column('description'))
+            ->addColumn((new Column('count'))
                 ->setOrderable()
                 ->setSearchable(true));
     }
@@ -96,29 +96,39 @@ class Lists extends DataTable implements ClientArea
             );
             return ['error' => $error->getMessage()];
         }
-        $api->logout();
-
-        logModuleCall(
-            'kerioEmail',
-            __FUNCTION__,
-            $lists,
-            'Debug Error',
-            $this->maildomain
-        );
 
+        $listQuery = araay('id','name');
         $data = [];
         foreach($lists as $list)
         {
             /* @var $list  DistributionList */
-
-            $tmp = [
+            try {
+                $listCount = $api->getMlUserList($listQuery, $list['id']);
+            } catch (KerioApiException $error) {
+                logModuleCall(
+                    'kerioEmail',
+                    __FUNCTION__,
+                    $error,
+                    'Debug Error',
+                    $error->getMessage()
+                );
+            };
+            logModuleCall(
+                'kerioEmail',
+                __FUNCTION__,
+                $list,
+                'Debug Error',
+                $listCount
+            );
+                $tmp = [
                 'id' => $list['id'],
                 'email' => $list['name'] . '@' . $this->maildomain,
                 'description' => $list['description']
             ];
 
            $data[] = $tmp;
-       }
+        }
+        $api->logout();
 
         $dataProv = new ArrayDataProvider();
         $dataProv->setDefaultSorting('id', 'ASC')->setData($data);