Esempio n. 1
0
 function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     $mform->addElement('header', 'general', get_string('general', 'form'));
     $mform->addElement('date_time_selector', 'scheduledtime', get_string('scheduledtime', 'podcaster'));
     $mform->addElement('text', 'title', get_string('itemtitle', 'podcaster'), array('size' => '48'));
     $mform->setType('title', PARAM_TEXT);
     $mform->addRule('title', null, 'required', null, 'client');
     $mform->addElement('htmleditor', 'description', get_string('itemdescription', 'podcaster'));
     $mform->setType('description', PARAM_RAW);
     $mform->addRule('description', get_string('required'), 'required', null, 'client');
     $mform->setHelpButton('description', array('writing', 'richtext'), false, 'editorhelpbutton');
     $mform->addElement('format', 'introformat', get_string('format'));
     $format = $this->item->channelObj->format;
     $xmlformat =& podcaster_format::create_format($format);
     $xmlformat->define_itemform($mform, $this->item);
     if ($CFG->podcaster_copyright == 'user') {
         $mform->addElement('header', 'license_header', get_string('license', 'podcaster'));
         $mform->addElement('textarea', 'copyright', get_string('copyright', 'podcaster'), array('rows' => '5', 'cols' => '40'));
     } else {
         $license = podcaster_license::create_license($this->item->channelObj->license, $this->item->channelObj->repository);
         if ($license) {
             $mform->addElement('header', 'license_header', get_string('license', 'podcaster'));
             $mform->addElement('static', 'license_name', podcaster_util::get_string('license_' . $license->name . '_title'));
             $mform->addElement('static', 'license_desc', '', podcaster_util::get_string('license_' . $license->name . '_desc'));
             if ($license->confirm) {
                 $mform->addElement('checkbox', 'confirm_license', get_string('confirm_license', 'podcaster'));
                 $mform->addRule('confirm_license', get_string('must_confirm', 'podcaster'), 'required', null, 'client');
             }
         }
     }
     $mform->addElement('hidden', 'cm', $this->coursemodule->id);
     $mform->addElement('hidden', 'channel', $this->item->channelObj->id);
     $mform->addElement('hidden', 'id', $this->item->id);
     $mform->setType('item', PARAM_TEXT);
     $this->add_action_buttons();
 }
Esempio n. 2
0
/**
 * This function prints out a number of upload form elements.
 *
 * @param int $numfiles The number of elements required (optional, defaults to 1)
 * @param array $names Array of element names to use (optional, defaults to FILE_n)
 * @param array $descriptions Array of strings to be printed out before each file bit.
 * @param boolean $uselabels -Whether to output text fields for file descriptions or not (optional, defaults to false)
 * @param array $labelnames Array of element names to use for labels (optional, defaults to LABEL_n)
 * @param int $coursebytes $coursebytes and $maxbytes are used to calculate upload max size ( using {@link get_max_upload_file_size})
 * @param int $modbytes $coursebytes and $maxbytes are used to calculate upload max size ( using {@link get_max_upload_file_size})
 * @param boolean $return -Whether to return the string (defaults to false - string is echoed)
 * @return string Form returned as string if $return is true
 */
