本文整理汇总了PHP中Vtiger_Util_Helper::getActiveAdminCurrentDateTime方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Util_Helper::getActiveAdminCurrentDateTime方法的具体用法?PHP Vtiger_Util_Helper::getActiveAdminCurrentDateTime怎么用?PHP Vtiger_Util_Helper::getActiveAdminCurrentDateTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Util_Helper
的用法示例。
在下文中一共展示了Vtiger_Util_Helper::getActiveAdminCurrentDateTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveScheduleReport
/**
* Function to save the Scheduled Reports data
*/
public function saveScheduleReport() {
$adb = PearDatabase::getInstance();
$reportid = $this->get('reportid');
$scheduleid = $this->get('scheduleid');
$schtime = $this->get('schtime');
if(!preg_match('/^[0-2]\d(:[0-5]\d){1,2}$/', $schtime) or substr($schtime,0,2)>23) { // invalid time format
$schtime='00:00';
}
$schtime .=':00';
$schdate = null; $schdayoftheweek = null; $schdayofthemonth = null; $schannualdates = null;
if ($scheduleid == self::$SCHEDULED_ON_SPECIFIC_DATE) {
$date = $this->get('schdate');
$dateDBFormat = DateTimeField::convertToDBFormat($date);
$nextTriggerTime = $dateDBFormat.' '.$schtime;
$currentTime = Vtiger_Util_Helper::getActiveAdminCurrentDateTime();
if($nextTriggerTime > $currentTime) {
$this->set('next_trigger_time', $nextTriggerTime);
} else {
$this->set('next_trigger_time', date('Y-m-d H:i:s', strtotime('+10 year')));
}
$schdate = Zend_Json::encode(array($dateDBFormat));
} else if ($scheduleid == self::$SCHEDULED_WEEKLY) {
$schdayoftheweek = Zend_Json::encode($this->get('schdayoftheweek'));
$this->set('schdayoftheweek', $schdayoftheweek);
} else if ($scheduleid == self::$SCHEDULED_MONTHLY_BY_DATE) {
$schdayofthemonth = Zend_Json::encode($this->get('schdayofthemonth'));
$this->set('schdayofthemonth', $schdayofthemonth);
} else if ($scheduleid == self::$SCHEDULED_ANNUALLY) {
$schannualdates = Zend_Json::encode($this->get('schannualdates'));
$this->set('schannualdates', $schannualdates);
}
$recipients = Zend_Json::encode($this->get('recipients'));
$specificemails = Zend_Json::encode($this->get('specificemails'));
$isReportScheduled = $this->get('isReportScheduled');
if($scheduleid != self::$SCHEDULED_ON_SPECIFIC_DATE) {
$nextTriggerTime = $this->getNextTriggerTime();
}
if ($isReportScheduled == '0' || $isReportScheduled == '' || $isReportScheduled == false) {
$deleteScheduledReportSql = "DELETE FROM vtiger_schedulereports WHERE reportid=?";
$adb->pquery($deleteScheduledReportSql, array($reportid));
} else {
$checkScheduledResult = $adb->pquery('SELECT 1 FROM vtiger_schedulereports WHERE reportid=?', array($reportid));
if ($adb->num_rows($checkScheduledResult) > 0) {
$scheduledReportSql = 'UPDATE vtiger_schedulereports SET scheduleid=?, recipients=?, schdate=?, schtime=?, schdayoftheweek=?, schdayofthemonth=?, schannualdates=?, specificemails=?, next_trigger_time=? WHERE reportid=?';
$adb->pquery($scheduledReportSql, array($scheduleid, $recipients, $schdate, $schtime, $schdayoftheweek, $schdayofthemonth, $schannualdates, $specificemails, $nextTriggerTime, $reportid));
} else {
$scheduleReportSql = 'INSERT INTO vtiger_schedulereports (reportid,scheduleid,recipients,schdate,schtime,schdayoftheweek,schdayofthemonth,schannualdates,next_trigger_time,specificemails) VALUES (?,?,?,?,?,?,?,?,?,?)';
$adb->pquery($scheduleReportSql, array($reportid, $scheduleid, $recipients, $schdate, $schtime, $schdayoftheweek, $schdayofthemonth, $schannualdates, $nextTriggerTime, $specificemails));
}
}
}
示例2: process
public function process(Vtiger_Request $request)
{
$recordId = $request->get('record');
$summary = $request->get('summary');
$moduleName = $request->get('module_name');
$conditions = $request->get('conditions');
$filterSavedInNew = $request->get('filtersavedinnew');
$executionCondition = $request->get('execution_condition');
if ($recordId) {
$workflowModel = Settings_Workflows_Record_Model::getInstance($recordId);
} else {
$workflowModel = Settings_Workflows_Record_Model::getCleanInstance($moduleName);
}
$response = new Vtiger_Response();
$workflowModel->set('summary', $summary);
$workflowModel->set('module_name', $moduleName);
$workflowModel->set('conditions', $conditions);
$workflowModel->set('execution_condition', $executionCondition);
if ($executionCondition == '6') {
$schtime = $request->get("schtime");
if (!preg_match('/^[0-2]\\d(:[0-5]\\d){1,2}$/', $schtime) or substr($schtime, 0, 2) > 23) {
// invalid time format
$schtime = '00:00';
}
$schtime .= ':00';
$workflowModel->set('schtime', $schtime);
$workflowScheduleType = $request->get('schtypeid');
$workflowModel->set('schtypeid', $workflowScheduleType);
$dayOfMonth = null;
$dayOfWeek = null;
$month = null;
$annualDates = null;
if ($workflowScheduleType == Workflow::$SCHEDULED_WEEKLY) {
$dayOfWeek = Zend_Json::encode($request->get('schdayofweek'));
} else {
if ($workflowScheduleType == Workflow::$SCHEDULED_MONTHLY_BY_DATE) {
$dayOfMonth = Zend_Json::encode($request->get('schdayofmonth'));
} else {
if ($workflowScheduleType == Workflow::$SCHEDULED_ON_SPECIFIC_DATE) {
$date = $request->get('schdate');
$dateDBFormat = DateTimeField::convertToDBFormat($date);
$nextTriggerTime = $dateDBFormat . ' ' . $schtime;
$currentTime = Vtiger_Util_Helper::getActiveAdminCurrentDateTime();
if ($nextTriggerTime > $currentTime) {
$workflowModel->set('nexttrigger_time', $nextTriggerTime);
} else {
$workflowModel->set('nexttrigger_time', date('Y-m-d H:i:s', strtotime('+10 year')));
}
$annualDates = Zend_Json::encode(array($dateDBFormat));
} else {
if ($workflowScheduleType == Workflow::$SCHEDULED_ANNUALLY) {
$annualDates = Zend_Json::encode($request->get('schannualdates'));
}
}
}
}
$workflowModel->set('schdayofmonth', $dayOfMonth);
$workflowModel->set('schdayofweek', $dayOfWeek);
$workflowModel->set('schannualdates', $annualDates);
}
// Added to save the condition only when its changed from vtiger6
if ($filterSavedInNew == '6') {
//Added to change advanced filter condition to workflow
$workflowModel->transformAdvanceFilterToWorkFlowFilter();
}
$workflowModel->set('filtersavedinnew', $filterSavedInNew);
$workflowModel->save();
//Update only for scheduled workflows other than specific date
if ($workflowScheduleType != Workflow::$SCHEDULED_ON_SPECIFIC_DATE && $executionCondition == '6') {
$workflowModel->updateNextTriggerTime();
}
$response->setResult(array('id' => $workflowModel->get('workflow_id')));
$response->emit();
}