本文整理匯總了PHP中ImpExData::how_complete方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImpExData::how_complete方法的具體用法?PHP ImpExData::how_complete怎麽用?PHP ImpExData::how_complete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ImpExData
的用法示例。
在下文中一共展示了ImpExData::how_complete方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: resume
function resume(&$sessionobject, &$displayobject, &$Db_target, &$Db_source)
{
// Set up working variables.
$displayobject->update_basic('displaymodules', 'FALSE');
$target_database_type = $sessionobject->get_session_var('targetdatabasetype');
$target_table_prefix = $sessionobject->get_session_var('targettableprefix');
$source_database_type = $sessionobject->get_session_var('sourcedatabasetype');
$source_table_prefix = $sessionobject->get_session_var('sourcetableprefix');
// Per page vars
$forum_start_at = $sessionobject->get_session_var('forumstartat');
$forum_per_page = $sessionobject->get_session_var('forumperpage');
$class_num = substr(get_class($this), -3);
// Start the timing
if (!$sessionobject->get_session_var($class_num . '_start')) {
$sessionobject->timing($class_num, 'start', $sessionobject->get_session_var('autosubmit'));
}
######################################
# Temp
######################################
$forum_object = new ImpExData($Db_target, $sessionobject, 'forum');
$try = phpversion() < '5' ? $forum_object : clone $forum_object;
$try->set_value('mandatory', 'title', 'Default Yahoo Category');
$try->set_value('mandatory', 'displayorder', '1');
$try->set_value('mandatory', 'parentid', '-1');
$try->set_value('mandatory', 'importforumid', '0');
$try->set_value('mandatory', 'importcategoryid', '1');
$try->set_value('mandatory', 'options', $this->_default_cat_permissions);
$try->set_value('nonmandatory', 'description', 'Default Yahoo Category Description');
$cat_id = $try->import_category($Db_target, $target_database_type, $target_table_prefix);
$displayobject->display_now("<br /><span class=\"isucc\"><b>" . $try->how_complete() . "%</b></span> :: " . $try->get_value('mandatory', 'title'));
$sessionobject->add_session_var($class_num . '_objects_done', intval($sessionobject->get_session_var($class_num . '_objects_done')) + 1);
unset($try);
$try = phpversion() < '5' ? $forum_object : clone $forum_object;
$try->set_value('mandatory', 'title', 'Default Yahoo Forum');
$try->set_value('mandatory', 'displayorder', '1');
$try->set_value('mandatory', 'parentid', $cat_id);
$try->set_value('mandatory', 'importforumid', '1');
$try->set_value('mandatory', 'importcategoryid', '0');
$try->set_value('nonmandatory', 'description', 'Default Yahoo Forum');
$try->set_value('nonmandatory', 'visible', '1');
$try->set_value('mandatory', 'options', $this->_default_forum_permissions);
$forum_id = $try->import_forum($Db_target, $target_database_type, $target_table_prefix);
$displayobject->display_now("<br /><span class=\"isucc\"><b>" . $try->how_complete() . "%</b></span> :: " . $try->get_value('mandatory', 'title'));
$sessionobject->add_session_var($class_num . '_objects_done', intval($sessionobject->get_session_var($class_num . '_objects_done')) + 1);
unset($try);
$try = new ImpExData($Db_target, $sessionobject, 'thread');
$try->set_value('mandatory', 'title', 'Yahoo catchments thread');
$try->set_value('mandatory', 'forumid', $forum_id);
$try->set_value('mandatory', 'importthreadid', '2');
$try->set_value('mandatory', 'importforumid', '1');
// Non Mandatory
$try->set_value('nonmandatory', 'visible', '1');
$try->set_value('nonmandatory', 'open', '1');
$try->set_value('nonmandatory', 'dateline', time());
$displayobject->display_now("<br /><span class=\"isucc\"><b>" . $try->how_complete() . "%</b></span> :: " . $try->get_value('mandatory', 'title'));
$sessionobject->add_session_var($class_num . '_objects_done', intval($sessionobject->get_session_var($class_num . '_objects_done')) + 1);
$thread_id = $try->import_thread($Db_target, $target_database_type, $target_table_prefix);
$sessionobject->set_session_var('catch_thread', $thread_id);
######################################
# Temp
######################################
// Check for page end
if (count($forum_array) == 0 or count($forum_array) < $forum_per_page) {
$sessionobject->timing($class_num, 'stop', $sessionobject->get_session_var('autosubmit'));
$sessionobject->remove_session_var($class_num . '_start');
$forum_ids_array = $this->get_forum_ids($Db_target, $target_database_type, $target_table_prefix);
$this->clean_nested_forums($Db_target, $target_database_type, $target_table_prefix, $forum_ids_array);
$this->build_forum_child_lists($Db_target, $target_database_type, $target_table_prefix);
$displayobject->update_html($displayobject->module_finished($this->_modulestring, $sessionobject->return_stats($class_num, '_time_taken'), $sessionobject->return_stats($class_num, '_objects_done'), $sessionobject->return_stats($class_num, '_objects_failed')));
$sessionobject->set_session_var($class_num, 'FINISHED');
$sessionobject->set_session_var('import_forum', 'done');
$sessionobject->set_session_var('module', '000');
$sessionobject->set_session_var('autosubmit', '0');
$displayobject->update_html($displayobject->print_redirect('index.php', '1'));
}
$sessionobject->set_session_var('forumstartat', $forum_start_at + $forum_per_page);
$displayobject->update_html($displayobject->print_redirect('index.php'));
}
示例2: resume
function resume(&$sessionobject, &$displayobject, &$Db_target, &$Db_source)
{
// Set up working variables.
$displayobject->update_basic('displaymodules', 'FALSE');
$target_database_type = $sessionobject->get_session_var('targetdatabasetype');
$target_table_prefix = $sessionobject->get_session_var('targettableprefix');
$source_database_type = $sessionobject->get_session_var('sourcedatabasetype');
$source_table_prefix = $sessionobject->get_session_var('sourcetableprefix');
// Per page vars
$forum_start_at = $sessionobject->get_session_var('forumstartat');
$forum_per_page = $sessionobject->get_session_var('forumperpage');
$class_num = substr(get_class($this), -3);
// Start the timing
if (!$sessionobject->get_session_var($class_num . '_start')) {
$sessionobject->timing($class_num, 'start', $sessionobject->get_session_var('autosubmit'));
}
if ($sessionobject->get_session_var('categoriesfinished') == 'FALSE') {
$try = new ImpExData($Db_target, $sessionobject, 'forum');
$try->set_value('mandatory', 'title', 'Default vB Lite Category');
$try->set_value('mandatory', 'displayorder', '1');
$try->set_value('mandatory', 'parentid', '-1');
$try->set_value('mandatory', 'importforumid', '0');
$try->set_value('mandatory', 'importcategoryid', '1');
$try->set_value('mandatory', 'options', $this->_default_cat_permissions);
$try->set_value('nonmandatory', 'description', 'Default vB Lite Category Description');
$cat_id = $try->import_category($Db_target, $target_database_type, $target_table_prefix);
$displayobject->display_now("<br /><span class=\"isucc\"><b>" . $try->how_complete() . "%</b></span> :: " . $try->get_value('mandatory', 'title'));
$sessionobject->add_session_var($class_num . '_objects_done', intval($sessionobject->get_session_var($class_num . '_objects_done')) + 1);
$sessionobject->add_session_var('categoriesfinished', 'TRUE');
} else {
// Sort out the forums
$forum_array = $this->get_vblite_forum_details($Db_source, $source_database_type, $source_table_prefix, $forum_start_at, $forum_per_page);
$cat_ids = $this->get_category_ids($Db_target, $target_database_type, $target_table_prefix);
$displayobject->display_now("<h4>Importing " . count($forum_array) . " forums</h4><p><b>From</b> : " . $forum_start_at . " :: <b>To</b> : " . ($forum_start_at + $forum_per_page) . "</p>");
$forum_object = new ImpExData($Db_target, $sessionobject, 'forum');
foreach ($forum_array as $forum_id => $forum) {
$try = phpversion() < '5' ? $forum_object : clone $forum_object;
$try->set_value('mandatory', 'title', $forum['title']);
$try->set_value('mandatory', 'displayorder', $forum['displayorder']);
$try->set_value('mandatory', 'parentid', $cat_ids[1]);
$try->set_value('mandatory', 'importforumid', $forum['forumid']);
$try->set_value('mandatory', 'importcategoryid', '0');
$try->set_value('mandatory', 'options', $this->_default_forum_permissions);
$try->set_value('nonmandatory', 'description', $forum['description']);
$try->set_value('nonmandatory', 'visible', $forum['active']);
if ($try->is_valid()) {
if ($try->import_forum($Db_target, $target_database_type, $target_table_prefix)) {
$displayobject->display_now("<br /><span class=\"isucc\"><b>" . $try->how_complete() . "%</b></span> :: " . $try->get_value('mandatory', 'title'));
$sessionobject->add_session_var($class_num . '_objects_done', intval($sessionobject->get_session_var($class_num . '_objects_done')) + 1);
$imported = true;
} else {
$sessionobject->add_error('warning', $this->_modulestring, get_class($this) . "::import_category failed for " . $cat['cat_title'] . " get_phpbb2_categories_details was ok.", 'Check database permissions and user table');
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
$displayobject->display_now("<br />Got category " . $cat['cat_title'] . " and <b>DID NOT</b> imported to the " . $target_database_type . " database");
}
} else {
$displayobject->display_now("<br />Invalid forum object, skipping." . $try->_failedon);
}
unset($try);
}
if (count($forum_array) == 0 or count($forum_array) < $forum_per_page) {
$this->build_forum_child_lists($Db_target, $target_database_type, $target_table_prefix);
$sessionobject->timing($class_num, 'stop', $sessionobject->get_session_var('autosubmit'));
$sessionobject->remove_session_var($class_num . '_start');
$displayobject->update_html($displayobject->module_finished($this->_modulestring, $sessionobject->return_stats($class_num, '_time_taken'), $sessionobject->return_stats($class_num, '_objects_done'), $sessionobject->return_stats($class_num, '_objects_failed')));
$sessionobject->set_session_var($class_num, 'FINISHED');
$sessionobject->set_session_var('forums', 'done');
$sessionobject->set_session_var('module', '000');
$sessionobject->set_session_var('autosubmit', '0');
}
$sessionobject->set_session_var('forumsstartat', $forum_start_at + $forum_per_page);
}
$displayobject->update_html($displayobject->print_redirect('index.php'));
}
示例3: resume
function resume(&$sessionobject, &$displayobject, &$Db_target, &$Db_source)
{
// Set up working variables.
$displayobject->update_basic('displaymodules', 'FALSE');
$t_db_type = $sessionobject->get_session_var('targetdatabasetype');
$t_tb_prefix = $sessionobject->get_session_var('targettableprefix');
$s_db_type = $sessionobject->get_session_var('sourcedatabasetype');
$s_tb_prefix = $sessionobject->get_session_var('sourcetableprefix');
// Per page vars
$start_at = $sessionobject->get_session_var('startat');
$per_page = $sessionobject->get_session_var('perpage');
$class_num = substr(get_class($this), -3);
$ImpExData_object = new ImpExData($Db_target, $sessionobject, 'pmtext');
$pm_object = new ImpExData($Db_target, $sessionobject, 'pm');
$idcache = new ImpExCache($Db_target, $t_db_type, $t_tb_prefix);
// Start the timing
if (!$sessionobject->get_session_var("{$class_num}_start")) {
$sessionobject->timing($class_num, 'start', $sessionobject->get_session_var('autosubmit'));
}
// Get an array data
$data_array = $this->get_source_data($Db_source, $s_db_type, "{$s_tb_prefix}pm", 'pmID', 0, $start_at, $per_page);
// Display count and pass time
$displayobject->print_per_page_pass($data_array['count'], $displayobject->phrases['pms'], $start_at);
foreach ($data_array['data'] as $pm_id => $pm) {
$pm_text_object = phpversion() < '5' ? $ImpExData_object : clone $ImpExData_object;
$pm_recipt = $this->get_wbb3_pm_recipt($Db_source, $s_db_type, $s_tb_prefix, $pm_id);
if (empty($pm_recipt)) {
$displayobject->display_now('<br />Empty recipt skipping.');
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
continue;
}
$userid = $idcache->get_id('user', $pm_recipt['recipientID']);
$username = $idcache->get_id('username', $pm_recipt['recipientID']);
unset($touserarray);
$touserarray[$userid] = $username;
$pm_text_object->set_value('mandatory', 'fromuserid', $idcache->get_id('user', $pm['userID']));
$pm_text_object->set_value('mandatory', 'title', $pm['subject']);
$pm_text_object->set_value('mandatory', 'message', $this->html_2_bb($pm['message']));
$pm_text_object->set_value('mandatory', 'importpmid', $pm_id);
$pm_text_object->set_value('mandatory', 'touserarray', addslashes(serialize($touserarray)));
$pm_text_object->set_value('nonmandatory', 'fromusername', $idcache->get_id('username', $pm['userID']));
$pm_text_object->set_value('nonmandatory', 'iconid', '');
$pm_text_object->set_value('nonmandatory', 'dateline', $pm['time']);
$pm_text_object->set_value('nonmandatory', 'showsignature', $pm['showSignature']);
$pm_text_object->set_value('nonmandatory', 'allowsmilie', $pm['enableSmilies']);
if ($pm_text_object->is_valid()) {
$pm_text_id = $pm_text_object->import_pm_text($Db_target, $t_db_type, $t_tb_prefix);
$vB_pm_to = phpversion() < '5' ? $pm_object : clone $pm_object;
$vB_pm_from = phpversion() < '5' ? $pm_object : clone $pm_object;
if ($pm_text_id) {
$vB_pm_to = phpversion() < '5' ? $pm_object : clone $pm_object;
$vB_pm_from = phpversion() < '5' ? $pm_object : clone $pm_object;
// The touser pm
$vB_pm_to->set_value('mandatory', 'pmtextid', $pm_text_id);
$vB_pm_to->set_value('mandatory', 'userid', $idcache->get_id('user', $pm_recipt['recipientID']));
$vB_pm_to->set_value('mandatory', 'importpmid', $pm_recipt['pmID']);
$vB_pm_to->set_value('nonmandatory', 'folderid', '1');
$vB_pm_to->set_value('nonmandatory', 'messageread', '0');
// The fromuser pm
$vB_pm_from->set_value('mandatory', 'pmtextid', $pm_text_id);
$vB_pm_from->set_value('mandatory', 'userid', $idcache->get_id('user', $pm['userID']));
$vB_pm_from->set_value('mandatory', 'importpmid', $pm_recipt['pmID']);
$vB_pm_from->set_value('nonmandatory', 'folderid', '-1');
$vB_pm_from->set_value('nonmandatory', 'messageread', '0');
if ($pm_text_object->is_valid()) {
if ($vB_pm_to->import_pm($Db_target, $t_db_type, $t_tb_prefix) and $vB_pm_from->import_pm($Db_target, $t_db_type, $t_tb_prefix)) {
if (shortoutput) {
$displayobject->display_now('.');
} else {
$displayobject->display_now('<br /><span class="isucc"><b>' . $pm_object->how_complete() . '%</b></span> ' . $displayobject->phrases['pm'] . ' -> ' . $pm_text_object->get_value('nonmandatory', 'fromusername'));
}
$sessionobject->add_session_var($class_num . '_objects_done', intval($sessionobject->get_session_var($class_num . '_objects_done')) + 1);
} else {
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
$sessionobject->add_error($Db_target, 'warning', $class_num, $pm_id, $displayobject->phrases['pm_not_imported'], $displayobject->phrases['pm_not_imported_rem_1']);
$displayobject->display_now("<br />{$displayobject->phrases['failed']} :: {$displayobject->phrases['pm_not_imported']}");
}
} else {
$sessionobject->add_error($Db_target, 'invalid', $class_num, $pm_id, $displayobject->phrases['invalid_object'], $pm_text_object->_failedon);
$displayobject->display_now("<br />{$displayobject->phrases['invalid_object']}" . $pm_text_object->_failedon);
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
}
} else {
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
$sessionobject->add_error($Db_target, 'warning', $class_num, $pm_id, $displayobject->phrases['pm_not_imported'], $displayobject->phrases['pm_not_imported_rem_2']);
$displayobject->display_now("<br />{$displayobject->phrases['failed']} :: {$displayobject->phrases['pm_not_imported']}");
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
}
} else {
$sessionobject->add_error($Db_target, 'invalid', $class_num, $pm_id, $displayobject->phrases['invalid_object'], $pm_text_object->_failedon);
$displayobject->display_now("<br />{$displayobject->phrases['invalid_object']}" . $pm_text_object->_failedon);
$sessionobject->set_session_var($class_num . '_objects_failed', $sessionobject->get_session_var($class_num . '_objects_failed') + 1);
}
unset($pm_text_object, $vB_pm_to, $vB_pm_from);
}
// End foreach
// Check for page end
if ($data_array['count'] == 0 or $data_array['count'] < $per_page) {
$sessionobject->timing($class_num, 'stop', $sessionobject->get_session_var('autosubmit'));
$sessionobject->remove_session_var("{$class_num}_start");
//.........這裏部分代碼省略.........
示例4: sizeof
function parse_message($data)
{
if ($discussion =& $this->get_first_tag('discussion')) {
/*
echo str_repeat('--', sizeof($this->stack)) . " message<br />\n";
flush();
*/
$user_names = $this->get_username($this->Db_object, $this->target_db_type, $this->target_db_prefix);
$users_ids = $this->get_user_ids($Db_target, $target_database_type, $target_table_prefix);
$userid = hexdec($data['attributes']['author']);
$post_object = new ImpExData($this->Db_object, $this->session, 'post');
$post_object->set_value('mandatory', 'threadid', $this->session->get_session_var('currentthread'));
$post_object->set_value('mandatory', 'userid', $users_ids[$userid]);
$post_object->set_value('mandatory', 'importthreadid', '1');
$post_object->set_value('nonmandatory', 'visible', '1');
$post_object->set_value('nonmandatory', 'dateline', strtotime(str_replace('.', ' ', $data['attributes']['date'])));
$post_object->set_value('nonmandatory', 'allowsmilie', '1');
$post_object->set_value('nonmandatory', 'showsignature', '1');
$post_object->set_value('nonmandatory', 'username', $user_names[$userid]);
$post_object->set_value('nonmandatory', 'ipaddress', $data['attributes']['sourceIp']);
$post_object->set_value('nonmandatory', 'title', htmlspecialchars($data['attributes']['title']));
$post_object->set_value('nonmandatory', 'pagetext', $this->html_2_bb($data['attributes']['body']));
$post_object->set_value('nonmandatory', 'importpostid', '1');
if ($post_object->import_post($this->Db_object, $this->target_db_type, $this->target_db_prefix)) {
echo "<br /><span class=\"isucc\">Post -- <b>" . $post_object->how_complete() . "%</b></span> :: Post from - " . $post_object->get_value('nonmandatory', 'username');
flush();
} else {
echo "<br />Post not imported";
}
unset($post_object);
}
}