本文整理汇总了PHP中db_table_factory类的典型用法代码示例。如果您正苦于以下问题:PHP db_table_factory类的具体用法?PHP db_table_factory怎么用?PHP db_table_factory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了db_table_factory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _get_theme_subscribers
function _get_theme_subscribers($theme_id)
{
$db_table = & db_table_factory :: instance('subscribe_member');
$subscribers = $db_table->get_list(array('theme_id' => $theme_id), '', 'member_id');
if (!count($subscribers))
return array();
$members_list = $this->_get_subscribers_from_branch('/root/admin/members');
$users_list = $this->_get_subscribers_from_branch('/root/admin/users');
$total_list = array_merge($members_list, $users_list);
foreach($total_list as $key => $data)
{
if (!isset($data['email']) || !$data['email'])
continue;
$user_id = $data['id'];
if(array_key_exists($user_id, $subscribers))
{
$subscribers[$user_id]['email'] = $data['email'];
$subscribers[$user_id]['name'] = $data['name'];
}
}
return $subscribers;
}
示例2: array
function &get_dataset(&$counter, $params = array())
{
$object_data = fetch_mapped_by_url();
if (!count($object_data)) {
return new array_dataset(array());
}
$db_table =& db_table_factory::instance('sys_object_version');
$arr = $db_table->get_list('object_id=' . $object_data['id'], 'version DESC');
$result = array();
$users =& fetch_sub_branch('/root/users', 'user_object', $counter);
foreach ($arr as $data) {
$record = $data;
$user = '';
if (count($users)) {
foreach ($users as $user_data) {
if ($user_data['id'] == $data['creator_id']) {
$user = $user_data;
break;
}
}
}
if ($user) {
$record['creator_identifier'] = $user['identifier'];
$record['creator_email'] = $user['email'];
$record['creator_name'] = $user['name'];
$record['creator_lastname'] = isset($user['lastname']) ? $user['lastname'] : '';
}
$result[] = $record;
}
return new array_dataset($result);
}
示例3: array
function &get_dataset($params = array())
{
$request = request::instance();
if (!($class_id = $request->get_attribute('class_id'))) {
return new array_dataset();
}
$db_table =& db_table_factory::instance('sys_class');
$class_data = $db_table->get_row_by_id($class_id);
if (!$class_data) {
return new array_dataset();
}
$c =& site_object_factory::instance($class_data['class_name']);
$site_object_controller =& $c->get_controller();
$actions = $site_object_controller->get_actions_definitions();
$result = array();
foreach ($actions as $action => $action_params) {
if (!isset($action_params['can_have_access_template']) || !$action_params['can_have_access_template']) {
continue;
}
if (isset($action_params['action_name'])) {
$result[$action]['action_name'] = $action_params['action_name'];
} else {
$result[$action]['action_name'] = str_replace('_', ' ', strtoupper($action[0]) . substr($action, 1));
}
}
return new array_dataset($result);
}
示例4: _update_media_record
function _update_media_record($id, $tmp_file_path, $file_name, $mime_type)
{
if (!file_exists($tmp_file_path)) {
debug::write_error('file doesnt exist', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('tmp' => $tmp_file_path));
return false;
}
if (function_exists('md5_file')) {
$etag = md5_file($tmp_file_path);
} else {
$fd = fopen($data['tmp_name'], 'rb');
$contents = fread($fd, filesize($tmp_file_path));
fclose($fd);
$etag = md5($contents);
}
if (!is_dir(MEDIA_DIR)) {
dir::mkdir(MEDIA_DIR, 777, true);
}
if (!copy($tmp_file_path, MEDIA_DIR . $id . '.media')) {
debug::write_error('temporary file copy failed', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('src' => $tmp_file_path, 'dst' => MEDIA_DIR . $id . '.media'));
return false;
}
$media_db_table = db_table_factory::instance('media');
$media_db_table->update_by_id($id, array('file_name' => $file_name, 'mime_type' => $mime_type, 'size' => filesize($tmp_file_path), 'etag' => $etag));
return true;
}
示例5: setUp
function setUp()
{
$this->image =& db_table_factory::instance('test_image');
$this->image_variation =& db_table_factory::instance('test_image_variation');
$this->media =& db_table_factory::instance('test_media');
parent::setUp();
}
示例6: load_metadata
function load_metadata()
{
$ids_array = $this->_get_path_objects_ids_array();
if (!count($ids_array)) {
return false;
}
$sys_metadata_db_table =& db_table_factory::instance('sys_metadata');
$objects_metadata = $sys_metadata_db_table->get_list(sql_in('object_id', $ids_array), '', 'object_id');
if (!count($objects_metadata)) {
return false;
}
$ids_array = array_reverse($ids_array);
$got_keywords = false;
$got_description = false;
foreach ($ids_array as $object_id) {
if ($got_keywords && $got_description) {
break;
}
if (!$got_keywords && !empty($objects_metadata[$object_id]['keywords'])) {
$this->object_metadata['keywords'] = $objects_metadata[$object_id]['keywords'];
$got_keywords = true;
}
if (!$got_description && !empty($objects_metadata[$object_id]['description'])) {
$this->object_metadata['description'] = $objects_metadata[$object_id]['description'];
$got_description = true;
}
}
return true;
}
示例7: get_dataset
function & get_dataset($params = array())
{
if(!$arr = fetch_requested_object())
return new array_dataset();
$db_table =& db_table_factory :: instance('sys_class');
$classes = $db_table->get_list('', 'class_name');
$result = array();
$params = array();
foreach($classes as $class_id => $class_data)
{
$result[$class_id] = $class_data;
$result[$class_id]['path'] = $arr['path'];
$params['class_id'] = $class_id;
$result[$class_id]['node_id'] = $arr['node_id'];
foreach($arr['actions'] as $action_name => $action_params)
$arr['actions'][$action_name]['extra'] = $params;
$result[$class_id]['actions'] = $arr['actions'];
}
return new array_dataset($result);
}
示例8: get_dataset
function & get_dataset($params = array())
{
$request = request :: instance();
if(!$controller_id = $this->_get_controller_id())
return new array_dataset();
$db_table =& db_table_factory :: instance('sys_controller');
$controller_data = $db_table->get_row_by_id($controller_id);
if (!$controller_data)
return new array_dataset();
$site_object_controller =& site_object_controller :: create($controller_data['name']);
$actions = $site_object_controller->get_actions_definitions();
$result = array();
foreach($actions as $action => $action_params)
{
if (!isset($action_params['can_have_access_template']) || !$action_params['can_have_access_template'])
continue;
if(isset($action_params['action_name']))
$result[$action]['action_name'] = $action_params['action_name'];
else
$result[$action]['action_name'] = str_replace('_', ' ', strtoupper($action{0}) . substr($action, 1));
}
return new array_dataset($result);
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:31,代码来源:controller_template_actions_list_datasource.class.php
示例9: array
function &get_dataset($params = array())
{
$request = request::instance();
if (!($controller_id = $request->get_attribute('controller_id'))) {
return new array_dataset();
}
$db_table =& db_table_factory::instance('sys_controller');
$controller_data = $db_table->get_row_by_id($controller_id);
if (!$controller_data) {
return new array_dataset();
}
$site_object_controller =& site_object_controller::create($controller_data['name']);
$actions = $site_object_controller->get_actions_definitions();
$user_groups =& fetch_sub_branch('/root/user_groups', 'user_group', $counter);
$result = array();
foreach ($actions as $action => $action_params) {
if (isset($action_params['action_name'])) {
$result[$action]['action_name'] = $action_params['action_name'];
} else {
$result[$action]['action_name'] = str_replace('_', ' ', strtoupper($action[0]) . substr($action, 1));
}
$result[$action]['permissions_required'] = $action_params['permissions_required'];
foreach ($user_groups as $group_id => $group_data) {
$result[$action]['groups'][$group_id]['selector_name'] = 'policy[' . $group_id . '][' . $action . ']';
}
}
return new array_dataset($result);
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:28,代码来源:controller_group_action_access_datasource.class.php
示例10: test_save
function test_save()
{
$metadata['id'] = 1;
$metadata['keywords'] = 'keywords';
$metadata['description'] = 'description';
$o =& site_object_factory :: create('site_object');
$o->import_attributes($metadata);
$result_id = $o->save_metadata();
$this->assertNotNull($result_id);
$sys_metadata_db_table =& db_table_factory :: instance('sys_metadata');
$metadata_row = $sys_metadata_db_table->get_row_by_id($result_id);
$this->assertTrue(is_array($metadata_row));
$this->assertTrue(isset($metadata_row['object_id']));
$this->assertTrue(isset($metadata_row['keywords']));
$this->assertTrue(isset($metadata_row['description']));
$this->assertEqual($metadata_row['object_id'], 1);
$this->assertEqual($metadata_row['keywords'], 'keywords');
$this->assertEqual($metadata_row['description'], 'description');
}
示例11: test_db_table_cascade_delete
function test_db_table_cascade_delete($name = 'db table test case')
{
$this->image =& db_table_factory::instance('test_image');
$this->image_variation =& db_table_factory::instance('test_image_variation');
$this->media =& db_table_factory::instance('test_media');
parent::test_db_case($name);
}
示例12: array
function &get_dataset($params = array())
{
$request = request::instance();
if (!($class_id = $request->get_attribute('class_id'))) {
return new array_dataset();
}
$db_table =& db_table_factory::instance('sys_class');
$class_data = $db_table->get_row_by_id($class_id);
if (!$class_data) {
return new array_dataset();
}
$c =& site_object_factory::instance($class_data['class_name']);
$site_object_controller =& $c->get_controller();
$actions = $site_object_controller->get_actions_definitions();
$user_groups =& fetch_sub_branch('/root/user_groups', 'user_group', $counter);
$result = array();
foreach ($user_groups as $group_id => $group_data) {
foreach ($actions as $action => $action_params) {
if (!isset($action_params['can_have_access_template']) || !$action_params['can_have_access_template']) {
continue;
}
if (isset($action_params['action_name'])) {
$result[$group_id]['actions'][$action]['action_name'] = $action_params['action_name'];
} else {
$result[$group_id]['actions'][$action]['action_name'] = str_replace('_', ' ', strtoupper($action[0]) . substr($action, 1));
}
$result[$group_id]['group_name'] = $group_data['identifier'];
$result[$group_id]['actions'][$action]['read_selector_name'] = 'template[' . $action . '][' . $group_id . '][r]';
$result[$group_id]['actions'][$action]['write_selector_name'] = 'template[' . $action . '][' . $group_id . '][w]';
}
}
return new array_dataset($result);
}
示例13: db_cart_handler
function db_cart_handler($cart_id)
{
parent :: cart_handler($cart_id);
$this->cart_db_table =& db_table_factory :: instance('cart');
register_shutdown_function(array(&$this, '_db_cart_handler'));
}
示例14: _insert_user_site_object_access_records
function _insert_user_site_object_access_records()
{
$access_db_table =& db_table_factory::instance('sys_object_access');
$data = array();
for ($i = 8; $i <= 10; $i++) {
$this->db->sql_insert('sys_object_access', array('object_id' => $i, 'accessor_id' => 200, 'r' => 1, 'w' => 1, 'accessor_type' => ACCESSOR_TYPE_USER));
}
}
示例15: array
function &get_dataset($params = array())
{
if (!fetch_requested_object()) {
return new array_dataset();
}
$db_table =& db_table_factory::instance('sys_controller');
$controllers = $db_table->get_list('', 'name');
return new array_dataset($controllers);
}