AdminController.php 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313
  1. <?php
  2. /**
  3. * @author darkredz
  4. */
  5. class AdminController extends DooController {
  6. public $staff;
  7. public $nature=array('1'=>'设计',
  8. '2'=>'造价管理',
  9. '3'=>'业主',
  10. '4'=>'交通局',
  11. '5'=>'公路局',
  12. '6'=>'审计',
  13. '7'=>'财政',
  14. '8'=>'审核',
  15. '9'=>'施工',
  16. '10'=>'咨询',
  17. '11'=>'招标代理',
  18. '12'=>'监理',
  19. '13'=>'学校',
  20. '14'=>'个人',
  21. '15'=>'合作伙伴',
  22. );
  23. public $tooltip=array('1'=>array('L','点击筛选标签'),
  24. '2'=>array('M','点击筛选标签'),
  25. '3'=>array('N','点击筛选标签'),
  26. '4'=>array('O','点击筛选标签'),
  27. '5'=>array('P','点击筛选标签'),
  28. '6'=>array('Q','点击筛选标签'),
  29. '7'=>array('R','点击筛选标签'),
  30. );
  31. public $webPath="http://cld.smartcost.com.cn/upload/emailAnnex/";
  32. function __construct() {
  33. if(isset($_COOKIE["adStaff"])){
  34. if(!empty($_COOKIE["adStaff"])){
  35. Doo::loadModel ( 'staff' );
  36. $staff = new staff ();
  37. $this->staff=$staff->getUserByIdList($_COOKIE["adStaff"]);
  38. if ($this->staff[0]['isadmin']==1&&$this->staff[0]['username']=='admin'){
  39. return "/adminoffice";
  40. }
  41. }
  42. }
  43. Doo::loadCore ( 'uri/DooUriRouter' );
  44. $router = new DooUriRouter ();
  45. $routeRs = $router->execute ( Doo::app ()->route, Doo::conf ()->SUBFOLDER );
  46. if($routeRs['1']!="adlogin"){
  47. header ( 'Content-Type:text/html;charset=utf-8' );
  48. @header ( "Location: /adlogin" );
  49. }
  50. }
  51. function adlogin(){
  52. $passwork = isset ( $_POST['passwork'] ) ? $_POST['passwork'] : "";
  53. $uid = isset ( $_POST['user'] ) ? $_POST['user'] : "";
  54. Doo::loadModel ( 'staff' );
  55. $staff = new staff ();
  56. if(!empty($passwork)){
  57. $userinfo=$staff->getOne(array('where'=>"username='admin'",'asArray'=>true));
  58. if(!empty($userinfo)){
  59. if ($userinfo['username']==$uid&&$userinfo['passwork']==md5($passwork)){
  60. setcookie("adStaff", $userinfo['sid'], time()+36000,"/");
  61. return "/adminoffice";
  62. }
  63. }
  64. }
  65. $data ['staff'] = "";
  66. $data['login']="";
  67. if(!empty($passwork))
  68. $data['login']="inputErrow";
  69. $this->render ( "/admin/adminLogin", $data );
  70. }
  71. function adout(){
  72. setcookie("adStaff", "", time()-3600,"/");
  73. return "/adlogin";
  74. }
  75. function adminPW(){
  76. $msg= $this->params['msg']?$this->params['msg']:"";
  77. $data['msg']="msg";
  78. $data['memu']="adminpw";
  79. $data['staff']=$this->staff;
  80. $data['msg']=urldecode($this->params['msg']);
  81. $this->render ( "/admin/admin-admininfo", $data );
  82. }
  83. function upAdP(){
  84. $opw=$this->get_args('opw')?$this->get_args('opw'):"";
  85. $npw1=$this->get_args('npw1')?$this->get_args('npw1'):"";
  86. $npw2=$this->get_args('npw2')?$this->get_args('npw2'):"";
  87. if(!empty($opw)){
  88. Doo::loadModel ( 'staff' );
  89. $staff = new staff ();
  90. $userinfo=$staff->getOne(array('where'=>"username='admin'",'asArray'=>true));
  91. if(!empty($userinfo)){
  92. if ($userinfo['sid']==$_COOKIE["adStaff"]&&$userinfo['passwork']==md5($opw)){
  93. if (($npw1==$npw2)&&($npw1!="")){
  94. $staff->passwork=md5($npw1);
  95. $staff->update(array('where'=>"sid='".$_COOKIE["adStaff"]."'"));
  96. return "/adminpw/".urlencode('密码修改成功');
  97. }else
  98. return "/adminpw/".urlencode('新密码不一致');
  99. }else
  100. return "/adminpw/".urlencode('旧密码不正确');
  101. }else
  102. return "/adminpw/".urlencode('未找到用户');
  103. }else
  104. return "/adminpw/".urlencode('请输入旧密码');
  105. }
  106. function adminoffice(){
  107. $data['memu']="adminoffice";
  108. $data['staff']=$this->staff;
  109. Doo::loadModel ( 'L_category' );
  110. Doo::loadModel ( 'staff' );
  111. Doo::loadModel('district');
  112. $district= new district();
  113. $staff = new staff ();
  114. $L_category = new L_category ();
  115. $data['category']=$L_category->getCategory();
  116. $data['district']=$district->get_lv(1);
  117. foreach ($data['category'] as $key=>$value){
  118. $data['category'][$key]['count']=$staff->count(array('where'=>'cid='.$value['cid']));
  119. }
  120. $data['msg']=urldecode($this->params['msg']);
  121. $this->render ( "/admin/admin_group", $data );
  122. }
  123. function addCategory(){
  124. $msg="添加成功";
  125. $title=isset($_POST['title'])?$_POST['title']:"";
  126. $district=isset($_POST['district'])?$_POST['district']:"";
  127. if(!empty($title)&&!empty($district)){
  128. Doo::loadModel ( 'L_category' );
  129. $L_category = new L_category ();
  130. $L_category->title=$title;
  131. $L_category->districtid=$district;
  132. $L_category->insert();
  133. }else{
  134. $msg="请输入正确的信息";
  135. }
  136. return "/adminoffice/".$msg;
  137. }
  138. function adminuser(){
  139. $data['memu']="adminuser";
  140. $data['staff']=$this->staff;
  141. Doo::loadModel ( 'L_category' );
  142. Doo::loadModel ( 'staff' );
  143. $staff = new staff ();
  144. $L_category = new L_category ();
  145. $data['category']=$L_category->getCategory();
  146. $data['stafflist']=$staff->getStaff();
  147. $data['staff']=$this->staff;
  148. $this->render ( "/admin/admin_user", $data );
  149. }
  150. function adduser(){
  151. $username=$this->get_args('username')?$this->get_args('username'):"";
  152. $password=$this->get_args('password')?$this->get_args('password'):"";
  153. $cid=is_numeric($this->get_args('cid'))?$this->get_args('cid'):0;
  154. $hiredate=$this->get_args('hiredate')?$this->get_args('hiredate'):"";
  155. $nature=is_numeric($this->get_args('nature'))?$this->get_args('nature'):1;
  156. if(!empty($username)&&!empty($password)&&!empty($cid)&&!empty($hiredate)&&!empty($nature)){
  157. Doo::loadModel ( 'L_category' );
  158. Doo::loadModel ( 'staff' );
  159. Doo::loadModel ( 'tag' );
  160. Doo::loadModel ( 'holidaystaff' );
  161. $staff = new staff ();
  162. $L_category = new L_category ();
  163. //加入默认总部分类
  164. $cagegory=$L_category->getCategoryById($cid);
  165. //根据这个分类加入管理权限
  166. if($cagegory[0]['defult']==1){
  167. $staff->isadmin=1;
  168. }
  169. $staff->username=$username;
  170. $staff->passwork=md5($password);
  171. $staff->cid=$cagegory[0]['cid'];
  172. $staff->category=$cagegory[0]['title'];
  173. $staff->hiredate=$hiredate;
  174. $staff->nature=$nature;
  175. $id=$staff->insert();
  176. $holidaystaff = new HStaff();
  177. $holidaystaff->uid = $id;
  178. $holidaystaff->yearnum = $nature == 1 ? (time() > strtotime("+ 1 year", strtotime($hiredate)) ? 5 : 0) : 0;
  179. $holidaystaff->insert();
  180. for ($i=1;$i<=7;$i++){
  181. $tag = new tag ();
  182. $tag->name="个人标签";
  183. $tag->sid=$id;
  184. $tag->colorid=$i;
  185. $tag->insert();
  186. }
  187. }
  188. return "/adminuser";
  189. }
  190. function adminEdiUser(){
  191. $sid= is_numeric($this->params['sid'])?$this->params['sid']:0;
  192. $msg= isset($this->params['msg'])?$this->params['msg']:"";
  193. if(!empty($sid)){
  194. $data['msg']=urldecode($msg);
  195. Doo::loadModel ( 'L_category' );
  196. Doo::loadModel ( 'staff' );
  197. $staff = new staff ();
  198. $L_category = new L_category ();
  199. $data['newPw']='';
  200. $data['staffInfo']=$staff->getUserById($sid);
  201. $data['category']=$L_category->getCategory();
  202. $data['staff']=$this->staff;
  203. $data['memu']="adminuser";
  204. $this->render ( "/admin/admin_EdiUser", $data );
  205. }else
  206. return "/adminuser";
  207. }
  208. function adminResetUserPw(){
  209. $sid= is_numeric($this->params['sid'])?$this->params['sid']:0;
  210. $msg= isset($this->params['msg'])?$this->params['msg']:"";
  211. if(!empty($sid)){
  212. $data['msg']=urldecode($msg);
  213. Doo::loadModel ( 'L_category' );
  214. Doo::loadModel ( 'staff' );
  215. $staff = new staff ();
  216. $L_category = new L_category ();
  217. $newPw=$this->getRandChar(6);
  218. $staff->sid=$sid;
  219. $staff->passwork=md5($newPw);
  220. $staff->update();
  221. $data['newPw']=$newPw;
  222. $data['staffInfo']=$staff->getUserById($sid);
  223. $data['category']=$L_category->getCategory();
  224. $data['staff']=$this->staff;
  225. $data['memu']="adminuser";
  226. $this->render ( "/admin/admin_EdiUser", $data );
  227. }else
  228. return "/adminuser";
  229. }
  230. function adminDoEdiUser(){
  231. $sid=is_numeric($this->get_args('sid'))?$this->get_args('sid'):0;
  232. $cid=is_numeric($this->get_args('cid'))?$this->get_args('cid'):0;
  233. $gender=$this->get_args('gender')?$this->get_args('gender'):"";
  234. $qq=is_numeric($this->get_args('qq'))?$this->get_args('qq'):0;
  235. $phone=$this->get_args('phone')?$this->get_args('phone'):"";
  236. $telephone=$this->get_args('telephone')?$this->get_args('telephone'):"";
  237. $email=$this->get_args('email')?$this->get_args('email'):"";
  238. $username=$this->get_args('username')?$this->get_args('username'):"";
  239. $nature=$this->get_args('nature')?$this->get_args('nature'):"";
  240. $hiredate=$this->get_args('hiredate')?$this->get_args('hiredate'):"";
  241. if(!empty($sid)){
  242. $msg="";
  243. Doo::loadModel ( 'L_category' );
  244. Doo::loadModel ( 'staff' );
  245. $staff = new staff ();
  246. $L_category = new L_category ();
  247. $categoryInfo=$L_category->getCategoryById($cid);
  248. $staff->sid=$sid;
  249. if ($cid!=0){
  250. $staff->cid=$categoryInfo[0]['cid'];
  251. $staff->category=$categoryInfo[0]['title'];
  252. }
  253. if($categoryInfo[0]['defult']==1){
  254. $staff->isadmin=1;
  255. }else{
  256. $staff->isadmin=0;
  257. }
  258. if (!empty($username))
  259. $staff->username=$username;
  260. if(!empty($gender))
  261. $staff->gender=$gender;
  262. if(!empty($qq)&&is_numeric($qq))
  263. $staff->qq=$qq;
  264. if(!empty($phone))
  265. $staff->phone=$phone;
  266. if(!empty($telephone))
  267. $staff->telephone=$telephone;
  268. if(!empty($email)&&filter_var($email, FILTER_VALIDATE_EMAIL))
  269. $staff->email=$email;
  270. else
  271. $msg="邮箱不正确";
  272. if(!empty($hiredate))
  273. $staff->hiredate=$hiredate;
  274. $staff->nature=$nature;
  275. $staff->update();
  276. $staffmsg = $staff->getUserById($sid);
  277. $this->updateAnnualLeave($staffmsg[0]);
  278. return "/edi/user/".$sid."/".$msg;
  279. }else{
  280. return "/adminuser";
  281. }
  282. }
  283. function adminDoAddCategory(){
  284. $sid=is_numeric($this->get_args('sid'))?$this->get_args('sid'):0;
  285. $cid=is_numeric($this->get_args('cid'))?$this->get_args('cid'):0;
  286. if(!empty($sid)){
  287. Doo::loadModel ( 'L_category' );
  288. Doo::loadModel ( 'staff' );
  289. $staff = new staff ();
  290. $L_category = new L_category ();
  291. $stfInfo=$staff->getOne(array('where'=>'sid ='.$sid,'asArray'=>true));
  292. if($stfInfo['cid']==$cid)
  293. return "/adminuser";
  294. $othcid=explode(',', $stfInfo['othercid']);
  295. if(in_array($cid, $othcid))
  296. return "/adminuser";
  297. array_push($othcid, $cid);
  298. $strCid=implode(',',array_filter($othcid));
  299. $catename=$L_category->getCategoryById($cid);
  300. $othcategory=explode(',', $stfInfo['othercategory']);
  301. array_push($othcategory, $catename[0]['title']);
  302. $strcategory=implode(',',array_filter($othcategory));
  303. $staff->sid=$sid;
  304. $staff->othercid=$strCid;
  305. $staff->othercategory=$strcategory;
  306. $staff->update();
  307. }
  308. return "/adminuser";
  309. }
  310. function adminDeleteUser(){
  311. $sid= is_numeric($this->params['sid'])?$this->params['sid']:0;
  312. if (!empty($sid)){
  313. Doo::loadModel ( 'staff' );
  314. $staff = new staff ();
  315. $staff->sid=$sid;
  316. $staff->delete();
  317. }
  318. return "/adminuser";
  319. }
  320. function adminproduct(){
  321. $data['memu']="adminproduct";
  322. $data['staff']=$this->staff;
  323. Doo::loadModel ( 'product' );
  324. Doo::loadModel ( 'longle' );
  325. $product = new product ();
  326. $longle = new longle ();
  327. $data['product']=$product->getProudct();
  328. foreach ($data['product'] as $key=>$value){
  329. $data['product'][$key]['count']=$longle->count(array('where'=>'product="'.$value['title'].'"'));
  330. }
  331. $this->render ( "/admin/admin_product", $data );
  332. }
  333. function addproduct(){
  334. $title=$this->get_args('title')?$this->get_args('title'):"";
  335. if(!empty($title)){
  336. Doo::loadModel ( 'product' );
  337. $product = new product ();
  338. $product->title=$title;
  339. $product->insert();
  340. }
  341. return "/adminproduct";
  342. }
  343. function adminDeleteProduct(){
  344. $pid= is_numeric($this->params['pid'])?$this->params['pid']:0;
  345. if (!empty($pid)){
  346. Doo::loadModel ( 'product' );
  347. $product = new product ();
  348. $product->pid=$pid;
  349. $product->delete();
  350. }
  351. return "/adminproduct";
  352. }
  353. function adminEdiProduct(){
  354. $pid= is_numeric($this->params['pid'])?$this->params['pid']:0;
  355. $msg= isset($this->params['msg'])?$this->params['msg']:"";
  356. if(!empty($pid)){
  357. $data['msg']=urldecode($msg);
  358. Doo::loadModel ( 'product' );
  359. $product = new product ();
  360. $data['productInfo']=$product->getProductById($pid);
  361. $data['memu']="adminproduct";
  362. $data['staff']=$this->staff;
  363. $this->render ( "/admin/admin_EdiProduct", $data );
  364. }else
  365. return "/adminproduct";
  366. }
  367. function adminDoEdiProduct(){
  368. $pid=is_numeric($this->get_args('pid'))?$this->get_args('pid'):"";
  369. $title=$this->get_args('title')?$this->get_args('title'):"";
  370. $typeid=$this->get_args('typeid')?$this->get_args('typeid'):"";
  371. if(!empty($pid)&&!empty($title)&&!empty($typeid)){
  372. $msg="";
  373. Doo::loadModel ( 'product' );
  374. $product = new product ();
  375. $product->pid=$pid;
  376. $product->title=$title;
  377. $product->typeid=$typeid;
  378. $product->update();
  379. return "/adminproduct";
  380. }else{
  381. return "/adminproduct";
  382. }
  383. }
  384. function adminverify(){
  385. Doo::loadModel('staff');
  386. Doo::loadModel("verify");
  387. $verify=new verify();
  388. $staff=new staff();
  389. Doo::loadModel("role");
  390. $role=new role();
  391. $data['staffList']=$staff->find(array('select'=>'username,sid,avatar','asArray'=>true));
  392. $list=$verify->find(array('asArray'=>true));
  393. $roleList=$role->find(array('asArray'=>true));
  394. foreach ($roleList as $key=>$value){
  395. $staffList=json_decode($value['staff']);
  396. foreach ($staffList as $k=>$v){
  397. $staffList[$k]=substr(strstr($v, '_'), 1);
  398. }
  399. $roleList[$key]['staff']=implode(',', $staffList);
  400. }
  401. foreach ($list as $key=>$value){
  402. $name=json_decode($value['staff']);
  403. $list[$key]['staff']="";
  404. foreach ($name as $k=>$v){
  405. if ($v[1]=='ROLE'){
  406. $roleInfo=$role->getOne(array('where'=>'rid = "'.$v[0].'"','asArray'=>true));
  407. $v[1]=$roleInfo['name'];
  408. }
  409. $list[$key]['staff'].=" ".$v[1];
  410. }
  411. }
  412. $data['roleList']=$roleList;
  413. $data['verify']=$list;
  414. $data['memu']="verify";
  415. $data['staff']=$this->staff;
  416. $this->render ( "/admin/admin_reportGroup", $data );
  417. }
  418. function addVerify(){
  419. $description=$this->get_args('description')?$this->get_args('description'):"";
  420. $staff=$this->get_args('staff')?$this->get_args('staff'):"";
  421. $uidlist=$this->get_args('uidlist')?$this->get_args('uidlist'):"";
  422. $uidlist=explode(",", $uidlist);
  423. Doo::loadModel("role");
  424. $role=new role();
  425. $list=array();
  426. foreach ($uidlist as $key=>$value){
  427. $info=explode(":", $value);
  428. if ($info[1]=='ROLE'){
  429. $roleInfo=$role->getOne(array('where'=>'rid = "'.$info[0].'"','asArray'=>true));
  430. array_push($info, $roleInfo['staff']);
  431. }
  432. array_push($list, $info);
  433. }
  434. if(!empty($description)&&!empty($list)){
  435. Doo::loadModel("verify");
  436. $verify=new verify();
  437. $verify->description=$description;
  438. $verify->staff=json_encode($list);
  439. $verify->insert();
  440. }
  441. return "/adminverify";
  442. }
  443. function adminRole(){
  444. Doo::loadModel('staff');
  445. $staff=new staff();
  446. Doo::loadModel("verify");
  447. $verify=new verify();
  448. Doo::loadModel("role");
  449. $role=new role();
  450. $data['staffList']=$staff->find(array('select'=>'username,sid,avatar','asArray'=>true));
  451. $list=$verify->find(array('asArray'=>true));
  452. $roleList=$role->find(array('asArray'=>true));
  453. foreach ($list as $key=>$value){
  454. $name=json_decode($value['staff']);
  455. $list[$key]['staff']="";
  456. foreach ($name as $k=>$v){
  457. $list[$key]['staff'].=" ".$v[1];
  458. }
  459. }
  460. foreach ($roleList as $key=>$value){
  461. $staff=json_decode($value['staff']);
  462. foreach ($staff as $k=>$v){
  463. //print_r($info);
  464. //$staff[$k]=substr(strstr($v, '_'), 1);
  465. $info=explode('_', $v);
  466. $staff[$k]=$info;
  467. }
  468. $roleList[$key]['list']=$staff;
  469. }
  470. $data['roleList']=$roleList;
  471. $data['verify']=$list;
  472. $data['memu']="verify";
  473. $data['staff']=$this->staff;
  474. $this->render ( "/admin/adminReportGroupRole", $data );
  475. }
  476. function addRole(){
  477. $name=$this->get_args('title')?$this->get_args('title'):"";
  478. $staff=$this->get_args('staff')?$this->get_args('staff'):"";
  479. $list=array();
  480. foreach ($staff as $key=>$value){
  481. $na=explode(":", $value);
  482. array_push($list, $na[0].'_'.$na[1]);
  483. }
  484. if(!empty($name)&&!empty($list)){
  485. Doo::loadModel("role");
  486. $role=new role();
  487. $role->name=$name;
  488. $role->staff=json_encode($list);
  489. $role->insert();
  490. }
  491. return "/adminRole";
  492. }
  493. function delRole(){
  494. $rid= isset($this->params['rid'])?$this->params['rid']:0;
  495. if(!empty($rid)){
  496. Doo::loadModel("role");
  497. $role=new role();
  498. $role->delete(array('where'=>'rid="'.$rid.'"'));
  499. }
  500. return "/adminRole";
  501. }
  502. function updateRole(){
  503. $oldStaff=$this->get_args('oldStaff')?$this->get_args('oldStaff'):"";
  504. $newStaff=$this->get_args('newStaff')?$this->get_args('newStaff'):"";
  505. $rid=$this->get_args('rid')?$this->get_args('rid'):"";
  506. if(!empty($oldStaff)&&!empty($newStaff)&&!empty($rid)){
  507. Doo::loadModel("role");
  508. $role=new role();
  509. $roleInfo=$role->getOne(array('where'=>'rid = "'.$rid.'"','asArray'=>true));
  510. $staffList=json_decode($roleInfo['staff'],true);
  511. foreach ($staffList as $key=>$value){
  512. if ($value==$oldStaff){
  513. $staffList[$key]=$newStaff;
  514. break;
  515. }
  516. }
  517. $role->staff=json_encode($staffList);
  518. $role->update(array('where'=>'rid = "'.$rid.'"'));
  519. }
  520. return "/adminRole";
  521. }
  522. function adminExecute(){
  523. Doo::loadModel('staff');
  524. $staff=new staff();
  525. Doo::loadModel("execute");
  526. $execute=new execute();
  527. $data['staffList']=$staff->find(array('select'=>'username,sid,avatar','asArray'=>true));
  528. $list=$execute->find(array('asArray'=>true));
  529. $execute=array('借款执行人'=>'','借款费用执行人'=>'','报销单执行人'=>'','对公汇款执行人'=>'');
  530. foreach ($list as $key=>$value){
  531. $name=json_decode($value['staff']);
  532. $staffString="";
  533. if (!empty($name)){
  534. foreach ($name as $k=>$v){
  535. $staffString.=" ".$v[1].'<a href="javascript:if(window.confirm(\'确认删除?\'))window.location=\'/delExecute/'.$v[0].'/'.$value['eid'].'\'" title="删除" class="icon-">k</a>';
  536. }
  537. }
  538. foreach ($execute as $k=>$v){
  539. if ($k==$value['mold']){
  540. $execute[$k]=$name=$staffString;
  541. }
  542. }
  543. }
  544. //print_r($execute);die;
  545. $data['execute']=$execute;
  546. $data['memu']="verify";
  547. $data['staff']=$this->staff;
  548. $this->render ( "/admin/adminCarriedout", $data );
  549. }
  550. function addExecute(){
  551. $mold=$this->get_args('mold')?$this->get_args('mold'):"";
  552. $staff=$this->get_args('staff')?$this->get_args('staff'):"";
  553. if(!empty($mold)&&!empty($staff)){
  554. Doo::loadModel("execute");
  555. $execute=new execute();
  556. $executeInfo=$execute->getOne(array('where'=>'mold ="'.$mold.'" ','asArray'=>true));
  557. if (empty($executeInfo)){
  558. $list=array();
  559. foreach ($staff as $key=>$value){
  560. $info=explode(":", $value);
  561. array_push($list, $info);
  562. }
  563. $execute->mold=$mold;
  564. $execute->staff=json_encode($list);
  565. $execute->insert();
  566. }else{
  567. $list=json_decode($executeInfo['staff'],true);
  568. foreach ($staff as $k=>$v){
  569. $info=explode(":", $v);
  570. foreach ($list as $key=>$value){
  571. if($value[1]==$info[1]){
  572. unset($staff[$k]);
  573. break;
  574. }
  575. }
  576. }
  577. foreach ($staff as $k=>$v){
  578. $info=explode(":", $v);
  579. array_push($list, $info);
  580. }
  581. $execute->staff=json_encode($list);
  582. $execute->update(array('where'=>'eid = '.$executeInfo['eid']));
  583. }
  584. }
  585. return "/adminExecute";
  586. }
  587. function delExecute(){
  588. $uid=isset($this->params['uid'])&&is_numeric($this->params['uid'])?$this->params['uid']:0;
  589. $eid=isset($this->params['eid'])&&is_numeric($this->params['eid'])?$this->params['eid']:0;
  590. if(!empty($uid)&&!empty($eid)){
  591. Doo::loadModel("execute");
  592. $execute=new execute();
  593. $executeInfo=$execute->getOne(array('where'=>'eid ="'.$eid.'" ','asArray'=>true));
  594. if (empty($executeInfo))
  595. return "/adminExecute";
  596. $ini=array();
  597. $list=json_decode($executeInfo['staff'],true);
  598. foreach ($list as $k=>$v){
  599. if ($v[0]==$uid){
  600. $ini=$list[$k];
  601. unset($list[$k]);break;
  602. }
  603. }
  604. file_put_contents("protected/config/execute/execute.ini", ",".$ini[0], FILE_APPEND);
  605. $execute->staff=json_encode($list);
  606. $execute->update(array('where'=>'eid = '.$executeInfo['eid']));
  607. }
  608. return "/adminExecute";
  609. }
  610. function adminInvoice(){
  611. Doo::loadModel('staff');
  612. $staff=new staff();
  613. Doo::loadModel("invoiceManage");
  614. $invoiceManage=new invoiceManage();
  615. $data['staffList']=$staff->find(array('select'=>'username,sid,avatar','asArray'=>true));
  616. $list=$invoiceManage->find(array('asArray'=>true));
  617. $execute=array('收款管理'=>'','发票审批'=>'','发票打印'=>'','发票邮寄'=>'','公司汇总查阅'=>'');
  618. foreach ($list as $key=>$value){
  619. $name=json_decode($value['staff']);
  620. $staffString="";
  621. if (!empty($name)){
  622. foreach ($name as $k=>$v){
  623. $staffString.="<span class='tagGroup'> ".$v[1].'<a href="javascript:if(window.confirm(\'确认删除?\'))window.location=\'/delInvoiceManage/'.$v[0].'/'.$value['iid'].'\'" title="删除" class="icon-">k</a></span>';
  624. }
  625. }
  626. foreach ($execute as $k=>$v){
  627. if ($k==$value['mold']){
  628. $execute[$k]=$name=$staffString;
  629. }
  630. }
  631. }
  632. $data['invoice']=$execute;
  633. $data['memu']="invoice";
  634. $data['staff']=$this->staff;
  635. $this->render ( "/admin/adminInvoice", $data );
  636. }
  637. function addInvoiceManage(){
  638. $mold=$this->get_args('mold')?$this->get_args('mold'):"";
  639. $staff=$this->get_args('staff')?$this->get_args('staff'):"";
  640. if(!empty($mold)&&!empty($staff)){
  641. Doo::loadModel("invoiceManage");
  642. $execute=new invoiceManage();
  643. $executeInfo=$execute->getOne(array('where'=>'mold ="'.$mold.'" ','asArray'=>true));
  644. if (empty($executeInfo)){
  645. $list=array();
  646. foreach ($staff as $key=>$value){
  647. $info=explode(":", $value);
  648. array_push($list, $info);
  649. }
  650. $execute->mold=$mold;
  651. $execute->staff=json_encode($list);
  652. $execute->insert();
  653. }else{
  654. $list=json_decode($executeInfo['staff'],true);
  655. foreach ($staff as $k=>$v){
  656. $info=explode(":", $v);
  657. foreach ($list as $key=>$value){
  658. if($value[1]==$info[1]){
  659. unset($staff[$k]);
  660. break;
  661. }
  662. }
  663. }
  664. foreach ($staff as $k=>$v){
  665. $info=explode(":", $v);
  666. array_push($list, $info);
  667. }
  668. $execute->staff=json_encode($list);
  669. $execute->update(array('where'=>'iid = '.$executeInfo['iid']));
  670. }
  671. }
  672. return "/adminInvoice";
  673. }
  674. function delInvoiceManage(){
  675. $uid=isset($this->params['uid'])&&is_numeric($this->params['uid'])?$this->params['uid']:0;
  676. $iid=isset($this->params['iid'])&&is_numeric($this->params['iid'])?$this->params['iid']:0;
  677. if(!empty($uid)&&!empty($iid)){
  678. Doo::loadModel("invoiceManage");
  679. $execute=new invoiceManage();
  680. $executeInfo=$execute->getOne(array('where'=>'iid ="'.$iid.'" ','asArray'=>true));
  681. if (empty($executeInfo))
  682. return "/adminInvoice";
  683. $ini=array();
  684. $list=json_decode($executeInfo['staff'],true);
  685. foreach ($list as $k=>$v){
  686. if ($v[0]==$uid){
  687. $ini=$list[$k];
  688. unset($list[$k]);break;
  689. }
  690. }
  691. $execute->staff=json_encode($list);
  692. $execute->update(array('where'=>'iid = '.$executeInfo['iid']));
  693. }
  694. return "/adminInvoice";
  695. }
  696. function ajaxRoleStaff(){
  697. $name=$this->get_args('name')?$this->get_args('name'):"";
  698. Doo::loadModel('staff');
  699. $staff=new staff();
  700. $staffList=$staff->find(array('select'=>'username,sid,avatar','where'=>'username != "'.$name.'" and username !="admin"','asArray'=>true));
  701. $html='';
  702. foreach ($staffList as $key=>$value){
  703. $html.='<option value='.$value['sid'].'_'.$value['username'].'>'.$value['username'].'</option>';
  704. }
  705. echo json_encode(array("success"=>true,'html'=>$html));die;
  706. }
  707. function loadCVS(){
  708. Doo::loadModel('longle');
  709. $longle=new longle();
  710. $list=$longle->find(array('select'=>'key_num','asArray' => TRUE));
  711. $file = fopen(DOO::conf()->SITE_PATH."upload/key2.csv",'r');
  712. while ($data = fgetcsv($file)) {
  713. $goods_list[$data[0]] = $data[1] ;
  714. }
  715. fclose($file);
  716. $sqlArray=array();
  717. $sql='UPDATE CLD_longle SET SerialNumber = CASE key_num ';
  718. foreach($list as $key=>$value){
  719. if(array_key_exists($value['key_num'],$goods_list)){
  720. //echo $value['key_num'].'-'.$goods_list[$value['key_num']].'<br/>';
  721. //$longle->SerialNumber=$goods_list[$value['key_num']];
  722. //$longle->update(array('where'=>'key_num="'.$value['key_num'].'"'));
  723. $sql.=' WHEN "'.$value['key_num'].'" THEN "'.$goods_list[$value['key_num']].'" ';
  724. array_push($sqlArray, '"'.$value['key_num'].'"');
  725. unset($goods_list[$value['key_num']]);
  726. }
  727. }
  728. $sql.='END WHERE key_num IN ('.implode(',', $sqlArray).')';
  729. echo $sql.'<br/>--------------------------------<br/>';
  730. foreach ($goods_list as $key=>$value){
  731. echo $key.','.$value.'<br/>';
  732. }
  733. }
  734. private function getRandChar($length){
  735. $str = null;
  736. $strPol = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
  737. $max = strlen($strPol)-1;
  738. for($i=0;$i<$length;$i++){
  739. $str.=$strPol[rand(0,$max)];//rand($min,$max)生成介于min和max两个数之间的一个随机整数
  740. }
  741. return $str;
  742. }
  743. private function getReceiptCount(){
  744. $status=2;
  745. $year=date('Y');
  746. Doo::loadModel('receipt');
  747. $receipt=new receipt();
  748. Doo::loadModel('verify');
  749. $verify=new verify();
  750. //user verify ID
  751. $vidList=array();
  752. $verifyDetail=$verify->find(array('where'=>'staff like "%\"'.$this->staff[0]['sid'].'\"%"','asArray'=>true));
  753. foreach ($verifyDetail as $key=>$value){
  754. array_push($vidList, $value['vid']);
  755. }
  756. $vid=implode(",", $vidList);
  757. if(empty($verifyDetail))
  758. $vid=0;
  759. $dateCondition=" and Year(date) =".$year;
  760. $approvalCondition=' and verifyStaff not like "%\"'.$this->staff[0]['sid'].'\":{%" ';
  761. $receiptList=$receipt->find(array('where'=>'verify in('.$vid.') and status='.$status.$dateCondition.$approvalCondition,'desc'=>'rid','asArray'=>true));
  762. return count($receiptList);
  763. }
  764. /**
  765. * 格式化excel文件为数组
  766. * @param unknown_type $file_url
  767. * @param unknown_type $mcid
  768. */
  769. function _format_excel_to_array($file_url = "") {
  770. if (! file_exists ( $file_url ))
  771. return array ();
  772. Doo::loadClass ( 'PHPExcel' );
  773. $PHPExcel = new PHPExcel ();
  774. $PHPReader = new PHPExcel_Reader_Excel2007 ();
  775. if (! $PHPReader->canRead ( $file_url )) {
  776. $PHPReader = new PHPExcel_Reader_Excel5 ();
  777. if (! $PHPReader->canRead ( $file_url )) {
  778. echo 'no Excel';
  779. return;
  780. }
  781. }
  782. $PHPExcel = $PHPReader->load ( $file_url );
  783. /**读取excel文件中的第一个工作表*/
  784. $currentSheet = $PHPExcel->getSheet ( 0 );
  785. /**取得最大的列号*/
  786. $allColumn = $currentSheet->getHighestColumn ();
  787. /**取得一共有多少行*/
  788. $allRow = $currentSheet->getHighestRow ();
  789. $excel_array = array ();
  790. for($currentRow = 2; $currentRow <= $allRow; $currentRow ++) {
  791. $excel_column = array ();
  792. //后期改进
  793. if($allColumn=='AM')
  794. $allColumn='Z';
  795. /**从第A列开始输出*/
  796. for($currentColumn = 'A'; $currentColumn <= $allColumn; $currentColumn ++) {
  797. $val = $currentSheet->getCellByColumnAndRow ( ord ( $currentColumn ) - 65, $currentRow )->getValue ();
  798. /**ord()将字符转为十进制数 iconv ( 'utf-8', 'gb2312',*/
  799. $val = "'" . addslashes ( $val ) . "'";
  800. if ($currentColumn == 'A')
  801. $excel_column ['key_num'] = $val;
  802. elseif ($currentColumn == 'C')
  803. $excel_column ['product'] = $val;
  804. elseif ($currentColumn == 'D'){
  805. $val=str_replace("'","",$val);
  806. $excel_column ['make_day'] = $this->excelTime($val);
  807. }elseif($currentColumn == 'E'){
  808. $val=str_replace("'","",$val);
  809. $excel_column ['alloted_time'] = $this->excelTime($val);
  810. }elseif($currentColumn == 'F'){
  811. $val=str_replace("'","",$val);
  812. $excel_column ['version'] = $val;
  813. }elseif ($currentColumn == 'B'){
  814. $val=str_replace("'","",$val);
  815. $excel_column ['SerialNumber'] = $val;
  816. }
  817. }
  818. array_push ( $excel_array, $excel_column );
  819. }
  820. return $excel_array;
  821. }
  822. function excelTime($date, $time = false)
  823. {
  824. if (function_exists ( 'GregorianToJD' ))
  825. {
  826. if (is_numeric ( $date ))
  827. {
  828. $jd = GregorianToJD ( 1, 1, 1970 );
  829. $gregorian = JDToGregorian ( $jd + intval ( $date ) - 25569 );
  830. $date = explode ( '/', $gregorian );
  831. $date_str = str_pad ( $date [2], 4, '0', STR_PAD_LEFT ) . "-" .
  832. str_pad ( $date [0], 2, '0', STR_PAD_LEFT ) . "-" .
  833. str_pad ( $date [1], 2, '0', STR_PAD_LEFT ) . ($time ? " 00:00:00" : '');
  834. return $date_str;
  835. }
  836. } else
  837. {
  838. $date = $date > 25568 ? $date + 1 : 25569;
  839. /* There was a bug if Converting date before 1-1-1970 (tstamp 0) */
  840. $ofs = (70 * 365 + 17 + 2) * 86400;
  841. $date = date ( "Y-m-d", ($date * 86400) - $ofs ) . ($time ? " 00:00:00" : '');
  842. }
  843. return $date;
  844. }
  845. function _GetFileEXT($filename) {
  846. $pics = explode ( '.', $filename );
  847. $num = count ( $pics );
  848. return $pics [$num - 1];
  849. }
  850. /**
  851. * 获取get或者POST值
  852. * @param string $name 属性名称
  853. * @return fixed 值
  854. */
  855. function get_args($name) {
  856. if (isset ( $_GET [$name] )) {
  857. if (is_array ( $_GET [$name] ))
  858. return $_GET [$name];
  859. else {
  860. return addslashes ( $_GET [$name] );
  861. //return $_GET [$name] ;
  862. }
  863. } elseif (isset ( $_POST [$name] )) {
  864. if (is_array ( $_POST [$name] ))
  865. return $_POST [$name];
  866. else {
  867. return addslashes ( $_POST [$name] );
  868. //return $_POST [$name];
  869. }
  870. } else {
  871. return false;
  872. }
  873. }
  874. function get_previous($on_page = 1) {
  875. return $on_page != 0 ? $on_page - 1 : $on_page;
  876. }
  877. /**
  878. * 获得分页数据
  879. * @param unknown_type $table
  880. * @param unknown_type $condition
  881. * @param unknown_type $on_page
  882. * @param unknown_type $page_size
  883. */
  884. function get_Tpage($table = "", $condition = "", $on_page = 1, $page_size = 20, $action = "",$tagSQL) {
  885. $page_c = "";
  886. $page ['previous'] = $this->get_previous ( $on_page );
  887. $page ['on_page'] = $on_page;
  888. $total_count = $this->get_table_Tcount ( $table, $condition,$tagSQL );
  889. $total = intval ( $total_count / $page_size );
  890. $page ['total_page'] = ($total_count % $page_size) == 0 ? $total : $total + 1;
  891. $page ['total_data'] = $total_count;
  892. $page ['next'] = $on_page == $page ['total_page'] ? $page ['total_page'] : $on_page + 1;
  893. $i = 1;
  894. $page_max = 1;
  895. if ($on_page > 10) {
  896. $page_max = intval ( $on_page / 10 ) + 1;
  897. $i = intval ( $on_page / 10 ) * 10 - 1;
  898. }
  899. $page ['page'] = $page_c;
  900. $page ['lower'] = (-- $on_page) * $page_size;
  901. return $page;
  902. }
  903. /**
  904. * 获得分页数据
  905. * @param unknown_type $table
  906. * @param unknown_type $condition
  907. * @param unknown_type $on_page
  908. * @param unknown_type $page_size
  909. */
  910. function get_page($table = "", $condition = "", $on_page = 1, $page_size = 20, $action = "", $get = "", $other = "page",$staffid="",$search,$tooltip,$cateid,$tagSQL) {
  911. $page_c = "";
  912. $page ['previous'] = $this->get_previous ( $on_page );
  913. $page ['on_page'] = $on_page;
  914. $total_count = $this->get_table_count ( $table, $condition ,$staffid,$search,$tooltip,$cateid,$tagSQL);
  915. $total = intval ( $total_count / $page_size );
  916. $page ['total_page'] = ($total_count % $page_size) == 0 ? $total : $total + 1;
  917. $page ['total_data'] = $total_count;
  918. $page ['next'] = $on_page == $page ['total_page'] ? $page ['total_page'] : $on_page + 1;
  919. $i = 1;
  920. $page_max = 1;
  921. if ($on_page > 10) {
  922. $page_max = intval ( $on_page / 10 ) + 1;
  923. $i = intval ( $on_page / 10 ) * 10 - 1;
  924. }
  925. for(; $i <= $page ['total_page']; $i ++) {
  926. if ($i == $on_page) {
  927. if ($other == "page")
  928. $page_c .= '<a href="javascript:void(0);" class="current">' . $i . '</a>';
  929. else
  930. $page_c .= '&nbsp;<span class="current">' . $i . '</span>&nbsp;';
  931. } else if ($other == "page")
  932. $page_c .= '<a href="' . $action . $i . $get . '" class="paginate">' . $i . '</a>';
  933. else
  934. $page_c .= '&nbsp;<a href="' . $action . $i . $get . '" class="paginate">' . $i . '</a>&nbsp;';
  935. if ($i == (10 * $page_max))
  936. break;
  937. }
  938. $page ['page'] = $page_c;
  939. $page ['lower'] = (-- $on_page) * $page_size;
  940. return $page;
  941. }
  942. /**
  943. * 获取总页数
  944. * @param unknown_type $table
  945. * @param unknown_type $condition
  946. */
  947. public function get_table_Tcount($table = "", $condition = "",$tagSQL) {
  948. if ($tagSQL)
  949. $sql = "select count(*) as count from CLD_tagCompanyNexus as a left join CLD_company as b on (a.company=b.cid ) where ".$condition ;
  950. else
  951. $sql = "select count(*) as count from CLD_company where " . $condition ;
  952. $query = Doo::db ()->query ( $sql );
  953. $result = $query->fetch ();
  954. return $result ['count'];
  955. }
  956. /**
  957. * 获取总页数
  958. * @param unknown_type $table
  959. * @param unknown_type $condition
  960. */
  961. public function get_table_count($table = "", $condition = "",$staffid="",$search,$tooltip,$cateid,$tagSQL) {
  962. //$sql = "select count(*) as count from " . $table . " where 1 " . $condition;
  963. //echo $staffid;die;
  964. //
  965. if (!empty($staffid)){
  966. //$staffid="and a.sid= '".$staffid."'"; " . $table . " as a left join on (a.cid=b.cid ".$staffid.")
  967. $sql = "select count(*) as count from CLD_client as b left join CLD_tag_client as c on (b.cid=c.client) where 1 " . $condition ;
  968. }else{
  969. if(strlen($condition)==1||empty($condition))
  970. $sql = "select count(*) as count from CLD_client as a ".$condition;
  971. else
  972. $sql = "select count(*) as count from CLD_client as a left join CLD_tag_client as c on (a.cid=c.client) where 1 ".$condition;
  973. }
  974. if(!empty($search))
  975. $sql = "select count(*) as count from CLD_client as a where 1 ".$condition ;
  976. if(!empty($tooltip)){
  977. $condition=str_replace("a.","c.",$condition);
  978. if ($tagSQL)
  979. $sql = "select count(*) as count from CLD_C_tooltip as a left join CLD_tag_client as c on (a.cid=c.client) left join CLD_client as b on (c.client=b.cid ) where a.name like '%".$tooltip."%' and a.cateid = ".$cateid." ".$condition ;
  980. else
  981. $sql = "select count(*) as count from CLD_C_tooltip as a left join CLD_client as b on (a.cid=b.cid ) where a.name like '%".$tooltip."%' and a.cateid = ".$cateid." ".$condition ;
  982. }
  983. //echo $sql;
  984. $query = Doo::db ()->query ( $sql );
  985. $result = $query->fetch ();
  986. return $result ['count'];
  987. }
  988. public function holidayGroup(){
  989. Doo::loadModel('staff');
  990. Doo::loadModel("holidayacman");
  991. $acman=new HACMan();
  992. $staff=new staff();
  993. $data['staffList']=$staff->find(array('select'=>'username,sid,wxid', 'where' => 'cid!=1','asArray'=>true));
  994. $acmanlist=$acman->find(array('where' => 'type=0','asArray'=>true));
  995. $data['acmanlist'] = $acmanlist;
  996. $data['staff']=$this->staff;
  997. $data['memu'] = 'holiday';
  998. $this->render( "/admin/admin_holidayGroup", $data );
  999. }
  1000. public function addHolidayApprover(){
  1001. if(!isset($_POST['title']) || empty($_POST['title'])){
  1002. exit('请输入组名');
  1003. }
  1004. if(!isset($_POST['staff']) || empty($_POST['staff'])){
  1005. exit('请选择成员');
  1006. }
  1007. $idname = $name = $pinyinname = array();
  1008. foreach($_POST['staff'] as $k => $v){
  1009. array_push($idname)
  1010. }
  1011. Doo::loadModel("holidayacman");
  1012. $acman=new HACMan();
  1013. $acman->typename = $_POST['title'];
  1014. var_dump($_POST);
  1015. exit;
  1016. }
  1017. public function holidayCSGroup(){
  1018. $data['memu'] = 'holiday';
  1019. $this->render( "/admin/admin_holidayGroup_cc", $data );
  1020. }
  1021. //检查年假是否过期并更新年假
  1022. private function updateAnnualLeave($staff){
  1023. Doo::loadModel('holidaystaff');
  1024. $hstaff = new HStaff();
  1025. $hstaffmsg = $hstaff->getOne(array('where' => 'uid='.$staff['sid'],'asArray' => TRUE));
  1026. $hiredate = $staff['hiredate'];
  1027. if(intval((time()-strtotime($hiredate))/(86400*365)) != $hstaffmsg['hadyear'] && $staff['nature'] == 1 ){
  1028. $hstaff->uid = $staff['sid'];
  1029. $hstaff->hadyear = intval((time()-strtotime($hiredate))/(86400*365));
  1030. $hstaff->yearnum = intval((time()-strtotime($hiredate))/(86400*365)) != 0 ? 5 : 0;
  1031. $hstaff->update();
  1032. }
  1033. }
  1034. }
  1035. ?>