Example #1
0
$objMember = new Member();
$districts = $objMember->getAllDistricts();
$rows = array();
$objForm = new Form();
$objProject = new Project();
$projects = $objProject->getAllProjectTypes();
$objTeam = new Team();
$teams = $objTeam->getTeamsForSearch();
$objPosition = new Position();
$positions = $objPosition->getAllPositions(true);
$objValid = new Validation($objForm);
$objSchool = new School();
$criteria = array('personal' => array(), 'involvements' => array());
if ($objForm->isPost('name')) {
    $return_null = false;
    $name = $objForm->getPost('name');
    if (!empty($name)) {
        $criteria['personal']['name'] = $name;
    }
    $gender = $objForm->getPost('gender');
    if (!empty($gender)) {
        $criteria['personal']['gender'] = $gender;
    }
    $day = $objForm->getPost('day');
    if (!empty($day)) {
        $criteria['personal']['day'] = $day;
    }
    $month = $objForm->getPost('month');
    if (!empty($month)) {
        $criteria['personal']['month'] = $month;
    }
Example #2
0
<?php

session_start();
if (Login::isLogged(Login::$_login_front)) {
    Helper::redirect(Login::$_dashboard_front);
}
$objForm = new Form();
$objValid = new Validation($objForm);
$objUser = new User();
// login form
if ($objForm->isPost('login_email')) {
    if ($objUser->isUser($objForm->getPost('login_email'), $objForm->getPost('login_password'))) {
        Login::loginFront($objUser->_id, Url::getReferrerUrl());
    } else {
        $objValid->add2Errors('login');
    }
}
// registration form
if ($objForm->isPost('first_name')) {
    $objValid->_expected = array('first_name', 'last_name', 'address_1', 'address_2', 'town', 'county', 'post_code', 'country', 'email', 'password', 'confirm_password');
    $objValid->_required = array('first_name', 'last_name', 'address_1', 'town', 'county', 'post_code', 'country', 'email', 'password', 'confirm_password');
    $objValid->_special = array('email' => 'email');
    $objValid->_post_remove = array('confirm_password');
    $objValid->_post_format = array('password' => 'password');
    // validate password
    $pass_1 = $objForm->getPost('password');
    $pass_2 = $objForm->getPost('confirm_password');
    if (!empty($pass_1) && !empty($pass_2) && $pass_1 != $pass_2) {
        $objValid->add2Errors('password_mismatch');
    }
    $email = $objForm->getPost('email');
Example #3
0
<?php

$id = Url::getParam('id');
if (!empty($id)) {
    $objCatalogue = new Catalogue();
    $category = $objCatalogue->getCategory($id);
    if (!empty($category)) {
        $objForm = new Form();
        $objValid = new Validation($objForm);
        if ($objForm->isPost('name')) {
            $objValid->_expected = array('name');
            $objValid->_required = array('name');
            $name = $objForm->getPost('name');
            if ($objCatalogue->duplicateCategory($name, $id)) {
                $objValid->add2Errors('name_duplicate');
            }
            if ($objValid->isValid()) {
                if ($objCatalogue->updateCategory($name, $id)) {
                    Helper::redirect('/admin' . Url::getCurrentUrl(array('action', 'id')) . '&action=edited');
                } else {
                    Helper::redirect('/admin' . Url::getCurrentUrl(array('action', 'id')) . '&action=edited-failed');
                }
            }
        }
        require_once 'template/_header.php';
        ?>
	
	<h1>Categories :: Edit</h1>
	
	<form action="" method="post">
		
Example #4
0
<?php

$rows = array();
$objRecruitment = new Recruitment();
$objProject = new Project();
$projects = $objProject->getAllProjectTypes();
$waves = $objProject->getWaves();
$objTeam = new Team();
$teams = $objTeam->getTeamsForSearch();
$objPosition = new Position();
$positions = $objPosition->getAllPositions(true);
$objForm = new Form();
$criteria = array();
if ($objForm->isPost('position')) {
    $project = $objForm->getPost('project');
    if (!empty($project)) {
        $criteria['project_type_id'] = $project;
    }
    $project_year = $objForm->getPost('project_year');
    if (!empty($project_year)) {
        $criteria['project_year'] = $project_year;
    }
    $project_wave = $objForm->getPost('project_wave');
    if (!empty($project_wave)) {
        $criteria['project_wave'] = $project_wave;
    }
    $team = $objForm->getPost('team');
    if (!empty($team)) {
        $criteria['team_id'] = $team;
    }
    $position = $objForm->getPost('position');
Example #5
0
//Cash Flow
$objCashFlow = new CashFlow();
$objCashFlow->getTanggal();
//Biaya Operasional
$objBiayaOperasional = new BiayaOperasional();
$objBiayaOperasional->getTanggal();
if (isset($_GET['detailinvoice'])) {
    $noinvoice = $_GET['detailinvoice'];
    $invoice = $objPenjualan->getPenjualanInvoice($noinvoice);
}
if ($objForm->isPost('dafcabang')) {
    $admin = new Admin();
    //if($objForm->getPost("dafcabang")!='cashflow'){
    //    $nmcabang = $objCabang->getNama($objForm->getPost("dafcabang"))?$objCabang->getNama($objForm->getPost("dafcabang")):"Semua Cabang";
    //}
    switch ($objForm->getPost('form')) {
        case 'penjualan':
            //Penjualan
            //$tglAwal = Helper::dateToMySqlSystem($objForm->getPost('tglawaljual'));
            //$tglAkhir = Helper::dateToMySqlSystem($objForm->getPost('tglakhirjual'));
            $group = $objForm->getPost("group_by");
            //$dir=$objForm->getPost("direction");
            $direction = $objForm->getPost("direction") ?: "DESC";
            $objPenjualan->_cabang = $objForm->getPost('dafcabang');
            $objPenjualan->_startDate = Helper::dateToMySqlSystem($objForm->getPost("tglawaljual"));
            $objPenjualan->_endDate = Helper::dateToMySqlSystem($objForm->getPost("tglakhirjual"));
            $listPenjualan = $objPenjualan->getDataByGroup($group, $direction);
            $nmcabang = $objCabang->getNama($objForm->getPost("dafcabang"));
            break;
        case 'pembelian':
            //Pembelian
Example #6
0
<?php

$id = Url::getParam('id');
if (!empty($id)) {
    $objUser = new User();
    $user = $objUser->getUser($id);
    if (!empty($user)) {
        $objForm = new Form();
        $objValid = new Validation($objForm);
        if ($objForm->isPost('first_name')) {
            $objValid->_expected = array('first_name', 'last_name', 'address_1', 'address_2', 'town', 'county', 'post_code', 'country', 'email');
            $objValid->_required = array('first_name', 'last_name', 'address_1', 'town', 'county', 'post_code', 'country', 'email');
            $objValid->_special = array('email' => 'email');
            $email = $objForm->getPost('email');
            $duplicate = $objUser->getByEmail($email);
            if (!empty($duplicate) && $duplicate['id'] != $user['id']) {
                $objValid->add2Errors('email_duplicate');
            }
            if ($objValid->isValid()) {
                if ($objUser->updateUser($objValid->_post, $user['id'])) {
                    Helper::redirect('/admin' . Url::getCurrentUrl(array('action', 'id')) . '&action=edited');
                } else {
                    Helper::redirect('/admin' . Url::getCurrentUrl(array('action', 'id')) . '&action=edited-failed');
                }
            }
        }
        require_once 'template/_header.php';
        ?>
	
	<h1>Clients :: Edit</h1>
	
<?php

$objForm = new Form();
$objValid = new Validation($objForm);
if ($objForm->isPost('name')) {
    $objValid->_expected = array('name', 'new', 'retype');
    $objValid->_required = array('name', 'new', 'retype');
    $new = $objForm->getPost('new');
    $retype = $objForm->getPost('retype');
    if ($new != '' && $retype != '' && $new != $retype) {
        $objValid->add2Errors('new_mismatch');
    }
    $id = $objForm->getPost('id');
    if ($objValid->isValid()) {
        $encoded = Login::hash($new);
        if ($objMember->updateMember(array('password' => $encoded), $id)) {
            $success = true;
        } else {
            $success = false;
        }
    }
}
require_once '_header.php';
?>
        <h1>Member :: Reset Pasword</h1>
        <?php 
if (!isset($success)) {
    ?>
            <form action="" method="post">
                <table cellpadding="0" cellspacing="0" border="0" class="tbl_insert">
                    <tr>
Example #8
0
<?php

if (Login::isLogged(Login::$_login_admin)) {
    Helper::redirect(Login::$_dashboard_admin);
}
$objForm = new Form();
$objValid = new Validation($objForm);
if ($objForm->isPost('login_email')) {
    $objAdmin = new Admin();
    if ($objAdmin->isUser($objForm->getPost('login_email'), $objForm->getPost('login_password'))) {
        Login::loginAdmin($objAdmin->_id, Url::getReferrerUrl());
    } else {
        $objValid->add2Errors('login');
    }
}
require_once 'template/_header.php';
?>

<h1>Login</h1>

<form action="" method="post">
	
	<table cellpadding="0" cellspacing="0" border="0" class="tbl_insert">
		
		<tr>
			<th><label for="login_email">Login:</label></th>
			<td>
				<?php 
echo $objValid->validate('login');
?>
				<input type="text" name="login_email" id="login_email"
Example #9
0
<?php

$objForm = new Form();
$objValid = new Validation($objForm);
$objSchool = new School();
$result = null;
$objValid->_expected = array('name', 'gender', 'day', 'month', 'year', 'personal_email', 'phone', 'skype', 'facebook', 'high_school', 'grad_year_h', 'uni', 'grad_year_u');
$objValid->_required = array('name', 'gender', 'personal_email');
//var_dump($objValid->_required);
$objValid->_special = array(array('field' => 'personal_email', 'case_type' => 'check_is_email'));
if ($objForm->isPost('name')) {
    $high_school = $objForm->getPost('high_school');
    $grad_year_h = $objForm->getPost('grad_year_h');
    $uni = $objForm->getPost('uni');
    $grad_year_u = $objForm->getPost('grad_year_u');
    $email = $objForm->getPost('personal_email');
    if (empty($high_school) && !empty($grad_year_h)) {
        $objValid->add2Errors('high_school');
    }
    if (!empty($high_school) && empty($grad_year_h)) {
        $objValid->add2Errors('grad_year_h');
    }
    if (empty($uni) && !empty($grad_year_u)) {
        $objValid->add2Errors('uni');
    }
    if (!empty($uni) && empty($grad_year_u)) {
        $objValid->add2Errors('grad_year_u');
    }
    if ($objMember->isDuplicateEmail($email)) {
        $objValid->add2Errors('duplicate_email');
    }
Example #10
0
<?php

$exco = $this->cPage == 'exco' ? 1 : 0;
$project_type = $this->cPage == 'exco' ? 'exco' : 'project';
$objMember = new Member();
$objProject = new Project();
$projects = $objProject->getAllProjectsForList();
$objForm = new Form();
$objValid = new Validation($objForm);
$params = array();
if ($objForm->isPost('project_type_id')) {
    $objValid->_expected = array('project_type_id', 'project_year');
    $objValid->_required = array('project_type_id', 'project_year');
    if ($objValid->isValid()) {
        $valid = 'yes';
        $project_year = $objForm->getPost('project_year');
        $project_type_id = $objForm->getPost('project_type_id');
        $project_type = $objProject->getProjectTypeById($project_type_id);
        //var_dump($project_year);
        if (!empty($project_type)) {
            $split = explode('_', $project_year);
            $year_start = $split[0];
            if (count($split) == 2) {
                $wave_id = $split[1];
                $wave_info = $objProject->getWaves(array('id' => 3))[0];
                $month_start = $wave_info['month_start'];
                $month_end = $wave_info['month_end'];
                $year_end = $wave_info['same_start_end'] == '1' ? $year_start : $year_start + 1;
            } else {
                $wave_id = 0;
                $month_start = $project_type['month_start'];
Example #11
0
<?php

require_once '../inc/autoload.php';
// tokens
$token2 = Session::getSession('token2');
$objForm = new Form();
$token1 = $objForm->getPost('token');
if ($token2 == Login::string2hash($token1)) {
    // create order
    $objOrder = new Order();
    if ($objOrder->createOrder()) {
        // populate order details
        $order = $objOrder->getOrder();
        $items = $objOrder->getOrderItems();
        if (!empty($order) && !empty($items)) {
            $objBasket = new Basket();
            $objCatalogue = new Catalogue();
            $objPayPal = new PayPal();
            foreach ($items as $item) {
                $product = $objCatalogue->getProduct($item['product']);
                $objPayPal->addProduct($item['product'], $product['name'], $item['price'], $item['qty']);
            }
            $objPayPal->_tax_cart = $objBasket->_vat;
            // populate client's details
            $objUser = new User();
            $user = $objUser->getUser($order['client']);
            if (!empty($user)) {
                // get user country record
                $objCountry = new Country();
                $country = $objCountry->getCountry($user['country']);
                // pass client's details to the PayPal instance
Example #12
0
    <?php 
if (Login::isLogged()) {
    Helper::redirect(Login::$_default);
}
$objForm = new Form();
$objValid = new Validation($objForm);
$objMember = new Member();
if ($objForm->isPost('login_email')) {
    $member = $objMember->getMembers(array('personal_email' => $objForm->getPost('login_email'), 'password' => Login::hash($objForm->getPost('login_password'))));
    if (!empty($member) && count($member) == 1) {
        //echo '<h1>VALID</h1>';
        Login::processLogin($member[0]['id'], '/sugarkms/' . $this->objURL->href($this->objURL->get(Login::$_referrer)), $objForm->getPost('remember'));
    } else {
        $objValid->add2Errors('login');
    }
}
require_once '_header.php';
?>
    <h1>Login</h1>
    <form action="" method="post">
        <table cellpadding="0" cellspacing="0" border="0" class="tbl_insert"> 
            <tr>
                <?php 
echo $objValid->validate('login');
?>
                <td><label for="login_email">Email:</label></td>
                <td><input type="text" name="login_email" id="login_email" class="fld" value="" /></td>
            </tr>
            <tr>
                <td><label for="login_password">Password:</label></td>
                <td><input type="password" name="login_password" id="login_password" class="fld" value="" /></td>
Example #13
0
<?php

$districts = $objMember->getAllDistricts();
$objForm = new Form();
$objValid = new Validation($objForm);
$objSchool = new School();
$objValid->_expected = array('name', 'gender', 'day', 'month', 'year', 'personal_email', 'phone', 'district', 'skype', 'facebook', 'high_school', 'grad_year_h', 'uni', 'grad_year_u');
$objValid->_required = array('name', 'gender');
$objValid->_prefilled_fields = $member;
//PERSONAL INFORMATION HANDLING
if ($objForm->isPost('name')) {
    $email = $objForm->getPost('personal_email');
    $phone = $objForm->getPost('phone');
    $facebook = $objForm->getPost('facebook');
    $high_school = $objForm->getPost('high_school');
    $grad_year_h = $objForm->getPost('grad_year_h');
    $uni = $objForm->getPost('uni');
    $grad_year_u = $objForm->getPost('grad_year_u');
    if (!empty($member['personal_email']) && empty($email)) {
        $objValid->_special = array('personal_email' => 'email');
        $objValid->_special = array(array('field' => 'personal_email', 'case_type' => 'check_is_email'));
    }
    if (!empty($member['phone']) && empty($phone)) {
        $objValid->_required[] = 'phone';
    }
    if (!empty($member['facebook']) && empty($facebook)) {
        $objValid->_required[] = 'facebook';
    }
    if (!empty($member['high_school']) && empty($high_school)) {
        $objValid->_required[] = 'high_school';
    }