コード例 #1
0
ファイル: filter_form.php プロジェクト: vuchannguyen/web
 function definition()
 {
     $mform = $this->_form;
     $current = $this->_customdata['current'];
     $mform->addElement('header', 'filtersettings', get_string('filter', 'report_customlang'));
     // Component
     $options = array();
     foreach (report_customlang_utils::list_components() as $component => $normalized) {
         list($type, $plugin) = normalize_component($normalized);
         if ($type == 'core' and is_null($plugin)) {
             $plugin = 'moodle';
         }
         $options[$type][$normalized] = $component . '.php';
     }
     $mform->addElement('selectgroups', 'component', get_string('filtercomponent', 'report_customlang'), $options, array('multiple' => 'multiple', 'size' => 7));
     // Customized only
     $mform->addElement('advcheckbox', 'customized', get_string('filtercustomized', 'report_customlang'));
     $mform->setType('customized', PARAM_BOOL);
     $mform->setDefault('customized', 0);
     // Only helps
     $mform->addElement('advcheckbox', 'helps', get_string('filteronlyhelps', 'report_customlang'));
     $mform->setType('helps', PARAM_BOOL);
     $mform->setDefault('helps', 0);
     // Modified only
     $mform->addElement('advcheckbox', 'modified', get_string('filtermodified', 'report_customlang'));
     $mform->setType('filtermodified', PARAM_BOOL);
     $mform->setDefault('filtermodified', 0);
     // Substring
     $mform->addElement('text', 'substring', get_string('filtersubstring', 'report_customlang'));
     $mform->setType('substring', PARAM_RAW);
     // String identifier
     $mform->addElement('text', 'stringid', get_string('filterstringid', 'report_customlang'));
     $mform->setType('stringid', PARAM_STRINGID);
     // Show strings - submit button
     $mform->addElement('submit', 'submit', get_string('filtershowstrings', 'report_customlang'));
 }
コード例 #2
0
navigation_node::override_active_url(new moodle_url('/admin/report/customlang/index.php'));
$PAGE->set_title(get_string('pluginname', 'report_customlang'));
$PAGE->set_heading(get_string('pluginname', 'report_customlang'));
$PAGE->requires->js_init_call('M.report_customlang.init_editor', array(), true);
if (empty($lng)) {
    // PARAM_LANG validation failed
    print_error('missingparameter');
}
// pre-output processing
$filter = new report_customlang_filter_form($PAGE->url, null, 'post', '', array('class' => 'filterform'));
$filterdata = report_customlang_utils::load_filter($USER);
$filter->set_data($filterdata);
if ($filter->is_cancelled()) {
    redirect($PAGE->url);
} elseif ($submitted = $filter->get_data()) {
    report_customlang_utils::save_filter($submitted, $USER);
    redirect(new moodle_url($PAGE->url, array('p' => 0)));
}
if ($translatorsubmitted) {
    $strings = optional_param('cust', array(), PARAM_RAW);
    $updates = optional_param('updates', array(), PARAM_INT);
    $checkin = optional_param('savecheckin', false, PARAM_RAW);
    if ($checkin === false) {
        $nexturl = $PAGE->url;
    } else {
        $nexturl = new moodle_url('/admin/report/customlang/index.php', array('action' => 'checkin', 'lng' => $lng, 'sesskey' => sesskey()));
    }
    if (!is_array($strings)) {
        $strings = array();
    }
    $current = $DB->get_records_list('report_customlang', 'id', array_keys($strings));
コード例 #3
0
ファイル: locallib.php プロジェクト: vuchannguyen/web
 /**
  * Returns the name of the file where the component's local strings should be exported into
  *
  * @param string $component normalized name of the component, eg 'core' or 'mod_workshop'
  * @return string|boolean filename eg 'moodle.php' or 'workshop.php', false if not found
  */
 protected static function get_component_filename($component)
 {
     if (is_null(self::$components)) {
         self::$components = self::list_components();
     }
     $return = false;
     foreach (self::$components as $legacy => $normalized) {
         if ($component === $normalized) {
             $return = $legacy . '.php';
             break;
         }
     }
     return $return;
 }
コード例 #4
0
ファイル: index.php プロジェクト: vuchannguyen/web
    } else {
        report_customlang_utils::checkin($lng);
        redirect($PAGE->url);
    }
}
$output = $PAGE->get_renderer('report_customlang');
// output starts here
echo $output->header();
echo $output->heading(get_string('pluginname', 'report_customlang'));
if (empty($lng)) {
    $s = new single_select($PAGE->url, 'lng', $langs);
    $s->label = get_accesshide(get_string('language'));
    $s->class = 'langselector';
    echo $output->box($OUTPUT->render($s), 'langselectorbox');
    echo $OUTPUT->footer();
    exit;
}
echo $output->heading($langs[$lng], 3);
$numofmodified = report_customlang_utils::get_count_of_modified($lng);
if ($numofmodified != 0) {
    echo $output->heading(get_string('modifiednum', 'report_customlang', $numofmodified), 3);
}
$menu = array();
if (has_capability('report/customlang:edit', get_system_context())) {
    $menu['checkout'] = array('title' => get_string('checkout', 'report_customlang'), 'url' => new moodle_url($PAGE->url, array('action' => 'checkout', 'lng' => $lng)), 'method' => 'post');
    if ($numofmodified != 0) {
        $menu['checkin'] = array('title' => get_string('checkin', 'report_customlang'), 'url' => new moodle_url($PAGE->url, array('action' => 'checkin', 'lng' => $lng)), 'method' => 'post');
    }
}
echo $output->render(new report_customlang_menu($menu));
echo $output->footer();