Ejemplo n.º 1
0
 public function index($args)
 {
     $db = $this->database();
     $s = new model_section($db);
     $p = new model_page($db);
     $md = new markdown_parser();
     $rt = explode("/", $args["_url"]);
     $s->load_from_name(strlen($rt[0]) > 0 ? $rt[0] : "home");
     array_shift($rt);
     $rt = implode("/", $rt);
     $cur_url = strlen($rt) > 0 ? $args["_url"] : $s->default_page();
     $p->load_from_url($cur_url);
     $navs = MODEL_SECTION::get_sections($db);
     $subnavs = $s->get_pages();
     $tpl = new view($this->registry);
     $tpl->set("cur_url", $cur_url);
     $tpl->set("title", $p->title);
     $tpl->set("navs", $navs);
     $tpl->set("subnavs", $subnavs);
     $tpl->set("page", $s->name);
     $tpl->set("content", $p->is_markdown ? array("markdown" => $md->transform($p->content)) : array("html" => $p->content));
     $tpl->set("s_intro", $md->transform($s->introduction));
     $tpl->set("s_img", $s->image);
     $tpl->show("default");
 }
Ejemplo n.º 2
0
 function get_routes()
 {
     $m = new model_page();
     $list = $m->fetch_all(array('show_it' => 1), 'title');
     $ret = array();
     if ($list) {
         foreach ($list as $el) {
             $ret[] = new entity_page(array('title' => $el->title_valid, 'route' => 'page_card', 'param' => array('id' => $el->stitle)));
         }
     }
     return $ret;
 }
Ejemplo n.º 3
0
 public function index($args)
 {
     $db = $this->database();
     $s = new model_section($db);
     $p = new model_page($db);
     $md = new markdown_parser();
     $rt = explode("/", $args["_url"]);
     $s->load_from_name(strlen($rt[0]) > 0 ? $rt[0] : "home");
     array_shift($rt);
     $rt = implode("/", $rt);
     $cur_url = strlen($rt) > 0 ? $args["_url"] : $s->default_page();
     $p->load_from_url($cur_url);
     $navs = MODEL_SECTION::get_sections($db);
     $subnavs = $s->get_pages();
     $tpl = new view($this->registry);
     if ($args["article"]) {
         # Loading and displaying an article.
         $a = new model_article($db, $args["article"]);
         $tpl->set("content", array("markdown" => $md->transform($a->body)));
         $tpl->set("title", $a->title);
     } else {
         # Listing articles.
         switch ($args["_url"]) {
             case "projects/other.html":
                 $listed = array(8, 9, 14);
                 $subtitle = "Other";
                 break;
             default:
                 $listed = array(13, 12, 11, 10, 15, 16, 17);
                 $subtitle = "KT-EQUAL";
                 break;
         }
         $projects = array();
         $projects = MODEL_ARTICLE::get_articles($db, $listed);
         $tpl->set("include", "subviews/project_list.php");
         $tpl->set("projects", $projects);
         $tpl->set("title", $subtitle . " Projects");
     }
     $tpl->set("cur_url", $cur_url);
     $tpl->set("navs", $navs);
     $tpl->set("subnavs", $subnavs);
     $tpl->set("page", $s->name);
     $tpl->set("s_intro", $md->transform($s->introduction));
     $tpl->set("s_img", $s->image);
     $tpl->show("default");
 }
Ejemplo n.º 4
0
<?php

