本文整理汇总了PHP中DAOFactory::create方法的典型用法代码示例。如果您正苦于以下问题:PHP DAOFactory::create方法的具体用法?PHP DAOFactory::create怎么用?PHP DAOFactory::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DAOFactory
的用法示例。
在下文中一共展示了DAOFactory::create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCacheData
function getCacheData()
{
$this->o->append('Default.debug.steps', __CLASS__ . '.' . __FUNCTION__);
// check memcache for the data.
$memcache = MemcacheFactory::construct('query_memcache');
foreach ($this->ids as $id) {
$memcache_keys[$id] = 'UserStatusBar_' . $id;
}
$cache = $memcache->get($memcache_keys);
// check memcache for which keys we got and which we need.
$records_found = $records_missing = array();
foreach ($cache as $mem_cache) {
$records_found[] = $mem_cache['user_id'];
}
// figure out which we still need to get.
$records_missing = array_diff($records_found, $this->ids);
if (count($records_missing) == 0 && count($this->ids) == count($cache)) {
$this->setResponse($cache);
return TRUE;
}
$this->set('missing', $records_missing);
// we have a few queries to get the correct dataset.
$dao = DAOFactory::create('users');
$dao->setWhat("`user_id`, `username`, `user_allow_viewonline`, `user_session_time`, `user_journal_id`, " . "`user_receive_pm`, `user_viewemail`, `user_email`, `user_vend`, `user_website`, `user_icq`, " . "`user_aim`,`user_msnm`, `user_yim`");
$dao->byIds($records_missing);
$rs = $dao->execute();
if (!$rs->isSuccess()) {
throw new CircuitDatabaseException('Unable to retrieve userdata for statusbar.', $rs);
}
$newdata = array();
while ($row = $rs->fetchRow(DB_ASSOC)) {
$newdata[$row['user_id']] = $row;
}
// also get the home location and house preferences
$dao = DAOFactory::create('gaiahousing');
$dao->setWhat("`user_id`, `home_zip`, `home_privacy`");
$dao->byIds($records_missing);
$rs = $dao->execute();
if (!$rs->isSuccess()) {
throw new CircuitDatabaseException('Unable to retrieve housingdata for statusbar.', $rs);
}
while ($row = $rs->fetchRow(DB_ASSOC)) {
$newdata[$row['user_id']]['home_zip'] = $row['home_zip'];
$newdata[$row['user_id']]['home_privacy'] = $row['home_privacy'];
}
// go through each user';s data and get what's appropriate.
$me = SC::get('userdata.user_id');
$cutoff = SC::get('board_config.time_now') - 600;
foreach ($newdata as $uid => $user) {
// init the stat array
$stats = array();
// online offline status. will get edited later.
if (isset($user['user_session_time']) && $user['user_session_time'] > $cutoff) {
$stats['status'] = 'online';
} else {
$stats['status'] = 'offline';
}
// profile
$stats['profile_url'] = append_sid("/profile/index.php?view=profile.ShowProfile&item=" . $uid);
// housing
if (isset($user['home_zip'])) {
$stats['home_zip'] = $user['home_zip'];
$stats['home_privacy'] = $user['home_privacy'];
}
// journal
if (isset($user['user_journal_id'])) {
$stats['journal_id'] = $user['user_journal_id'];
$stats['journal_view'] = $user['journal_view'];
}
// private messages
if (isset($user['user_receive_pm'])) {
$stats['pm_receive'] = $user['user_receive_pm'];
}
// guilds
if (isset($user['user_guild_count'])) {
$stats['guilds_url'] = append_sid("/guilds/index.php?gmode=search&user_id=" . $uid);
}
// store (vend)
if (isset($user['user_vend'])) {
$stats['vend_url'] = append_sid('http://' . VEND_SERVER . "/gaia/vend.php?mystore=" . $user_id);
}
// trade
$stats['trade_url'] = append_sid('http://' . BANK_SERVER . "/gaia/bank.php?mode=trade&uid=" . $user_id);
// www
if (isset($user['user_website'])) {
$stats['www_url'] = external_url($user['user_website']);
}
// aim
if (isset($user['user_aim'])) {
$stats['aim_url'] = 'aim:goim?screenname=' . htmlspecialchars($user['user_aim']) . '&message=FHello+Are+you+there?';
}
// icq
if (isset($user['user_icq'])) {
$stats['icq_url'] = external_url('http://wwp.icq.com/scripts/search.dll?to=' . htmlspecialchars($user['user_icq']));
}
// yim
if (isset($user['user_yim'])) {
$stats['yim_url'] = external_url('http://edit.yahoo.com/config/send_webmesg?.target=' . htmlspecialchars($user['user_yim']) . '&.src=pg');
}
// msn
//.........这里部分代码省略.........
示例2: createDAO
function & createDAO($dao_path)
{
include_once(LIMB_DIR . '/core/dao/DAOFactory.class.php');
return DAOFactory :: create($dao_path);
}