本文整理汇总了PHP中CGroup::Update方法的典型用法代码示例。如果您正苦于以下问题:PHP CGroup::Update方法的具体用法?PHP CGroup::Update怎么用?PHP CGroup::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGroup
的用法示例。
在下文中一共展示了CGroup::Update方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateGroupIfExists
public function updateGroupIfExists($code, $fields = array())
{
$groupId = $this->getGroupId($code);
if (!$groupId) {
return false;
}
if (empty($fields)) {
$this->throwException(__METHOD__, 'Set fields for group %s', $code);
}
$group = new \CGroup();
if ($group->Update($groupId, $fields)) {
return intval($groupId);
}
$this->throwException(__METHOD__, $group->LAST_ERROR);
}
示例2: CSite
$obSite = new CSite();
$obSite->Update("s1", array("NAME" => COption::GetOptionString("main", "site_name", GetMessage("DEFAULT_SITE_NAME"))));
//Edit profile task
$editProfileTask = false;
$dbResult = CTask::GetList(array(), array("NAME" => "main_change_profile"));
if ($arTask = $dbResult->Fetch()) {
$editProfileTask = $arTask["ID"];
}
//admin security policy
$z = CGroup::GetByID(1);
if ($res = $z->Fetch()) {
if ($res["SECURITY_POLICY"] == "") {
$group = new CGroup();
$arGroupPolicy = array("SESSION_TIMEOUT" => 15, "SESSION_IP_MASK" => "255.255.255.255", "MAX_STORE_NUM" => 1, "STORE_IP_MASK" => "255.255.255.255", "STORE_TIMEOUT" => 60 * 24 * 3, "CHECKWORD_TIMEOUT" => 60, "PASSWORD_LENGTH" => 10, "PASSWORD_UPPERCASE" => "Y", "PASSWORD_LOWERCASE" => "Y", "PASSWORD_DIGITS" => "Y", "PASSWORD_PUNCTUATION" => "Y", "LOGIN_ATTEMPTS" => 3);
$arFields = array("SECURITY_POLICY" => serialize($arGroupPolicy));
$group->Update(1, $arFields);
}
}
//Registered users group
$dbResult = CGroup::GetList($by, $order, array("STRING_ID" => "REGISTERED_USERS"));
if ($dbResult->Fetch()) {
return;
}
$group = new CGroup();
$arFields = array("ACTIVE" => "Y", "C_SORT" => 3, "NAME" => GetMessage("REGISTERED_GROUP_NAME"), "STRING_ID" => "REGISTERED_USERS");
$groupID = $group->Add($arFields);
if ($groupID > 0) {
COption::SetOptionString("main", "new_user_registration_def_group", $groupID);
if ($editProfileTask) {
CGroup::SetTasks($groupID, array($editProfileTask), true);
}
示例3: CGroup
{
$DB->Rollback();
$lAdmin->AddGroupError(GetMessage("DELETE_ERROR"), $ID);
}
$DB->Commit();
}
else
$lAdmin->AddGroupError(GetMessage("MAIN_ERROR_GROUP").$ID.GetMessage("MAIN_ERROR_GROUP_DELETE"));
break;
case "activate":
case "deactivate":
if($ID>2)
{
$ob = new CGroup();
$arFields["ACTIVE"] = ($_REQUEST['action']=="activate"?"Y":"N");
if(!$ob->Update($ID, $arFields))
$lAdmin->AddGroupError(GetMessage("MAIN_EDIT_ERROR").":".$ob->LAST_ERROR, $ID);
}
else
$lAdmin->AddGroupError(GetMessage("MAIN_ERROR_GROUP").$ID.GetMessage("MAIN_ERROR_GROUP_EDIT"));
break;
}
}
}
// инициализация списка - выборка данных
$rsData = CGroup::GetList($by, $order, $arFilter, "Y");
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
// установке параметров списка
示例4: intval
$ind++;
$USER_ID[$ind]["USER_ID"] = intval(${"USER_ID_" . $i});
$USER_ID[$ind]["DATE_ACTIVE_FROM"] = ${"USER_ID_FROM_" . $i};
$USER_ID[$ind]["DATE_ACTIVE_TO"] = ${"USER_ID_TO_" . $i};
}
}
if ($ID == 1 && $COPY_ID <= 0) {
$ind++;
$USER_ID[$ind]["USER_ID"] = 1;
$USER_ID[$ind]["DATE_ACTIVE_FROM"] = false;
$USER_ID[$ind]["DATE_ACTIVE_TO"] = false;
}
$arFields["USER_ID"] = $USER_ID;
}
if ($ID > 0 && $COPY_ID <= 0) {
$res = $group->Update($ID, $arFields);
} else {
$ID = $group->Add($arFields);
$res = $ID > 0;
$new = "Y";
}
$strError .= $group->LAST_ERROR;
if (strlen($strError) <= 0) {
if (intval($ID) != 1 || COption::GetOptionString("main", "controller_member", "N") == "Y" && COption::GetOptionString("main", "~controller_limited_admin", "N") == "Y") {
// set per module rights
$arTasks = array();
foreach ($arModules as $MID) {
$moduleName = str_replace(".", "_", $MID);
if (isset(${"TASKS_" . $moduleName})) {
$arTasks[$MID] = ${"TASKS_" . $moduleName};
$rt = CTask::GetLetter($arTasks[$MID]);
示例5: save
/**
* Сохраняет группу
* @return bool
*/
public function save()
{
$values = $this->getValues();
$arFields = array();
foreach ($values as $key => $value) {
$arFields[strtoupper($key)] = $value;
}
$group = new CGroup();
//записываем поля пользователя
if (!$this->isNew()) {
$id = $this->getAttribute('id')->getValue();
//при обновлении элемента сначала записываем базовые поля
$res = $group->Update($id, $arFields);
if (!$res) {
throw new Exception($group->LAST_ERROR);
}
$this->riseEvent('afterSave');
} else {
$new = $group->Add($arFields);
if ($new) {
$this->getAttribute('id')->setValue($new);
$this->riseEvent('afterSave');
} else {
throw new Exception($group->LAST_ERROR);
}
}
}