本文整理汇总了PHP中CAdminList::IsUpdated方法的典型用法代码示例。如果您正苦于以下问题:PHP CAdminList::IsUpdated方法的具体用法?PHP CAdminList::IsUpdated怎么用?PHP CAdminList::IsUpdated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAdminList
的用法示例。
在下文中一共展示了CAdminList::IsUpdated方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$filter = array();
$filterFields = array();
$adminList->InitFilter($filterFields);
if (!$readOnly && $adminList->EditAction())
{
if (isset($FIELDS) && is_array($FIELDS))
{
$conn = Application::getConnection();
Internals\DiscountCouponTable::disableCheckCouponsUse();
foreach ($FIELDS as $couponID => $fields)
{
$couponID = (int)$couponID;
if ($couponID <= 0 || !$adminList->IsUpdated($couponID))
continue;
$conn->startTransaction();
$result = Internals\DiscountCouponTable::prepareCouponData($fields);
if ($result->isSuccess())
{
$result = Internals\DiscountCouponTable::update($couponID, $fields);
}
if ($result->isSuccess())
{
$conn->commitTransaction();
}
else
{
$conn->rollbackTransaction();
示例2: CAdminList
$lAdmin = new CAdminList($sTableID, $oSort);
$arFilterFields = array("filter_period_from", "filter_period_to", "filter_currency");
$lAdmin->InitFilter($arFilterFields);
$filter = new CAdminFilter($sTableID . "_filter", array(GetMessage("curr_rates_curr1")));
$arFilter = array("CURRENCY" => $filter_currency, "DATE_RATE" => $filter_period_from, "!DATE_RATE" => $filter_period_to);
if ($by != "curr" && $by != "rate") {
$by = "date";
}
$order = strtolower($order);
if ($order != "asc") {
$order = "desc";
}
if ($CURRENCY_RIGHT == "W" && $lAdmin->EditAction()) {
foreach ($FIELDS as $ID => $arFields) {
$ID = (int) $ID;
if (!$lAdmin->IsUpdated($ID)) {
continue;
}
$arCurR = CCurrencyRates::GetByID($ID);
$arFields["CURRENCY"] = $arCurR["CURRENCY"];
$res = CCurrencyRates::Update($ID, $arFields);
if (!$res) {
if ($e = $APPLICATION->GetException()) {
$lAdmin->AddUpdateError(GetMessage("SAVE_ERROR") . $ID . ": " . str_replace("<br>", " ", $e->GetString()), $ID);
}
}
}
}
if ($CURRENCY_RIGHT == "W" && ($arID = $lAdmin->GroupAction())) {
if ($_REQUEST['action_target'] == 'selected') {
$rsData = CCurrencyRates::GetList($by, $order, $arFilter);
示例3: foreach
if ($_REQUEST['filter_lang'] != 'NOT_REF') {
$filter['LID'] = (string) $_REQUEST['filter_lang'];
}
}
if (!empty($_REQUEST['filter_active'])) {
$_REQUEST['filter_active'] = (string) $_REQUEST['filter_active'];
if ($_REQUEST['filter_active'] == 'Y' || $_REQUEST['filter_active'] == 'N') {
$filter['ACTIVE'] = $_REQUEST['filter_active'];
}
}
if (!$readOnly && $adminList->EditAction()) {
if (isset($FIELDS) && is_array($FIELDS)) {
$conn = Application::getConnection();
foreach ($FIELDS as $ID => $fields) {
$ID = (int) $ID;
if ($ID <= 0 || !$adminList->IsUpdated($ID)) {
continue;
}
$conn->startTransaction();
$result = Internals\DiscountTable::update($ID, $fields);
if ($result->isSuccess()) {
$conn->commitTransaction();
} else {
$conn->rollbackTransaction();
$adminList->AddUpdateError(implode('<br>', $result->getErrorMessages()), $ID);
}
}
unset($fields, $ID);
}
}
if (!$readOnly && ($listID = $adminList->GroupAction())) {
示例4: while
$arLangs[$res["LID"]] = true;
} while ($res = $db_res->GetNext());
}
if ($_SERVER["REQUEST_METHOD"] == "POST" && ($_POST["save"] != '' || $_POST["apply"] != '') && $isAdmin && check_bitrix_sessid()) {
$_POST["EVENT_NAME"] = trim($_POST["EVENT_NAME"]);
$res = array();
$DB->StartTransaction();
if ($_POST["EVENT_NAME"] != '') {
$db_res = CEventType::GetListEx(array(), array("EVENT_NAME" => $_POST["EVENT_NAME"]), array("type" => "full"));
if (!$db_res || !($res = $db_res->Fetch())) {
$res["EVENT_NAME"] = $_POST["EVENT_NAME"];
}
}
foreach ($arParams["LANGUAGE"] as $idLang => $arLang) {
$arType = array("ID" => $_POST["FIELDS"][$idLang]["ID"], "SORT" => $_POST["FIELDS"][$idLang]["SORT"], "NAME" => $_POST["FIELDS"][$idLang]["NAME"], "DESCRIPTION" => $_POST["FIELDS"][$idLang]["DESCRIPTION"], "LID" => $idLang, "EVENT_NAME" => $res["EVENT_NAME"]);
if (CAdminList::IsUpdated($idLang) && $_REQUEST[$idLang] == "Y") {
if (intval($arType["ID"]) > 0 && !CEventType::Update(array("ID" => $arType["ID"]), $arType) || intval($arType["ID"]) <= 0 && !CEventType::Add($arType)) {
$bVarsFromForm = true;
}
}
if ($_REQUEST[$idLang] != "Y") {
unset($arLangs[$idLang]);
if (intval($arType["ID"]) > 0) {
if (!CEventType::Delete(array("ID" => $arType["ID"]))) {
$bVarsFromForm = true;
}
}
}
if ($bVarsFromForm) {
break;
}
示例5: array
$filter = array();
if (strlen($filter_name) > 0) {
$filter["?NAME"] = $filter_name;
}
if (strlen($filter_location_id) > 0) {
$filter["LOCATION_ID"] = $filter_location_id;
}
if (strlen($filter_active) > 0 && $filter_active != 'NOT_REF') {
$filter["ACTIVE"] = $filter_active;
}
$USER_FIELD_MANAGER->AdminListAddFilter(CompanyTable::getUfId(), $filter);
if ($lAdmin->EditAction() && $saleModulePermissions >= 'W') {
foreach ($request->getPost('FIELDS') as $id => $arFields) {
$error = false;
$id = intval($id);
if ($id <= 0 || !$lAdmin->IsUpdated($id)) {
continue;
}
$reqFields = array('NAME');
// , 'LOCATION_ID'
foreach ($reqFields as $reqField) {
if (empty($arFields[$reqField])) {
$error = true;
$lAdmin->AddUpdateError('#' . $id . ' : ' . Loc::getMessage('SALE_COMPANY_ERROR_NO_' . $reqField), $id);
}
}
if (!$error) {
$arFields['DATE_MODIFY'] = new \Bitrix\Main\Type\DateTime();
$arFields['MODIFIED_BY'] = $USER->GetID();
$conn->startTransaction();
$res = CompanyTable::update($id, $arFields);
示例6: while
} while ($res = $db_res->GetNext());
}
if ($_SERVER["REQUEST_METHOD"] == "POST" && ($_POST["save"] != '' || $_POST["apply"] != '') && $isAdmin && check_bitrix_sessid()) {
$_POST["EVENT_NAME"] = trim($_POST["EVENT_NAME"]);
$res = array();
$DB->StartTransaction();
if ($_POST["EVENT_NAME"] != '') {
$db_res = CEventType::GetListEx(array(), array("EVENT_NAME" => $_POST["EVENT_NAME"]), array("type" => "full"));
if (!$db_res || !($res = $db_res->Fetch())) {
$res["EVENT_NAME"] = $_POST["EVENT_NAME"];
}
}
foreach ($arParams["LANGUAGE"] as $idLang => $arLang) {
$arType = array("ID" => $_POST["FIELDS"][$idLang]["ID"], "SORT" => $_POST["FIELDS"][$idLang]["SORT"], "NAME" => $_POST["FIELDS"][$idLang]["NAME"], "DESCRIPTION" => $_POST["FIELDS"][$idLang]["DESCRIPTION"], "LID" => $idLang, "EVENT_NAME" => $res["EVENT_NAME"]);
$admList = new CAdminList("dummy");
if ($admList->IsUpdated($idLang) && $_REQUEST[$idLang] == "Y") {
if (intval($arType["ID"]) > 0 && !CEventType::Update(array("ID" => $arType["ID"]), $arType) || intval($arType["ID"]) <= 0 && !CEventType::Add($arType)) {
$bVarsFromForm = true;
}
}
if ($_REQUEST[$idLang] != "Y") {
unset($arLangs[$idLang]);
if (intval($arType["ID"]) > 0) {
if (!CEventType::Delete(array("ID" => $arType["ID"]))) {
$bVarsFromForm = true;
}
}
}
if ($bVarsFromForm) {
break;
}
示例7: CAdminSorting
if (!$USER->CanDoOperation('edit_other_settings') && !$USER->CanDoOperation('view_other_settings')) {
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
$isAdmin = $USER->CanDoOperation('edit_other_settings');
use Freetrix\Main;
use Freetrix\Main\Localization\CultureTable;
use Freetrix\Main\Localization\Loc;
Loc::loadMessages(__FILE__);
$tableID = "tbl_culture";
$sorting = new CAdminSorting($tableID, "name", "asc");
$adminList = new CAdminList($tableID, $sorting);
/** @var $request Main\HttpRequest */
$request = Main\Context::getCurrent()->getRequest();
if ($adminList->EditAction() && $isAdmin) {
foreach ($request["FIELDS"] as $ID => $arFields) {
if (!$adminList->IsUpdated($ID)) {
continue;
}
$result = CultureTable::update($ID, $arFields);
if (!$result->isSuccess()) {
$adminList->AddUpdateError("(ID=" . $ID . ") " . implode("<br>", $result->getErrorMessages()), $ID);
}
}
}
if (($arID = $adminList->GroupAction()) && $isAdmin) {
if ($request['action_target'] == 'selected') {
$arID = array();
$data = CultureTable::getList();
while ($culture = $data->fetch()) {
$arID[] = $culture['ID'];
}
示例8: CAdminFilter
}
$sTableID = "tbl_external_service_list";
$oFilter = new CAdminFilter($sTableID . "_filter", $arFilterTitles);
$oSort = new CAdminSorting($sTableID, "SORT", "asc");
$lAdmin = new CAdminList($sTableID, $oSort);
$lAdmin->InitFilter($arFilterFields);
// order, select and filter for the list
$listParams = Helper::proxyListRequest('list');
#####################################
#### ACTIONS
#####################################
global $DB;
if ($lAdmin->EditAction() && $userIsAdmin) {
foreach ($FIELDS as $id => $arFields) {
$DB->StartTransaction();
if (!$lAdmin->IsUpdated($id)) {
// if there were no data change on this row - do nothing with it
continue;
}
try {
$res = Helper::update($id, $arFields);
if (!empty($res['errors'])) {
foreach ($res['errors'] as &$error) {
$error = ' ' . $error;
}
unset($error);
throw new Main\SystemException(implode(',<br />', $res['errors']));
}
} catch (Main\SystemException $e) {
// todo: do smth
$lAdmin->AddUpdateError(Loc::getMessage('SALE_LOCATION_L_ITEM_SAVE_ERROR', array('#ITEM#' => $id)) . ": <br />" . $e->getMessage() . '<br />', $id);
示例9: ShowError
$strError = $ex->GetString();
ShowError($strError);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
die;
}
IncludeModuleLangFile(__FILE__);
$sTableID = "tbl_catalog_group";
$oSort = new CAdminSorting($sTableID, "ID", "asc");
$lAdmin = new CAdminList($sTableID, $oSort);
$arFilterFields = array();
$lAdmin->InitFilter($arFilterFields);
$arFilter = array();
if ($lAdmin->EditAction() && !$bReadOnly) {
foreach ($_POST['FIELDS'] as $ID => $arFields) {
$ID = (int) $ID;
if ($ID <= 0 || !$lAdmin->IsUpdated($ID)) {
continue;
}
$DB->StartTransaction();
if (!CCatalogGroup::Update($ID, $arFields)) {
if ($ex = $APPLICATION->GetException()) {
$lAdmin->AddUpdateError($ex->GetString(), $ID);
} else {
$lAdmin->AddUpdateError(GetMessage("ERROR_UPDATING_REC") . " (" . $arFields["ID"] . ", " . $arFields["NAME"] . ", " . $arFields["SORT"] . ")", $ID);
}
$DB->Rollback();
} else {
$DB->Commit();
}
}
}
示例10:
// order, select and filter for the list
$listParams = Helper::proxyListRequest('list');
#####################################
#### ACTIONS
#####################################
global $DB;
if($lAdmin->EditAction() && $userIsAdmin)
{
foreach($FIELDS as $id => $arFields)
{
$DB->StartTransaction();
if(!$lAdmin->IsUpdated($id)) // if there were no data change on this row - do nothing with it
continue;
try
{
$res = Helper::update($id, $arFields);
if(!empty($res['errors']))
{
foreach($res['errors'] as &$error)
$error = ' '.$error;
unset($error);
throw new Main\SystemException(implode(',<br />', $res['errors']));
}
}
示例11: __construct
/**
* Производится инициализация переменных, обработка запросов на редактирование
*
* @param array $fields
* @param bool $isPopup
* @throws \Bitrix\Main\ArgumentException
*/
public function __construct(array $fields, $isPopup = false)
{
$this->isPopup = $isPopup;
if ($this->isPopup) {
$this->fieldPopupResultName = preg_replace("/[^a-zA-Z0-9_:\\[\\]]/", "", $_REQUEST['n']);
$this->fieldPopupResultIndex = preg_replace("/[^a-zA-Z0-9_:]/", "", $_REQUEST['k']);
$this->fieldPopupResultElTitle = $_REQUEST['eltitle'];
}
parent::__construct($fields);
$this->restoreLastGetQuery();
$this->prepareAdminVariables();
$className = static::getModel();
$oSort = new \CAdminSorting($this->getListTableID(), static::pk(), "desc");
$this->list = new \CAdminList($this->getListTableID(), $oSort);
$this->list->InitFilter($this->arFilterFields);
if ($this->list->EditAction() and $this->hasWriteRights()) {
global $FIELDS;
foreach ($FIELDS as $id => $fields) {
if (!$this->list->IsUpdated($id)) {
continue;
}
$this->editAction($id, $fields);
}
}
if ($IDs = $this->list->GroupAction() and $this->hasWriteRights()) {
if ($_REQUEST['action_target'] == 'selected') {
$this->setContext(AdminListHelper::OP_GROUP_ACTION);
$IDs = array();
//Текущий фильтр должен быть модифицирован виждтами
//для соответствия результатов фильтрации тому, что видит пользователь в интерфейсе.
$raw = array('SELECT' => $this->pk(), 'FILTER' => $this->arFilter, 'SORT' => array());
foreach ($this->fields as $code => $settings) {
$widget = $this->createWidgetForField($code);
$widget->changeGetListOptions($this->arFilter, $raw['SELECT'], $raw['SORT'], $raw);
}
$res = $className::getList(array('filter' => $this->arFilter, 'select' => array($this->pk())));
while ($el = $res->Fetch()) {
$IDs[] = $el[$this->pk()];
}
}
$filteredIDs = array();
foreach ($IDs as $id) {
if (strlen($id) <= 0) {
continue;
}
$filteredIDs[] = IntVal($id);
}
$this->groupActions($IDs, $_REQUEST['action']);
}
if (isset($_REQUEST['action']) || isset($_REQUEST['action_button']) && count($this->getErrors()) == 0) {
$listHelperClass = $this->getHelperClass(AdminListHelper::className());
$className = $listHelperClass::getModel();
$id = isset($_GET['ID']) ? $_GET['ID'] : null;
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : $_REQUEST['action_button'];
if ($action != 'edit' && $_REQUEST['cancel'] != 'Y') {
$params = $_GET;
unset($params['action']);
unset($params['action_button']);
$this->customActions($action, $id);
$sectionEditHelperClass = $this->getHelperClass(AdminSectionEditHelper::className());
if ($sectionEditHelperClass) {
$element = $className::getById($id)->Fetch();
$sectionField = $listHelperClass::getSectionField();
if ($element[$sectionField]) {
$params['ID'] = $element[$sectionField];
}
}
LocalRedirect($listHelperClass::getUrl($params));
}
}
if ($this->isPopup()) {
$this->genPopupActionJS();
}
// Получаем параметры навигации
$navUniqSettings = array('sNavID' => $this->getListTableID());
$this->navParams = array('nPageSize' => \CAdminResult::GetNavSize($navUniqSettings), 'navParams' => \CAdminResult::GetNavParams($navUniqSettings));
}
示例12: CAdminSorting
* @var $APPLICATION CMain
*/
$forumModulePermissions = $APPLICATION->GetGroupRight("forum");
if ($forumModulePermissions == "D") {
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
IncludeModuleLangFile(__FILE__);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/forum/prolog.php";
$sTableID = "tbl_forum_group";
$oSort = new CAdminSorting($sTableID, "LEFT_MARGIN", "asc");
$lAdmin = new CAdminList($sTableID, $oSort);
$arFilter = array();
if ($forumModulePermissions >= "W") {
if ($lAdmin->EditAction()) {
foreach ($_POST["FIELDS"] as $ID => $arFields) {
if ($ID > 0 && $lAdmin->IsUpdated($ID) && CForumGroup::CanUserUpdateGroup($ID, $USER->GetUserGroupArray()) && CForumGroup::Update($ID, $arFields)) {
BXClearCache(true, "bitrix/forum/group/");
}
}
} else {
if ($arID = $lAdmin->GroupAction()) {
if ($_REQUEST['action_target'] == 'selected') {
$arID = array();
$dbResultList = CForumGroup::GetList(array($by => $order), $arFilter);
while ($arResult = $dbResultList->Fetch()) {
$arID[] = $arResult['ID'];
}
}
foreach ($arID as $ID) {
if ($ID > 0) {
switch ($_REQUEST['action']) {
示例13: __construct
/**
* Производится инициализация переменных, обработка запросов на редактирование
*
* @param array $fields
* @param bool $isPopup
* @throws \Bitrix\Main\ArgumentException
*/
public function __construct($fields, $isPopup = false)
{
$this->isPopup = $isPopup;
parent::__construct($fields);
$this->restoreLastGetQuery();
$this->prepareAdminVariables();
$this->addContextMenu();
$this->addGroupActions();
if (isset($_REQUEST['action'])) {
$id = isset($_REQUEST['ID']) ? $_REQUEST['ID'] : null;
$this->customActions($_REQUEST['action'], $id);
}
$className = static::getModel();
$oSort = new \CAdminSorting($this->getListTableID(), static::pk(), "desc");
$this->list = new \CAdminList($this->getListTableID(), $oSort);
$this->list->InitFilter($this->arFilterFields);
if ($this->list->EditAction() and $this->hasWriteRights()) {
global $FIELDS;
foreach ($FIELDS as $id => $fields) {
if (!$this->list->IsUpdated($id)) {
continue;
}
$id = intval($id);
$this->editAction($id, $fields);
}
}
if ($IDs = $this->list->GroupAction() and $this->hasWriteRights()) {
if ($_REQUEST['action_target'] == 'selected') {
$this->setContext(AdminListHelper::OP_GROUP_ACTION);
$IDs = array();
//Текущий фильтр должен быть модифицирован виждтами
//для соответствия результатов фильтрации тому, что видит пользователь в интерфейсе.
$raw = array('SELECT' => $this->pk(), 'FILTER' => $this->arFilter, 'SORT' => array());
foreach ($this->fields as $code => $settings) {
$widget = $this->createWidgetForField($code);
$widget->changeGetListOptions($this->arFilter, $raw['SELECT'], $raw['SORT'], $raw);
}
$res = $className::getList(array('filter' => $this->arFilter, 'select' => array($this->pk())));
while ($el = $res->Fetch()) {
$IDs[] = $el[$this->pk()];
}
}
$filteredIDs = array();
foreach ($IDs as $id) {
if (strlen($id) <= 0) {
continue;
}
$filteredIDs[] = IntVal($id);
}
$this->groupActions($IDs, $_REQUEST['action']);
}
if ($this->isPopup()) {
$this->genPopupActionJS();
}
}