Пример #1
0
 protected function get_id()
 {
     $tempObj = new Model('t_temp');
     $res = $tempObj->lock(true)->find();
     if ($res == null) {
         $temp = 0;
         $data['v_id'] = '1';
         $tempObj->add($data);
     } else {
         $condition['t_id'] = $res['t_id'];
         $data['v_id'] = (int) $res['v_id'] + 1;
         $tempObj->where($condition)->save($data);
         $temp = (int) $res['v_id'];
     }
     $t = (int) $temp + 1;
     if ($t < 10) {
         return '000' . $t;
     } elseif ($t >= 0 && $t < 100) {
         return '00' . $t;
     } elseif ($t >= 100 && $t < 1000) {
         return '0' . $t;
     } elseif ($t >= 1000) {
         return $t;
     }
 }
Пример #2
0
 public function add($keyvalue)
 {
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $keyvalue['user_id'] = $userClass['_id'];
     $keyvalue['time'] = CURRENT_TIME;
     parent::add($keyvalue);
     #------记录日志(生成msg)-------#
     $logArr = array();
     array_push($logArr, '增加了一条FAQ记录');
     $this->_modelPlayerKindFaq = $this->_getGlobalData('Model_PlayerKindFaq', 'object');
     $gameTypeName = $this->_modelPlayerKindFaq->getGameKind();
     $gameTypeName = $gameTypeName[$keyvalue['game_type_id']];
     array_push($logArr, "FAQ所属游戏[{$gameTypeName}]");
     $lang = $this->_getGlobalData('lang');
     $lang = $lang[$keyvalue['lang_id']];
     array_push($logArr, "FAQ所属语言[{$lang}]");
     $kindList = $this->_modelPlayerKindFaq->findById($keyvalue['kind_id']);
     $kindName = $kindList['name'];
     array_push($logArr, "FAQ所属类型[{$kindName}]");
     array_push($logArr, "FAQ记录 [{$keyvalue['question']}]");
     $msg = Tools::formatLog($logArr);
     Tools::addLog($msg, true);
     return true;
     #------记录日志(生成msg)-------#
 }
Пример #3
0
 public function add($postArr)
 {
     if (empty($postArr['title'])) {
         return array('status' => -1, 'msg' => '请填写标题', 'href' => 1);
     }
     if (empty($postArr['description'])) {
         return array('status' => -1, 'msg' => '请填写描述', 'href' => 1);
     }
     if (empty($postArr['start_time'])) {
         return array('status' => -1, 'msg' => '请选择开始时间', 'href' => 1);
     }
     if (empty($postArr['end_time'])) {
         return array('status' => -1, 'msg' => '请选择结束时间', 'href' => 1);
     }
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $addArr = array();
     $addArr['title'] = $postArr['title'];
     $addArr['description'] = $postArr['description'];
     $addArr['start_time'] = strtotime($postArr['start_time']);
     $addArr['end_time'] = strtotime($postArr['end_time']);
     $addArr['create_time'] = CURRENT_TIME;
     $addArr['status'] = $postArr['status'];
     $addArr['user_id'] = $userClass['_id'];
     if (parent::add($addArr)) {
         return array('status' => 1, 'msg' => false, 'href' => Tools::url('Askform', 'Askform'));
     } else {
         return array('status' => -2, 'msg' => '添加问卷失败', 'href' => 1);
     }
 }
Пример #4
0
 public function addClicked(SubmitButton $button)
 {
     $array = $button->getForm()->getValues();
     if ($array['authorId'] == 'true') {
         $array['author'] = dibi::query('SELECT authorId FROM authors ORDER BY authorId DESC LIMIT 1')->fetchSingle();
     } elseif ($array['author'] == 0) {
         $this->flashMessage('Je potřaba vybrat autora!', 'error');
         return;
     }
     unset($array['authorId']);
     try {
         $array['url'] = Model::createUri($array['title'], $array['author']);
     } catch (Exception $e) {
         $this->flashMessage('U tohoto autora byla již vložena práce se stejným jménem', 'error');
         return;
     }
     $array['added%sql'] = 'NOW()';
     $array['edited%sql'] = 'NOW()';
     $array = $this->fixValues($array);
     $file = $array['file'];
     unset($array['file']);
     $id = Model::add($array, 'works');
     if ($file != '') {
         FileModel::add($id, $_FILES['file']);
     }
     $s = Environment::getSession('workform');
     $s->author = $array['author'];
     $s->award = $array['award'];
     $s->year = $array['year'];
     $s->type = $array['type'];
     $this->flashMessage('Práce byla přidána.', 'info');
     $this->redirect("this");
 }