function upload_print_form_fragment($numfiles = 1, $names = null, $descriptions = null, $uselabels = false, $labelnames = null, $coursebytes = 0, $modbytes = 0, $return = false)
{
    global $CFG;
    # HU, CS Repository plugin support
    global $scheme, $repository;
    include_once $CFG->dirroot . '/mod/podcaster/locallib.php';
    $maxbytes = get_max_upload_file_size($CFG->maxbytes, $coursebytes, $modbytes);
    $str = '<input type="hidden" name="MAX_FILE_SIZE" value="' . $maxbytes . '" />' . "\n";
    # HU, CS Repository plugin support
    $str .= '<input type="hidden" name="repository" value="' . $scheme . '" />' . "\n";
    $jsdummy = true;
    if ($CFG->podcaster_copyright != 'user' && ($license = podcaster_license::create_license(NULL, $repository->id)) && $license) {
        $str .= '<div id="mod-podcaster-upload"><div class="license">' . podcaster_util::get_string('license_' . $license->name . '_desc');
        if ($license->confirm) {
            $jsdummy = false;
            $str .= '<script type="text/javascript">
  function validate_confirm_license (e) {
    if (e && e.checked) {
      document.forms[0].elements.save.disabled = false;
      document.getElementById (\'confirm_license_span\').style.border = 0;
    }
    else {
      document.forms[0].elements.save.disabled = true;
      if (e) document.getElementById (\'confirm_license_span\').style.border = \'1px solid red;\';
    }
  }
</script>';
            $str .= '<br/><br/><div style="display:inline;padding:4px;margin-left:-4px;" id="confirm_license_span">' . get_string('confirm_license', 'podcaster') . '&nbsp;';
            $str .= '<input name="confirm_license" type="checkbox" value="1" onblur="validate_confirm_license(this)" onchange="validate_confirm_license(this)" /></div><br/><br/>';
        }
        $str .= '</div></div>';
    }
    if ($jsdummy) {
        $str .= '<script type="text/javascript">
        function validate_confirm_license (e) {
          return true;
        }
      </script>';
    }
    for ($i = 0; $i < $numfiles; $i++) {
        if (is_array($descriptions) && !empty($descriptions[$i])) {
            $str .= '<strong>' . $descriptions[$i] . '</strong><br />';
        }
        $name = is_array($names) && !empty($names[$i]) ? $names[$i] : 'FILE_' . $i;
        $str .= '<input type="file" size="50" name="' . $name . '" alt="' . $name . '" /><br />' . "\n";
        if ($uselabels) {
            $lname = is_array($labelnames) && !empty($labelnames[$i]) ? $labelnames[$i] : 'LABEL_' . $i;
            $str .= get_string('uploadlabel') . ' <input type="text" size="50" name="' . $lname . '" alt="' . $lname . '" /><br /><br />' . "\n";
        }
    }
    if ($return) {
        return $str;
    } else {
        echo $str;
    }
}
Esempio n. 3
0
 function podcaster_get_types()
 {
     global $CFG;
     require_once $CFG->dirroot . '/mod/podcaster/lib/util.php';
     $usegroups = false;
     $types = array();
     if (isset($CFG->podcaster_submenus) && $CFG->podcaster_submenus != 'none') {
         // TODO: adapt for other criteria
         $subtypes = array();
         if (strpos($CFG->podcaster_submenus, 'repository') !== false) {
             $repositories = get_records('podcaster_repository', 'enabled', '1');
             foreach ($repositories as $id => $r) {
                 $t = new object();
                 $t->modclass = $CFG->podcaster_type == 'resource' ? MOD_CLASS_RESOURCE : MOD_CLASS_ACTIVITY;
                 $t->type = 'podcaster&amp;type=repository' . podcaster_util::number2az($r->id);
                 $t->typestr = podcaster_util::get_string('repository_' . $r->name . '_title');
                 $subtypes[] = $t;
                 unset($t);
             }
         }
         if (strpos($CFG->podcaster_submenus, 'format') !== false) {
             $formats = explode(',', $CFG->podcaster_formats);
             $merge = count($subtypes) > 0;
             $subtypes2 = array();
             foreach ($formats as $format) {
                 if (!$merge) {
                     $t = new object();
                     $t->modclass = $CFG->podcaster_type == 'resource' ? MOD_CLASS_RESOURCE : MOD_CLASS_ACTIVITY;
                     $t->type = 'podcaster&amp;type=format' . strtoupper($format);
                     $t->typestr = podcaster_util::get_string('format_' . $format . '_title');
                     $subtypes2[] = $t;
                     unset($t);
                 } else {
                     foreach ($subtypes as $subtype) {
                         $t = new object();
                         $t->modclass = $subtype->modclass;
                         $t->type = $subtype->type . 'format' . strtoupper($format);
                         $t->typestr = $subtype->typestr . ', ' . podcaster_util::get_string('format_' . $format . '_title');
                         $subtypes2[] = $t;
                         unset($t);
                     }
                 }
             }
             $subtypes = $subtypes2;
         }
         if (strpos($CFG->podcaster_submenus, 'license') !== false) {
             $licenses = get_records('podcaster_license');
             $merge = count($subtypes) > 0;
             $subtypes2 = array();
             foreach ($licenses as $id => $license) {
                 if (!$merge) {
                     $t = new object();
                     $t->modclass = $CFG->podcaster_type == 'resource' ? MOD_CLASS_RESOURCE : MOD_CLASS_ACTIVITY;
                     $t->type = 'podcaster&amp;type=license' . podcaster_util::number2az($license->id);
                     $t->typestr = podcaster_util::get_string('license_' . $license->name . '_title');
                     $subtypes2[] = $t;
                     unset($t);
                 } else {
                     foreach ($subtypes as $subtype) {
                         $t = new object();
                         $t->modclass = $subtype->modclass;
                         $t->type = $subtype->type . 'license' . podcaster_util::number2az($license->id);
                         $t->typestr = $subtype->typestr . ', ' . podcaster_util::get_string('license_' . $license->name . '_title');
                         $subtypes2[] = $t;
                         unset($t);
                     }
                 }
             }
             $subtypes = $subtypes2;
         }
         if (count($subtypes) > 1) {
             $usegroups = true;
             $start = new object();
             $start->modclass = $CFG->podcaster_type == 'resource' ? MOD_CLASS_RESOURCE : MOD_CLASS_ACTIVITY;
             $start->type = 'podcaster_group_start';
             $start->typestr = '--Podcasts';
             $types[] = $start;
             foreach ($subtypes as $subtype) {
                 $types[] = $subtype;
             }
             $end = new object();
             $end->modclass = $CFG->podcaster_type == 'resource' ? MOD_CLASS_RESOURCE : MOD_CLASS_ACTIVITY;
             $end->type = 'podcaster_group_end';
             $end->typestr = '--';
             $types[] = $end;
         }
     }
     if ($usegroups == false) {
         $type = new object();
         $type->modclass = $CFG->podcaster_type == 'resource' ? MOD_CLASS_RESOURCE : MOD_CLASS_ACTIVITY;
         $type->type = 'podcaster';
         $type->typestr = get_string('modulename', 'podcaster');
         $types[] = $type;
     }
     return $types;
 }
Esempio n. 4
0
function html_header($course, $wdir, $formfield = "")
{
    # HU, CS Repository plugin support
    global $CFG, $ME, $choose, $repository, $scheme;
    $navlinks = array();
    if ($course->id == SITEID) {
        $strfiles = get_string("sitefiles");
    } else {
        $strfiles = get_string("files");
    }
    if ($wdir == "/") {
        $navlinks[] = array('name' => $strfiles, 'link' => null, 'type' => 'misc');
    } else {
        $dirs = explode("/", $wdir);
        $numdirs = count($dirs);
        $link = "";
        $navlinks[] = array('name' => $strfiles, 'link' => $ME . "?id={$course->id}&amp;wdir=/&amp;choose={$choose}" . $repository->get_arg(), 'type' => 'misc');
        for ($i = 1; $i < $numdirs - 1; $i++) {
            $link .= "/" . urlencode($dirs[$i]);
            $navlinks[] = array('name' => $dirs[$i], 'link' => $ME . "?id={$course->id}&amp;wdir={$link}&amp;choose={$choose}" . $repository->get_arg(), 'type' => 'misc');
        }
        $navlinks[] = array('name' => $dirs[$numdirs - 1], 'link' => null, 'type' => 'misc');
    }
    $navigation = build_navigation($navlinks);
    # HU, CS Repository plugin support
    $page = podcaster_page::create_page($c = null);
    $csslink = $page->get_stylesheet();
    if ($choose) {
        # HU, CS Repository plugin support
        print_header('', '', '', '', $csslink);
        $chooseparts = explode('.', $choose);
        if (count($chooseparts) == 2) {
            ?>
            <script type="text/javascript">
            //<![CDATA[
            function set_value(txt) {
                opener.document.forms['<?php 
            echo $chooseparts[0] . "']." . $chooseparts[1];
            ?>
.value = txt;
                window.close();
            }
            //]]>
            </script>

            <?php 
        } elseif (count($chooseparts) == 1) {
            ?>
            <script type="text/javascript">
            //<![CDATA[
            function set_value(txt) {
                opener.document.getElementById('<?php 
            echo $chooseparts[0];
            ?>
').value = txt;
                window.close();
            }
            //]]>
            </script>

            <?php 
        }
        $fullnav = '';
        $i = 0;
        foreach ($navlinks as $navlink) {
            // If this is the last link do not link
            if ($i == count($navlinks) - 1) {
                $fullnav .= $navlink['name'];
            } else {
                $fullnav .= '<a href="' . $navlink['link'] . '">' . $navlink['name'] . '</a>';
            }
            $fullnav .= ' -> ';
            $i++;
        }
        $fullnav = substr($fullnav, 0, -4);
        $fullnav = str_replace('->', '&raquo;', format_string($course->shortname) . " -> " . $fullnav);
        # HU, CS Repository plugin support
        echo '<div id="nav-bar"><img src="' . $CFG->pixpath . '/mod/podcaster/icon.gif" alt="podcaster">&nbsp;' . $fullnav . '</div>';
        if ($course->id == SITEID and $wdir != "/backupdata") {
            print_heading(get_string("publicsitefileswarning"), "center", 2);
        }
    } else {
        if ($course->id == SITEID) {
            if ($wdir == "/backupdata") {
                admin_externalpage_setup('frontpagerestore');
                admin_externalpage_print_header();
            } else {
                admin_externalpage_setup('sitefiles');
                admin_externalpage_print_header();
                print_heading(get_string("publicsitefileswarning"), "center", 2);
            }
        } else {
            print_header("{$course->shortname}: {$strfiles}", $course->fullname, "<a href=\"../../../course/view.php?id={$course->id}\">{$course->shortname}" . "</a> -> {$fullnav}", $formfield, $csslink);
        }
    }
    echo "<table border=\"0\" style=\"margin-left:auto;margin-right:auto\" cellspacing=\"3\" cellpadding=\"3\" width=\"640\">";
    echo "<tr>";
    echo "<td colspan=\"2\">";
    # HU, CS Repository plugin support
    echo '<div id="mod-podcaster-upload-headline">' . podcaster_util::get_string('repository_' . $repository->name . '_desc') . '</div>';
    echo '</tr><tr><td colspan="2">';
}
Esempio n. 5
0
 function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     // do some tests to determine if we have to choose a
     // podcast format, repository and / or license first
     if (isset($this->initial_data) && $this->initial_data->ismeta) {
         $formats = explode(',', $CFG->podcaster_metaformats);
     } else {
         $formats = explode(',', $CFG->podcaster_formats);
     }
     $repositories = get_records('podcaster_repository', 'enabled', '1');
     $licenses = get_records('podcaster_license');
     $format = isset($this->initial_data) ? $this->initial_data->format : '';
     $repository = isset($this->initial_data) ? $this->initial_data->repository : 0;
     $license = isset($this->initial_data) ? $this->initial_data->license : 0;
     if ($format == '') {
         $format = optional_param('format', '', PARAM_TEXT);
         if ($format == '') {
             $typeOptions =& $this->parseTypeOptions();
             if (array_key_exists('format', $typeOptions)) {
                 $format = $typeOptions['format'];
             }
         }
         if (count($formats) == 1) {
             $format = $formats[0];
         }
     }
     if ($repository == 0) {
         $repository = optional_param('repository', 0, PARAM_INT);
         if ($repository == 0) {
             $typeOptions =& $this->parseTypeOptions();
             if (array_key_exists('repository', $typeOptions)) {
                 $repository = $typeOptions['repository'];
             }
         }
         // there should be at least one
         if (count($repositories) == 1) {
             list($repository, ) = each($repositories);
         }
     }
     if ($license == 0) {
         $license = optional_param('license', 0, PARAM_INT);
         if ($license == 0) {
             $typeOptions =& $this->parseTypeOptions();
             if (array_key_exists('license', $typeOptions)) {
                 $license = $typeOptions['license'];
             }
         }
         if (count($licenses) == 1) {
             list($license, ) = each($licenses);
         }
     }
     if (!isset($this->initial_data)) {
         $this->initial_data = new object();
         $this->initial_data->format = $format;
         $this->initial_data->repository = $repository;
         $this->initial_data->license = $license;
     } else {
         $updobj = new object();
         $updobj->id = $this->initial_data->id;
         $dofix = false;
         if ($repository != 0 && (!isset($this->initial_data->repository) || $this->initial_data->repository == 0)) {
             $this->initial_data->repository = $repository;
             $updobj->repository = $repository;
             $dofix = true;
         }
         if ($format != '' && $format != '' && (!isset($this->initial_data->format) || $this->initial_data->format == '')) {
             $this->initial_data->format = $format;
             $updobj->format = $format;
             $dofix = true;
         }
         if ($license && (!isset($this->initial_data->license) || $this->initial_data->license == 0)) {
             $this->initial_data->license = $license;
             $updobj->license = $license;
             $dofix = true;
         }
         update_record('podcaster', $updobj);
     }
     // 1st step: repository, format or license cannot be determined automatically
     if (!$repository || !$format || !$license && $CFG->podcaster_copyright == 'menu') {
         $mform->addElement('header', 'firststep', get_string('create_step1', 'podcaster'));
         if (is_array($formats) && count($formats) > 1) {
             $options = array();
             $mform->addElement('static', 'repository_hint', get_string('format_hint', 'podcaster'));
             for ($i = 0, $c = count($formats); $i < $c; ++$i) {
                 $options[$formats[$i]] = podcaster_util::get_string('format_' . $formats[$i] . '_title');
             }
             $mform->addElement('select', 'format', get_string('format', 'podcaster'), $options);
         } elseif ($format) {
             $mform->addElement('hidden', 'format', $format);
         } else {
             error('Module is misconfigured: no formats available. Please check module configuration.');
         }
         if (is_array($repositories) && count($repositories) > 1) {
             $mform->addElement('static', 'repository_hint', get_string('repository_hint', 'podcaster'));
             $options = array();
             foreach ($repositories as $r) {
                 $options[$r->id] = podcaster_util::get_string('repository_' . $r->name . '_title');
             }
             $mform->addElement('select', 'repository', get_string('repository', 'podcaster'), $options);
         } elseif ($repository) {
             $mform->addElement('hidden', 'repository', $repository);
         } else {
             error('Module is misconfigured: no repositories available. Please check module configuration.');
         }
         if (is_array($licenses) && count($licenses) > 1 && $CFG->podcaster_copyright == 'menu') {
             $mform->addElement('static', 'license_hint', get_string('license_hint', 'podcaster'));
             $options = array();
             foreach ($licenses as $l) {
                 $options[$l->id] = podcaster_util::get_string('license_' . $l->name . '_title');
             }
             $mform->addElement('select', 'license', get_string('license', 'podcaster'), $options);
         } elseif ($license && $CFG->podcaster_copyright == 'menu') {
             $mform->addElement('hidden', 'license', $licenses);
         } elseif ($CFG->podcaster_copyright == 'menu') {
             error('Module is misconfigured: no licenses available. Please check module configuration.');
         }
         // add standard elements, common to all modules
         $this->standard_hidden_coursemodule_elements();
         $this->add_action_buttons(true);
         $mform->removeElement('submitbutton2');
         $mform->addElement('hidden', 'reloadform', 'true');
     } else {
         // just submitted 1st step?
         if (optional_param('reloadform', '', PARAM_TEXT) == 'true') {
             $querystr = '';
             $add = optional_param('add', 0, PARAM_TEXT);
             $update = optional_param('update', 0, PARAM_INT);
             if ($update != 0) {
                 $querystr = '?update=' . $update;
             } else {
                 $querystr = '?add=' . $add;
             }
             redirect($CFG->wwwroot . '/course/modedit.php' . $querystr . '&course=' . required_param('course', PARAM_INT) . '&section=' . required_param('section', PARAM_INT) . '&format=' . $format . '&repository=' . $repository . '&license=' . $license . '&sesskey=' . required_param('sesskey', PARAM_TEXT));
         }
         // show standard edit form
         $mform->addElement('header', 'general', get_string('general', 'form'));
         $mform->addElement('text', 'name', get_string('channelname', 'podcaster'), array('size' => '48'));
         $mform->setType('name', PARAM_TEXT);
         $mform->addRule('name', null, 'required', null, 'client');
         $mform->addElement('htmleditor', 'intro', get_string('channeldescription', 'podcaster'));
         $mform->setType('intro', PARAM_RAW);
         $mform->addRule('intro', get_string('required'), 'required', null, 'client');
         $mform->setHelpButton('intro', array('writing', 'richtext'), false, 'editorhelpbutton');
         $mform->addElement('format', 'introformat', get_string('format'));
         // include format specific elements
         $xmlformat =& podcaster_format::create_format($format);
         $xmlformat->define_channelform($mform, $this->initial_data);
         $mform->addElement('hidden', 'format', $format);
         $mform->setType('format', PARAM_TEXT);
         $mform->addElement('hidden', 'repository', $repository);
         $mform->setType('repository', PARAM_INT);
         $mform->addElement('hidden', 'license', $license);
         $mform->setType('license', PARAM_INT);
         // add standard elements, common to all modules
         $this->standard_coursemodule_elements();
         if ($CFG->podcaster_copyright == 'user') {
             $mform->addElement('header', 'license_header', get_string('license', 'podcaster'));
             $mform->addElement('textarea', 'copyright', get_string('copyright', 'podcaster'), array('rows' => '5', 'cols' => '40'));
         } else {
             $license = podcaster_license::create_license($license, $repository);
             if ($license) {
                 $mform->addElement('header', 'license_header', podcaster_util::get_string('license_' . $license->name . '_title'));
                 //
                 if (!isset($this->initial_data->copyright)) {
                     $copyright = podcaster_util::get_string('license_' . $license->name . '_desc');
                 } else {
                     $copyright = $this->initial_data->copyright;
                 }
                 $mform->addElement('static', 'license_desc', '', $copyright);
                 $mform->addElement('hidden', 'copyright', $copyright);
                 if ($license->confirm) {
                     $mform->addElement('checkbox', 'confirm_license', get_string('confirm_license', 'podcaster'));
                     $mform->addRule('confirm_license', get_string('must_confirm', 'podcaster'), 'required', null, 'client');
                 }
             }
         }
         // add standard buttons, common to all modules
         $this->add_action_buttons(false);
     }
 }
Esempio n. 6
0
    error('You are not allowed to do so');
}
$item = $channel->get_item($id);
if (!$item) {
    error('This item does not exist');
}
if ($confirm == 0) {
    $strdeletecheck = get_string('deletecheck', '', $item->title);
    $strdeletecheckfull = get_string('deletecheckfull', '', "{$channel->name} '{$item->title}'");
    $strdeletefilehint = get_string('deletefilehint', 'podcaster', $item->enclosure);
    $strdeletefilelabel = get_string('deletefilelabel', 'podcaster', $item->enclosure);
    $candeletefile = false;
    print_header_simple($strdeletecheck, '', $strdeletecheck);
    print_simple_box_start('center', '60%', '#FFAAAA', 20, 'noticebox');
    print_heading($strdeletecheckfull);
    if ($item->enclosure != '' && count(podcaster_util::get_filerefs($course, $channel, $item->enclosure)) == 1) {
        $candeletefile = true;
    }
    ?>
<form id="form" method="post" action="./deleteitem.php">
  <input type="hidden" name="channel" value="<?php 
    p($channel->id);
    ?>
" />
  <input type="hidden" name="id"      value="<?php 
    p($id);
    ?>
" />
  <input type="hidden" name="delete"  value="<?php 
    p('1');
    ?>
Esempio n. 7
0
 function get_itemdetailhtml(&$item, &$page)
 {
     global $CFG;
     $url = NULL;
     $enclosure = $item->get_enclosure();
     if ($enclosure) {
         $url = $enclosure->url;
     }
     $result = '';
     if ($item->channelObj->can_edit()) {
         if ($item->scheduledtime > time()) {
             $result = '<div class="scheduledtime">' . get_string('scheduledtime', 'podcaster') . ':&nbsp;' . userdate($item->scheduledtime, get_string('strftimedatetime')) . '</div>';
         }
         $result .= '<div class="timecreated">' . get_string('timecreated', 'podcaster') . ':&nbsp;' . userdate($item->timecreated, get_string('strftimedatetime')) . '</div>';
         $result .= '<div class="timemodified">' . get_string('lastmodified') . ':&nbsp;' . userdate($item->timemodified, get_string('strftimedatetime')) . '</div>';
     } else {
         $result = '<div class="scheduledtime">' . get_string('pubdate', 'podcaster') . ':&nbsp;' . userdate($item->scheduledtime, get_string('strftimedatetime')) . '</div>';
     }
     return $result . '<div class="title">' . htmlspecialchars($item->title) . '</div>' . '<div class="author">&nbsp;(' . htmlspecialchars(podcaster_util::strip_email($item->author)) . ')</div>' . ($url ? '<div class="download"><a href="' . $url . '" title="' . $enclosure->name . '">' . $enclosure->name . ' (' . $this->filesize($enclosure->length) . ') <img src="' . $CFG->pixpath . '/f/' . mimeinfo('icon', $url) . '" border="0" alt="' . $enclosure->name . '" align="top" /></a></div>' : '') . ($url ? '<div class="enclosure">' . $page->embedd_html($url, $item->title) . '</div>' : '') . '<div class="description">' . $item->description . '</div>' . '<div class="separator"><hr size="1" /></div>';
 }
Esempio n. 8
0
 function print_metachannelform()
 {
     global $CFG;
     require_once $CFG->dirroot . '/mod/podcaster/lib/util.php';
     $repositories = array();
     $disabled = array();
     $repos = get_records('podcaster_repository');
     if ($repos) {
         foreach ($repos as $rep) {
             $repositories[$rep->id] = podcaster_util::get_string('repository_' . $rep->name . '_title');
             if (!$rep->enabled) {
                 $disabled[] = $rep->id;
             }
         }
     }
     $metachannels = get_records('podcaster_metachannel');
     if ($metachannels) {
         foreach ($metachannels as $metachannel) {
             $selected = explode(',', $metachannel->params);
             $cm = get_coursemodule_from_instance('podcaster', $metachannel->channel, SITEID);
             $channel = get_record('podcaster', 'id', $metachannel->channel);
             echo '<tr>
             <td align="right">' . get_string('config_metachannelname', 'podcaster') . '</td>
             <td><b>' . $metachannel->name . '</b></td>
             <td>&nbsp;</td>
           </tr>
           <tr>
             <td align="right">' . get_string('config_metachannelpath', 'podcaster') . '</td>
             <td><input type="text" name="metachannel_' . $metachannel->id . '_path" value="' . htmlspecialchars($metachannel->path) . '" /></td>
             <td>&nbsp;</td>
           </tr>
           <tr>
             <td align="right">' . get_string('config_metachannelchannel', 'podcaster') . '</td>
             <td>' . $channel->name . '&nbsp;<a href="' . $CFG->wwwroot . '/course/modedit.php?update=' . $cm->id . '" title="' . get_string('edit') . '"><img src="' . $CFG->pixpath . '/t/edit.gif" class="iconsmall" alt="' . get_string('edit') . '" /></a></td>
             <td>&nbsp;</td>
           </tr>
           <tr>
             <td align="right" valign="top">' . get_string('config_metachannelparams', 'podcaster') . '</td>
             <td>' . $this->choose_from_menu_multiple($repositories, 'metachannel_' . $metachannel->id . '_params', $selected, $disabled, 5) . '</td>
             <td style="white-space:nowrap;" align="right" valign="bottom">
               <button name="" value="" title="" border="0" style="border:none;background-color:transparent;"></button>
               <input name="delete_' . $metachannel->id . '_confirm" type="checkbox" />
               <button name="delete_' . $metachannel->id . '" value="delete" title="' . get_string('delete') . '" border="0" style="border:none;background-color:transparent;vertical-align:top;padding-left:0px;">
                 <img src="' . $CFG->pixpath . '/t/delete.gif" class="iconsmall" alt="' . get_string('delete') . '" />
               </button>
             </td>
           </tr>
           <tr><td colspan="3"><hr size="1"/></td></tr>';
         }
     }
     // new meta channel form
     echo '
           <tr>
             <td align="right"><b>' . get_string('config_newmetachannel', 'podcaster') . '</b></td>
             <td><input name="metachannel_0_name" type="text" size="32" value="" /></td>
             <td>&nbsp;</td>
           </tr>
           <tr>
             <td align="right">' . get_string('config_metachannelpath', 'podcaster') . '</td>
             <td><input type="text" name="metachannel_0_path" value="" /></td>
             <td>&nbsp;</td>
           </tr>
           <tr>
             <td align="right" valign="top">' . get_string('config_metachannelparams', 'podcaster') . '</td>
             <td>' . $this->choose_from_menu_multiple($repositories, 'metachannel_0_params', array(), $disabled, 5) . '</td>
             <td align="right" valign="bottom">
               <button name="add" value="add" title="' . get_string('add') . '" border="0" style="border:none;background-color:transparent;">
                 <img src="' . $CFG->pixpath . '/t/go.gif" class="iconsmall" alt="' . get_string('add') . '" />
               </button>
             </td>
           </tr>';
 }