Location: PHPKode > projects > PhpTimeClock > phptimeclock-2.0.0rc2/plugins/MOTD/edit.php
<?php
/***************************************************************************
 * Copyright (C) 2009 by                                                   *
 * PhpTimeClock team respective developers. http://www.PhpTimeClock.com/   *
 *                                                                         *
 * This program is free software: you can redistribute it and/or modify    *
 * it under the terms of the GNU Affero General Public License as          *
 * published by the Free Software Foundation, either version 3 of the      *
 * License, or (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 Affero General Public License for more details.                     *
 *                                                                         *
 * You should have received a copy of the                                  *
 * GNU Affero General Public License along with this program.              *
 * If not, see http://www.gnu.org/licenses/.                               *
 ***************************************************************************/

function plugin_options() {
    $options = array();

    $options[] = array(OPTION_INFORMATION, 'MOTD Options', 'These options set the message of the day to display. Place the keyword \''.DO_NOT_USE_OPTION.'\' to not display the link.');
    $options['message_of_the_day'] = 'message_of_the_day';
    return $options;
}

function plugin_option_descriptions() {
    $options = array();

    $options[] = OPTION_INFORMATION;
    $options['message_of_the_day'] = 'Message of the day to display';
    return $options;
}

function plugin_option_values() {
    if (@include_once PLUGIN_CONFIGURATION_FILE_NAME) {
        $options = array();
        $options[] = OPTION_INFORMATION;
        if (isset($message_of_the_day)) {
            $options['message_of_the_day'] = $message_of_the_day;
        } else {
            $options = plugin_option_defaults();
        }
    } else {
        $options = plugin_option_defaults();
    }
    return $options;
}

function plugin_option_defaults() {
    $options = array();

    $options[] = OPTION_INFORMATION;
    $options['message_of_the_day'] = 'Using PhpTimeClock two times a day keeps the accountants at bay.';
    return $options;
}

function plugin_option_field_types() {
    $options = array();

    $options[] = OPTION_INFORMATION;
    $options['message_of_the_day'] = 'textarea';
    return $options;
}

function plugin_option_choices() {
    $options = array();

    $options[] = OPTION_INFORMATION;
    $options['message_of_the_day'] = '';
    return $options;
}

function plugin_options_validate($options) {
    $valid_result = true;

    foreach ($options as $option => $option_value) {
        if ('message_of_the_day' == $option) {
            if (empty($option_value)) {
                output_error_message("$option must contain a message.");
                $valid_result = false;
            }
        } else {
            output_error_message("Invalid option supplied! $option is not recognised as a valid option.");
            $valid_result = false;
        }
    }
    return $valid_result;
}

function write_plugin_options($file_pointer, $plugin_options) {
    return write_configuration_options($file_pointer, $plugin_options);
}

?>
Return current item: PhpTimeClock