/** * Outputs the form for assigning topic to user * * @param int $topicID * @param string $topicTitle * @param array $topicParams * @param boolean $editAllowed */ public static function userHasTopicForm($topicID, $topicTitle, $topicParams = null, $editAllowed = true) { if ($topicParams == null) { $assigned = '0'; } else { $assigned = '1'; } $output = '<tr><td>' . View::checkboxFormOutput("user_has_topic_" . $topicID, '1', $assigned, $editAllowed) . "</td>\n <td>{$topicTitle}</td>"; if ($assigned == '0') { foreach (EventDatabaseManager::$userHasTopicsParams as $key) { if ($key == 'repetition_frequency_days' or $key == 'topic_expiry_date') { // GW 140611 $output .= '<td>' . View::userHasTopicsFormFieldsOutput($key . '_' . $topicID, "", $editAllowed) . '</td>'; } } } else { foreach (EventDatabaseManager::$userHasTopicsParams as $key) { if ($key == 'repetition_frequency_days' or $key == 'topic_expiry_date') { // GW 140611 $output .= '<td>' . View::userHasTopicsFormFieldsOutput($key . '_' . $topicID, $topicParams[$key], $editAllowed) . '</td>'; } } } $output .= '</tr>'; echo $output; }