function collectData($type) { initTable($type); $tables = array('socdem' => array('table' => 'ank1', 'field' => 'user_id'), 'potreb' => array('table' => 'ank2', 'field' => 'person_id', 'user_fnc' => 'personByUser')); $total = 0; $st = query('select * from panelie_user where status_id in (10,11) and is_tester=0'); while ($obj = mysql_fetch_assoc($st)) { if (isset($tables[$type]['user_fnc'])) { $obj['user_id'] = $tables[$type]['user_fnc']($obj['user_id']); } if ($obj1 = mysql_fetch_assoc(query('select * from panelie_' . $tables[$type]['table'] . ' where ' . $tables[$type]['field'] . '=' . $obj['user_id']))) { $binds = array(); $binds[] = 'id=' . $obj['user_id']; $st2 = query("select * from panelie_single_choice where anketa_type='{$type}' and anketa_id='" . $obj1['id'] . "'"); while ($ans = mysql_fetch_assoc($st2)) { $binds[] = $ans['question_name'] . "=" . $ans['value']; if ($ans['descr']) { $binds[] = $ans['question_name'] . "_descr='" . $ans['descr'] . "'"; } } $oldName = ''; $values = array(); $freqs = array(); $descr = NULL; $st2 = query("select * from panelie_multiple_choice where anketa_type='{$type}' and anketa_id='" . $obj1['id'] . "' order by question_name"); while ($ans = mysql_fetch_assoc($st2)) { if ($oldName != $ans['question_name'] && $oldName) { $binds = array_merge($binds, applyData($oldName, $values, $freqs, $descr)); $values = array(); $freqs = array(); $descr = NULL; } $values[] = $ans['value']; if ($ans['freq']) { $freqs[$ans['value']] = $ans['freq']; } if ($ans['descr']) { $descr = $ans['descr']; } $oldName = $ans['question_name']; } $binds = array_merge($binds, applyData($oldName, $values, $freqs, $descr)); if ($type == 'socdem') { $binds[] = getDistrict($obj['city_id']); } $q = "insert into " . $type . "_data set " . join(', ', $binds); } // print $q."\n"; query($q); $total++; } print "{$total} rows inserted into table " . $type . "_data\n"; }
/** * 获取项目详细信息 * @param $id 项目编号 * @return false 未找到相关项目 * 项目详细信息 */ public function getdetail($id) { $project = $this->where(array('id' => $id, 'status' => 9))->find(); if (empty($project)) { return false; } $team = M('ProjectTeam')->join('jm_picture on jm_picture.id = jm_project_team.header_img', 'left')->where(array('project_id' => $id, 'jm_project_team.status' => 0))->field(array('name', 'postion', 'about', 'path' => 'header_img'))->order('sort')->select(); $pics = M('ProjectTemp')->join('jm_picture on jm_picture.id = jm_project_temp.info_key', 'left')->field(array('path' => 'image_path'))->where(array('project_id' => $id, 'temp_type' => 1))->select(); // 项目信息图片完善 $project['project_cover'] = 'http://www.dreammove.cn' . $project['project_cover']; $project['description'] = str_replace('"/Uploads/', '"http://www.dreammove.cn/Uploads/', $project['description']); $project['plan'] = str_replace('"/Uploads/', '"http://www.dreammove.cn/Uploads/', $project['plan']); $project['custom'] = str_replace('"/Uploads/', '"http://www.dreammove.cn/Uploads/', $project['custom']); $project['yingli_mode'] = str_replace('"/Uploads/', '"http://www.dreammove.cn/Uploads/', $project['yingli_mode']); $project['avantages'] = str_replace('"/Uploads/', '"http://www.dreammove.cn/Uploads/', $project['avantages']); $project['province_name'] = getDistrict($project['province']); $project['city_name'] = getDistrict($project['city']); $project['founder_name'] = get_membername($project['uid']); $project['leader_name'] = get_membername($project['leader_id']); $data['project'] = $project; unset($data['project']['province']); unset($data['project']['city']); unset($data['project']['status']); unset($data['project']['cover']); unset($data['project']['vote_leader']); unset($data['project']['agreement']); unset($data['project']['project_valuation']); unset($data['project']['update_time']); unset($data['project']['agree_fund']); unset($data['project']['uid']); unset($data['project']['leader_id']); unset($data['project']['type']); // 团队成员头像完善 foreach ($team as $k => $v) { if (!empty($v['header_img'])) { $v['header_img'] = 'http://www.dreammove.cn' . $v['header_img']; } $v['position'] = $v['postion']; $data['team'][] = $v; } foreach ($pics as $k => $v) { if (!empty($v['image_path'])) { $v['image_path'] = 'http://www.dreammove.cn' . $v['image_path']; } $data['pics'][] = $v; } return $data; }
function reformatData($project) { $data['project_index'] = $project['id']; //项目编号 $data['project_name'] = $project['project_name']; //项目名称 $data['project_stage'] = $this->stageConvertor($project['stage']); //项目阶段 $data['project_type'] = get_code_name($project['industry']); //项目类型 $data['project_abstract'] = $project['abstract']; //项目简介 $data['project_cover'] = 'http://' . $_SERVER['HTTP_HOST'] . get_cover($project['cover'], 'path'); //封面url $data['project_province'] = getDistrict($project['province']); //省 $data['project_city'] = getDistrict($project['city']); //市 $data['project_companyname'] = $project['company_name']; //公司名称 $data['project_leader'] = get_membername($project['leader_id']); //项目发起人 $data['project_financinglimit'] = $project['need_fund']; //目标融资额 if ($data['project_stage'] == 1) { $data['project_valuation'] = 0; //项目最终估值 } else { $data['project_valuation'] = M('ProjectFund')->where(array('project_id' => $project['id']))->getField('final_valuation'); //项目最终估值 } $data['project_mininvestment'] = $project['follow_fund']; //起投额 $data['project_raisedfund'] = $project['has_fund']; //完成金额 $data['project_investornumber'] = $project['investor_count']; //投资人数 $data['project_detailurl'] = 'http://' . $_SERVER['HTTP_HOST'] . '/project/detail/id/' . $project['id']; //项目url $data['project_details'] = M('ProjectInfo')->where(array('project_id' => $project['id']))->getField('description'); //项目详细详情 $data['project_details'] = str_replace('"/Uploads', '"http://' . $_SERVER['HTTP_HOST'] . "/Uploads/", $data['project_details']); if ($project['team']) { $data['project_team'] = $project['team']; } return $data; }
public function update() { //B('FilterString'); if (is_numeric($_POST['province'])) { $_POST['province'] = getProvince($_POST['province']); $_POST['city'] = getCity($_POST['city']); $_POST['dist'] = getDistrict($_POST['dist']); } $_POST['birthday'] = strtotime($_POST['birthday']); $name = $this->getActionName(); $model = CM($name); if (false === $model->create()) { $this->error($model->getError()); } // 更新数据 $list = $model->save(); if (false !== $list) { //成功提示 $this->assign('jumpUrl', Cookie::get('_currentUrl_')); $this->success('编辑成功!'); } else { //错误提示 $this->error('编辑失败!'); } }
<table class="adminTable col-100" cellspacing="0"> <tr> <th>Order No.</th> <th>Date</th> <th>Discount</th> <th>Customer</th> <th class="col-m-0">Delivery Address</th> <th class="col-m-0">District</th> <th>Delivery Job</th> </tr> <?php foreach ($orders as $o) { $cust = getCustomer($o[custNo]); $dist = getDistrict($o[distNo]); echo '<tr> <td>' . $o[ordNo] . '</td> <td>' . $o[ordDate] . '</td> <td>' . $o[ordDiscount] . '</td> <td> <a href="cust_details.php?custNo=' . $cust[custName] . '">' . $cust[custName] . '</td> <td class="col-m-0">' . $o[deliAddr] . '</td> <td class="col-m-0">' . $dist[distName] . '</td> <td> <a href="job_details.php?jobNo=' . $o[jobNo] . '">' . $o[jobNo] . '</a></td> </tr>'; } ?> </table> <?php
function getlocation($id) { $v = getDistrict($id); $v = str_ireplace('省', '', $v); $v = str_ireplace('自治区', '', $v); $v = str_ireplace('市', '', $v); return $v; }
<th></th></tr></thead><tbody> JOBTABLE_HEAD; $jobTable_row_format = <<<JOBTABLE_ROW <tr> \t<td align="center"><input name='jobNo' readonly type='text' style='border:none' value='%s'></input></td> \t<td align="center"><input name='date' style='border:none' type='date' class='changable dataPickerTd' readonly value='%s'/></td> \t<td align="center"> {$selectionBox}\t \t\t<input name='district' style='border:none' type='text' class='changable' readonly value='%s'/> \t\t<input name='distNo' type='hidden' value='%s' /></td> \t<td align="center"> \t\t<button class='removeJob'>Remove</button> \t</td> </tr> JOBTABLE_ROW; while (isset($jobs) && ($row = $jobs->fetch_assoc())) { $dist = getDistrict($row[distNo]); printf($jobTable_row_format, $row[jobNo], $row[jobDate], $dist["distName"], $row[distNo]); } echo "</tbody></table></div>"; ?> <div id="retPlaceHolder" class="col-20 col-m-100 topLine"> </div> <div id="btn_group"> <button id="weekopener" class="btn">Add Job Weekly</button> <button id="dayopener" class="btn">Add Job Daily</button> </div>
function getProvinceCity($provinceID, $cityID) { $p = getDistrict($provinceID); $c = getDistrict($cityID); return $p . ' ' . $c; }