Пример #1
0
 public static function ReportScheduler(Vtiger_Request $request, $viewer)
 {
     $moduleName = $request->getModule();
     $record = $request->get('record');
     $mode = $request->get('mode');
     $adb = PearDatabase::getInstance();
     $current_user = Users_Record_Model::getCurrentUserModel();
     $viewer->assign("MODULE", $moduleName);
     $record = $request->get('record');
     $reportModel = ITS4YouReports_Record_Model::getCleanInstance($record);
     /* SCHEDULE REPORTS START */
     $availableUsersHTML = ITS4YouScheduledReport::getAvailableUsersHTML();
     $availableGroupsHTML = ITS4YouScheduledReport::getAvailableGroupsHTML();
     $availableRolesHTML = ITS4YouScheduledReport::getAvailableRolesHTML();
     $availableRolesAndSubHTML = ITS4YouScheduledReport::getAvailableRolesAndSubordinatesHTML();
     $viewer->assign("AVAILABLE_USERS", $availableUsersHTML);
     $viewer->assign("AVAILABLE_GROUPS", $availableGroupsHTML);
     $viewer->assign("AVAILABLE_ROLES", $availableRolesHTML);
     $viewer->assign("AVAILABLE_ROLESANDSUB", $availableRolesAndSubHTML);
     $scheduledReport = new ITS4YouScheduledReport($adb, $current_user, $record);
     if ($mode == "ChangeSteps") {
         $scheduledReport->getReportScheduleInfo();
         $is_scheduled = $request->get('isReportScheduled');
         $report_format = $request->get('scheduledReportFormat');
         $selectedRecipientsHTML = $scheduledReport->getSelectedRecipientsHTML();
     } else {
         $scheduledReport->getReportScheduleInfo();
         $is_scheduled = $scheduledReport->isScheduled;
         $report_format = explode(";", $scheduledReport->scheduledFormat);
         $selectedRecipientsHTML = $scheduledReport->getSelectedRecipientsHTML();
     }
     $viewer->assign('IS_SCHEDULED', $is_scheduled);
     foreach ($report_format as $sh_format) {
         $viewer->assign("REPORT_FORMAT_" . strtoupper($sh_format), true);
     }
     $viewer->assign("SELECTED_RECIPIENTS", $selectedRecipientsHTML);
     $viewer->assign("schtypeid", $scheduledReport->scheduledInterval['scheduletype']);
     $viewer->assign("schtime", $scheduledReport->scheduledInterval['time']);
     $viewer->assign("schday", $scheduledReport->scheduledInterval['date']);
     $viewer->assign("schweek", $scheduledReport->scheduledInterval['day']);
     $viewer->assign("schmonth", $scheduledReport->scheduledInterval['month']);
     /* SCHEDULE REPORTS END */
     $LBL_INFORMATIONS_4YOU = vtranslate("LBL_STEP9_INFO", $moduleName);
     $viewer->assign("LBL_INFORMATIONS_4YOU", $LBL_INFORMATIONS_4YOU);
     if ($mode == "ChangeSteps") {
         $tpl_name = "ReportSchedulerContent.tpl";
     } else {
         $tpl_name = "ReportScheduler.tpl";
     }
     return $viewer->view($tpl_name, $moduleName, true);
 }
Пример #2
0
global $current_user;
$smarty_obj = new vtigerCRM_Smarty();
$smarty_obj->assign("MOD", $mod_strings);
$smarty_obj->assign("APP", $app_strings);
$smarty_obj->assign("IMAGE_PATH", $image_path);
$smarty_obj->assign("DATEFORMAT", $current_user->date_format);
$smarty_obj->assign("JS_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
/* SCHEDULE REPORTS START */
$reportid = "";
if (isset($_REQUEST["record"]) && $_REQUEST["record"] != "") {
    $reportid = vtlib_purify($_REQUEST["record"]);
}
$scheduledReport = new ITS4YouScheduledReport($adb, $this->current_user, $reportid);
$availableUsersHTML = $scheduledReport->getAvailableUsersHTML();
$availableGroupsHTML = $scheduledReport->getAvailableGroupsHTML();
$availableRolesHTML = $scheduledReport->getAvailableRolesHTML();
$availableRolesAndSubHTML = $scheduledReport->getAvailableRolesAndSubordinatesHTML();
$smarty_obj->assign("AVAILABLE_USERS", $availableUsersHTML);
$smarty_obj->assign("AVAILABLE_GROUPS", $availableGroupsHTML);
$smarty_obj->assign("AVAILABLE_ROLES", $availableRolesHTML);
$smarty_obj->assign("AVAILABLE_ROLESANDSUB", $availableRolesAndSubHTML);
$scheduledReport->id = $reportid;
$scheduledReport->user = $current_user;
$scheduledReport->getReportScheduleInfo();
if (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'ajax') {
    $is_scheduled = $_REQUEST['isReportScheduled'];
    $report_format = $_REQUEST['scheduledReportFormat'];
    $selectedRecipientsHTML = $scheduledReport->getSelectedRecipientsHTML();
} else {
    $is_scheduled = $scheduledReport->isScheduled;
    $report_format = $scheduledReport->scheduledFormat;