Esempio n. 1
0
 public function add()
 {
     if (empty($_GET['type_id'])) {
         $TypeID = 0;
     } else {
         $TypeID = $_GET['type_id'];
     }
     $org_id = $this->session->userdata('org_id');
     $LangID = $this->session->userdata("lang_id");
     $ObjType = $_GET['obj_type'];
     $obj = $this->obj->getOneData($ObjType);
     $obj_name = $obj['OBJ_NAME'];
     $obj_data = $this->obj->NameGetObj($org_id, $obj_name);
     p($obj_data);
     extract($obj_data, EXTR_OVERWRITE);
     $user_id = $this->session->userdata('user_id');
     $lead_attr = $this->attr->object_attr($org_id, $obj_name);
     $enum_attr = $this->enum->SelectAll();
     $DictAttr = _HashData($this->obj->NameGetCnDict($org_id, $LangID), "DICT_NAME");
     $data['lead_data'] = $this->message->Getinfo($org_id, $lead_attr, $user_id, $TypeID);
     //获取需要显示的字段
     $format = array("objType" => 170, "classID" => 16, "userID" => 0, "tables" => array(0 => array("tableNames" => array(1 => "消息详细", 2 => "消息详细", 3 => "消息详细"), "columns" => 2, "cells" => array(0 => array("name" => "MessageItem.Type", "rowspan" => 1, "colspan" => 1, "label" => 1, "required" => null), 1 => array("name" => "MessageItem.Type", "rowspan" => 1, "colspan" => 1, "label" => 0, "required" => null), 2 => array("name" => "MessageItem.To", "rowspan" => 1, "colspan" => 1, "label" => 1, "required" => null), 3 => array("name" => "MessageItem.To", "rowspan" => 1, "colspan" => 1, "label" => 0, "required" => null), 4 => array("name" => "MessageItem.Subject", "rowspan" => 1, "colspan" => 1, "label" => 1, "required" => null), 5 => array("name" => "MessageItem.Subject", "rowspan" => 1, "colspan" => 1, "label" => 0, "required" => null), 6 => array("name" => "MessageItem.CreatedTime", "rowspan" => 1, "colspan" => 1, "label" => 1, "required" => null), 7 => array("name" => "MessageItem.CreatedTime", "rowspan" => 1, "colspan" => 1, "label" => 0, "required" => null)))));
     $data['format_data'] = $this->objects->GetInfoEdit($org_id, $format, $data['lead_data'], $lead_attr, "", $enum_attr);
     $data['message'] = $this->message->countn4($user_id);
     $data['obj_type'] = $ObjType;
     $this->render('www/messsage/add', $data);
 }
