예제 #1
0
파일: adminlib.php 프로젝트: evltuma/moodle
 /**
  * Validate data.
  *
  * This ensures that:
  * - Plugins are only used once,
  * - Group names are unique,
  * - Lines match: group = plugin[, plugin[, plugin ...]],
  * - There are some groups and plugins defined,
  * - The plugins used are installed.
  *
  * @param string $data
  * @return mixed True on success, else error message.
  */
 public function validate($data)
 {
     $result = parent::validate($data);
     if ($result !== true) {
         return $result;
     }
     $lines = explode("\n", $data);
     $groups = array();
     $plugins = array();
     foreach ($lines as $line) {
         if (!trim($line)) {
             continue;
         }
         $matches = array();
         if (!preg_match('/^\\s*([a-z0-9]+)\\s*=\\s*([a-z0-9]+(\\s*,\\s*[a-z0-9]+)*)+\\s*$/', $line, $matches)) {
             $result = get_string('errorcannotparseline', 'editor_atto', $line);
             break;
         }
         $group = $matches[1];
         if (isset($groups[$group])) {
             $result = get_string('errorgroupisusedtwice', 'editor_atto', $group);
             break;
         }
         $groups[$group] = true;
         $lineplugins = array_map('trim', explode(',', $matches[2]));
         foreach ($lineplugins as $plugin) {
             if (isset($plugins[$plugin])) {
                 $result = get_string('errorpluginisusedtwice', 'editor_atto', $plugin);
                 break 2;
             } else {
                 if (!core_component::get_component_directory('atto_' . $plugin)) {
                     $result = get_string('errorpluginnotfound', 'editor_atto', $plugin);
                     break 2;
                 }
             }
             $plugins[$plugin] = true;
         }
     }
     // We did not find any groups or plugins.
     if (empty($groups) || empty($plugins)) {
         $result = get_string('errornopluginsorgroupsfound', 'editor_atto');
     }
     return $result;
 }
예제 #2
0
 public function write_setting($data)
 {
     // your custom validation logic here
     //we have no special needs, but we clean empty lines and compare with the db
     $lines = explode("\n", $data);
     array_walk($lines, create_function('&$val', '$val = trim($val);'));
     $lines = array_filter($lines);
     //leere weg
     /*
         	echo "<textarea cols=50 rows=20>";
     		var_dump($lines);
     		echo "</textarea>";
     		
     * 
     */
     //ok, jetzt abgleich mit db
     ResopDB::synchDBDepartements($lines);
     //nur einfügen, alte nicht herausnehmen
     $data = implode("\n", $lines);
     return parent::write_setting($data);
 }
예제 #3
0
$name = 'theme_mmcmonkwearmouth/teacher_buttons';
$title = get_string('teacherbuttons', 'theme_mmcmonkwearmouth');
$description = get_string('settingbuttonsdesc', 'theme_mmcmonkwearmouth');
$setting = new theme_mmcmonkwearmouth_admin_setting_buttons($name, $title, $description, 0);
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
$name = 'theme_mmcmonkwearmouth/student_buttons';
$title = get_string('studentbuttons', 'theme_mmcmonkwearmouth');
$description = get_string('settingbuttonsdesc', 'theme_mmcmonkwearmouth');
$setting = new theme_mmcmonkwearmouth_admin_setting_buttons($name, $title, $description, 0);
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
$name = 'theme_mmcmonkwearmouth/staff_buttons';
$title = get_string('staffbuttons', 'theme_mmcmonkwearmouth');
$description = get_string('settingbuttonsdesc', 'theme_mmcmonkwearmouth');
$setting = new theme_mmcmonkwearmouth_admin_setting_buttons($name, $title, $description, 0);
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
$name = 'theme_mmcmonkwearmouth/logo';
$title = get_string('logo', 'theme_mmcmonkwearmouth');
$description = get_string('logodesc', 'theme_mmcmonkwearmouth');
$setting = new admin_setting_configstoredfile($name, $title, $description, 'logo');
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
$name = 'theme_mmcmonkwearmouth/customcss';
$title = get_string('customcss', 'theme_mmcmonkwearmouth');
$description = get_string('customcssdesc', 'theme_mmcmonkwearmouth');
$default = '';
$setting = new admin_setting_configtextarea($name, $title, $description, $default);
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
 public function add_numbered_textareas($setting, $count, $default = '')
 {
     for ($i = 1; $i <= $count; $i++) {
         $textarea = new admin_setting_configtextarea($this->name_for($setting, $i), $this->title_for($setting, $i), $this->description_for($setting), $default);
         $textarea->set_updatedcallback('theme_reset_all_caches');
         $this->settingspage->add($textarea);
     }
 }
