فهرست منبع

Merge branch 'feature/附件功能完善' into develop

# Conflicts:
#	protected/config/routes.conf.php
#	protected/config/ver.conf.php
#	protected/controller/ClientController.php
#	protected/module/admin/model/aconfig.php
NoNZero 8 سال پیش
والد
کامیت
1044866086
39فایلهای تغییر یافته به همراه3352 افزوده شده و 1229 حذف شده
  1. 1 2
      global/js/jl.js
  2. 2 0
      global/js/jquery.cookie.min.js
  3. 1 0
      global/js/jquery.min.map
  4. 1 1
      index.php
  5. 407 381
      protected/class/attachment.php
  6. 14 0
      protected/class/auth.php
  7. 29 23
      protected/class/itemfile.php
  8. 51 0
      protected/class/itemmeasurenum.php
  9. 58 34
      protected/class/profile.php
  10. 83 0
      protected/class/sms.php
  11. 18 0
      protected/config/routes.conf.php
  12. 5 0
      protected/config/sms.conf.php
  13. 1 1
      protected/config/ver.conf.php
  14. 149 36
      protected/controller/ClientController.php
  15. 113 2
      protected/controller/ProjectController.php
  16. 129 3
      protected/controller/RProjectController.php
  17. 143 30
      protected/controller/UserController.php
  18. 8 7
      protected/model/itematt.php
  19. 33 0
      protected/model/itemmnum.php
  20. 7 4
      protected/model/uprofile.php
  21. 28 5
      protected/module/admin/controller/SysController.php
  22. 11 2
      protected/module/admin/model/aconfig.php
  23. 95 0
      protected/module/admin/view/admin-sms.html
  24. 90 81
      protected/module/admin/view/admin-userlist.html
  25. 1 0
      protected/module/admin/view/menu.html
  26. 75 80
      protected/view/edit-profile-avtra.html
  27. 169 0
      protected/view/edit-profile-sms-edit.html
  28. 205 0
      protected/view/edit-profile-sms.html
  29. 94 91
      protected/view/edit-profile.html
  30. 298 273
      protected/view/r-project-section-detail.html
  31. 154 0
      protected/view/r-project-section-files.html
  32. 191 162
      protected/view/r-project-section-report.html
  33. 13 11
      protected/view/top.html
  34. 3 0
      protected/view/w-project-section-detail.html
  35. 254 0
      protected/view/w-project-section-files-recover.html
  36. 325 0
      protected/view/w-project-section-files.html
  37. 67 0
      zh.php
  38. 2 0
      短信提醒.sql
  39. 24 0
      附件.sql

+ 1 - 2
global/js/jl.js

@@ -6,6 +6,7 @@ function autoFlashHeight() {
     $(".jlTable").height($(window).height() - 101);
     $(".misTable").height($(window).height() - 228);
     $(".topBanner").height($(window).height() - 65);
+    if($(this).hasClass('tablelist'))
     $(".tablelist").tablesorter({widthFixed: true});
 }
 $(window).resize(autoFlashHeight);
@@ -35,5 +36,3 @@ $(function () {
     waveloop2();
 
 });
-
-

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 2 - 0
global/js/jquery.cookie.min.js


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1 - 0
global/js/jquery.min.map


+ 1 - 1
index.php

@@ -1,10 +1,10 @@
 <?php
-
 include './protected/config/common.conf.php';
 include './protected/config/routes.conf.php';
 include './protected/config/db.conf.php';
 include './protected/config/acl.conf.php';
 include './protected/config/ver.conf.php';
+include './protected/config/sms.conf.php';
 #Just include this for production mode
 //include $config['BASE_PATH'].'deployment/deploy.php';
 include $config['BASE_PATH'] . 'Doo.php';

+ 407 - 381
protected/class/attachment.php

@@ -1,6 +1,7 @@
 <?php
 
