public function __construct($message, $code = 2, $log = '', $redirect = '')
 {
     // make sure everything is assigned properly
     parent::__construct($message, $code);
     // Set the alery
     SetAlert(stripslashes($this->message));
     // Log the Message if needed
     if ($log != '') {
         LogAction($log, $code);
     }
     // If needed Redirect
     if ($redirect != '') {
         header('Location:' . $redirect);
         die;
     }
 }
Пример #2
0
        die;
    }
    //ตรวจสอบถ้ามีการลบข้อมูล (ลบที่ละแถว)
    if ($_GET['action'] == 'del' && is_numeric($_GET['id']) && $_GET['id'] != '') {
        if (delete("tb_staff", "id = " . $_GET['id'])) {
            SetAlert('ลบข้อมูลสำเร็จ', 'success');
            //แสดงข้อมูลแจ้งเตือนถ้าสำเร็จ
            header('location:' . ADDRESS . 'staff');
            die;
        }
    }
    //ตรวจสอบถ้ามีการลบข้อมูล (ลบที่ละหลายแถว)
    if (isset($_POST['select_all'])) {
        $all_id = implode(',', $_POST['select_all']);
        if (delete("tb_staff", "id in(" . $all_id . ")")) {
            SetAlert('ลบข้อมูลสำเร็จ', 'success');
            //แสดงข้อมูลแจ้งเตือนถ้าสำเร็จ
            header('location:' . ADDRESS . 'staff');
            die;
        }
    }
    // แสดงการแจ้งเตือน
    Alert(GetAlert('error'));
    Alert(GetAlert('success'), 'success');
    ?>
<div class="row">
    <div class="col-lg-12">
        <h1 class="page-header">จัดการข้อมูลเจ้าหน้าที่</h1>

    </div>
    <!-- /.col-lg-12 -->
Пример #3
0
        if ($_POST['tag_title'][$i] != '' && $_POST['link_to'][$i] != '') {
            $arr_tag = array("tag_title" => $_POST['tag_title'][$i], "link_to" => $_POST['link_to'][$i]);
            $tag->SetValues($arr_tag);
            if ($tag->save()) {
                $save_res = true;
            } else {
                SetAlert('ไม่สามารถเพิ่ม แก้ไข ข้อมูลได้ กรุณาลองใหม่อีกครั้ง');
                $save_res = false;
            }
        }
    }
    if ($save_res) {
        SetAlert('เพิ่ม แก้ไข ข้อมูลสำเร็จ', 'success');
        // header('location:' . ADDRESS_ADMIN_CONTROL . 'shipping');
    } else {
        SetAlert('ไม่สามารถเพิ่ม แก้ไข ข้อมูลได้ กรุณาลองใหม่อีกครั้ง');
    }
}
?>

<div class="row-fluid">
    <div class="span12">
        <?php 
// Report errors to the user
Alert(GetAlert('error'));
Alert(GetAlert('success'), 'success');
?>
        <div class="da-panel collapsible">
            <div class="da-panel-header">
                <span class="da-panel-title"> <i
                        class="icol-<?php 
<script src="./plugins/datepicker/jquery.datepick-th.js"></script>
<?php 
//ยกเลิกการยืม
if ($_GET['action'] == 'cancel' && is_numeric($_GET['id']) && $_GET['id'] != '') {
    if (delete("tb_borrow", "id = " . $_GET['id'])) {
        SetAlert('ลบการยืมสำเร็จ', 'success');
        //แสดงข้อมูลแจ้งเตือนถ้าสำเร็จ
        header('location:' . ADDRESS . 'borrow');
        die;
    }
}
//ยกเลิกการยืม(ที่ละหลายแถว)
if (isset($_POST['select_all'])) {
    $all_id = implode(',', $_POST['select_all']);
    if (delete("tb_borrow", "id in(" . $all_id . ")")) {
        SetAlert('ลบการยืมสำเร็จ', 'success');
        //แสดงข้อมูลแจ้งเตือนถ้าสำเร็จ
        header('location:' . ADDRESS . 'borrow');
        die;
    }
}
// แสดงการแจ้งเตือน
Alert(GetAlert('error'));
Alert(GetAlert('success'), 'success');
?>

