本文整理汇总了PHP中fetch_by_node_ids函数的典型用法代码示例。如果您正苦于以下问题:PHP fetch_by_node_ids函数的具体用法?PHP fetch_by_node_ids怎么用?PHP fetch_by_node_ids使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fetch_by_node_ids函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_dataset
function & get_dataset(& $counter, $params = array())
{
$mime_type = new mime_type();
$pricelists_array =& $this->_fetch($counter, $params);
$file_ids = array();
foreach($pricelists_array as $id => $data)
if($data['file_id'] > 0)
$file_ids[$data['file_id']] = $data['file_id'];
if(!$file_ids)
return new array_dataset($pricelists_array);
$files_counter = null;
$file_data = fetch_by_node_ids($file_ids, 'file_object', $files_counter);
foreach($pricelists_array as $id => $data)
if($data['file_id'] > 0)
{
$pricelists_array[$id]['file_size'] = $file_data[$data['file_id']]['size'];
$pricelists_array[$id]['file_icon'] = $mime_type->get_type_icon($file_data[$data['file_id']]['mime_type']);
}
return new array_dataset($pricelists_array);
}
示例2: get_dataset
function & get_dataset(&$counter, $params=array())
{
$counter = 0;
$mapped_node = map_request_to_node();
$links_manager = new links_manager();
$groups = array();
if(isset($params['group_identifier']))
{
if($group = $links_manager->fetch_group_by_identifier($params['group_identifier']))
$groups[$group['id']] = $group;
}
else
$groups = $links_manager->fetch_groups();
if (!is_array($groups) || !count($groups))
return new empty_dataset();
if(isset($params['back_links']) && $params['back_links'])
$links = $links_manager->fetch_back_links($mapped_node['id'], array_keys($groups));
else
$links = $links_manager->fetch_target_links($mapped_node['id'], array_keys($groups));
if (!is_array($links) || !count($links))
return new array_dataset($groups);
$target_node_ids = complex_array :: get_column_values('target_node_id', $links);
if (!is_array($target_node_ids) || !count($target_node_ids))
return new array_dataset($groups);
$site_object_class_name = isset($params['loader_class_name']) ? $params['loader_class_name'] : 'site_object';
$objects =& fetch_by_node_ids($target_node_ids, $site_object_class_name, $counter, array(
'restrict_by_class' => false
));
$result = array();
foreach($groups as $group_id => $group)
{
$groups[$group_id]['links'] = array();
foreach($links as $link_id => $link)
{
if ($link['group_id']!= $group_id)
continue;
//if (!isset($objects[$link['target_node_id']]))
// continue;
$link_data = array_merge($objects[$link['target_node_id']], $link);
$groups[$group_id]['links'][$link_id] = $link_data;
}
}
return new array_dataset($groups);
}
示例3: _valid_perform
function _valid_perform(&$request, &$response)
{
if (!($objects_amounts = $this->dataspace->get('amount'))) {
$request->set_status(REQUEST_STATUS_FAILURE);
if ($request->has_attribute('popup')) {
$response->write(close_popup_response($request));
}
return;
}
$objects_data =& fetch_by_node_ids(array_keys($objects_amounts), $this->_define_catalog_object(), $counter);
if (!$objects_data) {
$request->set_status(REQUEST_STATUS_FAILURE);
if ($request->has_attribute('popup')) {
$response->write(close_popup_response($request));
}
return;
}
$object =& site_object_factory::create($this->_define_catalog_object());
if (!method_exists($object, 'get_cart_item')) {
$request->set_status(REQUEST_STATUS_FAILURE);
if ($request->has_attribute('popup')) {
$response->write(close_popup_response($request));
}
return;
}
$cart =& cart::instance();
foreach ($objects_data as $key => $object_data) {
$object->import_attributes($object_data);
$cart_item =& $object->get_cart_item();
$cart_item->set_amount($objects_amounts[$key]);
$cart->add_item($cart_item);
}
$response->redirect('/root/cart?popup=1');
}
示例4: _get_objects_to_delete
function _get_objects_to_delete($node_ids)
{
$params = array(
'restrict_by_class' => false
);
$objects =& fetch_by_node_ids($node_ids, 'site_object', $counter, $params);
$result = array();
$tree = tree :: instance();
foreach($objects as $id => $item)
{
if (!isset($item['actions']['delete']))
{
$objects[$id]['delete_status'] = 1;
$objects[$id]['delete_reason'] = strings :: get('delete_action_not_accessible', 'error');
continue;
}
$site_object =& wrap_with_site_object($item);
if (!$site_object->can_delete())
{
$objects[$id]['delete_status'] = 1;
$objects[$id]['delete_reason'] = strings :: get('cant_be_deleted', 'error');
continue;
}
$objects[$id]['delete_reason'] = strings :: get('ok');
$objects[$id]['delete_status'] = 0;
$objects[$id]['ids'][$item['node_id']] = 1;
}
return $objects;
}
示例5: _get_objects
function _get_objects($node_ids)
{
$params = array(
'restrict_by_class' => false
);
$objects =& fetch_by_node_ids($node_ids, 'site_object', $counter, $params);
return $objects;
}
示例6: _valid_perform
function _valid_perform()
{
if (!($objects_amounts = $this->dataspace->get('amount'))) {
return new close_popup_response(RESPONSE_STATUS_FAILURE);
}
$objects_data =& fetch_by_node_ids(array_keys($objects_amounts), $this->_catalog_object_class_name, $counter);
if (!$objects_data) {
return new close_popup_response(RESPONSE_STATUS_FAILURE);
}
$object =& site_object_factory::create($this->_catalog_object_class_name);
if (!method_exists($object, 'get_cart_item')) {
return new close_popup_response(RESPONSE_STATUS_FAILURE);
}
$cart =& cart::instance();
foreach ($objects_data as $key => $object_data) {
$object->import_attributes($object_data);
$cart_item =& $object->get_cart_item();
$cart_item->set_amount($objects_amounts[$key]);
$cart->add_item($cart_item);
}
return new redirect_response(RESPONSE_STATUS_SUCCESS, '/root/cart?popup=1');
}
示例7: _get_objects_to_move
function _get_objects_to_move($node_ids)
{
$params = array(
'restrict_by_class' => false
);
$objects = fetch_by_node_ids($node_ids, 'site_object', $counter, $params);
foreach($objects as $id => $item)
{
$objects[$id]['ids'][$item['node_id']] = 1;
}
return $objects;
}