本文整理汇总了PHP中CAgent::Delete方法的典型用法代码示例。如果您正苦于以下问题:PHP CAgent::Delete方法的具体用法?PHP CAgent::Delete怎么用?PHP CAgent::Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAgent
的用法示例。
在下文中一共展示了CAgent::Delete方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actualizeAgent
/**
* @param null $mailingId
* @param null $mailingChainId
* @throws \Bitrix\Main\ArgumentException
*/
public static function actualizeAgent($mailingId = null, $mailingChainId = null)
{
$agent = new \CAgent();
$isSendByTimeMethodCron = \COption::GetOptionInt("sender", "auto_method") === 'cron';
$arFilter = array();
if ($mailingId) {
$arFilter['=MAILING_ID'] = $mailingId;
}
if ($mailingChainId) {
$arFilter['=ID'] = $mailingChainId;
}
$mailingChainDb = MailingChainTable::getList(array('select' => array('ID', 'STATUS', 'AUTO_SEND_TIME', 'MAILING_ACTIVE' => 'MAILING.ACTIVE'), 'filter' => $arFilter));
while ($mailingChain = $mailingChainDb->fetch()) {
$agentName = static::getAgentName($mailingChain['ID']);
$rsAgents = $agent->GetList(array("ID" => "DESC"), array("MODULE_ID" => "sender", "NAME" => $agentName));
while ($arAgent = $rsAgents->Fetch()) {
$agent->Delete($arAgent["ID"]);
}
if ($isSendByTimeMethodCron || $mailingChain['REITERATE'] != 'Y' && empty($mailingChain['AUTO_SEND_TIME'])) {
continue;
}
if ($mailingChain['MAILING_ACTIVE'] == 'Y' && $mailingChain['STATUS'] == MailingChainTable::STATUS_SEND) {
if (!empty($mailingChain['AUTO_SEND_TIME'])) {
$dateExecute = $mailingChain['AUTO_SEND_TIME'];
} else {
$dateExecute = "";
}
$agent->AddAgent($agentName, "sender", "N", 0, null, "Y", $dateExecute);
}
}
}
示例2: array
if ($_REQUEST['action_target'] == 'selected') {
$arID = array();
$rsData = CAgent::GetList(array($by => $order), $arFilter);
while ($arRes = $rsData->Fetch()) {
$arID[] = $arRes['ID'];
}
}
foreach ($arID as $ID) {
$ID = IntVal($ID);
if ($ID <= 0) {
continue;
}
switch ($_REQUEST['action']) {
case "delete":
@set_time_limit(0);
if (!CAgent::Delete($ID)) {
$lAdmin->AddGroupError(GetMessage("DELETE_ERROR"), $ID);
}
break;
case "activate":
CAgent::Update($ID, array("ACTIVE" => "Y"));
break;
case "deactivate":
CAgent::Update($ID, array("ACTIVE" => "N"));
break;
}
}
}
$agentList = CAgent::GetList(array($by => $order), $arFilter);
$rsData = new CAdminResult($agentList, $sTableID);
$rsData->NavStart(20);
示例3: switch
switch ($_REQUEST['action']) {
case "delete":
@set_time_limit(0);
$DB->StartTransaction();
if (!CPosting::Delete($ID)) {
$DB->Rollback();
$lAdmin->AddGroupError(GetMessage("post_del_err"), $ID);
}
$DB->Commit();
break;
case "stop":
$cPosting = new CPosting();
$cPosting->ChangeStatus($ID, "W");
$rsAgents = CAgent::GetList(array("ID" => "DESC"), array("MODULE_ID" => "subscribe", "NAME" => "CPosting::AutoSend(" . $ID . ",%"));
while ($arAgent = $rsAgents->Fetch()) {
CAgent::Delete($arAgent["ID"]);
}
break;
}
}
}
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "id", "align" => "right", "default" => true), array("id" => "TIMESTAMP_X", "content" => GetMessage("post_updated"), "sort" => "timestamp", "default" => true), array("id" => "SUBJECT", "content" => GetMessage("post_subj"), "sort" => "subject", "default" => true), array("id" => "BODY_TYPE", "content" => GetMessage("post_body_type"), "sort" => "body_type", "default" => true), array("id" => "STATUS", "content" => GetMessage("post_stat"), "sort" => "status", "default" => true), array("id" => "DATE_SENT", "content" => GetMessage("post_sent"), "sort" => "date_sent", "default" => true), array("id" => "SENT_TO", "content" => GetMessage("post_report"), "sort" => false, "default" => false), array("id" => "FROM_FIELD", "content" => GetMessage("post_from"), "sort" => "from_field", "default" => false), array("id" => "TO_FIELD", "content" => GetMessage("post_to"), "sort" => "to_field", "default" => false)));
$cData = new CPosting();
$rsData = $cData->GetList(array($by => $order), $arFilter);
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("post_nav")));
while ($arRes = $rsData->NavNext(true, "f_")) {
$row =& $lAdmin->AddRow($f_ID, $arRes);
$row->AddViewField("SUBJECT", '<a href="posting_edit.php?ID=' . $f_ID . '&lang=' . LANG . '" title="' . GetMessage("post_act_edit") . '">' . $f_SUBJECT . '</a>');
$row->AddInputField("SUBJECT", array("size" => 20));
示例4: actualizeHandlers
public static function actualizeHandlers($chainId, array $fieldsNew = null, array $fieldsOld = null)
{
$settingsNew = null;
$settingsOld = null;
if ($fieldsNew) {
$settingsNew = new TriggerSettings($fieldsNew);
}
if ($fieldsOld) {
$settingsOld = new TriggerSettings($fieldsOld);
}
// if old item was closed trigger
if ($settingsOld && $settingsOld->isClosedTrigger()) {
// delete agent
$agentName = TriggerManager::getClosedEventAgentName($settingsOld->getEventModuleId(), $settingsOld->getEventType(), $chainId);
$agent = new \CAgent();
$agentListDb = $agent->GetList(array(), array('MODULE_ID' => 'sender', 'NAME' => $agentName));
while ($agentItem = $agentListDb->Fetch()) {
$agent->Delete($agentItem['ID']);
}
}
// if new item is closed trigger
if ($settingsNew && $settingsNew->isClosedTrigger()) {
// check active state of mailing
$chainDb = MailingChainTable::getList(array('select' => array('ID'), 'filter' => array('=ID' => $chainId, '=MAILING.ACTIVE' => 'Y')));
if (!$chainDb->fetch()) {
return;
}
// add new agent
$agentName = TriggerManager::getClosedEventAgentName($settingsNew->getEventModuleId(), $settingsNew->getEventType(), $chainId);
// set date of next exec
$agentTime = $settingsNew->getClosedTriggerTime();
$agentInterval = $settingsNew->getClosedTriggerInterval();
if ($agentInterval <= 0) {
$agentInterval = 1440;
}
$agentTimeArray = explode(":", $agentTime);
$agentDate = new \Bitrix\Main\Type\DateTime();
$agentDate->setTime((int) $agentTimeArray[0], (int) $agentTimeArray[1]);
// set next exec on next day if exec was today
if ($agentDate->getTimestamp() < time()) {
$agentDate->add("1 days");
}
// add agent
$agent = new \CAgent();
$agent->AddAgent($agentName, 'sender', 'N', $agentInterval * 60, '', 'Y', $agentDate->toString());
return;
}
// actualize deleted/changed event
if ($settingsOld && !$settingsOld->isClosedTrigger() && $settingsOld->getFullEventType()) {
// if delete operation(no the NEW)
// or change operation(the NEW is not equal to the OLD)
if (!$settingsNew || $settingsOld->getFullEventType() != $settingsNew->getFullEventType()) {
TriggerManager::actualizeHandler(array('MODULE_ID' => $settingsOld->getEventModuleId(), 'EVENT_TYPE' => $settingsOld->getEventType(), 'CALLED_BEFORE_CHANGE' => true));
}
}
// actualize new event
if ($settingsNew && $settingsNew->getFullEventType()) {
$calledBeforeChange = $fieldsOld ? false : true;
TriggerManager::actualizeHandler(array('MODULE_ID' => $settingsNew->getEventModuleId(), 'EVENT_TYPE' => $settingsNew->getEventType(), 'CALLED_BEFORE_CHANGE' => $calledBeforeChange));
}
}
示例5: Delete
public function Delete($ID)
{
global $DB;
CModule::IncludeModule("main");
$ID = intval($ID);
// ”дал¤ем агент
$arAgent = CAgent::GetList(array(), array("NAME" => "CAcritExport::StartAgent(" . $ID . ");"))->Fetch();
CAgent::Delete($arAgent["ID"]);
$DB->StartTransaction();
$res = $DB->Query("DELETE FROM " . $this->tableName . " WHERE ID='" . $ID . "'", false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($res) {
$DB->Commit();
} else {
$DB->Rollback();
}
return $res;
}
示例6: update
/**
* Update agent's params.
* @param string $siteId Site id.
* @param array $feedSettings Feed settings.
* @return array Feed settings with renew agents ids.
*/
public static function update($siteId, array $feedSettings)
{
foreach ($feedSettings as $feedType => $feedParams) {
$interval = intval($feedParams["INTERVAL"]);
$dbRes = \CAgent::GetList(array(), array('NAME' => self::createAgentNameForAdd($feedType, $siteId)));
if ($agent = $dbRes->Fetch()) {
if ($interval <= 0) {
\CAgent::Delete($agent["ID"]);
$feedSettings[$feedType]["AGENT_ID"] = 0;
continue;
}
\CAgent::Update($agent["ID"], array('AGENT_INTERVAL' => $interval * 60));
$feedSettings[$feedType]["AGENT_ID"] = $agent["ID"];
} else {
$feedSettings[$feedType]["AGENT_ID"] = self::add($feedType, $siteId, $feedParams["INTERVAL"]);
}
}
return $feedSettings;
}
示例7: UnSubscribeOnTime
public function UnSubscribeOnTime($id)
{
CAgent::Delete($id);
}