<div class="row">
    <div class="col-lg-12">
        <h1 class="page-header">รายงานสรุปการใช้งานยืม/คืน ตามระยะเวลา</h1>

    </div>
Пример #5
0
<?php

include_once $_SERVER['DOCUMENT_ROOT'] . '/../inc/application_top.php';
// Create the class
$myAnswers = new Answer();
// Refresh is nessisary
if (isset($_GET['refresh'])) {
    $total_imported = $myAnswers->GetRecentAnswers($myUser->GetPrimary());
    SetAlert('Successfully imported ' . $total_imported . ' new answers.', 'success');
    // Redirect out of the ?refresh
    header('Location: ' . PATH . 'answers/');
    die;
}
// Pull all the answers for this user
$myAnswers->SetValue('user_id', $myUser->GetPrimary());
$myAnswers->GetList(NULL, 'date_asked', 'ASC');
include_once DIR_ABS . '../inc/application_bottom.php';
// Assign everything to the templates
$smarty->assign('myObject', $myAnswers);
$smarty->assign('display', array('question', 'date_entered'));
$smarty->assign('locations', array('question' => '<a href="/answer/view/{$item_id}">{$data}</a>'));
$smarty->assign('options', array());
// Actions
$actions = array();
$actions[] = array('class' => 'reload', 'link' => '/answers?refresh', 'title' => 'Refresh Answers');
$smarty->assign('actions', $actions);
// Display the Index Page
$smarty->display('list.tpl');
Пример #6
0
    $data = array("status" => 'ยืม');
    if (update("tb_borrow", $data, "id = " . $_GET['id'])) {
        $data = array("status" => 'ยืม');
        if (update("tb_borrow_list", $data, "borrow_id = " . $_GET['id'])) {
            SetAlert('ยกเลิกการคืนสำเร็จ', 'success');
            //แสดงข้อมูลแจ้งเตือนถ้าสำเร็จ
            header('location:' . ADDRESS . 'return');
            die;
        }
    }
}
//ยกเลิกการคืน(ที่ละหลายแถว)
if (isset($_POST['select_all'])) {
    $all_id = implode(',', $_POST['select_all']);
    if (delete("tb_borrow", "id in(" . $all_id . ")")) {
        SetAlert('ลบการคืนสำเร็จ', 'success');
        //แสดงข้อมูลแจ้งเตือนถ้าสำเร็จ
        header('location:' . ADDRESS . 'borrow');
        die;
    }
}
// แสดงการแจ้งเตือน
Alert(GetAlert('error'));
Alert(GetAlert('success'), 'success');
?>
<div class="row">
    <div class="col-lg-12">
        <h1 class="page-header">จัดการคืนสื่อทัศนวัสดุ</h1>

    </div>
    <!-- /.col-lg-12 -->
