这段代码基于什么框架?

时间:2015-10-14 06:36:27

标签: php model-view-controller

我以前的公司使用了具有以下目录结构的框架:

Directory structure of using framework

我不知道框架的名称,它只被称为MVC框架。当我被问及#34;您知道哪个框架?"我不知道如何回应,因为我不知道我以前用过的名字;我只是说我非常了解MVC架构。

控制器示例:

<?php
    class adminController extends baseController {

        public function index() {
            $this->registry->template->show ( 'admin/admin_index' );
        }

        public function signin() { 
            $admin = new admin ();
            $validation = new validation ();  
            if (isset ( $this->registry->data ['signin'] )) { 
                if ($validation->validateForm ( 'admin_signin', $this->registry )) {                
                    if (isset ( $this->registry->data ['username'] ) && isset ( $this->registry->data ['password'] )) {
                        if ($admin->is_admin ( $this->registry->data ['username'], $this->registry->data ['password'] )) {
                            $admin->set_admin ();
                            //util::redirect ( '/admin/admin_index' );
                            util::redirect ( '/index/index' );
                           // $this->registry->template->show ( '/admin/admin_index' );
                        } else {
                            $this->registry->template->password_val = 'Invalid  password';
                        }
                    } else {
                        $this->registry->template->password_val = 'Invalid username or password';
                    }
                } else {
                    $this->registry->template->password_val = 'Invalid username or password';
                }
            } else { /*comment*/        }
            $this->registry->template->show ( 'admin/admin_signin' );
        }

示例视图:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

    <head>
    <?php
        include '/header.php';     
    ?>
    </head>
        <style>
    .blink{
      background-color : #ffcc33;
      width:320px; 
    }
    .error{
        width : 54%;
        font-family: Arial;
        font-weight: 100;
        font-size: 15px;
        color: #ffffff;
        background-color: #cc0000;
    }    

    </style> 

    <script>


        function addCashSubmit(){
            if(ValidateRequired('cashAmount','cashAmountDiv','cashAmountValMsg') && validNumericValue('cashAmount','cashAmountValMsg',0,10000000,true)){
                $('form:first').submit();
        }
            else{
                 alert("Please insert correct values for correct field..");
                 return false;
                 }             
        }

        $(document).ready(function() {
            var value_customer_id = getUrlVars()['customer_id'];
            var value_invoice_id = getUrlVars()['invoice_id'];
            $("#customer_id").val(value_customer_id);
            $("#invoice_id").val(value_invoice_id);
            var url =assignUrl(value_customer_id,value_invoice_id);
            $('#addCash').attr('action', url);
            });

        function getUrlVars() {
            var vars = {};
            var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
                vars[key] = value;
            });
            return vars;
        }

        function assignUrl(customer_id,invoice_id){
            return "/customer/addCash?add=ok&customer_id="+customer_id+"&invoice_id="+invoice_id;
        }

    </script>
    <body>  
        <!--heade set-->

        <?php
            include 'mainmenu.php';     
        ?>

        <!--heade set-->

        <!--body-->

        <div id="mainbody">

        <!--stock-->
        <div id="content">
            <form id="addCash" class="hms-form" name="addCash" action="#" method="post"> 

                <h2>Enter The Cash Detail</h2>
                    <div  class="error"><?php echo $this->errormsg?></div>                                               
                <div class="input-container">
                    <label for="check">Cash Amount</label>
                            <div id="cashAmountDiv" >
                                <input type="hidden" name="customer_id" maxlength="100" id="customer_id" class='dummy_for_validation_count'/>                            
                                <input type="hidden" name="invoice_id" maxlength="100" id="invoice_id" class='dummy_for_validation_count'/>                                
                                <input type="hidden" name="url" maxlength="100" id="url" class='dummy_for_validation_count'/ value="<?php echo $_SERVER['REQUEST_URI']; ?>">                                
                                <input type="text" name="cashAmount" maxlength="100" id="cashAmount"  onblur="ValidateRequired('cashAmount','cashAmountDiv','cashAmountValMsg');validNumericValue('cashAmount','cashAmountValMsg',0,10000000000000000000000,true)" />
                                <div id="cashAmountValMsg"></div>
                            </div>
                </div>
                <div class="bottomLinks clearfix">    
                    <a onclick="return addCashSubmit()" class="formActionBtnBg" name="Add" id="Add" href="#">Save</a>     
                </div>
            </form>
        </div>

        <!--body-->

        <!--footer-->
        <?php
            include 'footer.php';     
        ?>
        <!--footer-->


    </body>
</html>   

示例模型:

<?php
  class customer extends db {
      public function addCustomerInfo($customer_name,$customer_c_no,$customer_place,$date){
            $sql = "INSERT INTO sales_customer_info (name ,contact_no,place,date) VALUES (:name ,:contact_no,:place,:date)";
            $data ['name'] = array ($customer_name, 'string' );
            $data ['contact_no'] = array ($customer_c_no, 'int' );
            $data ['place'] = array ($customer_place, 'string' );
            $data ['date'] = array ($date, 'string' );
            parent::prepare ( $sql );
            parent::databind ( $data );
            parent::execute ();    
      }

      public function addSalesForCustomer($invoice_no,$customer_id,$product_place_id,$quantity,$date){
            $sql = "INSERT INTO sales (invoice_no,customer_id ,product_place_id_primary,quantity,date) VALUES (:invoice_no,:customer_id ,:product_place_id_primary,:quantity,:date)";
            $data ['customer_id'] = array ($customer_id, 'int' );
            $data ['invoice_no'] = array ($invoice_no, 'int' );
            $data ['product_place_id_primary'] = array ($product_place_id, 'int' );
            $data ['quantity'] = array ($quantity, 'int' );
            $data ['date'] = array ($date, 'string' );
            parent::prepare ( $sql );
            parent::databind ( $data );
            parent::execute ();    
      }

这是什么框架?

0 个答案:

没有答案