Пример #5
0
 /**
  * 新建任务
  */
 public function newTask($postArr)
 {
     $difficulty = Tools::coerceInt($postArr['difficulty']);
     $precastHour = Tools::coerceInt($postArr['precast_hour']);
     if (empty($postArr['task_content'])) {
         return array('status' => -1, 'msg' => '任务描述不能为空', 'href' => 2);
     }
     if (!$precastHour) {
         return array('status' => -1, 'msg' => '预计完成时间不能为0', 'href' => 2);
     }
     if (!$postArr['accept_user_id']) {
         return array('status' => -1, 'msg' => '请选择任务负责人', 'href' => 2);
     }
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $addArr = array();
     $addArr['Id'] = date('Ymd', CURRENT_TIME) . Tools::getRandCode(5, 1);
     $addArr['assign_user_id'] = $userClass['_id'];
     $addArr['accept_user_id'] = $postArr['accept_user_id'];
     $addArr['difficulty'] = $difficulty;
     $addArr['precast_hour'] = $precastHour;
     $addArr['assign_time'] = CURRENT_TIME;
     $addArr['task_content'] = $postArr['task_content'];
     if (parent::add($addArr)) {
         return array('status' => 1, 'msg' => '增加任务成功', 'href' => Tools::url('ProgramTask', 'Index', array('zp' => 'Program')));
     } else {
         return array('status' => -2, 'msg' => '增加任务失败', 'href' => 2);
     }
 }
Пример #6
0
 public function add($postArr)
 {
     if (empty($postArr['content'])) {
         return array('href' => 2, 'msg' => '工作计划不能为空', 'status' => -1);
     }
     if (empty($postArr['group_id'])) {
         return array('href' => 2, 'msg' => '请选择项目组', 'status' => -1);
     }
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $addArr = array();
     $addArr['start_time'] = strtotime($postArr['start_time']);
     $isAdd = $this->select("select Id from {$this->tName()} where user_id={$userClass['_id']} and start_time={$addArr['start_time']}", 1);
     if ($isAdd) {
         return array('href' => 2, 'msg' => '您今天已经填写过工作计划', 'status' => -1);
     }
     $addArr['end_time'] = strtotime($postArr['end_time']);
     $addArr['content'] = $postArr['content'];
     $addArr['group_id'] = $postArr['group_id'];
     $addArr['user_id'] = $userClass['_id'];
     if (parent::add($addArr)) {
         return array('href' => Tools::url('ProgramDateWork', 'Index', array('zp' => 'Program')), 'msg' => '添加成功', 'status' => 1);
     } else {
         return array('href' => Tools::url('ProgramDateWork', 'Index', array('zp' => 'Program')), 'msg' => '添加失败', 'status' => -2);
     }
 }
Пример #7
0
 public function add_data()
 {
     $data['pic'] = $this->_post('pic_url');
     //1-监督信息 2-好人好事
     $data['type'] = $this->_post('type');
     $data['title'] = $this->_post('title');
     $data['contents'] = $_POST['contents'];
     $data['add_time'] = date('Y-m-d H:i:s');
     $data['v_id'] = $this->get_volun_id();
     if ($data['v_id'] == '' && $_SESSION['temp'] == 1) {
         $this->error('请先提交个人信息', '__APP__/Index/personal', 3);
         exit;
     }
     if ($data['type'] != '1' && $data['type'] != '2') {
         $this->error('系统错误', '', 3);
         exit;
     }
     $obj = new Model('t_contents');
     $res = $obj->add($data);
     if ($res) {
         $this->success('提交成功', '__URL__/add_form?type=' . $data['type'], 3);
     } else {
         $this->error('提交失败', '', 3);
     }
 }
