if (!($cm = get_record('course_modules', 'id', $id))) {
    error('Course Module ID was incorrect');
}
if (!($course = get_record('course', 'id', $cm->course))) {
    error('Course is misconfigured');
}
if (!($netpublish = get_record('netpublish', 'id', $cm->instance))) {
    error('Course module is incorrect');
}
confirm_sesskey($skey);
require_login($course->id);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (!has_capability('mod/netpublish:movearticle', $context)) {
    error(get_string('errorpermissionmove', 'netpublish'));
}
if (!($sections = netpublish_get_sections($netpublish->id))) {
    $sections = array();
}
$movingarticle = netpublish_get_article($articleid);
$strfrontpage = !empty($sections) && !empty($sections[key($sections)]->frontpagename) ? $sections[key($sections)]->frontpagename : (!($frontpage = get_record("netpublish_first_section_names", "publishid", $netpublish->id)) ? get_string("frontpage", "netpublish") : $frontpage->name);
$sections[0] = new stdClass();
$sections[0]->id = 0;
$sections[0]->publishid = $netpublish->id;
$sections[0]->fullname = $strfrontpage;
$sections[0]->parentid = 0;
ksort($sections);
//print_header();
if ($course->category) {
    $navigation = "<a href=\"../../course/view.php?id={$course->id}\">{$course->shortname}</a> ->";
}
// Get strings
function netpublish_print_sections($moduleid, $instance)
{
    $instance = clean_param($instance, PARAM_INT);
    $sid = !empty($_GET['section']) ? $_GET['section'] : (!empty($HTTP_GET_VARS['section']) ? $HTTP_GET_VARS['section'] : 0);
    $sid = clean_param($sid, PARAM_INT);
    $currentsection = optional_param('section', 0, PARAM_INT);
    // section id
    $sections = netpublish_get_sections($instance);
    $strfrontpage = !empty($sections) && !empty($sections[key($sections)]->frontpagename) ? $sections[key($sections)]->frontpagename : (!($frontpage = get_record("netpublish_first_section_names", "publishid", $instance)) ? get_string("frontpage", "netpublish") : $frontpage->name);
    //echo "<p>";
    if ($currentsection != 0) {
        $tmplink = "%sחזרה לדף הראשי: <a href=\"view.php?id=%d&amp;section=0\">%s</a>%s";
    }
    echo !empty($sid) ? sprintf($tmplink, "", $moduleid, $strfrontpage, "") : sprintf($tmplink, "<strong>", $moduleid, $strfrontpage, "</strong>");
    echo "<ul class=\"netpublish-sectionlist\">";
    if (!empty($sections)) {
        netpublish_print_section_listview(0, &$sections, $moduleid);
    }
    echo "</ul>";
    //echo "</p>\n";
}