Пример #7
0
     } else {
         //ถ้าว่างทำส่วนนี้ คือ เพิม่ลงฐานข้อมูล
         $data = array("first_name" => $_POST['first_name'], "last_name" => $_POST['last_name'], "staff_id" => $_SESSION['user_id'], "tel" => $_POST['tel'], "created_at" => DATE_TIME, "updated_at" => DATE_TIME);
         // insert ข้อมูลลงในตาราง tb_repair โดยฃื่อฟิลด์ และค่าตามตัวแปร array ชื่อ $data
         if (insert("tb_repair", $data)) {
             // บันทึกข้อมูลลงตาราง tb_repair
             if ($_POST['media_id'] != '') {
                 //ถ้ามีรหัสคอมพิวเตอร์
                 $arrIDMedia = explode(',', $_POST['media_id']);
                 $repair_id = getDataDescLastID("id", 'tb_repair');
                 foreach ($arrIDMedia as $key => $value) {
                     $data = array("repair_id" => $repair_id, "computer_id" => $value, "status" => '', "problem_description" => $_POST['problem_description'][$key], "created_at" => DATE_TIME, "updated_at" => DATE_TIME, "date_input" => DATE_TIME);
                     insert("tb_repair_list", $data);
                 }
             }
             SetAlert('เพิ่ม แก้ไข ข้อมูลสำเร็จ', 'success');
             //แสดงข้อมูลแจ้งเตือนถ้าสำเร็จ
             header('location:' . ADDRESS . 'repair');
             die;
         }
     }
 }
 //ลบคอมพิวเตอร์
 if ($_POST['media_id'] != '') {
     $all_id = '';
     $arrr = explode(',', $_POST['media_id']);
     foreach ($arrr as $v) {
         if ($_POST['delete_id'] != $v) {
             $all_id .= ',' . $v;
         }
     }
Пример #8
0
         //ถ้ามีมากกว่า 0 แสดงว่า username นี้มีการใช้ไปแล้ว
         SetAlert('username นี้มีการใช้งานแล้ว กรุณาเปลี่ยนใหม่');
         //แสดงข้อมูลแจ้งเตือน
     } else {
         //ถ้าว่างทำส่วนนี้ คือ เพิม่ลงฐานข้อมูล
         $data = array("first_name" => $_POST['first_name'], "last_name" => $_POST['last_name'], "address" => $_POST['address'], "email" => $_POST['email'], "tel" => $_POST['tel'], "status" => $_POST['status'], "username" => $_POST['username'], "password" => $_POST['password'], "created_at" => DATE_TIME, "updated_at" => DATE_TIME);
         // insert ข้อมูลลงในตาราง tb_staff โดยฃื่อฟิลด์ และค่าตามตัวแปร array ชื่อ $data
         if (insert("tb_staff", $data)) {
             // บันทึกข้อมูลลงตาราง tb_staff
             //  echo AlertSuccess;
             SetAlert('เพิ่ม แก้ไข ข้อมูลสำเร็จ', 'success');
             //แสดงข้อมูลแจ้งเตือนถ้าสำเร็จ
             header('location:' . ADDRESS . 'staff');
             die;
         } else {
             SetAlert('เกิดข้อผิดพลาดไม่สามารถเพิ่มข้อมูลได้');
             //แสดงข้อมูลแจ้งเตือนถ้าไม่สำเร็จ
             header('location:' . ADDRESS . 'staff_add');
             die;
         }
     }
 }
 $sql_status = "SELECT * FROM tb_staff WHERE id = " . $_SESSION['user_id'];
 $result = mysql_query($sql_status);
 $num_row = mysql_num_rows($result);
 if ($num_row == 1) {
     $row = mysql_fetch_assoc($result);
 }
 // แสดงการแจ้งเตือน
 Alert(GetAlert('error'));
 Alert(GetAlert('success'), 'success');
Пример #9
0
                $allID .= ',' . $row2['media_id'];
            }
            $allID = substr($allID, 1);
        }
    }
    if ($_POST['media_id_cancelReturn'] != '') {
        //ยกเลิกการคืนสื่อ
        $data = array("status" => 'ยืม', "return_date" => '');
        if (update('tb_borrow_list', $data, 'borrow_id =' . $_GET['id'] . ' AND media_id =' . $_POST['media_id_cancelReturn'])) {
            //ถ้าสถานะเป็น ยืมหมด จะไปอยู่ที่รายการยืม แต่ถ้า คืนมาบางส่วนจะอยู่ในส่วน ของรายการคืน
            if (getDataCount('borrow_id', 'tb_borrow_list', 'status="คืน" AND borrow_id=' . $_GET['id']) == 0) {
                $data = array("status" => 'ยืม');
                update('tb_borrow', $data, 'id =' . $_GET['id']);
            }
        }
        SetAlert('ยกเลิกการคืน สำเร็จ', 'success');
        //แสดงข้อมูลแจ้งเตือนถ้าสำเร็จ
    }
}
// แสดงการแจ้งเตือน
Alert(GetAlert('error'));
Alert(GetAlert('success'), 'success');
?>
<div class="row">
    <div class="col-lg-12">
        <h1 class="page-header">ข้อมูลการยืม</h1>

    </div>
    <!-- /.col-lg-12 -->
</div>
<div class="row">
Пример #10
0
            </div>
        </div>
  	</div>
