Exemplo n.º 1
0
      */
     if (isset($_COOKIE['SCREENLOCK'])) {
         redirect(get_base_url() . 'lock' . '/');
     }
 });
 $app->match('GET|POST', '/grade-scale/(\\d+)/', function ($id) use($app, $css, $js, $flashNow) {
     if ($app->req->isPost()) {
         $gs = $app->db->grade_scale();
         foreach ($_POST as $k => $v) {
             $gs->{$k} = $v;
         }
         $gs->where('ID = ?', $id);
         if ($gs->update()) {
             etsis_cache_flush_namespace('grsc');
             $app->flash('success_message', $flashNow->notice(200));
             etsis_logger_activity_log_write('Update Record', 'Grade Scale', _filter_input_string(INPUT_POST, 'grade'), get_persondata('uname'));
         } else {
             $app->flash('error_message', $flashNow->notice(409));
         }
         redirect($app->req->server['HTTP_REFERER']);
     }
     $gs = $app->db->grade_scale()->where('ID = ?', $id);
     $q = etsis_cache_get($id, 'grsc');
     if (empty($q)) {
         $q = $gs->find(function ($data) {
             $array = [];
             foreach ($data as $d) {
                 $array[] = $d;
             }
             return $array;
         });
Exemplo n.º 2
0
             $app->flash('error_message', $flashNow->notice(409));
             redirect($app->req->server['HTTP_REFERER']);
         }
     }
     $app->view->display('application/add-inst', ['title' => 'Add Institution', 'cssArray' => $css, 'jsArray' => $js]);
 });
 $app->match('GET|POST', '/inst/(\\d+)/', function ($id) use($app, $css, $js, $json_url, $flashNow) {
     if ($app->req->isPost()) {
         $inst = $app->db->institution();
         foreach ($_POST as $k => $v) {
             $inst->{$k} = $v;
         }
         $inst->where('institutionID = ?', $id);
         if ($inst->update()) {
             $app->flash('success_message', $flashNow->notice(200));
             etsis_logger_activity_log_write('Update Record', 'Institution', _filter_input_string(INPUT_POST, 'instName'), get_persondata('uname'));
         } else {
             $app->flash('error_message', $flashNow->notice(409));
         }
         redirect($app->req->server['HTTP_REFERER']);
     }
     $inst = $app->db->institution()->where('institutionID = ?', (int) $id)->findOne();
     $app->view->display('application/view-inst', ['title' => $inst->instName, 'cssArray' => $css, 'jsArray' => $js, 'inst' => $inst]);
 });
 $app->get('/applications/', function () use($app, $json_url) {
     $css = ['css/admin/module.admin.page.alt.form_elements.min.css', 'css/admin/module.admin.page.alt.tables.min.css'];
     $js = ['components/modules/admin/forms/elements/bootstrap-select/assets/lib/js/bootstrap-select.js?v=v2.1.0', 'components/modules/admin/forms/elements/bootstrap-select/assets/custom/js/bootstrap-select.init.js?v=v2.1.0', 'components/modules/admin/forms/elements/select2/assets/lib/js/select2.js?v=v2.1.0', 'components/modules/admin/forms/elements/select2/assets/custom/js/select2.init.js?v=v2.1.0', 'components/modules/admin/forms/elements/bootstrap-datepicker/assets/lib/js/bootstrap-datepicker.js?v=v2.1.0', 'components/modules/admin/forms/elements/bootstrap-datepicker/assets/custom/js/bootstrap-datepicker.init.js?v=v2.1.0', 'components/modules/admin/forms/elements/bootstrap-timepicker/assets/lib/js/bootstrap-timepicker.js?v=v2.1.0', 'components/modules/admin/forms/elements/bootstrap-timepicker/assets/custom/js/bootstrap-timepicker.init.js?v=v2.1.0'];
     $appl = $app->db->application()->where('personID = ?', (int) get_persondata('personID'));
     $q = $appl->find(function ($data) {
         $array = [];
         foreach ($data as $d) {
Exemplo n.º 3
0
        $app->view->display('error/404', ['title' => '404 Error']);
    } else {
        $app->view->display('permission/view', ['title' => 'Edit Permission', 'cssArray' => $css, 'jsArray' => $js, 'perm' => $perm]);
    }
});
$app->match('GET|POST', '/permission/add/', function () use($app, $flashNow) {
    $css = ['css/admin/module.admin.page.form_elements.min.css', 'css/admin/module.admin.page.tables.min.css'];
    $js = ['components/modules/admin/forms/elements/bootstrap-select/assets/lib/js/bootstrap-select.js?v=v2.1.0', 'components/modules/admin/forms/elements/bootstrap-select/assets/custom/js/bootstrap-select.init.js?v=v2.1.0', 'components/modules/admin/forms/elements/select2/assets/lib/js/select2.js?v=v2.1.0', 'components/modules/admin/forms/elements/select2/assets/custom/js/select2.init.js?v=v2.1.0', 'components/modules/admin/forms/elements/bootstrap-datepicker/assets/lib/js/bootstrap-datepicker.js?v=v2.1.0', 'components/modules/admin/forms/elements/bootstrap-datepicker/assets/custom/js/bootstrap-datepicker.init.js?v=v2.1.0', 'components/modules/admin/tables/datatables/assets/lib/js/jquery.dataTables.min.js?v=v2.1.0', 'components/modules/admin/tables/datatables/assets/lib/extras/TableTools/media/js/TableTools.min.js?v=v2.1.0', 'components/modules/admin/tables/datatables/assets/custom/js/DT_bootstrap.js?v=v2.1.0', 'components/modules/admin/tables/datatables/assets/custom/js/datatables.init.js?v=v2.1.0', 'components/modules/admin/forms/elements/jasny-fileupload/assets/js/bootstrap-fileupload.js?v=v2.1.0'];
    if ($app->req->isPost()) {
        $perm = $app->db->permission();
        foreach (_filter_input_array(INPUT_POST) as $k => $v) {
            $perm->{$k} = $v;
        }
        if ($perm->save()) {
            $app->flash('success_message', $flashNow->notice(200));
            etsis_logger_activity_log_write('New Record', 'Permission', _filter_input_string(INPUT_POST, 'permName'), get_persondata('uname'));
            redirect(get_base_url() . 'permission' . '/');
        } else {
            $app->flash('error_message', $flashNow->notice(409));
            redirect($app->req->server['HTTP_REFERER']);
        }
    }
    $app->view->display('permission/add', ['title' => 'Add New Permission', 'cssArray' => $css, 'jsArray' => $js]);
});
/**
 * Before route check.
 */
$app->before('GET|POST', '/role.*', function () {
    if (!hasPermission('access_role_screen')) {
        redirect(get_base_url() . 'dashboard' . '/');
    }
Exemplo n.º 4
0
      * This function will validate a plugin and make sure
      * there are no errors before activating it.
      *
      * @since 6.2.0
      */
     etsis_validate_plugin($plugin_name);
     if (ob_get_length() > 0) {
         $output = ob_get_clean();
         $error = new \app\src\etError('unexpected_output', _t('The plugin generated unexpected output.'), $output);
         $app->flash('error_message', $error);
     }
     ob_end_clean();
     redirect($app->req->server['HTTP_REFERER']);
 });
 $app->get('/deactivate/', function () use($app) {
     $pluginName = _filter_input_string(INPUT_GET, 'id');
     /**
      * Fires before a specific plugin is deactivated.
      *
      * $pluginName refers to the plugin's
      * name (i.e. moodle.plugin.php).
      *
      * @since 6.1.06
      * @param string $pluginName
      *            The plugin's base name.
      */
     $app->hook->do_action('deactivate_plugin', $pluginName);
     /**
      * Fires as a specifig plugin is being deactivated.
      *
      * $pluginName refers to the plugin's
Exemplo n.º 5
0
 * @since       5.0.0
 * @package     eduTrac SIS
 * @author      Joshua Parker <*****@*****.**>
 */
$app->get('404', function () use($app) {
    $app->view->display('error/404');
});
/**
 * Before route checks to make sure the logged in user
 * us allowed to manage options/settings.
 */
$app->before('GET', '/err/screen-error.*', function () use($app) {
    if (!hasPermission('access_dashboard')) {
        redirect(get_base_url());
    }
    /**
     * If user is logged in and the lockscreen cookie is set, 
     * redirect user to the lock screen until he/she enters 
     * his/her password to gain access.
     */
    if (isset($_COOKIE['SCREENLOCK'])) {
        redirect(get_base_url() . 'lock' . '/');
    }
    if (empty($app->req->server['HTTP_REFERER']) === true) {
        redirect(get_base_url() . 'dashboard' . '/');
    }
});
$app->get('/err/screen-error/', function () use($app) {
    $error = new \app\src\Core\Exception\Exception(sprintf(_t('The screen %s does not exist. Please try your search again.'), strtoupper(_h(_filter_input_string(INPUT_GET, 'code')))), 'screen_error');
    $app->view->display('error/screen-error', ['error' => $error]);
});