protected function Form_Create() { $this->taskArray = array(); $this->taskArray[] = new WpUsersTask(); $this->taskArray[] = new WpTermsTask(); $this->taskArray[] = new WpTermTaxonomyTask(); $this->taskArray[] = new WpPostsTask(); $this->taskArray[] = new WpTermRelationshipsTask(); $this->taskArray[] = new WpCommentsTask(); $this->taskArray[] = new WpTermsAsTagsTask(); $this->taskArray[] = new WpTermTaxonomyCountTask(); $this->taskArray[] = new WpPostsStaticTask(); $this->taskArray[] = new WpCommentsCountTask(); // Populate plugin-related tables $objTableArray = WpPvcTotal::GetDatabase()->GetTables(); if (in_array(WpPvcTotal::GetTableName(), $objTableArray)) { $this->taskArray[] = new WpPvcTotalTask(); } if (in_array(WpPollsq::GetTableName(), $objTableArray) && in_array(WpPollsa::GetTableName(), $objTableArray) && in_array(WpPollsip::GetTableName(), $objTableArray)) { $this->taskArray[] = new WpPollsipTask(); } $this->lblMessage = new QPanel($this); $this->lblMessage->Text = QApplication::Translate('Click the button to start the conversion process.'); $this->lblMessage->HtmlEntities = false; $this->lblMessage->AddCssFile(__JQUERY_CSS__); $this->btnButton = new QJqButton($this); $this->btnButton->Text = QApplication::Translate('Convert!'); $this->btnButton->AddAction(new QClickEvent(), new QServerAction('btnButton_Click')); }
public static function GetSoapArrayFromArray($objArray) { if (!$objArray) { return null; } $objArrayToReturn = array(); foreach ($objArray as $objObject) { array_push($objArrayToReturn, WpPollsq::GetSoapObjectFromObject($objObject, true)); } return unserialize(serialize($objArrayToReturn)); }
public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) { if ($objObject->objPollaQidObject) { $objObject->objPollaQidObject = WpPollsq::GetSoapObjectFromObject($objObject->objPollaQidObject, false); } else { if (!$blnBindRelatedObjects) { $objObject->intPollaQid = null; } } return $objObject; }
/** * @param DlePoll $objDlePoll The DB ORM object to process */ protected function process_object($objDlePoll) { $objWpPollsq = WpPollsq::QuerySingle(QQ::Equal(QQN::WpPollsq()->PollqQuestion, $objDlePoll->Frage), QQ::Clause(QQ::LimitInfo(1))); if (!$objWpPollsq) { $objWpPollsq = new WpPollsq(); $objWpPollsq->PollqQuestion = $objDlePoll->Frage; $objWpPollsq->PollqTimestamp = $objDlePoll->News->Date->Timestamp; $objWpPollsq->PollqTotalvotes = $objDlePoll->Votes; $objWpPollsq->PollqActive = 1; $objWpPollsq->PollqExpiry = ''; $objWpPollsq->PollqMultiple = intval($objDlePoll->Multiple); $objWpPollsq->PollqTotalvoters = $objDlePoll->Votes; $objWpPollsq->Save(); $this->intPollQuestionCount++; } if ($objDlePoll->Answer && strlen($objDlePoll->Answer) && $objDlePoll->Body && strlen($objDlePoll->Body)) { $intA2VArray = array(); $strAnswerVoteArray = explode("|", $objDlePoll->Answer); if ($strAnswerVoteArray) { foreach ($strAnswerVoteArray as $strAnswerVote) { $intA2V = explode(":", $strAnswerVote); if (2 == count($intA2V)) { $intA2VArray[$intA2V[0]] = $intA2V[1]; } } } $strAnswerArray = explode("<br />", $objDlePoll->Body); $intAnswerCounter = 0; if ($strAnswerArray) { foreach ($strAnswerArray as $strAnswer) { $objWpPollsa = WpPollsa::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::WpPollsa()->PollaQid, $objWpPollsq->PollqId), QQ::Equal(QQN::WpPollsa()->PollaAnswers, $strAnswer)), QQ::Clause(QQ::OrderBy(QQN::WpPollsa()->PollaAid), QQ::LimitInfo(1))); if (!$objWpPollsa) { $objWpPollsa = new WpPollsa(); $objWpPollsa->PollaQid = $objWpPollsq->PollqId; $objWpPollsa->PollaAnswers = $strAnswer; $intVotes = 0; if (isset($intA2VArray[$intAnswerCounter])) { $intVotes = $intA2VArray[$intAnswerCounter]; } $objWpPollsa->PollaVotes = $intVotes; $objWpPollsa->Save(); $this->intPollAnswerCount++; } } } } $objDlePollLogArray = DlePollLog::LoadArrayByNewsId($objDlePoll->NewsId); if ($objDlePollLogArray) { foreach ($objDlePollLogArray as $objDlePollLog) { $strPollipUser = ''; $intPollipUserid = 0; $strPollipIp = ''; if (false === strpos($objDlePollLog->Member, '.')) { // The userId saved in the field Member $objDleUsers = DleUsers::Load($objDlePollLog->Member); if ($objDleUsers) { $objWpUsers = $objDleUsers->LoadWpUsers(); if ($objWpUsers) { $strPollipUser = $objWpUsers->UserLogin; $intPollipUserid = $objWpUsers->Id; } } } else { // The IP address is saved in the field Member $strPollipIp = $objDlePollLog->Member; } $objWpPollsip = WpPollsip::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::WpPollsip()->PollipQid, $objWpPollsq->PollqId), QQ::Equal(QQN::WpPollsip()->PollipIp, $strPollipIp), QQ::Equal(QQN::WpPollsip()->PollipUser, $strPollipUser), QQ::Equal(QQN::WpPollsip()->PollipUserid, $intPollipUserid)), QQ::Clause(QQ::OrderBy(QQN::WpPollsip()->PollipId), QQ::LimitInfo(1))); if (!$objWpPollsip) { $objWpPollsip = new WpPollsip(); $objWpPollsip->PollipQid = $objWpPollsq->PollqId; $objWpPollsip->PollipAid = ''; $objWpPollsip->PollipIp = $strPollipIp; $objWpPollsip->PollipUser = $strPollipUser; $objWpPollsip->PollipUserid = $intPollipUserid; $objWpPollsip->PollipHost = ''; $objWpPollsip->PollipTimestamp = '0'; $objWpPollsip->Save(); $this->intPollIpCount++; } } } // Insert the poll into the corresponding WP post $objDlePost = $objDlePoll->News; $objWpPosts = $objDlePost->LoadWpPosts(); $strText = $objWpPosts->PostContent; if (false === strpos($strText, "[poll id=")) { $objWpPosts->PostContent = sprintf('[poll id="%s"] %s', $objWpPollsq->PollqId, $strText); $objWpPosts->Save(); } $this->intPollCount++; }