本文整理汇总了PHP中aql::select方法的典型用法代码示例。如果您正苦于以下问题:PHP aql::select方法的具体用法?PHP aql::select怎么用?PHP aql::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aql
的用法示例。
在下文中一共展示了aql::select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: select
function select($aql = null, $clause = null)
{
if ($aql) {
$this->aql = $aql;
}
if ($clause) {
$this->clause = $clause;
}
//pagination settings
$default_limit = if_not($this->clause['default_limit'], 25);
if (!$_GET['limit' . $this->i]) {
$_GET['limit' . $this->i] = $default_limit;
}
$this->offset = $_GET['page' . $this->i] * $_GET['limit' . $this->i] - $_GET['limit' . $this->i];
$this->clause['limit'] = $_GET['limit' . $this->i];
$this->clause['offset'] = $this->offset;
$this->rs = aql::select($this->aql, $this->clause);
$this->first_row = $this->offset + 1;
$this->last_row = count($this->rs) + $this->first_row - 1;
$c = aql::sql($this->aql, $this->clause);
$c = sql($c['sql_count']);
$this->total_rows = $c->Fields('count');
$this->num_pages = ceil($this->total_rows / $_GET['limit' . $this->i]);
return $this->rs;
}
示例2: getList
public function getList($a = array())
{
//. category
//. seo_field
//. website_id
//. total_volume
//. page
//. name
//. order_by
$where = array();
if (is_array($a['where'])) {
foreach ($a['where'] as $w) {
$where[] = $w;
}
}
if ($a['category']) {
$where[] = "category = '" . addslashes($a['category']) . "'";
}
if ($a['seo_field']) {
$where[] = "seo_field = '" . addslashes($a['seo_field']) . "'";
}
if ($a['website_id']) {
$where[] = "website_id = " . $a['website_id'];
}
if ($a['total_volume']) {
$where[] = "total_volume >= " . $a['total_volume'];
}
if ($a['page']) {
$where[] = "page = '" . addslashes($a['page']) . "'";
}
if ($a['name']) {
$where[] = "name = '" . addslashes($a['name']) . "'";
}
if ($a['order_by']) {
$order_by = $a['order_by'];
}
$aql = "dup_phrase_group { }";
$clause = array("dup_phrase_group" => array("where" => $where, "order by" => $order_by));
$rs = aql::select($aql, $clause);
$ids = array();
foreach ($rs as $r) {
$ids[] = $r['dup_phrase_group_id'];
}
return $ids;
}
示例3: getList
public function getList($a = array())
{
//. category
//. sub_category
//. base
//. volume
//. holiday
//. keyword
$where = array();
if (is_array($a['where'])) {
foreach ($a['where'] as $w) {
$where[] = $w;
}
}
if ($a['category']) {
$where[] = "category = '" . addslashes($a['category']) . "'";
}
if ($a['sub_category']) {
$where[] = "sub_category = '" . addslashes($a['sub_category']) . "'";
}
if ($a['base']) {
$where[] = "base = '" . addslashes($a['base']) . "'";
}
if ($a['volume']) {
$where[] = "volume = " . $a['volume'];
}
if ($a['keyword']) {
$where[] = "keyword = '" . addslashes($a['keyword']) . "'";
}
if ($a['holiday']) {
$where[] = "holiday = '" . addslashes($a['holiday']) . "'";
}
if ($a['order_by']) {
$order_by = $a['order_by'];
}
$aql = "dup_phrase_data { }";
$clause = array("dup_phrase_data" => array("where" => $where, "order by" => $order_by));
$rs = aql::select($aql, $clause);
$ids = array();
foreach ($rs as $r) {
$ids[] = $r['dup_phrase_data_id'];
}
return $ids;
}
示例4: configure_perm
function configure_perm($sentences = array())
{
echo '<div class="has-floats" style="margin-bottom:15px;">';
echo '<div style="float:left; margin-right:10px;"><input type="checkbox" class="perm-box" s_order="';
$x = 0;
foreach ($sentences as $sentence_id) {
$x++;
echo $sentence_id;
if ($x != count($sentences)) {
echo ",";
}
}
echo '"/></div>';
echo '<div style="float:left;">';
foreach ($sentences as $sentence_id) {
$rs = aql::select("dup_sentence_data { sentence where id = " . $sentence_id . " } ");
echo $rs[0]['sentence'] . '<br>';
}
echo "</div></div>";
}
示例5: rgb
" value="<?php
echo $page['page_type'];
?>
" /><span style="font-size: 10px; color: rgb(0, 102, 0); margin-left: 4px; display: inline; " id="saved_1"></span></td>
<td>page_path = <?php
echo $page['page_path'];
?>
</td>
</tr>
</table>
<?php
// Insert the blank field records in the db for website_page fields that don't already exist
$y = 2;
foreach ($seo_field_array as $type => $field_array) {
foreach ($field_array as $field => $max) {
$rs2 = aql::select("website_page_data { id where field = '{$field}' and website_page_id = {$page['website_page_id']} }");
if (!$rs2) {
$data = array('field' => $field, 'website_id' => $website_id, 'website_page_id' => $page['website_page_id'], 'mod__person_id' => PERSON_ID);
aql::insert('website_page_data', $data);
}
}
if (!isset($header)) {
?>
<fieldset style="width:872px; background:#f3f3f3; margin-bottom:4px; border: 1px solid #ccc; padding:5px;">
<legend style="border: 1px solid #ccc; background:#ffffff; font-weight:bold; padding:2px 5px 2px 5px;"><?php
echo strtoupper(str_replace('_', ' ', $type));
?>
</legend>
<?php
$header = $type;
} else {
示例6: foreach
<?php
$SQL = "select id from market limit 1";
$r = $db->Execute($SQL);
if (!$db->ErrorMsg()) {
?>
<!-- Section for Market Start -->
<h2 class="module-bar">Market</h2>
<div class="module-body">
<div class="module-container">
<p>
<?php
#fetching all the market value
$aql_market = "market {\n * \n where market.primary = 1 \n\t\t\t\t\t\torder by market.name asc\n }";
$rs_market = aql::select($aql_market);
?>
<select name="market_id">
<?php
$selected = $rs_article[0]['market_id'] == "" ? "selected" : "";
?>
<option value="NULL" <?php
echo $selected;
?>
>National</option>
<?php
foreach ($rs_market as $market) {
$selected = $market['market_id'] == $rs_article[0]['market_id'] ? "selected" : "";
?>
<option value="<?php
echo $market['market_id'];
示例7: getUpcomingHolidays
function getUpcomingHolidays($date = NULL)
{
if (!$date) {
$date = time();
}
$year = date('Y');
$rs = aql::select("ct_holiday { slug, date where date is not null order by date_order asc }");
foreach ($rs as $r) {
if (strtotime($r['date'] . '/' . $year) > $date) {
$this_years_holidays[$r['slug']] = strtotime($r['date'] . '/' . $year);
} else {
$next_years_holidays[$r['slug']] = strtotime($r['date'] . '/' . ($year + 1));
}
}
return array_merge($this_years_holidays, $next_years_holidays);
}
示例8: array
<?php
$rs = aql::select("website_page_data { value where website_page_ide = '{$_POST['website_page_ide']}' and field = '{$_POST['field']}' }");
$data = array('value' => $_POST['value'], 'mod__person_id' => PERSON_ID, 'update_time' => 'now()');
if (is_numeric($rs[0]['website_page_data_id'])) {
$update = aql::update('website_page_data', $data, $rs[0]['website_page_data_ide']);
if ($update == true) {
echo 'saved';
} else {
echo 'error';
}
} else {
$data['website_page_id'] = decrypt($_POST['website_page_ide'], 'website_page');
$data['field'] = $_POST['field'];
$insert = aql::insert('website_page_data', $data);
if (is_numeric($insert['website_page_data_id'])) {
echo 'saved';
} else {
echo 'error';
}
}
示例9: array
</div>
</fieldset>
<?php
if ($media_item) {
$aql = "blog_article{\n\t\t\t\ttitle,\n\t\t\t\tintroduction,\n\t\t\t\tmedia_item_id as article__media_item_id\n\t\t\t}\n\t\t\tblog_media\t{\n\t\t\t\t\t\t\tmedia_item_id as blog_media__media_item_id\n\t\t\t\t\t\t}\n\t\t\tblog_article_tag{\n\t\t\t\tname\n\t\t\t\twhere blog_media.blog_article_id = {$blog_article_id}\n\t\t\t\t\tand blog_media.type = 'mebox'\n\t\t\t\torder by iorder asc\n\t\t\t\tlimit 1\n\t\t\t}";
$rs = aql::select($aql);
}
$settingss = array("transition" => "fade", "duration" => 4000, "height" => 322, "width" => 640, "height_small" => 62, "width_small" => 90);
?>
<fieldset>
<legend>Mediabox Preview</legend>
<?php
if ($rs) {
$rs[0]['media_item_id'] = $rs[0]['blog_media__media_item_id'] ? $rs[0]['blog_media__media_item_id'] : $rs[0]['article__media_item_id'];
$aql = "blog_media {\n media_item_id\n where blog_media.blog_article_id = {$rs[0]['blog_article_id']}\n and type = 'tnail'\n limit 1\n }";
$thumb = aql::select($aql);
$rs[0]['thumb__media_item_id'] = $thumb[0]['media_item_id'] ? $thumb[0]['media_item_id'] : $rs[0]['media_item_id'];
blog::marquee($rs, $settingss);
} else {
echo "No images have been uploaded yet";
}
?>
</fieldset>
<ul class="contextMenu" id="imageContextMenu">
<li>
<a href="#set_article">Add to article</a>
</li>
<li>
<a href="#delete">Delete</a>
</li>
示例10: permission
/**
* auth class
*
* Organization: Hotwire Communications
* Author: Harley Fischel
*/
public static function permission($params = null, $person_id = null)
{
$params = trim($params);
if (empty($params)) {
return false;
}
if (empty($person_id) && isset($_SESSION['login']['person_id'])) {
$person_id = $_SESSION['login']['person_id'];
}
// old method support
if (!strpos($params, ':')) {
$arr = explode(',', $params);
foreach ($arr as $arg) {
if (strpos(strtolower($_SESSION['login']['access_group']), strtolower($arg)) !== false) {
return true;
}
}
return false;
}
static $access, $key;
// new method
$perms = explode(';', $params);
foreach ($perms as $perm) {
list($group, $granted) = explode(':', $perm);
if (empty($group)) {
return false;
}
if (empty($key[$group])) {
$key[$group] = md5($group . $person_id);
}
if (empty($access[$key[$group]]) && !empty($person_id)) {
$rs = aql::select(" {$group} { id, access_group } ", array('where' => array(0 => ($group != 'person' ? 'person_' : '') . 'id=' . $person_id), 'limit' => 1));
$access[$key[$group]] = array_map(function ($str) {
return md5(trim(strtolower($str)));
}, explode(',', $rs[0]['access_group']));
// un-comment to see access array
// echo "<pre>md5:\n".print_r($access,true)."</pre>";
}
if ($granted == '*') {
return true;
}
if (is_array($access[$key[$group]])) {
if (in_array(md5($granted), $access[$key[$group]])) {
return true;
}
}
}
return false;
}
示例11: array
<div class="col">
<?php
$aql = "blog {\n\t\t\t\t\t \tid,\n\t\t\t\t\t\tname\n\t\t\t\t\t}\n\t\t\t\t\tblog_website {\n\t\t\t\t\t\twhere website_id = {$website_id}\n\t\t\t\t\t}";
$dropdown = array('select_name' => 'blog_id', 'value_field' => 'blog_id', 'option_field' => 'name', 'selected_value' => $_GET['blog_id'], 'null_option' => 'All Blogs', 'onchange' => 'this.form.submit();');
aql::dd($aql, $dropdown);
?>
</div>
<?php
if (auth('admin', 'developer', 'blog_editor')) {
?>
<div class="col">
<?php
$aql = "blog_author {\n\t\t\t\t\t\tperson_id\n\t\t\t\t\t\twhere website_id = {$website_id}\n\t\t\t\t\t}\n\t\t\t\t\tperson {\n\t\t\t\t\t\tfname,\n\t\t\t\t\t\tlname\n\t\t\t\t\t\torder by lname asc\n\t\t\t\t\t}";
$rs_author = aql::select($aql);
?>
<select name="author_ide" onchange="this.form.submit();">
<option value="">All Contributors</option>
<?php
if ($rs_author) {
foreach ($rs_author as $author) {
?>
<option value="<?php
echo $author['person_ide'];
?>
"
<?php
echo $author['person_ide'] == $_GET['author_ide'] ? 'selected="selected"' : '';
?>
>
示例12: sql_result
/**
* Executes the actual select query based on sql_array and settings,
* It will execute recursively based on the given array
* depending on if there are "subs" or objects and their respective sql_arrays and aql
*
* @see self::sql()
* @param array $arr generated sql array
* - sql
* - sql_list
* - sql_count
* - subs
* - objects
* @param array $settings
* - object (bool)
* - aql_statement (string)
* - select_type (string) default is 'sql'
* @param db $db_conn
* @return array
* @throws \Sky\AQL\ConnectionException if no db
* @throws \Sky\AQL\SelectException if db select fails
*/
private static function sql_result($arr, $settings, $db_conn = null)
{
if (!$db_conn) {
$db_conn = self::getDB();
}
if (self::in_transaction()) {
$db_conn = self::getMasterDB();
$silent = true;
}
if (!$db_conn) {
throw new \Sky\AQL\ConnectionException('Cannot Execute AQL without a db connection');
}
$object = $settings['object'];
$aql_statement = $settings['aql_statement'];
$sub_do_set = $settings['sub_do_set'];
$select_type = $settings['select_type'] ?: 'sql';
$rs = array();
$microtime_start = microtime(true);
$r = $db_conn->Execute($arr[$select_type]);
if (class_exists('hwc_debug')) {
hwc_debug::add_aql($arr[$select_type], number_format(microtime(true) - $microtime_start, 3));
}
if ($r === false) {
$e = new \Sky\AQL\SelectException($aql_statement, $arr[$select_type], $db_conn->ErrorMsg());
if (!$silent) {
throw $e;
} else {
aql::$errors[] = $e;
}
return $rs;
}
while (!$r->EOF) {
$tmp = self::generate_ides($r->GetRowAssoc(false));
$placeholder = null;
$get_placeholder = function ($m) use($tmp, &$placeholder) {
return $placeholder = $tmp[$m[1]];
};
$replace_placeholder = function ($clause) use($get_placeholder) {
return preg_replace_callback('/\\{\\$([\\w.]+)\\}/', $get_placeholder, $clause);
};
if ($arr['subs']) {
foreach ($arr['subs'] as $k => $s) {
$s['sql'] = $replace_placeholder($s['sql']);
if ($placeholder) {
$params = array('object' => $object);
$tmp[$k] = self::sql_result($s, $params, $db_conn);
}
}
}
$placeholder = '';
if ($arr['objects']) {
foreach ($arr['objects'] as $k => $s) {
$m = $s['model'];
if ($s['plural'] && $s['sub_where']) {
$clauses = self::get_clauses_from_model($m);
$min_aql = self::get_min_aql_from_model($m);
$clauses['where'][] = $replace_placeholder($s['sub_where']);
$query = aql::select($min_aql, $clauses, null, null, $sub_do_set, $db_conn);
if ($query) {
// new getRecords method
$ca = $s['constructor argument'];
$p = new $m();
$arr = array('ids' => array_map(function ($a) use($ca) {
return $a[$ca];
}, $query));
foreach ($p->getRecords($arr) as $row) {
$tmp[$k][]['_data'] = $row;
}
// old query loop method
/* foreach ($query as $row) {
$arg = $row[$s['constructor argument']];
$o = Model::get($m, $arg, $sub_do_set);
$tmp[$k][] = ($object) ? $o : $o->dataToArray();
}*/
}
} else {
if (!$s['plural']) {
$arg = (int) $tmp[$s['constructor argument']];
if ($arg) {
//.........这里部分代码省略.........
示例13: array
<?php
$rs = aql::select("website_uri_data { value where website_id = {$_POST['website_id']} and uri = '{$_POST['uri']}' and field = '{$_POST['field']}' }");
if ($rs) {
aql::update("website_uri_data", array('on_website' => $_POST['url_specific']), $rs[0]['website_uri_data_id']);
}
if (!$_POST['url_specific']) {
$rs = aql::select("website_page_data { value where field = '{$_POST['field']}' and website_page_id = {$_POST['website_page_id']} }");
}
exit($rs[0]['value']);
示例14: decrypt
<?php
$type = "mp3";
$blog_article_ide = IDE ? IDE : $_POST['blog_article_ide'];
$blog_article_id = $blog_article_id ? $blog_article_id : decrypt($blog_article_ide, 'blog_article');
$vfolder_path = '/blog/blog_article/' . $blog_article_id . '/mp3';
$media_upload['vfolder_path'] = $vfolder_path;
#$vfolder = media::get_vfolder($media_upload['vfolder_path']);
$aql = "blog_media{\t\n\t\t\t\t\tmedia_item_id as id,\n\t\t\t\t\ttitle\n\t\t\t\t\twhere type='mp3'\n\t\t\t\t\tand blog_article_id = {$blog_article_id}\n\t\t\t\t\torder by title asc\n\t\t\t\t}";
$vfolder['items'] = aql::select($aql);
?>
<div class = "float-left youtube_upload">
<h2>A) Youtube</h2>
<input type = "button" value = "Add YouTube Song" onclick = "new_youtube_media('<?php
echo $type;
?>
')" />
</div>
<div class = "has-floats" id = "images">
<h2>B) MP3 Upload</h2>
<input type = "hidden" name = "vfolder_path" id = "vfolder_path" value = "<?php
echo $vfolder_path;
?>
"/>
<input type = "hidden" name = "session_id" id = "session_id" value = "<?php
echo session_id();
?>
"/>
<?php
示例15: addslashes
?>
</h2>
<br>
This Website Cannot Be Optimized Until it is Set Up in the System
<br><br>
Would You Like to Set it Up Now? <button id="set-up-website">Yes</button> <button id="close">No</button>
<?php
// The website exists... move forward to the check if website_page record is entered
} else {
$aql = "website_page { url_specific, page_type, page_path, nickname where page_path = '" . addslashes($_POST['page_path']) . "' and website_id = {$website_id} }";
$rs = aql::select($aql);
$page = $rs[0];
if ($page['website_page_id']) {
if ($page['url_specific']) {
$rs_uri = aql::select("website_uri_data { where website_id = " . $website_id . " and uri = '" . $uri . "' and on_website = 1 }");
if ($rs_uri) {
$url_specific_flag = true;
} else {
$url_specific_flag = false;
}
}
// We have a website_page_record so load the form
?>
<div style="margin-bottom:10px;">
<input type="checkbox" id="url_specific" website_id="<?php
echo $website_id;
?>
" website_page_id="<?php
echo $page['website_page_id'];
?>