本文整理汇总了PHP中ADODB_Active_Record::ClassHasMany方法的典型用法代码示例。如果您正苦于以下问题:PHP ADODB_Active_Record::ClassHasMany方法的具体用法?PHP ADODB_Active_Record::ClassHasMany怎么用?PHP ADODB_Active_Record::ClassHasMany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ADODB_Active_Record
的用法示例。
在下文中一共展示了ADODB_Active_Record::ClassHasMany方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Type
<?php
# Movable Type (r) (C) 2001-2015 Six Apart, Ltd. All Rights Reserved.
# This code cannot be redistributed without permission from www.sixapart.com.
# For more information, consult your Movable Type license.
#
# $Id$
require_once "class.baseobject.php";
/***
* Class for mt_asset
*/
class Asset extends BaseObject
{
public $_table = 'mt_asset';
protected $_prefix = "asset_";
protected $_has_meta = true;
}
// Relations
ADODB_Active_Record::ClassHasMany('Asset', 'mt_asset_meta', 'asset_meta_asset_id');
示例2: Type
# Movable Type (r) (C) 2001-2015 Six Apart, Ltd. All Rights Reserved.
# This code cannot be redistributed without permission from www.sixapart.com.
# For more information, consult your Movable Type license.
#
# $Id$
require_once "class.baseobject.php";
/***
* Class for mt_tbping
*/
class TBPing extends BaseObject
{
public $_table = 'mt_tbping';
protected $_prefix = "tbping_";
protected $_has_meta = true;
public function trackback()
{
$col_name = "tbping_tb_id";
${$tb} = null;
if (isset($this->{$col_name}) && is_numeric($this->{$col_name})) {
$tb_id = $this->{$col_name};
require_once 'class.mt_trackback.php';
$tb = new Trackback();
$tb->Load("trackback_id = {$tb_id}");
}
return $tb;
}
}
// Relations
ADODB_Active_Record::ClassHasMany('TBPing', 'mt_tbping_meta', 'tbping_meta_tbping_id');
示例3: Save
* Class for mt_blog (website)
*/
class Website extends Blog
{
function Save()
{
if (empty($this->blog_class)) {
$this->blog_class = 'website';
}
return parent::Save();
}
function blogs()
{
$where = "blog_parent_id = " . $this->id;
require_once 'class.mt_blog.php';
$blog = new Blog();
$blogs = $blog->Find($where);
return $blogs;
}
function site_path()
{
return $this->blog_site_path;
}
function site_url()
{
return $this->blog_site_url;
}
}
// Relations
ADODB_Active_Record::ClassHasMany('Website', 'mt_blog_meta', 'blog_meta_blog_id');
示例4: Trackback
}
require_once 'class.mt_trackback.php';
$trackback = new Trackback();
$loaded = $trackback->Load("trackback_entry_id = " . $this->entry_id);
if (!$loaded) {
$trackback = null;
}
return $trackback;
}
public function pings()
{
$pings = array();
$tb = $this->trackback();
if (!empty($tb)) {
require_once 'class.mt_tbping.php';
$tbping = new TBPing();
$pings = $tbping->Find("tbping_tb_id = " . $tb->id);
}
return $pings;
}
function Save()
{
if (empty($this->entry_class)) {
$this->class = 'entry';
}
return parent::Save();
}
}
// Relations
ADODB_Active_Record::ClassHasMany('Entry', 'mt_entry_meta', 'entry_meta_entry_id');
示例5: TBPing
if (!empty($tb)) {
require_once 'class.mt_tbping.php';
$tbping = new TBPing();
$pings = $tbping->Find("tbping_tb_id = " . $tb->id);
}
return $pings;
}
public function Save()
{
if (empty($this->category_class)) {
$this->class = 'category';
}
parent::Save();
}
public function entry_count()
{
$child_class = $this->class === 'category' ? 'entry' : 'page';
$blog_id = $this->blog_id;
$cat_id = $this->id;
$where = "entry_status = 2\n and entry_class = '{$child_class}'\n and entry_blog_id = {$blog_id}";
$join = array();
$join['mt_placement'] = array('condition' => "placement_entry_id = entry_id and placement_category_id = {$cat_id}");
require_once 'class.mt_entry.php';
$entry = new Entry();
$cnt = $entry->count(array('where' => $where, 'join' => $join));
return $cnt;
}
}
// Relations
ADODB_Active_Record::ClassHasMany('Category', 'mt_category_meta', 'category_meta_category_id');
示例6:
<?php
class Template extends ADOdb_Active_Record
{
}
ADODB_Active_Record::ClassHasMany('template', 'templates', 'user_id');
示例7: Type
# Movable Type (r) (C) 2001-2014 Six Apart, Ltd. All Rights Reserved.
# This code cannot be redistributed without permission from www.sixapart.com.
# For more information, consult your Movable Type license.
#
# $Id$
require_once "class.baseobject.php";
/***
* Class for mt_comment
*/
class Comment extends BaseObject
{
public $_table = 'mt_comment';
protected $_prefix = "comment_";
protected $_has_meta = true;
public function commenter()
{
$commenter_id = $this->comment_commenter_id;
if (empty($commenter_id) || !is_numeric($commenter_id)) {
return;
}
require_once 'class.mt_author.php';
$author = new Author();
if ($author->Load("author_id = {$commenter_id}")) {
return $author;
}
return null;
}
}
// Relations
ADODB_Active_Record::ClassHasMany('Comment', 'mt_comment_meta', 'comment_meta_comment_id');
示例8: isShowAllNetwork
/**
*
* show all network
* @param unknown_type $username
*/
function isShowAllNetwork($username)
{
ADODB_Active_Record::ClassHasMany('Users', 'user_privileges', 'user');
$obone_user = new Users();
$obone_user->Load("user='" . $username . "'");
$res = $obone_user->LoadRelations('user_privileges', "id=12 ");
foreach ($res as $item) {
$item->value == "1" ? $result = true : ($result = false);
}
return $result;
}
示例9: Type
<?php
# Movable Type (r) (C) 2001-2014 Six Apart, Ltd. All Rights Reserved.
# This code cannot be redistributed without permission from www.sixapart.com.
# For more information, consult your Movable Type license.
#
# $Id$
require_once "class.baseobject.php";
/***
* Class for mt_template
*/
class Template extends BaseObject
{
public $_table = 'mt_template';
protected $_prefix = "template_";
protected $_has_meta = true;
public function blog()
{
if ($this->template_blog_id === 0) {
return null;
}
return parent::blog();
}
}
// Relations
ADODB_Active_Record::ClassHasMany('Template', 'mt_template_meta', 'template_meta_template_id');
示例10: permissions
public function permissions($blog_id = null)
{
require_once 'class.mt_permission.php';
$whereOrder = "permission_author_id = " . $this->id;
if (!is_null($blog_id)) {
if (is_array($blog_id)) {
$ids = join(',', $blog_id);
$whereOrder = $whereOrder . " and permission_blog_id in ( {$ids} )";
} else {
$whereOrder = $whereOrder . " and permission_blog_id = {$blog_id}";
}
}
$whereOrder = $whereOrder . " order by permission_blog_id";
$permission = new Permission();
return $permission->Find($whereOrder);
}
public function userpic()
{
$userpic_id = $this->author_userpic_asset_id;
if (empty($userpic_id) || !is_numeric($userpic_id)) {
return;
}
require_once 'class.mt_asset.php';
$asset = new Asset();
$asset->Load("asset_id = {$userpic_id}");
return $asset;
}
}
// Relations
ADODB_Active_Record::ClassHasMany('Author', 'mt_author_meta', 'author_meta_author_id');
示例11:
<?php
class User extends ADOdb_Active_Record
{
}
ADODB_Active_Record::ClassHasMany('document', 'documents', 'user_id');
示例12: NewADOConnection
<?php
// Connect into database and create active record
include 'libraries/adodb5/adodb.inc.php';
include 'libraries/adodb5/adodb-active-record.inc.php';
$DB = NewADOConnection("mysql://root:root@localhost/juridix");
// if ($_SERVER['HTTP_HOST'] == 'localhost') { $DB = NewADOConnection("mysql://root:root@localhost/juridix");
// } else { $DB = NewADOConnection("mysql://user:pass@localhost/gogs_juridix"); }
$DB->SetFetchMode(ADODB_FETCH_ASSOC);
ADOdb_Active_Record::SetDatabaseAdapter($DB);
// Create class for tables
class user extends ADOdb_Active_Record
{
}
// Table relations
ADODB_Active_Record::ClassHasMany('user', 'profile', 'user_id');
// User...
$user = new user();
// Set logged
@session_start();
// Verify permissions and users options
if ($_SESSION[email]) {
$env['name'] = "Jorge Pinheiro Advogados Associados";
$env['modules'] = array('db', 'login', 'user', 'panel', 'agenda', 'money', 'todo', 'news', 'mobile');
$env['start_module'] = "panel";
$env['menu'] = array('panel' => 'Inicial', 'agenda' => 'Agenda', 'money' => 'Financeiro');
$env['blocks'] = array('agenda', 'todo', 'news');
} else {
$env['name'] = "Jorge Pinheiro Advogados Associados";
$env['modules'] = array('login', 'user', 'news', 'mobile');
$env['start_module'] = "login";