本文整理汇总了PHP中cw_core_get_navigation函数的典型用法代码示例。如果您正苦于以下问题:PHP cw_core_get_navigation函数的具体用法?PHP cw_core_get_navigation怎么用?PHP cw_core_get_navigation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cw_core_get_navigation函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dod_show
function dod_show()
{
global $available_fields, $optional_fields, $tables, $smarty, $top_message, $target;
$generators = array();
$fields = $from_tbls = $query_joins = $where = $groupbys = $having = $orderbys = array();
$from_tbls[] = 'dod_generators';
$fields = array_keys($available_fields);
$where[] = 1;
$orderbys[] = 'position';
$orderbys[] = 'generator_id';
$search_query_count = cw_db_generate_query('count(generator_id)', $from_tbls, $query_joins, $where, $groupbys, $having, array(), 0);
$search_query = cw_db_generate_query($fields, $from_tbls, $query_joins, $where, $groupbys, $having, $orderbys);
$total_items_res_id = db_query($search_query_count);
$number_generators = db_num_rows($total_items_res_id);
if (empty($number_generators)) {
return null;
}
global $navigation, $page;
$navigation = cw_core_get_navigation($target, $number_generators, $page);
$limit_str = " LIMIT {$navigation['first_page']}, {$navigation['objects_per_page']}";
$generators = cw_query($search_query . $limit_str);
if (empty($generators)) {
return null;
}
$generators = array_map(create_function('$elm', '$elm["description"] = strip_tags($elm["description"]); return $elm;'), $generators);
$smarty->assign('dod_generators', cw_stripslashes($generators));
$navigation['script'] = 'index.php?target=' . $target;
$smarty->assign('navigation', $navigation);
}
示例2: ppd_show
function ppd_show($product_id)
{
global $available_fields, $smarty, $tables, $config, $target;
global $app_catalogs, $mode;
$product_id = (int) $product_id;
if (empty($product_id)) {
return;
}
if ($_SERVER['REQUEST_METHOD'] != 'GET') {
ppd_redirect($product_id);
}
global $page;
if (!isset($page)) {
$page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
}
$_new_files =& cw_session_register('_new_files');
if (!empty($_new_files)) {
$smarty->assign('_new_files', $_new_files);
cw_session_unregister('_new_files');
}
$limit_files = null;
$number_files = cw_query_first_cell('SELECT COUNT(file_id) FROM ' . $tables['ppd_files'] . ' WHERE product_id = \'' . $product_id . '\'');
$navigation = cw_core_get_navigation($target, $number_files, $page);
$navigation['script'] = "{$app_catalogs['admin']}/index.php?target={$target}&mode={$mode}&js_tab=ppd&product_id={$product_id}";
$smarty->assign('navigation', $navigation);
if (isset($navigation['first_page']) && isset($navigation['objects_per_page'])) {
$limit_files = " LIMIT {$navigation['first_page']}, {$navigation['objects_per_page']}";
}
unset($available_fields['type_id']);
$files = array();
if (!empty($number_files)) {
$files = cw_query('SELECT `' . implode('`, `', array_keys($available_fields)) . '`, `type`, `fileicon` FROM ' . $tables['ppd_files'] . ' AS files LEFT JOIN ' . $tables['ppd_types'] . ' AS types ON files.type_id = types.type_id WHERE product_id = \'' . $product_id . '\' ORDER BY number' . $limit_files);
}
if (empty($files) || !is_array($files)) {
return;
}
foreach ($files as $key => $file) {
$files[$key]['fileicon'] = ppd_get_url_fileicon($files[$key]['fileicon']);
$_real_path = ppd_check_path($files[$key]['filename']);
$files[$key]['is_deleted'] = empty($_real_path) ? true : false;
$files[$key]['fileicon'] = empty($files[$key]['filename']) ? null : $files[$key]['fileicon'];
$files[$key]['perms_owner'] = ppd_permissions($files[$key]['perms_owner']);
$files[$key]['perms_all'] = ppd_permissions($files[$key]['perms_all']);
$files[$key]['size'] = ppd_convertfrom_bytes($files[$key]['size']);
$files[$key]['month_stats'] = ppd_get_stats($files[$key]['file_id'], $product_id, mktime(0, 0, 0, date('m'), 1, date('Y')), mktime(23, 59, 59, date('m') + 1, 0, date('Y')));
$files[$key]['year_stats'] = ppd_get_stats($files[$key]['file_id'], $product_id, mktime(0, 0, 0, 1, 1, date('Y')), mktime(23, 59, 59, 12, 31, date('Y')));
}
$smarty->assign('ppd_files', $files);
}
示例3: ppd_filetype_show
function ppd_filetype_show()
{
global $available_fields, $smarty, $tables, $config, $target;
global $app_catalogs;
global $page;
if (!isset($page)) {
$page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
}
$page = (int) $page;
if ($_SERVER['REQUEST_METHOD'] != 'GET') {
ppd_filetype_redirect();
}
$_new_types =& cw_session_register('_new_types');
if (!empty($_new_types)) {
$smarty->assign('_new_types', $_new_types);
cw_session_unregister('_new_types');
}
$limit_types = null;
$number_types = cw_query_first_cell('SELECT COUNT(type_id) FROM ' . $tables['ppd_types']);
$navigation = cw_core_get_navigation($target, $number_types, $page);
$navigation['script'] = "{$app_catalogs['admin']}/index.php?target={$target}";
$smarty->assign('navigation', $navigation);
if (isset($navigation['first_page']) && isset($navigation['objects_per_page'])) {
$limit_types = " LIMIT {$navigation['first_page']}, {$navigation['objects_per_page']}";
}
$types = array();
if (!empty($number_types)) {
$types = cw_query('SELECT `' . implode('`, `', array_keys($available_fields)) . '` FROM ' . $tables['ppd_types'] . $limit_types);
}
if (empty($types) || !is_array($types)) {
return;
}
foreach ($types as $key => $file) {
$types[$key]['fileicon_exists'] = true;
$types[$key]['fileicon_url'] = ppd_get_url_fileicon($types[$key]['fileicon']);
if (empty($types[$key]['fileicon_url'])) {
$types[$key]['fileicon_exists'] = false;
}
}
$smarty->assign('ppd_types', $types);
}
示例4: db_query
db_query("UPDATE {$tables['map_countries']} SET active=1");
$top_message['content'] = cw_get_langvar_by_name("msg_adm_countries_enabled");
}
if ($action == 'update' && is_array($posted_data)) {
foreach ($posted_data as $k => $v) {
$to_update = array('active' => $v['active'], 'display_regions' => $v['display_regions'], 'display_states' => $v['display_states'], 'display_counties' => $v['display_counties'], 'display_cities' => $v['display_cities'], 'lang' => $v['lang']);
cw_array2update('map_countries', $to_update, "code='{$k}'");
db_query("UPDATE {$tables['languages']} SET value = '{$v['country']}' WHERE name = 'country_{$k}' AND code = '{$current_language}'");
}
$top_message['content'] = cw_get_langvar_by_name("msg_adm_countries_upd");
cw_header_location("index.php?target=countries&zone={$zone}&page={$page}");
}
if ($action) {
cw_header_location("index.php?target=countries&zone={$zone}&page={$page}");
}
$condition = "";
if (!empty($zone)) {
if ($zone == "SU") {
$condition = " WHERE {$tables['map_countries']}.code IN ('AM','AZ','BY','EE','GE','KZ','KG','LV','LT','MD','RU','TJ','TM','UA','UZ')";
} else {
$condition = " WHERE {$tables['map_countries']}.region='{$zone}'";
}
}
$total_items_in_search = cw_query_first_cell("SELECT COUNT(*) FROM {$tables['map_countries']} {$condition}");
$navigation = cw_core_get_navigation($target, $total_items_in_search, $page);
$navigation['script'] = "index.php?target=countries&zone=" . (empty($zone) ? "ALL" : $zone);
$smarty->assign('navigation', $navigation);
$countries = cw_query("SELECT {$tables['map_countries']}.*, IFNULL(lng1c.value, lng2c.value) as country, IFNULL(lng1l.value, lng2l.value) as language FROM {$tables['map_countries']} LEFT JOIN {$tables['languages']} as lng1c ON lng1c.name = CONCAT('country_', {$tables['map_countries']}.code) AND lng1c.code = '{$current_language}' LEFT JOIN {$tables['languages']} as lng2c ON lng2c.name = CONCAT('country_', {$tables['map_countries']}.code) AND lng2c.code = '{$config['default_admin_language']}' LEFT JOIN {$tables['languages']} as lng1l ON lng1l.name = CONCAT('language_', {$tables['map_countries']}.code) AND lng1l.code = '{$current_language}' LEFT JOIN {$tables['languages']} as lng2l ON lng2l.name = CONCAT('language_', {$tables['map_countries']}.code) AND lng2l.code = '{$config['default_admin_language']}' {$condition} ORDER BY country LIMIT {$navigation['first_page']}, {$navigation['objects_per_page']}");
$smarty->assign('countries', $countries);
$smarty->assign('zones', $zones);
$smarty->assign('zone', $zone);
示例5: cw_load
<?php
cw_load('files', 'image');
if (!isset($available_images[$type])) {
cw_close_window();
}
$images = cw_query($sql = "SELECT " . ($available_images[$type] == "U" ? "id" : "image_id") . " as id, image_path, image_x, image_y, image_size, alt FROM " . $tables[$type] . " WHERE id = '{$id}' AND avail = 1 ORDER BY orderby");
if (empty($images)) {
cw_close_window();
}
$navigation = cw_core_get_navigation($target, count($total_items), $page);
$navigation['script'] = "index.php?target=popup_image&type={$type}&id={$id}&title=" . urlencode($title);
$smarty->assign('navigation', $navigation);
$max_x = 0;
// get max height
foreach ($images as $k => $v) {
$images[$k] = cw_image_info($type, $v);
if ($images[$k]['image_x'] > $max_x) {
$max_x = $images[$k]['image_x'];
}
}
if (!empty($title)) {
$smarty->assign('title', $title);
}
$smarty->assign('max_x', $max_x);
$smarty->assign('images_count', count($images));
$smarty->assign('images', $images);
$smarty->assign('id', $id);
$smarty->assign('type', $type);
$smarty->assign('area', $area);
$smarty->assign('body_onload', 'changeImg(0);');
示例6: cw_pages_search
function cw_pages_search($params, $return = null)
{
extract($params);
global $tables, $current_language, $target;
$fields = $from_tbls = $query_joins = $where = $groupbys = $having = $orderbys = array();
# kornev, merge standart and additional variables
if ($return) {
foreach ($return as $saname => $sadata) {
if (isset(${$saname}) && is_array(${$saname}) && empty(${$saname})) {
${$saname} = $sadata;
}
}
}
$from_tbls[] = 'pages';
$fields[] = "{$tables['pages']}.*";
$where[] = 1;
if (!empty($data['sort_field'])) {
$direction = $data['sort_direction'] ? 'DESC' : 'ASC';
$orderbys[] = $data['sort_field'] . ' ' . $direction;
} else {
$orderbys[] = 'title';
}
$search_query_count = cw_db_generate_query('count(*)', $from_tbls, $query_joins, $where, $groupbys, $having, array(), 0);
$search_query = cw_db_generate_query($fields, $from_tbls, $query_joins, $where, $groupbys, $having, $orderbys);
$total_items_res_id = db_query($search_query_count);
$total_items = db_num_rows($total_items_res_id);
$page = $data['page'];
if ($data['count']) {
return $total_items;
} elseif ($data['limit']) {
$limit_str = " LIMIT {$data['limit']}";
} elseif ($data['all']) {
$limit_str = '';
} else {
$navigation = cw_core_get_navigation($target, $total_items, $page);
$limit_str = " LIMIT {$navigation['first_page']}, {$navigation['objects_per_page']}";
}
$pages = cw_query($search_query . $limit_str);
return array($pages, $navigation);
}
示例7: cw_gift_get_giftreg_wishlist_database
function cw_gift_get_giftreg_wishlist_database($customer_id, $event_id)
{
global $tables;
global $items_per_page, $page, $sort, $sort_direction, $items_per_page_targets;
global $smarty, $target, $action, $mode;
$wishlist_items_nav = array();
if (isset($items_per_page)) {
$wishlist_items_nav['items_per_page'] = $items_per_page;
}
if (isset($page)) {
$wishlist_items_nav['page'] = $page;
}
$page = 1;
if (isset($sort)) {
$wishlist_items_nav['sort_field'] = $sort;
}
if (isset($sort_direction)) {
$wishlist_items_nav['sort_direction'] = $sort_direction;
}
$items_per_page_targets['wishlist'] = PHP_INT_MAX;
$items_fields = array("{$tables['wishlist']}.*");
$items_from_tbls = array('wishlist');
$items_where = array("{$tables['wishlist']}.customer_id='{$customer_id}' and {$tables['wishlist']}.event_id='{$event_id}'");
$items_groupbys = array();
$items_having = array();
if ($wishlist_items_nav['sort_field'] == 'forsale') {
$items_orderbys = array("{$tables['wishlist']}.product_id" . ($wishlist_items_nav['sort_direction'] ? ' DESC' : ' ASC'));
}
$items_count_query = cw_db_generate_query(array('count(*)'), $items_from_tbls, $items_query_joins, $items_where, $items_groupbys, $items_having, null);
$items_total_items = cw_query_first_cell($items_count_query);
$items_qry = cw_db_generate_query($items_fields, $items_from_tbls, $items_query_joins, $items_where, $items_groupbys, $items_having, $items_orderbys);
$items_per_page_targets['wishlist'] = $wishlist_items_nav['items_per_page'];
$navigation = cw_core_get_navigation($target, $items_total_items, $wishlist_items_nav['page']);
$navigation['script'] = "index.php?target={$target}&action={$action}&mode={$mode}";
$smarty->assign('navigation', $navigation);
if ($items_total_items > 0) {
$wishlist_items = cw_query($items_qry . " LIMIT {$navigation['first_page']}, {$navigation['objects_per_page']}");
}
if (!empty($wishlist_items)) {
$smarty->assign('wishlist_items_nav', $wishlist_items_nav);
}
return $wishlist_items;
}
示例8: cw_category_search
function cw_category_search($params, $return = null)
{
extract($params);
global $tables, $current_language;
$fields = $from_tbls = $query_joins = $where = $groupbys = $having = $orderbys = array();
$from_tbls[] = 'categories';
# kornev, merge standart and additional variables
if ($return) {
foreach ($return as $saname => $sadata) {
if (isset(${$saname}) && is_array(${$saname}) && empty(${$saname})) {
${$saname} = $sadata;
}
}
}
$query_joins['categories_lng'] = array('on' => "{$tables['categories_lng']}.category_id = {$tables['categories']}.category_id and {$tables['categories_lng']}.code='{$current_language}'\n");
$query_joins['categories_subcount'] = array('on' => "{$tables['categories_subcount']}.category_id = {$tables['categories']}.category_id");
$fields[] = "{$tables['categories_subcount']}.subcategory_count";
$fields[] = "{$tables['categories_subcount']}.product_count";
$query_joins['categories_subcount_1'] = array('tblname' => 'categories_subcount', 'on' => "categories_subcount_1.category_id = {$tables['categories']}.category_id and categories_subcount_1.status=1");
$fields[] = "categories_subcount_1.subcategory_count as subcategory_count_web";
$fields[] = "categories_subcount_1.product_count as product_count_web";
$fields[] = "{$tables['categories']}.*";
$fields[] = "IFNULL({$tables['categories_lng']}.category, {$tables['categories']}.category) as category";
$fields[] = "IFNULL({$tables['categories_lng']}.description, {$tables['categories']}.description) as description";
$where[] = 1;
if ($data['substring']) {
$where[] = "(IFNULL({$tables['categories_lng']}.category, {$tables['categories']}.category) like '%{$data['substring']}%' or IFNULL({$tables['categories_lng']}.description, {$tables['categories']}.description) like '%{$data['substring']}%')";
}
if (isset($data['parent_id'])) {
$where[] = "{$tables['categories']}.parent_id='" . intval($data['parent_id']) . "'";
}
if (isset($data['active']) || isset($data['status'])) {
$data['status'] = intval($data['status'] || $data['active']);
$where[] = "{$tables['categories']}.status = '{$data['status']}'";
}
if (isset($data['membership_id'])) {
$query_joins['categories_memberships'] = array('on' => "{$tables['categories_memberships']}.category_id = {$tables['categories']}.category_id");
$where[] = "{$tables['categories_memberships']}.membership_id='{$data['membership_id']}'";
}
$groupbys[] = "{$tables['categories']}.category_id";
$orderbys[] = "{$tables['categories']}.order_by";
$search_query_count = cw_db_generate_query('count(*)', $from_tbls, $query_joins, $where, $groupbys, $having, array(), 0);
$search_query = cw_db_generate_query($fields, $from_tbls, $query_joins, $where, $groupbys, $having, $orderbys);
$_res = db_query($search_query_count);
$total_items = db_num_rows($_res);
db_free_result($_res);
$page = $data['page'];
if ($data['count']) {
return $total_items;
} elseif ($data['limit']) {
$limit_str = " LIMIT {$data['limit']}";
} elseif ($data['all']) {
$limit_str = '';
} else {
$navigation = cw_core_get_navigation($target, $total_items, $page);
$limit_str = " LIMIT {$navigation['first_page']}, {$navigation['objects_per_page']}";
}
$categories = cw_query($search_query . $limit_str);
if ($data['all']) {
$navigation = cw_core_get_navigation($target, count($categories), $page, count($categories));
}
if (is_array($categories)) {
foreach ($categories as $k => $v) {
$categories[$k]['subcounts'] = cw_query_hash("SELECT cs.status, sum(cs.subcategory_count) as subcategory_count, \n\t\t\tsum(cs.product_count) as product_count\n FROM {$tables['categories_subcount']} cs, {$tables['categories_parents']} cp\n WHERE cs.membership_id='{$data['membership_id']}' AND\n\t\t\tcs.category_id = cp.category_id AND cp.parent_id='{$v['category_id']}'\n\t\t\tGROUP BY status", 'status', false, false);
}
}
return array($categories, $navigation);
}
示例9: int
$load_data_tables_qry[] = "CREATE TABLE `{$table_name}` ({$table_key_name} int(11) NOT NULL AUTO_INCREMENT, " . implode(", ", $add_field_qry) . ", PRIMARY KEY `{$table_key_name}` (`{$table_key_name}`))ENGINE=MyISAM;";
$load_data_tables_qry[] = "INSERT INTO `{$table_name}` (" . implode(", ", $field_names) . ") SELECT " . implode(", ", $tmp_fields) . " FROM {$parsed_file['tmp_table']}";
}
$load_data_tables_qry[] = "DROP TABLE IF EXISTS {$parsed_file['tmp_table']}";
foreach ($load_data_tables_qry as $lqry) {
cw_csvxc_logged_query($lqry);
}
cw_include('addons/flexible_import/include/tmp_tables_load.php');
if ($parsed_file['err']) {
cw_add_top_message($parsed_file['err'], 'E');
} else {
cw_add_top_message(cw_get_langvar_by_name('lbl_import_success'), 'I');
}
}
cw_header_location("index.php?target={$target}&mode={$mode}");
}
$search_prefilled['files'] = cw_flexible_import_files_dir();
$search_prefilled['sort_field'] = $sort && $sort != "" ? $sort : "id";
$search_prefilled['sort_direction'] = $sort_direction && $sort_direction != 0 ? 0 : 1;
$search_prefilled['items_per_page'] = $items_per_page ? $items_per_page : 20;
$search_prefilled['page'] = $page ? $page : 1;
$profiles = cw_call('cw_flexible_import_get_profiles', array('params' => $search_prefilled));
$total_profiles = cw_query_first_cell("SELECT COUNT(*) from {$tables['flexible_import_profiles']}");
$navigation = cw_core_get_navigation($target, $total_profiles, $page, $items_per_page);
$navigation['script'] = "index.php?target=import&mode=flexible_import";
$navigation['objects_per_page'] = $search_prefilled['items_per_page'];
$smarty->assign('navigation', $navigation);
$smarty->assign('search_prefilled', $search_prefilled);
$smarty->assign('profiles', $profiles);
$smarty->assign('main', 'flexible_import');
}
示例10: cw_product_search
//.........这里部分代码省略.........
}
/*
if (($current_area == "C" || $current_area == "B") && $config['General']['disable_outofstock_products'] == "Y") {
$query_joins['products_warehouses_amount'] = array(
'tblname' => 'products_warehouses_amount',
'on' => "$tables[products_warehouses_amount].product_id = $tables[products].product_id and $tables[products_warehouses_amount].variant_id=$tables[product_variants].variant_id and $tables[products_warehouses_amount.avail > 0",
'only_select' => 0,
);
}
*/
$groupbys[] = "{$tables['products']}.product_id";
$orderbys[] = $sort_string;
$orderbys[] = "{$tables['products']}.product ASC";
if (isset($params['product_id_only']) && $params['product_id_only'] == true) {
$fields = array($tables['products'] . '.product_id');
}
$search_query_count = cw_db_generate_query('count(*)', $from_tbls, $query_joins, $where, $groupbys, $having, array(), 0);
$search_query = cw_db_generate_query($fields, $from_tbls, $query_joins, $where, $groupbys, $having, $orderbys);
//var_dump($search_query); die();
if (!$data['limit'] && !$data['all']) {
$_res = db_query($search_query_count);
$total_items = db_num_rows($_res);
db_free_result($_res);
}
# kornev, optimization, we don't need to pre-calculate the amount in some cases
$page = $data['page'];
if ($data['count']) {
return $total_items;
} elseif ($data['limit']) {
$limit_str = " LIMIT {$data['limit']}";
} elseif ($data['all']) {
$limit_str = '';
} else {
$navigation = cw_core_get_navigation($target, $total_items, $page);
$_objects2load = $navigation['objects_per_page'];
$_first_object_on_page = $navigation['first_page'];
if (isset($navigation['preload_objects'])) {
$_objects2load += $navigation['preload_objects'];
$_first_object_on_page = max($_first_object_on_page - $navigation['preload_objects'], 0);
}
$limit_str = " LIMIT {$_first_object_on_page}, {$_objects2load}";
}
$products = $pfr = array();
if ($params['count_only']) {
return array($products, $navigation, $pfr);
}
if ($total_items > 0 || $data['limit'] || $data['all'] || $data['attributes']) {
$products = cw_query($search_query . $limit_str);
if ($data['limit'] || $data['all']) {
$items_per_page = 20;
if (!empty($objects_per_page)) {
$items_per_page = $objects_per_page;
}
$navigation = cw_core_get_navigation($target, count($products), $page, $items_per_page);
}
/* kornev, not used now
if ($data['query_manufacturers'] == 'Y') {
$query_joins['manufacturers'] = array(
'on' => "$tables[products].manufacturer_id=$tables[manufacturers].manufacturer_id",
'is_inner' => 1,
);
unset($where['manuf_condition']);
$manuf_query = cw_db_generate_query(array("$tables[manufacturers].manufacturer", "$tables[manufacturers].manufacturer_id"), $from_tbls, $query_joins, $where, array("$tables[manufacturers].manufacturer"), $having, array("$tables[manufacturers].orderby"));
$p_manufacturers = cw_query($manuf_query);
示例11: cw_core_get_time
<?php
$ctime = cw_core_get_time();
$start_date = mktime(0, 0, 0, date("m", $ctime), 1, date("Y", $ctime));
$end_date = $ctime;
if ($action == "go") {
$salesman_condition = $salesman ? " AND {$tables['salesman_payment']}.customer_id='{$salesman}'" : "";
if ($StartMonth) {
$start_date = mktime(0, 0, 0, $StartMonth, $StartDay, $StartYear);
$end_date = mktime(23, 59, 59, $EndMonth, $EndDay, $EndYear);
}
$query = "SELECT {$tables['salesman_payment']}.*, {$tables['customers']}.* FROM {$tables['salesman_payment']}, {$tables['customers']} WHERE {$tables['salesman_payment']}.paid='Y' AND {$tables['salesman_payment']}.customer_id={$tables['customers']}.customer_id AND {$tables['salesman_payment']}.add_date>='{$start_date}' AND {$tables['salesman_payment']}.add_date<='{$end_date}' {$salesman_condition} ORDER BY {$tables['salesman_payment']}.add_date desc";
$total_history = count(cw_query($query));
$navigation = cw_core_get_navigation($target, $total_history, $page);
$navigation['script'] = "index.php?target=payment_history&StartMonth={$StartMonth}&StartDay={$StartDay}&StartYear={$StartYear}&EndMonth={$EndMonth}&EndDay={$EndDay}&EndYear={$EndYear}&salesman={$salesman}&mode=go";
$smarty->assign('navigation', $navigation);
$smarty->assign("history", cw_query("{$query} LIMIT {$navigation['first_page']}, {$navigation['objects_per_page']}"));
}
$salesmans = cw_query("SELECT * FROM {$tables['customers']} WHERE usertype='B' ORDER BY lastname");
$smarty->assign("salesmans", $salesmans);
$smarty->assign('history', $history);
$smarty->assign('salesman', $salesman);
$smarty->assign('start_date', $start_date);
$smarty->assign('end_date', $end_date);
$smarty->assign('main', 'payment_history');
示例12: cw_call
} else {
$smarty->assign('clearance', cw_call('cw_sections_get', array('section' => 'clearance', array('all' => 1), 'where' => 'home_page=1', 'info_type' => 136)));
$smarty->assign('hot_deals_home', cw_call('cw_sections_get', array('section' => 'hot_deals', array('all' => 1), 'where' => 'home_page=1', 'info_type' => 136)));
$hot_deals_hot = cw_call('cw_sections_get', array('section' => 'hot_deals', array('all' => 1), 'where' => 'hot_deal=1', 'info_type' => 136));
if (is_array($hot_deals_hot)) {
$smarty->assign('hot_deals_hot', array_pop($hot_deals_hot));
}
$featured_categories = cw_call('cw_featured_categories_get', array('current_language' => $current_language));
$smarty->assign('featured_categories', $featured_categories);
}
$smarty->assign('tags', cw_tags_get_popular_tags());
$smarty->assign('bottom_line', cw_call('cw_sections_get', array('section' => 'bottom_line', array('all' => 1), '', 'info_type' => 136)));
# kornev, deals of week
$hot_deals_week = cw_call('cw_sections_get', array('section' => 'hot_deals', array('all' => 1), 'where' => 'week_deal=1', 'info_type' => 136));
if (is_array($hot_deals_week)) {
$week_navigation = cw_core_get_navigation($target, sizeof($hot_deals_week), 1, 4);
$smarty->assign('week_navigation', $week_navigation);
$smarty->assign('hot_deals_week', $hot_deals_week);
}
if ($cat) {
$last = array_pop($location);
$last['1'] = '';
$location[] = $last;
// $location = array_merge($location, cw_product_get_filter_location($product_filter, $navigation['script']));
$smarty->assign('product_filter_navigation', cw_product_get_filter_location($product_filter, $navigation['script']));
$smarty->assign('cat', $cat);
$smarty->assign('current_section_dir', 'products');
$smarty->assign('main', 'subcategories');
$smarty->assign('show_left_bar', TRUE);
if (defined('IS_AJAX')) {
define('PREVENT_XML_OUT', 1);
示例13: cw_session_register
<?php
$search_data =& cw_session_register('search_data', array());
if ($action == 'go') {
$date_fields = array('' => array('start_date' => 0, 'end_date' => 1));
cw_core_process_date_fields($posted_data, $date_fields);
$search_data['payment_history'] = $posted_data;
cw_header_location('index.php?target=' . $target);
}
$paid_total_result = cw_query_first("SELECT SUM(commissions) AS numba FROM {$tables['salesman_payment']} WHERE paid='Y' AND salesman_customer_id='{$customer_id}'");
$smarty->assign('paid_total', $paid_total);
$data = $search_data['payment_history'];
$where = array();
$from_tbls = array('salesman_payment');
$where[] = 'paid="Y"';
if ($data['start_date']) {
$where[] = "{$tables['salesman_payment']}.add_date>='{$data['start_date']}'";
}
if ($data['end_date']) {
$where[] = "{$tables['salesman_payment']}.add_date>='{$data['end_date']}'";
}
$total_payments = cw_query_first_cell(cw_db_generate_query('count(*)', $from_tbls, '', $where, '', '', '', 0));
if ($total_payments) {
$smarty->assign('payments', cw_query(cw_db_generate_query('*', $from_tbls, '', $where, '', '', array('add_date'))));
}
$navigation = cw_core_get_navigation($target, $total_payments, $page);
$navigation['script'] = 'index.php?target=' . $target;
$smarty->assign('navigation', $navigation);
$smarty->assign('search_prefilled', $data);
$smarty->assign('main', 'payment_history');
示例14: cw_manufacturer_search
function cw_manufacturer_search($params, $return = null)
{
extract($params);
global $tables, $current_language, $target;
$fields = $from_tbls = $query_joins = $where = $groupbys = $having = $orderbys = array();
# kornev, merge standart and additional variables
if ($return) {
foreach ($return as $saname => $sadata) {
if (isset(${$saname}) && is_array(${$saname}) && empty(${$saname})) {
${$saname} = $sadata;
}
}
}
$from_tbls[] = 'manufacturers';
$query_joins['manufacturers_lng'] = array('on' => "{$tables['manufacturers_lng']}.manufacturer_id = {$tables['manufacturers']}.manufacturer_id and {$tables['manufacturers_lng']}.code='{$current_language}'");
if ($info_type & 2) {
$attribute_id = cw_call('cw_attributes_get_attribute_by_field', array('field' => 'manufacturer_id'));
$query_joins['product_counter'] = array('tblname' => 'attributes_values', 'on' => "product_counter.value = {$tables['manufacturers']}.manufacturer_id AND product_counter.attribute_id={$attribute_id}", 'parent' => 'manufacturers', 'only_select' => 1);
$fields[] = "count(product_counter.item_id) as products_count";
}
$groupbys[] = "{$tables['manufacturers']}.manufacturer_id";
$fields[] = "{$tables['manufacturers']}.*";
$fields[] = "IFNULL({$tables['manufacturers_lng']}.manufacturer, {$tables['manufacturers']}.manufacturer) as manufacturer";
$fields[] = "IFNULL({$tables['manufacturers_lng']}.descr, {$tables['manufacturers']}.descr) as descr";
$where[] = 1;
if ($data['substring']) {
$where[] = "(IFNULL({$tables['manufacturers_lng']}.manufacturer, {$tables['manufacturers']}.manufacturer) like '%{$data['substring']}%' or IFNULL({$tables['manufacturers_lng']}.descr, {$tables['manufacturers']}.descr) like '%{$data['substring']}%')";
}
if (isset($data['avail'])) {
$where[] = "{$tables['manufacturers']}.avail = '{$data['avail']}'";
}
if (isset($data['featured'])) {
$where[] = "{$tables['manufacturers']}.featured = '{$data['featured']}'";
}
if (!empty($data['sort_field'])) {
$direction = $data['sort_direction'] ? 'DESC' : 'ASC';
switch ($data['sort_field']) {
case '':
$sort_string = "manufacturer {$direction}";
break;
default:
$orderbys[] = $data['sort_field'] . ' ' . $direction;
}
} else {
$orderbys[] = 'manufacturer';
}
$search_query_count = cw_db_generate_query('count(*)', $from_tbls, $query_joins, $where, $groupbys, $having, array(), 0);
$search_query = cw_db_generate_query($fields, $from_tbls, $query_joins, $where, $groupbys, $having, $orderbys);
$total_items_res_id = db_query($search_query_count);
$total_items = db_num_rows($total_items_res_id);
$page = $data['page'];
if ($data['count']) {
return $total_items;
} elseif ($data['limit']) {
$limit_str = " LIMIT {$data['limit']}";
} elseif ($data['all']) {
$limit_str = '';
} else {
$navigation = cw_core_get_navigation($target, $total_items, $page);
$limit_str = " LIMIT {$navigation['first_page']}, {$navigation['objects_per_page']}";
}
$manufacturers = cw_query($search_query . $limit_str);
if ($info_type & 1 && $manufacturers) {
foreach ($manufacturers as $k => $v) {
$manufacturers[$k]['image'] = cw_image_get('manufacturer_images', $v['manufacturer_id']);
}
}
return array($manufacturers, $navigation);
}
示例15: cw_accounting_get_movements
function cw_accounting_get_movements($mtype, $data)
{
global $tables;
$fields = array();
$from_tbls = array();
$query_joins = array();
$where = array();
$groupbys = array();
$having = array();
$orderbys = array();
$from_tbls[] = 'movements';
$query_joins['accounting_categories'] = array('on' => "{$tables['accounting_categories']}.accounting_category_id = {$tables['movements']}.accounting_category_id", 'parent' => 'movements', 'is_inner' => 1);
$fields[] = "{$tables['accounting_categories']}.category";
/*
$query_joins['movements_info_'.$mtype] = array (
'tblname' => 'movements_'.$mtype,
'on' => "movements_info.movements_id = $tables[movements].movements_id",
);
*/
$fields[] = "{$tables['movements']}.*";
// $fields[] = "movements_info.*";
$where[] = "1";
if ($data['warehouse_customer_id']) {
$where[] = "{$tables['movements']}.warehouse_customer_id='" . $data['warehouse_customer_id'] . "'";
}
if ($data['substring']) {
$where[] = "{$tables['movements']}.product like '%" . $data['substring'] . "%'";
}
if ($data['productcode']) {
$where[] = "{$tables['movements']}.productcode like '%" . $data['productcode'] . "%'";
}
if ($data['price_min']) {
$where[] = "{$tables['movements']}.price >= '" . $data['price_min'] . "'";
}
if ($data['price_max']) {
$where[] = "{$tables['movements']}.price <= '" . $data['price_max'] . "'";
}
if ($data['amount_min']) {
$where[] = "{$tables['movements']}.amount >= '" . $data['amount_min'] . "'";
}
if ($data['amount_max']) {
$where[] = "{$tables['movements']}.amount <= '" . $data['amount_max'] . "'";
}
if ($data['pos_customer_id']) {
$movements_info[] = 'G';
$fields[] = "movements_G.pos_customer_id";
$where[] = "movements_G.pos_customer_id='" . $data['pos_customer_id'] . "'";
}
if ($data['date_start']) {
$where[] = "{$tables['movements']}.date >= '" . $data['date_start'] . "'";
}
if ($data['date_end']) {
$where[] = "{$tables['movements']}.date <= '" . $data['date_end'] . "'";
}
if (count($movements_info)) {
$movements_info = array_unique($movements_info);
foreach ($movements_info as $tp) {
$query_joins['movements_' . $tp] = array('tblname' => 'movements_' . $tp, 'on' => "movements_{$tp}.movements_id = {$tables['movements']}.movements_id", 'parent' => 'movements');
}
}
if ($data['by_doc']) {
$query_joins['docs'] = array('on' => "{$tables['docs']}.doc_id = {$tables['movements']}.doc_id", 'is_inner' => 1);
$query_joins['docs_user_info'] = array('on' => "{$tables['docs_user_info']}.doc_info_id = {$tables['docs']}.doc_info_id", 'is_inner' => 1);
$query_joins['docs_info'] = array('on' => "{$tables['docs_info']}.doc_info_id = {$tables['docs']}.doc_info_id", 'is_inner' => 1);
$query_joins['warehouse_divisions'] = array('on' => "{$tables['warehouse_divisions']}.division_id = {$tables['movements']}.warehouse_customer_id", 'is_inner' => 1);
$fields[] = "{$tables['warehouse_divisions']}.title as warehouse_title";
$fields[] = "{$tables['docs']}.date";
$fields[] = "{$tables['docs_user_info']}.customer_id";
$fields[] = "{$tables['docs_info']}.total";
$fields[] = "{$tables['docs_info']}.warehouse_customer_id";
$groupbys[] = "{$tables['movements']}.doc_id";
}
$count_query = cw_db_generate_query(array('count(*)'), $from_tbls, $query_joins, $where, $groupbys, $having, $orderbys);
if ($data['by_doc']) {
$_res = db_query($count_query);
$total_items = db_num_rows($_res);
db_free_result($_res);
} else {
$total_items = cw_query_first_cell($count_query);
}
if ($data['all']) {
$navigation = cw_core_get_navigation($target, $total_items, 0, $total_items);
} else {
$navigation = cw_core_get_navigation($target, $total_items, $data['page']);
}
if ($total_items) {
$movements = cw_query(cw_db_generate_query($fields, $from_tbls, $query_joins, $where, $groupbys, $having, $orderbys) . " LIMIT {$navigation['first_page']}, {$navigation['objects_per_page']}");
if ($data['by_doc']) {
foreach ($movements as $k => $v) {
$movements[$k]['movements'] = cw_query($sql = "select * from {$tables['movements']} where doc_id='{$v['doc_id']}'");
$movements[$k]['items_count'] = cw_query_first_cell("select count(*) from {$tables['docs_items']} where doc_id='{$v['doc_id']}'");
}
}
}
return array($movements, $navigation);
}