Exemple #1
0
 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'));
 }
 /**
  * @param DlePost $objDlePost The DB ORM object to process
  */
 protected function process_object($objDlePost)
 {
     $objWpPosts = $objDlePost->LoadWpPosts();
     if (!$objWpPosts) {
         return;
     }
     $objWpPvcTotalArray = WpPvcTotal::LoadArrayByPostnum($objWpPosts->Id);
     if ($objWpPvcTotalArray) {
         foreach ($objWpPvcTotalArray as $objWpPvcTotal) {
             $objWpPvcTotal->Postcount = $objDlePost->NewsRead;
             $objWpPvcTotal->Save();
         }
     } else {
         $objWpPvcTotal = new WpPvcTotal();
         $objWpPvcTotal->Initialize();
         $objWpPvcTotal->Postnum = $objWpPosts->Id;
         $objWpPvcTotal->Postcount = $objDlePost->NewsRead;
         $objWpPvcTotal->Save();
     }
     $this->intPvcTotalCount++;
 }
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, WpPvcTotal::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
 /**
  * Counts all associated WpPvcTotalsAsPostnum
  * @return int
  */
 public function CountWpPvcTotalsAsPostnum()
 {
     if (is_null($this->intId)) {
         return 0;
     }
     return WpPvcTotal::CountByPostnum($this->intId);
 }