예제 #5
0
 /**
  * Returns an XHTML string for the editor
  *
  * @param string $data
  * @param string $query
  * @return string XHTML string for the editor
  */
 public function output_html($data, $query='') {
     $editor = editors_get_preferred_editor(FORMAT_HTML);
     $editor->set_text($data);
     $editor->use_editor($this->get_id(), array('noclean'=>true));
     return parent::output_html($data, $query);
 }
예제 #6
0
     }
 }
 // The default here is feedback_comments (if it exists).
 $name = new lang_string('feedbackplugin', 'mod_assign');
 $description = new lang_string('feedbackpluginforgradebook', 'mod_assign');
 $settings->add(new admin_setting_configselect('assign/feedback_plugin_for_gradebook', $name, $description, 'assignfeedback_comments', $menu));
 $name = new lang_string('showrecentsubmissions', 'mod_assign');
 $description = new lang_string('configshowrecentsubmissions', 'mod_assign');
 $settings->add(new admin_setting_configcheckbox('assign/showrecentsubmissions', $name, $description, 0));
 $name = new lang_string('sendsubmissionreceipts', 'mod_assign');
 $description = new lang_string('sendsubmissionreceipts_help', 'mod_assign');
 $settings->add(new admin_setting_configcheckbox('assign/submissionreceipts', $name, $description, 1));
 $name = new lang_string('submissionstatement', 'mod_assign');
 $description = new lang_string('submissionstatement_help', 'mod_assign');
 $default = get_string('submissionstatementdefault', 'mod_assign');
 $setting = new admin_setting_configtextarea('assign/submissionstatement', $name, $description, $default);
 $setting->set_force_ltr(false);
 $settings->add($setting);
 $name = new lang_string('maxperpage', 'mod_assign');
 $options = array(-1 => get_string('unlimitedpages', 'mod_assign'), 10 => 10, 20 => 20, 50 => 50, 100 => 100);
 $description = new lang_string('maxperpage_help', 'mod_assign');
 $settings->add(new admin_setting_configselect('assign/maxperpage', $name, $description, -1, $options));
 $name = new lang_string('defaultsettings', 'mod_assign');
 $description = new lang_string('defaultsettings_help', 'mod_assign');
 $settings->add(new admin_setting_heading('defaultsettings', $name, $description));
 $name = new lang_string('alwaysshowdescription', 'mod_assign');
 $description = new lang_string('alwaysshowdescription_help', 'mod_assign');
 $setting = new admin_setting_configcheckbox('assign/alwaysshowdescription', $name, $description, 1);
 $setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
 $setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
 $settings->add($setting);
예제 #7
0
파일: adminlib.php 프로젝트: Burick/moodle
 /**
  * Returns an XHTML string for the editor
  *
  * @param string $data
  * @param string $query
  * @return string XHTML string for the editor
  */
 public function output_html($data, $query = '')
 {
     $result = parent::output_html($data, $query);
     $data = trim($data);
     if ($data) {
         $decoded = json_decode($data, true);
         // Note: it is not very nice to abuse these file classes, but anyway...
         if (is_array($decoded)) {
             $valid = '<span class="pathok">&#x2714;</span>';
         } else {
             $valid = '<span class="patherror">&#x2718;</span>';
         }
         $result = str_replace('</textarea>', '</textarea>' . $valid, $result);
     }
     return $result;
 }
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
This plugin is part of Archaius theme.
@copyright  2015 onwards Daniel Munera Sanchez
*/
defined('MOODLE_INTERNAL') || die;
if (is_siteadmin()) {
    $developer_options = new admin_settingpage('theme_archaius_developer', get_string('developersectiontitle', 'theme_archaius'));
    $developer_options->add(new admin_setting_heading('theme_archaius_developer', get_string('developersectionsub', 'theme_archaius'), format_text(get_string('developersectiondesc', 'theme_archaius'), FORMAT_MARKDOWN)));
    // Custom CSS file
    $name = 'theme_archaius/customcss';
    $title = get_string('customcss', 'theme_archaius');
    $description = get_string('customcssdesc', 'theme_archaius');
    $default = '';
    $setting = new admin_setting_configtextarea($name, $title, $description, $default);
    $setting->set_updatedcallback('theme_reset_all_caches');
    $developer_options->add($setting);
    // Custom Javascript file
    $name = 'theme_archaius/customjs';
    $title = get_string('customjs', 'theme_archaius');
    $description = get_string('customjsdesc', 'theme_archaius');
    $default = '';
    $setting = new admin_setting_configtextarea($name, $title, $description, $default);
    $setting->set_updatedcallback('theme_reset_all_caches');
    $developer_options->add($setting);
    //Add options to admin tree
    $ADMIN->add('theme_archaius', $developer_options);
}