/**
     * @return string
     * @throws \Bitrix\Main\ArgumentException
     */
    public function getForm()
    {
        $listInput = '<select name="' . $this->getFieldName('LIST_ID') . '">';
        $listDb = ListTable::getList(array('select' => array('ID', 'NAME'), 'order' => array('NAME' => 'ASC', 'ID' => 'DESC')));
        while ($list = $listDb->fetch()) {
            $inputSelected = $list['ID'] == $this->getFieldValue('LIST_ID') ? 'selected' : '';
            $listInput .= '<option value="' . $list['ID'] . '" ' . $inputSelected . '>';
            $listInput .= htmlspecialcharsbx($list['NAME']);
            $listInput .= '</option>';
        }
        $listInput .= '</select>';
        return '
			<table>
				<tr>
					<td>' . Loc::getMessage('sender_connector_contact_list') . '</td>
					<td>' . $listInput . '</td>
				</tr>
			</table>
		';
    }
Пример #2
0
		<?php 
echo SelectBoxFromArray("find_unsubscribed", $filterMailingUnSubList, $rub_f_unsubscribed, GetMessage("MAIN_ALL"), "");
?>
	</td>
</tr>
<tr>
	<td><?php 
echo GetMessage("rub_f_list");
?>
:</td>
	<td>
		<?php 
$arr = array();
$arr['reference'][] = GetMessage("SENDER_CONTACT_ADM_FILTER_WITHOUT");
$arr['reference_id'][] = 'NONE';
$listDb = \Bitrix\Sender\ListTable::getList(array('select' => array('REFERENCE' => 'NAME', 'REFERENCE_ID' => 'ID')));
while ($arList = $listDb->fetch()) {
    $arr['reference'][] = $arList['REFERENCE'];
    $arr['reference_id'][] = $arList['REFERENCE_ID'];
}
echo SelectBoxFromArray("find_list", $arr, $find_list, GetMessage("MAIN_ALL"), "");
?>
	</td>
</tr>
<?php 
$oFilter->Buttons(array("table_id" => $sTableID, "url" => $APPLICATION->GetCurPage(), "form" => "find_form"));
$oFilter->End();
?>
</form>

Пример #3
0
	if(count($aEmailInvalid)>0)
	{
		foreach($aEmailInvalid as $email) if(!empty($email)) $arError[] = array("id"=>"", "text"=>htmlspecialcharsbx($email));
		$nSuccess += count($aEmailInvalid);
		$nError += count($aEmailInvalid);
	}

}//$REQUEST_METHOD=="POST"
else
{
	$LIST_TYPE = "E";
}

$listDict = array();
$listDb = \Bitrix\Sender\ListTable::getList();
while($arList = $listDb->fetch())
{
	$listDict[] = $arList;
}
if(empty($listDict))
	$LIST_TYPE = "N";

$APPLICATION->SetTitle(GetMessage("sender_imp_title"));

require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_after.php");

