本文整理汇总了PHP中Import::initFieldSelectTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP Import::initFieldSelectTemplate方法的具体用法?PHP Import::initFieldSelectTemplate怎么用?PHP Import::initFieldSelectTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Import
的用法示例。
在下文中一共展示了Import::initFieldSelectTemplate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importuser
//.........这里部分代码省略.........
// 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&act=users&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");
$objTpl->setVariable(array('IMPORT_ADD_NAME' => $_ARRAYLANG['TXT_NEWSLETTER_LIST'], 'IMPORT_ADD_VALUE' => $this->_getAssociatedListSelection(), 'IMPORT_ROWCLASS' => 'row2'));
$objTpl->parse("additional");
$this->_objTpl->setVariable('NEWSLETTER_USER_FILE', $objTpl->get());
}
} elseif (empty($_POST['importfile']) || isset($_POST['imported']) && empty($_POST['newsletter_recipient_associated_list'])) {
// Dateiauswahldialog. Siehe Fileselect
$this->_pageTitle = $_ARRAYLANG['TXT_IMPORT'];
$this->_objTpl->addBlockfile('NEWSLETTER_USER_FILE', 'module_newsletter_user_import', 'module_newsletter_user_import.html');
if (isset($_POST['imported']) && empty($_POST['newsletter_recipient_associated_list'])) {
self::$strErrMessage = $_ARRAYLANG['TXT_NEWSLETTER_SELECT_CATEGORY'];
}
$objImport->initFileSelectTemplate($objTpl);
$objTpl->setVariable(array("IMPORT_ACTION" => "index.php?cmd=Newsletter&act=users&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");
$objTpl->setVariable(array('IMPORT_ADD_NAME' => $_ARRAYLANG['TXT_NEWSLETTER_LIST'], 'IMPORT_ADD_VALUE' => $this->_getAssociatedListSelection(), 'IMPORT_ROWCLASS' => 'row2'));
$objTpl->parse("additional");
$this->_objTpl->setVariable(array('TXT_NEWSLETTER_IMPORT_FROM_FILE' => $_ARRAYLANG['TXT_NEWSLETTER_IMPORT_FROM_FILE'], 'TXT_IMPORT' => $_ARRAYLANG['TXT_IMPORT'], 'TXT_NEWSLETTER_LIST' => $_ARRAYLANG['TXT_NEWSLETTER_LIST'], 'TXT_ENTER_EMAIL_ADDRESS' => $_ARRAYLANG['TXT_ENTER_EMAIL_ADDRESS'], 'NEWSLETTER_CATEGORY_MENU' => $this->_getAssociatedListSelection(), 'NEWSLETTER_IMPORT_FRAME' => $objTpl->get()));
if (isset($_POST['newsletter_import_plain'])) {
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 ($_POST['newsletter_recipient_associated_list'] as $listId) {
array_push($arrLists, intval($listId));
}
}
$EmailList = str_replace(array(']', '[', "\t", "\n", "\r"), ' ', $_REQUEST["Emails"]);
$EmailArray = preg_split('/[\\s"\';,:<>\\n]+/', contrexx_stripslashes($EmailList));
$EmailCount = 0;
$arrBadEmails = array();
$ExistEmails = 0;
$NewEmails = 0;
foreach ($EmailArray as $email) {
if (empty($email)) {
continue;
}
if (!strpos($email, '@')) {
continue;
}
if (!\FWValidator::isEmail($email)) {
array_push($arrBadEmails, $email);
} else {
$EmailCount++;
$objRecipient = $objDatabase->SelectLimit("SELECT `id` FROM `" . DBPREFIX . "module_newsletter_user` WHERE `email` = '" . addslashes($email) . "'", 1);
if ($objRecipient->RecordCount() == 1) {
foreach ($arrLists as $listId) {
$this->_addRecipient2List($objRecipient->fields['id'], $listId);
}
$ExistEmails++;
} else {
$NewEmails++;
if ($objDatabase->Execute("\n INSERT INTO `" . DBPREFIX . "module_newsletter_user` (\n `code`, `email`, `status`, `emaildate`\n ) VALUES (\n '" . $this->_emailCode() . "', '" . addslashes($email) . "', 1, " . time() . "\n )") !== false) {
$this->_setRecipientLists($objDatabase->Insert_ID(), $arrLists);
} else {
array_push($arrBadEmails, $email);
}
}
}
}
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;
}
}
$this->_objTpl->parse('module_newsletter_user_import');
} else {
// Felderzuweisungsdialog. Siehe Fieldselect
$objImport->initFieldSelectTemplate($objTpl, $arrFields);
$arrLists = array();
if (isset($_POST['newsletter_recipient_associated_list'])) {
foreach ($_POST['newsletter_recipient_associated_list'] as $listId) {
array_push($arrLists, intval($listId));
}
}
$objTpl->setVariable(array('IMPORT_HIDDEN_NAME' => 'newsletter_recipient_associated_list', 'IMPORT_HIDDEN_VALUE' => !empty($arrLists) ? implode(',', $arrLists) : ''));
$objTpl->parse('hidden_fields');
$objTpl->setVariable(array('IMPORT_HIDDEN_NAME' => 'sendEmail', 'IMPORT_HIDDEN_VALUE' => isset($_POST['sendEmail']) ? intval($_POST['sendEmail']) : 0));
$objTpl->parse('hidden_fields');
$objTpl->setVariable(array('IMPORT_ACTION' => 'index.php?cmd=Newsletter&act=users&tpl=import'));
$this->_objTpl->setVariable(array('TXT_REMOVE_PAIR' => $_ARRAYLANG['TXT_REMOVE_PAIR'], 'NEWSLETTER_USER_FILE' => $objTpl->get()));
}
}
示例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&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']));
}
}