session_start();
session_set_cookie_params(0, "/");
setcookie('PHPSESSID', session_id(), 0, '/');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>	
<?php 
include_once '../../credentials.php';
include_once 'view/view_client_payment.php';
include_once 'model/model_client_payment.php';
include_once 'controller/controller_auth.php';
$a = new controller_auth($username, $password);
$m = new model_page($username, $password);
$r = new view_page($username, $password);
include_once 'template/header.php';
$a->do_auth($username, $password);
if ($_SESSION['valid'] == TRUE) {
    //Initialize and set relevant arrays
    $ClientPaymentID = $_GET['id'];
    $ClientPaymentInformation = $m->get_client_payment_information($ClientPaymentID);
    //Process submitted information.
    if (isset($_GET['action'])) {
        $action = $_GET['action'];
        $m->{$action}($_POST);
    }
    //Start Main Content Here
    echo <<<eos
<div class="row">
  <div class="col-md-12">
Ejemplo n.º 5
0
<?php

session_start();
session_set_cookie_params(0, "/");
setcookie('PHPSESSID', session_id(), 0, '/');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>	
<?php 
include_once '../../credentials.php';
include_once 'view/view_my_projects.php';
include_once 'model/model_my_projects.php';
include_once 'controller/controller_auth.php';
$a = new controller_auth($username, $password);
$m = new model_page($username, $password);
$r = new view_page($username, $password);
include_once 'template/header.php';
$a->do_auth($username, $password);
if ($_SESSION['valid'] == TRUE) {
    //Start Main Content Here
    $my_projects = $m->get_my_projects();
    echo $r->view_my_projects($my_projects);
}
include_once 'template/footer.php';
Ejemplo n.º 6
0
<?php

session_start();
session_set_cookie_params(0, "/");
setcookie('PHPSESSID', session_id(), 0, '/');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>	
<?php 
include_once '../../credentials.php';
include_once 'view/view_expense.php';
include_once 'model/model_expense.php';
include_once 'controller/controller_auth.php';
$a = new controller_auth($username, $password);
$m = new model_page($username, $password);
$r = new view_page($username, $password);
include_once 'template/header.php';
$a->do_auth($username, $password);
if ($_SESSION['valid'] == TRUE) {
    //Initialize and set relevant arrays
    $ExpenseID = $_GET['id'];
    $ExpenseInformation = $m->get_expense_information($ExpenseID);
    //Process submitted information.
    if (isset($_GET['action'])) {
        $action = $_GET['action'];
        $m->{$action}($_POST);
    }
    //Start Main Content Here
    echo <<<eos
<div class="row">
  <div class="col-md-12">
Ejemplo n.º 7
0
<?php

session_start();
session_set_cookie_params(0, "/");
setcookie('PHPSESSID', session_id(), 0, '/');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>	
<?php 
include_once '../../credentials.php';
include_once 'view/view_regular_clients.php';
include_once 'model/model_regular_clients.php';
include_once 'controller/controller_auth.php';
$a = new controller_auth($username, $password);
$m = new model_page($username, $password);
$r = new view_page($username, $password);
include_once 'template/header.php';
$a->do_auth($username, $password);
//Process submitted information.
if (isset($_GET['action'])) {
    $action = $_GET['action'];
    $m->{$action}($_GET);
}
$my_clients = $m->get_my_regular_clients();
if ($_SESSION['valid'] == TRUE) {
    //Start Main Content Here
    echo $r->view_my_clients($my_clients);
}
include_once 'template/footer.php';
Ejemplo n.º 8
0
<?php

session_start();
session_set_cookie_params(0, "/");
setcookie('PHPSESSID', session_id(), 0, '/');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>	
<?php 
include_once '../../credentials.php';
include_once 'view/view_index.php';
include_once 'model/model_index.php';
include_once 'controller/controller_auth.php';
$a = new controller_auth($username, $password);
$m = new model_page($username, $password);
$r = new view_page($username, $password);
include_once 'template/header.php';
$a->do_auth($username, $password);
if ($_SESSION['valid'] == TRUE) {
    $EmployeeID = $_SESSION['UserID'];
    $my_projects = $m->get_my_projects();
    $recent_hours = $m->get_recent_hours();
    //Start Main Content Here
    echo <<<eos
\t\t\t<div class="row">
\t\t\t\t<div class="col-md-6">
\t\t\t\t\t<div class="row">
\t\t\t\t\t\t<div class="panel panel-info">
\t\t\t\t\t\t\t<div class="panel-heading">
\t\t\t\t\t\t\t\t<h3 class="panel-title">Projects</h3>
\t\t\t\t\t\t\t</div>
Ejemplo n.º 9
0
<?php

session_start();
session_set_cookie_params(0, "/");
setcookie('PHPSESSID', session_id(), 0, '/');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>	
<?php 
include_once '../../credentials.php';
include_once 'view/view_hours.php';
include_once 'model/model_hours.php';
include_once 'controller/controller_auth.php';
$a = new controller_auth($username, $password);
$m = new model_page($username, $password);
$r = new view_page($username, $password);
include_once 'template/header.php';
$a->do_auth($username, $password);
if ($_SESSION['valid'] == TRUE) {
    //Initialize and set relevant arrays
    $Hours = $m->get_my_hours();
    //Start Main Content Here
    echo <<<eos
<div class="row">
  <div class="col-md-12">
\t<div class="row">
\t\t<div class="panel panel-info">
\t\t\t<div class="panel-heading">
    \t\t\t\t<h3 class="panel-title">My Hours</h3>
  \t\t\t</div>
  \t\t\t<div class="panel-body">
Ejemplo n.º 10
0
<?php

session_start();
session_set_cookie_params(0, "/");
setcookie('PHPSESSID', session_id(), 0, '/');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>	
<?php 
include_once '../../credentials.php';
include_once 'view/view_project.php';
include_once 'model/model_project.php';
include_once 'controller/controller_auth.php';
$a = new controller_auth($username, $password);
$m = new model_page($username, $password);
$r = new view_page($username, $password);
include_once 'template/header.php';
$a->do_auth($username, $password);
if ($_SESSION['valid'] == TRUE) {
    //Initialize and set relevant arrays
    $OrderID = $_GET['id'];
    $ProjectInformation = $m->get_project_information($OrderID);
    $ClientInformation = $m->get_client_information($OrderID);
    $WorkerAssignments = $m->get_assignments_by_project($OrderID);
    $Employees = $m->get_employees($OrderID);
    $ProjectHours = $m->get_hours_by_project($OrderID);
    $ProjectExpenses = $m->get_expenses_by_project($OrderID);
    $ProjectClientPayments = $m->get_client_payments_by_project($OrderID);
    //Process submitted information.
    if (isset($_GET['action'])) {
        $action = $_GET['action'];
Ejemplo n.º 11
0
 function hapus($var)
 {
     cek_keamanan(array("admin"));
     $this->model("model_page");
     $this->model_page->delete($var[model_page::pk()]);
     $this->redirect();
 }
Ejemplo n.º 12
0
 public function page($stitle, $field = 'message_valid')
 {
     $m = new model_page();
     $card = $m->fetch_row(array('stitle' => $stitle));
     return is_object($card) ? (string) $card->{$field} : '';
 }
Ejemplo n.º 13
0
 *    - opsi dari database :
 *      <?php $opsi_db = opsi($this->model_XXX->ambil_data(),"nama_kolom_tabel_XXX"); ?> 
 *      <?php pilihan("nama_kolom", $opsi_db, $data) ?>
 * 
 * 4. textarea:
 *    <?php textarea("nama_kolom", $data) ?>
 */
?>
<div class="page-header">
  <h1><?php 
echo $judul;
?>
</h1>
</div>
<form <?php 
form_properties("page", $aksi, $data[model_page::pk()], true);
?>
>
  <table border="0">

    <tr>
      <td>Kode</td>
      <td><?php 
input("kode", $data);
?>
</td>
    </tr>
    <tr>
      <td>Nama</td>
      <td><?php 
input("nama", $data);
Ejemplo n.º 14
0
    public function do_auth_admin($dbuser, $dbpass)
    {
        if (isset($_POST['logout'])) {
            $_SESSION['valid'] = FALSE;
        }
        if ($this->is_valid()) {
            if ($_SESSION['admin'] != TRUE) {
                $_SESSION['valid'] = FALSE;
                header('Location: admin.php');
            } else {
                echo <<<eos
<div class='navbarlayout'>
  <div style='float: left;'>Welcome back, {$_SESSION['firstname']}</div>
  <div style='float: right;'>
<form method='POST'><input name='logout' type='submit' value='Logout'>
</form></div>
</div><br><br>
eos;
            }
            return;
        }
        $m2 = new model_page($dbuser, $dbpass);
        $login_arr1 = $m2->get_admin_login($_POST['username'], md5($_POST['password']));
        foreach ($login_arr1 as $login) {
            $user = $login['Email'];
            $pass = $login['Password'];
            $name = $login['FirstName'] . " " . $login['LastName'];
            $isAdmin = $login['IsAdmin'];
            $UserID = $login['ID'];
        }
        if ($_POST['username'] == $user && md5($_POST['password']) == $pass && strlen($user) > 0 && strlen($pass) > 0 && $isAdmin == 1) {
            $_SESSION['valid'] = TRUE;
            $_SESSION['name'] = $name;
            $_SESSION['firstname'] = $login['FirstName'];
            $_SESSION['admin'] = 1;
            $_SESSION['UserID'] = $UserID;
            echo <<<eos
<div class='navbarlayout'>
  <div style='float: left;'>Welcome back, {$_SESSION['firstname']}</div>
  <div style='float: right;'>
<form method='POST'><input name='logout' type='submit' value='Logout'>
</form></div>
</div><br><br>
eos;
            return;
        }
        if ($_POST['username'] != "" || $_POST['password'] != "") {
            $errormessage = "Incorrect Username or Password. Please try again";
        }
        echo <<<eos
<center><br><br><h1>Admin Login</h1><br>
eos;
        echo '<font color="red"><b>' . $errormessage . '</b></font color>';
        echo <<<eos
<br><form method='POST'>
Username:  <input name='username' type='text'><br><br>
Password:  <input name='password' type='password'><br><br>
<input name='submit_auth' type='submit' name='Submit'>
</form><br>
eos;
        return;
    }
Ejemplo n.º 15
0
<?php

session_start();
session_set_cookie_params(0, "/");
setcookie('PHPSESSID', session_id(), 0, '/');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>	
<?php 
include_once '../../credentials.php';
include_once 'view/view_hour.php';
include_once 'model/model_hour.php';
include_once 'controller/controller_auth.php';
$a = new controller_auth($username, $password);
$m = new model_page($username, $password);
$r = new view_page($username, $password);
include_once 'template/header.php';
$a->do_auth($username, $password);
if ($_SESSION['valid'] == TRUE) {
    //Initialize and set relevant arrays
    $HourID = $_GET['id'];
    $HourInformation = $m->get_hour_information($HourID);
    //Process submitted information.
    if (isset($_GET['action'])) {
        $action = $_GET['action'];
        $m->{$action}($_POST);
    }
    //Start Main Content Here
    echo <<<eos
<div class="row">
  <div class="col-md-12">