if(count($arError)>0)
{
	$e = new CAdminException($arError);
	$message = new CAdminMessage(GetMessage("sender_imp_error"), $e);
Пример #4
0
 /**
  * @param Connector $connector
  * @param null $pageNumber
  * @param int $timeout
  * @return array
  * @throws \Bitrix\Main\ArgumentException
  */
 public static function addFromConnector(Connector $connector, $pageNumber = null, $timeout = 0)
 {
     $startTime = getmicrotime();
     $withoutNav = empty($pageNumber);
     $result = false;
     $onlyOneLoop = false;
     $rowsInPage = 5;
     $countAll = 0;
     $countProcessed = 0;
     $countUpdated = 0;
     $countAdded = 0;
     $countError = 0;
     $dataDb = $connector->getResult();
     if ($dataDb->resourceCDBResult) {
         $dataDb = $dataDb->resourceCDBResult;
     } elseif ($dataDb->resource) {
         $dataDb = new \CDBResult($dataDb->resource);
     } else {
         $dataDb = new \CDBResult();
         $dataDb->InitFromArray(array());
     }
     if (!is_subclass_of($dataDb, 'CDBResultMysql')) {
         $rowsInPage = 50;
         $onlyOneLoop = true;
     }
     while ($timeout == 0 || getmicrotime() - $startTime < $timeout) {
         if (!$withoutNav) {
             $dataDb->NavStart($rowsInPage, false, $pageNumber);
             $countAll = $dataDb->SelectedRowsCount();
         }
         $listId = null;
         while ($arData = $dataDb->Fetch()) {
             if ($withoutNav) {
                 $countAll++;
             }
             $countProcessed++;
             if (!$listId) {
                 $listId = ListTable::addIfNotExist($connector->getModuleId() . '_' . $connector->getCode(), Loc::getMessage('CONTACT_PULL_LIST_PREFIX') . $connector->getName());
             }
             $id = null;
             $contactDb = ContactTable::getList(array('select' => array('ID'), 'filter' => array('EMAIL' => $arData['EMAIL'])));
             if ($arContact = $contactDb->fetch()) {
                 $id = $arContact['ID'];
                 $countUpdated++;
             } else {
                 $resultAdd = static::add(array('NAME' => $arData['NAME'], 'EMAIL' => $arData['EMAIL'], 'USER_ID' => $arData['USER_ID']));
                 if ($resultAdd->isSuccess()) {
                     $id = $resultAdd->getId();
                     $countAdded++;
                 } else {
                     $countError++;
                 }
             }
             if ($id) {
                 ContactListTable::addIfNotExist($id, $listId);
             }
         }
         if ($withoutNav) {
             $result = false;
             break;
         }
         if ($dataDb->NavPageCount <= $pageNumber) {
             $result = false;
             break;
         } else {
             $pageNumber++;
             $result = $pageNumber;
         }
         if ($onlyOneLoop) {
             break;
         }
     }
     if ($withoutNav) {
         $countProgress = $countAll;
     } else {
         $countProgress = ($pageNumber - 1) * $dataDb->NavPageSize;
         if (!$result || $countProgress > $countAll) {
             $countProgress = $countAll;
         }
     }
     return array('STATUS' => $result, 'COUNT_ALL' => $countAll, 'COUNT_PROGRESS' => $countProgress, 'COUNT_PROCESSED' => $countProcessed, 'COUNT_NEW' => $countAdded, 'COUNT_ERROR' => $countError);
 }
Пример #5
0
                $DB->Commit();
                break;
            case "activate":
            case "deactivate":
                $arFields["ACTIVE"] = $_REQUEST['action'] == "activate" ? "Y" : "N";
                $dataUpdateDb = \Bitrix\Sender\ListTable::update($dataPrimary, $arFields);
                if (!$dataUpdateDb->isSuccess()) {
                    $LAST_ERROR = $dataUpdateDb->getErrorMessages();
                    $LAST_ERROR = $LAST_ERROR[0];
                    $lAdmin->AddGroupError(GetMessage("rub_save_error") . $LAST_ERROR, $ID);
                }
                break;
        }
    }
}
$listDb = \Bitrix\Sender\ListTable::getList(array('filter' => $arFilter, 'order' => array($by => $order)));
$rsData = new CAdminResult($listDb, $sTableID);
$rsData->NavStart();
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("rub_nav")));
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "ID", "align" => "right", "default" => true), array("id" => "NAME", "content" => GetMessage("rub_name"), "sort" => "NAME", "default" => true), array("id" => "SORT", "content" => GetMessage("rub_sort"), "sort" => "SORT", "align" => "right", "default" => true), array("id" => "CODE", "content" => GetMessage("rub_code"), "sort" => "CODE", "default" => true)));
while ($arRes = $rsData->NavNext(true, "f_")) {
    $row =& $lAdmin->AddRow($f_ID, $arRes);
    $row->AddInputField("NAME", array("size" => 20));
    $row->AddInputField("SORT", array("size" => 6));
    $row->AddInputField("CODE", array("size" => 20));
    $arActions = array();
    $arActions[] = array("ICON" => "edit", "DEFAULT" => true, "TEXT" => GetMessage("rub_edit"), "ACTION" => $lAdmin->ActionDoGroup($f_ID, "edit"));
    if ($POST_RIGHT >= "W") {
        $arActions[] = array("ICON" => "delete", "TEXT" => GetMessage("rub_del"), "ACTION" => "if(confirm('" . GetMessage('rub_del_conf') . "')) " . $lAdmin->ActionDoGroup($f_ID, "delete"));
    }
    $arActions[] = array("SEPARATOR" => true);