Beispiel #1
0
function display_date_selector($p_year = null, $p_month = null, $p_day = null)
{
    $cur_year = get_current_year();
    $cur_month = get_current_month();
    $cur_day = get_current_day();
    $sel_year = $p_year == null ? $cur_year : $p_year;
    $sel_month = $p_month == null ? $cur_month : $p_month;
    $sel_day = $p_day == null ? $cur_day : $p_day;
    echo "<select name=\"fm_year\">\n";
    for ($year = $cur_year; $year <= $cur_year + 10; $year++) {
        $selected = $year == $sel_year ? "selected" : "";
        echo "<option value=\"{$year}\" {$selected}>{$year}</option>\n";
    }
    echo "</select>\n";
    echo "<select name=\"fm_month\">\n";
    for ($month = 1; $month <= 12; $month++) {
        $selected = $month == $sel_month ? "selected" : "";
        $month = sprintf("%02d", $month);
        echo "<option value=\"{$month}\" {$selected}>{$month}</option>\n";
    }
    echo "</select>\n";
    echo "<select name=\"fm_day\">\n";
    for ($day = 1; $day <= 31; $day++) {
        $selected = $day == $sel_day ? "selected" : "";
        $day = sprintf("%02d", $day);
        echo "<option value=\"{$day}\" {$selected}>{$day}</option>\n";
    }
    echo "</select>\n";
}
Beispiel #2
0
 function login()
 {
     $this->data['title'] = "Login";
     $this->data['body_classes'] = array("not-logged-in");
     // validate form input
     $this->form_validation->set_rules('identity', 'Identity', 'required');
     $this->form_validation->set_rules('password', 'Password', 'required');
     if ($this->form_validation->run() == true) {
         // check to see if the user is logging in
         // check for "remember me"
         $remember = (bool) $this->input->post('remember');
         if ($this->ion_auth->login($this->input->post('identity'), $this->input->post('password'), $remember)) {
             // if the login is successful
             // redirect them back to the home page
             $this->session->set_flashdata('message', $this->ion_auth->messages());
             if ($uri = $this->input->cookie("uri")) {
                 redirect($uri);
             } else {
                 redirect('/', 'refresh');
             }
         } else {
             // if the login was un-successful
             // redirect them back to the login page
             $this->session->set_flashdata('message', $this->ion_auth->errors());
             redirect('auth/login', 'refresh');
             // use redirects instead of loading views for compatibility with MY_Controller libraries
         }
     } else {
         // the user is not logging in so display the login page
         // set the flash data error message if there is one
         $this->data['message'] = validation_errors() ? validation_errors() : $this->session->flashdata('message');
         $this->data['identity'] = array('name' => 'identity', 'id' => 'identity', 'type' => 'email', 'value' => $this->form_validation->set_value('identity'));
         $this->data['password'] = array('name' => 'password', 'id' => 'password', 'type' => 'password');
         $this->data['target'] = 'auth/login';
         $this->_render_page('page/index', $this->data);
         bake_cookie("sale_year", get_current_year());
     }
 }
Beispiel #3
0
    $template->setVariable("DATE", $date->format("%A %b %e, %Y"));
    $template->setVariable("GREETING", setupGreeting());
    $displayName = getUserFirstName($connection, $userID);
    if (!$displayName) {
        $displayName = $_SESSION["loggedinUserName"];
    }
    $template->setVariable("USER", $displayName . "!");
    $template->parseCurrentBlock();
    // Setup and load the quickentry calendar for actual workout data entry.
    $template->setCurrentBlock("WEEKLY");
    loadQuickEntry($template, $Month, $connection);
    // Setup the weekly graphs for actual and planned workout volumes.
    get_weekly_volume_graph($userID, $connection);
    // Setup current month, current year and prior year volume/dist blocks
    get_current_month($template, $userID, $connection);
    get_current_year($template, $userID, $connection);
    get_prior_month($template, $userID, $connection);
    get_prior_year($template, $userID, $connection);
} else {
    //Seems the user has attempted to navigate directly to the dashboard without
    //logging in. Send them to the logout page with an error message.
    $_SESSION["headerMessage"] = "Error!!";
    $_SESSION["message"] = "You must first log into the system before you can view the page.";
    // Send user to the logout page.
    header("Location: logout.php");
    exit;
}
//Show the user's Dashboard page.
$template->show();
/********************************* Helper Functions ******************************************/
function setupGreeting()
Beispiel #4
0
    $template_name = 'index-ajax.html';
    $quarter_id = intval($_REQUEST['quarter_id']) or die('Invalid quarter_id');
    $quarter = get_quarter($quarter_id) or die("No quarter for {$quarter_id}={$quarter_id}");
    $date_from = $quarter['started'];
    $date_to = $quarter['finished'];
    $day_of_week = array(0 => 'Пн', 1 => 'Вт', 2 => 'Ср', 3 => 'Чт', 4 => 'Пт', 5 => 'Сб', 6 => 'Вс');
    $class_id = get_student_class_id($student_id) or die('Unknown student');
    $student_grades = get_student_grades($student_id, $date_from, $date_to);
    $disciplines = get_disciplines_from_class($class_id);
    $dates = array();
    $grades = array();
    foreach ($student_grades as $grade) {
        $lesson_monthyear = $grade['lesson_month'] . '.' . $grade['lesson_year'];
        $dates[$lesson_monthyear][$grade['lesson_date']] = array('lesson_weekday' => $grade['lesson_weekday'], 'lesson_weekday_w' => $day_of_week[$grade['lesson_weekday']], 'lesson_day' => $grade['lesson_day'], 'lesson_month' => $grade['lesson_month'], 'lesson_year' => $grade['lesson_year']);
        $grades[$grade['discipline_id']][$grade['lesson_date']][] = array('grade' => $grade['grade'], 'topic' => $grade['topic'], 'lesson_id' => $grade['lesson_id'], 'lesson_type_id' => $grade['lesson_type_id'], 'lesson_type_name' => $grade['lesson_type_name']);
    }
    $quarter['started_date'] = date("d.m.Y", strtotime($quarter['started']));
    $quarter['finished_date'] = date("d.m.Y", strtotime($quarter['finished']));
    $renderArray['quarter'] = $quarter;
    $renderArray['dates'] = $dates;
    $renderArray['disciplines'] = $disciplines;
    $renderArray['grades'] = $grades;
} else {
    $year = get_current_year() or die('Now current year');
    $quarters = get_quarters_in_year($year['school_year_id'], 1);
    $renderArray['ui_theme'] = $config['ui']['theme'];
    $renderArray['year'] = $year;
    $renderArray['quarters'] = $quarters;
}
$template = $twig->loadTemplate('students/' . $template_name);
echo $template->render($renderArray);