public function editattachAction() { $result = array('success' => true, 'info' => '上传成功'); $request = $this->getRequest()->getParams(); $id = isset($request['id']) ? $request['id'] : null; if ($id && isset($_FILES['attach_file'])) { $now = date('Y-m-d H:i:s'); $user_session = new Zend_Session_Namespace('user'); $user_id = $user_session->user_info['user_id']; $file = $_FILES['attach_file']; $file_name = $file['name']; $file_extension = strrchr($file_name, "."); $h = new Application_Model_Helpers(); $tmp_file_name = $h->getMicrotimeStr() . $file_extension; $savepath = "../upload/files/" . date('Y-m-d') . '/'; if (!is_dir($savepath)) { mkdir($savepath); // 目录不存在则创建目录 } $tmp_file_path = $savepath . $tmp_file_name; move_uploaded_file($file["tmp_name"], $tmp_file_path); $vacation = new Hra_Model_Attendance_Vacation(); $vacationData = $vacation->getData(null, $id); if ($vacationData['attach_path'] != '' && file_exists($vacationData['attach_path'])) { unlink($vacationData['attach_path']); } $data = array('attach_name' => $file_name, 'attach_path' => $tmp_file_path, 'update_user' => $user_id, 'update_time' => $now); $vacation->update($data, "id = " . $id); } echo Zend_Json::encode($result); exit; }
public function importcontactAction() { $result = array('success' => true, 'data' => array(), 'info' => '导入成功'); if (isset($_FILES['csv'])) { $file = $_FILES['csv']; $file_extension = strrchr($file['name'], "."); $h = new Application_Model_Helpers(); $tmp_file_name = $h->getMicrotimeStr() . $file_extension; $savepath = "../temp/"; $tmp_file_path = $savepath . $tmp_file_name; move_uploaded_file($file["tmp_name"], $tmp_file_path); $file = fopen($tmp_file_path, "r"); $i = 0; $materiel = new Product_Model_Materiel(); while (!feof($file)) { $csv_data = fgetcsv($file); $name = isset($csv_data[1]) ? $csv_data[1] : ''; $post = isset($csv_data[2]) ? $csv_data[2] : ''; $tel = isset($csv_data[3]) ? $csv_data[3] : ''; $fax = isset($csv_data[4]) ? $csv_data[4] : ''; $email = isset($csv_data[5]) ? $csv_data[5] : ''; $person_liable = isset($csv_data[6]) ? $csv_data[6] : ''; $area_code = isset($csv_data[7]) ? $csv_data[7] : ''; $country = isset($csv_data[8]) ? $csv_data[8] : ''; $area = isset($csv_data[9]) ? $csv_data[9] : ''; $area_city = isset($csv_data[10]) ? $csv_data[10] : ''; $address = isset($csv_data[11]) ? $csv_data[11] : ''; $zip_code = isset($csv_data[12]) ? $csv_data[12] : ''; $remark = isset($csv_data[13]) ? $csv_data[13] : ''; if ($i > 0 && $name != '') { array_push($result['data'], array('name' => $name, 'post' => $post, 'tel' => $tel, 'fax' => $fax, 'email' => $email, 'person_liable' => $person_liable, 'area_code' => $area_code, 'country' => $country, 'area' => $area, 'area_city' => $area_city, 'address' => $address, 'zip_code' => $zip_code, 'remark' => $remark)); } $i++; } fclose($file); } else { $result['success'] = false; $result['info'] = '没有选择文件,导入失败!'; } /* echo '<pre>'; print_r($result); exit; */ echo Zend_Json::encode($result); exit; }
public function photoAction() { $result = array('success' => true, 'info' => '上传成功'); $request = $this->getRequest()->getParams(); $employee_id = isset($request['employee_id']) ? $request['employee_id'] : null; if ($employee_id && isset($_FILES['attach_file'])) { $now = date('Y-m-d H:i:s'); $user_session = new Zend_Session_Namespace('user'); $user_id = $user_session->user_info['user_id']; $file = $_FILES['attach_file']; $file_name = $file['name']; $file_extension = strrchr($file_name, "."); /* if ($file_extension != '.jpg') { $result = array( 'success' => false, 'info' => '格式错误,请选择格式为jpg的相片文件!' ); echo Zend_Json::encode($result); exit; } */ $h = new Application_Model_Helpers(); $tmp_file_name = $h->getMicrotimeStr() . $file_extension; $savepath = "../upload/portrait/"; if (!is_dir($savepath)) { mkdir($savepath); // 目录不存在则创建目录 } $tmp_file_path = $savepath . $tmp_file_name; move_uploaded_file($file["tmp_name"], $tmp_file_path); $employee = new Hra_Model_Employee(); $employeeData = $employee->getInfoById($employee_id); if ($employeeData['photo_path'] != '' && file_exists($employeeData['photo_path'])) { unlink($employeeData['photo_path']); } $employeeData = array('photo_path' => $tmp_file_path, 'update_user' => $user_id, 'update_time' => $now); $employee->update($employeeData, "id = " . $employee_id); } echo Zend_Json::encode($result); exit; }
public function importAction() { $result = array('success' => true, 'info' => '导入成功'); $request = $this->getRequest()->getParams(); $now = date('Y-m-d H:i:s'); if (isset($_FILES['csv'])) { $now = date('Y-m-d H:i:s'); $user_session = new Zend_Session_Namespace('user'); $user_id = $user_session->user_info['user_id']; $file = $_FILES['csv']; $file_extension = strrchr($file['name'], "."); $h = new Application_Model_Helpers(); $tmp_file_name = $h->getMicrotimeStr() . $file_extension; $savepath = "../temp/"; $tmp_file_path = $savepath . $tmp_file_name; move_uploaded_file($file["tmp_name"], $tmp_file_path); $plist = new Product_Model_Productlist(); // 读取文件 require_once LIBRARY_PATH . "/Excel/reader.php"; $reader = new Spreadsheet_Excel_Reader(); $reader->setOutputEncoding('UTF-8'); $reader->setUTFEncoder('mb'); $reader->setRowColOffset(1); $reader->read($tmp_file_path); error_reporting(E_ALL ^ E_NOTICE); $data = array(); for ($i = 1; $i <= $reader->sheets[0]['numRows']; $i++) { $row = array(); for ($j = 1; $j <= $reader->sheets[0]['numCols']; $j++) { $row[] = $reader->sheets[0]['cells'][$i][$j]; } $data[] = $row; } // 数据校验 if (count($data) <= 1) { $result['success'] = false; $result['info'] = "文件中无数据!"; echo Zend_Json::encode($result); exit; } $cols = array("sn", "code", "step", "description", "is_bom_exists", "bom_apply_time", "bom_archive_time", "product_code", "bosa", "bosa_supply", "tosa", "tosa_supply", "rosa", "rosa_supply", "pcb", "pcba", "dg02", "dg01", "product_label", "barcode_label", "label_print_rule", "tooling_model", "sample_send_time", "pra", "trial_produce_qa1", "pmr", "dl", "ipa", "cri", "ds", "dd", "pl", "pes", "pcb_file", "icd", "smt", "mp", "sqr", "dvs", "dvp", "dvr", "dvt", "rtr", "emr", "mtb", "tsq", "sqc", "ed", "pts", "sp", "ep", "fep", "fsp", "ld", "pd", "pg", "nfc", "frm", "pfc", "wi", "other", "create_time", "create_user", "update_time", "update_user"); for ($i = 1; $i < count($data); $i++) { $num = $i + 1; $row = $data[$i]; if (count($row) < 2 || !$row[1]) { continue; } $code = $row[1]; if (!$this->checkExists($code)) { $insertData = array(); $k = 0; foreach ($cols as $c) { $insertData[$c] = $row[$k]; $k++; } try { $plist->insert($insertData); } catch (Exception $e) { $result['result'] = false; $result['info'] = $e->getMessage(); echo Zend_Json::encode($result); exit; } } else { $errors[] = $code; } } $result['error'] = $errors; } echo Zend_Json::encode($result); exit; }
public function importAction() { $result = array('success' => true, 'info' => '导入成功'); $request = $this->getRequest()->getParams(); $type = isset($request['type']) ? $request['type'] : null; $nid = isset($request['nid']) ? $request['nid'] : ""; if (isset($_FILES['csv'])) { $now = date('Y-m-d H:i:s'); $user_session = new Zend_Session_Namespace('user'); $user_id = $user_session->user_info['user_id']; $file = $_FILES['csv']; $file_extension = strrchr($file['name'], "."); $h = new Application_Model_Helpers(); $tmp_file_name = $h->getMicrotimeStr() . $file_extension; $savepath = "../temp/"; $tmp_file_path = $savepath . $tmp_file_name; move_uploaded_file($file["tmp_name"], $tmp_file_path); $materiel = new Product_Model_Materiel(); $db = $materiel->getAdapter(); if ($type == 'dev') { $fa = new Product_Model_Fadev(); $son = new Product_Model_Sondev(); $table = "oa_product_bom_fa_dev"; } else { if ($type == 'bom') { $fa = new Product_Model_Fa(); $son = new Product_Model_Son(); $table = "oa_product_bom_fa"; } } if ($type == 'dev' || $type == 'bom') { $file = fopen($tmp_file_path, "r"); $data = array(); while (!feof($file)) { array_push($data, fgetcsv($file)); } // 数据校验 if (count($data) <= 1) { $result['success'] = false; $result['info'] = "文件中无数据!"; fclose($file); echo Zend_Json::encode($result); exit; } for ($i = 1; $i < count($data); $i++) { $num = $i + 1; $row = $data[$i]; if ($i == 1 && !$row[1]) { $result['success'] = false; $result['info'] = "请以上级物料开头:第" . $num . "行!"; fclose($file); echo Zend_Json::encode($result); exit; } if (!$row[1] && !$row[2]) { continue; } if ($row[1] && $row[2]) { $result['success'] = false; $result['info'] = "上级物料和下级物料不能同时存在:第" . $num . "行!"; fclose($file); echo Zend_Json::encode($result); exit; } if ($row[1]) { if (!$materiel->checkExist($row[1])) { $result['success'] = false; $result['info'] = "物料“" . $row[1] . "”不存在:第" . $num . "行!"; fclose($file); echo Zend_Json::encode($result); exit; } $m = $materiel->getMaterielByCode($row[1]); } if ($row[2]) { if (!$materiel->checkExist($row[2])) { $result['success'] = false; $result['info'] = "物料“" . $row[2] . "”不存在:第" . $num . "行!"; fclose($file); echo Zend_Json::encode($result); exit; } } if ($row[2] && $row[7]) { $replace = explode(',', $row[7]); foreach ($replace as $r) { $r = iconv('utf-8', 'gbk//IGNORE', $r); if (!$materiel->checkExist($r)) { $result['success'] = false; $result['info'] = "物料“" . $r . "”不存在:第" . $i . "行!"; fclose($file); echo Zend_Json::encode($result); exit; } } } if ($i > 1 && $row[1] && $data[$i - 1][1]) { $result['success'] = false; $result['info'] = "BOM“" . $data[$i - 1][1] . "”不存在子物料:第{$i行!}"; fclose($file); echo Zend_Json::encode($result); exit; } } // 只取一次最大值,可能遇到重号 $maxkeys = $fa->getAdapter()->query("select ifnull(max(recordkey),0) as maxkey from {$table}")->fetchObject(); $recordkey = $maxkeys->maxkey; $pid = ""; $faArr = array(); $sonArr = array(); $obsoleteWhere = "1=0"; // 校验成功,开始保存数据 for ($i = 1; $i < count($data); $i++) { $row = $data[$i]; if ($row[1]) { $m = $materiel->getMaterielByCode($row[1]); $recordkey++; $pid = $m['id']; $faData = array('nid' => $nid, 'recordkey' => $recordkey, 'id' => $m['id'], 'code' => $row[1], 'qty' => 1, 'state' => $row[3] ? $row[3] : 'EBOM', 'ver' => $row[4] ? $row[4] : '1.0'); if ($faData['ver'] > '1.0') { $obsoleteWhere .= " or (code='" . $row[1] . "' and ver < '" . $faData['ver'] . "')"; } // 检查是否已经存在 if ($type == 'dev') { $list = $fa->getFaList("nid = {$nid} and ver = '" . $faData['ver'] . "' and id = " . $m['id']); } else { $list = $fa->getFaList("ver = '" . $faData['ver'] . "' and id = " . $m['id']); } if ($list && count($list) > 0) { $result['success'] = false; $result['info'] = "数据已存在:" . $faData['code'] . " " . $faData['ver'] . "!"; fclose($file); echo Zend_Json::encode($result); exit; } $faArr[] = $faData; } if ($row[2]) { $m = $materiel->getMaterielByCode($row[2]); $sonData = array('nid' => $nid, 'recordkey' => $recordkey, 'pid' => $pid, 'id' => $m['id'], 'code' => $row[2], 'qty' => $row[5] ? $row[5] : 1, 'partposition' => $row[6] ? $row[6] : '', 'replace' => $row[7] ? $row[7] : '', 'remark' => $row[8] ? $row[8] : ''); // 检查是否已经存在 if ($type == 'dev') { $list = $son->getList("nid = {$nid} and id = " . $m['id']); } else { $list = $son->getList("recordkey = {$recordkey} and id = " . $m['id']); } if ($list && count($list) > 0) { $result['success'] = false; $result['info'] = "数据已存在:" . $sonData['code'] . "!"; fclose($file); echo Zend_Json::encode($result); exit; } $sonArr[] = $sonData; } } $db->beginTransaction(); try { foreach ($faArr as $faData) { $fa->insert($faData); } foreach ($sonArr as $sonData) { $son->insert($sonData); } // 旧版作废 if ($type == 'bom') { $bosoleteData = array("state" => "Obsolete"); $fa->update($bosoleteData, $obsoleteWhere); } $db->commit(); //执行commit } catch (Exception $e) { $db->rollBack(); //如果出现错误,执行回滚操作 $result['result'] = false; $result['info'] = $e->getMessage(); fclose($file); echo Zend_Json::encode($result); exit; } fclose($file); } } echo Zend_Json::encode($result); exit; }
public function importitemsAction() { $result = array('success' => true, 'data' => array(), 'info' => '导入成功'); if (isset($_FILES['csv'])) { $file = $_FILES['csv']; $file_extension = strrchr($file['name'], "."); $h = new Application_Model_Helpers(); $tmp_file_name = $h->getMicrotimeStr() . $file_extension; $savepath = "../temp/"; $tmp_file_path = $savepath . $tmp_file_name; move_uploaded_file($file["tmp_name"], $tmp_file_path); $file = fopen($tmp_file_path, "r"); $i = 0; $materiel = new Product_Model_Materiel(); $desc = new Product_Model_Desc(); while (!feof($file)) { $csv_data = fgetcsv($file); $code = isset($csv_data[1]) ? $csv_data[1] : ''; $qty = isset($csv_data[2]) ? $csv_data[2] : 0; $date_req = isset($csv_data[3]) ? str_replace('-', '/', $csv_data[3]) : ''; $project_info = isset($csv_data[4]) ? $csv_data[4] : ''; $order_req_num = isset($csv_data[5]) ? $csv_data[5] : ''; $customer_address = isset($csv_data[6]) ? $csv_data[6] : ''; $customer_aggrement = isset($csv_data[7]) ? $csv_data[7] : ''; $remark = isset($csv_data[8]) ? $csv_data[8] : ''; if ($i > 0 && $code != '') { $materielData = $materiel->getOptionList($code); $is_changing = false; if ($code != '') { $is_changing = $desc->isChanging($code); } if (count($materielData) > 0) { array_push($result['data'], array('code' => $code, 'is_changing' => $is_changing, 'name' => $materielData['name'], 'description' => $materielData['description'], 'unit' => $materielData['unit'], 'qty' => $qty, 'date_req' => $date_req, 'project_info' => mb_convert_encoding($project_info, 'UTF-8', 'GBK'), 'order_req_num' => $order_req_num, 'customer_address' => $customer_address, 'customer_aggrement' => $customer_aggrement, 'remark' => mb_convert_encoding($remark, 'UTF-8', 'GBK'))); } else { $result['success'] = 0; $result['info'] = $code . '未找到,导入失败!'; echo Zend_Json::encode($result); exit; } } $i++; } fclose($file); } else { $result['success'] = false; $result['info'] = '没有选择文件,导入失败!'; } //echo '<pre>';print_r($result);die; echo Zend_Json::encode($result); exit; }
public function importAction() { $result = array('success' => true, 'info' => '导入成功'); $request = $this->getRequest()->getParams(); $now = date('Y-m-d H:i:s'); if (isset($_FILES['csv'])) { $now = date('Y-m-d H:i:s'); $user_session = new Zend_Session_Namespace('user'); $user_id = $user_session->user_info['user_id']; $file = $_FILES['csv']; $file_extension = strrchr($file['name'], "."); $h = new Application_Model_Helpers(); $tmp_file_name = $h->getMicrotimeStr() . $file_extension; $savepath = "../temp/"; $tmp_file_path = $savepath . $tmp_file_name; move_uploaded_file($file["tmp_name"], $tmp_file_path); $materiel = new Product_Model_Materiel(); $supply = new Product_Model_Bpartner(); $db = $materiel->getAdapter(); $file = fopen($tmp_file_path, "r"); $data = array(); while (!feof($file)) { array_push($data, fgetcsv($file)); } // 数据校验 if (count($data) <= 1) { $result['success'] = false; $result['info'] = "文件中无数据!"; fclose($file); echo Zend_Json::encode($result); exit; } // 文件格式 # 物料号 MPQ MOQ LT 供应商1 供应商2 备注 $errorCode = array(); $okData = array(); for ($i = 1; $i < count($data); $i++) { $num = $i + 1; $row = $data[$i]; if (count($row) < 2 || !$row[1]) { continue; } for ($k = 0; $k < count($row); $k++) { $row[$k] = str_replace("\"", "", $row[$k]); } // check materiel code if ($materiel->checkExist($row[1])) { // data $code = $row[1]; $supply1Id = $supply2Id = ''; $mpq = $moq = $lt = 0; $manufacturers = $remark = ''; if (isset($row[2]) && $row[2] && is_numeric($row[2])) { $mpq = $row[2]; } if (isset($row[3]) && $row[3] && is_numeric($row[3])) { $moq = $row[3]; } if (isset($row[4]) && $row[4] && is_numeric($row[4])) { $lt = $row[4]; } // supply $supply1 = isset($row[5]) ? $row[5] : 0; $supply2 = isset($row[6]) ? $row[6] : 0; // check supply exists if ($supply1) { $supply1 = iconv('GBK', 'UTF-8', $supply1); $where = "code = '{$supply1}' or cname like '{$supply1}' or ename like '{$supply1}' or concat(code, cname) like '{$supply1}' or concat(code, ename) like '{$supply1}'"; $supply1Data = $supply->getJoinList($where, array(), array('id')); if (count($supply1Data) > 0) { $supply1Id = $supply1Data[0]['id']; } } if ($supply2) { $supply2 = iconv('GBK', 'UTF-8', $supply2); $where = "code = '{$supply2}' or cname like '{$supply2}' or ename like '{$supply2}' or concat(code, cname) like '{$supply2}' or concat(code, ename) like '{$supply2}'"; $supply2Data = $supply->getJoinList($where, array(), array('id')); if (count($supply2Data) > 0) { $supply2Id = $supply2Data[0]['id']; } } $manufacturers = isset($row[7]) ? iconv('GBK', 'UTF-8', $row[7]) : ''; $remark = isset($row[8]) ? iconv('GBK', 'UTF-8', $row[8]) : ''; $profile = array('mpq' => $mpq, 'moq' => $moq, 'tod' => $lt, 'supply1' => $supply1Id, 'supply2' => $supply2Id, 'manufacturers' => $manufacturers, 'remark' => $remark); $where = "code = '{$code}'"; try { $materiel->update($profile, $where); } catch (Exception $e) { $errorCode[] = $code; } $okData[] = $row; } else { $errorCode[] = $row[1]; } } if (count($errorCode) > 0) { $result['error'] = $errorCode; } fclose($file); } echo Zend_Json::encode($result); exit; }
public function importAction() { $result = array('success' => true, 'info' => '导入成功'); $request = $this->getRequest()->getParams(); $type = isset($request['type']) ? $request['type'] : null; if (isset($_FILES['csv'])) { $now = date('Y-m-d H:i:s'); $user_session = new Zend_Session_Namespace('user'); $user_id = $user_session->user_info['user_id']; $file = $_FILES['csv']; $file_extension = strrchr($file['name'], "."); $h = new Application_Model_Helpers(); $tmp_file_name = $h->getMicrotimeStr() . $file_extension; $savepath = "../temp/"; $tmp_file_path = $savepath . $tmp_file_name; move_uploaded_file($file["tmp_name"], $tmp_file_path); if ($type == 'attendance') { $attendance = new Hra_Model_Attendance(); // 出勤 $file = fopen($tmp_file_path, "r"); $insertIds = array(); while (!feof($file)) { $csv_data = fgetcsv($file); $number = isset($csv_data[0]) && $csv_data[0] != '' ? $csv_data[0] : null; $clock_in = isset($csv_data[2]) && $csv_data[2] != '' ? $csv_data[1] . ' ' . $csv_data[2] : null; $clock_out = isset($csv_data[3]) && $csv_data[3] != '' ? $csv_data[1] . ' ' . $csv_data[3] : null; if ($number && ($clock_in || $clock_out)) { // 获取打卡日期:上班或下班打卡日期 $clock_date = $clock_in ? date('Y-m-d', strtotime($clock_in)) : date('Y-m-d', strtotime($clock_out)); if ($attendance->fetchAll("number = '" . $number . "' and clock_date = '" . $clock_date . "'")->count() == 0) { $clock_hours = 0; if ($clock_in != '' && $clock_out != '') { $clock_hours = (strtotime($clock_out) - strtotime($clock_in)) / 3600; } $data = array('number' => $number, 'clock_date' => $clock_date, 'clock_in' => $clock_in, 'clock_out' => $clock_out, 'clock_hours' => $clock_hours, 'create_user' => $user_id, 'create_time' => $now, 'update_user' => $user_id, 'update_time' => $now); try { $insertId = $attendance->insert($data); array_push($insertIds, $insertId); } catch (Exception $e) { $result['success'] = false; $result['info'] = $e->getMessage(); echo Zend_Json::encode($result); exit; } } } } fclose($file); // 刷新打卡类别setAttendanceType($id) /* foreach ($insertIds as $id){ $this->setAttendanceType($id); } */ } } echo Zend_Json::encode($result); exit; }
public function importitemsAction() { $result = array('success' => true, 'data' => array(), 'info' => '导入成功'); $request = $this->getRequest()->getParams(); $type = isset($request['type']) ? $request['type'] : null; if ($type && isset($_FILES['csv'])) { $file = $_FILES['csv']; $file_extension = strrchr($file['name'], "."); $h = new Application_Model_Helpers(); $tmp_file_name = $h->getMicrotimeStr() . $file_extension; $savepath = "../temp/"; $tmp_file_path = $savepath . $tmp_file_name; move_uploaded_file($file["tmp_name"], $tmp_file_path); $file = fopen($tmp_file_path, "r"); $i = 0; $materiel = new Product_Model_Materiel(); $stock = new Erp_Model_Stock_Stock(); while (!feof($file)) { $csv_data = fgetcsv($file); $code = isset($csv_data[1]) ? $csv_data[1] : ''; $qty = isset($csv_data[2]) ? $csv_data[2] : 0; $warehouse_code = 0; $warehouse_code_transfer = 0; if ($type == 'in') { $warehouse_code = isset($csv_data[4]) ? $csv_data[4] : ''; } else { if ($type == 'out') { $warehouse_code = isset($csv_data[3]) ? $csv_data[3] : ''; } else { if ($type == 'transfer') { $warehouse_code = isset($csv_data[3]) ? $csv_data[3] : ''; $warehouse_code_transfer = isset($csv_data[4]) ? $csv_data[4] : ''; } } } $remark = isset($csv_data[5]) ? $csv_data[5] : ''; if ($i > 0 && $code != '') { $materielData = $materiel->getOptionList($code); if (count($materielData) > 0) { // 获取仓位剩余库存 $warehouse = array(); array_push($warehouse, $warehouse_code); $warehouse_qty = $stock->getStockQty($code, $warehouse); array_push($result['data'], array('code' => $code, 'name' => $materielData['name'], 'description' => $materielData['description'], 'unit' => $materielData['unit'], 'qty' => $qty, 'warehouse_qty' => $warehouse_qty['total'], 'warehouse_code' => $warehouse_code, 'warehouse_code_transfer' => $warehouse_code_transfer, 'remark' => $remark)); } else { echo Zend_Json::encode(array('success' => false, 'info' => '物料号 [' . $code . '] 错误,导入失败!')); exit; } } $i++; } fclose($file); } else { $result['success'] = false; $result['info'] = '没有选择文件,导入失败!'; } /* echo '<pre>'; print_r($result); exit; */ echo Zend_Json::encode($result); exit; }