当前位置: 首页>>代码示例>>PHP>>正文


PHP buildQuery函数代码示例

本文整理汇总了PHP中buildQuery函数的典型用法代码示例。如果您正苦于以下问题:PHP buildQuery函数的具体用法?PHP buildQuery怎么用?PHP buildQuery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了buildQuery函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __initialize

 function __initialize()
 {
     parent::__initialize();
     $ds = model_datasource('system');
     $ds->ExecuteSql("CREATE TABLE IF NOT EXISTS blog(id INTEGER,title VARCHAR(50),body TEXT,PRIMARY KEY(id))");
     $this->content(new Anchor(buildQuery('blog', 'newpost'), 'New post'));
 }
开发者ID:Naveenr9,项目名称:WebFramework,代码行数:7,代码来源:blog.class.php

示例2: __initialize

 /**
  * @param string $culture_code Culture code (see <CultureInfo>)
  * @param mixed $selected_date_format The currently selected date format or false
  * @param mixed $selected_time_format The currently selected time format or false
  * @param string $timezone Timezone identifier or false
  */
 function __initialize($culture_code, $selected_date_format = false, $selected_time_format = false, $timezone = false)
 {
     parent::__initialize();
     $this->script("Locale_Settings_Init();");
     $this->setData('role', 'datetimeformat');
     $this->setData('controller', buildQuery($this->id));
     $this->culture_code = $culture_code;
     if ($selected_date_format || $selected_time_format) {
         $this->SetCurrentValue(json_encode(array($selected_date_format ? $selected_date_format : false, $selected_time_format ? $selected_time_format : false)));
     }
     $df = array(DateTimeFormat::DF_LONGDATE, DateTimeFormat::DF_SHORTDATE, DateTimeFormat::DF_MONTHDAY, DateTimeFormat::DF_YEARMONTH);
     $tf = array(DateTimeFormat::DF_LONGTIME, DateTimeFormat::DF_SHORTTIME);
     $value = time();
     $ci = Localization::getCultureInfo($culture_code);
     if ($timezone) {
         $ci->SetTimezone($timezone);
         $value = $ci->GetTimezoneDate($value);
     }
     $dtf = $ci->DateTimeFormat;
     foreach ($df as $d) {
         foreach ($tf as $t) {
             $sv = $dtf->Format($value, $d) . " " . $dtf->Format($value, $t);
             $this->AddOption(json_encode(array($d, $t)), $sv);
         }
     }
 }
开发者ID:Naveenr9,项目名称:WebFramework,代码行数:32,代码来源:datetimeformatselect.class.php

示例3: __initialize

 /**
  * @param string $culture_code Code of current <CultureInfo>
  * @param mixed $date_format Chosen date format
  * @param mixed $time_format Chosen time format
  * @param string $timezone Currently chosen timezone
  * @param bool $append_timezone If true timezome will be appended
  */
 function __initialize($culture_code, $date_format, $time_format, $timezone = false, $append_timezone = false)
 {
     parent::__initialize();
     $this->script("Locale_Settings_Init();");
     store_object($this);
     if (!$timezone) {
         $timezone = Localization::getTimeZone();
     }
     $this->timezone = $timezone;
     $this->culture_code = $culture_code;
     $txt = $this->_sample(false, $date_format, $time_format);
     if ($append_timezone) {
         $txt .= " {$timezone}";
     }
     $sample = new Control('span');
     $sample->append("({$txt})")->css('color', 'gray');
     $cb = new CheckBox();
     $cb->setData('role', 'timeformatex')->setData('controller', buildQuery($this->id));
     $cb->value = 1;
     if ($append_timezone) {
         $cb->checked = "checked";
     }
     $lab = $cb->CreateLabel(tds("TXT_APPEND_TIMEZONE", "Append timezone") . " ");
     $lab->content($sample);
     $this->append($cb)->append($lab);
 }
开发者ID:Naveenr9,项目名称:WebFramework,代码行数:33,代码来源:timeformatex.class.php

示例4: Details

 /**
  * Shows product details
  * @attribute[RequestParam('id','int')]
  */
 function Details($id)
 {
     // check if product really exists
     $ds = model_datasource('system');
     $prod = $ds->Query('products')->eq('id', $id)->current();
     if (!$prod) {
         redirect('Products', 'Index', array('error' => 'Product not found'));
     }
     // create a template with product details
     $this->content(Template::Make('product_details'))->set('title', $prod->title)->set('description', $prod->body)->set('image', resFile($prod->image))->set('link', buildQuery('Basket', 'Add', array('id' => $prod->id)));
 }
开发者ID:Naveenr9,项目名称:WebFramework,代码行数:15,代码来源:products.class.php

