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


PHP aql::get_primary_table方法代码示例

本文整理汇总了PHP中aql::get_primary_table方法的典型用法代码示例。如果您正苦于以下问题:PHP aql::get_primary_table方法的具体用法?PHP aql::get_primary_table怎么用?PHP aql::get_primary_table使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在aql的用法示例。


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

示例1: array

<?php

$model = 'blog_article';
$blog_article = aql::profile($model, IDE);
$primary_table = aql::get_primary_table($model);
$blog_article_id = $blog_article['blog_article_id'];
$blog_article_ide = $blog_article['blog_article_ide'];
$title = $blog_article['title'] ? $blog_article['title'] : 'Write A New Post';
$head_arr[] = "<script src = '/lib/swfupload/swfupload.js' type = 'text/javascript'></script>";
$head_arr[] = "<script src = '/modules/media/upload/handlers.js' type = 'text/javascript'></script>";
$head_arr[] = "<link type='text/css' rel='stylesheet' href='/modules/media/upload/progress.css' />";
template::inc('intranet', 'top');
?>
	<div id = "back_to_blogs"><a href = "/admin/blog/post/">&laquo; Back to Blog Posts</a></div>
<?php 
//$theme_ab1 = "undo,redo,|,bold,italic,underline,strikethrough,forecolor,backcolor,|,justifyleft,justifycenter,justifyright,justifyfull,fontselect,fontsizeselect,styleselect";
//$theme_ab2 = "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,sub,sup,charmap,|,link,unlink,anchor,image,cleanup,help,|,code,|,removeformat,|,fullscreen,|,preview";
$theme_ab1 = "undo,redo,|,bold,italic,underline,strikethrough,forecolor,backcolor,|,bullist,numlist,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect";
$theme_ab2 = "cut,copy,paste,pastetext,pasteword,|,outdent,indent,blockquote,|,sub,sup,charmap,|,link,unlink,image,cleanup,|,code,|,removeformat,|,fullscreen,|,hr";
if (!$css_blog_editor) {
    $css_blog_editor = '/css/blog.css';
}
$options_article = array('resizing' => false, 'full_url' => $blog_img_absolute ? true : false, 'theme' => 'advanced', 'multi_buttons' => true, 'theme_ab1' => $theme_ab1, 'theme_ab2' => $theme_ab2, 'theme_ab3' => "", 'theme_ab4' => "", 'width' => '675', 'height' => '520', 'css' => $css_blog_editor);
$theme_ab1_notes = "bold,italic,underline,strikethrough,forecolor,backcolor,hr";
$options_notes = array('resizing' => true, 'theme' => 'advanced', 'multi_buttons' => true, 'theme_ab1' => $theme_ab1_notes, 'theme_ab2' => '', 'theme_ab3' => "", 'theme_ab4' => "", 'height' => '120', 'width' => '257');
$settings = array('article-content' => $options_article, 'note' => $options_notes);
helper::tinymce($settings);
aql::form($model);
template::inc('intranet', 'bottom');
开发者ID:hshoghi,项目名称:cms,代码行数:29,代码来源:post-profile.php

示例2: value

 /**
  * @param   string  $param1
  * @param   string  $param2
  * @param   mixed   $options
  * @return  mixed
  */
 public static function value($param1, $param2, $options = array())
 {
     if (!$param2) {
         return null;
     }
     // third param can be a db connection resource
     if (is_object($options) && get_class($options) == 'ADODB_postgres7') {
         $db_conn = $options;
         $options = array();
     }
     // get connection
     $db_conn = $db_conn ?: $options['db'];
     $db_conn = $db_conn ?: self::getDB();
     $is_aql = aql::is_aql($param1);
     // normalize primary table and aql
     if ($is_aql) {
         $aql = $param1;
         $primary_table = aql::get_primary_table($aql);
     } else {
         list($primary_table, $field) = explode('.', $param1);
         $aql = "{$primary_table} { {$field} }";
     }
     // get where
     $multiple = false;
     $where = call_user_func(function () use($primary_table, $param2, &$multiple) {
         $spr = '%s.%s = \'%s\'';
         $decrypt = function ($r) use($primary_table) {
             return is_numeric($r) ? $r : decrypt($r, $primary_table);
         };
         if (is_numeric($param2)) {
             return sprintf($spr, $primary_table, 'id', $param2);
         }
         if (!is_array($param2)) {
             // check for ide
             $id = $decrypt($param2);
             if (is_numeric($id)) {
                 return sprintf($spr, $primary_table, 'id', $id);
             }
             // otherwise check for slug field on table
             if (!aql2array::table_field_exists($primary_table, 'slug')) {
                 return;
             }
             return sprintf($spr, $primary_table, 'slug', $param2);
         }
         // this is an array
         $multiple = true;
         $param2 = array_filter(array_map($decrypt, $param2));
         $param2[] = -1;
         $ids = implode(',', $param2);
         return "{$primary_table}.id in ({$ids})";
     });
     // return if we dont find a where clause
     if (!$where) {
         return false;
     }
     $clause = array($primary_table => array('where' => array($where), 'order by' => 'id asc'));
     $rs = aql::select($aql, $clause, null, null, null, $db_conn);
     if ($multiple) {
         return $rs;
     }
     if ($is_aql) {
         return $rs[0];
     }
     return $rs[0][$field];
 }
