Пример #1
0
 /**
  * @param string $class
  * @return string
  */
 public function get_user_menu($class = "active")
 {
     $list = cfg()->get('menu');
     $rt = "";
     $ui = $this->__uri->getUriInfo()->getUrlList();
     $access = access_class();
     foreach ($list as $v) {
         $flag = $this->menu_rule_check($v['url'], $ui);
         if ((!isset($v['role']) || login_class()->check_role($v['role'])) && (!isset($v['hide']) || !$v['hide'] || $v['hide'] && $flag[0])) {
             if (isset($v['access']) && !$access->has($v['access'])) {
                 continue;
             }
             $rt .= "<li role=\"presentation\"" . ($flag ? " class=\"{$class}\"" : '') . "><a href='" . get_url($v['url']) . "'>" . $v['name'] . "</a></li>\n";
         }
     }
     return $rt;
 }
Пример #2
0
 public function post()
 {
     header("Content-Type: text/html; charset=utf-8");
     $access = access_class();
     if (!$access->read("scores_list_report")) {
         $this->permission_deny();
         return;
     }
     $id_id = $this->__req->req('id_id');
     $icl_id = $this->__req->req('icl_id');
     $mc_number = $this->__req->req('mc_number');
     $mc_year = $this->__req->req('mc_year');
     $mc_s = compact('id_id', 'mc_number', 'mc_year');
     $msg = "";
     if (count($mc_s) != 3) {
         $msg = "提交数据不完全";
     } else {
         foreach ($mc_s as $v) {
             if (empty($v)) {
                 $msg = "数据存在空值";
                 break;
             }
         }
     }
     if ($msg) {
         $this->__view('report/error.php', compact('msg'));
         return;
     }
     $db = db_class();
     $mc_list = $db->getDriver()->select("mg_curriculum", ["[><]info_curriculum" => ['cu_id' => "cu_id"]], ["mc_id", "cu_name"], ['AND' => $mc_s]);
     if (count($mc_list) < 1) {
         $msg = "无数据可供查询";
         $this->__view('report/error.php', compact('msg'));
         return;
     }
     $mc_list = list2keymap($mc_list, "mc_id", "cu_name");
     if (!empty($icl_id)) {
         $icl_id = ['info_student.icl_id' => $icl_id];
     } else {
         $icl_id = [];
     }
     $table = [];
     foreach ($mc_list as $mc_id => $cu_name) {
         $now_select = $db->report_curriculum($mc_id, $icl_id);
         foreach ($now_select as $v) {
             if (!isset($table[$v['is_id']])) {
                 $table[$v['is_id']] = [];
                 $table[$v['is_id']]['name'] = $v['is_name'];
                 $table[$v['is_id']]['class'] = $v['icl_number'];
             }
             if (!isset($table[$v['is_id']]['list'])) {
                 $table[$v['is_id']]['list'] = [];
             }
             if (!isset($table[$v['is_id']]['list'][$mc_id])) {
                 $table[$v['is_id']]['list'][$mc_id] = ['test' => $v['sc_test'], 'work' => $v['sc_work'], 'total' => $v['sc_total']];
             }
         }
     }
     ksort($table);
     $info = $db->get_curriculum_info_by_mc_id(array_keys($mc_list)[0]);
     $this->__view('report/report.php', compact('info', 'table', 'mc_list', 'mc_s'));
 }
Пример #3
0
<?php

/**
 * @var $this    \UView\BaseInfo
 * @var $__info  array
 * @var $__type  string
 * @var $__query \ULib\QueryList
 */
$this->get_header();
$is_write = access_class()->write($__type);
?>
	<h3><?php 
echo $__info['name'];
?>
		<?php 
if ($is_write) {
    ?>
<a class="btn btn-primary btn-sm" href="<?php 
    echo get_url('BaseInfo', 'op', $__type, "add");
    ?>
">
				添加</a><?php 
}
?>
	</h3>
<?php 
if (isset($__info['search'])) {
    echo "<form class=\"form-inline\" method=\"get\" action='" . get_url("BaseInfo", "op", $__type, "list") . "'>";
    $__info['search']['order'] = ['name' => '排序', 'type' => 'select', 'list' => list2keymapSK($__info['filed'], "name")];
    $__info['search']['sort'] = ['name' => '排序方式', 'type' => 'select', 'list' => ['ASC' => '顺序', 'DESC' => '倒序']];
    foreach ($__info['search'] as $search_name => $search) {
Пример #4
0
 public function add_ajax()
 {
     $access = access_class();
     if (!$access->write("scores_add")) {
         $this->permission_deny();
         return;
     }
     header("Content-Type: application/json; charset=utf-8");
     $id_id = $this->__req->post('id_id');
     $icl_id = $this->__req->post('icl_id');
     $mc_id = $this->__req->post('mc_id');
     $rt = ['msg' => NULL, 'status' => false];
     if (!is_numeric($id_id) || !is_numeric($mc_id)) {
         $rt['msg'] = '专业字段或专业课程课号为空';
     } else {
         $db = db_class();
         if (!$db->check_mg_id_exists($id_id, $mc_id)) {
             $rt['msg'] = "专业与课程不匹配";
         } else {
             if (!empty($icl_id)) {
                 if (!$db->check_class_exists($id_id, $icl_id)) {
                     $rt['msg'] = "无法找到对应的班级";
                 } else {
                     $rt['msg'] = $db->insert_mc_id_class_list($id_id, $mc_id, $icl_id);
                     if ($rt['msg'] === false) {
                         $rt['msg'] = "插入失败,检测重复或异常";
                     } else {
                         $rt['status'] = true;
                     }
                 }
             } else {
                 $rt['msg'] = $db->insert_mc_id_list($id_id, $mc_id);
                 if ($rt['msg'] === false) {
                     $rt['msg'] = "插入失败,检测重复或异常";
                 } else {
                     $rt['status'] = true;
                 }
             }
         }
     }
     echo json_encode($rt);
 }
Пример #5
0
 public function add($type = NULL)
 {
     if (!isset($this->info_data[$type])) {
         $this->__load_404();
         return;
     }
     $access = access_class();
     if (!$access->write($type)) {
         $this->permission_deny();
         return;
     }
     header("Content-Type: application/json; charset=utf-8");
     $info = [];
     $rt = ['status' => false, 'msg' => NULL];
     $filed_check = $this->filed_check($type, $info, "add");
     if (!empty($filed_check)) {
         $rt['msg'] = '信息检测出错:' . $filed_check;
     }
     if (empty($rt['msg'])) {
         if (isset($this->info_data[$type]['full_check']) && !$this->info_data[$type]['full_check']($info)) {
             $rt['msg'] = "无法通过完整性约束检查";
         } else {
             $i = db_class()->base_info_insert($this->info_data[$type]['table'], $info);
             if ($i >= 0) {
                 $rt['status'] = true;
             } else {
                 $rt['msg'] = "添加数据失败";
             }
         }
     }
     echo json_encode($rt);
 }