</div>
<?php 
} else {
    ?>
 


<div class="row-fluid">
    <div class="span12">
    	<?php 
    // Report errors to the user
    SetAlert(GetAlert('error'));
    SetAlert(GetAlert('success'), 'success');
    ?>
       
        <div class="da-panel collapsible">
            <div class="da-panel-header">
                <span class="da-panel-title">
                    <i class="icol-grid"></i> รูปภาพ ทั้งหมด
                </span>
            </div>
            <div class="da-panel-toolbar">
                <div class="btn-toolbar">
                    <div class="btn-group"></div>
                </div>
            </div> 
            <div class="da-panel-content da-table-container">
                <table id="da-ex-datatable-sort" class="da-table" sort="0" order="asc" width="2000">
Пример #11
0
    //
    //        $data2 = array(
    //            "status" => 'ยกเลิกการจอง', // สถานะ
    //        );
    //        if (update("tb_booking_list", $data2, "booking_id in(" . $_GET['id'] . ")")) {
    //            SetAlert('ยกเลิกการจองสำเร็จ', 'success'); //แสดงข้อมูลแจ้งเตือนถ้าสำเร็จ
    //            header('location:' . ADDRESS . 'booking');
    //            die();
    //        }
    //    }
}
//ยกเลิกการจอง(ที่ละหลายแถว)
if (isset($_POST['select_all'])) {
    $all_id = implode(',', $_POST['select_all']);
    if (delete("tb_booking", "id in(" . $all_id . ")")) {
        SetAlert('ลบการจองสำเร็จ', 'success');
        //แสดงข้อมูลแจ้งเตือนถ้าสำเร็จ
        header('location:' . ADDRESS . 'booking');
        die;
    }
    //    $data = array(
    //        "status" => 'ยกเลิกการจอง', // สถานะ
    //        "updated_at" => DATE_TIME, //วันที่แก้ไข
    //    );
    //    if (update("tb_booking", $data, "id in(" . $all_id . ")")) {
    //        $data2 = array(
    //            "status" => 'ยกเลิกการจอง', // สถานะ
    //        );
    //        if (update("tb_booking_list", $data2, "booking_id in(" . $all_id . ")")) {
    //
    //            SetAlert('ยกเลิกการจองสำเร็จ', 'success'); //แสดงข้อมูลแจ้งเตือนถ้าสำเร็จ
Пример #12
0
// Prerequisites
session_start();
include_once $_SERVER["DOCUMENT_ROOT"] . '/lib/application.php';
if ($_COOKIE['user'] == '') {
    header('location:' . ADDRESS_ADMIN . 'login.php');
    //  die();
}
if ($_SESSION['admin_id'] != "") {
    // $users->SetPrimary($_SESSION['admin_id']);
    // $users->GetInfo();
} else {
    header('location:' . ADDRESS_ADMIN . 'login.php');
}
if ($_SESSION['admin_id'] == 'demo') {
    if ($_SERVER['REQUEST_METHOD'] == 'POST' || $_GET['action'] == 'del') {
        SetAlert('DEMO MODE ไม่สามารถกระทำรายการได้');
        header('location:' . ADDRESS_ADMIN_CONTROL . 'demo');
        exit;
    }
}
?>
<html lang="en">
    <head>

        <title></title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="Keywords" content="">
        <meta name="Description" content="">

            SetAlert('Category Successfully Saved.', 'success');
            LogAction('Saved Category: ' . stripslashes($myCategory->GetValue('category')), 1);
            header('location:' . PATH . 'categories');
            die;
        }
    }
    // If Deleting
    if ($_POST['submit'] == 'delete') {
        $myCategory->SetValues($_POST);
        $name = stripslashes($myCategory->GetValue('category'));
        // Remove from the DB
        if (!$myCategory->Delete()) {
            throw new SimplException('Error deleting from the database, please try again.');
        }
        // Everything went fine
        SetAlert('Category Deleted Successfully', 'success');
        LogAction('Deleted Category: ' . $name, 1);
        header('location:' . PATH . 'categories');
        die;
    }
    // Set the requested primary key and get its info
    if ($_GET['id'] != '' && $myCategory->GetPrimary() == '') {
        $myCategory->SetPrimary((int) $_GET['id']);
        // Try to get the info
        if (!$myCategory->GetInfo()) {
            throw new SimplException('Invalid category, please try another.', 3, 'Access to invalid category - ' . $myCategory->GetPrimary(), PATH . 'categories');
        }
    }
} catch (SimplException $e) {
}
// Set the object
        // insert ข้อมูลลงในตาราง tb_repair โดยฃื่อฟิลด์ และค่าตามตัวแปร array ชื่อ $data
        if (insert("tb_repair", $data)) {
            // บันทึกข้อมูลลงตาราง tb_repair
            if ($_POST['media_id'] != '') {
                //ถ้ามีรหัสคอมพิวเตอร์
                $arrIDMedia = explode(',', $_POST['media_id']);
                $repair_id = getDataDescLastID("id", 'tb_repair');
                foreach ($arrIDMedia as $key => $value) {
                    $data = array("repair_id" => $repair_id, "computer_id" => $value, "status" => '', "problem_description" => $_POST['problem_description'][$key], "created_at" => DATE_TIME, "updated_at" => DATE_TIME, "date_input" => DATE_TIME);
                    insert("tb_repair_list", $data);
                    // อัพเดรต status คอมพิวเตอร์หากมีการแจ้งปัญหา
                    $dataStatusCpt = array("status" => 'ส่งซ่อม', "updated_at" => DATE_TIME);
                    update("tb_computer", $dataStatusCpt, 'id = ' . $value);
                }
            }
            SetAlert('เพิ่ม แก้ไข ข้อมูลสำเร็จ <br><br> <b>รหัสการแจ้งซ่อม : ' . getDataDescLastID('id', 'tb_repair') . '<br> วันที่แจ้งซ่อม : ' . ShowDate(getDataDescLastID('created_at', 'tb_repair')) . '</b>', 'success');
            //แสดงข้อมูลแจ้งเตือนถ้าสำเร็จ
            header('location:' . ADDRESS . 'repair_add_user');
            die;
        }
    }
}
//ลบคอมพิวเตอร์
if ($_POST['media_id'] != '') {
    $all_id = '';
    $arrr = explode(',', $_POST['media_id']);
    foreach ($arrr as $v) {
        if ($_POST['delete_id'] != $v) {
            $all_id .= ',' . $v;
        }
    }
Пример #15
0
    if ($con > 0) {
        $row = $db->FetchArray($query);
        $getKey = $row['hash_key'];
        $getPass = $row['password'];
        $decodePass = $functions->deCrypted($getPass, $getKey);
        if ($password == $decodePass) {
            $_SESSION['admin_id'] = $row['id'];
            setcookie('id', $row['id'], time() + 86400 * 30, "/");
            // 86400 = 1 day
            header('location:' . ADDRESS_ADMIN_CONTROL . 'slides');
            die;
        } else {
            SetAlert('ชื่อผู้ใช้ กับรหัสผ่านไม่ตรงกัน กรุณาลองใหม่อีกครั้ง');
        }
    } else {
        SetAlert('ไม่มีชื่อผู้ใช้นี้ กรุณาลองใหม่อีกครั้ง');
    }
}
?>

