Merge pull request #575 from openclassify/dia

#1447 [arabam-theme] 3 pages improvments
This commit is contained in:
Fatih Alp 2020-05-21 17:37:09 +03:00 committed by GitHub
commit 97d4c7efbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -19,6 +19,11 @@ class AdvCriteria extends EntryCriteria
$this->image = $image; $this->image = $image;
} }
public function getAdvsModel()
{
return new AdvModel();
}
public function popularAdvs() public function popularAdvs()
{ {
$advModel = new AdvModel(); $advModel = new AdvModel();
@ -72,14 +77,14 @@ class AdvCriteria extends EntryCriteria
return $ads; return $ads;
} }
public function findAdsByCategoryId($catId) public function findAdsByCategoryId($catId, $level = 1)
{ {
$advModel = new AdvModel(); $advModel = new AdvModel();
$advs = AdvModel::query() $advs = AdvModel::query()
->whereDate('finish_at', '>=', date("Y-m-d H:i:s")) ->whereDate('finish_at', '>=', date("Y-m-d H:i:s"))
->where('status', '=', 'approved') ->where('status', '=', 'approved')
->where('slug', '!=', '') ->where('slug', '!=', '')
->where('cat1', $catId) ->where('cat' . $level, $catId)
->get(); ->get();
$ads = $advModel->getLocationNames($advs); $ads = $advModel->getLocationNames($advs);

View File

@ -40,6 +40,12 @@ class CatsModulePlugin extends Plugin
$category_model = new CategoryModel(); $category_model = new CategoryModel();
return $category_model->getParentCats($id,'add_main'); return $category_model->getParentCats($id,'add_main');
} }
), new \Twig_SimpleFunction(
'getParentsCount',
function ($id) {
$category_model = new CategoryModel();
return $category_model->getParentsCount($id);
}
) )
]; ];
} }