-class attachment {
+class attachment
+{
 
     var $contentid;
     var $module;
@@ -18,20 +19,22 @@ class attachment {
     var $upload_dir;
     var $uploadeds;
 
-    function __construct($catid = 0, $upload_dir = 'data/') {
-	$this->catid = intval($catid);
+    function __construct($catid = 0, $upload_dir = 'data/')
+    {
+        $this->catid = intval($catid);
 //	$this->siteid = intval($siteid) == 0 ? 1 : intval($siteid);
 //	$this->module = $module ? $module : 'content';
 //	pc_base::load_sys_func('dir');
 //	pc_base::load_sys_class('image', '', '0');
-	$this->upload_root = Doo::conf()->SITE_PATH;
-	$this->upload_func = 'move_uploaded_file';
+        $this->upload_root = Doo::conf()->SITE_PATH;
+        $this->upload_func = 'move_uploaded_file';
 //	$this->upload_func = 'copy';
-	$this->upload_dir = $upload_dir;
+        $this->upload_dir = $upload_dir;
     }
 
-    function setUploadDir($upload_dir = 'files/') {
-	$this->upload_dir = $upload_dir;
+    function setUploadDir($upload_dir = 'files/')
+    {
+        $this->upload_dir = $upload_dir;
     }
 
     /**
@@ -43,88 +46,89 @@ class attachment {
      * @param $thumb_setting 缩略图设置
      * @param $watermark_enable  是否添加水印
      */
-    function upload($field, $alowexts = '', $maxsize = 0, $overwrite = 0, $thumb_setting = array(), $watermark_enable = 1, $ip = '') {
-	if (!isset($_FILES[$field])) {
-	    $this->error = UPLOAD_ERR_OK;
-	    return false;
-	}
-	$this->field = $field;
-	$this->savepath = $this->upload_root . $this->upload_dir . date('Y/md/');
-	$this->alowexts = $alowexts;
-	$this->maxsize = $maxsize;
-	$this->overwrite = $overwrite;
-	$uploadfiles = array();
-	$description = isset($GLOBALS[$field . '_description']) ? $GLOBALS[$field . '_description'] : array();
+    function upload($field, $alowexts = '', $maxsize = 0, $overwrite = 0, $thumb_setting = array(), $watermark_enable = 1, $ip = '')
+    {
+        if (!isset($_FILES[$field])) {
+            $this->error = UPLOAD_ERR_OK;
+            return false;
+        }
+        $this->field = $field;
+        $this->savepath = $this->upload_root . $this->upload_dir . date('Y/md/');
+        $this->alowexts = $alowexts;
+        $this->maxsize = $maxsize;
+        $this->overwrite = $overwrite;
+        $uploadfiles = array();
+        $description = isset($GLOBALS[$field . '_description']) ? $GLOBALS[$field . '_description'] : array();
 //	$this->uploads = count($_FILES[$field]['error']);
 //	if ($this->uploads >= 2) {
-	if (is_array($_FILES[$field]['error'])) {
-	    $this->uploads = count($_FILES[$field]['error']);
-	    foreach ($_FILES[$field]['error'] as $key => $error) {
-		if ($error === UPLOAD_ERR_NO_FILE)
-		    continue;
-		if ($error !== UPLOAD_ERR_OK) {
-		    $this->error = $error;
-		    return false;
-		}
-		$uploadfiles[$key] = array('tmp_name' => $_FILES[$field]['tmp_name'][$key], 'name' => $_FILES[$field]['name'][$key], 'type' => $_FILES[$field]['type'][$key], 'size' => $_FILES[$field]['size'][$key], 'error' => $_FILES[$field]['error'][$key], 'description' => $description[$key]);
-	    }
-	} else {
-	    $this->uploads = 1;
-	    if (!$description)
-		$description = '';
-	    $uploadfiles[0] = array('tmp_name' => $_FILES[$field]['tmp_name'], 'name' => $_FILES[$field]['name'], 'type' => $_FILES[$field]['type'], 'size' => $_FILES[$field]['size'], 'error' => $_FILES[$field]['error'], 'description' => $description);
-	}
-	if (!$this->dir_create($this->savepath)) {
-	    $this->error = '8';
-	    return false;
-	}
-	if (!is_dir($this->savepath)) {
-	    $this->error = '8';
-	    return false;
-	}
-	@chmod($this->savepath, 0777);
-
-	if (!is_writeable($this->savepath)) {
-	    $this->error = '9';
-	    return false;
-	}
+        if (is_array($_FILES[$field]['error'])) {
+            $this->uploads = count($_FILES[$field]['error']);
+            foreach ($_FILES[$field]['error'] as $key => $error) {
+                if ($error === UPLOAD_ERR_NO_FILE)
+                    continue;
+                if ($error !== UPLOAD_ERR_OK) {
+                    $this->error = $error;
+                    return false;
+                }
+                $uploadfiles[$key] = array('tmp_name' => $_FILES[$field]['tmp_name'][$key], 'name' => $_FILES[$field]['name'][$key], 'type' => $_FILES[$field]['type'][$key], 'size' => $_FILES[$field]['size'][$key], 'error' => $_FILES[$field]['error'][$key], 'description' => $description[$key]);
+            }
+        } else {
+            $this->uploads = 1;
+            if (!$description)
+                $description = '';
+            $uploadfiles[0] = array('tmp_name' => $_FILES[$field]['tmp_name'], 'name' => $_FILES[$field]['name'], 'type' => $_FILES[$field]['type'], 'size' => $_FILES[$field]['size'], 'error' => $_FILES[$field]['error'], 'description' => $description);
+        }
+        if (!$this->dir_create($this->savepath)) {
+            $this->error = '8';
+            return false;
+        }
+        if (!is_dir($this->savepath)) {
+            $this->error = '8';
+            return false;
+        }
+        @chmod($this->savepath, 0777);
+
+        if (!is_writeable($this->savepath)) {
+            $this->error = '9';
+            return false;
+        }
 //	if (!$this->is_allow_upload()) {
 //	    $this->error = '13';
 //	    return false;
 //	}
-	$aids = array();
-	foreach ($uploadfiles as $k => $file) {
-	    $fileext = $this->fileext($file['name']);
-	    if ($file['error'] != 0) {
-		$this->error = $file['error'];
-		return false;
-	    }
+        $aids = array();
+        foreach ($uploadfiles as $k => $file) {
+            $fileext = $this->fileext($file['name']);
+            if ($file['error'] != 0) {
+                $this->error = $file['error'];
+                return false;
+            }
 //	    if (!preg_match("/^(" . $this->alowexts . ")$/", $fileext)) {
 //		$this->error = '10';
 //		return false;
 //	    }
-	    if ($this->maxsize && $file['size'] > $this->maxsize) {
-		$this->error = '11';
-		return false;
-	    }
-	    if (!$this->isuploadedfile($file['tmp_name'])) {
-		$this->error = '12';
-		return false;
-	    }
-	    $temp_filename = $this->getname($fileext);
-	    $savefile = $this->savepath . $temp_filename;
-
-	    $savefile = preg_replace("/(php|phtml|php3|php4|jsp|exe|dll|asp|cer|asa|shtml|shtm|aspx|asax|cgi|fcgi|pl)(\.|$)/i", "_\\1\\2", $savefile);
-	    $filepath = preg_replace($this->new_addslashes("|^" . $this->upload_root . "|"), "", $savefile);
-	    if (!$this->overwrite && file_exists($savefile))
-		continue;
-	    $upload_func = $this->upload_func;
-	    if ($upload_func($file['tmp_name'], $savefile)) {
+            if ($this->maxsize && $file['size'] > $this->maxsize) {
+                $this->error = '11';
+                return false;
+            }
+            if (!$this->isuploadedfile($file['tmp_name'])) {
+                $this->error = '12';
+                return false;
+            }
+            $temp_filename = $this->getname($fileext);
+            $savefile = $this->savepath . $temp_filename;
+
+            $savefile = preg_replace("/(php|phtml|php3|php4|jsp|exe|dll|asp|cer|asa|shtml|shtm|aspx|asax|cgi|fcgi|pl)(\.|$)/i", "_\\1\\2", $savefile);
+            $filepath = preg_replace($this->new_addslashes("|^" . $this->upload_root . "|"), "", $savefile);
+            if (!$this->overwrite && file_exists($savefile))
+                continue;
+            $upload_func = $this->upload_func;
+            if ($upload_func($file['tmp_name'], $savefile)) {
 //		$this->uploadeds++;
-		@chmod($savefile, 0777);
-		@unlink($file['tmp_name']);
+                @chmod($savefile, 0777);
+                @unlink($file['tmp_name']);
 //		$file['name'] = iconv("utf-8", 'sdsdf', $file['name']);
-		$uploadedfile = array('filename' => $file['name'], 'filepath' => $filepath, 'filesize' => $file['size'], 'fileext' => $fileext, 'uploadip' => $ip, 'uploadtime' => time());
+                $uploadedfile = array('filename' => $file['name'], 'filepath' => $filepath, 'filesize' => $file['size'], 'fileext' => $fileext, 'uploadip' => $ip, 'uploadtime' => time());
 //                error_log(var_export($uploadedfile, TRUE), 3, '/opt/WebRoot/wenku/data/upArray.txt');
 //		$thumb_enable = is_array($thumb_setting) && ($thumb_setting[0] > 0 || $thumb_setting[1] > 0 ) ? 1 : 0;
 //		$image = new image($thumb_enable, $this->siteid);
@@ -135,9 +139,9 @@ class attachment {
 //		    $image->watermark($savefile, $savefile);
 //		}
 //		$aids[] = $this->add($uploadedfile);
-	    }
-	}
-	return $uploadedfile;
+            }
+        }
+        return $uploadedfile;
     }
 
     /**
@@ -147,89 +151,90 @@ class attachment {
      * @param $maxsize 最大上传大小
      * @param $overwrite 是否覆盖原有文件
      */
-    function uploadMut($field, $alowexts = '', $maxsize = 0, $overwrite = 0) {
-	if (!isset($_FILES[$field])) {
-	    $this->error = UPLOAD_ERR_OK;
-	    return false;
-	}
-	$this->field = $field;
-	$this->savepath = $this->upload_root . $this->upload_dir . date('Y/md/');
-	$this->alowexts = $alowexts;
-	$this->maxsize = $maxsize;
-	$this->overwrite = $overwrite;
-	$uploadfiles = array();
-	$description = isset($GLOBALS[$field . '_description']) ? $GLOBALS[$field . '_description'] : array();
-	if (is_array($_FILES[$field]['error'])) {
-	    $this->uploads = count($_FILES[$field]['error']);
-	    foreach ($_FILES[$field]['error'] as $key => $error) {
-		if ($error === UPLOAD_ERR_NO_FILE)
-		    continue;
-		if ($error !== UPLOAD_ERR_OK) {
-		    $this->error = $error;
-		    return false;
-		}
-		$uploadfiles[$key] = array('tmp_name' => $_FILES[$field]['tmp_name'][$key], 'name' => $_FILES[$field]['name'][$key], 'type' => $_FILES[$field]['type'][$key], 'size' => $_FILES[$field]['size'][$key], 'error' => $_FILES[$field]['error'][$key]);
-	    }
-	} else {
-	    $this->uploads = 1;
-	    if (!$description)
-		$description = '';
-	    $uploadfiles[0] = array('tmp_name' => $_FILES[$field]['tmp_name'], 'name' => $_FILES[$field]['name'], 'type' => $_FILES[$field]['type'], 'size' => $_FILES[$field]['size'], 'error' => $_FILES[$field]['error'], 'description' => $description);
-	}
-	if (!$this->dir_create($this->savepath)) {
-	    $this->error = '8';
-	    return false;
-	}
-	if (!is_dir($this->savepath)) {
-	    $this->error = '8';
-	    return false;
-	}
+    function uploadMut($field, $alowexts = '', $maxsize = 0, $overwrite = 0)
+    {
+        if (!isset($_FILES[$field])) {
+            $this->error = UPLOAD_ERR_OK;
+            return false;
+        }
+        $this->field = $field;
+        $this->savepath = $this->upload_root . $this->upload_dir . date('Y/md/');
+        $this->alowexts = $alowexts;
+        $this->maxsize = $maxsize;
+        $this->overwrite = $overwrite;
+        $uploadfiles = array();
+        $description = isset($GLOBALS[$field . '_description']) ? $GLOBALS[$field . '_description'] : array();
+        if (is_array($_FILES[$field]['error'])) {
+            $this->uploads = count($_FILES[$field]['error']);
+            foreach ($_FILES[$field]['error'] as $key => $error) {
+                if ($error === UPLOAD_ERR_NO_FILE)
+                    continue;
+                if ($error !== UPLOAD_ERR_OK) {
+                    $this->error = $error;
+                    return false;
+                }
+                $uploadfiles[$key] = array('tmp_name' => $_FILES[$field]['tmp_name'][$key], 'name' => $_FILES[$field]['name'][$key], 'type' => $_FILES[$field]['type'][$key], 'size' => $_FILES[$field]['size'][$key], 'error' => $_FILES[$field]['error'][$key]);
+            }
+        } else {
+            $this->uploads = 1;
+            if (!$description)
+                $description = '';
+            $uploadfiles[0] = array('tmp_name' => $_FILES[$field]['tmp_name'], 'name' => $_FILES[$field]['name'], 'type' => $_FILES[$field]['type'], 'size' => $_FILES[$field]['size'], 'error' => $_FILES[$field]['error'], 'description' => $description);
+        }
+        if (!$this->dir_create($this->savepath)) {
+            $this->error = '8';
+            return false;
+        }
+        if (!is_dir($this->savepath)) {
+            $this->error = '8';
+            return false;
+        }
 //	@chmod($this->savepath, 0777);
 
-	if (!is_writeable($this->savepath)) {
-	    $this->error = '9';
-	    return false;
-	}
-	$aids = array();
-	foreach ($uploadfiles as $k => $file) {
-	    $fileext = $this->fileext2($file['name']);
-	    if ($file['error'] != 0) {
-		$this->error = $file['error'];
+        if (!is_writeable($this->savepath)) {
+            $this->error = '9';
+            return false;
+        }
+        $aids = array();
+        foreach ($uploadfiles as $k => $file) {
+            $fileext = $this->fileext2($file['name']);
+            if ($file['error'] != 0) {
+                $this->error = $file['error'];
 //		echo $this->error;
-		return false;
-	    }
+                return false;
+            }
 //	    if (!preg_match("/^(" . $this->alowexts . ")$/", $fileext)) {
 //		$this->error = '10';
 //		echo $this->error;
 //		return false;
 //	    }
-	    if ($this->maxsize && $file['size'] > $this->maxsize) {
-		$this->error = '11';
+            if ($this->maxsize && $file['size'] > $this->maxsize) {
+                $this->error = '11';
 //		echo $this->error;
-		return false;
-	    }
-	    if (!$this->isuploadedfile($file['tmp_name'])) {
-		$this->error = '12';
+                return false;
+            }
+            if (!$this->isuploadedfile($file['tmp_name'])) {
+                $this->error = '12';
 //		echo $this->error;
-		return false;
-	    }
-	    $temp_filename = $this->getname($fileext);
-	    $savefile = $this->savepath . $temp_filename;
-	    $savefile = preg_replace("/(php|phtml|php3|php4|jsp|exe|dll|asp|cer|asa|shtml|shtm|aspx|asax|cgi|fcgi|pl)(\.|$)/i", "_\\1\\2", $savefile);
-	    $filepath = preg_replace($this->new_addslashes("|^" . $this->upload_root . "|"), "", $savefile);
-	    if (!$this->overwrite && file_exists($savefile))
-		continue;
-	    $upload_func = $this->upload_func;
-	    if (@$upload_func($file['tmp_name'], $savefile)) {
-		$this->uploadeds++;
-		@chmod($savefile, 0777);
-		@unlink($file['tmp_name']);
-		$file['name'] = $this->safe_replace($file['name']);
-		$uploadedfile = array('filename' => $file['name'], 'filepath' => $filepath, 'filesize' => $file['size'], 'fileext' => $fileext);
-		$aids[] = $uploadedfile;
-	    }
-	}
-	return $aids;
+                return false;
+            }
+            $temp_filename = $this->getname($fileext);
+            $savefile = $this->savepath . $temp_filename;
+            $savefile = preg_replace("/(php|phtml|php3|php4|jsp|exe|dll|asp|cer|asa|shtml|shtm|aspx|asax|cgi|fcgi|pl)(\.|$)/i", "_\\1\\2", $savefile);
+            $filepath = preg_replace($this->new_addslashes("|^" . $this->upload_root . "|"), "", $savefile);
+            if (!$this->overwrite && file_exists($savefile))
+                continue;
+            $upload_func = $this->upload_func;
+            if (@$upload_func($file['tmp_name'], $savefile)) {
+                $this->uploadeds++;
+                @chmod($savefile, 0777);
+                @unlink($file['tmp_name']);
+                $file['name'] = $this->safe_replace($file['name']);
+                $uploadedfile = array('filename' => trim($file['name']), 'filepath' => $filepath, 'filesize' => $file['size'], 'fileext' => $fileext);
+                $aids[] = $uploadedfile;
+            }
+        }
+        return $aids;
     }
 
     /**
@@ -238,8 +243,9 @@ class attachment {
      * @param $filename 文件名
      * @return 扩展名
      */
-    function fileext2($filename) {
-	return strtolower(trim(substr(strrchr($filename, '.'), 1, 10)));
+    function fileext2($filename)
+    {
+        return strtolower(trim(substr(strrchr($filename, '.'), 1, 10)));
     }
 
     /**
@@ -248,20 +254,21 @@ class attachment {
      * @param $string
      * @return string
      */
-    function safe_replace($string) {
-	$string = str_replace('%20', '', $string);
-	$string = str_replace('%27', '', $string);
-	$string = str_replace('%2527', '', $string);
-	$string = str_replace('*', '', $string);
-	$string = str_replace('"', '&quot;', $string);
-	$string = str_replace("'", '', $string);
-	$string = str_replace('"', '', $string);
-	$string = str_replace(';', '', $string);
-	$string = str_replace('<', '&lt;', $string);
-	$string = str_replace('>', '&gt;', $string);
-	$string = str_replace("{", '', $string);
-	$string = str_replace('}', '', $string);
-	return $string;
+    function safe_replace($string)
+    {
+        $string = str_replace('%20', '', $string);
+        $string = str_replace('%27', '', $string);
+        $string = str_replace('%2527', '', $string);
+        $string = str_replace('*', '', $string);
+        $string = str_replace('"', '&quot;', $string);
+        $string = str_replace("'", '', $string);
+        $string = str_replace('"', '', $string);
+        $string = str_replace(';', '', $string);
+        $string = str_replace('<', '&lt;', $string);
+        $string = str_replace('>', '&gt;', $string);
+        $string = str_replace("{", '', $string);
+        $string = str_replace('}', '', $string);
+        return $string;
     }
 
     /**
@@ -269,12 +276,13 @@ class attachment {
      * @param $string 需要处理的字符串或数组
      * @return mixed
      */
-    function new_addslashes($string) {
-	if (!is_array($string))
-	    return addslashes($string);
-	foreach ($string as $key => $val)
-	    $string[$key] = new_addslashes($val);
-	return $string;
+    function new_addslashes($string)
+    {
+        if (!is_array($string))
+            return addslashes($string);
+        foreach ($string as $key => $val)
+            $string[$key] = new_addslashes($val);
+        return $string;
     }
 
     /**
@@ -283,28 +291,30 @@ class attachment {
      * @param $filename 文件名
      * @return 扩展名
      */
-    function fileext($filename) {
-	$pathinfo = pathinfo($filename);
+    function fileext($filename)
+    {
+        $pathinfo = pathinfo($filename);
 //	return strtolower(trim(substr(mb_strrchr($filename, '.'), 1, 10)));
-	return $pathinfo['extension'];
+        return $pathinfo['extension'];
     }
 
     /**
      * 创建目录
      *
-     * @param	string	$path	路径
-     * @param	string	$mode	属性
-     * @return	string	如果已经存在则返回true,否则为flase
+     * @param    string $path 路径
+     * @param    string $mode 属性
+     * @return    string    如果已经存在则返回true,否则为flase
      */
-    function dir_create($path, $mode = 0777) {
-	if (is_dir($path))
-	    return TRUE;
+    function dir_create($path, $mode = 0777)
+    {
+        if (is_dir($path))
+            return TRUE;
 //	$ftp_enable = 0;
-	$path = $this->dir_path($path);
-	$parent = dirname($path);
-	if (!is_dir($parent))
-	    @mkdir($parent, 0777, true);
-	@mkdir($path, 0777, true);
+        $path = $this->dir_path($path);
+        $parent = dirname($path);
+        if (!is_dir($parent))
+            @mkdir($parent, 0777, true);
+        @mkdir($path, 0777, true);
 //	$temp = explode('/', $path);
 //	$cur_dir = '';
 //	$max = count($temp) - 1;
@@ -318,20 +328,21 @@ class attachment {
 //	    @mkdir($cur_dir, 0777, true);
 //	    @chmod($cur_dir, 0777);
 //	}
-	return is_dir($path);
+        return is_dir($path);
     }
 
     /**
      * 转化 \ 为 /
      *
-     * @param	string	$path	路径
-     * @return	string	路径
+     * @param    string $path 路径
+     * @return    string    路径
      */
-    function dir_path($path) {
-	$path = str_replace('\\', '/', $path);
-	if (substr($path, -1) != '/')
-	    $path = $path . '/';
-	return $path;
+    function dir_path($path)
+    {
+        $path = str_replace('\\', '/', $path);
+        if (substr($path, -1) != '/')
+            $path = $path . '/';
+        return $path;
     }
 
     /**
@@ -344,225 +355,236 @@ class attachment {
      * @param $absurl 绝对路径
      * @param $basehref
      */
-    function download($field, $value, $watermark = '0', $ext = 'gif|jpg|jpeg|bmp|png', $absurl = '', $basehref = '') {
-	global $image_d;
-	$this->att_db = pc_base::load_model('attachment_model');
-	$upload_url = pc_base::load_config('system', 'upload_url');
-	$this->field = $field;
-	$dir = date('Y/md/');
-	$uploadpath = $upload_url . $dir;
-	$uploaddir = $this->upload_root . $dir;
-	$string = new_stripslashes($value);
-	if (!preg_match_all("/(href|src)=([\"|']?)([^ \"'>]+\.($ext))\\2/i", $string, $matches))
-	    return $value;
-	$remotefileurls = array();
-	foreach ($matches[3] as $matche) {
-	    if (strpos($matche, '://') === false)
-		continue;
-	    dir_create($uploaddir);
-	    $remotefileurls[$matche] = $this->fillurl($matche, $absurl, $basehref);
-	}
-	unset($matches, $string);
-	$remotefileurls = array_unique($remotefileurls);
-	$oldpath = $newpath = array();
-	foreach ($remotefileurls as $k => $file) {
-	    if (strpos($file, '://') === false || strpos($file, $upload_url) !== false)
-		continue;
-	    $filename = fileext($file);
-	    $file_name = basename($file);
-	    $filename = $this->getname($filename);
-
-	    $newfile = $uploaddir . $filename;
-	    $upload_func = $this->upload_func;
-	    if ($upload_func($file, $newfile)) {
-		$oldpath[] = $k;
-		$GLOBALS['downloadfiles'][] = $newpath[] = $uploadpath . $filename;
-		@chmod($newfile, 0777);
-		$fileext = fileext($filename);
-		if ($watermark) {
-		    watermark($newfile, $newfile, $this->siteid);
-		}
-		$filepath = $dir . $filename;
-		$downloadedfile = array('filename' => $filename, 'filepath' => $filepath, 'filesize' => filesize($newfile), 'fileext' => $fileext);
-		$aid = $this->add($downloadedfile);
-		$this->downloadedfiles[$aid] = $filepath;
-	    }
-	}
-	return str_replace($oldpath, $newpath, $value);
+    function download($field, $value, $watermark = '0', $ext = 'gif|jpg|jpeg|bmp|png', $absurl = '', $basehref = '')
+    {
+        global $image_d;
+        $this->att_db = pc_base::load_model('attachment_model');
+        $upload_url = pc_base::load_config('system', 'upload_url');
+        $this->field = $field;
+        $dir = date('Y/md/');
+        $uploadpath = $upload_url . $dir;
+        $uploaddir = $this->upload_root . $dir;
+        $string = new_stripslashes($value);
+        if (!preg_match_all("/(href|src)=([\"|']?)([^ \"'>]+\.($ext))\\2/i", $string, $matches))
+            return $value;
+        $remotefileurls = array();
+        foreach ($matches[3] as $matche) {
+            if (strpos($matche, '://') === false)
+                continue;
+            dir_create($uploaddir);
+            $remotefileurls[$matche] = $this->fillurl($matche, $absurl, $basehref);
+        }
+        unset($matches, $string);
+        $remotefileurls = array_unique($remotefileurls);
+        $oldpath = $newpath = array();
+        foreach ($remotefileurls as $k => $file) {
+            if (strpos($file, '://') === false || strpos($file, $upload_url) !== false)
+                continue;
+            $filename = fileext($file);
+            $file_name = basename($file);
+            $filename = $this->getname($filename);
+
+            $newfile = $uploaddir . $filename;
+            $upload_func = $this->upload_func;
+            if ($upload_func($file, $newfile)) {
+                $oldpath[] = $k;
+                $GLOBALS['downloadfiles'][] = $newpath[] = $uploadpath . $filename;
+                @chmod($newfile, 0777);
+                $fileext = fileext($filename);
+                if ($watermark) {
+                    watermark($newfile, $newfile, $this->siteid);
+                }
+                $filepath = $dir . $filename;
+                $downloadedfile = array('filename' => $filename, 'filepath' => $filepath, 'filesize' => filesize($newfile), 'fileext' => $fileext);
+                $aid = $this->add($downloadedfile);
+                $this->downloadedfiles[$aid] = $filepath;
+            }
+        }
+        return str_replace($oldpath, $newpath, $value);
     }
 
     /**
      * 附件删除方法
      * @param $where 删除sql语句
      */
-    function delete($where) {
-	$this->att_db = pc_base::load_model('attachment_model');
-	$result = $this->att_db->select($where);
-	foreach ($result as $r) {
-	    $image = $this->upload_root . $r['filepath'];
-	    @unlink($image);
-	    $thumbs = glob(dirname($image) . '/*' . basename($image));
-	    if ($thumbs)
-		foreach ($thumbs as $thumb)
-		    @unlink($thumb);
-	}
-	return $this->att_db->delete($where);
+    function delete($where)
+    {
+        $this->att_db = pc_base::load_model('attachment_model');
+        $result = $this->att_db->select($where);
+        foreach ($result as $r) {
+            $image = $this->upload_root . $r['filepath'];
+            @unlink($image);
+            $thumbs = glob(dirname($image) . '/*' . basename($image));
+            if ($thumbs)
+                foreach ($thumbs as $thumb)
+                    @unlink($thumb);
+        }
+        return $this->att_db->delete($where);
     }
 
     /**
      * 附件添加如数据库
      * @param $uploadedfile 附件信息
      */
-    function add($Arrupfileinfo) {
-	Doo::loadModel('attachment');
-	$attaobj = new AttachmentModel();
-	$aid = $attaobj->add_attachment($Arrupfileinfo);
-	return $aid;
+    function add($Arrupfileinfo)
+    {
+        Doo::loadModel('attachment');
+        $attaobj = new AttachmentModel();
+        $aid = $attaobj->add_attachment($Arrupfileinfo);
+        return $aid;
     }
 
-    function set_userid($userid) {
-	$this->userid = $userid;
+    function set_userid($userid)
+    {
+        $this->userid = $userid;
     }
 
     /**
      * 获取缩略图地址..
      * @param $image 图片路径
      */
-    function get_thumb($image) {
-	return str_replace('.', '_thumb.', $image);
+    function get_thumb($image)
+    {
+        return str_replace('.', '_thumb.', $image);
     }
 
     /**
      * 获取附件名称
      * @param $fileext 附件扩展名
      */
-    function getname($fileext) {
-	return date('Ymdhis') . rand(100, 999) . '.' . $fileext;
+    function getname($fileext)
+    {
+        return date('Ymdhis') . rand(100, 999) . '.' . $fileext;
     }
 
     /**
      * 返回附件大小
      * @param $filesize 图片大小
      */
-    function size($filesize) {
-	if ($filesize >= 1073741824) {
-	    $filesize = round($filesize / 1073741824 * 100) / 100 . ' GB';
-	} elseif ($filesize >= 1048576) {
-	    $filesize = round($filesize / 1048576 * 100) / 100 . ' MB';
-	} elseif ($filesize >= 1024) {
-	    $filesize = round($filesize / 1024 * 100) / 100 . ' KB';
-	} else {
-	    $filesize = $filesize . ' Bytes';
-	}
-	return $filesize;
+    function size($filesize)
+    {
+        if ($filesize >= 1073741824) {
+            $filesize = round($filesize / 1073741824 * 100) / 100 . ' GB';
+        } elseif ($filesize >= 1048576) {
+            $filesize = round($filesize / 1048576 * 100) / 100 . ' MB';
+        } elseif ($filesize >= 1024) {
+            $filesize = round($filesize / 1024 * 100) / 100 . ' KB';
+        } else {
+            $filesize = $filesize . ' Bytes';
+        }
+        return $filesize;
     }
 
     /**
      * 判断文件是否是通过 HTTP POST 上传的
      *
-     * @param	string	$file	文件地址
-     * @return	bool	所给出的文件是通过 HTTP POST 上传的则返回 TRUE
+     * @param    string $file 文件地址
+     * @return    bool    所给出的文件是通过 HTTP POST 上传的则返回 TRUE
      */
-    function isuploadedfile($file) {
-	return is_uploaded_file($file) || is_uploaded_file(str_replace('\\\\', '\\', $file));
+    function isuploadedfile($file)
+    {
+        return is_uploaded_file($file) || is_uploaded_file(str_replace('\\\\', '\\', $file));
     }
 
     /**
      * 补全网址
      *
-     * @param	string	$surl		源地址
-     * @param	string	$absurl		相对地址
-     * @param	string	$basehref	网址
-     * @return	string	网址
+     * @param    string $surl 源地址
+     * @param    string $absurl 相对地址
+     * @param    string $basehref 网址
+     * @return    string    网址
      */
-    function fillurl($surl, $absurl, $basehref = '') {
-	if ($basehref != '') {
-	    $preurl = strtolower(substr($surl, 0, 6));
-	    if ($preurl == 'http://' || $preurl == 'ftp://' || $preurl == 'mms://' || $preurl == 'rtsp://' || $preurl == 'thunde' || $preurl == 'emule://' || $preurl == 'ed2k://')
-		return $surl;
-	    else
-		return $basehref . '/' . $surl;
-	}
-	$i = 0;
-	$dstr = '';
-	$pstr = '';
-	$okurl = '';
-	$pathStep = 0;
-	$surl = trim($surl);
-	if ($surl == '')
-	    return '';
-	$urls = @parse_url(SITE_URL);
-	$HomeUrl = $urls['host'];
-	$BaseUrlPath = $HomeUrl . $urls['path'];
-	$BaseUrlPath = preg_replace("/\/([^\/]*)\.(.*)$/", '/', $BaseUrlPath);
-	$BaseUrlPath = preg_replace("/\/$/", '', $BaseUrlPath);
-	$pos = strpos($surl, '#');
-	if ($pos > 0)
-	    $surl = substr($surl, 0, $pos);
-	if ($surl[0] == '/') {
-	    $okurl = 'http://' . $HomeUrl . '/' . $surl;
-	} elseif ($surl[0] == '.') {
-	    if (strlen($surl) <= 2)
-		return '';
-	    elseif ($surl[0] == '/') {
-		$okurl = 'http://' . $BaseUrlPath . '/' . substr($surl, 2, strlen($surl) - 2);
-	    } else {
-		$urls = explode('/', $surl);
-		foreach ($urls as $u) {
-		    if ($u == "..")
-			$pathStep++;
-		    else if ($i < count($urls) - 1)
-			$dstr .= $urls[$i] . '/';
-		    else
-			$dstr .= $urls[$i];
-		    $i++;
-		}
-		$urls = explode('/', $BaseUrlPath);
-		if (count($urls) <= $pathStep)
-		    return '';
-		else {
-		    $pstr = 'http://';
-		    for ($i = 0; $i < count($urls) - $pathStep; $i++) {
-			$pstr .= $urls[$i] . '/';
-		    }
-		    $okurl = $pstr . $dstr;
-		}
-	    }
-	} else {
-	    $preurl = strtolower(substr($surl, 0, 6));
-	    if (strlen($surl) < 7)
-		$okurl = 'http://' . $BaseUrlPath . '/' . $surl;
-	    elseif ($preurl == "http:/" || $preurl == 'ftp://' || $preurl == 'mms://' || $preurl == "rtsp://" || $preurl == 'thunde' || $preurl == 'emule:' || $preurl == 'ed2k:/')
-		$okurl = $surl;
-	    else
-		$okurl = 'http://' . $BaseUrlPath . '/' . $surl;
-	}
-	$preurl = strtolower(substr($okurl, 0, 6));
-	if ($preurl == 'ftp://' || $preurl == 'mms://' || $preurl == 'rtsp://' || $preurl == 'thunde' || $preurl == 'emule:' || $preurl == 'ed2k:/') {
-	    return $okurl;
-	} else {
-	    $okurl = preg_replace('/^(http:\/\/)/i', '', $okurl);
-	    $okurl = preg_replace('/\/{1,}/i', '/', $okurl);
-	    return 'http://' . $okurl;
-	}
+    function fillurl($surl, $absurl, $basehref = '')
+    {
+        if ($basehref != '') {
+            $preurl = strtolower(substr($surl, 0, 6));
+            if ($preurl == 'http://' || $preurl == 'ftp://' || $preurl == 'mms://' || $preurl == 'rtsp://' || $preurl == 'thunde' || $preurl == 'emule://' || $preurl == 'ed2k://')
+                return $surl;
+            else
+                return $basehref . '/' . $surl;
+        }
+        $i = 0;
+        $dstr = '';
+        $pstr = '';
+        $okurl = '';
+        $pathStep = 0;
+        $surl = trim($surl);
+        if ($surl == '')
+            return '';
+        $urls = @parse_url(SITE_URL);
+        $HomeUrl = $urls['host'];
+        $BaseUrlPath = $HomeUrl . $urls['path'];
+        $BaseUrlPath = preg_replace("/\/([^\/]*)\.(.*)$/", '/', $BaseUrlPath);
+        $BaseUrlPath = preg_replace("/\/$/", '', $BaseUrlPath);
+        $pos = strpos($surl, '#');
+        if ($pos > 0)
+            $surl = substr($surl, 0, $pos);
+        if ($surl[0] == '/') {
+            $okurl = 'http://' . $HomeUrl . '/' . $surl;
+        } elseif ($surl[0] == '.') {
+            if (strlen($surl) <= 2)
+                return '';
+            elseif ($surl[0] == '/') {
+                $okurl = 'http://' . $BaseUrlPath . '/' . substr($surl, 2, strlen($surl) - 2);
+            } else {
+                $urls = explode('/', $surl);
+                foreach ($urls as $u) {
+                    if ($u == "..")
+                        $pathStep++;
+                    else if ($i < count($urls) - 1)
+                        $dstr .= $urls[$i] . '/';
+                    else
+                        $dstr .= $urls[$i];
+                    $i++;
+                }
+                $urls = explode('/', $BaseUrlPath);
+                if (count($urls) <= $pathStep)
+                    return '';
+                else {
+                    $pstr = 'http://';
+                    for ($i = 0; $i < count($urls) - $pathStep; $i++) {
+                        $pstr .= $urls[$i] . '/';
+                    }
+                    $okurl = $pstr . $dstr;
+                }
+            }
+        } else {
+            $preurl = strtolower(substr($surl, 0, 6));
+            if (strlen($surl) < 7)
+                $okurl = 'http://' . $BaseUrlPath . '/' . $surl;
+            elseif ($preurl == "http:/" || $preurl == 'ftp://' || $preurl == 'mms://' || $preurl == "rtsp://" || $preurl == 'thunde' || $preurl == 'emule:' || $preurl == 'ed2k:/')
+                $okurl = $surl;
+            else
+                $okurl = 'http://' . $BaseUrlPath . '/' . $surl;
+        }
+        $preurl = strtolower(substr($okurl, 0, 6));
+        if ($preurl == 'ftp://' || $preurl == 'mms://' || $preurl == 'rtsp://' || $preurl == 'thunde' || $preurl == 'emule:' || $preurl == 'ed2k:/') {
+            return $okurl;
+        } else {
+            $okurl = preg_replace('/^(http:\/\/)/i', '', $okurl);
+            $okurl = preg_replace('/\/{1,}/i', '/', $okurl);
+            return 'http://' . $okurl;
+        }
     }
 
     /**
      * 是否允许上传
      */
-    function is_allow_upload() {
-	if ($_groupid == 1)
-	    return true;
-	$starttime = SYS_TIME - 86400;
-	$site_setting = $this->_get_site_setting($this->siteid);
-	return ($uploads < $site_setting['upload_maxsize']);
+    function is_allow_upload()
+    {
+        if ($_groupid == 1)
+            return true;
+        $starttime = SYS_TIME - 86400;
+        $site_setting = $this->_get_site_setting($this->siteid);
+        return ($uploads < $site_setting['upload_maxsize']);
     }
 
     /**
      * 返回错误信息
      */
-    function error() {
-	return $this->error;
+    function error()
+    {
+        return $this->error;
     }
 
     /**
@@ -571,42 +593,46 @@ class attachment {
      * @param $fileurl 路径
      * @param $message 显示信息
      */
-    function mkhtml($fn, $fileurl, $message) {
-	$str = '<script type="text/javascript">window.parent.CKEDITOR.tools.callFunction(' . $fn . ', \'' . $fileurl . '\', \'' . $message . '\');</script>';
-	exit($str);
+    function mkhtml($fn, $fileurl, $message)
+    {
+        $str = '<script type="text/javascript">window.parent.CKEDITOR.tools.callFunction(' . $fn . ', \'' . $fileurl . '\', \'' . $message . '\');</script>';
+        exit($str);
     }
 
     /**
      * flash上传调试方法
      * @param $id
      */
-    function uploaderror($id = 0) {
-	file_put_contents(PHPCMS_PATH . 'xxx.txt', $id);
+    function uploaderror($id = 0)
+    {
+        file_put_contents(PHPCMS_PATH . 'xxx.txt', $id);
     }
 
     /**
      * 获取站点配置信息
      * @param  $siteid 站点id
      */
-    private function _get_site_setting($siteid) {
-	$siteinfo = getcache('sitelist', 'commons');
-	return string2array($siteinfo[$siteid]['setting']);
+    private function _get_site_setting($siteid)
+    {
+        $siteinfo = getcache('sitelist', 'commons');
+        return string2array($siteinfo[$siteid]['setting']);
     }
 
     /**
      * Get client's IP
      * @return string
      */
-    public function clientIP() {
-	if (getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'), 'unknown')) {
-	    return getenv('HTTP_CLIENT_IP');
-	} elseif (getenv('HTTP_X_FORWARDED_FOR') && strcasecmp(getenv('HTTP_X_FORWARDED_FOR'), 'unknown')) {
-	    return getenv('HTTP_X_FORWARDED_FOR');
-	} elseif (getenv('REMOTE_ADDR') && strcasecmp(getenv('REMOTE_ADDR'), 'unknown')) {
-	    return getenv('REMOTE_ADDR');
-	} elseif (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], 'unknown')) {
-	    return $_SERVER['REMOTE_ADDR'];
-	}
+    public function clientIP()
+    {
+        if (getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'), 'unknown')) {
+            return getenv('HTTP_CLIENT_IP');
+        } elseif (getenv('HTTP_X_FORWARDED_FOR') && strcasecmp(getenv('HTTP_X_FORWARDED_FOR'), 'unknown')) {
+            return getenv('HTTP_X_FORWARDED_FOR');
+        } elseif (getenv('REMOTE_ADDR') && strcasecmp(getenv('REMOTE_ADDR'), 'unknown')) {
+            return getenv('REMOTE_ADDR');
+        } elseif (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], 'unknown')) {
+            return $_SERVER['REMOTE_ADDR'];
+        }
     }
 
 }

+ 14 - 0
protected/class/auth.php

@@ -67,6 +67,20 @@ class Auth
         return $_SESSION['uid'] = $uid;
     }
 
+    public function setVerifyMobile($array = array('mobile' => 0, 'code' => 0))
+    {
+        $_SESSION['verifymobile'] = $array;
+    }
+
+    public function getVerifyMobile()
+    {
+        if (isset($_SESSION['verifymobile']) && $_SESSION['verifymobile']) {
+            return $_SESSION['verifymobile'];
+        } else {
+            return FALSE;
+        }
+    }
+
     public function setUemail($uemail)
     {
         return $_SESSION['uemail'] = $uemail;

+ 29 - 23
protected/class/itemfile.php

@@ -2,39 +2,45 @@
 
 Doo::loadModel('itematt');
 
-class ItemFile {
+class ItemFile
+{
 
     private $__itemfile;
 
-    function __construct() {
-	$this->__itemfile = new ItemAtt();
+    function __construct()
+    {
+        $this->__itemfile = new ItemAtt();
     }
 
-    public function insertItemFileRecord($postArray) {
-	$this->__itemfile->mpid = $postArray['mpid'];
-	$this->__itemfile->ownerid = $postArray['ownerid'];
-	$this->__itemfile->itemid = $postArray['itemid'];
-	$this->__itemfile->filename = $postArray['filename'];
-	$this->__itemfile->fileext = $postArray['fileext'];
-	$this->__itemfile->filesize = $postArray['filesize'];
-	$this->__itemfile->filepath = $postArray['filepath'];
-	$this->__itemfile->categoryid = $postArray['categoryid'];
-	if (isset($postArray['tips']))
-	    $this->__itemfile->tips = $postArray['tips'];
-	$this->__itemfile->intime = time();
-	return $this->__itemfile->insert();
+    public function insertItemFileRecord($postArray)
+    {
+        $this->__itemfile->ownerid = $postArray['ownerid'];
+        $this->__itemfile->pid = $postArray['pid'];
+        $this->__itemfile->pmid = $postArray['pmid'];
+        $this->__itemfile->filename = $postArray['filename'];
+        $this->__itemfile->fileext = $postArray['fileext'];
+        $this->__itemfile->filesize = $postArray['filesize'];
+        $this->__itemfile->filepath = $postArray['filepath'];
+        $this->__itemfile->intime = time();
+        return $this->__itemfile->insert();
     }
 
-    public function getItemFileList($tenderid) {
-	return $tenderid ? $this->__itemfile->find(array('where' => 'mpid=?', 'desc' => 'intime', 'param' => array($tenderid), 'asArray' => TRUE)) : FALSE;
+    public function getItemFile($iaid)
+    {
+        return $iaid ? $this->__itemfile->getOne(array('where' => 'iaid=?', 'param' => array($iaid), 'asArray' => TRUE)) : FALSE;
     }
 
-    public function updateItemFields($id, $fname, $tips) {
-	$this->__itemfile->filename = iconv('GBK', 'UTF-8', $fname);
-	$this->__itemfile->tips = iconv('GBK', 'UTF-8', $tips);
-	return $this->__itemfile->update(array('where' => 'iaid=?', 'param' => array($id)));
+    public function getFilesAll($pmid)
+    {
+        return $pmid ? $this->__itemfile->find(array('where' => 'pmid=?', 'param' => array($pmid), 'asArray' => TRUE)) : FALSE;
+    }
+
+    public function updateItemFields($id, $fname)
+    {
+        $this->__itemfile->filename = iconv('GBK', 'UTF-8', $fname);
+        return $this->__itemfile->update(array('where' => 'iaid=?', 'param' => array($id)));
     }
 
 }
 
-?>
+?>

+ 51 - 0
protected/class/itemmeasurenum.php

@@ -0,0 +1,51 @@
+<?php
+
+Doo::loadModel('itemmnum');
+
+class ItemMeasureNumpofper
+{
+
+    private $__itemMeasureNum;
+
+    function __construct()
+    {
+        $this->__itemMeasureNum = new ItemMeasureNumofper();
+    }
+
+    public function insert($postArray)
+    {
+        $this->__itemMeasureNum->iaid = $postArray['iaid'];
+        $this->__itemMeasureNum->ownerid = $postArray['ownerid'];
+        $this->__itemMeasureNum->softwareitemid = $postArray['itemid'];
+        $this->__itemMeasureNum->pid = $postArray['pid'];
+        $this->__itemMeasureNum->pmid = $postArray['pmid'];
+        $this->__itemMeasureNum->isdel = 0;
+        $this->__itemMeasureNum->deltime = 0;
+        $this->__itemMeasureNum->categoryid = $postArray['categoryid'];
+        $this->__itemMeasureNum->tips = $postArray['tips'];
+        $this->__itemMeasureNum->numpname = $postArray['numpname'];
+        $this->__itemMeasureNum->intime = time();
+        return $this->__itemMeasureNum->insert();
+    }
+
+    public function getItemMeasureNum($tenderid)
+    {
+        return $this->__itemMeasureNum->find(array('where' => 'pmid=?', 'param' => array($tenderid), 'asArray' => TRUE));
+    }
+
+    public function getRowData($imnid)
+    {
+        return $this->__itemMeasureNum->getOne(array('where' => 'imnid=?', 'param' => array($imnid), 'asArray' => TRUE));
+    }
+
+    public function updateItemFields($id, $tips)
+    {
+        $this->__itemMeasureNum->tips = iconv('GBK', 'UTF-8', $tips);
+        return $this->__itemMeasureNum->update(array('where' => 'imnid=?', 'param' => array($id)));
+    }
+
+    public function delItemFields($imnid)
+    {
+        return $this->__itemMeasureNum->delete(array('where' => 'imnid=?', 'param' => array($imnid)));
+    }
+}

+ 58 - 34
protected/class/profile.php

@@ -2,53 +2,77 @@
 
 Doo::loadModel('uprofile');
 
-class Profile {
+class Profile
+{
 
     private $uprofile;
 
-    public function __construct() {
-	$this->uprofile = new Uprofile();
+    public function __construct()
+    {
+        $this->uprofile = new Uprofile();
     }
 
-    public function insertProfile($intp = array()) {
-	if (!isset($intp['userid']))
-	    return FALSE;
-	$this->uprofile->userid = filter_var($intp['userid'], FILTER_VALIDATE_INT);
-	$this->uprofile->name = filter_var($intp['realname'], FILTER_SANITIZE_STRING);
-	$this->uprofile->company = filter_var($intp['company'], FILTER_SANITIZE_STRING);
-	$this->uprofile->jobs = filter_var($intp['jobs'], FILTER_SANITIZE_STRING);
-	$this->uprofile->phone = filter_var($intp['phone'], FILTER_SANITIZE_STRING);
-	$this->uprofile->mobile = filter_var($intp['mobile'], FILTER_SANITIZE_STRING);
-	if (isset($intp['qq']))
-	    $this->uprofile->qq = filter_var($intp['qq'], FILTER_SANITIZE_STRING);
-	$this->uprofile->groups = 'vip';
-	return $this->uprofile->insert();
+    public function insertProfile($intp = array())
+    {
+        if (!isset($intp['userid']))
+            return FALSE;
+        $this->uprofile->userid = filter_var($intp['userid'], FILTER_VALIDATE_INT);
+        $this->uprofile->name = filter_var($intp['realname'], FILTER_SANITIZE_STRING);
+        $this->uprofile->company = filter_var($intp['company'], FILTER_SANITIZE_STRING);
+        $this->uprofile->jobs = filter_var($intp['jobs'], FILTER_SANITIZE_STRING);
+        $this->uprofile->phone = filter_var($intp['phone'], FILTER_SANITIZE_STRING);
+        $this->uprofile->mobile = filter_var($intp['mobile'], FILTER_SANITIZE_STRING);
+        if (isset($intp['qq']))
+            $this->uprofile->qq = filter_var($intp['qq'], FILTER_SANITIZE_STRING);
+        $this->uprofile->groups = 'vip';
+        return $this->uprofile->insert();
     }
 
-    public function getProWithUid($userid = 0) {
-	if (!isset($userid))
-	    return FALSE;
-	return $this->uprofile->getOne(array('where' => 'userid=?', 'param' => array($userid), 'asArray' => TRUE));
+    public function getProWithUid($userid = 0)
+    {
+        if (!isset($userid))
+            return FALSE;
+        return $this->uprofile->getOne(array('where' => 'userid=?', 'param' => array($userid), 'asArray' => TRUE));
     }
 
-    public function setAvatar($userid = 0, $avaurl) {
-	if (!isset($userid))
-	    return FALSE;
-	$this->uprofile->avatar = $avaurl;
-	return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
+    public function getVerifiedMobile($userid = 0)
+    {
+        if (!isset($userid))
+            return FALSE;
+        return $this->uprofile->getOne(array('where' => 'userid=? and isnotice=1', 'param' => array($userid), 'asArray' => TRUE));
     }
 
-    public function upProfile($userid, $proArray) {
-	$this->uprofile->name = $proArray['name'];
-	$this->uprofile->company = $proArray['company'];
-	$this->uprofile->jobs = $proArray['jobs'];
-	$this->uprofile->phone = $proArray['phone'];
-	$this->uprofile->mobile = $proArray['mobile'];
-	if (isset($proArray['qq']) && $proArray['qq'])
-	    $this->uprofile->qq = $proArray['qq'];
-	return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
+    public function setAvatar($userid = 0, $avaurl)
+    {
+        if (!isset($userid))
+            return FALSE;
+        $this->uprofile->avatar = $avaurl;
+        return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
     }
 
+    public function upProfile($userid, $proArray)
+    {
+        $this->uprofile->name = $proArray['name'];
+        $this->uprofile->company = $proArray['company'];
+        $this->uprofile->jobs = $proArray['jobs'];
+        $this->uprofile->phone = $proArray['phone'];
+        $this->uprofile->mobile = $proArray['mobile'];
+        if (isset($proArray['qq']) && $proArray['qq'])
+            $this->uprofile->qq = $proArray['qq'];
+        return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
+    }
+
+    public function updateMobile($userid, $mobile)
+    {
+        $this->uprofile->mobile = $mobile;
+        $this->uprofile->isnotice = 1;
+        return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
+    }
+
+    public function checkMobile($number)
+    {
+        return $this->uprofile->count(array('where' => 'mobile=?', 'param' => array($number), 'asArray' => TRUE));
+    }
 }
 
 ?>

+ 83 - 0
protected/class/sms.php

@@ -0,0 +1,83 @@
+<?php
+
+class Sms
+{
+    private $api_url, $auth_key, $errorMsg;
+
+    function __construct($api_url, $auth_key)
+    {
+        $this->api_url = $api_url;
+        $this->auth_key = $auth_key;
+    }
+
+    /**
+     * 实现短信验证码接口
+     *
+     */
+    public function sendSms($mobile, $code)
+    {
+        $send = array(
+            'apikey' => $this->auth_key,
+            'mobile' => $mobile,
+            'text' => $code
+        );
+        $data = http_build_query($send);
+        $res = json_decode($this->_httpClient($this->api_url, $data));
+        $resArr = $this->objectToArray($res);
+        if (!empty($resArr) && $resArr["code"] == 0) {
+            return true;
+        } else {
+            if (empty($this->errorMsg)) $this->errorMsg = isset($resArr["msg"]) ? $resArr["msg"] : '未知错误';
+            return false;
+        }
+    }
+
+    //对象转数组,使用get_object_vars返回对象属性组成的数组
+    function objectToArray($array)
+    {
+        if (is_object($array)) {
+            $array = (array)$array;
+        }
+        if (is_array($array)) {
+            foreach ($array as $key => $value) {
+                $array[$key] = $this->objectToArray($value);
+            }
+        }
+        return $array;
+    }
+
+    /**
+     * POST方式访问短信接口
+     * @param string $data
+     * @return mixed
+     */
+    private function _httpClient($api_url, $data)
+    {
+        try {
+            $ch = curl_init();
+            curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept:text/plain;charset=utf-8', 'Content-Type:application/x-www-form-urlencoded', 'charset=utf-8'));
+            curl_setopt($ch, CURLOPT_URL, $api_url);
+            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+            curl_setopt($ch, CURLOPT_POST, 1);
+            curl_setopt($ch, CURLOPT_TIMEOUT, 10);
+            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+            curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
+            $res = curl_exec($ch);
+            curl_close($ch);
+            return $res;
+        } catch (Exception $e) {
+            $this->errorMsg = $e->getMessage();
+            return false;
+        }
+    }
+
+    /**
+     * POST方式访问短信接口
+     * @param string $data
+     * @return mixed
+     */
+    public function getErrors()
+    {
+        return $this->errorMsg;
+    }
+}

+ 18 - 0
protected/config/routes.conf.php

@@ -15,6 +15,8 @@ $route['*']['/project/:pmid/measure'] = array('ProjectController', 'proMeasure')
 $route['*']['/project/section/get'] = array('ProjectController', 'getAjaxSection');
 $route['*']['/project/:pid/section/:mpid/measure'] = array('ProjectController', 'proSectionMeasure');
 $route['*']['/project/:pid/section/:pmid/detail'] = array('ProjectController', 'proDetail');
+$route['*']['/project/:pid/section/:pmid/files'] = array('ProjectController', 'proSectionFiles');
+$route['*']['/project/:pid/section/:pmid/files/recover'] = array('ProjectController', 'proSectionFilesRecover');
 // R
 $route['*']['/rproject/index'] = array('RProjectController', 'index');
 $route['*']['/rproject/:pid/section'] = array('RProjectController', 'proSection');
@@ -22,6 +24,8 @@ $route['*']['/rproject/:pid/section/:mpid/measure'] = array('RProjectController'
 $route['*']['/rproject/:pid/section/:pmid/detail'] = array('RProjectController', 'proDetail');
 $route['*']['/rproject/:pmid/measure/detail'] = array('RProjectController', 'proMeasure');
 $route['*']['/rproject/:pid/section/:pmid/report/:mpid'] = array('RProjectController', 'proReport');
+$route['*']['/rproject/:pid/section/:pmid/files/:mpid'] = array('RProjectController', 'proSectionFiles');
+$route['*']['/rproject/section/get/:iaid/attachment'] = array('RProjectController', 'proSectionGetFiles');
 // S
 $route['get']['/sproject/index'] = array('SProjectController', 'index');
 $route['get']['/sproject/:pid/section'] = array('SProjectController', 'proSection');
@@ -29,6 +33,10 @@ $route['get']['/sproject/:pid/section/:pmid/detail'] = array('SProjectController
 $route['get']['/sproject/:pid/section/measure'] = array('SProjectController', 'proMeasure');
 // 登入登出API
 $route['*']['/user/profile'] = array('UserController', 'index');
+$route['*']['/user/profile/sms'] = array('UserController', 'sms');
+$route['*']['/user/profile/sms/edit'] = array('UserController', 'smsEdit');
+$route['*']['/user/profile/check/mobile'] = array('UserController', 'checkMobile');
+$route['*']['/user/profile/sms/send/verify'] = array('UserController', 'smsSend');
 $route['*']['/user/avatar'] = array('UserController', 'avatar');
 $route['*']['/user/repasswd'] = array('UserController', 'repasswd');
 // Client API
@@ -128,6 +136,14 @@ $route['*']['/api/client/tender/attachment/:tenderid/list'] = array('ClientContr
  */
 $route['*']['/api/client/tender/attachment/info/:fileid/update'] = array('ClientController', 'updateItemFileDesc');
 /**
+ * 根据关联列表ID删除附件关联关系
+ */
+$route['*']['/api/client/tender/attachment/:fileid/del'] = array('ClientController', 'delItemFile');
+/**
+ * 根据标段ID获取全部附件列表
+ */
+$route['*']['/api/client/tender/attachment/get/:tenderid/files/all'] = array('ClientController', 'getAttaFilesAll');
+/**
  * 根据标段ID和期数获取审核意见
  */
 $route['*']['/api/client/tender/get/:tenderid/:phaseno/auditopinion'] = array('ClientController', 'getAuditOpinion');
@@ -151,6 +167,7 @@ $route['*']['/manage/item/list/:pid/project'] = array('[admin]ItemController', '
 $route['*']['/manage/item/del/:pmid'] = array('[admin]ItemController', 'itemDel');
 $route['*']['/manage/restore/list'] = array('[admin]RestoreController', 'restoreList');
 $route['*']['/manage/sys/info'] = array('[admin]SysController', 'sysinfo');
+$route['*']['/manage/sys/sms/switch'] = array('[admin]SysController', 'smsSwitch');
 // upgrade
 $route['*']['/api/upgrade/v1/get/web/version'] = array('UpgradeController', 'getWebVersion');
 $route['*']['/api/upgrade/v1/get/software/version'] = array('UpgradeController', 'getSoftwareVersion');
@@ -158,4 +175,5 @@ $route['*']['/api/upgrade/v1/get/switch/status'] = array('UpgradeController', 'g
 $route['*']['/api/upgrade/v1/set/switch/:onoff'] = array('UpgradeController', 'setSwitchStatus');
 $route['*']['/api/upgrade/v1/set/upgrade/info'] = array('UpgradeController', 'setUpgradeInfo');
 $route['*']['/api/upgrade/v1/get/version/status'] = array('UpgradeController', 'getVersionAndStatus');
+
 ?>

+ 5 - 0
protected/config/sms.conf.php

@@ -0,0 +1,5 @@
+<?php
+$config['SMS_URL'] = 'http://sms.haotingyun.com/v2/sms/single_send.json';
+$config['SMS_AUTHKEY'] = 'fb5ef483e44b9556512a9febef376051';
+$config['SMS_TIPS_PRE'] = '【纵横计量支付】';
+$config['SMS_TIPS'] = array('AUDIT_NOTICE' => $config['SMS_TIPS_PRE'] . '验证码:', 'END_MSG' => ',15分钟内有效。', 'AUDIT_NOTICE_AUDITOR' => ',已审批通过。请您继续审批。', 'AUDIT_NOTICE_AUDITOR2' => ',需要您继续审批。');

+ 1 - 1
protected/config/ver.conf.php

@@ -1,5 +1,5 @@
 <?php
 
 // Version
-$config['ver'] = 'v1.4.0';
+$config['ver'] = 'v1.5.0';
 

+ 149 - 36
protected/controller/ClientController.php

@@ -14,7 +14,13 @@ Doo::loadClass('numofperact');
 Doo::loadClass('measureauditact');
 Doo::loadClass('itemfile');
 Doo::loadModel('users');
+<<<<<<< HEAD
 Doo::loadModelAt('aconfig', 'admin');
+=======
+Doo::loadClass('itemmeasurenum');
+Doo::loadModelAt('aconfig', 'admin');
+Doo::loadClass('sms');
+>>>>>>> feature/附件功能完善
 
 /**
  * MainController
@@ -25,7 +31,11 @@ Doo::loadModelAt('aconfig', 'admin');
 class ClientController extends DooController
 {
 
+<<<<<<< HEAD
     private $data, $client, $auth, $att, $file, $zip, $actmeasure, $contractact, $project, $profile, $numofperact, $measureauditact, $attfile, $users, $itemfile, $modelconfig;
+=======
+    private $data, $client, $auth, $att, $file, $zip, $actmeasure, $contractact, $project, $profile, $numofperact, $measureauditact, $attfile, $users, $itemfile, $aconfig, $sms, $itemMeasureNum;
+>>>>>>> feature/附件功能完善
     private $statusArray = array('uncheck' => '1', 'checking' => '2', 'checked' => '3', 'checkno' => '4');
     private $fileTypeArray = array('台帐附件');
 
@@ -45,7 +55,13 @@ class ClientController extends DooController
         $this->measureauditact = new MeasureauditAct();
         $this->users = new Users();
         $this->itemfile = new ItemFile();
+<<<<<<< HEAD
         $this->modelconfig = new AConfig();
+=======
+        $this->itemMeasureNum = new ItemMeasureNumpofper();
+        $this->aconfig = new AConfig();
+        $this->sms = new Sms(Doo::conf()->SMS_URL, Doo::conf()->SMS_AUTHKEY);
+>>>>>>> feature/附件功能完善
     }
 
     public function ClientSignin()
@@ -204,7 +220,16 @@ class ClientController extends DooController
                     $firstAuditor = $this->measureauditact->getFirstAuditor($this->params['tenderid'], $this->params['phaseno'], $iniTimes);
                     if (isset($firstAuditor)) {
                         if ($firstAuditor['mastatus'] == 'uncheck') {
-                            $this->measureauditact->updateMastatus($firstAuditor['maid']);
+                            $retVal = $this->measureauditact->updateMastatus($firstAuditor['maid']);
+                            if ($retVal > 0) {
+                                // SMS Start
+                                $verifyUserArray = $this->profile->getVerifiedMobile($firstAuditor['auditoruid']);
+                                $pmnameArray = $this->actmeasure->getRowByPmid($this->params['tenderid']);
+                                if (isset($verifyUserArray) && ($verifyUserArray['mobile'])) {// // XXXX(标段名),陈特,已审批通过。请您继续审批。
+                                    $this->__auditNotice($verifyUserArray['mobile'], Doo::conf()->SMS_TIPS_PRE . $pmnameArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR2"]);
+                                }
+                                // SMS End
+                            }
                         }
                     }
                 }
@@ -776,26 +801,35 @@ class ClientController extends DooController
                     if ($this->measureauditact->setStatusTo($auditArray['maid'], 3, $auditcontent)) {
                         // 更新下一个人的状态
                         $countAudit = count($auditUserArray);
-                        if ($auditArray['last'] == '1') {
+                        if ($auditArray['last'] == '1') {// 根据标志位判断是否为最后一个审核人{ 判断当前审核人是什么角色 } 利用post发送的UID 与 当前期数参与的所有人比较
                             $this->measureauditact->setStatusTo($auditUserArray[0]['maid'], 3);
                             $this->numofperact->updateAuditStatus($_POST['tenderid'], $_POST['phaseno'], 'checked', $iniTimes);
                             echo json_encode(array('status' => TRUE, 'msg' => ''), JSON_UNESCAPED_UNICODE);
                             die();
-                        } else {
-                            if (($countAudit == 2) && ($auditUserArray[0]['last'] == 1) && ($auditUserArray[1]['maid'] == $auditArray['maid'])) {
+                        } else {// 不是最后一个审核人根据不同审核人数量变更状态 {当前用户不是最后一个审核人}
+                            if (($countAudit == 2) && ($auditUserArray[0]['last'] == 1) && ($auditUserArray[1]['maid'] == $auditArray['maid'])) {// 如果审核人为两个,第一个是最后审核人角色,第二个为当前审核人,设置审核中状态 {就是当前用户POST UID}
                                 $this->measureauditact->updateMastatus($auditUserArray[0]['maid']);
                                 $this->numofperact->updateAuditStatus($_POST['tenderid'], $_POST['phaseno'], 'checking', $iniTimes);
                                 echo json_encode(array('status' => TRUE, 'msg' => ''), JSON_UNESCAPED_UNICODE);
                                 die();
                             }
-                            if (($countAudit > 2)) {
+                            if (($countAudit > 2)) {// 审核人总数大于2时,
                                 foreach ($auditUserArray as $k => $v) {
-                                    if ($v['maid'] == $auditArray['maid']) {
+                                    if ($v['maid'] == $auditArray['maid']) {// 找到当前用户
                                         if ($k == ($countAudit - 1)) {//如果是最后一个
                                             $this->measureauditact->updateMastatus($auditUserArray[0]['maid']);
+                                            $verifyUserArray = $this->profile->getVerifiedMobile($auditUserArray[0]['auditoruid']);
+                                            $pmnameArray = $this->actmeasure->getRowByPmid($auditUserArray[0]['pmid']);
                                         } else {
-                                            $this->measureauditact->updateMastatus($auditUserArray[$k + 1]['maid']);
+                                            $this->measureauditact->updateMastatus($auditUserArray[$k + 1]['maid']);//变更下一个状态
+                                            $verifyUserArray = $this->profile->getVerifiedMobile($auditUserArray[$k + 1]['auditoruid']);
+                                            $pmnameArray = $this->actmeasure->getRowByPmid($auditUserArray[$k]['pmid']);
                                         }
+                                        // SMS Start
+                                        if (isset($verifyUserArray) && ($verifyUserArray['mobile'])) {// // XXXX(标段名),陈特,已审批通过。请您继续审批。
+                                            $this->__auditNotice($verifyUserArray['mobile'], Doo::conf()->SMS_TIPS_PRE . $pmnameArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR2"]);
+                                        }
+                                        // SMS End
                                         $this->numofperact->updateAuditStatus($_POST['tenderid'], $_POST['phaseno'], 'checking', $iniTimes);
                                         echo json_encode(array('status' => TRUE, 'msg' => ''), JSON_UNESCAPED_UNICODE);
                                         die();
@@ -929,7 +963,7 @@ class ClientController extends DooController
     function setCheckno()
     {
         if (isset($this->params['userid']) && isset($this->params['tenderid']) && isset($this->params['phaseno']) && isset($_POST['MD5_JL']) && isset($_POST['MD5_Zip'])) {
-            $auditcontent = iconv('GBK', 'UTF-8', $_POST['CheckerMemo']);
+            $auditcontent = iconv('GBK', 'UTF - 8', $_POST['CheckerMemo']);
             $auditArrayStatus = $this->measureauditact->getLastNewRowInfo($this->params['tenderid'], $this->params['phaseno'], $this->params['userid']);
             if (isset($auditArrayStatus ['mastatus']) && (($auditArrayStatus ['mastatus'] == 'checked') || ($auditArrayStatus ['mastatus'] == 'checkno'))) {
                 echo json_encode(array('status' => FALSE, 'msg' => '该标段已审批完毕。'), JSON_UNESCAPED_UNICODE);
@@ -992,7 +1026,7 @@ class ClientController extends DooController
     {
         // 插入上次期数相关审批人员
         // TODO:
-//	error_log(var_export($this->params, TRUE), 3, '/opt/html/jiliang_customedProduct/data/' . time());
+//	error_log(var_export($this->params, TRUE), 3, ' / opt / html / jiliang_customedProduct / data / ' . time());
 //	die;
         if (isset($this->params['tenderid']) && isset($this->params['phaseno'])) {
             $auditArray = $this->numofperact->getChecknoRow($this->params['tenderid'], $this->params['phaseno']);
@@ -1020,7 +1054,7 @@ class ClientController extends DooController
 //                $downArray = NULL;
 //                $pathinfo = pathinfo($urlinfoArray['filepath']);
 //                if (isset($pathinfo['dirname']))
-//                    $downArray[] = array('downurl' => Doo::conf()->APP_URL . $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '/ProjectFile.rmf', 'MD5_Jl' => $urlinfoArray['filehashcode'], 'proName' => $proArray['pname'], 'stName' => $stArray['stname'], 'pnameid' => $proArray['pid'], 'ptypeid' => $stArray['stid'], 'BidName' => $MeasureArray['pmname']);
+//                    $downArray[] = array('downurl' => Doo::conf()->APP_URL . $pathinfo['dirname'] . ' / ' . $pathinfo['filename'] . ' / ProjectFile . rmf', 'MD5_Jl' => $urlinfoArray['filehashcode'], 'proName' => $proArray['pname'], 'stName' => $stArray['stname'], 'pnameid' => $proArray['pid'], 'ptypeid' => $stArray['stid'], 'BidName' => $MeasureArray['pmname']);
 //                echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $downArray), JSON_UNESCAPED_UNICODE);
                 echo json_encode(array('status' => 'TRUE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
                 die();
@@ -1090,7 +1124,7 @@ class ClientController extends DooController
     public function updateTenderName()
     {
         if (isset($this->params['BidID']) && isset($this->params['BidNewName'])) {
-            if ($this->actmeasure->updateName($this->params['BidID'], iconv('GBK', 'UTF-8', $this->params['BidNewName']))) {
+            if ($this->actmeasure->updateName($this->params['BidID'], iconv('GBK', 'UTF - 8', $this->params['BidNewName']))) {
                 echo json_encode(array('status' => 'TRUE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
                 die();
             } else {
@@ -1112,21 +1146,28 @@ class ClientController extends DooController
     public function uploadItemFile()
     {
         if (isset($this->params['tenderid']) && isset($this->params['uid'])) {
-            if (!isset($_FILES['upitem']) && !isset($_POST['itemid']) && !isset($_POST['Category'])) {
+            if (!isset($_FILES['upitem']) && !isset($_POST['itemid']) && !isset($_POST['category']) && !isset($_POST['phase'])) {
                 $this->msg(0, '上传参数错误');
             }
             $fileArray = $this->upItemFile('upitem')[0];
             if (isset($fileArray['filepath'])) {
+                $pidArray = $this->actmeasure->getRowByPmid($this->params['tenderid']);
                 $memoStr = iconv('GBK', 'UTF-8', $_POST['Memo']);
                 $fnArray = explode('.', $fileArray['filename']);
                 $filenameStr = iconv('GBK', 'UTF-8', $fnArray[0]);
-                $postArray = array('mpid' => $this->params['tenderid'], 'ownerid' => $this->params['uid'], 'itemid' => $_POST['itemid'], 'filename' => $filenameStr, 'filesize' => $fileArray['filesize'], 'fileext' => $fileArray['fileext'], 'filepath' => $fileArray['filepath'], 'categoryid' => array_search($_POST['Category'], $this->fileTypeArray), 'tips' => $memoStr);
-                if ($this->itemfile->insertItemFileRecord($postArray) > 1) {
-                    $extPath = pathinfo($fileArray['filepath']);
-                    $itemArray = array('onlineFileName' => $extPath['filename'] . '.' . $extPath['extension']);
-                    $status = array('status' => TRUE, 'msg' => '', 'iteminfo' => $itemArray);
-                    echo json_encode($status, JSON_UNESCAPED_UNICODE);
-                    die();
+                $postArray = array('ownerid' => $this->params['uid'], 'pid' => $pidArray['pid'], 'pmid' => $this->params['pmid'], 'filename' => $filenameStr, 'filesize' => $fileArray['filesize'], 'fileext' => $fileArray['fileext'], 'filepath' => $fileArray['filepath']);
+                $iaid = $this->itemfile->insertItemFileRecord($postArray);
+                if ($iaid > 1) {
+                    $itemMeasureNumArray = array('iaid' => $iaid, 'pid' => $pidArray['pid'], 'pmid' => $this->params['tenderid'], 'numpname' => $_POST['phase'], 'ownerid' => $this->params['uid'], 'itemid' => $_POST['itemid'], 'categoryid' => array_search($_POST['category'], $this->fileTypeArray), 'tips' => $memoStr);
+                    if (($imnid = $this->itemMeasureNum->insert($itemMeasureNumArray)) > 0) {
+                        $extPath = pathinfo($fileArray['filepath']);
+                        $itemArray = array('onlineFileName' => $extPath['filename'] . '.' . $extPath['extension'], 'imnid' => $imnid, 'fileurl' => Doo::conf()->APP_URL . $fileArray['filepath']);
+                        $status = array('status' => TRUE, 'msg' => '', 'iteminfo' => $itemArray);
+                        echo json_encode($status, JSON_UNESCAPED_UNICODE);
+                        die();
+                    } else {
+                        $this->msg(0, '附件上传失败,请重新上传.');
+                    }
                 }
             } else {
                 $this->msg(0, '附件上传失败,请重新上传');
@@ -1142,16 +1183,15 @@ class ClientController extends DooController
     public function getItemFileList()
     {
         if (isset($this->params['tenderid'])) {
-            $itemfileArray = $this->itemfile->getItemFileList($this->params['tenderid']);
-            $key = array_search(max($itemfileArray), $itemfileArray);
-            if ($key >= 0) {
-                foreach ($itemfileArray as $value) {
-                    $profileArray = $this->profile->getProWithUid($value['ownerid']);
-                    $downArray[] = array('downurl' => Doo::conf()->APP_URL . $value['filepath'], 'filename' => $value['filename'] . '.' . $value['fileext'], 'fileext' => $value['fileext'], 'ownerName' => $profileArray['name'], 'itemid' => $value['itemid'], 'Category' => $this->fileTypeArray[$value['categoryid']], 'Memo' => $value['tips'], 'ownerid' => $value['ownerid'], 'uptime' => date('Y-m-d H:i', $value['intime']), 'fileid' => $value['iaid']);
-                }
-                echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $downArray), JSON_UNESCAPED_UNICODE);
-                die();
+            $itemfileArray = $this->itemMeasureNum->getItemMeasureNum($this->params['tenderid']);
+            foreach ($itemfileArray as $value) {
+                $profileArray = $this->profile->getProWithUid($value['ownerid']);
+                $attFileArray = $this->itemfile->getItemFile($value['iaid']);
+                if (isset($attFileArray) && $attFileArray && isset($profileArray) && $profileArray)
+                    $downArray[] = array('downurl' => Doo::conf()->APP_URL . $attFileArray['filepath'], 'filename' => $attFileArray['filename'] . '.' . $attFileArray['fileext'], 'fileext' => $attFileArray['fileext'], 'ownerName' => $profileArray['name'], 'itemid' => $value['softwareitemid'], 'Category' => $value['categoryid'], 'Memo' => $value['tips'], 'ownerid' => $value['ownerid'], 'uptime' => date('Y-m-d H:i', $value['intime']), 'fileid' => $value['imnid'], 'phase' => $value['numpname']);
             }
+            echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $downArray), JSON_UNESCAPED_UNICODE);
+            die();
         } else {
             $this->msg(0, '获取附件列表参数错误');
         }
@@ -1163,19 +1203,80 @@ class ClientController extends DooController
     public function updateItemFileDesc()
     {
         if (isset($this->params['fileid']) && isset($_POST['FileName']) && isset($_POST['Memo'])) {
-            if ($this->itemfile->updateItemFields($this->params['fileid'], $_POST['FileName'], $_POST['Memo']) > 0) {
-                echo json_encode(array('status' => 'TRUE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
-                die();
-            } else {
-                echo json_encode(array('status' => 'FALSE', 'msg' => '附件更新接口参数错误'), JSON_UNESCAPED_UNICODE);
-                die();
-            }
+            // $memoStr = iconv('GB18030', 'UTF-8', $_POST['Memo']);
+            $memoStr = $_POST['Memo'];
+            // $filenameStr = iconv('GB18030', 'UTF-8', $_POST['FileName']);
+            $filenameStr = $_POST['FileName'];
+            $imnidArray = $this->itemMeasureNum->getRowData($this->params['fileid']);
+            // if ($this->itemMeasureNum->updateItemFields($this->params['fileid'], $memoStr) > 0) {
+            $this->itemMeasureNum->updateItemFields($this->params['fileid'], $memoStr);
+            $this->itemfile->updateItemFields($imnidArray['iaid'], $filenameStr);
+            echo json_encode(array('status' => 'TRUE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
+            die();
+            // } else {
+            //     echo json_encode(array('status' => 'FALSE', 'msg' => '附件更新接口参数错误'), JSON_UNESCAPED_UNICODE);
+            //     die();
+            // }
         } else {
             $this->msg(0, '附件更新接口参数错误');
         }
     }
 
     /**
+     * 删除清单附件
+     */
+    public function delItemFile()
+    {
+        if (isset($this->params['fileid'])) {
+            $this->itemMeasureNum->delItemFields($this->params['fileid']);
+            echo json_encode(array('status' => 'TRUE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
+            die();
+        } else {
+            $this->msg(0, '关联删除接口参数错误');
+        }
+    }
+
+    /**
+     * @return attachment
+     */
+    public function getAttaFilesAll()
+    {
+        if (isset($this->params['tenderid'])) {
+            $itemfileArray = $this->itemfile->getFilesAll($this->params['tenderid']);
+            foreach ($itemfileArray as $value) {
+//                $profileArray = $this->profile->getProWithUid($value['ownerid']);
+//                $attFileArray = $this->itemfile->getItemFile($value['iaid']);
+//                if (isset($attFileArray) && $attFileArray && isset($profileArray) && $profileArray)
+                $filesArray[] = array('downurl' => Doo::conf()->APP_URL . $value['filepath'], 'filename' => $value['filename'] . '.' . $value['fileext'], 'fileext' => $value['fileext'], 'fileid' => $value['iaid']);
+            }
+            echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $filesArray), JSON_UNESCAPED_UNICODE);
+            die();
+        } else {
+            $this->msg(0, '获取附件列表参数错误');
+        }
+    }
+
+    /**
+     * @return attachment
+     */
+    public function createAttWithTender()
+    {
+        if (isset($this->params['tenderid'])) {
+            $itemfileArray = $this->itemfile->getFilesAll($this->params['tenderid']);
+            foreach ($itemfileArray as $value) {
+//                $profileArray = $this->profile->getProWithUid($value['ownerid']);
+//                $attFileArray = $this->itemfile->getItemFile($value['iaid']);
+//                if (isset($attFileArray) && $attFileArray && isset($profileArray) && $profileArray)
+                $filesArray[] = array('downurl' => Doo::conf()->APP_URL . $value['filepath'], 'filename' => $value['filename'] . '.' . $value['fileext'], 'fileext' => $value['fileext'], 'fileid' => $value['iaid']);
+            }
+            echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $filesArray), JSON_UNESCAPED_UNICODE);
+            die();
+        } else {
+            $this->msg(0, '获取附件列表参数错误');
+        }
+    }
+
+    /**
      *   查询指定项目的指定期的全部审批意见。
      *   标段ID,期号
      */
@@ -1200,6 +1301,18 @@ class ClientController extends DooController
         }
     }
 
+    /**
+     *   。
+     *   标段ID,期号
+     */
+    private function __auditNotice($mobile, $text)
+    {
+        $smsSwitch = $this->aconfig->getOne(array('select' => 'smsSwitch', 'asArray' => TRUE))['smsSwitch'];
+        if ($smsSwitch > 0)
+            return $this->sms->sendSms($mobile, $text);
+
+    }
+
     function upfile($fildname, $param = 'doc, docx, xls, xlsx, png, zip')
     {
         return $this->att->uploadMut($fildname, $param);
@@ -1321,4 +1434,4 @@ class ClientController extends DooController
 
 }
 
-?>
+?>

+ 113 - 2
protected/controller/ProjectController.php

@@ -1,5 +1,4 @@
 <?php
-
 Doo::loadClass('auth');
 Doo::loadClass('attfile');
 Doo::loadClass('profile');
@@ -8,6 +7,8 @@ Doo::loadClass('contractact');
 Doo::loadClass('actmeasure');
 Doo::loadClass('numofperact');
 Doo::loadClass('measureauditact');
+Doo::loadClass('itemmeasurenum');
+Doo::loadClass('itemfile');
 
 /* * proDetail
  * MainController
@@ -19,7 +20,7 @@ Doo::loadClass('measureauditact');
 class ProjectController extends DooController
 {
 
-    private $data, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $measureauditact, $numofperact, $statusArray = array('uncheck' => '<span class = "colGray">未审批</span>', 'checking' => '<span class = "colOrange">审批中</span>', 'checked' => '<span class = "colGreen">审批通过</span>', 'checkno' => '<span class = "colRed">审批不通过</span>');
+    private $data, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $measureauditact, $numofperact, $statusArray = array('uncheck' => '<span class = "colGray">未审批</span>', 'checking' => '<span class = "colOrange">审批中</span>', 'checked' => '<span class = "colGreen">审批通过</span>', 'checkno' => '<span class = "colRed">审批不通过</span>'), $itemmeasurenum, $itemfle;
 
     public function beforeRun($resource, $action)
     {
@@ -43,6 +44,8 @@ class ProjectController extends DooController
         $this->actmeasure = new actMeasure();
         $this->numofperact = new NumofperAct();
         $this->measureauditact = new MeasureauditAct();
+        $this->itemmeasurenum = new ItemMeasureNumpofper();
+        $this->itemfle = new ItemFile();
         $this->data['rootUrl'] = Doo::conf()->APP_URL;
         $this->data['currChannle'] = 'p';
         $this->data['user'] = $this->profile->getProWithUid($this->auth->getUid());
@@ -350,6 +353,114 @@ class ProjectController extends DooController
         $this->render('w-project-section', $this->data, TRUE);
     }
 
+    function proSectionFiles()
+    {
+        // 面包屑导航项目
+        $this->data['currproArray'] = $this->data['allproArray'] = NULL;
+        $this->data['pmid'] = $this->params['pmid'];
+        $allproArray = $this->project->getAll();
+        foreach ($allproArray as $kk => $vv) {
+            if ($vv['pid'] == $this->params['pid']) {
+                $this->data['currproArray'] = $vv;
+            } else {
+                $this->data['allproArray'][] = $vv;
+            }
+        }
+// 面包屑导航合同
+        $conArray = $this->contractact->getAll();
+        $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
+        if (isset($measureArray['stid'])) {
+            foreach ($conArray as $kkk => $vvv) {
+                if ($vvv['stid'] == $measureArray['stid']) {
+                    $this->data['currconArray'] = $vvv;
+                } else {
+                    if ($vvv['pid'] == $this->params['pid'])
+                        $this->data['allconArray'][] = $vvv;
+                }
+            }
+        } else {
+            $this->data['currconArray'] = $this->data['allconArray'] = NULL;
+        }
+// 面包屑导航标段
+        $this->data['curractmeasureArray'] = NULL;
+        $this->data['allactmeasureArray'] = [];
+        $actmeasureArray = $this->actmeasure->getAll();
+        foreach ($actmeasureArray as $kkkk => $vvvv) {
+            if ($vvvv['stid'] == $measureArray['stid']) {
+                if (($vvvv['pmid'] == $this->params['pmid'])) {
+                    $this->data['curractmeasureArray'] = $vvvv;
+                } else {
+                    $this->data['allactmeasureArray'][] = $vvvv;
+                }
+            }
+        }
+        $this->data['itemMeasureArray'] = $this->itemmeasurenum->getItemMeasureNum($this->params['pmid']);
+        foreach ($this->data['itemMeasureArray'] as $k => $v) {
+            $fileArray = $this->itemfle->getItemFile($v['iaid']);
+            $this->data['itemMeasureArray'][$k]['realname'] = $this->profile->getProWithUid($v['ownerid'])['name'];
+            $this->data['itemMeasureArray'][$k]['pmname'] = $this->actmeasure->getRowByPmid($v['pmid'])['pmname'];
+            $this->data['itemMeasureArray'][$k]['filename'] = $fileArray['filename'];
+            $this->data['itemMeasureArray'][$k]['fileext'] = $fileArray['fileext'];
+            $this->data['itemMeasureArray'][$k]['tips'] = $v['tips'];
+        }
+        $this->data['pid'] = $this->params['pid'];
+        $this->data['pmid'] = $this->params['pmid'];
+        $this->data['mpid'] = $this->params['mpid'];
+        $this->render('w-project-section-files', $this->data, TRUE);
+    }
+
+    function proSectionFilesRecover()
+    {
+        // 面包屑导航项目
+        $this->data['currproArray'] = $this->data['allproArray'] = NULL;
+        $this->data['pmid'] = $this->params['pmid'];
+        $allproArray = $this->project->getAll();
+        foreach ($allproArray as $kk => $vv) {
+            if ($vv['pid'] == $this->params['pid']) {
+                $this->data['currproArray'] = $vv;
+            } else {
+                $this->data['allproArray'][] = $vv;
+            }
+        }
+// 面包屑导航合同
+        $conArray = $this->contractact->getAll();
+        $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
+        if (isset($measureArray['stid'])) {
+            foreach ($conArray as $kkk => $vvv) {
+                if ($vvv['stid'] == $measureArray['stid']) {
+                    $this->data['currconArray'] = $vvv;
+                } else {
+                    if ($vvv['pid'] == $this->params['pid'])
+                        $this->data['allconArray'][] = $vvv;
+                }
+            }
+        } else {
+            $this->data['currconArray'] = $this->data['allconArray'] = NULL;
+        }
+// 面包屑导航标段
+        $this->data['curractmeasureArray'] = NULL;
+        $this->data['allactmeasureArray'] = [];
+        $actmeasureArray = $this->actmeasure->getAll();
+        foreach ($actmeasureArray as $kkkk => $vvvv) {
+            if ($vvvv['stid'] == $measureArray['stid']) {
+                if (($vvvv['pmid'] == $this->params['pmid'])) {
+                    $this->data['curractmeasureArray'] = $vvvv;
+                } else {
+                    $this->data['allactmeasureArray'][] = $vvvv;
+                }
+            }
+        }
+        $this->data['itematta'] = $this->itemfle->getFilesAll($this->params['pmid']);
+        foreach ($this->data['itematta'] as $k => $v) {
+            $this->data['itematta'][$k]['realname'] = $this->profile->getProWithUid($v['ownerid'])['name'];
+            $this->data['itematta'][$k]['pmname'] = $this->actmeasure->getRowByPmid($v['pmid'])['pmname'];
+        }
+        $this->data['pid'] = $this->params['pid'];
+        $this->data['pmid'] = $this->params['pmid'];
+        $this->data['mpid'] = $this->params['mpid'];
+        $this->render('w-project-section-files-recover', $this->data, TRUE);
+    }
+
     Function fNumber($number)
     {
         if ($number == '')

+ 129 - 3
protected/controller/RProjectController.php

@@ -1,5 +1,4 @@
 <?php
-
 Doo::loadClass('auth');
 Doo::loadClass('attfile');
 Doo::loadClass('profile');
@@ -8,6 +7,10 @@ Doo::loadClass('contractact');
 Doo::loadClass('actmeasure');
 Doo::loadClass('measureauditact');
 Doo::loadClass('numofperact');
+Doo::loadClass('itemmeasurenum');
+Doo::loadClass('itemfile');
+Doo::loadModelAt('aconfig', 'admin');
+Doo::loadClass('sms');
 
 /**
  * MainController
@@ -18,7 +21,8 @@ Doo::loadClass('numofperact');
 class RProjectController extends DooController
 {
 
-    private $data, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $measureauditact, $numofperact, $statusArray = array('uncheck' => '未审批', 'checking' => '审批中', 'checked' => '已审批', 'checkno' => '未通过');
+
+    private $data, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $measureauditact, $numofperact, $statusArray = array('uncheck' => '未审批', 'checking' => '审批中', 'checked' => '已审批', 'checkno' => '未通过'), $aconfig, $sms, $itemfile, $itemmeasurenum;
 
     public function __construct()
     {
@@ -30,6 +34,10 @@ class RProjectController extends DooController
         $this->actmeasure = new actMeasure();
         $this->measureauditact = new MeasureauditAct();
         $this->numofperact = new NumofperAct();
+        $this->itemfile = new ItemFile();
+        $this->itemmeasurenum = new ItemMeasureNumpofper();
+        $this->aconfig = new AConfig();
+        $this->sms = new Sms(Doo::conf()->SMS_URL, Doo::conf()->SMS_AUTHKEY);
         $this->data['rootUrl'] = Doo::conf()->APP_URL;
         $this->data['currChannle'] = 'r';
         $this->data['user'] = $this->profile->getProWithUid($this->auth->getUid());
@@ -221,6 +229,92 @@ class RProjectController extends DooController
         $this->render('r-project-section-measure', $this->data, TRUE);
     }
 
+    function proSectionFiles()
+    {
+        $mpidArray = $this->measureauditact->getAuditProject($this->auth->getUid());
+        foreach ($mpidArray as $k1 => $v1) {
+            if ($v1['pid'] != $this->params['pid'])
+                $this->data['allproArray'][] = $this->project->getRowByPid($v1['pid']);
+        }
+        $this->data['currproArray'] = $this->project->getRowByPid($this->params['pid']);
+        $this->data['itematta'] = $this->itemmeasurenum->getItemMeasureNum($this->params['pmid']);
+        foreach ($this->data['itematta'] as $k => $v) {
+            $fileArray = $this->itemfile->getItemFile($v['iaid']);
+            $this->data['itematta'][$k]['realname'] = $this->profile->getProWithUid($v['ownerid'])['name'];
+            $this->data['itematta'][$k]['pmname'] = $this->actmeasure->getRowByPmid($v['pmid'])['pmname'];
+            $this->data['itematta'][$k]['filename'] = $fileArray['filename'];
+            $this->data['itematta'][$k]['fileext'] = $fileArray['fileext'];
+            $this->data['itematta'][$k]['iaid'] = $fileArray['iaid'];
+            $this->data['itematta'][$k]['tips'] = $v['tips'];
+        }
+        $this->data['pid'] = $this->params['pid'];
+        $this->data['pmid'] = $this->params['pmid'];
+        $this->data['mpid'] = $this->params['mpid'];
+        $this->render('r-project-section-files', $this->data, TRUE);
+    }
+
+    /**
+     * @return actMeasure
+     */
+    public function proSectionGetFiles()
+    {
+        $attaArray = $this->itemfile->getItemFile($this->params['iaid']);
+        $this->file_down($attaArray['filepath'], $attaArray['filesize'], $attaArray['filename']);
+        return;
+    }
+
+    /**
+     * 文件下载
+     * @param $filepath 文件路径
+     * @param $filename 文件名称
+     */
+    function file_down($filepath, $filesize, $filename = '')
+    {
+        if (!$filename)
+            $filename = basename($filepath);
+        if ($this->is_ie())
+            $filename = rawurlencode($filename);
+        $filetype = $this->fileext($filename);
+//        $filesize = sprintf("%u", filesize($filepath));
+        if (ob_get_length() !== false)
+            @ob_end_clean();
+        header('Pragma: public');
+        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
+        header('Cache-Control: no-store, no-cache, must-revalidate');
+        header('Cache-Control: pre-check=0, post-check=0, max-age=0');
+        header('Content-Transfer-Encoding: binary');
+        header('Content-Encoding: none');
+        header('Content-type: ' . $filetype);
+        header('Content-Disposition: attachment; filename="' . $filename . '"');
+        header('Content-length: ' . $filesize);
+        @readfile($filepath);
+        exit;
+    }
+
+    /**
+     * IE浏览器判断
+     */
+    function is_ie()
+    {
+        $useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
+        if ((strpos($useragent, 'opera') !== false) || (strpos($useragent, 'konqueror') !== false))
+            return false;
+        if (strpos($useragent, 'msie ') !== false)
+            return true;
+        return false;
+    }
+
+    /**
+     * 取得文件扩展
+     *
+     * @param $filename 文件名
+     * @return 扩展名
+     */
+    function fileext($filename)
+    {
+        return strtolower(trim(substr(strrchr($filename, '.'), 1, 10)));
+    }
+
     Function fNumber($number)
     {
         if ($number == '')
@@ -363,9 +457,29 @@ class RProjectController extends DooController
                             if ($v['maid'] == $auditArray['maid']) {
                                 if ($k == ($countAudit - 1)) {//如果是最后一个
                                     $this->measureauditact->updateMastatus($auditUserArray[0]['maid']);
+                                    // SMS Start
+                                    $verifyUserArray = $this->profile->getVerifiedMobile($auditUserArray[0]['auditoruid']);
+                                    // var_dump($verifyUserArray);
+                                    $pmnameArray = $this->actmeasure->getRowByPmid($auditUserArray[0]['pmid']);
+                                    // var_dump($pmnameArray);
+                                    // SMS End
                                 } else {
                                     $this->measureauditact->updateMastatus($auditUserArray[$k + 1]['maid']);
+                                    // SMS Start
+                                    $verifyUserArray = $this->profile->getVerifiedMobile($auditUserArray[$k + 1]['auditoruid']);
+                                    // var_dump($verifyUserArray);
+                                    $pmnameArray = $this->actmeasure->getRowByPmid($auditUserArray[$k + 1]['pmid']);
+                                    // var_dump($pmnameArray);
+                                    // SMS End
+                                }
+                                // SMS Start
+                                if (isset($verifyUserArray) && ($verifyUserArray['mobile'])) {// XXXX(标段名),陈特,已审批通过。请您继续审批。
+                                    $retval = $this->__auditNotice($verifyUserArray['mobile'], Doo::conf()->SMS_TIPS_PRE . $pmnameArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR2"]);
+//                                        var_dump($pmnameArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR2"]);
+//                                        var_dump($retval);
+//                                        var_dump($this->sms->getErrors());
                                 }
+                                // SMS End
                                 $this->numofperact->updateAuditStatus($lastRowArray['pmid'], $lastRowArray['numpname'], 'checking', $maxTimes['times']);
                                 echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
                                 die();
@@ -425,6 +539,18 @@ class RProjectController extends DooController
         $this->data['mpid'] = $this->params['mpid'];
         $this->render('r-project-section-report', $this->data, TRUE);
     }
+
+    /**
+     *   。
+     *   标段ID,期号
+     */
+    private function __auditNotice($mobile, $text)
+    {
+        $smsSwitch = $this->aconfig->getOne(array('select' => 'smsSwitch', 'asArray' => TRUE))['smsSwitch'];
+        if ($smsSwitch > 0)
+            return $this->sms->sendSms($mobile, $text);
+
+    }
 }
 
-?>
+?>

+ 143 - 30
protected/controller/UserController.php

@@ -1,5 +1,5 @@
 <?php
-
+ini_set('display_errors', 1);
 Doo::loadClass('auth');
 Doo::loadClass('attfile');
 Doo::loadClass('profile');
@@ -9,6 +9,9 @@ Doo::loadClass('actmeasure');
 Doo::loadClass('numofperact');
 Doo::loadClass('user');
 Doo::loadClass('PasswordHash');
+Doo::loadClass('sms');
+Doo::loadModelAt('aconfig', 'admin');
+Doo::loadClass('measureauditact');
 
 /* * proDetail
  * MainController
@@ -17,11 +20,13 @@ Doo::loadClass('PasswordHash');
  * @author darkredz
  */
 
-class UserController extends DooController {
+class UserController extends DooController
+{
 
-    private $data, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $numofperact, $user, $ph;
+    private $data, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $numofperact, $user, $ph, $sms, $aconfig;
 
-    public function beforeRun($resource, $action) {
+    public function beforeRun($resource, $action)
+    {
 //	$uGroups = $this->profile->getProWithUid($this->auth->getUid());
 //	$falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
 //	if (!$falg)
@@ -31,12 +36,14 @@ class UserController extends DooController {
             $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
             if (!$falg)
                 return Doo::acl()->defaultFailedRoute;
-        }else {
+        } else {
             return Doo::acl()->defaultFailedRoute;
         }
     }
 
-    public function __construct() {
+    public function __construct()
+    {
+        $this->data['numofchecking'] = null;
         $this->auth = new Auth();
         $this->attfile = new attFile();
         $this->profile = new Profile();
@@ -46,26 +53,41 @@ class UserController extends DooController {
         $this->numofperact = new NumofperAct();
         $this->user = new User();
         $this->ph = new PasswordHash(8, FALSE);
+        $this->sms = new Sms(Doo::conf()->SMS_URL, Doo::conf()->SMS_AUTHKEY);
+        $this->aconfig = new AConfig();
+        $this->measureauditact = new MeasureauditAct();
         $this->data['rootUrl'] = Doo::conf()->APP_URL;
         $this->data['currChannle'] = 'p';
         $this->data['user'] = $this->profile->getProWithUid($this->auth->getUid());
+        $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
+        if (isset($mpidArray[0]['pid'])) {
+            foreach ($mpidArray as $key => $value) {
+                // 审批操作按照时间排序多标段
+                $this->data['numofchecking'] += $this->measureauditact->getCountMyChecking($value['pid'], $this->auth->getUid());
+            }
+        }
+        if ($this->data['numofchecking'] == 0) {
+            $this->data['numofchecking'] = null;
+        }
     }
 
     /**
      *
      * @return type
      */
-    public function index() {
+    public function index()
+    {
         $this->data['uprofile'] = $this->profile->getProWithUid($this->auth->getUid());
         $this->data['uprofile']['email'] = $this->auth->getUemail();
-        if (isset($_POST['name']) && isset($_POST['company']) && isset($_POST['jobs']) && isset($_POST['phone']) && isset($_POST['mobile'])) {
+        if (isset($_POST['name']) && isset($_POST['company']) && isset($_POST['jobs']) && isset($_POST['phone'])) {
             $this->profile->upProfile($this->auth->getUid(), $_POST);
             return DOO::conf()->APP_URL . 'user/profile';
         }
         $this->render('edit-profile', $this->data, TRUE);
     }
 
-    public function avatar() {
+    public function avatar()
+    {
         // TODO:加入目录可否写入判断
         if (count($_FILES) == 3) {
             $result = array();
@@ -114,16 +136,18 @@ class UserController extends DooController {
      *  @access public
      * ************************************************************ */
 
-    function createRandomCode($length) {
+    function createRandomCode($length)
+    {
         $randomCode = "";
         $randomChars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
         for ($i = 0; $i < $length; $i++) {
-            $randomCode .= $randomChars { mt_rand(0, 35) };
+            $randomCode .= $randomChars{mt_rand(0, 35)};
         }
         return $randomCode;
     }
 
-    public function proSection() {
+    public function proSection()
+    {
         /**
          * 计量期数
          * 完成进度
@@ -156,7 +180,7 @@ class UserController extends DooController {
                 }
                 $biaoduantotalmoney += $value['contracttotal'];
                 $totalmoney = number_format($value['contracttotal'], 2, '.', ',');
-                $bdhtmlstr .='
+                $bdhtmlstr .= '
 				<thead>
 				    <tr><th class="taC"  width="225">标段名</th><th class="taC" width="140">计量期数</th><th width="115" class="taC">总价</th><th class="taC" width="">截止本期累计完成/本期完成/未完成</th></tr></thead>
 				<tbody>
@@ -210,7 +234,88 @@ class UserController extends DooController {
         $this->render('w-project-section', $this->data, TRUE);
     }
 
-    Function fNumber($number) {
+    /**
+     *
+     * @return type
+     */
+    public function sms()
+    {
+        if (isset($_POST['mobile']) && isset($_POST['verifycode'])) {
+            $vmArray = $this->auth->getVerifyMobile();
+            if (isset($vmArray) && $vmArray) {
+                if (md5($_POST['mobile'] . $_POST['verifycode']) == md5($vmArray['mobile'] . $vmArray['code'])) {
+                    $this->profile->updateMobile($this->auth->getUid(), $vmArray['mobile']);
+                    die(json_encode(array('status'=> true)));
+                }
+            }
+        }
+        $this->data['uprofile'] = $this->profile->getProWithUid($this->auth->getUid());
+        $this->data['smsNoticeSwitch'] = $this->aconfig->getOne(array('select' => 'smsswitch', 'asArray' => TRUE))['smsswitch'];
+        $this->render('edit-profile-sms', $this->data, TRUE);
+    }
+
+    /**
+     *
+     * @return type
+     */
+    public function smsEdit()
+    {
+        if (isset($_POST['mobile']) && isset($_POST['verifycode'])) {
+            $vmArray = $this->auth->getVerifyMobile();
+            if (isset($vmArray) && $vmArray) {
+                if (md5($_POST['mobile'] . $_POST['verifycode']) == md5($vmArray['mobile'] . $vmArray['code'])) {
+                    $this->profile->updateMobile($this->auth->getUid(), $vmArray['mobile']);
+                    return Doo::conf()->APP_URL . 'user/profile/sms/edit';
+                }
+            }
+        }
+        $this->data['uprofile'] = $this->profile->getProWithUid($this->auth->getUid());
+        $this->render('edit-profile-sms-edit', $this->data, TRUE);
+    }
+
+    /**
+     *
+     * @return type
+     */
+    public function checkMobile()
+    {
+//        $this->data['uprofile']['email'] = $this->auth->getUemail();
+//        if (isset($_POST['name']) && isset($_POST['company']) && isset($_POST['jobs']) && isset($_POST['phone']) && isset($_POST['mobile'])) {
+//            $this->profile->upProfile($this->auth->getUid(), $_POST);
+//            return DOO::conf()->APP_URL . 'user/profile';
+//        }
+        die(json_encode(array('mobile' => (int)$this->profile->checkMobile($_POST['mobile']))));
+    }
+
+    /**
+     *
+     * @return type
+     */
+    public function mobileVerify()
+    {
+//        $this->data['uprofile']['email'] = $this->auth->getUemail();
+//        if (isset($_POST['name']) && isset($_POST['company']) && isset($_POST['jobs']) && isset($_POST['phone']) && isset($_POST['mobile'])) {
+//            $this->profile->upProfile($this->auth->getUid(), $_POST);
+//            return DOO::conf()->APP_URL . 'user/profile';
+//        }
+        die(json_encode(array('mobile' => (int)$this->profile->checkMobile($_POST['mobile']))));
+    }
+
+    /**
+     *
+     * @return type
+     */
+    public function smsSend()
+    {
+        $randNum = rand(1000, 9999);
+        $this->auth->setVerifyMobile(array('mobile' => $_POST['mobile'], 'code' => $randNum));
+        $res = $this->sms->sendSms($_POST['mobile'], Doo::conf()->SMS_TIPS['AUDIT_NOTICE'] . $randNum . Doo::conf()->SMS_TIPS['END_MSG']);
+        die(json_encode(array('verify' => $res)));
+    }
+
+
+    Function fNumber($number)
+    {
         if ($number == '')
             Return "-";
         $nlen = strlen($number);
@@ -226,7 +331,8 @@ class UserController extends DooController {
         Return $fNumber;
     }
 
-    private function getFav() {
+    private function getFav()
+    {
         $proArray = $this->project->getAll();
         $this->data['othrPro'] = [];
         foreach ($proArray as $key => $value) {
@@ -239,7 +345,8 @@ class UserController extends DooController {
         }
     }
 
-    public function proSectionMeasure() {
+    public function proSectionMeasure()
+    {
         //此处未做更改,JSON文件已经固定名称
         $jsonpath = pathinfo($this->attfile->getMaxRow()['filepath']);
         if (isset($jsonpath['dirname'])) {
@@ -254,7 +361,7 @@ class UserController extends DooController {
                 closedir($handle);
             }
             $this->data['proArray'] = $proArray['Bills'];
-        }else {
+        } else {
             $this->data['proArray'] = [];
         }
         $this->data['mpid'] = $this->params['mpid'];
@@ -262,7 +369,8 @@ class UserController extends DooController {
         $this->render('w-project-section-measure', $this->data, TRUE);
     }
 
-    public function substr_replace_cn($string, $repalce = '*', $start = 0, $len = 0) {
+    public function substr_replace_cn($string, $repalce = '*', $start = 0, $len = 0)
+    {
         $count = mb_strlen($string, 'UTF-8'); //此处传入编码,建议使用utf-8。此处编码要与下面mb_substr()所使用的一致
         if (!$count) {
             return $string;
@@ -281,12 +389,13 @@ class UserController extends DooController {
             } else {
                 $returnString .= $tmpString;
             }
-            $i ++;
+            $i++;
         }
         return $returnString;
     }
 
-    function unicode_encode($name) {//to Unicode
+    function unicode_encode($name)
+    {//to Unicode
         $name = iconv('UTF-8', 'UCS-2', $name);
         $len = strlen($name);
         $str = '';
@@ -303,7 +412,8 @@ class UserController extends DooController {
         return $str;
     }
 
-    function unicode_decode($name) {//Unicode to
+    function unicode_decode($name)
+    {//Unicode to
         $pattern = '/([\w]+)|(\\\u([\w]{4}))/i';
         preg_match_all($pattern, $name, $matches);
         if (!empty($matches)) {
@@ -324,7 +434,8 @@ class UserController extends DooController {
         return $name;
     }
 
-    public function proDetail() {
+    public function proDetail()
+    {
         // 面包屑导航项目
         $this->data['currproArray'] = $this->data['allproArray'] = NULL;
         $allproArray = $this->project->getAll();
@@ -377,7 +488,8 @@ class UserController extends DooController {
         $this->render('w-project-section-detail', $this->data, TRUE);
     }
 
-    public function welcome() {
+    public function welcome()
+    {
 //	if (!$this->auth->isLoggedIn())
 //	    return Doo::conf()->APP_URL;
         if ($this->profile->getProWithUid($this->auth->getUid())['userid'])
@@ -391,7 +503,8 @@ class UserController extends DooController {
         $this->render('welcome', $this->data);
     }
 
-    public function prolist() {
+    public function prolist()
+    {
 //	if (!$this->auth->isLoggedIn())
 //	    return Doo::conf()->APP_URL;
 //	$proArray = new stdClass();
@@ -406,19 +519,19 @@ class UserController extends DooController {
 //	    closedir($handle);
 //	}
 //	$this->data['proArray'] = null;
-        $this->render('s-project
-
-	', $this->data);
+        $this->render('s-project', $this->data);
     }
 
 // ajax提取密码名称
-    public function getAjaxSection() {
+    public function getAjaxSection()
+    {
         if (!$this->isAjax())
             return;
         echo json_encode($_POST);
     }
 
-    public function repasswd() {
+    public function repasswd()
+    {
         if (isset($_POST['oldpasswd']) && isset($_POST['newpasswd']) && isset($_POST['renewpasswd']) && ($_POST['newpasswd'] == $_POST['renewpasswd'])) {
             $userArray = $this->user->getRowUser($this->auth->getUid());
             if ($this->ph->CheckPassword($_POST['oldpasswd'], $userArray['upass'])) {
@@ -431,4 +544,4 @@ class UserController extends DooController {
 
 }
 
-?>
+?>

+ 8 - 7
protected/model/itematt.php

@@ -5,26 +5,27 @@ Doo::loadCore('db/DooModel');
 /**
  * 用户表
  */
-class ItemAtt extends DooModel {
+class ItemAtt extends DooModel
+{
 
     public $iaid;
-    public $mpid;
     public $ownerid;
-    public $itemid;
+    public $pid;
+    public $pmid;
     public $filename;
     public $fileext;
     public $filesize;
     public $filepath;
-    public $categoryid;
     public $intime;
     public $isdel;
     public $tips;
     public $_table = 'jl_item_attachment';
     public $_primarykey = 'iaid';
-    public $_fields = array('iaid', 'mpid', 'ownerid', 'itemid', 'filename', 'fileext', 'filesize', 'filepath', 'categoryid', 'intime', 'isdel', 'tips');
+    public $_fields = array('iaid', 'ownerid', 'pid', 'pmid', 'filename', 'fileext', 'filesize', 'filepath', 'intime', 'isdel', 'tips');
 
-    public function __construct() {
-	parent::setupModel(__CLASS__);
+    public function __construct()
+    {
+        parent::setupModel(__CLASS__);
     }
 
 }

+ 33 - 0
protected/model/itemmnum.php

@@ -0,0 +1,33 @@
+<?php
+
+Doo::loadCore('db/DooModel');
+
+/**
+ * 用户表
+ */
+class ItemMeasureNumofper extends DooModel
+{
+    public $imnid;
+    public $iaid;
+    public $pid;
+    public $pmid;
+    public $numpname;
+    public $softwareitemid;
+    public $isdel;
+    public $intime;
+    public $deltime;
+    public $ownerid;
+    public $categoryid;
+    public $tips;
+    public $_table = 'jl_item_measure_numofper';
+    public $_primarykey = 'imnid';
+    public $_fields = array('imnid', 'iaid', 'pid', 'pmid', 'numpname', 'softwareitemid', 'isdel', 'intime', 'deltime', 'ownerid', 'categoryid', 'tips');
+
+    public function __construct()
+    {
+        parent::setupModel(__CLASS__);
+    }
+
+}
+
+?>

+ 7 - 4
protected/model/uprofile.php

@@ -5,7 +5,8 @@ Doo::loadCore('db/DooModel');
 /**
  * 用户表
  */
-class Uprofile extends DooModel {
+class Uprofile extends DooModel
+{
 
     public $userid;
     public $name;
@@ -16,12 +17,14 @@ class Uprofile extends DooModel {
     public $qq;
     public $groups;
     public $avatar;
+    public $isnotice;
     public $_table = 'jl_user_profiles';
     public $_primarykey = 'userid';
-    public $_fields = array('userid', 'name', 'company', 'jobs', 'phone', 'mobile', 'qq', 'groups','avatar');
+    public $_fields = array('userid', 'name', 'company', 'jobs', 'phone', 'mobile', 'qq', 'groups', 'avatar', 'isnotice');
 
-    public function __construct() {
-	parent::setupModel(__CLASS__);
+    public function __construct()
+    {
+        parent::setupModel(__CLASS__);
     }
 
 }

+ 28 - 5
protected/module/admin/controller/SysController.php

@@ -1,5 +1,5 @@
 <?php
-
+ini_set('display_errors', 1);
 session_start(); // starts new or resumes existing session
 Doo::loadModelAt('aconfig', 'admin');
 Doo::loadModelAt('auser', 'admin');
@@ -14,24 +14,28 @@ Doo::loadClass('mailer');
 // 列表停用 编辑 重置密码
 // 管理员权限管理
 // 管理员修改密码
-class SysController extends DooController {
+class SysController extends DooController
+{
 
     private $data, $aconfig, $auser, $profile, $ph, $userz, $mailer;
 
-    public function beforeRun($resource, $action) {
+    public function beforeRun($resource, $action)
+    {
         if (!isset($_SESSION['auid'])) {
             return Doo::conf()->APP_URL . 'manage';
         }
     }
 
-    public function __construct() {
+    public function __construct()
+    {
         $this->aconfig = new AConfig();
         $this->auser = new AUser();
         $this->mailer = new Mailer();
         $this->data['rootUrl'] = Doo::conf()->APP_URL;
     }
 
-    function sysinfo() {
+    function sysinfo()
+    {
         if (isset($_POST['proname']) || isset($_POST['aemail'])) {
             if ($_POST['proname']) {
                 $this->aconfig->proname = $_POST['proname'];
@@ -57,4 +61,23 @@ class SysController extends DooController {
         $this->render('admin-sysinfo', $this->data, TRUE);
     }
 
+    function smsSwitch()
+    {
+        if (isset($_POST['switch'])) {
+            if ($_POST['switch'] == 'off') {
+                $this->aconfig->smsswitch = 0;
+                if ($this->aconfig->update(array('where' => "conid = 1")) > 0)
+                    exit(json_encode(array('switch' => 'off')));
+            }
+            if ($_POST['switch'] == 'on') {
+                $this->aconfig->smsswitch = 1;
+                if ($this->aconfig->update(array('where' => "conid = 1")) > 0)
+                    exit(json_encode(array('switch' => 'on')));
+            }
+        }
+        $this->data['smsSwitch'] = $this->aconfig->getOne(array('select' => 'smsswitch', 'asArray' => TRUE))['smsswitch'];
+        $this->data['menu'] = 4;
+        $this->render('admin-sms', $this->data, TRUE);
+    }
+
 }

+ 11 - 2
protected/module/admin/model/aconfig.php

@@ -5,17 +5,26 @@ Doo::loadCore('db/DooModel');
 /**
  * 用户表
  */
-class AConfig extends DooModel {
+class AConfig extends DooModel
+{
 
     public $conid;
     public $proname;
+<<<<<<< HEAD
     public $onoff;
     public $upgradeinfo;
     public $_table = 'jl_config';
     public $_primarykey = 'conid';
     public $_fields = array('conid', 'proname', 'onoff', 'upgradeinfo');
+=======
+    public $smsswitch;
+    public $_table = 'jl_config';
+    public $_primarykey = 'conid';
+    public $_fields = array('conid', 'proname', 'smsswitch');
+>>>>>>> feature/附件功能完善
 
-    public function __construct() {
+    public function __construct()
+    {
         parent::setupModel(__CLASS__);
     }
 

+ 95 - 0
protected/module/admin/view/admin-sms.html

@@ -0,0 +1,95 @@
+<!DOCTYPE html>
+<html lang=zh-cn>
+<head>
+    <meta charset=utf-8>
+    <title>纵横计量支付系统</title>
+    <meta name=description content=计量支付>
+    <meta name=copyright content=smartcost.com.cn>
+    <link rel=stylesheet href={{rootUrl}}global/css/bootstrap.css>
+    <link rel=stylesheet href={{rootUrl}}global/css/style.css>
+    <script src={{rootUrl}}global/js/jquery-1.9.1.min.js></script>
+    <script src={{rootUrl}}global/js/bootstrap.js></script>
+    <script src={{rootUrl}}global/js/jl.js></script>
+</head>
+<body>
+<div class="wrapHeader">
+    <h1 class="mainLogo" title="纵横计量支付"></h1>
+    <div class="sysTools"><a title="返回首页" href="index.html"><i class="icon-circle-arrow-left icon-white"></i></a>&nbsp;&nbsp;&nbsp;<a
+            title="纵横官网" target="_blank" href="http://smartcost.com.cn"><i class="icon-home icon-white"></i></a></div>
+</div>
+<!-- include "top" -->
+<div class="warpAdmin">
+    <!-- include "menu" -->
+    <div class="adminContent">
+        <div class="adminMain">
+            <form class="form-horizontal">
+                <fieldset>
+                    <legend>短信通知</legend>
+                    <div id="switchon" class="control-group <!-- if {{smsSwitch}}=='1' --> hide <!-- endif -->">
+                        <label class="control-label">开启短信通知功能</label>
+                        <div class="controls">
+                            <div class="btn-group">
+                                <input type="button" class="btn" id="smsOn" title="开启短信通知" value="开启"/>
+                                <button class="btn btn-danger disabled" disabled="disabled">已关闭</button>
+                            </div>
+                        </div>
+                    </div>
+                    <div id="switchoff" class="control-group <!-- if {{smsSwitch}}=='0' --> hide <!-- endif -->">
+                        <label class="control-label">开启短信通知功能</label>
+                        <div class="controls">
+                            <div class="btn-group">
+                                <button class="btn btn-success  disabled" disabled="disabled">已开启</button>
+                                <input type="button" class="btn" id="smsOff" title="关闭短信通知" value="关闭"/>
+                            </div>
+                        </div>
+                    </div>
+                    <div id="alert-open" class="alert alert-info hide">
+                        初次开启,所有用户都必须进行手机验证才能正常接收短信通知。
+                    </div>
+                    <div id="alert-close" class="alert alert-error hide">
+                        短信通知已关闭,所有用户都将不会再接收短信通知。
+                    </div>
+                </fieldset>
+            </form>
+        </div>
+    </div>
+</div>
+<script type="text/javascript">autoFlashHeight();</script>
+<script type="text/javascript">
+    $(document).ready(function () {
+        $("#smsOff").click(function () {
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"switch": 'off'},
+                url: "{{rootUrl}}manage/sys/sms/switch"
+            }).done(function (data) {
+                if (data['switch'] == 'off') {
+                    $("#switchoff").fadeOut();
+                    $("#switchon").fadeIn();
+                    $("#alert-open").fadeOut();
+                    $("#alert-close").fadeIn();
+                }
+            });
+        });
+        $("#smsOn").click(function () {
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"switch": 'on'},
+                url: "{{rootUrl}}manage/sys/sms/switch",
+            }).done(function (data) {
+                if (data['switch'] == 'on') {
+                    $("#switchon").fadeOut();
+                    $("#switchoff").fadeIn();
+                    $("#alert-close").fadeOut();
+                    $("#alert-open").fadeIn();
+                }
+            });
+        });
+    });
+
+</script>
+</body>

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 90 - 81
protected/module/admin/view/admin-userlist.html


+ 1 - 0
protected/module/admin/view/menu.html

@@ -1,6 +1,7 @@
 <div class="adminSidebar fL">
     <ul>
         <li><a href="{{rootUrl}}manage/sys/info"<!-- if {{menu}}=='1' --> class="now" <!-- endif -->>系统信息</a></li>
+        <li><a href="{{rootUrl}}manage/sys/sms/switch"<!-- if {{menu}}=='4' --> class="now" <!-- endif -->>短信通知</a></li>
         <li><a href="{{rootUrl}}manage/user/list"<!-- if {{menu}}=='2' --> class="now" <!-- endif -->>用户列表</a></li>
         <li><a href="{{rootUrl}}manage/user/add"<!-- if {{menu}}=='3' --> class="now" <!-- endif -->>添加用户</a></li>
     </ul>

+ 75 - 80
protected/view/edit-profile-avtra.html

@@ -1,89 +1,84 @@
 <!DOCTYPE html>
 <html lang=zh-cn>
-    <head>
-	<meta charset=utf-8>
-	<title>纵横计量支付系统</title>
-	<meta name=description content=计量支付>
-	<meta name=copyright content=smartcost.com.cn>
-		<meta name="viewport" content="width=device-width,initial-scale=1.0">
-	<link rel=stylesheet href="{{rootUrl}}global/css/bootstrap.css">
-	<link rel=stylesheet href={{rootUrl}}global/css/style.css>
-	<script src={{rootUrl}}global/js/jquery-1.9.1.min.js></script>
-	<script src={{rootUrl}}global/js/bootstrap.js></script>
-	<script src={{rootUrl}}global/js/jl.js></script>
-    </head>
-    <body>
-	<!-- include "top" -->
-	<div class="wrapContent">
-	    <!-- include "left" -->
-	    <div class="mainContainer">
-		<!--内容-->
-		<div class="mainContent">
-		    <div class="title clearfix">
-			<div class="fR">
-			    <button class="btn btn-link" type="button"><i class="icon-question-sign"></i>&nbsp;帮助</button>
-			</div>
-		    </div>
-		    <div class="form">
-			<legend>修改头像</legend>
-			<div class="clearfix">
-			    <p id="swfContainer">
-				本组件需要安装Flash Player后才可使用,请从<a href="http://www.adobe.com/go/getflashplayer">这里</a>下载安装。
-			    </p>
-			</div>
-		    </div>
-		</div>
-		<!--内容-->
-	    </div>
-	</div>
-	<script type="text/javascript">autoFlashHeight();</script>
-	<script type="text/javascript" src="{{rootUrl}}global/avaup/scripts/swfobject.js"></script>
-        <script type="text/javascript" src="{{rootUrl}}global/avaup/scripts/fullAvatarEditor.js"></script>
-	<script type="text/javascript">
-swfobject.addDomLoadEvent(function () {
-    var swf = new fullAvatarEditor("swfContainer", {
-	id: 'swf',
-	upload_url: '{{rootUrl}}user/avatar',
-	src_upload: 2,
-	    avatar_sizes : '100*100|96*96|48*48',
-    avatar_sizes_desc : '100*100像素|96*96像素|48*48像素',
-    }, function (msg) {
-	switch (msg.code)
-	{
-	    case 1 :
+<head>
+    <meta charset=utf-8>
+    <title>纵横计量支付系统</title>
+    <meta name=description content=计量支付>
+    <meta name=copyright content=smartcost.com.cn>
+    <meta name="viewport" content="width=device-width,initial-scale=1.0">
+    <link rel=stylesheet href="{{rootUrl}}global/css/bootstrap.css">
+    <link rel=stylesheet href={{rootUrl}}global/css/style.css>
+    <script src={{rootUrl}}global/js/jquery-1.9.1.min.js></script>
+    <script src={{rootUrl}}global/js/bootstrap.js></script>
+    <script src={{rootUrl}}global/js/jl.js></script>
+</head>
+<body>
+<!-- include "top" -->
+<div class="wrapContent">
+    <!-- include "left" -->
+    <div class="mainContainer">
+        <!--内容-->
+        <div class="mainContent">
+            <div class="title clearfix">
+                <div class="fR">
+                    <button class="btn btn-link" type="button"><i class="icon-question-sign"></i>&nbsp;帮助</button>
+                </div>
+            </div>
+            <div class="form">
+                <legend>修改头像</legend>
+                <div class="clearfix">
+                    <p id="swfContainer">
+                        本组件需要安装Flash Player后才可使用,请从<a href="http://www.adobe.com/go/getflashplayer">这里</a>下载安装。
+                    </p>
+                </div>
+            </div>
+        </div>
+        <!--内容-->
+    </div>
+</div>
+<script type="text/javascript">autoFlashHeight();</script>
+<script type="text/javascript" src="{{rootUrl}}global/avaup/scripts/swfobject.js"></script>
+<script type="text/javascript" src="{{rootUrl}}global/avaup/scripts/fullAvatarEditor.js"></script>
+<script type="text/javascript">
+    swfobject.addDomLoadEvent(function () {
+        var swf = new fullAvatarEditor("swfContainer", {
+                    id: 'swf',
+                    upload_url: '{{rootUrl}}user/avatar',
+                    src_upload: 2,
+                    avatar_sizes: '100*100|96*96|48*48',
+                    avatar_sizes_desc: '100*100像素|96*96像素|48*48像素',
+                }, function (msg) {
+                    switch (msg.code) {
+                        case 1 :
 //		alert("页面成功加载了组件!");
-		break;
-	    case 2 :
+                            break;
+                        case 2 :
 //		alert("已成功加载默认指定的图片到编辑面板。");
-		break;
-	    case 3 :
-		if (msg.type == 0)
-		{
+                            break;
+                        case 3 :
+                            if (msg.type == 0) {
 //		    alert("摄像头已准备就绪且用户已允许使用。");
-		}
-		else if (msg.type == 1)
-		{
+                            }
+                            else if (msg.type == 1) {
 //		    alert("摄像头已准备就绪但用户未允许使用!");
-		}
-		else
-		{
+                            }
+                            else {
 //		    alert("摄像头被占用!");
-		}
-		break;
-	    case 5 :
-		if (msg.type == 0)
-		{
-		    windows.location.href = '/user/profile';
+                            }
+                            break;
+                        case 5 :
+                            if (msg.type == 0) {
+                                windows.location.href = '/user/profile';
 
-		}
-		break;
-	}
-    }
-    );
-    document.getElementById("upload").onclick = function () {
-	swf.call("upload");
-    };
-});
-        </script>
-    </body>
+                            }
+                            break;
+                    }
+                }
+        );
+        document.getElementById("upload").onclick = function () {
+            swf.call("upload");
+        };
+    });
+</script>
+</body>
 </html>

+ 169 - 0
protected/view/edit-profile-sms-edit.html

@@ -0,0 +1,169 @@
+<!DOCTYPE html>
+<html lang=zh-cn>
+<head>
+    <meta charset=utf-8>
+    <title>纵横计量支付系统</title>
+    <meta name=description content=计量支付>
+    <meta name=copyright content=smartcost.com.cn>
+    <link rel=stylesheet href="{{rootUrl}}global/css/bootstrap.css">
+    <link rel=stylesheet href={{rootUrl}}global/css/style.css>
+    <script src={{rootUrl}}global/js/jquery-1.9.1.min.js></script>
+    <script src={{rootUrl}}global/js/bootstrap.js></script>
+    <script src={{rootUrl}}global/js/jl.js></script>
+    <script src={{rootUrl}}global/js/jquery.cookie.min.js></script>
+</head>
+<body>
+<!-- include "top" -->
+<div class="wrapContent">
+    <!-- include "left" -->
+    <div class="mainContainer">
+        <!--内容-->
+        <div class="mainContent">
+            <div class="title clearfix">
+                <div class="fR">
+                    <button class="btn btn-link" type="button"><i class="icon-question-sign"></i>&nbsp;帮助</button>
+                </div>
+            </div>
+            <div class="form">
+                <form class="form-horizontal">
+                    <legend>短信通知-修改手机</legend>
+                    <div class="control-group">
+                        <label class="control-label" for="inputEmail">当前手机</label>
+                        <div class="controls">
+                            <input type="text" placeholder="{{uprofile.mobile}}" disabled="">
+                        </div>
+                    </div>
+                    <div id="input_error" class="control-group">
+                        <label class="control-label" for="inputEmail">新手机</label>
+                        <div class="controls">
+                            <input id="mobile" name="mobile" type="text" placeholder="输入您的新手机号码"><span id="help-inline"
+                                                                                                       class="help-inline hide"></span>
+                        </div>
+                    </div>
+                    <div class="control-group">
+                        <label class="control-label" for="inputEmail">短信校验码</label>
+                        <div class="controls">
+                            <input type="text" id="verifycode" name="verifycode" placeholder="输入验证码" maxlength="11"
+                                   class="span2">
+                            <!--<button class="btn">获取验证码</button>-->
+                            <!--<button class="btn" disabled>重新获取 60s</button>-->
+                            <input type="button" class="btn" id="getting" value="获取验证码">
+                        </div>
+                    </div>
+                    <div class="control-group">
+                        <label class="control-label"></label>
+                        <div class="controls">
+                            <i class="icon-ok icon-white"></i><input type="button" id="addMobile"
+                                                                     class="btn btn-primary" value="确定修改"/>
+                        </div>
+                    </div>
+                    </fieldset>
+                </form>
+            </div>
+        </div>
+        <!--内容-->
+    </div>
+</div>
+<script type="text/javascript">autoFlashHeight();</script>
+<script type="text/javascript">
+    $(document).ready(function () {
+        $("#mobile").blur(function () {
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"mobile": $(this).val()},
+                url: "{{rootUrl}}user/profile/check/mobile",
+            }).done(function (data) {
+                if (data['mobile'] > 0) {
+                    $("#input_error").addClass('error');
+                    $("#help-inline").html('手机号码已被使用');
+                    $("#help-inline").show();
+                } else {
+                    $("#input_error").removeClass('error');
+                    $("#help-inline").hide();
+                }
+            });
+        });
+
+
+        /*仿刷新:检测是否存在cookie*/
+        if ($.cookie("sms")) {
+            var count = $.cookie("sms");
+            var btn = $('#getting');
+            btn.val('重新获取 ' + count + 's').attr('disabled', true).css('cursor', 'not-allowed');
+            var resend = setInterval(function () {
+                count--;
+                if (count > 0) {
+                    btn.val('重新获取 ' + count + 's').attr('disabled', true).css('cursor', 'not-allowed');
+                    $.cookie("sms", count, {path: '/', expires: (1 / 86400) * count});
+                } else {
+                    clearInterval(resend);
+                    btn.val("获取验证码").removeClass('disabled').removeAttr('disabled style');
+                }
+            }, 1000);
+        }
+
+        /*点击改变按钮状态,已经简略掉ajax发送短信验证的代码*/
+        $('#getting').click(function () {
+            var btn = $(this);
+            if ($("#mobile").val() == '') {
+                $("#input_error").addClass('error');
+                $("#help-inline").html('手机号码不能为空');
+                $("#help-inline").show();
+                return false;
+            }
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"mobile": $("#mobile").val()},
+                url: "{{rootUrl}}user/profile/check/mobile",
+            }).done(function (data) {
+                if (data['mobile'] > 0) {
+                    $("#input_error").addClass('error');
+                    $("#help-inline").html('手机号码已被使用');
+                    $("#help-inline").show();
+                    return false;
+                } else {
+                    $("#input_error").removeClass('error');
+                    $("#help-inline").hide();
+                    $.ajax({
+                        type: "POST",
+                        dataType: "json",
+                        cache: false,
+                        data: {"mobile": $("#mobile").val()},
+                        url: "{{rootUrl}}user/profile/sms/send/verify",
+                    }).done(function (data) {
+                    });
+                    var count = 60;
+                    var resend = setInterval(function () {
+                        count--;
+                        if (count > 0) {
+                            btn.val('重新获取 ' + count + 's');
+                            $.cookie("sms", count, {path: '/', expires: (1 / 86400) * count});
+                        } else {
+                            clearInterval(resend);
+                            btn.val("获取验证码").removeAttr('disabled style');
+                        }
+                    }, 1000);
+                    btn.attr('disabled', true).css('cursor', 'not-allowed');
+                }
+            });
+        });
+
+        /*点击改变按钮状态,已经简略掉ajax发送短信验证的代码*/
+        $('#addMobile').click(function () {
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"mobile": $("#mobile").val(), "verifycode": $("#verifycode").val()},
+                url: "{{rootUrl}}user/profile/sms/edit",
+            }).done(function (data) {
+                window.location.reload(true);
+            });
+        });
+    });
+</script>
+</body>

+ 205 - 0
protected/view/edit-profile-sms.html

@@ -0,0 +1,205 @@
+<!DOCTYPE html>
+<html lang=zh-cn>
+<head>
+    <meta charset=utf-8>
+    <title>纵横计量支付系统</title>
+    <meta name=description content=计量支付>
+    <meta name=copyright content=smartcost.com.cn>
+    <link rel=stylesheet href="{{rootUrl}}global/css/bootstrap.css">
+    <link rel=stylesheet href={{rootUrl}}global/css/style.css>
+    <script src={{rootUrl}}global/js/jquery-1.9.1.min.js></script>
+    <script src={{rootUrl}}global/js/bootstrap.js></script>
+    <script src={{rootUrl}}global/js/jl.js></script>
+    <script src={{rootUrl}}global/js/jquery.cookie.min.js></script>
+</head>
+<body>
+<!-- include "top" -->
+<div class="wrapContent">
+    <!-- include "left" -->
+    <div class="mainContainer">
+        <!--内容-->
+        <div class="mainContent">
+            <div class="title clearfix">
+                <div class="fR">
+                    <button class="btn btn-link" type="button"><i class="icon-question-sign"></i>&nbsp;帮助</button>
+                </div>
+            </div>
+            <div class="form">
+                <form class="form-horizontal">
+                    <legend>短信通知</legend>
+                    <!-- if {{smsNoticeSwitch}} < 1 -->
+                    <!--管理员关闭功能-->
+                    <div class="alert alert-error">
+                        短信通知功能已被关闭。
+                    </div>
+                    <!--管理员关闭功能-->
+                    <!-- else -->
+                    <!-- if {{uprofile.isnotice}} < 1 -->
+                    <!--初次使用-->
+                    <div class="alert alert-info">
+                        初次使用,请先添加用于接收通知的手机号码。
+                    </div>
+                    <div id="input_error" class="control-group">
+                        <label class="control-label" for="inputEmail">添加手机</label>
+                        <div class="controls">
+                            <input id="mobile" name="mobile" type="text" placeholder="输入您的新手机号码"><span id="help-inline"
+                                                                                                       class="help-inline hide"></span>
+                        </div>
+                    </div>
+                    <div class="control-group">
+                        <label class="control-label" for="inputEmail">短信校验码</label>
+                        <div class="controls">
+                            <input type="text" id="verifycode" name="verifycode" placeholder="输入验证码" maxlength="11"
+                                   class="span2">
+                            <!--<button class="btn">获取验证码</button>-->
+                            <!--<button class="btn" disabled>重新获取 60s</button>-->
+                            <input type="button" class="btn" id="getting" value="获取验证码">
+                        </div>
+                    </div>
+                    <div class="control-group">
+                        <label class="control-label"></label>
+                        <div class="controls">
+                            <i class="icon-ok icon-white"></i><input type="button" id="addMobile"
+                                                                     class="btn btn-primary" value="确定添加"/>
+                        </div>
+                    </div>
+                    <!--初次使用-->
+                    <!-- else -->
+                    <!--正常使用-->
+                    <div class="control-group">
+                        <label class="control-label" for="inputEmail">接收手机</label>
+                        <div class="controls">
+                            <input type="text" value="{{uprofile.mobile}}" disabled="">&nbsp;<a
+                                href="{{rootUrl}}user/profile/sms/edit">修改手机</a>
+                        </div>
+                    </div>
+                    <div class="control-group">
+                        <label class="control-label" for="inputEmail">通知类型</label>
+                        <div class="controls">
+                            <label class="checkbox inline">
+                                <input type="checkbox" checked value="option1" disabled> 到我审批
+                            </label>
+                        </div>
+                    </div>
+                    <!--正常使用-->
+                    <!-- endif -->
+                    <!-- endif -->
+                    </fieldset>
+                </form>
+            </div>
+        </div>
+        <!--内容-->
+    </div>
+</div>
+<script type="text/javascript">autoFlashHeight();</script>
+<script type="text/javascript">
+    $(document).ready(function () {
+        $("#mobile").blur(function () {
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"mobile": $(this).val()},
+                url: "{{rootUrl}}user/profile/check/mobile",
+                success: function(data){
+                    if (data["mobile"] > 0) {
+                        $("#input_error").addClass('error');
+                        $("#help-inline").html('手机号码已被使用');
+                        $("#help-inline").show();
+                    } else {
+                        $("#input_error").removeClass('error');
+                        $("#help-inline").hide();
+                    }
+              	}
+            });
+        });
+
+
+        /*仿刷新:检测是否存在cookie*/
+        if ($.cookie("sms")) {
+            var count = $.cookie("sms");
+            var btn = $('#getting');
+            btn.val('重新获取 ' + count + 's').attr('disabled', true).css('cursor', 'not-allowed');
+            var resend = setInterval(function () {
+                count--;
+                if (count > 0) {
+                    btn.val('重新获取 ' + count + 's').attr('disabled', true).css('cursor', 'not-allowed');
+                    $.cookie("sms", count, {path: '/', expires: (1 / 86400) * count});
+                } else {
+                    clearInterval(resend);
+                    btn.val("获取验证码").removeClass('disabled').removeAttr('disabled style');
+                }
+            }, 1000);
+        }
+
+        /*点击改变按钮状态,已经简略掉ajax发送短信验证的代码*/
+        $('#getting').click(function () {
+            var btn = $(this);
+            if ($("#mobile").val() == '') {
+                $("#input_error").addClass('error');
+                $("#help-inline").html('手机号码不能为空');
+                $("#help-inline").show();
+                return false;
+            }
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"mobile": $("#mobile").val()},
+                url: "{{rootUrl}}user/profile/check/mobile",
+                success: function(data){
+                  if (data["mobile"] > 0) {
+                      $("#input_error").addClass('error');
+                      $("#help-inline").html('手机号码已被使用');
+                      $("#help-inline").show();
+                      return false;
+                  } else {
+                      $("#input_error").removeClass('error');
+                      $("#help-inline").hide();
+                      $.ajax({
+                          type: "POST",
+                          dataType: "json",
+                          cache: false,
+                          data: {"mobile": $("#mobile").val()},
+                          url: "{{rootUrl}}user/profile/sms/send/verify",
+                          success: function(data){
+                            if(data["verify"]==true){
+                              var count = 60;
+                              var resend = setInterval(function () {
+                                  count--;
+                                  if (count > 0) {
+                                      btn.val('重新获取 ' + count + 's');
+                                      $.cookie("sms", count, {path: '/', expires: (1 / 86400) * count});
+                                  } else {
+                                      clearInterval(resend);
+                                      btn.val("获取验证码").removeAttr('disabled style');
+                                  }
+                              }, 1000);
+                              btn.attr('disabled', true).css('cursor', 'not-allowed');
+                            }
+                          }
+                      });
+                  }
+                }
+            });
+        });
+
+        /*点击改变按钮状态,已经简略掉ajax发送短信验证的代码*/
+        $('#addMobile').click(function () {
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                cache: false,
+                data: {"mobile": $("#mobile").val(), "verifycode": $("#verifycode").val()},
+                url: "{{rootUrl}}user/profile/sms",
+                error: function (err) {
+                    alert(err);
+                },
+                success: function () {
+                    window.location.href = "{{rootUrl}}user/profile/sms";
+                }
+            });
+        });
+    });
+</script>
+</body>

+ 94 - 91
protected/view/edit-profile.html

@@ -1,94 +1,97 @@
 <!DOCTYPE html>
 <html lang=zh-cn>
-    <head>
-	<meta charset=utf-8>
-	<title>纵横计量支付系统</title>
-	<meta name=description content=计量支付>
-	<meta name=copyright content=smartcost.com.cn>
-		<meta name="viewport" content="width=device-width,initial-scale=1.0">
-	<link rel=stylesheet href="{{rootUrl}}global/css/bootstrap.css">
-	<link rel=stylesheet href={{rootUrl}}global/css/style.css>
-	<script src={{rootUrl}}global/js/jquery-1.9.1.min.js></script>
-	<script src={{rootUrl}}global/js/bootstrap.js></script>
-	<script src={{rootUrl}}global/js/jl.js></script>
-    </head>
-    <body>
-	<!-- include "top" -->
-	<div class="wrapContent">
-	    <!-- include "left" -->
-	    <div class="mainContainer">
-		<!--内容-->
-		<div class="mainContent">
-		    <div class="title clearfix">
-			<div class="fR">
-			    <button class="btn btn-link" type="button"><i class="icon-question-sign"></i>&nbsp;帮助</button>
-			</div>
-		    </div>
-		    <div class="form">
-			<form class="form-horizontal" action="{{rootUrl}}user/profile" method="post">
-			    <legend>编辑个人信息</legend>
-			    <div class="control-group">
-				<label class="control-label" for="inputEmail">头像</label>
-				<div class="controls">
-				    <img src="{{rootUrl}}{{user.avatar}}"> <a href="{{rootUrl}}user/avatar">更换</a>
-				</div>
-			    </div>
-			    <div class="control-group">
-				<label class="control-label" for="inputEmail">邮箱(登录账号)</label>
-				<div class="controls">
-				    <input type="text" value="{{uprofile.email}}" disabled="">&nbsp;<a href="{{rootUrl}}user/repasswd">修改密码</a>
-				</div>
-			    </div>
-			    <div class="control-group">
-				<label class="control-label" for="inputEmail">姓名</label>
-				<div class="controls">
-				    <input type="text" name="name" value="{{uprofile.name}}" placeholder="输入您的姓名">
-				</div>
-			    </div>
-			    <div class="control-group">
-				<label class="control-label" for="inputEmail">单位(公司)名称</label>
-				<div class="controls">
-				    <input type="text" name="company" value="{{uprofile.company}}" placeholder="输入您的单位或者公司名称" >
-				</div>
-			    </div>
-			    <div class="control-group">
-				<label class="control-label" for="inputEmail">职位</label>
-				<div class="controls">
-				    <input type="text" name="jobs" value="{{uprofile.jobs}}" placeholder="输入您的职位">
-				</div>
-			    </div>
-			    <div class="control-group">
-				<label class="control-label" for="inputEmail">联系电话</label>
-				<div class="controls">
-				    <div class="input-prepend">
-					<span class="add-on">固话</span>
-					<input type="text" name="phone" value="{{uprofile.phone}}" placeholder="格式:0000-00000000" style="width:167px">
-				    </div>
-				    <div class="input-prepend">
-					<span class="add-on">手机</span>
-					<input type="text" name="mobile" value="{{uprofile.mobile}}" placeholder="输入11位手机号码"  class="span2">
-				    </div>
-				</div>
-			    </div>
-			    <div class="control-group">
-				<label class="control-label" for="inputEmail">QQ</label>
-				<div class="controls">
-				    <input type="text" name="qq" value="{{uprofile.qq}}" placeholder="输入您的QQ号码">
-				</div>
-			    </div>
-			    <div class="control-group">
-				<label class="control-label"></label>
-				<div class="controls">
-				    <input type="submit" class="btn btn-primary" value="确定提交"><i class="icon-ok icon-white"></i>&nbsp;</input>
-				</div>
-			    </div>
-			    </fieldset>
-			</form>
-		    </div>
-		</div>
-		<!--内容-->
-	    </div>
-	</div>
-	<script type="text/javascript">autoFlashHeight();</script>
-    </body>
+<head>
+    <meta charset=utf-8>
+    <title>纵横计量支付系统</title>
+    <meta name=description content=计量支付>
+    <meta name=copyright content=smartcost.com.cn>
+    <meta name="viewport" content="width=device-width,initial-scale=1.0">
+    <link rel=stylesheet href="{{rootUrl}}global/css/bootstrap.css">
+    <link rel=stylesheet href={{rootUrl}}global/css/style.css>
+    <script src={{rootUrl}}global/js/jquery-1.9.1.min.js></script>
+    <script src={{rootUrl}}global/js/bootstrap.js></script>
+    <script src={{rootUrl}}global/js/jl.js></script>
+</head>
+<body>
+<!-- include "top" -->
+<div class="wrapContent">
+    <!-- include "left" -->
+    <div class="mainContainer">
+        <!--内容-->
+        <div class="mainContent">
+            <div class="title clearfix">
+                <div class="fR">
+                    <button class="btn btn-link" type="button"><i class="icon-question-sign"></i>&nbsp;帮助</button>
+                </div>
+            </div>
+            <div class="form">
+                <form class="form-horizontal" action="{{rootUrl}}user/profile" method="post">
+                    <legend>编辑个人信息</legend>
+                    <div class="control-group">
+                        <label class="control-label" for="inputEmail">头像</label>
+                        <div class="controls">
+                            <img src="{{rootUrl}}{{user.avatar}}"> <a href="{{rootUrl}}user/avatar">更换</a>
+                        </div>
+                    </div>
+                    <div class="control-group">
+                        <label class="control-label" for="inputEmail">邮箱(登录账号)</label>
+                        <div class="controls">
+                            <input type="text" value="{{uprofile.email}}" disabled="">&nbsp;<a
+                                href="{{rootUrl}}user/repasswd">修改密码</a>
+                        </div>
+                    </div>
+                    <div class="control-group">
+                        <label class="control-label" for="inputEmail">姓名</label>
+                        <div class="controls">
+                            <input type="text" name="name" value="{{uprofile.name}}" placeholder="输入您的姓名">
+                        </div>
+                    </div>
+                    <div class="control-group">
+                        <label class="control-label" for="inputEmail">单位(公司)名称</label>
+                        <div class="controls">
+                            <input type="text" name="company" value="{{uprofile.company}}" placeholder="输入您的单位或者公司名称">
+                        </div>
+                    </div>
+                    <div class="control-group">
+                        <label class="control-label" for="inputEmail">职位</label>
+                        <div class="controls">
+                            <input type="text" name="jobs" value="{{uprofile.jobs}}" placeholder="输入您的职位">
+                        </div>
+                    </div>
+                    <div class="control-group">
+                        <label class="control-label" for="inputEmail">联系电话</label>
+                        <div class="controls">
+                            <div class="input-prepend">
+                                <span class="add-on">固话</span>
+                                <input type="text" name="phone" value="{{uprofile.phone}}"
+                                       placeholder="格式:0000-00000000" style="width:167px">
+                            </div>
+                            <div class="input-prepend">
+                                <span class="add-on">手机</span>
+                                <input type="text" disabled="disabled" value="{{uprofile.mobile}}" placeholder="输入11位手机号码"
+                                       class="span2">
+                            </div>
+                        </div>
+                    </div>
+                    <div class="control-group">
+                        <label class="control-label" for="inputEmail">QQ</label>
+                        <div class="controls">
+                            <input type="text" name="qq" value="{{uprofile.qq}}" placeholder="输入您的QQ号码">
+                        </div>
+                    </div>
+                    <div class="control-group">
+                        <label class="control-label"></label>
+                        <div class="controls">
+                            <input type="submit" class="btn btn-primary" value="确定提交"><i class="icon-ok icon-white"></i>&nbsp;</input>
+                        </div>
+                    </div>
+                    </fieldset>
+                </form>
+            </div>
+        </div>
+        <!--内容-->
+    </div>
+</div>
+<script type="text/javascript">autoFlashHeight();</script>
+</body>
 </html>

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 298 - 273
protected/view/r-project-section-detail.html


+ 154 - 0
protected/view/r-project-section-files.html

@@ -0,0 +1,154 @@
+<!DOCTYPE html>
+<html lang=zh-cn>
+<head>
+    <meta charset=utf-8>
+    <title>纵横计量支付系统</title>
+    <meta name=description content=计量支付>
+    <meta name=copyright content=smartcost.com.cn>
+    <link rel=stylesheet href={{rootUrl}}global/css/fixedheadertable.css>
+    <link rel=stylesheet href="{{rootUrl}}global/css/bootstrap.css">
+    <link rel=stylesheet href="{{rootUrl}}global/css/style.css">
+    <script src="{{rootUrl}}global/js/jquery-1.9.1.min.js"></script>
+    <script src="{{rootUrl}}global/js/bootstrap.js"></script>
+    <script src="{{rootUrl}}global/js/jl.js"></script>
+    <script src={{rootUrl}}global/js/jquery.fixedheadertable.js></script>
+</head>
+<body>
+<!-- include "top" -->
+<div class="wrapContent">
+    <!-- include "left" -->
+    <div class="mainContainer">
+        <!--内容-->
+        <div class="mainContent">
+            <div class="title clearfix">
+                <ul class="nav nav-pills">
+                    <li class="dropdown"><a title="返回" href="{{rootUrl}}rproject/{{pid}}/section"><span
+                            class="closePanel" aria-hidden="true" data-icon="Z"></span></a></li>
+                    <li class="dropdown">
+                        <a href="{{rootUrl}}sproject/{{currproArray.pid}}/section" data-toggle="dropdown"
+                           class="dropdown-toggle">
+                            {{currproArray.pname}}<b class="caret"></b>
+                        </a>
+                        <ul class="dropdown-menu">
+                            <!-- loop allproArray -->
+                            <li><a href="{{rootUrl}}sproject/{{allproArray' value.pid}}/section">{{allproArray'
+                                value.pname}}</a></li>
+                            <!-- endloop -->
+                        </ul>
+                    </li>
+                </ul>
+            </div>
+            <!--导航-->
+            <ul class="nav nav-tabs">
+                <li>
+                    <a href="{{rootUrl}}rproject/{{pid}}/section/{{pmid}}/detail">标段概况</a>
+                </li>
+                <li class="active">
+                    <a href="/rproject/{{pid}}/section/{{pmid}}/files/{{mpid}}">附件</a>
+                </li>
+                <!-- if {{mpid}}>0 -->
+                <li>
+                    <a href="{{rootUrl}}rproject/{{pid}}/section/{{pmid}}/report/{{mpid}}">审批</a>
+                </li>
+                <!-- endif -->
+            </ul>
+            <!--导航-->
+            <!--文件管理-->
+            <div class="filesWrap">
+                <div class="filesList">
+                    <table class="table table-striped table-hover">
+                        <thead>
+                        <tr>
+                            <th width="">文件名</th>
+                            <th width="">节点</th>
+                            <th width="">上传者</th>
+                            <th width="">上传时间</th>
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <!-- loop itematta -->
+                        <tr>
+                            <td width=""><span class="fileico ico-{{itematta' value.fileext}}"></span><a
+                                    fileext="{{itematta' value.fileext}}"
+                                    iaid="{{itematta' value.iaid}}"
+                                    filename="{{itematta' value.filename}}"
+                                    realname="{{itematta' value.realname}}"
+                                    intime="{{formatDate(itematta' value.intime,'Y-m-d')}}"
+                                    tips="{{itematta' value.tips}}"
+                                    href="#"
+                                    numpname="第{{ToChinaseNum(itematta' value.numpname)}}期"
+                                    id="fname_{{itematta' value.imnid}}">{{itematta' value.filename}}</a></td>
+                            <td>{{itematta' value.pmname}}</td>
+                            <td width="">{{itematta' value.realname}}</td>
+                            <td width="">{{formatDate(itematta' value.intime,'Y-m-d')}}</td>
+                        </tr>
+                        <!-- endloop -->
+                        </tbody>
+                    </table>
+                </div>
+                <div class="filesDetail">
+                    <table class="table table-striped">
+                        <thead>
+                        <tr>
+                            <th colspan="4">文件详情</th>
+                            <input type="hidden" value="" id="uuid"/>
+                        </tr>
+                        </thead>
+                        <tr>
+                            <th width="60">文件名</th>
+                            <td colspan="3"><a href="#" id="filename" target="_blank">K0+800-K1+000图纸</a><span
+                                    class="fR"><button
+                                    class="btn btn-mini btn-primary" id="filedown"
+                                    type="button">下载</button></span></td>
+                        </tr>
+                        <tr>
+                            <th width="60">格式</th>
+                            <td id="fileext"><span class="fileico ico-jpg"></span>.jpg</td>
+                            <th width="60">所在类</th>
+                            <td>台帐附件</td>
+                        </tr>
+                        <tr>
+                            <th width="60">上传者</th>
+                            <td id="realname">陈工</td>
+                            <th width="60">上传时间</th>
+                            <td id="intime">2014-11-20 14:20</td>
+                        </tr>
+                        <tr>
+                            <th width="60">备注/描述</th>
+                            <td id="tips" colspan="3">内容内容内容内容</td>
+                        </tr>
+                    </table>
+                </div>
+            </div>
+            <!--文件管理-->
+        </div>
+        <!--内容-->
+    </div>
+</div>
+<script type="text/javascript">autoFlashHeight();</script>
+<script type="text/javascript">
+    $(document).ready(function () {
+        $("a[id^='fname_']").click(function () {
+            var fileext = $(this).attr('fileext');
+            var filename = $(this).attr('filename');
+            var realname = $(this).attr('realname');
+            var intime = $(this).attr('intime');
+            var tips = $(this).attr('tips');
+            var numpname = $(this).attr('numpname');
+            var iaid = $(this).attr('iaid');
+            $("#filename").html(filename);
+            $("#fileico").html(fileext);
+            $("#realname").html(realname);
+            $("#intime").html(intime);
+            $("#tips").html(tips);
+            $("#numpname").html(numpname);
+            $("#fileext").html(fileext);
+            $("#uuid").val(iaid);
+        });
+        $("#filedown").click(function () {
+            var uuid = $("#uuid").val();
+            location.href = "{{rootUrl}}rproject/section/get/" + uuid + "/attachment";
+        });
+    });
+</script>
+</body>

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 191 - 162
protected/view/r-project-section-report.html


+ 13 - 11
protected/view/top.html

@@ -1,16 +1,18 @@
 <div class="wrapHeader">
     <h1 title="纵横计量支付" class="mainLogo"></h1>
     <div class="userInfo"><img src="{{rootUrl}}{{user.avatar}}" class="fR">
-	<div class="btn-group">
-	    <button data-toggle="dropdown" class="btn dropdown-toggle">{{user.name}}&nbsp;<span class="caret"></span></button>
-	    <ul class="dropdown-menu">
-		<li><a href="{{rootUrl}}user/profile">个人信息</a></li>
-		<li class="hide"><a href="#"><span data-icon="r" aria-hidden="true"></span>&nbsp;工作组</a></li>
-		<li class="hide"><a href="#"><span data-icon="B" aria-hidden="true"></span>&nbsp;我的任务</a></li>
-		<li class="divider"></li>
-		<li class="hide"><a href="#">帮助中心</a></li>
-		<li><a href="{{rootUrl}}signout">退出</a></li>
-	    </ul>
-	</div>
+        <div class="btn-group">
+            <button data-toggle="dropdown" class="btn dropdown-toggle">{{user.name}}&nbsp;<span class="caret"></span>
+            </button>
+            <ul class="dropdown-menu">
+                <li><a href="{{rootUrl}}user/profile">个人信息</a></li>
+                <li><a href="{{rootUrl}}user/profile/sms">短信通知</a></li>
+                <li class="hide"><a href="#"><span data-icon="r" aria-hidden="true"></span>&nbsp;工作组</a></li>
+                <li class="hide"><a href="#"><span data-icon="B" aria-hidden="true"></span>&nbsp;我的任务</a></li>
+                <li class="divider"></li>
+                <li class="hide"><a href="#">帮助中心</a></li>
+                <li><a href="{{rootUrl}}signout">退出</a></li>
+            </ul>
+        </div>
     </div>
 </div>

+ 3 - 0
protected/view/w-project-section-detail.html

@@ -55,6 +55,9 @@
 			<li class="active">
 			    <a href="{{rootUrl}}project/{{pid}}/section/{{pmid}}/detail">标段概况</a>
 			</li>
+				<li>
+					<a href="{{rootUrl}}project/{{pid}}/section/{{pmid}}/files/{{mpid}}">附件</a>
+				</li>
 <!--			<li><a href="/project/{{pid}}/section/{{pmid}}/measure">计量台帐</a></li>-->
 		    </ul>
 		    <!--导航-->

+ 254 - 0
protected/view/w-project-section-files-recover.html

@@ -0,0 +1,254 @@
+<!DOCTYPE html>
+<html lang=zh-cn>
+<head>
+    <meta charset=utf-8>
+    <title>纵横计量支付系统</title>
+    <meta name=description content=计量支付>
+    <meta name=copyright content=smartcost.com.cn>
+    <link rel=stylesheet href={{rootUrl}}global/css/fixedheadertable.css>
+    <script src={{rootUrl}}global/js/jquery.fixedheadertable.js></script>
+    <link rel=stylesheet href="{{rootUrl}}global/css/bootstrap.css">
+    <link rel=stylesheet href="{{rootUrl}}global/css/style.css">
+    <script src="{{rootUrl}}global/js/jquery-1.9.1.min.js"></script>
+    <script src="{{rootUrl}}global/js/bootstrap.js"></script>
+    <script src="{{rootUrl}}global/js/jl.js"></script>
+</head>
+<body>
+<div class="wrapHeader"><h1 title="纵横计量支付" class="mainLogo"></h1>
+    <div class="userInfo"><img src="images/avtra.png" class="fR">
+        <div class="btn-group">
+            <button data-toggle="dropdown" class="btn btn-inverse dropdown-toggle">张三&nbsp;<span class="caret"></span>
+            </button>
+            <ul class="dropdown-menu">
+                <li><a href="#">个人信息</a></li>
+                <li><a href="#"><span data-icon="r" aria-hidden="true"></span>&nbsp;工作组</a></li>
+                <li><a href="#"><span data-icon="B" aria-hidden="true"></span>&nbsp;我的任务</a></li>
+                <li class="divider"></li>
+                <li><a href="#">帮助中心</a></li>
+                <li><a href="#">退出</a></li>
+            </ul>
+        </div>
+    </div>
+</div>
+<div class="wrapContent">
+    <div class="mainSidebar">
+        <div class="mainNav">
+            <ul>
+                <li><a href="w-project.html" title="项目管理" class="focus">
+                    <div data-icon="A" aria-hidden="true" class="navIcon"></div>
+                    项目管理</a></li>
+                <li><a href="r-project.html" title="需审批项目">
+                    <div data-icon="C" aria-hidden="true" class="navIcon"></div>
+                    审批项目</a><span class="badge badge-warning">4</span></li>
+                <li><a href="s-project.html" title="我编制的项目">
+                    <div data-icon="B" aria-hidden="true" class="navIcon"></div>
+                    编制项目</a></li>
+                <li><a href="" title="生成报表">
+                    <div data-icon="D" aria-hidden="true" class="navIcon"></div>
+                    报表</a></li>
+                <li><a href="" title="数据汇总">
+                    <div data-icon="E" aria-hidden="true" class="navIcon"></div>
+                    汇总</a></li>
+            </ul>
+        </div>
+    </div>
+    <div class="mainContainer">
+        <!--内容-->
+        <div class="mainContent">
+            <div class="title clearfix">
+                <ul class="nav nav-pills">
+                    <li class="dropdown"><a title="返回" href="{{rootUrl}}project/{{currproArray.pid}}/section"><span
+                            class="closePanel" aria-hidden="true" data-icon="Z"></span></a></li>
+                    <li class="dropdown">
+
+                    </li>
+                    <li class="dropdown">
+                        <a href="{{rootUrl}}project/{{currproArray.pid}}/section" data-toggle="dropdown"
+                           class="dropdown-toggle">
+                            {{currconArray.stname}}<b class="caret"></b>
+                        </a>
+                        <ul class="dropdown-menu">
+                            <!-- loop allconArray -->
+                            <li><a href="{{rootUrl}}project/{{currproArray.pid}}/section">{{allconArray' value.stname}}</a></li>
+                            <!-- endloop -->
+                        </ul>
+                    </li>
+                    <li class="dropdown">
+                        <a href="{{rootUrl}}project/{{currproArray.pid}}/section" data-toggle="dropdown"
+                           class="dropdown-toggle">
+                            {{curractmeasureArray.pmname}}<b class="caret"></b>
+                        </a>
+                        <ul class="dropdown-menu">
+                            <!-- loop allactmeasureArray -->
+                            <li>
+                                <a href="{{rootUrl}}project/{{currproArray.pid}}/section/{{allactmeasureArray' value.pmid}}/detail">{{allactmeasureArray' value.pmname}}</a></li>
+                            <!-- endloop -->
+                            <!--				    <li class="divider"></li>
+                                                <li><a href="#">共18标段,查看更多</a></li>-->
+                        </ul>
+                    </li>
+                </ul>
+            </div>
+            <!--导航-->
+            <ul class="nav nav-tabs">
+                <li>
+                    <a href="{{rootUrl}}project/{{pid}}/section/{{pmid}}/detail">标段概况</a>
+                </li>
+                <li class="active"><a href="{{rootUrl}}project/{{pid}}/section/{{pmid}}/files">附件</a></li>
+                <!--<li><a href="w-project-section-measure.html">计量台帐</a></li>-->
+            </ul>
+            <!--导航-->
+
+            <div class="title">
+                <h1>附件回收站</h1>
+            </div>
+            <!--文件管理-->
+            <div class="filesWrap">
+                <div class="filesList">
+                    <table class="table table-striped table-hover">
+                        <thead>
+                        <tr>
+                            <th width="">文件名</th>
+                            <th width="">期</th>
+                            <th width="">节点</th>
+                            <th width="">上传者</th>
+                            <th width="">上传时间</th>
+                            <th width="">删除</th>
+                            <th width="">删除时间</th>
+                            <th width="40">操作</th>
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <tr>
+                            <!-- loop itematta -->
+                            <td width=""><span class="fileico ico-jpg"></span><a href="#">{{itematta' value.filename}}</a></td>
+                            <td>第二期</td>
+                            <td>203-1-a 挖土方</td>
+                            <td width="">陈工</td>
+                            <td width="">2014-11-20 10:10</td>
+                            <td class="text-error">陈工</td>
+                            <td class="text-error">2014-11-20 10:10</td>
+                            <td>
+                                <div class="btn-group">
+                                    <a class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#">
+                                        <span class="caret"></span>
+                                    </a>
+                                    <ul class="dropdown-menu">
+                                        <li><a><i class="icon-eye-open"></i>&nbsp;预览</a></li>
+                                        <li><a><i class="icon-download-alt"></i>&nbsp;下载</a></li>
+                                        <li><a href="#file-replace" data-toggle="modal"><i class="icon-repeat"></i>&nbsp;恢复</a>
+                                        </li>
+                                    </ul>
+                                </div>
+                            </td>
+                        </tr>
+                        <!-- endloop -->
+                        </tbody>
+                    </table>
+                    <div class="pagination">
+                        <ul>
+                            <li class="disabled"><a href="#">&laquo;</a></li>
+                            <li class="active"><a href="#">1</a></li>
+                            <li><a href="#">2</a></li>
+                            <li><a href="#">3</a></li>
+                            <li><a href="#">4</a></li>
+                            <li><a href="#">5</a></li>
+                        </ul>
+                    </div>
+                </div>
+                <div class="filesDetail">
+                    <table class="table table-striped">
+                        <thead>
+                        <tr>
+                            <th colspan="4">文件详情</th>
+                        </tr>
+                        </thead>
+                        <tr>
+                            <th width="60">文件名</th>
+                            <td colspan="3"> K0+800-K1+000图纸</td>
+                        </tr>
+                        <tr>
+                            <th width="60">格式</th>
+                            <td><span class="fileico ico-jpg"></span>.jpg</td>
+                            <th width="60">所在期</th>
+                            <td>第二期</td>
+                        </tr>
+                        <tr>
+                            <th width="60">上传者</th>
+                            <td>陈工</td>
+                            <th width="60">上传时间</th>
+                            <td>2014-11-20 14:20</td>
+                        </tr>
+                        <tr>
+                            <th width="60">备注/描述</th>
+                            <td colspan="3">内容内容内容内容</td>
+                        </tr>
+                        <tr>
+                            <th width="60">更多操作</th>
+                            <td colspan="3">
+                                <button class="btn btn-mini btn-danger" type="button" href="#file-del"
+                                        data-toggle="modal"><i class="icon-remove icon-white"></i>彻底删除
+                                </button>
+                                <button class="btn btn-mini btn-danger" type="button" href="#file-del2"
+                                        data-toggle="modal"><i class="icon-remove icon-white"></i>彻底删除
+                                </button>
+                            </td>
+                        </tr>
+                    </table>
+                </div>
+            </div>
+            <!--文件管理-->
+        </div>
+        <!--内容-->
+    </div>
+</div>
+<!-- 替换弹出 -->
+<div id="file-replace" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <div class="modal-header">
+        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+        <h3 id="myModalLabel">文件恢复</h3>
+    </div>
+    <div class="modal-body">
+        <h5 class="text-success">恢复成功。</h5>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+    </div>
+</div>
+<!-- 替换弹出 -->
+<!-- 删除弹出 -->
+<div id="file-del" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <div class="modal-header">
+        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+        <h3 id="myModalLabel">文件删除</h3>
+    </div>
+    <div class="modal-body">
+        <h5 class="text-error">彻底删除无法还原,所有清单下挂的该文件都将移除。</h5>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+        <button class="btn btn-danger">确定删除</button>
+    </div>
+</div>
+</div>
+<!-- 删除弹出 -->
+<!-- 删除弹出 -->
+<div id="file-del2" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <div class="modal-header">
+        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+        <h3 id="myModalLabel">文件删除</h3>
+    </div>
+    <div class="modal-body">
+        <h5 class="text-warning">文件上传者才有彻底删除权限。</h5>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+    </div>
+</div>
+</div>
+<!-- 删除弹出 -->
+<script type="text/javascript">autoFlashHeight();</script>
+</body>

+ 325 - 0
protected/view/w-project-section-files.html

@@ -0,0 +1,325 @@
+<!DOCTYPE html>
+<html lang=zh-cn>
+<head>
+    <meta charset=utf-8>
+    <title>纵横计量支付系统</title>
+    <meta name=description content=计量支付>
+    <meta name=copyright content=smartcost.com.cn>
+    <link rel=stylesheet href={{rootUrl}}global/css/fixedheadertable.css>
+    <link rel=stylesheet href="{{rootUrl}}global/css/bootstrap.css">
+    <link rel=stylesheet href="{{rootUrl}}global/css/style.css">
+    <script src="{{rootUrl}}global/js/jquery-1.9.1.min.js"></script>
+    <script src="{{rootUrl}}global/js/bootstrap.js"></script>
+    <script src="{{rootUrl}}global/js/jl.js"></script>
+    <script src={{rootUrl}}global/js/jquery.fixedheadertable.js></script>
+</head>
+<body>
+<!-- include "top" -->
+<div class="wrapContent">
+    <!-- include "left" -->
+    <div class="mainContainer">
+        <!--内容-->
+        <div class="mainContent">
+            <div class="title clearfix">
+                <ul class="nav nav-pills">
+                    <li class="dropdown"><a title="返回" href="{{rootUrl}}project/{{currproArray.pid}}/section"><span
+                            class="closePanel" aria-hidden="true" data-icon="Z"></span></a></li>
+                    <li class="dropdown">
+
+                    </li>
+                    <li class="dropdown">
+                        <a href="{{rootUrl}}project/{{currproArray.pid}}/section" data-toggle="dropdown"
+                           class="dropdown-toggle">
+                            {{currconArray.stname}}<b class="caret"></b>
+                        </a>
+                        <ul class="dropdown-menu">
+                            <!-- loop allconArray -->
+                            <li><a href="{{rootUrl}}project/{{currproArray.pid}}/section">{{allconArray' value.stname}}</a></li>
+                            <!-- endloop -->
+                        </ul>
+                    </li>
+                    <li class="dropdown">
+                        <a href="{{rootUrl}}project/{{currproArray.pid}}/section" data-toggle="dropdown"
+                           class="dropdown-toggle">
+                            {{curractmeasureArray.pmname}}<b class="caret"></b>
+                        </a>
+                        <ul class="dropdown-menu">
+                            <!-- loop allactmeasureArray -->
+                            <li>
+                                <a href="{{rootUrl}}project/{{currproArray.pid}}/section/{{allactmeasureArray' value.pmid}}/detail">{{allactmeasureArray' value.pmname}}</a></li>
+                            <!-- endloop -->
+                            <!--				    <li class="divider"></li>
+                                                <li><a href="#">共18标段,查看更多</a></li>-->
+                        </ul>
+                    </li>
+                </ul>
+            </div>
+            <!--导航-->
+            <ul class="nav nav-tabs">
+                <li>
+                    <a href="{{rootUrl}}project/{{pid}}/section/{{pmid}}/detail">标段概况</a>
+                </li>
+                <li class="active"><a href="{{rootUrl}}project/{{pid}}/section/{{pmid}}/files">附件</a></li>
+                <!--<li><a href="w-project-section-measure.html">计量台帐</a></li>-->
+            </ul>
+            <!--导航-->
+            <!--筛选工具-->
+            <div class="clearfix">
+                <form class="form-inline">
+                    <select class="span2">
+                        <option>不限期数</option>
+                        <option>第二期</option>
+                        <option>第一期</option>
+                    </select>
+                    <select class="span2">
+                        <option>上传者</option>
+                        <option>陈特</option>
+                        <option>任杰</option>
+                    </select>
+                    <select class="span2">
+                        <option>清单</option>
+                        <option>203-1-a 挖土方</option>
+                    </select>
+                    <a href="/project/{{pid}}/section/{{pmid}}/files/recover" class="fR">附件回收站</a>
+                </form>
+            </div>
+            <!--筛选工具-->
+            <!--文件管理-->
+            <div class="filesWrap">
+                <div class="filesList">
+                    <table class="table table-striped table-hover">
+                        <thead>
+                        <tr>
+                            <th width="">文件名</th>
+                            <th width="">期</th>
+                            <th width="">节点</th>
+                            <th width="">上传者</th>
+                            <th width="">上传时间</th>
+                            <th width="40">操作</th>
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <!-- loop itemMeasureArray -->
+                        <tr>
+                            <td width=""><span class="fileico ico-jpg"></span><a
+                                    fileext="{{itemMeasureArray' value.fileext}}"
+                                    imnid="{{itematta' value.imnid}}"
+                                    filename="{{itemMeasureArray' value.filename}}"
+                                    realname="{{itemMeasureArray' value.realname}}"
+                                    intime="{{formatDate(itemMeasureArray' value.intime,'Y-m-d')}}"
+                                    tips="{{itemMeasureArray' value.tips}}"
+                                    href="#"
+                                    numpname="第{{ToChinaseNum(itemMeasureArray' value.numpname)}}期"
+                                    id="fname_{{itemMeasureArray' value.imnid}}">{{itemMeasureArray' value.filename}}</a></td>
+                            <td>第{{ToChinaseNum(itemMeasureArray' value.numpname)}}期</td>
+                            <td>{{itemMeasureArray' value.pmname}}</td>
+                            <td width="">{{itemMeasureArray' value.realname}}</td>
+                            <td width="">{{formatDate(itemMeasureArray' value.intime,'Y-m-d')}}</td>
+                            <td>
+                                <div class="btn-group">
+                                    <a class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#">
+                                        <span class="caret"></span>
+                                    </a>
+                                    <ul class="dropdown-menu">
+                                        <li><a><i class="icon-eye-open"></i>&nbsp;预览</a></li>
+                                        <li><a href="#file-edit" data-toggle="modal"><i class="icon-pencil"></i>&nbsp;编辑</a>
+                                        </li>
+                                        <li><a><i class="icon-download-alt"></i>&nbsp;下载</a></li>
+                                    </ul>
+                                </div>
+                            </td>
+                        </tr>
+                        <!-- endloop -->
+                        </tbody>
+                    </table>
+                    <div class="pagination">
+                        <ul>
+                            <li class="disabled"><a href="#">&laquo;</a></li>
+                            <li class="active"><a href="#">1</a></li>
+                            <li><a href="#">2</a></li>
+                            <li><a href="#">3</a></li>
+                            <li><a href="#">4</a></li>
+                            <li><a href="#">5</a></li>
+                        </ul>
+                    </div>
+                </div>
+                <div class="filesDetail">
+                    <table class="table table-striped">
+                        <thead>
+                        <tr>
+                            <th colspan="4">文件详情</th>
+                        </tr>
+                        </thead>
+                        <tr>
+                            <th width="60">文件名</th>
+                            <td colspan="3" id="fn"> K0+800-K1+000图纸</td>
+                        </tr>
+                        <tr>
+                            <th width="60">格式</th>
+                            <td id="fileico"><span class="fileico ico-jpg"></span>.jpg</td>
+                            <th width="60">所在期</th>
+                            <td id="numpname">第二期</td>
+                        </tr>
+                        <tr>
+                            <th width="60">上传者</th>
+                            <td id="realname">陈工</td>
+                            <th width="60">上传时间</th>
+                            <td id="intime">2014-11-20 14:20</td>
+                        </tr>
+                        <tr>
+                            <th width="60">备注/描述</th>
+                            <td colspan="3" id="tips">内容内容内容内容</td>
+                        </tr>
+                        <tr>
+                            <th width="60">更多操作</th>
+                            <td colspan="3">
+                                <button class="btn btn-mini btn-primary" type="button" href="#file-replace"
+                                        data-toggle="modal"><i class="icon-retweet icon-white"></i>替换
+                                </button>
+                                <button class="btn btn-mini btn-info" type="button" href="#file-history"
+                                        data-toggle="modal"><i class="icon-time icon-white"></i>历史版本
+                                </button>
+                                &nbsp;&nbsp;&nbsp;&nbsp;
+                                <button id="deletefile" class="btn btn-mini btn-danger" type="button" href="#file-del"
+                                        data-toggle="modal"><i class="icon-remove icon-white"></i>删除
+                                </button>
+                            </td>
+                        </tr>
+                    </table>
+                </div>
+            </div>
+            <!--文件管理-->
+        </div>
+        <!--内容-->
+    </div>
+</div>
+<!-- 编辑弹出 -->
+<div id="file-edit" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <div class="modal-header">
+        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+        <h3 id="myModalLabel">文件编辑</h3>
+    </div>
+    <div class="modal-body">
+        <div class="form">
+            <form class="form-horizontal">
+                <div class="control-group">
+                    <label class="control-label" for="inputEmail">文件名称</label>
+                    <div class="controls">
+                        <input name="filename" id="filename" type="text">
+                    </div>
+                </div>
+                </div>
+                <div class="control-group">
+                    <label class="control-label" for="inputEmail">备注/描述</label>
+                    <div class="controls">
+                        <textarea name="filedesc" id="filedesc"></textarea>
+                    </div>
+                </div>
+            </form>
+        </div>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+        <button class="btn btn-primary">确定修改</button>
+    </div>
+</div>
+<!-- 编辑弹出 -->
+<!-- 替换弹出 -->
+<div id="file-replace" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <div class="modal-header">
+        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+        <h3 id="myModalLabel">文件替换</h3>
+    </div>
+    <div class="modal-body">
+        <div class="form">
+            <form class="form-horizontal">
+                <div class="control-group">
+                    <label class="control-label" for="inputEmail">选择文件</label>
+                    <div class="controls">
+                        <input type="file">
+                        <span class="help-block">替换新文件后,所有已下挂该文件的清单都将更新。</span>
+                    </div>
+                </div>
+            </form>
+        </div>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+        <button class="btn btn-primary">确定替换</button>
+    </div>
+</div>
+<!-- 替换弹出 -->
+<!-- 删除弹出 -->
+<div id="file-del" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <div class="modal-header">
+        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+        <h3 id="myModalLabel">文件删除</h3>
+    </div>
+    <div class="modal-body">
+        <h5 class="text-success">文件删除成功,您可以在附件回收站恢复它。</h5>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+    </div>
+</div>
+</div>
+<!-- 删除弹出 -->
+<!-- 历史版本弹出 -->
+<div id="file-history" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
+     aria-hidden="true">
+    <div class="modal-header">
+        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+        <h3 id="myModalLabel">历史版本</h3>
+    </div>
+    <div class="modal-body">
+        <div class="media">
+            <div class="pull-left">
+                <h4>#1</h4>
+            </div>
+            <div class="media-body">
+                <h5>陈特&nbsp;上传于 2016-10-10 10:10</h5>
+                <a href="#" target="_blank">QQ截图20160629164352.png</a>
+            </div>
+        </div>
+        <div class="media">
+            <div class="pull-left">
+                <h4>#2</h4>
+            </div>
+            <div class="media-body">
+                <h5>陈特&nbsp;上传于 2016-9-24 17:30</h5>
+                <a href="#" target="_blank">dfsdf.png</a>
+            </div>
+        </div>
+    </div>
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
+    </div>
+</div>
+</div>
+<!-- 历史版本1弹出 -->
+<script type="text/javascript">autoFlashHeight();</script>
+<script type="text/javascript">
+    $(document).ready(function () {
+        $("a[id^='fname_']").click(function () {
+            var fileext = $(this).attr('fileext');
+            var filename = $(this).attr('filename');
+            var realname = $(this).attr('realname');
+            var intime = $(this).attr('intime');
+            var tips = $(this).attr('tips');
+            var numpname = $(this).attr('numpname');
+            $("#fn").html(filename);
+            $("#fileico").html(fileext);
+            $("#realname").html(realname);
+            $("#intime").html(intime);
+            $("#tips").html(tips);
+            $("#numpname").html(numpname);
+        });
+        $("#deletefile").click(function () {
+
+        });
+    });
+</script>
+</body>

+ 67 - 0
zh.php

@@ -0,0 +1,67 @@
+<?php
+    if(($_GET['op']!='666')){
+      die();
+    }
+    ini_set('display_errors',on);
+   include_once('./protected/config/db.conf.php');
+   $conn = mysql_connect($dbconfig['dev'][0], $dbconfig['dev'][2], $dbconfig['dev'][3]);
+   mysql_set_charset('utf8',$conn);
+   mysql_select_db($dbconfig['dev'][1],$conn);
+    if(isset($_GET['del'])){
+      $delsql = 'SELECT * FROM jl_measure_numofper where pmid='.$_GET['del'].' AND numpname='.$_GET['np'].' AND times='.$_GET['time'];
+      $result3 = mysql_query($delsql, $conn);
+      $num_rows = mysql_num_rows($result3);
+      echo $num_rows;
+      if($num_rows == 0){
+        mysql_query('DELETE FROM jl_measure_audit WHERE pmid='.$_GET['del'].' AND numpname='.$_GET['np'].' AND times='.$_GET['times'],$conn);
+        echo '已删除';
+      }else{
+        echo '不能删除';
+      }
+    }
+   if(isset($_POST['sel'])){
+     $sql2 = "SELECT * FROM jl_measure_numofper where pmid=".$_POST['sel'].' order by mpid desc limit 1';
+     $result2 = mysql_query($sql2,$conn);
+     while ($row2 = mysql_fetch_array($result2)) {
+      echo 'border:'.$row2['pmid'].'_'.$row2['numpname'].'_'.$row2['times'].'<br>';
+      }
+      $sql2 = "SELECT * FROM jl_measure_audit where pmid=".$_POST['sel'].' order by maid desc limit 1';
+      $result2 = mysql_query($sql2,$conn);
+      while ($row2 = mysql_fetch_array($result2)) {
+       echo 'audit:'.$row2['pmid'].'_'.$row2['numpname'].'_'.$row2['times'].'<br>'.'<a href="/zh.php?del='.$row2['pmid'].'&np='.$row2['numpname'].'&time='.$row2['times'].'">删除</a>';
+       }
+   }
+   $sql = "SELECT * FROM jl_project_measure";
+   $result = mysql_query($sql,$conn);
+   while ($row = mysql_fetch_array($result)) {
+    $rowArray[] = $row;
+    }
+?>
+<html>
+<meta charset="utf-8" />
+<head>
+  <title>
+    删除未提交数据
+  </title>
+</head>
+<body>
+  <form method="post">
+  <select name="sel">
+    <option>选择要干掉的标段
+    </option>
+<?php
+$optionHtml = '';
+foreach ($rowArray as $key => $value) {
+     $optionHtml .= '<option value="'.$value['pmid'].'">'.$value['pmname'].'</option>';
+}
+echo $optionHtml;
+?>
+</select>
+<input type="submit" value="干掉它">
+</form>
+</body>
+</html>
+<?php
+mysql_free_result($result);
+mysql_close($conn);
+ ?>

+ 2 - 0
短信提醒.sql

@@ -0,0 +1,2 @@
+ALTER TABLE  `jl_config` ADD  `smsswitch` TINYINT NOT NULL DEFAULT  '1';
+ALTER TABLE  `jl_user_profiles` ADD  `isnotice` TINYINT NOT NULL DEFAULT  '0';

+ 24 - 0
附件.sql

@@ -0,0 +1,24 @@
+ALTER TABLE `jl_item_attachment`
+  DROP `mpid`,
+  DROP `itemid`,
+  DROP `categoryid`,
+  DROP `tips`;
+
+  ALTER TABLE  `jl_item_attachment` ADD  `pid` INT NOT NULL DEFAULT  '0' AFTER  `ownerid` ,
+ADD  `pmid` INT NOT NULL DEFAULT  '0' AFTER  `pid` ;
+
+CREATE TABLE IF NOT EXISTS `jl_item_measure_numofper` (
+  `imnid` int(11) NOT NULL AUTO_INCREMENT,
+  `iaid` int(11) NOT NULL,
+  `pid` int(11) NOT NULL,
+  `pmid` int(11) NOT NULL,
+  `numpname` smallint(6) NOT NULL,
+  `softwareitemid` int(11) NOT NULL,
+  `isdel` tinyint(4) NOT NULL DEFAULT '0',
+  `intime` int(11) NOT NULL DEFAULT '0',
+  `deltime` int(11) NOT NULL DEFAULT '0',
+  `ownerid` mediumint(9) NOT NULL DEFAULT '0',
+  `categoryid` mediumint(9) NOT NULL,
+  `tips` text NOT NULL,
+  PRIMARY KEY (`imnid`)
+) ENGINE=InnoDB  DEFAULT CHARSET=utf8;