<!DOCTYPE html>

<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->

<!--[if IE 7]>    <html class="lt-ie9 lt-ie8" lang="en"> <![endif]-->

<!--[if IE 8]>    <html class="lt-ie9" lang="en"> <![endif]-->

<!--[if gt IE 8]><!--><html lang="en"><!--<![endif]-->

Пример #16
0
        <script type="text/javascript">

            $(document).ready(function () {
                alert('รหัสผ่านไม่ถูกต้อง ลองใหม่อีกครั้ง');
            });


        </script>
        <?php 
    }
}
if ($_GET['id'] != '' && $_GET['action'] == 'edit') {
    // For Update
    $users->SetPrimary((int) $_GET['id']);
    if (!$users->GetInfo()) {
        SetAlert('Can not find data, please try again.');
        $users->ResetValues();
    }
}
if ($_GET['action'] == "add" || $_GET['action'] == "edit") {
    ?>

    <div class="row-fluid">
        <div class="span12">
            <?php 
    // Report errors to the user
    Alert(GetAlert('error'));
    Alert(GetAlert('success'), 'success');
    ?>
            <div class="da-panel collapsible">
                <div class="da-panel-header"> <span class="da-panel-title"> <i class="icol-bullet-key"></i>เปลี่ยนรหัสผ่าน</span> </div>
Пример #17
0
        $products->ResetValues();
    }
}
//
if ($_GET['product_files_id'] != '') {
    // Get all the form data
    $arrDel = array('id' => $_GET['product_files_id']);
    $product_files->SetValues($arrDel);
    // Remove the info from the DB
    if ($product_files->Delete()) {
        // Set alert and redirect
        SetAlert('Delete Data Success', 'success');
        header('location:' . ADDRESS_ADMIN_CONTROL . 'product&action=edit&id=' . $products->GetPrimary());
        die;
    } else {
        SetAlert('ไม่สามารถลบข้อมูลได้ กรุณาลองใหม่อีกครั้ง');
    }
}
if ($_GET['action'] == "add" || $_GET['action'] == "edit") {
    ?>
    <div class="row-fluid">
        <div class="span12">
    <?php 
    // Report errors to the user
    Alert(GetAlert('error'));
    Alert(GetAlert('success'), 'success');
    ?>
            <div class="da-panel collapsible">
                <div class="da-panel-header"> <span class="da-panel-title"> <i class="icol-<?php 
    echo $products->GetPrimary() != '' ? 'application-edit' : 'add';
    ?>
Пример #18
0
     if ($_SESSION['group'] == 'ผู้ดูแลระบบ') {
         $data = array("first_name" => $_POST['first_name'], "last_name" => $_POST['last_name'], "address" => $_POST['address'], "email" => $_POST['email'], "tel" => $_POST["tel"], "password" => $_POST['password'], "updated_at" => DATE_TIME);
     } else {
         $data = array("first_name" => $_POST['first_name'], "last_name" => $_POST['last_name'], "address" => $_POST['address'], "email" => $_POST['email'], "tel" => $_POST["tel"], "status" => $_POST["status"], "password" => $_POST['password'], "updated_at" => DATE_TIME);
     }
     // update ข้อมูลลงในตาราง tb_staff โดยฃื่อฟิลด์ และค่าตามตัวแปร array ชื่อ $data
     $user_id = $_GET['id'] == '' ? $_SESSION['user_id'] : $_GET['id'];
     if (update("tb_staff", $data, "id = " . $user_id)) {
         //ชื่อตาราง,ข้อมูลจากตัวแปร $data,id ที่จะทำการแก้ไข
         //  echo AlertSuccess;
         SetAlert('เพิ่ม แก้ไข ข้อมูลสำเร็จ', 'success');
         //แสดงข้อมูลแจ้งเตือนถ้าสำเร็จ
         //   header('location:' . ADDRESS . 'staff_edit&id=' . $_POST['id'] . $_POST['action'] != '' ? '&action=repassword':''); //กลับยังหน้าแสดงข้อมูล staff ทั้งหมด
         //   die();
     } else {
         SetAlert('เกิดข้อผิดพลาดไม่สามารถแก้ไขข้อมูลได้');
         //แสดงข้อมูลแจ้งเตือนถ้าไม่สำเร็จ
         header('location:' . ADDRESS . 'staff_edit');
         die;
     }
 }
 //เช็คค่า id ต้องมีค่า และ ไม่เป็นค่าว่าง และ ต้องเป็นตัวเลขเท่านั้น
 if (isset($_GET['id']) && $_GET['id'] != '' && is_numeric($_GET['id'])) {
     //ดึงข้อมูลตาม  $_GET['id'] ที่รับมา
     $sql = "SELECT * FROM tb_staff WHERE id = " . $_GET['id'];
     $result = mysql_query($sql);
     $num_row = mysql_num_rows($result);
     if ($num_row == 1) {
         $row = mysql_fetch_assoc($result);
     }
 } else {
         SetAlert('Answer Successfully Saved.', 'success');
         LogAction('Saved Answer: ' . stripslashes($myAnswer->GetValue('question')), 1);
         header('location:' . PATH . 'answers');
         die;
     }
 }
 // If Deleting
 if ($_POST['submit'] == 'Delete') {
     $myAnswer->SetValues($_POST);
     $name = stripslashes($myAnswer->GetValue('question'));
     // Remove from the DB
     if (!$myAnswer->Delete()) {
         throw new SimplException('Error deleting from the database, please try again.');
     }
     // Everything went fine
     SetAlert('Answer Deleted Successfully', 'success');
     LogAction('Deleted Answer: ' . $name, 1);
     header('location:' . PATH . 'answers');
     die;
 }
 // Set the requested primary key and get its info
 if ($_GET['id'] != '' && $myAnswer->GetPrimary() == '') {
     $myAnswer->SetPrimary((int) $_GET['id']);
     // Try to get the info
     if (!$myAnswer->GetInfo()) {
         throw new SimplException('Invalid answer, please try another.', 3, 'Access to invalid answer - ' . $myAnswer->GetPrimary(), PATH . 'answers');
     }
 }
 // If saving categories
 if ($_POST['submit'] == 'Save Categories') {
     $myAnswer->SyncCategories($_POST['category']);
Пример #20
0
    if ($myAuthor->Delete()) {
        // Set alert and redirect
        SetAlert('Author Deleted Successfully', 'success');
        header('location:authors.php');
        die;
    } else {
        SetAlert('Error Deleting Author, Please Try Again');
    }
}
// Set the requested primary key and get its info
if ($_GET['id'] != '') {
    // Set the priarmy key
    $myAuthor->SetPrimary((int) $_GET['id']);
    // Try to get the information
    if (!$myAuthor->GetInfo()) {
        SetAlert('Invalid Author, please try again');
        $myAuthor->ResetValues();
    }
}
// Display the Header
define('PAGE_TITLE', ($myAuthor->GetPrimary() != '' ? 'Edit' : 'Add') . ' Author');
include_once 'inc/header.php';
?>
<div id="main-info">
	<h1><?php 
