Esempio n. 1
0
 function getParent()
 {
     $user = log_model::getIdUserLogin();
     foreach ($user as $id) {
     }
     $id_u = $id['ID_U'];
     $q = $this->db->select('*')->from('menu_dropdown_parent')->join('fk_user_menu_dropdown ', 'fk_user_menu_dropdown.ID_MENU = menu_dropdown_parent.ID ', 'inner')->join('qtht_users ', 'qtht_users.ID_U = fk_user_menu_dropdown.ID_U ', 'inner')->where('qtht_users.ID_U', $id_u);
     return $q->get()->result_array();
 }
Esempio n. 2
0
 function getUrlUserAvartar()
 {
     $user_log = new log_model();
     $log = $user_log->getIdUserLogin();
     foreach ($log as $id) {
     }
     $id_avartar = $id['ID_U'];
     $q = $this->db->select('*')->from('qtht_users')->where('ID_U', $id_avartar)->get()->result_array();
     return $q;
 }
Esempio n. 3
0
 public function count_inbox()
 {
     $log = new log_model();
     $idu = $log->getIdUserLogin();
     foreach ($idu as $user) {
     }
     $idu = $user['ID_U'];
     $result = $this->db->select('COUNT(tinnhan_thongtin.id_thongtin) as C')->select('SUM(tinnhan_nhan.danhan) as UNREAD')->from('tinnhan_nhan')->join('tinnhan_thongtin', 'tinnhan_thongtin.id_thongtin=tinnhan_nhan.id_thongtin', 'inner')->where('nguoinhan', $idu)->where('tinnhan_nhan.hienthi', '1');
     $tmp = $result->get()->result();
     $res['count_inbox'] = $tmp[0]->C;
     $res['count_unread'] = $tmp[0]->UNREAD;
     return $res;
 }
Esempio n. 4
0
 function insertFile($idObject, $isTemp, $iddiv, $year, $type, $pdf = 0, $is_nogetcontent = 0)
 {
     $date = getdate();
     if (!$type) {
         $type = -1;
     }
     $year = '2012';
     if (!$idObject) {
         $idObject = 0;
     }
     if (!$isTemp) {
         $isTemp = 0;
     }
     $model = new filedinhkem_model();
     //Lưu file đính kèm xuống thư mục tạm
     $temp_path = $model->getTempPath();
     //lấy id người đăng nhập
     $user_log = new log_model();
     $user = $user_log->getIdUserLogin();
     foreach ($user as $au) {
     }
     //lấy idmessage
     $message_model = new message_model();
     $thongtin = $message_model->getId_Thongtin();
     foreach ($thongtin as $id_thongtin) {
     }
     $id_tn = $id_thongtin['id_thongtin'] + 1;
     //lấy idfood
     $food = new admin_model();
     $max_food = $food->getMaxIdFood();
     foreach ($max_food as $food_join) {
     }
     $ID = $food_join['ID'] + 1;
     //lấy id_project
     $project = new project_model();
     $duan = $project->getMaxId();
     foreach ($duan as $file_project) {
         $id_project = $file_project['ID_PR'] + 1;
     }
     $filepath = $temp_path . DIRECTORY_SEPARATOR . $_FILES['uploadedfile']['name'];
     if (!move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $filepath)) {
         return -1;
     } else {
         $file = new FileDinhKem();
         $file->_time_update = $date['year'] . '-' . $date['mon'] . '-' . $date['mday'] . ' ' . $date['hours'] . ':' . $date['minutes'] . ':' . $date['seconds'];
         $file->_nam = $date['year'];
         $file->_thang = $date['mon'];
         $dirPath = $model->getDir($file->_nam, $file->_thang);
         $file->_id_thongtin = $id_tn;
         $file->_folder = $dirPath;
         $file->_id_object = $idObject;
         $file->_ID = $ID;
         $file->_id_project = $id_project;
         $file->_user = $au['ID_U'];
         $file->_filename = $_FILES['uploadedfile']['name'];
         $file->_mime = $_FILES['uploadedfile']['type'];
         $file->_type = $type;
         $model->insertFileObject($file);
         //get attachment id
         $id = $this->getId_Dk();
         foreach ($id as $object) {
             $id_file = $object['ID_DK'];
         }
         $maso = $id_file . $file->_filename . $file->_time_update;
         //var_dump($maso);
         $maso = md5($maso);
         $model->md5_update($id_file, $maso);
         $newlocation = $dirPath . DIRECTORY_SEPARATOR . $maso;
         rename($filepath, $newlocation);
         $file->_pathFile = $newlocation;
         $file->_id_dk = $id_file;
         return $id_file;
     }
 }