Exemplo n.º 1
0
    function definition() {
        global $DB, $PAGE;
        $mform = & $this->_form;
        $reportid = $this->_customdata['id'];
        $scheduledreportid = $this->_customdata['scheduleid'];
        $PAGE->requires->yui_module('moodle-block_cobalt_reports-schedulertype', 'M.block_cobalt_reports.init_schedulertype', array(array('formid' => $mform->getAttribute('id'))));
        $mform->addElement('hidden', 'id', $reportid);
        $mform->setType('id', PARAM_INT);
        $mform->addElement('hidden', 'scheduleid', $scheduledreportid);
        $mform->setType('scheduleid', PARAM_INT);

        $exportoptions = cr_get_export_plugins();
        $reportname = $DB->get_field('block_cobalt_reports', 'name', array('id' => $reportid));
        $exporttofilesystem = false;
        if (get_config('block_cobalt_reports', 'exportfilesystem') == 1) {
            $exporttofilesystem = true;
        }
        if ($scheduledreportid < 0) {
            $pagename = 'addscheduledreport';
        } else {
            $pagename = 'editscheduledreport';
        }
        $mform->addElement('header', 'general', get_string($pagename, 'block_cobalt_reports'));

        $mform->addElement('static', 'report', get_string('report', 'block_cobalt_reports'), $reportname);

        $mform->addElement('select', 'exportformat', get_string('export', 'block_cobalt_reports'), $exportoptions);

        if ($exporttofilesystem) {
            $exporttosystemarray = array();
            $exporttosystemarray[] = & $mform->createElement('radio', 'exporttofilesystem', '', get_string('exporttoemail', 'block_cobalt_reports'), REPORT_EMAIL);
            $exporttosystemarray[] = & $mform->createElement('radio', 'exporttofilesystem', '', get_string('exporttosave', 'block_cobalt_reports'), REPORT_EXPORT);
            $exporttosystemarray[] = & $mform->createElement('radio', 'exporttofilesystem', '', get_string('exporttoemailandsave', 'block_cobalt_reports'), REPORT_EXPORT_AND_EMAIL);
            $mform->setDefault('exporttofilesystem', 1);
            $mform->addGroup($exporttosystemarray, 'exporttofilesystemarray', get_string('exportfilesystemoptions', 'block_cobalt_reports'), array('<br />'), false);
        } else {
            $mform->addElement('hidden', 'emailsaveorboth', REPORT_EMAIL);
            $mform->setType('emailsaveorboth', PARAM_TEXT);
        }

        //Schedule type options
        $scheduling = new schedule();
        $frequencyselect = $scheduling->get_options();

        $mform->registerNoSubmitButton('updatefrequency');
        $mform->addElement('submit', 'updatefrequency', get_string('updatefrequency', 'block_cobalt_reports'));
        $mform->addElement('select', 'frequency', get_string('schedule', 'block_cobalt_reports'), $frequencyselect);
        $mform->addElement('hidden', 'frequentpos');
        $mform->setType('frequentpos', PARAM_RAW);

        $this->add_action_buttons();
    }
Exemplo n.º 2
0
        case 1:
            $scheduledreport->daily = $scheduledreport->schedule;
            break;
        case 2:
            $scheduledreport->weekly = $scheduledreport->schedule;
            break;
        case 3:
            $scheduledreport->monthly = $scheduledreport->schedule;
            break;
    }
    $mform->set_data($scheduledreport);
}
$myreportsurl = $CFG->wwwroot . '/blocks/cobalt_reports';
$scheduledreports = $DB->get_records('block_cobaltreports_schedule', array('reportid' => $reportid));

$scheduling = new schedule();
$frequencyselect = $scheduling->get_options();

