<?php
/******************************************************************************/
//                                                                            //
//                             Smarty plugin                                  //
//                            @package Smarty                                 //
//							 @subpackage plugins                              //
//                        https://life-style.uz/                              //
//                   produced by Life Style, life-style.uz                    //
//                                                                            //
/******************************************************************************/

function smarty_function_fetch_countries($params, &$smarty) {
	
	$assign   = fetch_getParam('assign', $params, 'countries');
	$fields   = fetch_getParam('fields', $params, 'id, name, alias, fileName, status, price, coordinates, orderBy');
	$status   = fetch_getParam('status', $params, 'V');
    $orderBy  = fetch_getParam('orderBy', $params, 'name ASC');

	/* conditions */
    $countries = connect()->table('geo_countries')->where('status', $status)->select($fields)->orderBy($orderBy)->getAll('array');

//    print_r($countries);
	$smarty->assign($assign, $countries);

}