本文整理汇总了PHP中Display::NotifyDisplays方法的典型用法代码示例。如果您正苦于以下问题:PHP Display::NotifyDisplays方法的具体用法?PHP Display::NotifyDisplays怎么用?PHP Display::NotifyDisplays使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Display
的用法示例。
在下文中一共展示了Display::NotifyDisplays方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UpdateWatermark
/**
* Update the Water Mark to indicate the last data edit
* @param int $dataSetId The Data Set ID to Update
*/
private function UpdateWatermark($dataSetId)
{
if ($dataSetId == 0 || $dataSetId == '') {
return $this->SetError(25001, __('Missing dataSetId'));
}
if (!$this->updateWatermark) {
return;
}
Debug::LogEntry('audit', sprintf('Updating water mark on DataSetId: %d', $dataSetId), 'DataSetData', 'UpdateWatermark');
try {
$dbh = PDOConnect::init();
$sth = $dbh->prepare('UPDATE `dataset` SET LastDataEdit = :last_data_edit WHERE DataSetID = :dataset_id');
$sth->execute(array('last_data_edit' => time(), 'dataset_id' => $dataSetId));
// Get affected Campaigns
Kit::ClassLoader('dataset');
$dataSet = new DataSet($this->db);
$campaigns = $dataSet->GetCampaignsForDataSet($dataSetId);
Kit::ClassLoader('display');
$display = new Display($this->db);
foreach ($campaigns as $campaignId) {
// Assess all displays
$campaigns = $display->NotifyDisplays($campaignId);
}
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage());
if (!$this->IsError()) {
$this->SetError(1, __('Unknown Error'));
}
return false;
}
}
示例2: SetLayoutXml
/**
* Sets the Layout Xml and writes it back to the database
* @return
* @param $layoutid Object
* @param $xml Object
*/
public function SetLayoutXml($layoutid, $xml)
{
Debug::LogEntry('audit', 'IN', 'Layout', 'SetLayoutXml');
try {
$dbh = PDOConnect::init();
$sth = $dbh->prepare('UPDATE layout SET xml = :xml, modifieddt = NOW() WHERE layoutID = :layoutid');
$sth->execute(array('layoutid' => $layoutid, 'xml' => $xml));
// Get the Campaign ID
$campaign = new Campaign($this->db);
$campaignId = $campaign->GetCampaignId($layoutid);
// Notify (dont error)
if (!$this->delayFinalise) {
$displayObject = new Display($this->db);
$displayObject->NotifyDisplays($campaignId);
}
Debug::LogEntry('audit', 'OUT', 'Layout', 'SetLayoutXml');
return true;
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage());
if (!$this->IsError()) {
$this->SetError(25007, 'Unable to Update Layout.');
}
return false;
}
}
示例3: Add
//.........这里部分代码省略.........
// Validation
if (count($displayGroupIDs) == 0) {
return $this->SetError(25001, __('No display groups selected'));
}
if ($userID == 0) {
return $this->SetError(25001, __('No User Id Present'));
}
// Cant have a 0 increment as it creates a loop
if ($recDetail == 0) {
$recDetail = 1;
}
// make the displayid_list from the selected displays.
$displayGroupIDList = implode(",", $displayGroupIDs);
// Parameters for the query
$params = array('campaignid' => $campaignId, 'displaygroupids' => $displayGroupIDList, 'userid' => $userID, 'is_priority' => $isPriority, 'fromdt' => $fromDT, 'todt' => $toDT);
$SQL = "";
$SQL .= "INSERT INTO `schedule` (CampaignId, DisplayGroupIDs, userID, is_priority, FromDT, ToDT ";
// Columns for Recurrence
if ($recType != '' && $recType != 'null') {
$SQL .= ", recurrence_type, recurrence_detail, recurrence_range ";
}
$SQL .= ") ";
$SQL .= " VALUES ( :campaignid, :displaygroupids, :userid, :is_priority, :fromdt, :todt ";
// Values for Recurrence
if ($recType != '' && $recType != 'null') {
$SQL .= ", :recurrence_type, :recurrence_detail, :recurrence_range ";
$params['recurrence_type'] = $recType;
$params['recurrence_detail'] = $recDetail;
$params['recurrence_range'] = $recToDT;
}
$SQL .= ")";
$sth = $dbh->prepare($SQL);
$sth->execute($params);
// Get the event id
$eventID = $dbh->lastInsertId();
// Make sure we dont just have one...
if (!is_array($displayGroupIDs)) {
$displayGroupIDs = array($displayGroupIDs);
}
// Create a detail record for each display group
foreach ($displayGroupIDs as $displayGroupID) {
// Add the parent detail record for this event
if (!$this->AddDetail($displayGroupID, $campaignId, $fromDT, $toDT, $userID, $isPriority, $eventID, $displayOrder)) {
throw new Exception("Error Processing Request", 1);
}
// Is there any recurrance to take care of?
if ($recType != '' && $recType != 'null') {
// Set the temp starts
$t_start_temp = $fromDT;
$t_end_temp = $toDT;
Debug::LogEntry('audit', sprintf('Recurrence detected until %d. Recurrence period is %s and interval is %s.', $recToDT, $recDetail, $recType), 'Schedule', 'Add');
//loop until we have added the recurring events for the schedule
while ($t_start_temp < $recToDT) {
// add the appropriate time to the start and end
switch ($recType) {
case 'Hour':
$t_start_temp = mktime(date("H", $t_start_temp) + $recDetail, date("i", $t_start_temp), date("s", $t_start_temp), date("m", $t_start_temp), date("d", $t_start_temp), date("Y", $t_start_temp));
$t_end_temp = mktime(date("H", $t_end_temp) + $recDetail, date("i", $t_end_temp), date("s", $t_end_temp), date("m", $t_end_temp), date("d", $t_end_temp), date("Y", $t_end_temp));
break;
case 'Day':
$t_start_temp = mktime(date("H", $t_start_temp), date("i", $t_start_temp), date("s", $t_start_temp), date("m", $t_start_temp), date("d", $t_start_temp) + $recDetail, date("Y", $t_start_temp));
$t_end_temp = mktime(date("H", $t_end_temp), date("i", $t_end_temp), date("s", $t_end_temp), date("m", $t_end_temp), date("d", $t_end_temp) + $recDetail, date("Y", $t_end_temp));
break;
case 'Week':
$t_start_temp = mktime(date("H", $t_start_temp), date("i", $t_start_temp), date("s", $t_start_temp), date("m", $t_start_temp), date("d", $t_start_temp) + $recDetail * 7, date("Y", $t_start_temp));
$t_end_temp = mktime(date("H", $t_end_temp), date("i", $t_end_temp), date("s", $t_end_temp), date("m", $t_end_temp), date("d", $t_end_temp) + $recDetail * 7, date("Y", $t_end_temp));
break;
case 'Month':
$t_start_temp = mktime(date("H", $t_start_temp), date("i", $t_start_temp), date("s", $t_start_temp), date("m", $t_start_temp) + $recDetail, date("d", $t_start_temp), date("Y", $t_start_temp));
$t_end_temp = mktime(date("H", $t_end_temp), date("i", $t_end_temp), date("s", $t_end_temp), date("m", $t_end_temp) + $recDetail, date("d", $t_end_temp), date("Y", $t_end_temp));
break;
case 'Year':
$t_start_temp = mktime(date("H", $t_start_temp), date("i", $t_start_temp), date("s", $t_start_temp), date("m", $t_start_temp), date("d", $t_start_temp), date("Y", $t_start_temp) + $recDetail);
$t_end_temp = mktime(date("H", $t_end_temp), date("i", $t_end_temp), date("s", $t_end_temp), date("m", $t_end_temp), date("d", $t_end_temp), date("Y", $t_end_temp) + $recDetail);
break;
}
// after we have added the appropriate amount, are we still valid
if ($t_start_temp > $recToDT) {
break;
}
if (!$this->AddDetail($displayGroupID, $campaignId, $t_start_temp, $t_end_temp, $userID, $isPriority, $eventID, $displayOrder)) {
throw new Exception("Error Processing Request", 1);
}
}
}
}
// Notify (dont error)
Kit::ClassLoader('Display');
$displayObject = new Display($this->db);
$displayObject->NotifyDisplays($campaignId);
Debug::LogEntry('audit', 'OUT', 'Schedule', 'Add');
return true;
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage());
if (!$this->IsError()) {
$this->SetError(25001, __('Could not INSERT a new Schedule'));
}
return false;
}
}