$data = array();
foreach ($scheduledreports as $sreport) {
    $line = array();
    $line[] = $DB->get_field('block_cobalt_reports', 'name', array('id' => $sreport->reportid));
    $line[] = $sreport->exportformat;
    $line[] = $scheduling->get_formatted($sreport->frequency, $sreport->schedule);
    $buttons = array();
    $buttons[] = html_writer::link(new moodle_url('/blocks/cobalt_reports/components/scheduler/schedule.php', array('id' => $reportid, 'courseid' => $courseid, 'scheduleid' => $sreport->id, 'sesskey' => sesskey())), html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/edit'), 'alt' => get_string('edit'), 'class' => 'iconsmall')));
    $buttons[] = html_writer::link(new moodle_url('/blocks/cobalt_reports/components/scheduler/schedule.php', array('id' => $reportid, 'courseid' => $courseid, 'scheduleid' => $sreport->id, 'sesskey' => sesskey(), 'delete' => 1)), html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/delete'), 'alt' => get_string('delete'), 'class' => 'iconsmall')));
    $line[] = implode(' ', $buttons);
    $data[] = $line;
}
Exemplo n.º 3
0
<?php

require_once "../config.php";
verify_access($list_modules);
$scheAdd = false;
$scheUpd = false;
$scheDel = false;
$newSche = new schedule();
if ($_POST['action'] == 'Save') {
    if (isset($_POST['hdIdAct'])) {
        if ($_POST['hdIdAct'] == "") {
            $newSche->save($_POST['hdIdUser'], $_POST['hdDate'], $_POST['scheDet']);
            $scheAdd = true;
        } else {
            $newSche->open($_POST['hdIdAct']);
            $newSche->save($_POST['hdIdUser'], $_POST['hdDate'], $_POST['scheDet']);
            $scheUpd = true;
        }
    }
}
if ($_POST['action'] == 'Delete') {
    if (isset($_POST['hdIdAct'])) {
        $newSche->open($_POST['hdIdAct']);
        $newSche->del();
        $scheDel = true;
    }
}
?>


Exemplo n.º 4
0
function getSchedulesByUserDate($idUsers, $dtStart, $dtEnd)
{
    $users = "";
    foreach ($idUsers as $u) {
        $users .= $u . ",";
    }
    $users = substr($users, 0, -1);
    $schedule = new schedule();
    $data = array();
    $i = 0;
    $list_schedules = $schedule->getByUserDate($users, $dtStart, $dtEnd);
    $html .= '<table id="datatables" class="table table-bordered table-striped responsive">';
    $html .= '   <thead>';
    $html .= '       <tr>';
    $html .= '           <th class="head0">User</th>';
    $html .= '           <th class="head1">Date</th>';
    $html .= '           <th class="head0">Month</th>';
    $html .= '           <th class="head1">Day</th>';
    $html .= '           <th class="head0">Hours</th>';
    $html .= '       </tr>';
    $html .= '   </thead>';
    $html .= '   <tbody>';
    foreach ($list_schedules as $value) {
        $i = $i + 1;
        $html .= '       <tr src="schedule-report">';
        $html .= '           <td>' . $value['user'] . '</td><input name="hdId" type="hidden" value="' . $value['id'] . '"/>';
        $html .= '           <td>' . $value['date'] . '</td><input name="hdDate" type="hidden" value="' . $value['date'] . '"/>';
        $html .= '           <td>' . $value['month'] . '</td>';
        $html .= '           <td>' . $value['day'] . '</td>';
        $html .= '           <td><a href="#myModalScheduleDetails" role="button" class="btn btn-link" data-toggle="modal" id="aHours">' . $value['hours'] . '</a></td>';
        $html .= '       </tr>';
    }
    $html .= '   </tbody>';
    $html .= '</table>';
    $data['html'] = $html;
    $data['count'] = $i;
    echo json_encode($data);
}
 public function cron() {
     global $CFG, $DB;
     require_once($CFG->dirroot . "/blocks/cobalt_reports/components/scheduler/lib.php");
     $scheduler = new schedule();
     $scheduler->process_scheduled_reports();
     return true; // Finished OK.
 }
Exemplo n.º 6
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id, $area, $professor)
 {
     $course = Course::where('id', $id)->first();
     $course = Course::findOrFail($id);
     $course->taken = 0;
     $course->save();
     $prof = Professor::findOrFail($professor);
     $selectedCourseSchedule = explode("-", $course->schedule);
     $professorLoad = $prof->current_load - count($selectedCourseSchedule) * 22.5;
     $prof->current_load = $professorLoad;
     $prof->save();
     $schedules = schedule::where('course_id', $id)->delete();
     return redirect("schedules/{$course->year}-{$course->semester}/{$area}/{$professor}");
 }
Exemplo n.º 7
0
 function getSchedulesByIdMonth($idUser, $month)
 {
     $query = $this->con->genericQuery("select * from " . $this->table . " where fk_user = "******" and MONTH(date)='" . $month . "'");
     $objReturn = array();
     foreach ($query as $value) {
         $sche = new schedule();
         $sche->open($value);
         $objReturn[] = $sche;
     }
     return $objReturn;
 }
Exemplo n.º 8
0
        $this->calculate = new includes\calculate();
        $network = 'IFC';
        $show = 'Comedy Bang! Bang!';
        try {
            # execute the schedule count
        } catch (\Exception $e) {
            $error = 'Unable to complete: ' . $e->getMessage() . PHP_EOL;
            echo $error;
            die;
        }
    }
    # retrieve the schedule data from endpoint, and store in schedule_data property
    private function get_schedule($network)
    {
    }
    # parse the json based schedule, and store in parsed_data property
    private function parse_schedule()
    {
    }
    # count the number of occurances, and store in count property
    private function count_schedule($showname)
    {
    }
    // output the count
    public function get_count()
    {
        echo $this->count . PHP_EOL;
    }
}
$schedule = new schedule();
$schedule->get_count();