Пример #8
0
 public function add($postArr)
 {
     if (empty($postArr['conf_name'])) {
         return array('status' => -1, 'msg' => '请填定配置名称', 'href' => 1);
     }
     if (empty($postArr['description'])) {
         return array('status' => -1, 'msg' => '请填定说明', 'href' => 1);
     }
     if (!count($postArr['option'])) {
         return array('status' => -1, 'msg' => '至少要有一个投票选项', 'href' => 1);
     }
     if (!count($postArr['user'])) {
         return array('status' => -1, 'msg' => '至少要有一个投票用户', 'href' => 1);
     }
     $addArr = array();
     $addArr['conf_name'] = $postArr['conf_name'];
     $addArr['description'] = $postArr['description'];
     $addArr['is_open'] = $postArr['is_open'];
     $addArr['content'] = serialize($postArr['option']);
     $addArr['vote_user'] = serialize($postArr['user']);
     if (parent::add($addArr)) {
         return array('status' => 1, 'msg' => "增加 [{$postArr['conf_name']}] 配置成功", 'href' => Tools::url(CONTROL, ACTION, array('doaction' => 'conf')));
     } else {
         return array('status' => -1, 'msg' => '添加配置失败', 'href' => 1);
     }
 }
Пример #9
0
 public function add($keyValue, $table = null)
 {
     if ($this->_hasValue($keyValue['game_type_id'], $keyValue['operator_id'])) {
         return false;
     } else {
         return parent::add($keyValue, $table);
     }
 }
Пример #10
0
 public function add($keyValue, $table = null)
 {
     if ($this->_hasValue($keyValue['value'])) {
         return false;
     } else {
         return parent::add($keyValue);
     }
 }
Пример #11
0
 public function add()
 {
     $where = array("price_left='{$this->R['price_left']}'", "price_right='{$this->R['price_right']}'");
     if (!$this->check->checkAdd($this, $where)) {
         $this->check->showError();
     }
     $addData = $this->getRequest()->filter($this->fields);
     return parent::add($addData);
 }
Пример #12
0
 public function add()
 {
     //$_where = array("name='{$this->_R['name']}'");
     //if (!$this->_check->addCheck($this, $_where)) $this->_check->error();
     $_addData = $this->getRequest()->filter($this->_fields);
     $_addData['user'] = $_COOKIE['user'];
     $_addData['date'] = Tool::getDate();
     return parent::add($_addData);
 }
Пример #13
0
 /** User specific random password handling */
 public function add($data)
 {
     if (empty($data['set']['password'])) {
         $data['set']['password'] = dechex(mt_rand(1000000, mt_getrandmax()));
     }
     /** @TODO Send email notification of password */
     $data['password'] = md5($data['set']['password']);
     return parent::add($data);
 }
Пример #14
0
 /**
  * 添加反馈
  *
  * @param int $type 反馈的类型
  * @param string $content 反馈的内容
  * @param int $uid 反馈的UID,默认为0,兼容某些地方,可以匿名反馈
  * @return bool
  * @author Medz Seven <*****@*****.**>
  **/
 public function add($type, $content, $uid = 0)
 {
     /* # 验证类型 */
     if (!($type = $this->selectAddType($type))) {
         return flase;
     }
     /* # 添加数据 */
     return parent::add(array('content' => $content, 'cTime' => time(), 'type' => $type, 'uid' => intval($uid)));
 }
Пример #15
0
 public function addClicked(SubmitButton $button)
 {
     $array = $button->getForm()->getValues();
     $array = $this->convertNumberToClass($array);
     $array['authorUrl'] = Model::createAuthorUri($array['name'], $array['surname'], $array['class']);
     Model::add($array, 'authors');
     $this->flashMessage($array['name'] . " " . $array['surname'] . ' byl přidán.');
     $this->redirect("this");
 }
Пример #16
0
 public function add()
 {
     $where = array('where' => "name='{$this->R['name']}'");
     if (!$this->check->checkAdd($this, $where)) {
         $this->check->showError();
     }
     $addData = $this->getRequest()->filter($this->fields);
     $addData['nav'] = implode(',', $addData['nav']);
     return parent::add($addData);
 }
Пример #17
0
 public function add()
 {
     $_where = array("user='******'user']}'");
     if (!$this->_check->addCheck($this, $_where)) {
         $this->_check->error();
     }
     $_addData = $this->getRequest()->filter($this->_fields);
     $_addData['user'] = $_COOKIE['user'];
     return parent::add($_addData);
 }
Пример #18
0
 public function add()
 {
     $_where = array("name='{$this->_R['name']}'");
     if (!$this->_check->addCheck($this, $_where)) {
         $this->_check->error();
     }
     $_addData = $this->getRequest()->filter($this->_fields);
     $_addData['reg_time'] = Tool::getDate();
     return parent::add($_addData);
 }
Пример #19
0
 public function add()
 {
     $where = array("name='{$this->R['name']}'");
     if (!$this->check->checkAdd($this, $where)) {
         $this->check->showError();
     }
     $addData = $this->getRequest()->filter($this->fields);
     $addData['reg_time'] = Tool::getDate();
     return parent::add($addData);
 }
