本文整理汇总了PHP中generateLink函数的典型用法代码示例。如果您正苦于以下问题:PHP generateLink函数的具体用法?PHP generateLink怎么用?PHP generateLink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generateLink函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: generateLoginButton
function generateLoginButton($scopes = ['publicData'])
{
$login = "";
$login .= '<a href="';
$login .= generateLink($scopes);
$login .= '">';
$login .= '<img alt="EVE SSO Login Buttons Small White" src="https://images.contentful.com/idjq7aai9ylm/18BxKSXCymyqY4QKo8KwKe/c2bdded6118472dd587c8107f24104d7/EVE_SSO_Login_Buttons_Small_White.png?w=195&h=30"></a>';
return $login;
}
开发者ID:akturis,项目名称:spyonyou,代码行数:9,代码来源:ccpOAuth.php
示例2: generate_currency_cache
function generate_currency_cache($load = false)
{
global $mysql, $config;
$eshop_dir = get_plugcfg_dir('eshop');
if (!file_exists($eshop_dir . '/cache_currency.php') or $load) {
$currency_link = checkLinkAvailable('eshop', 'currency') ? generateLink('eshop', 'currency', array()) : generateLink('core', 'plugin', array('plugin' => 'eshop', 'handler' => 'currency'), array());
$currency_tEntry = array();
foreach ($mysql->select("SELECT * FROM " . prefix . "_eshop_currencies WHERE enabled = 1 ORDER BY position, id") as $row) {
$row['currency_link'] = $currency_link . "?id=" . $row['id'];
$currency_tEntry[] = $row;
}
file_put_contents($eshop_dir . '/cache_currency.php', serialize($currency_tEntry));
}
}
开发者ID:irbees2008,项目名称:ngcms_eshop,代码行数:14,代码来源:cache.php
示例3: automation
function automation()
{
global $tpl, $mysql, $twig;
$tpath = locatePluginTemplates(array('config/main', 'config/automation'), 'eshop', 1);
if (isset($_REQUEST['yml_url']) && !empty($_REQUEST['yml_url']) && isset($_REQUEST['import'])) {
import_yml($_REQUEST['yml_url']);
//$import_str = implode('<br/>',$_SESSION['import_yml']);
//$info = "Импорт YML успешно завершен<br/><br/>".$import_str;
$info = "Импорт YML успешно завершен";
msg(array("type" => "info", "info" => $info));
}
if (isset($_REQUEST['currency'])) {
$rates_str = update_currency();
$info = "Валюты обновлены<br/><br/>" . $rates_str;
msg(array("type" => "info", "info" => $info));
}
$xt = $twig->loadTemplate($tpath['config/automation'] . 'config/' . 'automation.tpl');
$yml_export_link = checkLinkAvailable('eshop', 'yml_export') ? generateLink('eshop', 'yml_export', array()) : generateLink('core', 'plugin', array('plugin' => 'eshop', 'handler' => 'yml_export'), array());
$tVars = array('yml_export_link' => $yml_export_link, 'info' => '');
$xg = $twig->loadTemplate($tpath['config/main'] . 'config/' . 'main.tpl');
$tVars = array('entries' => $xt->render($tVars), 'php_self' => $PHP_SELF, 'plugin_url' => admin_url . '/admin.php?mod=extra-config&plugin=eshop', 'skins_url' => skins_url, 'admin_url' => admin_url, 'home' => home, 'current_title' => 'Автоматизация');
print $xg->render($tVars);
}
开发者ID:irbees2008,项目名称:ngcms_eshop,代码行数:23,代码来源:config.php
示例4: ebasket_rpc_manage
function ebasket_rpc_manage($params)
{
global $userROW, $DSlist, $mysql, $twig;
LoadPluginLibrary('xfields', 'common');
if (!is_array($params) || !isset($params['action'])) {
return array('status' => 0, 'errorCode' => 1, 'errorText' => 'Activity mode is not set');
}
$params = arrayCharsetConvert(1, $params);
switch ($params['action']) {
// **** ADD NEW ITEM INTO ebasket ****
case 'add':
$linked_ds = intval($params['ds']);
$linked_id = intval($params['id']);
$count = intval($params['count']);
// Check available DataSources
if (!in_array($linked_ds, array($DSlist['news']))) {
return array('status' => 0, 'errorCode' => 2, 'errorText' => 'ebasket can be used only for NEWS');
}
// Check available DataSources
if ($count < 1) {
return array('status' => 0, 'errorCode' => 2, 'errorText' => 'Count should be positive');
}
// Check if linked item is available
switch ($linked_ds) {
case $DSlist['news']:
$conditions = array();
if ($linked_id) {
array_push($conditions, "p.id = " . db_squote($linked_id));
}
$fSort = " GROUP BY p.id ORDER BY p.id DESC";
$sqlQPart = "FROM " . prefix . "_eshop_products p LEFT JOIN " . prefix . "_eshop_products_categories pc ON p.id = pc.product_id LEFT JOIN " . prefix . "_eshop_categories c ON pc.category_id = c.id LEFT JOIN (SELECT * FROM " . prefix . "_eshop_images ORDER BY position, id) i ON i.product_id = p.id LEFT JOIN " . prefix . "_eshop_variants v ON p.id = v.product_id " . (count($conditions) ? "WHERE " . implode(" AND ", $conditions) : '') . $fSort;
$sqlQ = "SELECT p.id AS id, p.url as url, p.code AS code, p.name AS name, p.active AS active, p.featured AS featured, p.position AS position, c.url as curl, c.name AS category, i.filepath AS image_filepath, v.price AS price, v.compare_price AS compare_price, v.stock AS stock " . $sqlQPart;
// Retrieve news record
$rec = $mysql->record($sqlQ);
if (!is_array($rec)) {
return array('status' => 0, 'errorCode' => 3, 'errorText' => 'Item [news] with ID (' . $linked_id . ') is not found');
}
$btitle = $rec['name'];
$price = $rec['price'];
$view_link = checkLinkAvailable('eshop', 'show') ? generateLink('eshop', 'show', array('alt' => $rec['url'])) : generateLink('core', 'plugin', array('plugin' => 'eshop', 'handler' => 'show'), array('alt' => $rec['url']));
$rec['view_link'] = $view_link;
// Add data into basked
return ebasket_add_item($linked_ds, $linked_id, $btitle, $price, $count, array('item' => $rec));
break;
}
break;
case 'update_count':
$id = intval($params['id']);
$linked_ds = intval($params['linked_ds']);
$linked_id = intval($params['linked_id']);
$count = intval($params['count']);
return basket_update_item_count($id, $linked_ds, $linked_id, $count);
break;
case 'delete':
$id = intval($params['id']);
$linked_ds = intval($params['linked_ds']);
$linked_id = intval($params['linked_id']);
return basket_delete_item($id, $linked_ds, $linked_id);
break;
case 'add_fast':
$linked_ds = intval($params['ds']);
$linked_id = intval($params['id']);
$count = intval($params['count']);
$type = intval($params['type']);
$order['name'] = filter_var($params['name'], FILTER_SANITIZE_STRING);
if (empty($order['name'])) {
return array('status' => 0, 'errorCode' => 3, 'errorText' => 'Item [news] with ID (' . $linked_id . ') is not found');
}
$order['email'] = "";
$order['phone'] = filter_var($params['phone'], FILTER_SANITIZE_STRING);
if (empty($order['phone'])) {
return array('status' => 0, 'errorCode' => 3, 'errorText' => 'Item [news] with ID (' . $linked_id . ') is not found');
}
$order['address'] = filter_var($params['address'], FILTER_SANITIZE_STRING);
if (empty($order['address'])) {
return array('status' => 0, 'errorCode' => 3, 'errorText' => 'Item [news] with ID (' . $linked_id . ') is not found');
}
// Check available DataSources
if (!in_array($linked_ds, array($DSlist['news']))) {
return array('status' => 0, 'errorCode' => 2, 'errorText' => 'ebasket can be used only for NEWS');
}
// Check available DataSources
if ($count < 1) {
$count = 1;
}
$conditions = array();
if ($linked_id) {
array_push($conditions, "p.id = " . db_squote($linked_id));
}
$fSort = " GROUP BY p.id ORDER BY p.id DESC";
$sqlQPart = "FROM " . prefix . "_eshop_products p LEFT JOIN " . prefix . "_eshop_products_categories pc ON p.id = pc.product_id LEFT JOIN " . prefix . "_eshop_categories c ON pc.category_id = c.id LEFT JOIN (SELECT * FROM " . prefix . "_eshop_images ORDER BY position, id) i ON i.product_id = p.id LEFT JOIN " . prefix . "_eshop_variants v ON p.id = v.product_id " . (count($conditions) ? "WHERE " . implode(" AND ", $conditions) : '') . $fSort;
$sqlQ = "SELECT p.id AS id, p.url as url, p.code AS code, p.name AS name, p.active AS active, p.featured AS featured, p.position AS position, c.url as curl, c.name AS category, i.filepath AS image_filepath, v.price AS price, v.compare_price AS compare_price, v.stock AS stock " . $sqlQPart;
// Retrieve news record
$rec = $mysql->record($sqlQ);
if (!is_array($rec)) {
return array('status' => 0, 'errorCode' => 3, 'errorText' => 'Item [news] with ID (' . $linked_id . ') is not found');
}
$btitle = $rec['name'];
$price = $rec['price'];
$view_link = checkLinkAvailable('eshop', 'show') ? generateLink('eshop', 'show', array('alt' => $row['url'])) : generateLink('core', 'plugin', array('plugin' => 'eshop', 'handler' => 'show'), array('alt' => $row['url']));
//.........这里部分代码省略.........
开发者ID:irbees2008,项目名称:ngcms_eshop,代码行数:101,代码来源:rpc_eshop.php
示例5: define
*/
define('XAJAX_HTML_CONTROL_DOCTYPE_FORMAT', 'HTML');
define('XAJAX_HTML_CONTROL_DOCTYPE_VERSION', '4.01');
define('XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION', 'TRANSITIONAL');
$sBaseFolder = dirname(dirname(dirname(__FILE__)));
$sCoreFolder = '/xajax_core';
$sCtrlFolder = '/xajax_controls';
include $sBaseFolder . $sCoreFolder . '/xajax.inc.php';
$xajax = new xajax();
$xajax->configure('javascript URI', '../../');
include $sBaseFolder . $sCtrlFolder . '/validate_HTML401TRANSITIONAL.inc.php';
include $sBaseFolder . $sCoreFolder . '/xajaxControl.inc.php';
foreach (array('/document.inc.php', '/structure.inc.php', '/content.inc.php', '/form.inc.php', '/group.inc.php', '/misc.inc.php') as $sFile) {
include $sBaseFolder . $sCtrlFolder . $sFile;
}
$objDocument = new clsDocument(array('children' => array(new clsDoctype(), new clsHtml(array('children' => array(new clsHead(array('xajax' => $xajax, 'children' => array(generateTitle(), generateStyle(), generateScript(), generateMeta(), generateLink(), generateBase()))), new clsBody(array('children' => array(generateOrderedList(), generateUnorderedList(), generateDefinitionList(), generateTable(), generateForm(), generateContent(), generateValidation(), generateIframe())))))))));
function generateTitle()
{
return new clsTitle(array('child' => new clsLiteral('Title')));
}
function generateStyle()
{
return new clsStyle(array('attributes' => array('type' => 'text/css'), 'child' => new clsLiteral('styleOne { background: #ffdddd; }')));
}
function generateScript()
{
return new clsScript(array('attributes' => array('type' => 'text/javascript'), 'child' => new clsLiteral('javascriptFunction = function(a, b) { alert(a*b); };')));
}
function generateMeta()
{
return new clsMeta(array('attributes' => array('name' => 'keywords', 'lang' => 'en-us', 'content' => 'xajax, javascript, php, ajax')));
开发者ID:silvia-valdez,项目名称:SignalsViewer,代码行数:31,代码来源:controls_html_401_transitional.php
示例6: generateLink
if (description.length < 15) {
$("#wmd-input").addClass('textalert');
$.fancyalert('Your description must be atleast 15 characters in length');
$("#wmd-input").focus();
return false;
} else {
$("#wmd-input").removeClass('textalert');
}
return true;
}
</script>
<form action="<?php
echo generateLink("questions", "post");
?>
" method="post" onsubmit="javascript:return cform();">
<h1>What would you like to ask or contribute?</h1>
<input type="textbox" class="textbox" name="title" id="title" tabindex="1"/><br/>
<div id="wmd-editor" class="wmd-panel" style="padding-top:10px">
<div id="wmd-button-bar"></div>
<textarea id="wmd-input" name="description" tabindex="2" ></textarea>
</div>
<div id="wmd-preview" class="markdown"></div>
<h3 style="padding-top:20px">Share a Link</h3>
<input type="textbox" class="textbox" name="link" id="link" tabindex="3"/><br/>
开发者ID:nayanshah,项目名称:Qwench,代码行数:29,代码来源:ask.php
示例7: printf
printf("<a href=\"" . BASE_PATH . "/admin\">Admin Panel</a><br>");
}
?>
<a href="<?php
echo BASE_PATH;
?>
/users/logout">Logout</a>
</div>
<div style="clear:both"></div>
</div>
<?php
} elseif (empty($loginpage)) {
?>
<div class="userlogin">
<form action="<?php
echo generateLink("users", "validate");
?>
" method="post">
<h3>E-mail</h3>
<input type="textbox" class="textbox" name="email" style="width:215px;"/>
<h3>Password</h3>
<input type="password" class="textbox" name="password" style="width:215px;"/>
<input type="hidden" name="returnurl" value="<?php
echo getLink();
?>
">
<div style="padding-top:10px">
<input type="submit" value="Login" class="button"> or <i><a href="<?php
echo BASE_PATH;
?>
/users/register">click here to register</a></i>
开发者ID:nayanshah,项目名称:Qwench,代码行数:31,代码来源:footer.php
示例8: generateLink
if (password.length < 1 || password.length > 100) {
$("#namepassword").addClass('textalert');
$.fancyalert('Please enter your password');
$("#password").focus();
return false;
} else {
$("#password").removeClass('textalert');
}
return true;
}
</script>
<form action="<?php
echo generateLink("users", "create");
?>
" method="post" onsubmit="javascript:return cform();">
<h1>Register</h1>
<h3>Name</h3>
<input type="textbox" class="textbox" name="name" id="name"/><br/>
<h3>E-mail</h3>
<input type="textbox" class="textbox" name="email" id="email"/><br/>
<h3>Password</h3>
<input type="password" class="textbox" name="password" id="password"/></select>
<br/><br/>
开发者ID:pacoesni,项目名称:Qwench,代码行数:31,代码来源:register.php
示例9: plugin_gsmg_screen
function plugin_gsmg_screen()
{
global $config, $mysql, $catz, $catmap, $SUPRESS_TEMPLATE_SHOW, $SYSTEM_FLAGS, $PFILTERS;
$SUPRESS_TEMPLATE_SHOW = 1;
$SUPRESS_MAINBLOCK_SHOW = 1;
@header('Content-type: text/xml; charset=utf-8');
$SYSTEM_FLAGS['http.headers'] = array('content-type' => 'application/xml; charset=charset=utf-8', 'cache-control' => 'private');
if (extra_get_param('gsmg', 'cache')) {
$cacheData = cacheRetrieveFile('gsmg.txt', extra_get_param('gsmg', 'cacheExpire'), 'gsmg');
if ($cacheData != false) {
// We got data from cache. Return it and stop
print $cacheData;
return;
}
}
$output = '<?xml version="1.0" encoding="UTF-8"?>';
$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
// Настройки постранички
if ($config['number'] < 1) {
$config['number'] = 5;
}
// Надо ли выводить данные с головной страницы
if (extra_get_param('gsmg', 'main')) {
$output .= "<url>";
$output .= "<loc>" . generateLink('news', 'main', array(), array(), false, true) . "</loc>";
$output .= "<priority>" . floatval(extra_get_param('gsmg', 'main_pr')) . "</priority>";
$lm = $mysql->record("select date(from_unixtime(max(postdate))) as pd from " . prefix . "_news");
$output .= "<lastmod>" . $lm['pd'] . "</lastmod>";
$output .= "<changefreq>daily</changefreq>";
$output .= "</url>";
if (extra_get_param('gsmg', 'mainp')) {
$cnt = $mysql->record("select count(*) as cnt from " . prefix . "_news");
$pages = ceil($cnt['cnt'] / $config['number']);
for ($i = 2; $i <= $pages; $i++) {
$output .= "<url>";
$output .= "<loc>" . generateLink('news', 'main', array('page' => $i), array(), false, true) . "</loc>";
$output .= "<priority>" . floatval(extra_get_param('gsmg', 'mainp_pr')) . "</priority>";
$output .= "<lastmod>" . $lm['pd'] . "</lastmod>";
$output .= "<changefreq>daily</changefreq>";
$output .= "</url>";
}
}
}
// Надо ли выводить данные по категориям
if (extra_get_param('gsmg', 'cat')) {
foreach ($catmap as $id => $altname) {
$output .= "<url>";
$output .= "<loc>" . generateLink('news', 'by.category', array('category' => $altname, 'catid' => $id), array(), false, true) . "</loc>";
$output .= "<priority>" . floatval(extra_get_param('gsmg', 'cat_pr')) . "</priority>";
$output .= "<lastmod>" . $lm['pd'] . "</lastmod>";
$output .= "<changefreq>daily</changefreq>";
$output .= "</url>";
if (extra_get_param('gsmg', 'catp')) {
$cn = $catz[$altname]['number'] > 0 ? $catz[$altname]['number'] : $config['number'];
$pages = ceil($catz[$altname]['posts'] / $cn);
for ($i = 2; $i <= $pages; $i++) {
$output .= "<url>";
$output .= "<loc>" . generateLink('news', 'by.category', array('category' => $altname, 'catid' => $id, 'page' => $i), array(), false, true) . "</loc>";
$output .= "<priority>" . floatval(extra_get_param('gsmg', 'catp_pr')) . "</priority>";
$output .= "<lastmod>" . $lm['pd'] . "</lastmod>";
$output .= "<changefreq>daily</changefreq>";
$output .= "</url>";
}
}
}
}
// Надо ли выводить данные по новостям
if (extra_get_param('gsmg', 'news')) {
$query = "select id, postdate, author, author_id, alt_name, editdate, catid from " . prefix . "_news where approve = 1 order by id desc";
foreach ($mysql->select($query, 1) as $rec) {
$link = newsGenerateLink($rec, false, 0, true);
$output .= "<url>";
$output .= "<loc>" . $link . "</loc>";
$output .= "<priority>" . floatval(extra_get_param('gsmg', 'news_pr')) . "</priority>";
$output .= "<lastmod>" . strftime("%Y-%m-%d", max($rec['editdate'], $rec['postdate'])) . "</lastmod>";
$output .= "<changefreq>daily</changefreq>";
$output .= "</url>";
}
}
// Надо ли выводить данные по статическим страницам
if (extra_get_param('gsmg', 'static')) {
$query = "select id, alt_name from " . prefix . "_static where approve = 1";
foreach ($mysql->select($query, 1) as $rec) {
$link = generatePluginLink('static', '', array('altname' => $rec['alt_name'], 'id' => $rec['id']), array(), false, true);
$output .= "<url>";
$output .= "<loc>" . $link . "</loc>";
$output .= "<priority>" . floatval(extra_get_param('gsmg', 'static_pr')) . "</priority>";
$output .= "<lastmod>" . $lm['pd'] . "</lastmod>";
$output .= "<changefreq>weekly</changefreq>";
$output .= "</url>";
}
}
if (is_array($PFILTERS['gsmg'])) {
foreach ($PFILTERS['gsmg'] as $k => $v) {
$v->onShow($output);
}
}
$output .= "</urlset>";
print $output;
cacheStoreFile('gsmg.txt', $output, 'gsmg');
//.........这里部分代码省略.........
开发者ID:irbees2008,项目名称:ngcms_eshop,代码行数:101,代码来源:gsmg.php
示例10: automation
function automation()
{
global $tpl, $mysql, $twig;
$tpath = locatePluginTemplates(array('config/main', 'config/automation'), 'eshop', 1);
if (isset($_REQUEST['yml_url']) && !empty($_REQUEST['yml_url']) && isset($_REQUEST['import'])) {
import_yml($_REQUEST['yml_url']);
//$import_str = implode('<br/>',$_SESSION['import_yml']);
//$info = "Импорт YML успешно завершен<br/><br/>".$import_str;
$info = "Импорт YML успешно завершен";
msg(array("type" => "info", "info" => $info));
}
if (isset($_REQUEST['currency'])) {
$rates_str = update_currency();
$info = "Валюты обновлены<br/><br/>" . $rates_str;
msg(array("type" => "info", "info" => $info));
}
if (isset($_REQUEST['change_price'])) {
$change_price_type = intval($_REQUEST['change_price_type']);
$change_price_qnt = intval($_REQUEST['change_price_qnt']);
update_prices($change_price_type, $change_price_qnt);
$info = "Цены обновлены<br/>";
msg(array("type" => "info", "info" => $info));
}
if (isset($_REQUEST['export_csv'])) {
$SUPRESS_TEMPLATE_SHOW = 1;
$SUPRESS_MAINBLOCK_SHOW = 1;
require_once dirname(__FILE__) . '/csv_lib/CsvImportInterface.php';
require_once dirname(__FILE__) . '/csv_lib/CsvImport.php';
require_once dirname(__FILE__) . '/csv_lib/CsvExportInterface.php';
require_once dirname(__FILE__) . '/csv_lib/CsvExport.php';
$export = new CsvExport();
$cat_array = array();
foreach ($mysql->select('SELECT * FROM ' . prefix . '_eshop_categories ORDER BY position ASC') as $cat_row) {
$catlink = checkLinkAvailable('eshop', '') ? generateLink('eshop', '', array('cat' => $cat_row['id'])) : generateLink('core', 'plugin', array('plugin' => 'eshop'), array('cat' => $cat_row['id']));
$cat_array[] = array('id' => $cat_row['id'], 'url' => $cat_row['url'], 'image' => $cat_row['image'], 'name' => $cat_row['name'], 'description' => $cat_row['description'], 'parent_id' => $cat_row['parent_id'], 'position' => $cat_row['position'], 'meta_title' => $cat_row['meta_title'], 'meta_keywords' => $cat_row['meta_keywords'], 'meta_description' => $cat_row['meta_description'], 'link' => $catlink);
}
$conditions = array();
array_push($conditions, "p.active = 1");
//$limitCount = "10000";
$fSort = " GROUP BY p.id ORDER BY p.id DESC ";
$sqlQPart = "FROM " . prefix . "_eshop_products p LEFT JOIN " . prefix . "_eshop_products_categories pc ON p.id = pc.product_id LEFT JOIN " . prefix . "_eshop_categories c ON pc.category_id = c.id " . (count($conditions) ? "WHERE " . implode(" AND ", $conditions) : '') . $fSort;
$sqlQ = "SELECT p.id AS id, p.url AS url, p.code AS code, p.name AS name, p.annotation AS annotation, p.body AS body, p.active AS active, p.featured AS featured, p.stocked AS stocked, p.position AS position, p.meta_title AS meta_title, p.meta_keywords AS meta_keywords, p.meta_description AS meta_description, p.date AS date, p.editdate AS editdate, p.views AS views, c.id AS cid, c.name AS category " . $sqlQPart;
$entries = array();
foreach ($mysql->select($sqlQ) as $row) {
$entriesImg = array();
foreach ($mysql->select('SELECT * FROM ' . prefix . '_eshop_images i WHERE i.product_id = ' . $row['id'] . ' ') as $row2) {
$entriesImg[] = $row2['filepath'];
}
$entriesVariants = array();
foreach ($mysql->select('SELECT * FROM ' . prefix . '_eshop_variants v WHERE v.product_id = ' . $row['id'] . ' ') as $vrow) {
$entriesVariants[] = $vrow;
}
$options_array = array();
foreach ($mysql->select("SELECT * FROM " . prefix . "_eshop_options LEFT JOIN " . prefix . "_eshop_features ON " . prefix . "_eshop_features.id=" . prefix . "_eshop_options.feature_id WHERE " . prefix . "_eshop_options.product_id = " . $row['id'] . " ORDER BY position, id") as $orow) {
$options_array[$orow['id']] = $orow['value'];
}
$xf_name_id = array();
$features_array = array();
foreach ($mysql->select("SELECT * FROM " . prefix . "_eshop_features ORDER BY position, id") as $frow) {
$frow['value'] = $options_array[$frow['id']];
$frow['foptions'] = json_decode($frow['foptions'], true);
foreach ($frow['foptions'] as $key => $value) {
$frow['foptions'][$key] = iconv("utf-8", "windows-1251", $value);
}
$features_array["xfields_" . $frow['name']] = $frow['value'];
$xf_name_id[$frow['name']] = $frow['id'];
}
$images_comma_separated = implode(",", $entriesImg);
$entry = array();
$entry = array('id' => $row['id'], 'code' => $row['code'], 'url' => $row['url'], 'name' => $row['name'], 'variants' => $entriesVariants, 'annotation' => $row['annotation'], 'body' => $row['body'], 'active' => $row['active'], 'featured' => $row['featured'], 'stocked' => $row['stocked'], 'meta_title' => $row['meta_title'], 'meta_keywords' => $row['meta_keywords'], 'meta_description' => $row['meta_description'], 'date' => empty($row['date']) ? '' : $row['date'], 'editdate' => empty($row['editdate']) ? '' : $row['editdate'], 'cat_name' => $row['category'], 'cid' => $row['cid'], 'images' => $images_comma_separated);
foreach ($features_array as $fk => $fv) {
$entry[$fk] = $fv;
}
$entries[] = $entry;
}
$count = 0;
foreach ($entries as $entry) {
foreach ($entry['variants'] as $variant) {
$entry_row = array();
$entry_row = $entry;
unset($entry_row['variants']);
$entry_row['v_id'] = $variant['id'];
$entry_row['v_sku'] = $variant['sku'];
$entry_row['v_name'] = $variant['name'];
$entry_row['v_price'] = $variant['price'];
$entry_row['v_compare_price'] = $variant['compare_price'];
$entry_row['v_stock'] = $variant['stock'];
$entry_row['v_amount'] = $variant['amount'];
if ($count == 0) {
$export->setHeader(array_keys($entry_row));
}
$count += 1;
$export->append(array($entry_row));
unset($entry_row);
}
}
$export->export('products.csv', ';');
die;
}
if (isset($_REQUEST['import_csv'])) {
//.........这里部分代码省略.........
开发者ID:stdex,项目名称:ngcms_eshop,代码行数:101,代码来源:config.php
示例11: generateLink
$remove = generateLink("Remove", buildTextbookLink($bookRef, "core/remove.php"));
$action = '';
//Chooses what action to display and links them correctly
if ($result[$i]['CategoryId'] == "2") {
if ($result[$i]['State'] == "Active") {
$action = generateLink("Borrowed", buildTextbookLink($bookRef, "core/updateState.php") . "&action=borrowed");
} elseif ($result[$i]['State'] != 'Hidden') {
$action = generateLink("UnBorrow", buildTextbookLink($bookRef, "core/updateState.php") . "&action=unborrow");
}
} elseif ($result[$i]['CategoryId'] == "1") {
if ($result[$i]['State'] == "Active") {
$action = generateLink("Swaped", buildTextbookLink($bookRef, "core/updateState.php") . "&action=swapped");
} elseif ($result[$i]['State'] != 'Hidden') {
$action = generateLink("UnSwap", buildTextbookLink($bookRef, "core/updateState.php") . "&action=unswap");
}
} elseif ($result[$i]['CategoryId'] == "0") {
if ($result[$i]['State'] == "Active") {
$action = generateLink("Sold", buildTextbookLink($bookRef, "core/updateState.php") . "&action=sold");
} elseif ($result[$i]['State'] != 'Hidden') {
$action = generateLink("UnSell", buildTextbookLink($bookRef, "core/updateState.php") . "&action=unsell");
}
}
if ($result[$i]['State'] == "Active") {
$hide = generateLink("Hide", buildTextbookLink($bookRef, "core/updateState.php") . "&action=hide");
} elseif ($result[$i]['State'] == "Hidden") {
$hide = generateLink("Activate", buildTextbookLink($bookRef, "core/updateState.php") . "&action=active");
} else {
$hide = "";
}
echo '<tr><td>' . $bookRef . '</td><td>' . $result[$i]['Title'] . '</td><td>' . $result[$i]['ISBN'] . '</td><td>' . $result[$i]['Subject'] . '</td><td>' . $result[$i]['Edition'] . '</td><td>' . $conditions[$result[$i]['CondId']]['Condname'] . '</td><td>' . $categories[$result[$i]['CategoryId']]['CategoryName'] . '</td><td>' . $result[$i]['State'] . '</td><td>' . $view . ' ' . $remove . ' ' . $action . ' ' . $hide . '</td></tr>';
}
开发者ID:HandsomeMustache,项目名称:IFB299-team70,代码行数:31,代码来源:retrieveMyTextbooks.php
示例12: breadcrumbs
function breadcrumbs()
{
global $lang, $catz, $catmap, $template, $CurrentHandler, $config, $SYSTEM_FLAGS, $tpl, $systemAccessURL, $twig;
$tpath = locatePluginTemplates(array('breadcrumbs'), 'breadcrumbs', pluginGetVariable('breadcrumbs', 'template_source'));
$location = array();
$location_last = '';
# processing 404 page
if ($SYSTEM_FLAGS['info']['title']['group'] == $lang['404.title']) {
$link = str_replace(array('{home_url}', '{home_title}'), array($config['home_url'], $lang['bc:mainpage']), $lang['bc:page_404']);
$location[] = array('url' => $config['home_url'], 'title' => $lang['bc:mainpage'], 'link' => $link);
$location_last = $lang['404.title'];
} else {
if ($CurrentHandler) {
$params = $CurrentHandler['params'];
$pluginName = $CurrentHandler['pluginName'];
}
# generate main page with or without link
$main_page = $systemAccessURL != '/' ? str_replace(array('{home_url}', '{home_title}'), array($config['home_url'], $lang['bc:mainpage']), $lang['bc:page_404']) : $lang['bc:mainpage'];
$location[] = array('url' => $systemAccessURL != '/' ? $config['home_url'] : '', 'title' => $systemAccessURL != '/' ? $lang['bc:mainpage'] : $lang['bc:mainpage'], 'link' => $main_page);
$location_last = $main_page;
# if category
if ($CurrentHandler['handlerName'] == 'by.category') {
$location_last = GetCategories($catz[$params['category']]['id'], true);
# show full path [if requested]
if ($catz[$params['category']]['parent'] != 0 && !pluginGetVariable('breadcrumbs', 'block_full_path')) {
$id = $catz[$params['category']]['parent'];
do {
$location_tmp[] = array('url' => generateLink('news', 'by.category', array('category' => $catz[$params['category']]['alt'], 'catid' => $catz[$params['category']]['id'])), 'title' => $catz[$params['category']]['name'], 'link' => GetCategories($id, false));
$id = $catz[$catmap[$id]]['parent'];
} while ($id != 0);
$location = array_merge($location, array_reverse($location_tmp));
}
} elseif ($params['year']) {
# if we have only year then $year = plain text, if we have month then $year = link
$year = !$params['month'] ? $params['year'] : str_replace(array('{year_url}', '{year}'), array(generateLink('news', 'by.year', array('year' => $params['year'])), $params['year']), $lang['bc:by.year']);
$month_p = LangDate("F", mktime(0, 0, 0, $params['month'], 7, 0));
# if we have only year and month then $month = plain text, if we have day then $month = link
$month = !$params['day'] ? $month_p : str_replace(array('{month_url}', '{month_p}'), array(generateLink('news', 'by.month', array('year' => $params['year'], 'month' => $params['month'])), $month_p), $lang['bc:by.month']);
$day = $params['day'];
$location_last = $year;
if ($params['month']) {
$location[] = array('url' => !$params['month'] ? '' : generateLink('news', 'by.year', array('year' => $params['year'])), 'title' => !$params['month'] ? $params['year'] : $params['year'], 'link' => $year);
$location_last = $month;
}
if ($params['day']) {
$location[] = array('url' => !$params['day'] ? '' : generateLink('news', 'by.month', array('year' => $params['year'], 'month' => $params['month'])), 'title' => !$params['day'] ? $month_p : $month_p, 'link' => $month);
$location_last = $day;
}
# plugin, static, etc.
} elseif ($pluginName != 'news') {
if ($pluginName == "static") {
$location_last = $SYSTEM_FLAGS['info']['title']['item'];
} elseif ($pluginName == 'uprofile' && $CurrentHandler['handlerName'] == 'edit' || $pluginName == 'search') {
$location_last = $SYSTEM_FLAGS['info']['title']['group'];
} elseif ($pluginName == 'uprofile' && $CurrentHandler['handlerName'] == 'show') {
$location_last = $SYSTEM_FLAGS['info']['title']['group'] . ' ' . $SYSTEM_FLAGS['info']['title']['item'];
} elseif ($pluginName == 'core' && in_array($CurrentHandler['handlerName'], array('registration', 'lostpassword', 'login'))) {
$location_last = $SYSTEM_FLAGS['info']['title']['group'];
} elseif ($params['plugin'] || $pluginName) {
# if plugin provide put some info
if ($SYSTEM_FLAGS['info']['breadcrumbs']) {
# plugin name becomes link
$count = count($SYSTEM_FLAGS['info']['breadcrumbs']) - 1;
# all items except last become links
for ($i = 0; $i < $count; $i++) {
$link = str_replace(array('{plugin_url}', '{plugin}'), array($SYSTEM_FLAGS['info']['breadcrumbs'][$i]['link'], $SYSTEM_FLAGS['info']['breadcrumbs'][$i]['text']), $lang['bc:plugin']);
$location[] = array('url' => $SYSTEM_FLAGS['info']['breadcrumbs'][$i]['link'], 'title' => $SYSTEM_FLAGS['info']['breadcrumbs'][$i]['text'], 'link' => $link);
}
# last item becomes plain text
$location_last = $SYSTEM_FLAGS['info']['breadcrumbs'][$i]['text'];
} else {
$link = str_replace(array('{plugin_url}', '{plugin}'), array(generatePluginLink($params['plugin'], '', array(), array(), false, true), $SYSTEM_FLAGS['info']['title']['group'] != $lang['loc_plugin'] ? $SYSTEM_FLAGS['info']['title']['group'] : $params['plugin']), $lang['bc:plugin']);
$location[] = array('url' => generatePluginLink($params['plugin'], '', array(), array(), false, true), 'title' => $SYSTEM_FLAGS['info']['title']['group'] != $lang['loc_plugin'] ? $SYSTEM_FLAGS['info']['title']['group'] : $params['plugin'], 'link' => $link);
if ($SYSTEM_FLAGS['info']['title']['group'] != $lang['loc_plugin']) {
$location_last = $SYSTEM_FLAGS['info']['title']['group'];
} else {
$location_last = $params['plugin'];
}
}
}
# full news
} elseif ($CurrentHandler['pluginName'] == 'news' && $CurrentHandler['handlerName'] == 'news') {
$catids = $SYSTEM_FLAGS['news']['db.categories'];
$location_last = $SYSTEM_FLAGS['info']['title']['item'];
if (count($catids) != 1 || pluginGetVariable('breadcrumbs', 'block_full_path')) {
if ($CurrentHandler['params']['category'] != 'none') {
foreach ($catids as $cid) {
foreach ($catz as $cc) {
if ($cc['id'] == $cid) {
$location[] = array('url' => generateLink('news', 'by.category', array('category' => $cc['alt'], 'catid' => $cc['id'])), 'title' => $cc['name'], 'link' => GetCategories($cc['id'], false));
}
}
}
}
} else {
$id = $catz[$params['category']]['parent'];
$location_tmp[] = array('url' => generateLink('news', 'by.category', array('category' => $catz[$params['category']]['alt'], 'catid' => $catz[$params['category']]['id'])), 'title' => $catz[$params['category']]['name'], 'link' => GetCategories($catz[$params['category']]['id'], false));
while ($id != 0) {
foreach ($catz as $cc) {
if ($cc['id'] == $id) {
//.........这里部分代码省略.........
开发者ID:irbees2008,项目名称:ngcms_eshop,代码行数:101,代码来源:breadcrumbs.php
示例13: main_prd
function main_prd($params)
{
global $tpl, $template, $twig, $SYSTEM_FLAGS, $config, $userROW, $mysql, $twigLoader;
$results = array();
$params = arrayCharsetConvert(1, $params);
$number = $params['number'];
$mode = $params['mode'];
$cat = $params['cat'];
$overrideTemplateName = $params['template'];
$prd_per_page = $number;
$page = $params['page'];
switch ($params['action']) {
// **** ADD NEW ITEM INTO compare ****
case 'show':
$conditions = array();
if (isset($cat) && !empty($cat)) {
array_push($conditions, "c.id IN (" . $cat . ") ");
}
array_push($conditions, "p.active = 1");
if ($number < 1 || $number > 100) {
$number = 5;
}
switch ($mode) {
case 'view':
$orderby = " ORDER BY p.view DESC ";
break;
case 'last':
$orderby = " ORDER BY p.editdate DESC ";
break;
case 'stocked':
array_push($conditions, "p.stocked = 1");
$orderby = " ORDER BY p.editdate DESC ";
break;
case 'featured':
array_push($conditions, "p.featured = 1");
$orderby = " ORDER BY p.editdate DESC ";
break;
case 'rnd':
$cacheDisabled = true;
$orderby = " ORDER BY RAND() DESC ";
break;
default:
$mode = 'last';
$orderby = " ORDER BY p.editdate DESC ";
break;
}
$fSort = " " . $orderby;
$sqlQPart = "FROM " . prefix . "_eshop_products p LEFT JOIN " . prefix . "_eshop_products_categories pc ON p.id = pc.product_id LEFT JOIN " . prefix . "_eshop_categories c ON pc.category_id = c.id " . (count($conditions) ? "WHERE " . implode(" AND ", $conditions) : '') . $fSort;
$sqlQCount = "SELECT COUNT(p.id) " . $sqlQPart;
$sqlQ = "SELECT p.id AS id, p.url as url, p.code AS code, p.name AS name, p.annotation AS annotation, p.body AS body, p.active AS active, p.featured AS featured, p.stocked AS stocked, p.position AS position, p.meta_title AS meta_title, p.meta_keywords AS meta_keywords, p.meta_description AS meta_description, p.date AS date, p.editdate AS editdate, p.views AS views, c.id AS cid, c.url as curl, c.name AS category " . $sqlQPart;
$entries = array();
$pageNo = intval($page) ? $page : 0;
if ($pageNo < 1) {
$pageNo = 1;
}
if (!$start_from) {
$start_from = ($pageNo - 1) * $prd_per_page;
}
$count = $mysql->result($sqlQCount);
$countPages = ceil($count / $prd_per_page);
$cmp_array = array();
foreach ($SYSTEM_FLAGS["eshop"]["compare"]["entries"] as $cmp_row) {
$cmp_array[] = $cmp_row['linked_fld'];
}
foreach ($mysql->select($sqlQ . ' LIMIT ' . $start_from . ', ' . $prd_per_page) as $row) {
$fulllink = checkLinkAvailable('eshop', 'show') ? generateLink('eshop', 'show', array('alt' => $row['url'])) : generateLink('core', 'plugin', array('plugin' => 'eshop', 'handler' => 'show'), array('alt' => $row['url']));
$catlink = checkLinkAvailable('eshop', '') ? generateLink('eshop', '', array('alt' => $row['curl'])) : generateLink('core', 'plugin', array('plugin' => 'eshop'), array('alt' => $row['curl']));
$cmp_flag = in_array($row['id'], $cmp_array);
$entries[$row['id']] = array('id' => $row['id'], 'code' => $row['code'], 'name' => $row['name'], 'annotation' => $row['annotation'], 'body' => $row['body'], 'active' => $row['active'], 'featured' => $row['featured'], 'meta_title' => $row['meta_title'], 'meta_keywords' => $row['meta_keywords'], 'meta_description' => $row['meta_description'], 'fulllink' => $fulllink, 'date' => empty($row['date']) ? '' : $row['date'], 'editdate' => empty($row['editdate']) ? '' : $row['editdate'], 'views' => $row['views'], 'cat_name' => $row['category'], 'cid' => $row['cid'], 'catlink' => $catlink, 'compare' => $cmp_flag, 'home' => home, 'tpl_url' => home . '/templates/' . $config['theme']);
}
$entries_array_ids = array_keys($entries);
if (isset($entries_array_ids) && !empty($entries_array_ids)) {
$entries_string_ids = implode(',', $entries_array_ids);
foreach ($mysql->select('SELECT * FROM ' . prefix . '_eshop_images i WHERE i.product_id IN (' . $entries_string_ids . ') ORDER BY i.position, i.id') as $irow) {
$entries[$irow['product_id']]['images'][] = $irow;
}
foreach ($mysql->select('SELECT * FROM ' . prefix . '_eshop_variants v WHERE v.product_id IN (' . $entries_string_ids . ') ORDER BY v.position, v.id') as $vrow) {
$entries[$vrow['product_id']]['variants'][] = $vrow;
}
}
$tVars = array('info' => isset($info) ? $info : '', 'entries' => isset($entries) ? $entries : '', 'tpl_url' => home . '/templates/' . $config['theme'], 'tpl_home' => admin_url);
if ($overrideTemplateName) {
$templateName = 'block/' . $overrideTemplateName;
} else {
$templateName = 'block/main_block_eshop';
|
请发表评论