Ejemplo n.º 1
0
    // strip execute flags
}
// Better also set default umask because developers often forget to include directory
// permissions in mkdir() and chmod() after creating new files.
if (!isset($CFG->umaskpermissions)) {
    $CFG->umaskpermissions = $CFG->directorypermissions & 0777 ^ 0777;
}
umask($CFG->umaskpermissions);
if (defined('BEHAT_SITE_RUNNING')) {
    // We already switched to behat test site previously.
} else {
    if (!empty($CFG->behat_wwwroot) or !empty($CFG->behat_dataroot) or !empty($CFG->behat_prefix)) {
        // The behat is configured on this server, we need to find out if this is the behat test
        // site based on the URL used for access.
        require_once __DIR__ . '/../lib/behat/lib.php';
        if (behat_is_test_site()) {
            // Checking the integrity of the provided $CFG->behat_* vars and the
            // selected wwwroot to prevent conflicts with production and phpunit environments.
            behat_check_config_vars();
            // Check that the directory does not contains other things.
            if (!file_exists("{$CFG->behat_dataroot}/behattestdir.txt")) {
                if ($dh = opendir($CFG->behat_dataroot)) {
                    while (($file = readdir($dh)) !== false) {
                        if ($file === 'behat' or $file === '.' or $file === '..' or $file === '.DS_Store') {
                            continue;
                        }
                        behat_error(BEHAT_EXITCODE_CONFIG, '$CFG->behat_dataroot directory is not empty, ensure this is the directory where you want to install behat test dataroot');
                    }
                    closedir($dh);
                    unset($dh);
                    unset($file);
Ejemplo n.º 2
0
// 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.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * A two column layout for the boost theme.
 *
 * @package   theme_boost
 * @copyright 2016 Damyon Wiese
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
defined('MOODLE_INTERNAL') || die;
user_preference_allow_ajax_update('drawer-open-nav', PARAM_ALPHA);
require_once $CFG->libdir . '/behat/lib.php';
if (isloggedin() && !behat_is_test_site()) {
    $navdraweropen = get_user_preferences('drawer-open-nav', 'true') == 'true';
} else {
    $navdraweropen = false;
}
$extraclasses = [];
if ($navdraweropen) {
    $extraclasses[] = 'drawer-open-left';
}
$bodyattributes = $OUTPUT->body_attributes($extraclasses);
$blockshtml = $OUTPUT->blocks('side-pre');
$hasblocks = strpos($blockshtml, 'data-block=') !== false;
$templatecontext = ['sitename' => format_string($SITE->shortname, true, array('context' => context_course::instance(SITEID))), 'output' => $OUTPUT, 'sidepreblocks' => $blockshtml, 'hasblocks' => $hasblocks, 'bodyattributes' => $bodyattributes, 'navdraweropen' => $navdraweropen];
$templatecontext['flatnavigation'] = $PAGE->flatnav;
echo $OUTPUT->render_from_template('theme_boost/columns2', $templatecontext);