public function index(Request $request, Response $response, array $args)
 {
     $this->setPageTitle('Membership', 'Keanggotaan');
     $regionals = $this->data(Regionals::class);
     $provinceId = $request->getQueryParam('province_id');
     return $this->view->render('home-index', ['members' => $this->data(Users::class)->getMembers($request), 'provinces' => array_pairs($regionals->getProvinces(), 'id', 'regional_name'), 'cities' => array_pairs($regionals->getCities($provinceId), 'id', 'regional_name')]);
 }
Example #2
0
 public function listContent(Request $request, Response $response, $arguments)
 {
     $content = Content::where('content_type', $arguments['contentTypeSlug'])->orderBy('updated_at', true)->get();
     $contentTypeDefinition = $this->container->ContentService->getContentTypeDefinition($arguments['contentTypeSlug']);
     if ($request->getQueryParam('show-unpublished') !== 'true') {
         $content = $content->filter(function ($value) {
             return $value->is_published === true;
         })->values();
     }
     $content = $content->map(function ($item) use($request, $contentTypeDefinition) {
         return $this->container->ContentService->convertFields($item, $contentTypeDefinition, $request);
     });
     return $response->withJson($content, 200, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
 }
Example #3
0
 /**
  * Handle the [GET] list view
  * @param Request $request
  * @param Response $response
  * @return Response
  */
 protected function handleReadList(Request $request, Response $response)
 {
     $model = new ProductsListModel();
     $service = $this->service;
     $filterTag = $request->getQueryParam('tag', null);
     $model->setProducts($service->readList($filterTag, 'creationDate', true));
     $model->setFilterTag($filterTag);
     return TwigUtil::render($this->container, $response, 'product/list.twig', $model->jsonSerialize());
 }
 /**
  * Get Total Member
  *
  * @param \Slim\Http\Request $request Filter by request
  * @return integer
  */
 public function getTotalMember($request)
 {
     $query = $this->db->select(['u.user_id'])->from('users u')->leftJoin('members_profiles m', 'u.user_id', '=', 'm.user_id')->leftJoin('users_roles ur', 'u.user_id', '=', 'ur.user_id')->leftJoin('regionals reg_prv', 'reg_prv.id', '=', 'm.province_id')->leftJoin('regionals reg_cit', 'reg_cit.id', '=', 'm.city_id')->where('ur.role_id', '=', 'member')->where('u.activated', '=', 'Y');
     if ($request->getQueryParam('province_id')) {
         $query->where('m.province_id', '=', (int) $request->getQueryParam('province_id'));
     }
     if ($request->getQueryParam('city_id')) {
         $query->where('m.city_id', '=', (int) $request->getQueryParam('city_id'));
     }
     if ($request->getQueryParam('area')) {
         $query->whereLike('m.area', $request->getQueryParam('area'));
     }
     return $query->execute()->rowCount();
 }
 /**
  * List all members
  *
  * @param \Slim\Http\Request $request Filter by request
  * @return array
  */
 public function getMembers($request)
 {
     $query = $this->db->select(['u.user_id', 'u.username', 'u.email', 'u.created', 'ur.role_id', 'm.fullname', 'm.gender', 'm.photo', 'reg_prv.regional_name province', 'reg_cit.regional_name city'])->from('users u')->leftJoin('members_profiles m', 'u.user_id', '=', 'm.user_id')->leftJoin('users_roles ur', 'u.user_id', '=', 'ur.user_id')->leftJoin('regionals reg_prv', 'reg_prv.id', '=', 'm.province_id')->leftJoin('regionals reg_cit', 'reg_cit.id', '=', 'm.city_id')->where('ur.role_id', '=', 'member')->where('u.activated', '=', 'Y');
     if ($request->getQueryParam('province_id')) {
         $query->where('m.province_id', '=', (int) $request->getQueryParam('province_id'));
     }
     if ($request->getQueryParam('city_id')) {
         $query->where('m.city_id', '=', (int) $request->getQueryParam('city_id'));
     }
     if ($request->getQueryParam('area')) {
         $query->whereLike('m.area', $request->getQueryParam('area'));
     }
     $query->orderBy('u.created', 'DESC')->limit(18, $request->getQueryParam('page'));
     return $query->execute()->fetchAll();
 }