Esempio n. 2
0
 public function InfoPagerList($ListFormat, $LeadAttr, $obj_data, $OrgID, $user_id, $CurrentPage = 1, $PageSize = 10, $where = array())
 {
     $first_tbl = $obj_data["MAIN_TABLE"];
     //主表名称
     $tbl_data = $this->GetTbl($ListFormat, $LeadAttr);
     //获取表名
     $fld_data = $this->GetFld($ListFormat, $LeadAttr);
     //获取字段名
     array_push($fld_data, $first_tbl . "." . ucfirst($obj_data["KEY_ATTR_FLD"]));
     $count_tbl = count($tbl_data);
     //获取得到的表数目
     //判断查询是否有过滤条件
     if (!empty($where)) {
         $w = $this->objects->parse_w($OrgID, $where);
         $this->db->where($w, NULL, FALSE);
     }
     $this->db->select($fld_data);
     //如果只有一张表无需使用join
     if ($count_tbl == 1) {
         $this->db->from(current($tbl_data));
     } else {
         $this->db->from($first_tbl);
         foreach ($tbl_data as $k => $v) {
             $join_on = "{$first_tbl}." . $obj_data["KEY_ATTR_FLD"] . " = {$v}." . $obj_data["KEY_ATTR_FLD"] . " and {$v}.ORG_ID = {$OrgID}";
             if ($v == $first_tbl) {
                 continue;
             }
             $this->db->join($v, $join_on, "inner");
         }
     }
     /**
      * 拼接过滤条件 判断 表中主键是否大于0 是否为已删除数据  按创建时间 排序
      */
     $FilterPriKey = $first_tbl . "." . $obj_data["KEY_ATTR_FLD"] . ">=";
     //$obj_data['IS_RECYCLABLE'] 是否放入回收站  如果是0则直接删除 如果是1则逻辑删除所以需在查询时做逻辑判断
     if ($obj_data['IS_RECYCLABLE']) {
         $IsDEleteKey = $first_tbl . "." . "is_deleted";
         $FilterWhere[$IsDEleteKey] = 0;
     }
     $FilterWhere[$FilterPriKey] = 1;
     $OrgIDKey = $first_tbl . "." . "org_id";
     $FilterWhere[$OrgIDKey] = 1;
     $FilterWhere['rel_message_user.user_id'] = $user_id;
     $this->db->where($FilterWhere);
     $this->db->order_by($first_tbl . "." . $obj_data["KEY_ATTR_FLD"], "desc");
     /**
      * 拼接过滤条件结束
      */
     //开始分页
     $this->db->limit($PageSize, ($CurrentPage - 1) * $PageSize + 1);
     $data = $this->db->get()->result_array();
     //将ID主键压入返回的数组字段中
     array_push($ListFormat, $obj_data["KEY_ATTR_NAME"]);
     foreach ($data as $k => $v) {
         if ($v['READ_FLAG'] == 0) {
             $data[$k]['MESSAGE_SUBJECT'] = $v['MESSAGE_SUBJECT'] . "<span class=\"badge badge-pink\">NEW!</span>";
         }
     }
     if (!empty($data)) {
         $data = $this->objects->FldConverName($data, $ListFormat, $LeadAttr);
         /*             * *开始解析数据类型*** */
         $data = $this->objects->GetDataType($data, $LeadAttr, $OrgID);
         if (!empty($res_data)) {
             $data = _HashData($data, $obj_data["KEY_ATTR_NAME"]);
             $this->objects->InfoMerger($data, $res_data, $attr_data, $for_data);
         } else {
             $res_data = $data;
         }
     }
     $count = $this->InoPageCount($first_tbl, $obj_data, $where, $w, $w1, $w_in, $user_id, $tbl_data);
     return $this->objects->InfoPagers($CurrentPage, $count, $PageSize, $res_data);
 }
Esempio n. 3
0
 /**
  * 获取AJAX查询列表
  * @param type $org_id 标识ID
  * @param type $LangID 语言ID
  * @param type $obj_name 对象名称
  * @param type $obj_data 对象结果集
  * @return type 返回数据
  */
 public function getSeniorQueryAttrs($org_id, $LangID, $obj_name, $obj_data, $lead_attr)
 {
     $DictAttr = _HashData($this->obj->NameGetCnDict($org_id, $LangID), "DICT_NAME");
     /**
      * 1 首先使用DISTANCT筛选出不重复的REFOBJNAME属性字段,并且调用getattrquery方法完成一次遍历查询 查询结果使用对象名+数组形式
      * 2 完成1步后再根据getattrquery 传入 bool值 与1步查询出来的数据 进行查询并且解析
      * 3 完成1 2 两步以后 调用解析自定义函数把相关数组转成一维数组并且将原因加入到二维数组中的值转换成一维
      */
     $dis_data = $this->getAttrDistanct($org_id, $obj_name, $obj_data, $DictAttr, $lead_attr);
     $object_attr = $this->getAttrQuery($org_id, $obj_name, $obj_data, $DictAttr, $lead_attr, true, $dis_data);
     $data["SeniorQueryAttrJson"] = $this->getObjAttrs($object_attr);
     return json_encode($data["SeniorQueryAttrJson"]);
 }