/** * Печать анкеты */ public function anketa() { Logs::write(Core::getInstance()->user, 'amt', null); if (!isset($_POST['anketa'])) { throw new Exception('No personal data'); } $data = $this->_prepareData($_POST['anketa']); $parsedData = $this->_parseData($data); $this->_sendEmail($parsedData); $this->renderJsonSuccess("Анкета успешно отправлена!"); }
/** * 对文档添加索引 * * @param unknown_type $colName $colName 集合名 * @param unknown_type $index * @return boolean|unknown */ public function ensureIndex($colName, $index = array()) { $col = $this->_getCol($colName); try { $ret = $col->ensureIndex($index); } catch (MongoCursorException $e) { Logs::write("MongoPHP::ensureIndex() exception, error:" . $e->getMessage(), "log"); return false; } return $ret; }
public function saveExorder($strDate, $nType, $nExorder) { try { $sql = Exorder::getInsertExorderSql($strDate, $nType, $nExorder); $bResult = $this->executeSql($sql); if (!$bResult) { Logs::write('ExorderDb::saveExorder():executeSql() failed', 'log'); return false; } return true; } catch (Exception $e) { Logs::write('ExorderDb::saveExorder() exception, err:' . $e->getMessage(), 'log'); return false; } return true; }
public function addIndex($keys) { try { $result = $this->_mongo->getIndexInfo($this->_collection); if ($result) { return true; } foreach ($keys as $key => $value) { if (is_array($value)) { $index = $value; } else { $index = array($key => $value); } $bResult = $this->_mongo->ensureIndex($this->_collection, $index); if (!$bResult) { Logs::write('MongoRecord::addIndex():ensureIndex() failed, collection:' . $this->_collection, 'log'); return false; } } return true; } catch (Exception $e) { Logs::write('MongoRecord::addIndex() exception, mongErr:' . $this->_mongo->getError() . ' err:' . ' file:' . $e->getFile() . ' line:' . $e->getLine() . ' message:' . $e->getMessage() . ' trace:' . $e->getTraceAsString(), 'log'); } return false; }