public function findLastAdverts($limit=15, Krugozor_Module_User_Model_User $current_user)
{
$sql = 'SELECT *,
IF (`advert`.`advert_vip_date` IS NOT NULL AND `advert`.`advert_vip_date` > NOW(), 1, 0) AS `advert__is_vip`,
`advert`.`id`, `advert`.`advert_vip_date`,
`advert`.`advert_id_user`,
`advert`.`advert_unique_user_cookie_id`,
`advert`.`advert_type`,
`advert`.`advert_category`,
`advert`.`advert_header`,
`advert`.`advert_price`,
`advert`.`advert_price_type`,
`advert`.`advert_free`,
`advert`.`advert_create_date`,
`advert`.`advert_text`,
`advert`.`advert_thumbnail_file_name`,
`advert`.`advert_thumbnail_count`,
`category`.`id`,
`category`.`category_name`,
`category`.`category_url`,
`user-country`.`id`,
`user-country`.`country_name_ru`,
`user-country`.`country_name_en`,
`user-region`.`id`,
`user-region`.`id_country`,
`user-region`.`region_name_ru`,
`user-region`.`region_name_en`,
`user-city`.`id`,
`user-city`.`id_region`,
`user-city`.`id_country`,
`user-city`.`city_name_ru`,
`user-city`.`city_name_en`
FROM `advert` USE INDEX(adverts_listing)
INNER JOIN `category` ON `advert`.`advert_category` = `category`.`id`
INNER JOIN `user-country` ON `advert`.`advert_place_country` = `user-country`.`id`
INNER JOIN `user-region` ON `advert`.`advert_place_region` = `user-region`.`id`
INNER JOIN `user-city` ON `advert`.`advert_place_city` = `user-city`.`id`
INNER JOIN `user` ON `user`.`id` = `advert`.`advert_id_user`
WHERE
(`advert`.advert_thumbnail_count > 0 OR `advert`.`advert_vip_date` IS NOT NULL) AND
`category`.category_show_on_index = 1
' . self::SQL_COMMON_SELECT_LIST_CONDITION . '
ORDER BY `advert`.`id` DESC
LIMIT 0, ?i';
return parent::result2objects(call_user_func_array(array($this->getDb(), 'query'), array($sql, $current_user->getId(), $current_user->getUniqueCookieId(), $limit)));
}
SearchCtrl = (function() {
SearchCtrl.$inject = ['$scope', '$location', '$routeParams', 'SearchService'];
function SearchCtrl(scope, location, routeParams, SearchService) {
this.scope = scope;
this.location = location;
this.routeParams = routeParams;
this.SearchService = SearchService;
this.scope.search_string = this.routeParams.query;
this.scope.search = this.search;
this.loadingSearch();
}
SearchCtrl.prototype.loadingSearch = function() {
var _this = this;
this.scope.loadingPromise = this.SearchService.getList({
q: this.scope.search_string
});
return this.scope.loadingPromise.then(function(data) {
return _this.scope.elements = data;
});
};
SearchCtrl.prototype.search = function() {
debugger;
return this.location.url('/search?query=');
};
return SearchCtrl;
'use strict'
class SearchCtrl
@$inject: [ '$scope', '$location', '$routeParams', 'SearchService' ]
constructor: (@scope, @location, @routeParams, @SearchService) ->
@scope.search_string = @routeParams.query
@scope.search = @search
this.loadingSearch()
loadingSearch: ->
@scope.loadingPromise = @SearchService.getList {q: @scope.search_string}
@scope.loadingPromise.then (data) =>
@scope.elements = data
search: ->
debugger
@location.url '/search?query='
angular.module('SearchModule').controller 'SearchCtrl', SearchCtrl
<form class="form-inline" role="form" ng-submit="search()" ng-controller="SearchCtrl">
<div class="input-group">
<input
type="text"
class="form-control"
ng-model="search_string"
placeholder="<?= $lang->search_place ?>"
value="<?=$this->container->request->query('query')?>"
/>
<span class="input-group-btn">
<button class="btn btn-info" type="submit"><?= $lang->search ?></button>
</span>
</div>
</form>
как по мне, так от фрейма надо только Маршрутизацию,ПсевдоMVC (настоящего в вебе нет), обёрточку к БД, логирование/кеширование ...
Всё это в фреймворке есть! (Ура) . А то что он не устраивает диктатуру и не "учит" меня писать так, как видят процесс написания его разработчики .... и слава богу, не считаю это минусом