Пример #1
0
/**
 * Given an object containing all the necessary data, 
 * (defined by the form in mod.html) this function 
 * will update an existing instance with new data.
 *
 * @param object $instance An object from the form in mod.html
 * @return boolean Success/Fail
 **/
function podcaster_update_instance($podcaster)
{
    podcaster_preprocess_data($podcaster);
    $podcaster->timemodified = time();
    $podcaster->id = $podcaster->instance;
    $podcaster->dirty = 1;
    $podcaster->imagewidth = 0;
    $podcaster->imageheight = 0;
    $podcaster->imageurl = '';
    $podcaster->imagetype = '';
    if (($result = update_record('podcaster', $podcaster)) != false) {
        podcaster_update_rss($podcaster);
    }
    return $result;
}
Пример #2
0
        }
        $item->timemodified = time();
        // clear cached values
        $item->enclosureurl = '';
        $item->enclosuretype = '';
        $item->enclosurelength = 0;
        if (isset($item->id) && $item->id) {
            update_record('podcaster_item', $item);
        } else {
            $item->channel = $channel->id;
            $item->timecreated = time();
            insert_record('podcaster_item', $item);
        }
        // update channel record
        $podupd = new object();
        $podupd->id = $channel->id;
        $podupd->timemodified = time();
        update_record('podcaster', $podupd);
        // update rss
        $channel->timemodified = time();
        podcaster_update_rss($channel);
        redirect('view.php?id=' . $cm->id . '&tab=items');
    }
}
$strpodcaster = get_string('modulename', 'podcaster');
$strpodcasters = get_string('modulenameplural', 'podcaster');
$stredit = $item->id == 0 ? get_string('additem', 'podcaster') : get_string('edit');
print_header_simple(format_string($item->title), "", "<a href=\"index.php?id={$course->id}\">{$strpodcasters}</a> ->\n                <a href=\"view.php?id={$cm->id}\">" . format_string($channel->name, true) . "</a> -> {$stredit}", "", "", true, "", navmenu($course, $cm));
print_heading(format_string($item->title));
$mform->display();
print_footer($course);