<?php

require_once PLUGIN_DIR_PATH . 'admin/device.class.php';
require_once PLUGIN_DIR_PATH . 'admin/room.class.php';
require_once PLUGIN_DIR_PATH . 'admin/TypeStatus.class.php';
require_once PLUGIN_DIR_PATH . 'admin/provide.class.php';
require_once PLUGIN_DIR_PATH . 'admin/accessories.class.php';
require_once PLUGIN_DIR_PATH . 'admin/DeviceStatus.class.php';
require_once PLUGIN_DIR_PATH . 'admin/AccessoriesDevice.class.php';
$args = ['fields' => ['display_name', 'id']];
$list_user = get_users($args);
$devicestatus = new DeviceStatus();
$type_status = new TypeStatus();
$accessories = new Accessories();
$device = new Device();
$data = $devicestatus->getTable($where = "", $orderField = "matttb", $groupByField = "", Global_Define::KC_MANAGEMENT_ORDER . ' LIMIT ' . $devicestatus->num_item);
$num_page = $devicestatus->CountPage();
$list_type_status = $type_status->getTable($where = "", $orderField = "loaitinhtrang", $groupByField = "", '');
$list_accessories = $accessories->getTable($where = "", $orderField = "malk", $groupByField = "", '');
$list_device = $device->getTable($where = "", $orderField = "matb", $groupByField = "");
?>
<div id="wpbody" role="main">
	<div id="wpbody-content" aria-label="Nội dung chính" tabindex="0" style="overflow: hidden;">
			<div class="wrap">
				<h1><?php 
_e('Quản lý thiết bị phòng thực hành', KC_DOMAIN);
?>
</h1>
				<div id="welcome-panel" class="welcome-panel">
					<input type="hidden" id="welcomepanelnonce" name="welcomepanelnonce" value="d0b9b07e0f">        <a class="welcome-panel-close" href="http://manager.dev/wp-admin/?welcome=0">Hủy</a>
						<div class="welcome-panel-content">
Exemplo n.º 2
0
<?php

require_once PLUGIN_DIR_PATH . 'admin/accessories.class.php';
require_once PLUGIN_DIR_PATH . 'admin/room.class.php';
require_once PLUGIN_DIR_PATH . 'admin/provide.class.php';
$class = new Accessories();
$room = new Room();
$provide = new Provide();
$data = $class->getTable($where = "", $orderField = "malk", $groupByField = "", Global_Define::KC_MANAGEMENT_ORDER . ' LIMIT ' . $class->num_item);
$num_page = $class->CountPage();
$list_room = $room->getTable($where = "", $orderField = "maphong", $groupByField = "", '');
$list_provide = $provide->getTable($where = "", $orderField = "mancc", $groupByField = "", '');
?>
<div id="wpbody" role="main">

<div id="wpbody-content" aria-label="Nội dung chính" tabindex="0" style="overflow: hidden;">



<div class="wrap">
    <h1><?php 
_e('Quản lý thiết bị phòng thực hành', KC_DOMAIN);
?>
</h1>


    <div id="welcome-panel" class="welcome-panel">
        <input type="hidden" id="welcomepanelnonce" name="welcomepanelnonce" value="d0b9b07e0f">        <a class="welcome-panel-close" href="http://manager.dev/wp-admin/?welcome=0">Hủy</a>
            <div class="welcome-panel-content">
                <h3><?php 
_e('Quản lý linh kiện!', KC_DOMAIN);
 public static function Accessories($type, $data)
 {
     require_once 'accessories.class.php';
     $class = new Accessories();
     $status = false;
     $class->setData($data);
     switch ($type) {
         case 'add':
             $status = $class->add();
             break;
         case 'update':
             $status = $class->update();
             break;
         case 'delete':
             $status = $class->delete();
             break;
         case 'getsingle':
             $status = $class->getsingle();
             break;
         case 'getpage':
             $status = $class->getpage();
             break;
         case 'search':
             $status = $class->search();
             break;
         default:
             break;
     }
     if ($status) {
         wp_send_json_success($status);
     } else {
         wp_send_json_error($class->error);
     }
 }
Exemplo n.º 4
0
 public function actionSearch()
 {
     // страница
     $page = Yii::app()->request->getParam('page');
     if (!$page && !is_numeric($page)) {
         $page = 1;
     }
     $per_page = 10;
     // ключевое слово
     $select = '*';
     $where = '1';
     $string = Yii::app()->request->getParam('string');
     $string = strip_tags($string);
     if (isset($_GET['string'])) {
         if ($string) {
             $select .= ', MATCH(name) AGAINST (:string) as description';
             $where .= " and (MATCH(name) AGAINST(:string) > 5 OR name like '%" . $string . "%' OR art like '%" . $string . "%')";
             $params[':string'] = $string;
             $rubric = new Rubrics();
             $rubric->parent_id = -1;
             $rubric->name = $string;
         } else {
             Yii::app()->user->setFlash('no_search_string', 'Задана пустая строка. Введите поисковую фразу.');
         }
     }
     /* бренды */
     $brands = Brands::model()->findAll(array('condition' => 'status=1', 'order' => 'name'));
     $filterBrand = Yii::app()->request->getParam('b');
     if ($filterBrand > 0) {
         $where .= ' and brand_id=:brandId';
         $params[':brandId'] = $filterBrand;
         $filterBrand = Brands::model()->findByPk($filterBrand)->name;
     }
     if (!$rubric) {
         $rubric = new Rubrics();
         $rubric->parent_id = 1;
         $rubric->name = $filterBrand;
     }
     /* производитель аксессуаров */
     $accessories = Accessories::model()->findAll(array('condition' => 'status=1', 'order' => 'name'));
     $filterAccessories = Yii::app()->request->getParam('a');
     if ($filterAccessories > 0) {
         $where .= ' and accessories_id=:accessoriesId';
         $params[':accessoriesId'] = $filterAccessories;
         $filterAccessories = Accessories::model()->findByPk($filterAccessories)->name;
     }
     if (!$rubric) {
         $rubric = new Rubrics();
         $rubric->parent_id = 1;
         $rubric->name = $filterAccessories;
     }
     $catalog = Catalog::model()->findAll(array('select' => $select, 'condition' => $where, 'params' => $params, 'order' => $sort, 'limit' => $per_page, 'offset' => ($page - 1) * $per_page));
     $cnt = Catalog::model()->count(array('condition' => $where, 'params' => $params));
     $pages = ceil($cnt / $per_page);
     $data = array('rubric' => $rubric, 'data' => $catalog, 'brands' => $brands, 'accessories' => $accessories, 'pages' => $pages, 'page' => $page, 'page_link' => '?' . Yii::app()->request->getQueryString(), 'pp' => $per_page);
     $this->render('/catalog/rubric', $data);
 }