@@ 90-107 (lines=18) @@ | ||
87 | } |
|
88 | ||
89 | return 0; |
|
90 | } else { |
|
91 | ||
92 | $typeCondition = ''; |
|
93 | if ($type != -1) { |
|
94 | $type = intval($type); |
|
95 | $typeCondition = " WHERE group_type = $type "; |
|
96 | } |
|
97 | ||
98 | $sql = "SELECT count(a.id) as count |
|
99 | FROM {$this->table} a |
|
100 | $typeCondition |
|
101 | "; |
|
102 | $result = Database::query($sql); |
|
103 | if (Database::num_rows($result)) { |
|
104 | $row = Database::fetch_array($result); |
|
105 | return $row['count']; |
|
106 | } |
|
107 | } |
|
108 | } |
|
109 | ||
110 | /** |
|
@@ 134-155 (lines=22) @@ | ||
131 | } |
|
132 | ||
133 | return 0; |
|
134 | } else { |
|
135 | $typeCondition = ''; |
|
136 | if ($type != -1) { |
|
137 | $type = intval($type); |
|
138 | $typeCondition = " AND group_type = $type "; |
|
139 | } |
|
140 | $sql = "SELECT count(c.usergroup_id) as count |
|
141 | FROM {$this->usergroup_rel_course_table} c |
|
142 | INNER JOIN {$this->table} a |
|
143 | ON (c.usergroup_id = a.id) |
|
144 | WHERE |
|
145 | course_id = $course_id |
|
146 | $typeCondition |
|
147 | "; |
|
148 | $result = Database::query($sql); |
|
149 | if (Database::num_rows($result)) { |
|
150 | $row = Database::fetch_array($result); |
|
151 | return $row['count']; |
|
152 | } |
|
153 | ||
154 | return 0; |
|
155 | } |
|
156 | } |
|
157 | ||
158 | /** |