echo PAGE_TITLE;
?>
</h1>
</div>
<div id="data">
	<div id="notifications">
Пример #21
0
    if ($myPost->Delete()) {
        // Set status and redirect
        SetAlert('Post Deleted Successfully', 'success');
        header('location:posts.php');
        die;
    } else {
        SetAlert('Error Deleting Post, Please Try Again');
    }
}
// Set the requested primary key and get its info
if ($_GET['id'] != '' && $myPost->GetPrimary() == '') {
    // Set the primary key
    $myPost->SetPrimary((int) $_GET['id']);
    // Try to get its information
    if (!$myPost->GetInfo()) {
        SetAlert('Invalid Post, please try again');
        $myPost->ResetValues();
    }
}
// Display the Header
define('PAGE_TITLE', ($myPost->GetPrimary() != '' ? 'Edit' : 'Add') . ' Post');
include_once 'inc/header.php';
?>
<div id="main-info">
	<h1><?php 
echo PAGE_TITLE;
?>
</h1>
</div>
<div id="data">
	<div id="notifications">
Пример #22
0
<?php

include_once $_SERVER['DOCUMENT_ROOT'] . '/../inc/application_top.php';
// Create the class
$myAnswers = new Answer();
// Refresh is nessisary
if (isset($_GET['refresh'])) {
    $total_imported = $myAnswers->GetRecentQuestions($myUser->GetPrimary());
    SetAlert('Successfully imported ' . $total_imported . ' new questions.', 'success');
    // Redirect out of the ?refresh
    header('Location: ' . PATH . 'inbox/');
    die;
}
// Pull all the answers for this user
$myAnswers->SetValue('user_id', $myUser->GetPrimary());
$myAnswers->SetConditions('`answer` = \'\'');
$myAnswers->GetList(NULL, 'date_asked', 'ASC');
include_once DIR_ABS . '../inc/application_bottom.php';
// Assign everything to the templates
$smarty->assign('myObject', $myAnswers);
$smarty->assign('display', array('question', 'date_entered'));
$smarty->assign('locations', array('question' => '<a href="/question/edit/{$item_id}">{$data}</a>'));
$smarty->assign('options', array());
// Actions
$actions = array();
$actions[] = array('class' => 'reload', 'link' => '/inbox?refresh', 'title' => 'Refresh Inbox');
$smarty->assign('actions', $actions);
// Display the Index Page
$smarty->display('list.tpl');