/** * マイフレンズグループメンバを更新する * * @param マイフレンズグループメンバ情報 (連想配列) * @return true(成功) / false(失敗) */ static function update_friends_group_member($form) { $org_form = $form; ACSLib::escape_sql_array($form); ACSLib::get_sql_value_array($form); // BEGIN ACSDB::_do_query("BEGIN"); // マイフレンズグループ名 $sql = "UPDATE community"; $sql .= " SET community_name = {$form['community_name']}"; $sql .= " WHERE community_id = {$form['community_id']}"; $ret = ACSDB::_do_query($sql); if (!$ret) { ACSDB::_do_query("ROLLBACK"); return $ret; } // DELETE $sql = "DELETE"; $sql .= " FROM community_member"; $sql .= " WHERE community_id = {$form['community_id']}"; $ret = ACSDB::_do_query($sql); if (!$ret) { ACSDB::_do_query("ROLLBACK"); return $ret; } $form = $org_form; // INSERT foreach ($form['trusted_community_id_array'] as $trusted_community_id) { $trusted_community_id = pg_escape_string($trusted_community_id); $community_member_form = array('community_id' => $form['community_id'], 'user_community_id' => $trusted_community_id, 'community_member_type_code' => ''); $ret = ACSCommunityMemberModel::insert_community_member($community_member_form); if (!$ret) { ACSDB::_do_query("ROLLBACK"); return $ret; } } // COMMIT ACSDB::_do_query("COMMIT"); return $ret; }
/** * コミュニティのメンバ(非管理者)を登録する * * @param $form コミュニティメンバ情報 * @return 成功(true) / 失敗(false) */ static function set_community_member($form) { // コミュニティメンバ種別マスタ $community_member_type_master_array = ACSDB::get_master_array('community_member_type'); // $form['community_id'] 参加対象のコミュニティ // $form['user_community_id'] 参加するユーザコミュニティID $form['community_member_type_code'] = array_search(ACSMsg::get_mst('community_member_type_master', 'D20'), $community_member_type_master_array); $ret = ACSCommunityMemberModel::insert_community_member($form); return $ret; }