开发者ID:HotwireCommunications,项目名称:skyphp,代码行数:71,代码来源:class.aql.php

示例3: inner

 /**
  * Parses the innards of the table definition block for info
  * @param   string  $aql
  * @param   array   $parent     (if in a subquery)
  * @return  array   { fields, subqueries, objects, clauses }
  */
 public function inner($aql, $parent = array())
 {
     $tmp = array();
     $subqueries = $this->split_tables($aql, true);
     $subqueries = $subqueries[0];
     if (is_array($subqueries)) {
         $subs = array();
         $sub = '';
         foreach ($subqueries as $k => $v) {
             if (stripos(trim($v), "'") > 2 || stripos(trim($v), "'") === false) {
                 // FOR MULTIPLE SUBQUERIES
                 $aql = str_replace($v, '', $aql);
                 if (!preg_match('/\\},$/', trim($v))) {
                     $sub .= $v;
                 } else {
                     $sub .= $v;
                     $sub = substr($sub, 0, -1);
                     $subs[] = $sub;
                     $sub = '';
                 }
             }
         }
         $subs[] = $sub;
         foreach ($subs as $s) {
             $sub = $this->init($s, $parent);
             if (!empty($sub)) {
                 $keys = array_keys($sub);
                 $tmp['subqueries'][$keys[0]] = $sub;
             }
         }
     }
     // remove opening brace and before and last brace and whitespace
     $aql = trim(substr(substr($aql, 0, -1), strpos($aql, '{') + 1));
     // get clauses
     foreach (array_reverse(self::$clauses) as $cl) {
         $pattern = sprintf('/(?:\\b%s\\b)%s/i', $cl, "(?=(?:(?:[^']*+'){2})*+[^']*+\\z)");
         $split = preg_split($pattern, $aql, 2);
         $aql = $split[0];
         if ($split[1]) {
             $tmp[$cl] = $split[1];
         }
     }
     preg_match_all(self::$object_pattern, $aql, $matches);
     $aql = str_replace($matches[0], '', $aql);
     foreach ($matches['model'] as $k => $v) {
         $primary_table = aql::get_primary_table($v);
         $constructor_arg = $matches['param'][$k] ?: $primary_table . '_id';
         $object_tmp = array('model' => $v, 'primary_table' => $primary_table, 'constructor argument' => $constructor_arg);
         $tmp_as = $matches['as'][$k] ?: $v;
         if ($matches['sub'][$k]) {
             $object_tmp['plural'] = true;
             $object_tmp['sub_where'] = $this->subquery_where($primary_table, $primary_table, $parent['table'], $parent['as']);
         }
         $tmp['objects'][$tmp_as] = $object_tmp;
     }
     $i = 1;
     $fields = explodeOnComma($aql);
     array_walk($fields, function ($field, $_, $o) use($parent, &$tmp, &$i) {
         $add_field = function ($alias, $value, $type = 'fields') use(&$tmp) {
             $tmp[$type][$alias] = $value;
         };
         $field = trim($field);
         if (empty($field)) {
             return;
         }
         if ($field == '*') {
             $fields = $o->get_table_fields($parent['table']);
             if (is_array($fields)) {
                 foreach ($fields as $f) {
                     $tmp['fields'][$f] = $parent['as'] . '.' . $f;
                 }
             }
             return;
         }
         $as = array_map('trim', preg_split("/\\bas\\b{$o->not_in_quotes}/", $field));
         $alias = $as[1] ?: $as[0];
         if (strpos($alias, "'") !== false) {
             $alias = 'field_' . $i;
         }
         if (!$as[0] || !$alias) {
             return;
         }
         if (preg_match("/(case|when){$o->not_in_quotes}/im", $as[0])) {
             // this is a case when
             $add_field($alias, trim($o->parse_case_when($as[0], $parent['as'])));
         } else {
             if (strpos($as[0], ')') !== false) {
                 // this is a "function" we call it an aggregate for now
                 $a = array_map('trim', explode('(', $as[0]));
                 if (!empty($a[0])) {
                     $alias = $alias == $as[0] ? $a[0] : $alias;
                     if ($tmp['aggregates'][$alias]) {
                         $j = '1';
                         while (true) {
//.........这里部分代码省略.........
开发者ID:HotwireCommunications,项目名称:skyphp,代码行数:101,代码来源:class.aql2array.php

示例4: checkProfile

 private function checkProfile($piece, $i, $file, $path)
 {
     // find primary_table via model if it is specified
     if ($this->settings['model']) {
         $aql = \aql::get_aql($this->settings['model']);
         $this->settings['primary_table'] = \aql::get_primary_table($aql);
     }
     // throw error if no primary_table
     if (!$this->settings['primary_table']) {
         header("HTTP/1.1 503 Service Temporarily Unavailable");
         header("Status: 503 Service Temporarily Unavailable");
         header("Retry-After: 1");
         throw new \Exception('Profile Page Error: $primary_table not specified on file. <br />' . $file);
         return false;
     }
     // set to profile
     $decrypted = \decrypt($piece, $this->settings['primary_table']);
     if ($piece == 'add-new' || is_numeric($decrypted)) {
         $this->addToPageAndPath($file, $path, $i);
         return true;
     }
     return false;
 }
开发者ID:HotwireCommunications,项目名称:skyphp,代码行数:23,代码来源:PageRouter.php


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