public function getReportScheduleInfo() { $adb = PearDatabase::getInstance(); if (!empty($this->id)) { $cachedInfo = VTCacheUtils::lookupReport_ScheduledInfo($this->user->id, $this->id); if ($cachedInfo == false) { $result = $adb->pquery('SELECT * FROM its4you_reports4you_scheduled_reports WHERE reportid=?', array($this->id)); if ($adb->num_rows($result) > 0) { $reportScheduleInfo = $adb->raw_query_result_rowdata($result, 0); $scheduledInterval = !empty($reportScheduleInfo['schedule']) ? Zend_Json::decode($reportScheduleInfo['schedule']) : array(); $scheduledRecipients = !empty($reportScheduleInfo['recipients']) ? Zend_Json::decode($reportScheduleInfo['recipients']) : array(); VTCacheUtils::updateReport_ScheduledInfo($this->user->id, $this->id, true, $reportScheduleInfo['format'], $scheduledInterval, $scheduledRecipients, $reportScheduleInfo['next_trigger_time']); $cachedInfo = VTCacheUtils::lookupReport_ScheduledInfo($this->user->id, $this->id); } } if ($cachedInfo) { $this->isScheduled = $cachedInfo['isScheduled']; $this->scheduledFormat = $cachedInfo['scheduledFormat']; $this->scheduledInterval = $cachedInfo['scheduledInterval']; $this->scheduledRecipients = $cachedInfo['scheduledRecipients']; $this->scheduledTime = $cachedInfo['scheduledTime']; return true; } } else { $this->isScheduled = isset($_REQUEST['isReportScheduled']) && $_REQUEST['isReportScheduled'] != '' ? $_REQUEST['isReportScheduled'] : ''; $this->scheduledFormat = isset($_REQUEST['scheduledReportFormat']) && $_REQUEST['scheduledReportFormat'] != '' ? $_REQUEST['scheduledReportFormat'] : ''; $this->scheduledInterval = isset($_REQUEST['scheduledTypeSelectedStr']) && $_REQUEST['scheduledTypeSelectedStr'] != '' ? Zend_Json::decode($_REQUEST['scheduledIntervalJson']) : array(); $this->scheduledRecipients = isset($_REQUEST['selectedRecipientsStr']) && $_REQUEST['selectedRecipientsStr'] != '' ? Zend_Json::decode($_REQUEST['selectedRecipientsStr']) : array(); return true; } // ITS4YOU-END return false; }
public function getReportScheduleInfo() { $adb = PearDatabase::getInstance(); if (!empty($this->id)) { $cachedInfo = VTCacheUtils::lookupReport_ScheduledInfo($this->user->id, $this->id); if ($cachedInfo == false) { $result = $adb->pquery('SELECT * FROM vtiger_scheduled_reports WHERE reportid=?', array($this->id)); if ($adb->num_rows($result) > 0) { $reportScheduleInfo = $adb->raw_query_result_rowdata($result, 0); $scheduledInterval = !empty($reportScheduleInfo['schedule']) ? Zend_Json::decode($reportScheduleInfo['schedule']) : array(); $scheduledRecipients = !empty($reportScheduleInfo['recipients']) ? Zend_Json::decode($reportScheduleInfo['recipients']) : array(); VTCacheUtils::updateReport_ScheduledInfo($this->user->id, $this->id, true, $reportScheduleInfo['format'], $scheduledInterval, $scheduledRecipients, $reportScheduleInfo['next_trigger_time']); $cachedInfo = VTCacheUtils::lookupReport_ScheduledInfo($this->user->id, $this->id); } } if ($cachedInfo) { $this->isScheduled = $cachedInfo['isScheduled']; $this->scheduledFormat = $cachedInfo['scheduledFormat']; $this->scheduledInterval = $cachedInfo['scheduledInterval']; $this->scheduledRecipients = $cachedInfo['scheduledRecipients']; $this->scheduledTime = $cachedInfo['scheduledTime']; return true; } } return false; }