示例5: __initialize

 /**
  * @param mixed $current_language_code Currently selected language
  * @param type $current_region_code Currently selected region
  */
 function __initialize($current_language_code = false, $current_region_code = false)
 {
     parent::__initialize();
     $this->script("Locale_Settings_Init();");
     $this->setData('role', 'region');
     $this->setData('controller', buildQuery($this->id));
     if ($current_language_code) {
         if ($current_language_code instanceof CultureInfo) {
             $lang = $current_language_code->ResolveToLanguage();
         } else {
             $lang = Localization::getLanguageCulture($current_language_code);
         }
         if (!$lang) {
             $lang = Localization::detectCulture()->ResolveToLanguage();
         }
         $regions = $lang->GetRegions(false);
         if (!$current_region_code) {
             $current_region_code = $lang->DefaultRegion()->Code;
         }
     } else {
         $regions = Localization::get_all_regions(false);
     }
     if ($current_region_code) {
         if ($current_region_code instanceof CultureInfo) {
             $this->SetCurrentValue($current_region_code->DefaultRegion()->Code);
         } else {
             $this->SetCurrentValue($current_region_code);
         }
     }
     if (count($regions) > 0) {
         $cc = current_controller(false);
         $translations_active = $cc instanceof Renderable && $cc->_translate;
         $sorted = array();
         foreach ($regions as $reg) {
             if (!$reg) {
                 continue;
             }
             $code = $reg->Code;
             if ($translations_active) {
                 $sorted[$code] = array("name" => tds("TXT_COUNTRY_" . strtoupper($code), $reg->EnglishName), "code", $code);
             } else {
                 $sorted[$code] = array("name" => $reg->EnglishName, "code", $code);
             }
         }
         uasort($sorted, __CLASS__ . "::compareCountryNames");
         foreach ($sorted as $code => $item) {
             $this->AddOption($code, $item['name']);
         }
     }
 }
开发者ID:Naveenr9,项目名称:WebFramework,代码行数:54,代码来源:regionselect.class.php

示例6: __initialize

 /**
  * @param string $currency_code A valid currency code
  * @param mixed $selected_format The currently selected format
  */
 function __initialize($currency_code, $selected_format = false)
 {
     parent::__initialize();
     $this->script("Locale_Settings_Init();");
     $this->setData('role', 'currenyformat');
     $this->setData('controller', buildQuery($this->id));
     if ($selected_format) {
         $this->SetCurrentValue($selected_format);
     }
     $samples = $this->getCurrencySamples($currency_code, 1234.56, true);
     foreach ($samples as $code => $label) {
         $this->AddOption($code, $label);
     }
 }
开发者ID:Naveenr9,项目名称:WebFramework,代码行数:18,代码来源:currencyformatselect.class.php

示例7: Linked

 /**
  * @attribute[RequestParam('f','string')]
  */
 function Linked($f)
 {
     if ($f) {
         $md = file_get_contents(__DIR__ . "/out/{$f}.md");
     } else {
         $md = "# Scavix WDF Home\n- [Alphabetical function listing](functions)\n- [Alphabetical class listing](classes)\n- [Inheritance tree](inheritance)\n- [Interfaces](interfaces)\n- [Folder tree](foldertree)\n- [Namespace tree](namespacetree)";
     }
     $q = buildQuery('Preview', 'Linked');
     $s = "\$('.markdown-body').html(marked(" . json_encode($md) . "));";
     $s .= "\$('.markdown-body a[id]').each(function(){ \$(this).attr('id','wiki-'+\$(this).attr('id')); });";
     $s .= "\$('.markdown-body a[href]').each(function(){ if( \$(this).attr('href').match(/^http/)) return; \$(this).attr('href','{$q}?f='+\$(this).attr('href')); });";
     $s .= "\$('.markdown-body a[id='+location.hash.substr(1)+']').get(0).scrollIntoView();";
     $this->addDocReady("{$s}");
 }
开发者ID:Naveenr9,项目名称:WebFramework,代码行数:17,代码来源:preview.class.php

示例8: mysqlQuery

function mysqlQuery($config, $request, $report)
{
    $mysql = mysqlAccess($config);
    $start_time = getMicrotime();
    //		$show_time = true;
    if (!isset($request['mode'])) {
        $request['mode'] = 'SELECT';
    }
    $request['model'] = $GLOBALS['model'][$GLOBALS['controller']]['model'];
    if ($GLOBALS['debug'] == true) {
        print_r($request);
    }
    $db_result = buildQuery($mysql, $request, $start_time, $report);
    // Return MySQL query result and query:
    return array('result' => $db_result['result'], 'query' => $db_result['query']);
    // Close MySQL connection:
    $mysql->close();
}
开发者ID:chogsden,项目名称:file-browser,代码行数:18,代码来源:functions.php

