function showTopicsList($course_id, $topics, $links, $elements, $span = 1) { global $option, $Itemid, $max_lvl, $JLMS_CONFIG; // echo '<pre>'; var_dump($elements);die; $usertype = $JLMS_CONFIG->get('current_usertype', 0); $date_format = $JLMS_CONFIG->get('date_format_fdow', 1); ?> <script language="javascript" type="text/javascript"> <!--//--><![CDATA[//><!-- function topicSubmit ($topic_id, $task) { var $form = document.forms['topicForm_'+$topic_id]; $form.task.value = $task; $form.submit(); } function topicDelete ($topic_id) { var $form = document.forms['topicForm_'+$topic_id]; $form.task.value = 'delete_topic'; $form.submit(); } function topicAdd ($topic_id) { var $form = document.forms['topicForm_'+$topic_id]; $form.task.value = 'add_topic_element'; $form.submit(); } function topicChange ($topic_id, $def) { var $form = document.forms['topicForm_'+$topic_id]; $form.task.value = 'change_element'; $form.state.value = $def; $form.submit(); } //same for isChecked function but has FORM name param function isChecked_mod(isitchecked, $form_name){ if (isitchecked == true){ document.forms[$form_name].boxchecked.value++; } else { document.forms[$form_name].boxchecked.value--; } } function checkAll_mod( n, fldName, $form_name ) { if (!fldName) { fldName = 'cb'; } var f = document.forms[$form_name]; var c = f.toggle.checked; var n2 = 0; for (i=0; i < n; i++) { cb = eval( 'f.' + fldName + '' + i ); if (cb) { cb.checked = c; n2++; } } if (c) { document.forms[$form_name].boxchecked.value = n2; } else { document.forms[$form_name].boxchecked.value = 0; } } //--><!]]> </script> <?php $topics_count = count($topics); foreach ($topics as $topic) { $topic_publish = publishUtility($topic->published, -1, $topic->publish_start, $topic->publish_end, $topic->start_date, $topic->end_date); ?> <div id="topicmain_<?php echo $topic->id; ?> " class="topicmaindiv<?php echo $usertype != 2 && $topic_publish->state == 1 ? 2 : ''; ?> "> <a name="topic_<?php echo $topic->id; ?> "><!--x--></a> <?php echo JLMSCSS::h2($topic->name); ?> <div class="contentmain"> <form name="topicForm_<?php echo $topic->id; ?> " method="post" action="<?php echo sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid); ?> "> <?php if ($topic->publish_start || $topic->publish_end || $topic->description || isset($links[$topic->id]) && count($links[$topic->id])) { ?> <div class="topics"> <?php JLMS_TMPL::OpenMT(); $_JLMS_PLUGINS =& JLMSFactory::getPlugins(); $_JLMS_PLUGINS->loadBotGroup('system'); $plugin_args = array(); $plugin_args[] = $topic->id; $_JLMS_PLUGINS->trigger('onAboveTopicDescription', $plugin_args); JLMS_TMPL::CloseMT(); ?> <?php if ($topic->publish_start || $topic->publish_end) { ?> <div class="topic_createdate"> <?php //if ($topic->publish_start) echo _JLMS_TOPIC_T_STARTS_ON.date("Y-m-d",strtotime($topic->start_date)); //if ($topic->publish_end) echo _JLMS_TOPIC_T_ENDS_ON.date("Y-m-d",strtotime($topic->end_date)); // 06.12.2007 - (DEN) if ($topic->publish_start) { echo _JLMS_TOPIC_T_STARTS_ON . ' ' . JLMS_dateToDisplay($topic->start_date) . ($topic->publish_end ? ' ' : ''); } if ($topic->publish_end) { echo _JLMS_TOPIC_T_ENDS_ON . ' ' . JLMS_dateToDisplay($topic->end_date); } ?> </div> <?php } ?> <?php if ($topic->description && isset($links[$topic->id]) && count($links[$topic->id])) { ?> <div class="topic_description"> <?php echo JLMS_ShowText_WithFeatures($topic->description); #echo JLMS_ShowText_WithFeatures('{readmore title="FIRST"}text{readmore}text{/readmore}'); //for test ?> <?php if (isset($links[$topic->id]) && count($links[$topic->id])) { echo '<br />'; } ?> <div class="topic_elements"> <?php echo JLMS_topic_html::showTopicElements($course_id, $topic, $links, $elements, $span); ?> </div> <?php global $JLMS_topic_readmore_closeTag, $JLMS_count_begin_tags, $JLMS_count_end_tags; if ($JLMS_topic_readmore_closeTag) { if (isset($JLMS_count_begin_tags) && isset($JLMS_count_end_tags)) { $stop = 0; if ($JLMS_count_begin_tags > $JLMS_count_end_tags) { $stop = $JLMS_count_begin_tags - $JLMS_count_end_tags; } $i = 0; while ($i < $stop) { echo '<div class="clr"><!-- --></div>' . "\n"; echo '</div>' . "\n"; $i++; } } } ?> </div> <?php } else { if (!$topic->description && isset($links[$topic->id]) && count($links[$topic->id])) { ?> <div class="topic_elements"> <?php //echo JLMS_topic_html::showTopicElements($course_id, $topic, $links, $elements, $span=1); echo JLMS_topic_html::showTopicElements($course_id, $topic, $links, $elements, $span); ?> </div> <?php } else { if ($topic->description && (!isset($links[$topic->id]) || !count($links[$topic->id]))) { ?> <div class="topic_description"> <?php echo JLMS_ShowText_WithFeatures($topic->description); ?> <?php if (isset($links[$topic->id]) && count($links[$topic->id])) { echo '<br />'; } ?> <?php global $JLMS_topic_readmore_closeTag, $JLMS_count_begin_tags, $JLMS_count_end_tags; if ($JLMS_topic_readmore_closeTag) { if (isset($JLMS_count_begin_tags) && isset($JLMS_count_end_tags)) { $stop = 0; if ($JLMS_count_begin_tags > $JLMS_count_end_tags) { $stop = $JLMS_count_begin_tags - $JLMS_count_end_tags; } $i = 0; while ($i < $stop) { echo '<div class="clr"><!-- --></div>' . "\n"; echo '</div>' . "\n"; $i++; } } } ?> </div> <?php } } } ?> </div> <?php } ?> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="id" value="<?php echo $course_id; ?> " /> <input type="hidden" name="state" value="0" /> <input type="hidden" name="topic_id" value="<?php echo $topic->id; ?> " /> <input type="hidden" name="topic_ordering" value="<?php echo $topic->ordering; ?> " /> <?php $is_curtopic = intval(mosgetparam($_REQUEST, 't_id', 0)); echo "<input type='hidden' name='t_id' value='" . $is_curtopic . "' />"; ?> </form> <?php $controls = array(); $controls[] = array('href' => "javascript:if(document.topicForm_{$topic->id}.boxchecked.value==0){alert('" . str_replace(' ', '%20', _JLMS_TOPIC_E_NO_ELEMENTS_CHOSEN) . "');}else{topicChange({$topic->id},0);}", 'title' => _JLMS_PUBLISH_ELEMENT, 'img' => 'publish'); $controls[] = array('href' => "javascript:if(document.topicForm_{$topic->id}.boxchecked.value==0){alert('" . str_replace(' ', '%20', _JLMS_TOPIC_E_NO_ELEMENTS_CHOSEN) . "');}else{topicChange({$topic->id},1);}", 'title' => _JLMS_UNPUBLISH_ELEMENT, 'img' => 'unpublish'); $controls[] = array('href' => "javascript:if(document.topicForm_{$topic->id}.boxchecked.value==0){alert('" . str_replace(' ', '%20', _JLMS_TOPIC_E_NO_ELEMENTS_CHOSEN) . "');}else{topicSubmit({$topic->id},'delete_topic_element');}", 'title' => _JLMS_DELETE_ELEMENT, 'img' => 'delete'); $controls[] = array('href' => "javascript:topicAdd({$topic->id});", 'title' => _JLMS_ADD_ELEMENTS, 'img' => 'add'); $controls[] = array('href' => 'spacer'); $controls[] = array('href' => 'spacer'); $publish_options = publishUtility_topic($topic->published, $topic->publish_start, $topic->publish_end, $topic->start_date, $topic->end_date); $controls[] = array('href' => JLMSRoute::_("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=publish_topic&state=" . (1 - $publish_options->state) . "&id=" . $course_id . "&topic_id={$topic->id}"), 'title' => $publish_options->state == 1 ? _JLMS_TOPIC_PUBLISHED : _JLMS_TOPIC_UNPUBLISHED, 'img' => $publish_options->state == 1 ? 'publish' : 'unpublish'); $controls[] = array('href' => "javascript:if(confirm('" . str_replace(' ', '%20', _JLMS_TOPIC_T_CONFIRM_DELETE) . "')){topicDelete({$topic->id});}", 'title' => _JLMS_TOPIC_T_DELETE, 'img' => 'delete'); global $Itemid, $option; $course_id = intval(mosGetParam($_REQUEST, 'id', 0)); $controls[] = array('href' => JLMSRoute::_("index.php?option={$option}&Itemid={$Itemid}&task=edit_topic&id={$course_id}&topic_id={$topic->id}"), 'title' => _JLMS_TOPIC_T_EDIT, 'img' => 'edit'); if ($topic->ordering > 0) { $controls[] = array('href' => "javascript:topicSubmit({$topic->id},'orderup_topic')", 'title' => _JLMS_TOPIC_T_MOVEUP, 'img' => 'up'); } if ($topic->ordering < $topics_count - 1) { $controls[] = array('href' => "javascript:topicSubmit({$topic->id},'orderdown_topic')", 'title' => _JLMS_TOPIC_T_MOVEDOWN, 'img' => 'down'); } if ($usertype == 2) { $controls = array(); } JLMS_TMPL::ShowControlsFooterC($controls); ?> </div> </div> <?php } }