芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/www/cepali/blocks/rss_client/managefeeds.php
. /** * Script to let a user manage their RSS feeds. * * @package block_rss_client * @copyright 2009 Tim Hunt * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(__DIR__ . '/../../config.php'); require_once($CFG->libdir . '/tablelib.php'); require_login(); $returnurl = optional_param('returnurl', '', PARAM_LOCALURL); $courseid = optional_param('courseid', 0, PARAM_INT); $deleterssid = optional_param('deleterssid', 0, PARAM_INT); if ($courseid == SITEID) { $courseid = 0; } if ($courseid) { $course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST); $PAGE->set_course($course); $context = $PAGE->context; } else { $context = context_system::instance(); $PAGE->set_context($context); } $managesharedfeeds = has_capability('block/rss_client:manageanyfeeds', $context); if (!$managesharedfeeds) { require_capability('block/rss_client:manageownfeeds', $context); } $urlparams = array(); $extraparams = ''; if ($courseid) { $urlparams['courseid'] = $courseid; $extraparams = '&courseid=' . $courseid; } if ($returnurl) { $urlparams['returnurl'] = $returnurl; $extraparams = '&returnurl=' . $returnurl; } $baseurl = new moodle_url('/blocks/rss_client/managefeeds.php', $urlparams); $PAGE->set_url($baseurl); // Process any actions if ($deleterssid && confirm_sesskey()) { $DB->delete_records('block_rss_client', array('id'=>$deleterssid)); redirect($PAGE->url, get_string('feeddeleted', 'block_rss_client')); } // Display the list of feeds. if ($managesharedfeeds) { $select = '(userid = ' . $USER->id . ' OR shared = 1)'; } else { $select = 'userid = ' . $USER->id; } $feeds = $DB->get_records_select('block_rss_client', $select, null, $DB->sql_order_by_text('title')); $strmanage = get_string('managefeeds', 'block_rss_client'); $PAGE->set_pagelayout('standard'); $PAGE->set_title($strmanage); $PAGE->set_heading($strmanage); $managefeeds = new moodle_url('/blocks/rss_client/managefeeds.php', $urlparams); $PAGE->navbar->add(get_string('blocks')); $PAGE->navbar->add(get_string('pluginname', 'block_rss_client')); $PAGE->navbar->add(get_string('managefeeds', 'block_rss_client'), $managefeeds); echo $OUTPUT->header(); $table = new flexible_table('rss-display-feeds'); $table->define_columns(array('feed', 'actions')); $table->define_headers(array(get_string('feed', 'block_rss_client'), get_string('actions', 'moodle'))); $table->define_baseurl($baseurl); $table->set_attribute('cellspacing', '0'); $table->set_attribute('id', 'rssfeeds'); $table->set_attribute('class', 'generaltable generalbox'); $table->column_class('feed', 'feed'); $table->column_class('actions', 'actions'); $table->setup(); foreach($feeds as $feed) { if (!empty($feed->preferredtitle)) { $feedtitle = s($feed->preferredtitle); } else { $feedtitle = $feed->title; } $viewlink = html_writer::link($CFG->wwwroot .'/blocks/rss_client/viewfeed.php?rssid=' . $feed->id . $extraparams, $feedtitle); $feedinfo = '
' . $viewlink . '
' . '
' . html_writer::link($feed->url, $feed->url) .'
' . '
' . $feed->description . '
'; if ($feed->skipuntil) { $skipuntil = userdate($feed->skipuntil, get_string('strftimedatetime', 'langconfig')); $skipmsg = get_string('failedfeed', 'block_rss_client', $skipuntil); $notification = new \core\output\notification($skipmsg, 'error'); $notification->set_show_closebutton(false); $feedinfo .= $OUTPUT->render($notification); } $editurl = new moodle_url('/blocks/rss_client/editfeed.php?rssid=' . $feed->id . $extraparams); $editaction = $OUTPUT->action_icon($editurl, new pix_icon('t/edit', get_string('edit'))); $deleteurl = new moodle_url('/blocks/rss_client/managefeeds.php?deleterssid=' . $feed->id . '&sesskey=' . sesskey() . $extraparams); $deleteicon = new pix_icon('t/delete', get_string('delete')); $deleteaction = $OUTPUT->action_icon($deleteurl, $deleteicon, new confirm_action(get_string('deletefeedconfirm', 'block_rss_client'))); $feedicons = $editaction . ' ' . $deleteaction; $table->add_data(array($feedinfo, $feedicons)); } $table->print_html(); $url = $CFG->wwwroot . '/blocks/rss_client/editfeed.php?' . substr($extraparams, 1); echo '
' . $OUTPUT->single_button($url, get_string('addnewfeed', 'block_rss_client'), 'get') . '
'; if ($returnurl) { echo '
' . html_writer::link($returnurl, get_string('back')) . '
'; } echo $OUTPUT->footer();