function db_schedule_event4c_member_id($year, $month, $c_member_id) { $sql = 'SELECT c_commu_id FROM c_commu_member WHERE c_member_id = ?'; $params = array(intval($c_member_id)); $ids = db_get_col($sql, $params); $ids = implode(', ', $ids); if (!$ids) { return array(); } $sql = 'SELECT * FROM c_commu_topic WHERE c_commu_id IN (' . $ids . ')' . ' AND event_flag = 1 AND open_date >= ? AND open_date <= ?'; $max_day = date("t", mktime(0, 0, 0, intval($month), 1, intval($year))); $params = array(sprintf('%04d-%02d', intval($year), intval($month)) . '-01', sprintf('%04d-%02d', intval($year), intval($month)) . '-' . $max_day); $list = db_get_all($sql, $params); $res = array(); foreach ($list as $item) { $item['is_join'] = db_commu_is_c_event_member_2($item['c_commu_topic_id'], $c_member_id); $day = date('j', strtotime($item['open_date'])); $res[$day][] = $item; } return $res; }
function p_common_is_c_event_member($c_commu_topic_id, $c_member_id) { return db_commu_is_c_event_member_2($c_commu_topic_id, $c_member_id); }
function db_commu_event4c_member_id($year, $month, $day, $c_member_id) { $sql = 'SELECT c_commu_id FROM c_commu_member WHERE c_member_id = ?'; $params = array(intval($c_member_id)); $ids = db_get_col($sql, $params); $ids = implode(", ", $ids); if (!$ids) { return array(); } $today = sprintf("%04d-%02d-%02d", $year, $month, $day); $sql = "SELECT * FROM c_commu_topic" . " WHERE c_commu_id IN ({$ids})" . " AND event_flag = 1" . " AND open_date = ?"; $params = array($today); $list = db_get_all($sql, $params); foreach ($list as $key => $item) { $list[$key]['is_join'] = db_commu_is_c_event_member_2($item['c_commu_topic_id'], $c_member_id); } return $list; }