示例9: buildQuery

function buildQuery($data, $separator = '&amp;', $key = '')
{
    if (is_object($data)) {
        $data = get_object_vars($data);
    }
    $p = array();
    foreach ($data as $k => $v) {
        $k = urlencode($k);
        if (!empty($key)) {
            $k = $key . '[' . $k . ']';
        }
        if (is_array($v) || is_object($v)) {
            $p[] = buildQuery($v, $separator, $k);
        } else {
            $p[] = $k . '=' . urlencode($v);
        }
    }
    return implode($separator, $p);
}
开发者ID:laiello,项目名称:suitex,代码行数:19,代码来源:utils.php

示例10: strrpos

$found_order = strrpos($query1, "order");
$target1 = buildTarget($query1);
$from1 = buildFrom($found_where, $found_group, $found_order, $query1);
$where1 = buildWhere($found_where, $found_group, $found_order, $query1);
$group1 = buildGroup($found_group, $found_order, $query1);
$order1 = buildOrder($found_order, $query1);
//******************************************************EXTRACTION 2
$found_group = strrpos($query2, "group");
$found_where = strrpos($query2, "where");
$found_order = strrpos($query2, "order");
$target2 = buildTarget($query2);
$from2 = buildFrom2($found_where, $found_group, $found_order, $query2);
$where2 = buildWhere($found_where, $found_group, $found_order, $query2);
$group2 = buildGroup($found_group, $found_order, $query2);
$order2 = buildOrder($found_order, $query2);
$query = buildQuery($cubetablenameB, $join_final, $target1, $target2, $from1, $from2, $where1, $where2, $group1, $group2, $order1, $order2);
$result = exec_query($query);
buildReport($result);
//*****************************************************************************************************************************************
function buildFrom($found_where, $found_group, $found_order, $query1)
{
    //FROM
    if ($found_where == true) {
        $a = eregi("from (.+) where", $query1, $regs);
    } elseif ($found_group == true) {
        $a = eregi("from (.+) group", $query1, $regs);
    } elseif ($found_order == true) {
        $a = eregi("from (.+) order", $query1, $regs);
    } else {
        $a = eregi("from (.+)\$", $query1, $regs);
    }
开发者ID:apmuthu,项目名称:phpMyOLAP,代码行数:31,代码来源:exec_across.php

示例11: buildQuery

 * Scavix Web Development Framework
 *
 * Copyright (c) since 2012 Scavix Software Ltd. & Co. KG
 *
 * This library is free software; you can redistribute it
 * and/or modify it under the terms of the GNU Lesser General
 * Public License as published by the Free Software Foundation;
 * either version 3 of the License, or (at your option) any
 * later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>
 *
 * @author Scavix Software Ltd. & Co. KG http://www.scavix.com <info@scavix.com>
 * @copyright since 2012 Scavix Software Ltd. & Co. KG
 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
 */
?>
<form action="<?php 
echo buildQuery('blog', 'addpost');
?>
" method="post">
	Title: <input type="text" name="title"/><br/>
	Text: <textarea name="body"></textarea><br/>
	<input type="submit" value="Create post"/>
</form>
开发者ID:Naveenr9,项目名称:WebFramework,代码行数:31,代码来源:newpostform.tpl.php

示例12: trim

<?php

include_once 'src/database-config.php';
if ($_REQUEST['qtype'] == 'search') {
    $rawquery = trim($_REQUEST['q']);
    $limit = $_REQUEST['page_limit'];
    $query = $rawquery;
    while (preg_match('/  /', $rawquery)) {
        $query = preg_replace('/  /', ' ', $rawquery);
        $rawquery = $query;
    }
    $sql = buildQuery($query, false);
    $jsonObject = array();
    $result = queryPostgres($sql);
    if (pg_num_rows($result) < 1) {
        $sql = buildQuery($query, true);
        $result = queryPostgres($sql);
    }
    while ($row = pg_fetch_object($result)) {
        $address = preg_replace('/~/', ' ', $row->address);
        $jsonObject[] = array('id' => $row->pid, 'text' => $address);
    }
    header('Content-type: application/json');
    echo json_encode($jsonObject);
} else {
    if ($_REQUEST['qtype'] == 'retrieve') {
        $query = trim($_REQUEST['address']);
        $sql = "select\n                to_char((now() - '1 day'::INTERVAL) - ((now()::date - SeedDate::date - 1)%days)*'1 day'::INTERVAL,'Day Mon FMDD, YYYY') as \"lastpickup\",\n                to_char((now() - '1 day'::INTERVAL) + ((Days) * '1 day'::INTERVAL)  - ((now()::date - SeedDate::date - 1)%days)*'1 day'::INTERVAL,'Day Mon FMDD, YYYY') as \"nextpickup\",\n\t\t\t\taddress,\n\t\t\t\tST_AsGeoJSON(ST_Transform(geom, 4326), 5) AS geom,\n                servicecode,\n                day,\n                week,\n                frequency,\n                containersdescription\nfrom dbo.\"WastePickup\"\nwhere PID = {$query}";
        $result = pg_query($dbConn, $sql);
        $addressObj = array();
        $servicesObj = array();
开发者ID:alexgleith,项目名称:maps-website,代码行数:31,代码来源:address-search.php

示例13: buildQuery

 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>
 *
 * @author Scavix Software Ltd. & Co. KG http://www.scavix.com <info@scavix.com>
 * @copyright since 2012 Scavix Software Ltd. & Co. KG
 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
 */
?>
<form id="frm_add_product" method="post" action="<?php 
echo buildQuery('Admin', 'AddProduct');
?>
" enctype="multipart/form-data">
	<table>
		<tr>
			<td>Title</td>
			<td><input type="text" name="title" value=""/></td>
		</tr>
		<tr>
			<td>Tagline</td>
			<td><input type="text" name="tagline" value=""/></td>
		</tr>
		<tr>
			<td>Description</td>
			<td><textarea name="body"></textarea></td>
		</tr>
开发者ID:Naveenr9,项目名称:WebFramework,代码行数:31,代码来源:admin_product_add.tpl.php

示例14: buildQuery

function buildQuery(&$node)
{
    if (!is_array($node) || count($node) < 1) {
        return;
    }
    $hasChild = count($node) > 1;
    if ($hasChild) {
        $sub .= "[";
    }
    $i = 0;
    foreach ($node as $key => $subnode) {
        $sub .= "{$key}";
        if (is_array($subnode) && count($subnode) >= 1) {
            $sub .= ".";
            $sub .= buildQuery($subnode);
        }
        if ($i < count($node) - 1) {
            $sub .= ",";
        }
        ++$i;
    }
    if ($hasChild) {
        $sub .= "]";
    }
    return $sub;
}
开发者ID:ryzom,项目名称:ryzomcore,代码行数:26,代码来源:display_view.php

示例15: getCatIdAndType

            $updated_session = [SessionOperator::SORT => $sort];
        } else {
            HelperOperator::redirectTo("../views/search_view.php");
            return;
        }
    }
}
$cats = getCatIdAndType($searchCategory);
// Set up pagination object
$total = QueryOperator::countFoundAuctions(buildQuery($searchString, $cats, null));
$page = isset($_GET["page"]) ? $_GET["page"] : 1;
$page = $page <= $total ? $page : 1;
$per_page = 15;
$pagination = new Pagination($page, $per_page, $total);
// Get paginated search results
$catsAndAuctions = QueryOperator::searchAuctions(buildQuery($searchString, $cats, $sort, $per_page, $pagination->offset()));
// Update search sessions
$updated_session = array_merge([SessionOperator::SEARCH_RESULT => $catsAndAuctions], $updated_session);
$updated_session = array_merge([SessionOperator::SEARCH_PAGINATION => $pagination], $updated_session);
SessionOperator::setSearch($updated_session);
// Return back to search page
HelperOperator::redirectTo("../views/search_view.php");
function buildQuery($searchString, $searchCategory, $sortOption, $limit = null, $offset = null)
{
    $query = null;
    // Prepare count query
    if (is_null($limit) && is_null($offset)) {
        $query = "SELECT COUNT(*) ";
    } else {
        $query = "SELECT auctions.auctionId, quantity, startPrice, reservePrice, startTime,\n            endTime, itemName, itemBrand, itemDescription, items.image, auctions.views,\n            item_categories.categoryName as subCategoryName, superCategoryName,\n            item_categories.superCategoryId, item_categories.categoryId,\n            conditionName, countryName, COUNT(DISTINCT (bids.bidId)) AS numBids,\n            COUNT(DISTINCT (auction_watches.watchId)) AS numWatches,\n            MAX(bids.bidPrice) AS highestBid,\n            case\n                when MAX(bids.bidPrice)is not null THEN MAX(bids.bidPrice)\n                else startPrice\n            end AS currentPrice ";
    }
开发者ID:Alex92rus,项目名称:COMP3013Databases,代码行数:31,代码来源:search.php


注:本文中的buildQuery函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。