function kaltura_import_entries_page in Kaltura 5
Same name and namespace in other branches
- 6.2 includes/kaltura.admin.inc \kaltura_import_entries_page()
- 6 includes/kaltura.admin.inc \kaltura_import_entries_page()
- 7.2 includes/kaltura.admin.inc \kaltura_import_entries_page()
1 string reference to 'kaltura_import_entries_page'
File
- includes/
kaltura.admin.inc, line 470
Code
function kaltura_import_entries_page() {
if ($_POST['op'] == 'import selected') {
kaltura_import_entries($_POST['entries_to_import']);
drupal_goto('admin/settings/kaltura/import');
}
if (variable_get('kaltura_partner_id', '') == '') {
return t('You have not configured your partner details yet. Import cannot be performed until you setup your partner details');
}
$get_entries = module_exists('node_kaltura_entry');
$get_mixes = module_exists('node_kaltura_mix');
$filter = new KalturaEntryFilter();
if ($get_entries) {
if ($get_mixes) {
$filter->inType = '1,2';
}
else {
$filter->inType = '1';
}
}
else {
return t('Can\'t import entries, you did not enable the node_kaltura_entries module.');
}
if (!$_GET['p']) {
$_GET['p'] = 1;
}
list($total, $each_page, $entries) = kaltura_get_my_entries($filter, $each_page = 30, $_GET['p']);
if ($entries === NULL) {
return t('No entries found.');
}
$entries_need_import = kaltura_remove_existing_entries($entries);
if (!count($entries_need_import)) {
return t('No entries needed to be imported.');
}
if (count($entries_need_import) < $each_page) {
list($t, $n, $second_page) = kaltura_get_my_entries($filter, $each_page, $_GET['p'] + 1);
$new_entries_need_import = kaltura_remove_existing_entries($second_page);
if (is_array($new_entries_need_import) && $second_page !== NULL) {
foreach ($new_entries_need_import as $eid => $entry) {
$entries_need_import[$eid] = $entry;
if (count($entries_need_import) == $each_page) {
break;
}
}
}
}
if ($total > $each_page) {
$pages = floor($total / $each_page);
for ($start = 1; $start <= $pages; $start++) {
if ($start == $_GET['p']) {
$pager .= '<a>' . $start . '</a>';
}
else {
$pager .= l($start, 'admin/settings/kaltura/import', array(), 'p=' . $start);
}
$pager .= ' ';
}
}
if (is_array($entries_need_import) && count($entries_need_import)) {
foreach ($entries_need_import as $entry => $details) {
$entries_options[$details['id']] = $details['id'] . ': ' . $details['name'] . ' (' . ($details['type'] == 2 ? 'mix' : 'entry') . ')';
}
}
else {
$entries_options = array();
}
$output = drupal_get_form('kaltura_create_entries_form', array(
$entries_options,
));
return $pager . $output . $pager;
}