当前位置: 首页>>代码示例>>PHP>>正文


PHP Import::getFinalData方法代码示例

本文整理汇总了PHP中Import::getFinalData方法的典型用法代码示例。如果您正苦于以下问题:PHP Import::getFinalData方法的具体用法?PHP Import::getFinalData怎么用?PHP Import::getFinalData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Import的用法示例。


在下文中一共展示了Import::getFinalData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: importuser

 function importuser()
 {
     global $objDatabase, $_ARRAYLANG;
     $objTpl = new \Cx\Core\Html\Sigma(ASCMS_MODULE_PATH . '/Newsletter/View/Template/Backend');
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($objTpl);
     $objTpl->setErrorHandling(PEAR_ERROR_DIE);
     \Env::get('ClassLoader')->loadFile(ASCMS_LIBRARY_PATH . '/importexport/import.class.php');
     $objImport = new \Import();
     $arrFields = array('email' => $_ARRAYLANG['TXT_NEWSLETTER_EMAIL_ADDRESS'], 'sex' => $_ARRAYLANG['TXT_NEWSLETTER_SEX'], 'salutation' => $_ARRAYLANG['TXT_NEWSLETTER_SALUTATION'], 'title' => $_ARRAYLANG['TXT_NEWSLETTER_TITLE'], 'lastname' => $_ARRAYLANG['TXT_NEWSLETTER_LASTNAME'], 'firstname' => $_ARRAYLANG['TXT_NEWSLETTER_FIRSTNAME'], 'position' => $_ARRAYLANG['TXT_NEWSLETTER_POSITION'], 'company' => $_ARRAYLANG['TXT_NEWSLETTER_COMPANY'], 'industry_sector' => $_ARRAYLANG['TXT_NEWSLETTER_INDUSTRY_SECTOR'], 'address' => $_ARRAYLANG['TXT_NEWSLETTER_ADDRESS'], 'zip' => $_ARRAYLANG['TXT_NEWSLETTER_ZIP'], 'city' => $_ARRAYLANG['TXT_NEWSLETTER_CITY'], 'country_id' => $_ARRAYLANG['TXT_NEWSLETTER_COUNTRY'], 'phone_office' => $_ARRAYLANG['TXT_NEWSLETTER_PHONE'], 'phone_private' => $_ARRAYLANG['TXT_NEWSLETTER_PHONE_PRIVATE'], 'phone_mobile' => $_ARRAYLANG['TXT_NEWSLETTER_PHONE_MOBILE'], 'fax' => $_ARRAYLANG['TXT_NEWSLETTER_FAX'], 'birthday' => $_ARRAYLANG['TXT_NEWSLETTER_BIRTHDAY'], 'uri' => $_ARRAYLANG['TXT_NEWSLETTER_WEBSITE'], 'notes' => $_ARRAYLANG['TXT_NEWSLETTER_NOTES'], 'language' => $_ARRAYLANG['TXT_NEWSLETTER_LANGUAGE']);
     if (isset($_POST['import_cancel'])) {
         // Abbrechen. Siehe Abbrechen
         $objImport->cancel();
         \Cx\Core\Csrf\Controller\Csrf::header("Location: index.php?cmd=Newsletter&act=users&tpl=import");
         exit;
     } elseif (isset($_POST['fieldsSelected'])) {
         // Speichern der Daten. Siehe Final weiter unten.
         $arrRecipients = $objImport->getFinalData($arrFields);
         if (empty($_POST['newsletter_recipient_associated_list'])) {
             self::$strErrMessage = $_ARRAYLANG['TXT_NEWSLETTER_SELECT_CATEGORY'];
         } else {
             $arrLists = array();
             if (isset($_POST['newsletter_recipient_associated_list'])) {
                 foreach (explode(',', $_POST['newsletter_recipient_associated_list']) as $listId) {
                     array_push($arrLists, intval($listId));
                 }
             }
             $EmailCount = 0;
             $arrBadEmails = array();
             $ExistEmails = 0;
             $NewEmails = 0;
             $recipientSendEmailId = isset($_POST['sendEmail']) ? intval($_POST['sendEmail']) : 0;
             foreach ($arrRecipients as $arrRecipient) {
                 if (empty($arrRecipient['email'])) {
                     continue;
                 }
                 if (!strpos($arrRecipient['email'], '@')) {
                     continue;
                 }
                 $arrRecipient['email'] = trim($arrRecipient['email']);
                 if (!\FWValidator::isEmail($arrRecipient['email'])) {
                     array_push($arrBadEmails, $arrRecipient['email']);
                 } else {
                     $EmailCount++;
                     $arrRecipientLists = $arrLists;
                     // TODO: use FWUSER
                     if (in_array($arrRecipient['salutation'], $this->_getRecipientTitles())) {
                         $arrRecipientTitles = array_flip($this->_getRecipientTitles());
                         $recipientSalutationId = $arrRecipientTitles[$arrRecipient['salutation']];
                     } else {
                         $recipientSalutationId = $this->_addRecipientTitle($arrRecipient['salutation']);
                     }
                     // try to parse the imported birthday in a usable format
                     if (!empty($arrRecipient['birthday'])) {
                         $arrDate = date_parse($arrRecipient['birthday']);
                         $arrRecipient['birthday'] = $arrDate['day'] . '-' . $arrDate['month'] . '-' . $arrDate['year'];
                     }
                     $objRecipient = $objDatabase->SelectLimit("SELECT `id`,\n                                                                          `language`,\n                                                                          `status`,\n                                                                          `notes`\n                                                                   FROM `" . DBPREFIX . "module_newsletter_user`\n                                                                   WHERE `email` = '" . addslashes($arrRecipient['email']) . "'", 1);
                     if ($objRecipient->RecordCount() == 1) {
                         $recipientId = $objRecipient->fields['id'];
                         $recipientLanguage = $objRecipient->fields['language'];
                         $recipientStatus = $objRecipient->fields['status'];
                         $recipientNotes = !empty($objRecipient->fields['notes']) ? $objRecipient->fields['notes'] . ' ' . $arrRecipient['notes'] : $arrRecipient['notes'];
                         $objList = $objDatabase->Execute("SELECT `category` FROM " . DBPREFIX . "module_newsletter_rel_user_cat WHERE user=" . $recipientId);
                         if ($objList !== false) {
                             while (!$objList->EOF) {
                                 array_push($arrRecipientLists, $objList->fields['category']);
                                 $objList->MoveNext();
                             }
                         }
                         $arrRecipientLists = array_unique($arrRecipientLists);
                         $recipientAttributeStatus = array();
                         $this->_updateRecipient($recipientAttributeStatus, $recipientId, $arrRecipient['email'], $arrRecipient['uri'], $arrRecipient['sex'], $recipientSalutationId, $arrRecipient['title'], $arrRecipient['lastname'], $arrRecipient['firstname'], $arrRecipient['position'], $arrRecipient['company'], $arrRecipient['industry_sector'], $arrRecipient['address'], $arrRecipient['zip'], $arrRecipient['city'], $arrRecipient['country_id'], $arrRecipient['phone_office'], $arrRecipient['phone_private'], $arrRecipient['phone_mobile'], $arrRecipient['fax'], $recipientNotes, $arrRecipient['birthday'], $recipientStatus, $arrRecipientLists, $recipientLanguage);
                         $ExistEmails++;
                     } else {
                         $NewEmails++;
                         if (!$this->_addRecipient($arrRecipient['email'], $arrRecipient['uri'], $arrRecipient['sex'], $recipientSalutationId, $arrRecipient['title'], $arrRecipient['lastname'], $arrRecipient['firstname'], $arrRecipient['position'], $arrRecipient['company'], $arrRecipient['industry_sector'], $arrRecipient['address'], $arrRecipient['zip'], $arrRecipient['city'], $arrRecipient['country_id'], $arrRecipient['phone_office'], $arrRecipient['phone_private'], $arrRecipient['phone_mobile'], $arrRecipient['fax'], $arrRecipient['notes'], $arrRecipient['birthday'], 1, $arrRecipientLists, $arrRecipient['language'])) {
                             array_push($arrBadEmails, $arrRecipient['email']);
                         } elseif (!empty($recipientSendEmailId)) {
                             $objRecipient = $objDatabase->SelectLimit("\n                                    SELECT id\n                                    FROM " . DBPREFIX . "module_newsletter_user\n                                        WHERE email='" . contrexx_input2db($arrRecipient['email']) . "'", 1);
                             $recipientId = $objRecipient->fields['id'];
                             $this->insertTmpEmail($recipientSendEmailId, $arrRecipient['email'], self::USER_TYPE_NEWSLETTER);
                             // setting TmpEntry=1 will set the newsletter status=1, this will force an imediate stop in the newsletter send procedere.
                             if ($this->SendEmail($recipientId, $recipientSendEmailId, $arrRecipient['email'], 1, self::USER_TYPE_NEWSLETTER) == false) {
                                 self::$strErrMessage .= $_ARRAYLANG['TXT_SENDING_MESSAGE_ERROR'];
                             } else {
                                 // TODO: Unused
                                 //                                    $objUpdateCount    =
                                 $objDatabase->execute('
                                     UPDATE ' . DBPREFIX . 'module_newsletter
                                     SET recipient_count = recipient_count+1
                                     WHERE id=' . intval($recipientSendEmailId));
                             }
                         }
                     }
                 }
             }
             self::$strOkMessage = $_ARRAYLANG['TXT_DATA_IMPORT_SUCCESSFUL'] . "<br/>" . $_ARRAYLANG['TXT_CORRECT_EMAILS'] . ": " . $EmailCount . "<br/>" . $_ARRAYLANG['TXT_NOT_VALID_EMAILS'] . ": " . implode(', ', $arrBadEmails) . "<br/>" . $_ARRAYLANG['TXT_EXISTING_EMAILS'] . ": " . $ExistEmails . "<br/>" . $_ARRAYLANG['TXT_NEW_ADDED_EMAILS'] . ": " . $NewEmails;
             $objImport->initFileSelectTemplate($objTpl);
             $objTpl->setVariable(array("IMPORT_ACTION" => "index.php?cmd=Newsletter&amp;act=users&amp;tpl=import", 'TXT_FILETYPE' => $_ARRAYLANG['TXT_NEWSLETTER_FILE_TYPE'], 'TXT_HELP' => $_ARRAYLANG['TXT_NEWSLETTER_IMPORT_HELP'], 'IMPORT_ADD_NAME' => $_ARRAYLANG['TXT_NEWSLETTER_SEND_EMAIL'], 'IMPORT_ADD_VALUE' => $this->_getEmailsDropDown(), 'IMPORT_ROWCLASS' => 'row1'));
             $objTpl->parse("additional");
//.........这里部分代码省略.........
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:101,代码来源:NewsletterManager.class.php

示例2: elseif

 /**
  * Import
  *
  * Shows the import dialog
  * Customer.
  * @access private
  * @global ADONewConnection
  * @global array
  */
 function _import()
 {
     global $objDatabase, $_ARRAYLANG;
     \Env::get('ClassLoader')->loadFile(ASCMS_LIBRARY_PATH . '/importexport/import.class.php');
     $importlib = new \Import();
     if (isset($_POST['import_cancel'])) {
         $importlib->cancel();
         \Cx\Core\Csrf\Controller\Csrf::header("Location: index.php?cmd=MemberDir&act=import");
         exit;
     } elseif ($_POST['fieldsSelected']) {
         $fieldnames = $this->getFieldData($_POST['directory']);
         foreach ($fieldnames as $fieldKey => $fieldValue) {
             if ($fieldValue['active']) {
                 $fields[$fieldKey] = $fieldValue['name'];
             }
         }
         $data = $importlib->getFinalData($fields);
         foreach ($data as $row) {
             $query = "INSERT INTO " . DBPREFIX . "module_memberdir_values\n                    (`dirid`, `pic1`, `pic2`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`,\n                     `10`, `11`, `12`, `13`, `14`, `15`, `16`, `17`, `18`, `lang_id`) VALUES\n                    ('" . $_POST['directory'] . "',\n                     'none', 'none',\n                     '" . $this->getDbInput($row[1]) . "',\n                     '" . $this->getDbInput($row[2]) . "',\n                     '" . $this->getDbInput($row[3]) . "',\n                     '" . $this->getDbInput($row[4]) . "',\n                     '" . $this->getDbInput($row[5]) . "',\n                     '" . $this->getDbInput($row[6]) . "',\n                     '" . $this->getDbInput($row[7]) . "',\n                     '" . $this->getDbInput($row[8]) . "',\n                     '" . $this->getDbInput($row[9]) . "',\n                     '" . $this->getDbInput($row[10]) . "',\n                     '" . $this->getDbInput($row[11]) . "',\n                     '" . $this->getDbInput($row[12]) . "',\n                     '" . $this->getDbInput($row[13]) . "',\n                     '" . $this->getDbInput($row[14]) . "',\n                     '" . $this->getDbInput($row[15]) . "',\n                     '" . $this->getDbInput($row[16]) . "',\n                     '" . $this->getDbInput($row[17]) . "',\n                     '" . $this->getDbInput($row[18]) . "',\n                     '" . $this->langId . "')\n                ";
             if (!$objDatabase->Execute($query)) {
                 echo $objDatabase->ErrorMsg();
             }
             \Cx\Core\Csrf\Controller\Csrf::header("Location: index.php?cmd=MemberDir&act=showdir&id=" . $_POST['directory']);
         }
     } elseif ($_FILES['importfile']['size'] == 0) {
         $importlib->initFileSelectTemplate($this->_objTpl);
         /*
          * We need an additional input field for the selection
          * of the directory
          */
         $this->_objTpl->setVariable(array("IMPORT_ACTION" => "?cmd=MemberDir&amp;act=import", "IMPORT_ADD_NAME" => $_ARRAYLANG['TXT_DIRECTORY'], "IMPORT_ADD_VALUE" => $this->dirList('directory', $this->firstDir, 200), "IMPORT_ROWCLASS" => "row1", "TXT_HELP" => $_ARRAYLANG['TXT_IMPORT_HELP']));
         $this->_objTpl->parse("additional");
     } else {
         $fieldnames = $this->getFieldData($_POST['directory']);
         foreach ($fieldnames as $key => $value) {
             if ($value['active']) {
                 $given_fields[$key] = $value['name'];
             }
         }
         $importlib->initFieldSelectTemplate($this->_objTpl, $given_fields);
         /*
          * We need to pass the directory value, given by the
          * file selection template to the next step of importing
          */
         $this->_objTpl->setVariable(array("IMPORT_HIDDEN_NAME" => "directory", "IMPORT_HIDDEN_VALUE" => $_POST['directory']));
     }
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:56,代码来源:MemberDirManager.class.php


注:本文中的Import::getFinalData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。