public function screen_modify() { // データベースを操作します。 $NoticeModel = new NoticeModel(); $noticedata = $NoticeModel->get_notice_data_id('1'); // 現在のお知らせを設定します。 $this->form->setDefaults(['subject' => $noticedata['subject'], 'body' => $noticedata['body']]); if ($this->action == "form") { $this->form->addElement('text', 'subject', '件名', ['size' => 100]); $this->form->addElement('textarea', 'body', '内容', ['rows' => 5, 'cols' => 40]); $this->next_type = 'notice'; $this->next_action = 'complete'; $this->form->addElement('submit', 'submit', '更新する'); $this->file = "notice_form.tpl"; } else { if ($this->action == "complete") { $userdata = $this->form->getSubmitValues(); $userdata['id'] = '1'; $NoticeModel->modify_notice($userdata); $this->message = "お知らせを更新しました。"; $this->file = "message.tpl"; } } $this->title = 'お知らせ画面'; $this->view_display(); }
public static function act_delEmail() { if (!empty($_GET['idArr'])) { $idStr = implode(",", $_GET['idArr']); $where = ' and id in (' . $idStr . ')'; $data["is_delete"] = 1; $result = NoticeModel::update($data, $where, 'nt_email'); if ($result) { self::$errCode = "001"; self::$errMsg = "删除成功"; return $result; } self::$errCode = "066"; self::$errMsg = "删除失败"; } }
public static function update($data, $where = "", $table = "nt_email") { self::initDB(); $sql = array2sql($data); if ($table == 'nt_email') { $sql = "UPDATE `" . self::$tabemail . "` SET " . $sql . " WHERE 1 " . $where; } else { $sql = "UPDATE `" . self::$tabsms . "` SET " . $sql . " WHERE 1 " . $where; } $query = self::$dbConn->query($sql); if ($query) { return true; } else { self::$errCode = "005"; self::$errMsg = "Error occurred!Function=" . __FUNCTION__ . " sql= " . $sql; return false; } }
public function screen_top() { $NoticeModel = new NoticeModel(); $noticedata = $NoticeModel->get_notice_data_id('1'); $this->view->assign('subject', $noticedata['subject']); $this->view->assign('body', $noticedata['body']); $this->view->assign('reg_date', $noticedata['reg_date']); $this->view->assign('last_name', $_SESSION[_MEMBER_AUTHINFO]['last_name']); $this->view->assign('first_name', $_SESSION[_MEMBER_AUTHINFO]['first_name']); $this->title = '会員トップ画面'; $this->file = 'member_top.tpl'; $this->view_display(); }