Пример #20
0
 function add()
 {
     $user = new Model('user');
     $_GET['password'] = md5($_GET['password']);
     if ($list = $user->add($_GET)) {
         $this->success('添加成功');
     } else {
         $this->error('添加失败');
     }
 }
Пример #21
0
 public function frontReg()
 {
     $_where = array("user='******'user']}'");
     if (!$this->_check->regCheck($this, $_where)) {
         $this->_check->error();
     }
     $_addData = $this->getRequest()->filter($this->_fields);
     $_addData['pass'] = sha1($_addData['pass']);
     $_addData['date'] = Tool::getDate();
     return parent::add($_addData);
 }
Пример #22
0
 public function add($postArr)
 {
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $addArr = array('user_id' => $userClass['_id'], 'create_time' => CURRENT_TIME, 'content' => $postArr['content']);
     if (parent::add($addArr)) {
         return array('status' => 1, 'msg' => false, 'href' => Tools::url(CONTROL, 'BugBack'));
     } else {
         return array('status' => -2, 'msg' => '添加bug失败', 'href' => Tools::url(CONTROL, 'BugBack'));
     }
 }
Пример #23
0
 public function insert()
 {
     $Demo = new Model('Demo');
     // 实例化模型类
     $Demo->Create();
     // 创建数据对象
     $result = $Demo->add();
     // 写入数据库
     $this->redirect('index');
     // 成功后重定向到index操作页面
 }
Пример #24
0
 public function addLog($returnData, $subData)
 {
     $data = array();
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $data["acuser"] = $userClass['_id'] ? $userClass['_id'] : 0;
     $data["returnData"] = base64_encode($returnData);
     $data["subData"] = base64_encode($subData);
     $data["actime"] = CURRENT_TIME;
     parent::add($data);
 }
Пример #25
0
 public function add()
 {
     $_where = array("price_left='{$this->_R['price_left']}' AND price_right='{$this->_R['price_right']}'");
     if (!$this->_check->addCheck($this, $_where)) {
         $this->_check->error();
     }
     $_addData = $this->getRequest()->filter($this->_fields);
     if (isset($_addData['nav'])) {
         $_addData['nav'] = implode(',', $_addData['nav']);
     }
     return parent::add($_addData);
 }
Пример #26
0
 public function insert()
 {
     //定义方法
     $ins = new Model('user');
     // 实例化模型类,传递参数为没有前缀的数据表名称
     $ins->Create();
     // 创建数据对象
     $result = $ins->add();
     // 写入数据库
     $this->redirect('Index/index', '', 5, '页面跳转中');
     //页面重定向
 }
Пример #27
0
 public function runAdd()
 {
     $where = array("goods_id='{$this->R['id']}'", "user='******'user']}'");
     if (!$this->check->checkAdd($this, $where)) {
         $this->check->showError();
     }
     $addData = $this->getRequest()->filter($this->fields);
     $addData['user'] = $_COOKIE['user'];
     $addData['goods_id'] = $this->R['id'];
     $addData['date'] = Tool::getDate();
     return parent::add($addData);
 }
Пример #28
0
 public function add()
 {
     $where = array("order_id='{$this->R['order_id']}'");
     if (!$this->check->checkAdd($this, $where)) {
         $this->check->showError();
     }
     $addData = $this->getRequest()->filter($this->fields);
     $addData['date'] = Tool::getDate();
     $addData['attr'] = mb_substr($_POST['attr'], 0, -1, 'utf-8');
     $addData['user'] = $_COOKIE['user'];
     return parent::add($addData);
 }
Пример #29
0
 public function add()
 {
     $where = array("name='{$this->R['name']}'");
     if (!$this->check->checkAdd($this, $where)) {
         $this->check->showError();
     }
     if ($this->R['first'] == 1) {
         parent::update(array("first=1"), array('first' => 0));
     }
     $addData = $this->getRequest()->filter($this->fields);
     return parent::add($addData);
 }
Пример #30
0
 public function add()
 {
     $where = array("name='{$this->R['name']}'", "user='******'user']}'");
     if (!$this->check->checkAdd($this, $where)) {
         $this->check->showError();
     }
     $addData = $this->getRequest()->filter($this->fields);
     $addData['user'] = $_COOKIE['user'];
     $addData['selected'] = 1;
     parent::update(array("user='******'user']}'"), array('selected' => 0));
     return parent::add($addData);
 }