profile->getProWithUid($this->auth->getUid());
// $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
// if (!$falg)
// return Doo::acl()->defaultFailedRoute;
if ($this->auth->getUid()) {
$uGroups = $this->profile->getProWithUid($this->auth->getUid());
$falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
if (!$falg)
return Doo::acl()->defaultFailedRoute;
}else {
return Doo::acl()->defaultFailedRoute;
}
}
public function __construct() {
$this->auth = new Auth();
$this->attfile = new attFile();
$this->profile = new Profile();
$this->project = new Project();
$this->contractact = new Contractact();
$this->actmeasure = new actMeasure();
$this->numofperact = new NumofperAct();
$this->user = new User();
$this->ph = new PasswordHash(8, FALSE);
$this->data['rootUrl'] = Doo::conf()->APP_URL;
$this->data['currChannle'] = 'p';
$this->data['user'] = $this->profile->getProWithUid($this->auth->getUid());
}
/**
*
* @return type
*/
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'])) {
$this->profile->upProfile($this->auth->getUid(), $_POST);
return DOO::conf()->APP_URL . 'user/profile';
}
$this->render('edit-profile', $this->data, TRUE);
}
public function avatar() {
// TODO:加入目录可否写入判断
if (count($_FILES) == 3) {
$result = array();
$result['success'] = false;
$successNum = 0;
$avatarNumber = 1;
$i = 0;
$msg = '';
$dir = 'global/avatar';
while (list($key, $val) = each($_FILES)) {
if ($_FILES[$key]['error'] > 0) {
$msg .= $_FILES[$key]['error'];
} else {
$fileName = date("YmdHis") . '_' . floor(microtime() * 1000) . '_' . self::createRandomCode(8);
if ($key == '__source') {
$initParams = $_POST["__initParams"];
$virtualPath = "$dir/php_source_$fileName.jpg";
$result['sourceUrl'] = '/' . $virtualPath . $initParams;
move_uploaded_file($_FILES[$key]["tmp_name"], Doo::conf()->SITE_PATH . $virtualPath);
$successNum++;
} else if (strpos($key, '__avatar') === 0) {
$virtualPath = "$dir/php_avatar" . $avatarNumber . "_$fileName.jpg";
$result['avatarUrls'][$i] = $virtualPath;
if ($i == 2) {
$this->profile->setAvatar($this->auth->getUid(), $result['avatarUrls'][$i]);
}
move_uploaded_file($_FILES[$key]["tmp_name"], $virtualPath);
$successNum++;
$i++;
}
}
}
$result['msg'] = $msg;
if ($successNum > 0) {
$result['success'] = true;
}
print json_encode($result);
die;
}
$this->render('edit-profile-avtra', $this->data, TRUE);
}
/* * ************************************************************
* 生成指定长度的随机码。
* @param int $length 随机码的长度。
* @access public
* ************************************************************ */
function createRandomCode($length) {
$randomCode = "";
$randomChars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
for ($i = 0; $i < $length; $i++) {
$randomCode .= $randomChars { mt_rand(0, 35) };
}
return $randomCode;
}
public function proSection() {
/**
* 计量期数
* 完成进度
*
*/
$this->getFav();
$contractArray = $this->contractact->getRowByPid($this->params['pid']); // 获取合同段
$htmlstr = NULL;
foreach ($contractArray as $k => $v) {
$retval = $this->actmeasure->getAllbyStid($v['stid']); // 获取标段
$bdhtmlstr = NULL;
$biaoduantotalmoney = 0;
$currTotal = 0;
$progress = $otherprogress = '0%';
$currTotal = $this->numofperact->getCountTotalSTID($v['stid']);
//
foreach ($retval as $key => $value) {
$snTotalProgress = $currTotalProgress = $lessTotalProgress = '0%';
$numCount = $this->numofperact->getCountTotalnum($value['pmid']);
$totalplus = $this->numofperact->getCountTotalplus($value['pmid']);
$snTotal = $this->numofperact->getStopNow($value['pmid']); //截止目前
$currcomTotal = $this->numofperact->getCurrTotal($value['pmid']); //截止目前
if ($numCount > 0) {
$nTotalProgress = number_format($snTotal['sntotal'], 2, '.', ',');
$ncurrTotalProgress = number_format($currcomTotal['currtotal'], 2, '.', ',');
$nlessTotalProgress = number_format($totalplus['totalplus'] - $currcomTotal['currtotal'] - $snTotal['sntotal'], 2, '.', ',');
$snTotalProgress = round(($snTotal['sntotal'] / $totalplus['totalplus']) * 100) . '%';
$currTotalProgress = round(($currcomTotal['currtotal'] / $totalplus['totalplus']) * 100) . '%';
$lessTotalProgress = round((($totalplus['totalplus'] - $currcomTotal['currtotal'] - $snTotal['sntotal']) / $totalplus['totalplus']) * 100) . '%';
}
$biaoduantotalmoney += $value['contracttotal'];
$totalmoney = number_format($value['contracttotal'], 2, '.', ',');
$bdhtmlstr .='
标段名 计量期数 总价 截止本期累计完成/本期完成/未完成