コード例 #1
0
<?php

$root = $_SERVER['DOCUMENT_ROOT'];
require_once $root . '/models/back/Layout_Model.php';
require_once $root . '/views/Layout_View.php';
require_once $root . '/backends/admin-backend.php';
require_once $root . '/Framework/Tools.php';
$model = new Layout_Model();
$memberId = (int) $_POST['memberId'];
switch ($_POST['opt']) {
    case 1:
        if ($model->addAgency($_POST['agency'])) {
            echo 1;
        }
        break;
    case 2:
        if ($agencies = $model->getAgencies()) {
            echo Layout_View::listAgencies($agencies);
        }
        break;
    default:
        break;
}
コード例 #2
0
    public function getAgencies()
    {
        ob_start();
        ?>
		<div class="row agencyForm">
			<div class="col-sm-3">
				<input type="text" class="" placeholder="agency" id="agency">
			</div>
			
			<div class="col-sm-2">
				<a href="javascript:void(0);" class="btn btn-info btn-xs" id="addAgency">add</a>
			</div>
		</div>
				
		<div class="table-responsive">
   		   	<table class="table table-striped">
   				<thead>
   					<tr>
   						<th>Agency</th>
   						<th></th>
   					</tr>
   				</thead>
   				<tbody id="agenciesList">
   					<?php 
        echo Layout_View::listAgencies($this->data['agencies']);
        ?>
   				</tbody>
   			</table>
		</div>
		<?php 
        $agencies = ob_get_contents();
        ob_end_clean();
        return $agencies;
    }