$tempfield->setDefault($default);
/// Prepare the output
$site = get_site();
- print_header("$site->shortname: XMLDB",
- "$site->fullname",
- "<a href=\"../index.php\">" . $this->str['administration'] . "</a> -> <a href=\"index.php\">XMLDB</a>");
+ $navlinks = array();
+ $navlinks[] = array('name' => $this->str['administration'], 'link' => '../index.php', 'type' => 'misc');
+ $navlinks[] = array('name' => 'XMLDB', 'link' => 'index.php', 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$site->shortname: XMLDB", "$site->fullname", $navigation);
notice ('<p>' .implode(', ', $errors) . '</p>
<p>' . $tempfield->readableInfo(),
- 'index.php?action=edit_field&field=' .$field->getName() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)));
+ 'index.php?action=edit_field&field=' .$field->getName() . '&table=' . $table->getName()
+ . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)));
die; /// re-die :-P
}
$tempindex->setFields($fieldsarr);
/// Prepare the output
$site = get_site();
- print_header("$site->shortname: XMLDB",
- "$site->fullname",
- "<a href=\"../index.php\">" . $this->str['administration'] . "</a> -> <a href=\"index.php\">XMLDB</a>");
+ $navlinks = array();
+ $navlinks[] = array('name' => $this->str['administration'], 'link' => '../index.php', 'type' => 'misc');
+ $navlinks[] = array('name' => 'XMLDB', 'link' => 'index.php', 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$site->shortname: XMLDB", "$site->fullname", $navigation);
notice ('<p>' .implode(', ', $errors) . '</p>
<p>' . $tempindex->readableInfo(),
'index.php?action=edit_index&index=' .$index->getName() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)));
}
/// Prepare the output
$site = get_site();
- print_header("$site->shortname: XMLDB",
- "$site->fullname",
- "<a href=\"../index.php\">" . $this->str['administration'] . "</a> -> <a href=\"index.php\">XMLDB</a>");
+ $navlinks = array();
+ $navlinks[] = array('name' => $this->str['administration'], 'link' => '../index.php', 'type' => 'misc');
+ $navlinks[] = array('name' => 'XMLDB', 'link' => 'index.php', 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$site->shortname: XMLDB", "$site->fullname", $navigation);
+
notice ('<p>' .implode(', ', $errors) . '</p>
<p>' . $tempkey->readableInfo(),
'index.php?action=edit_key&key=' .$key->getName() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)));
if (!empty($errors)) {
/// Prepare the output
$site = get_site();
- print_header("$site->shortname: XMLDB",
- "$site->fullname",
- "<a href=\"../index.php\">" . $this->str['administration'] . "</a> -> <a href=\"index.php\">XMLDB</a>");
+ $navlinks = array();
+ $navlinks[] = array('name' => $this->str['administration'], 'link' => '../index.php', 'type' => 'misc');
+ $navlinks[] = array('name' => 'XMLDB', 'link' => 'index.php', 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$site->shortname: XMLDB", "$site->fullname", $navigation);
notice ('<p>' .implode(', ', $errors) . '</p>
<p>' . s($sentence),
'index.php?action=edit_sentence&sentence=' .$sentenceparam . '&statement=' . urlencode($statementparam) . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)));
$temptable = new XMLDBTable($name);
/// Prepare the output
$site = get_site();
- print_header("$site->shortname: XMLDB",
- "$site->fullname",
- "<a href=\"../index.php\">" . $this->str['administration'] . "</a> -> <a href=\"index.php\">XMLDB</a>");
+ $navlinks = array();
+ $navlinks[] = array('name' => $this->str['administration'], 'link' => '../index.php', 'type' => 'misc');
+ $navlinks[] = array('name' => 'XMLDB', 'link' => 'index.php', 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$site->shortname: XMLDB", "$site->fullname", $navigation);
notice ('<p>' .implode(', ', $errors) . '</p>
<p>' . $temptable->readableInfo(),
'index.php?action=edit_table&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)));
}
}
/**
- * Authenticates user againt CAS
+ * Authenticates user againt CAS
* Returns true if the username and password work and false if they are
* wrong or don't exist.
*
if (!empty($username)) {
if (strstr($SESSION->wantsurl,'ticket') || strstr($SESSION->wantsurl,'NOCAS'))
unset($SESSION->wantsurl);
- return;
+ return;
}
// Test si cas activé et paramêtres non remplis
// Connection to CAS server
$this->connectCAS();
- // Gestion de la connection CAS si accès direct d'un ent ou autre
+ // Gestion de la connection CAS si accès direct d'un ent ou autre
if (phpCAS::checkAuthentication()) {
$frm->username=phpCAS::getUser();
// if (phpCAS::getUser()=='esup9992')
// $frm->username='erhar0062';
- $frm->password="passwdCas";
+ $frm->password="passwdCas";
return;
}
-
+
if ($this->config->multiauth) {
$authCAS = optional_param("authCAS");
- if ($authCAS=="NOCAS")
+ if ($authCAS=="NOCAS")
return;
-
+
// choice authentication form for multi-authentication
// test pgtIou parameter for proxy mode (https connection
// in background from CAS server to the php server)
if ($authCAS!="CAS" && !isset($_GET["pgtIou"])) {
- print_header("$site->fullname: $CASform", $site->fullname, $CASform);
+ $navlinks = array();
+ $navlinks[] = array('name' => $CASform, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header("$site->fullname: $CASform", $site->fullname, $navigation);
include($CFG->dirroot."/auth/cas/cas_form.html");
print_footer();
exit();
{phpCAS::forceAuthentication();}
}
/**
- * logout from the cas
+ * logout from the cas
*
* This function is called from admin/auth.php
*
if ($this->config->logoutcas ) {
$backurl = $CFG->wwwroot;
$this->connectCAS();
- phpCAS::logout($backurl);
+ phpCAS::logout($backurl);
}
}
/**
- * Connect to the cas (clientcas connection or proxycas connection
+ * Connect to the cas (clientcas connection or proxycas connection
*
* This function is called from admin/auth.php
*
function process_config($config) {
// set to defaults if undefined
// CAS settings
- if (!isset ($config->hostname))
+ if (!isset ($config->hostname))
$config->hostname = '';
- if (!isset ($config->port))
+ if (!isset ($config->port))
$config->port = '';
- if (!isset ($config->casversion))
+ if (!isset ($config->casversion))
$config->casversion = '';
- if (!isset ($config->baseuri))
+ if (!isset ($config->baseuri))
$config->baseuri = '';
- if (!isset ($config->language))
+ if (!isset ($config->language))
$config->language = '';
- if (!isset ($config->proxycas))
+ if (!isset ($config->proxycas))
$config->proxycas = '';
- if (!isset ($config->logoutcas))
+ if (!isset ($config->logoutcas))
$config->logoutcas = '';
if (!isset ($config->multiauth))
$config->multiauth = '';
return $text;
}
}
-?>
\ No newline at end of file
+?>
if ($notify) {
global $CFG;
$emailconfirm = get_string('emailconfirm');
- print_header($emailconfirm, $emailconfirm, $emailconfirm);
+ $navlinks = array();
+ $navlinks[] = array('name' => $emailconfirm, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header($emailconfirm, $emailconfirm, $navigation);
notice(get_string('emailconfirmsent', '', $user->email), "$CFG->wwwroot/index.php");
} else {
return true;
// create the user object, then you set the password. If you try
// to set the password while creating the user, the operation
// fails.
-
+
// Passwords in Active Directory must be encoded as Unicode
// strings (UCS-2 Little Endian format) and surrounded with
// double quotes. See http://support.microsoft.com/?kbid=269190
if (!function_exists('mb_convert_encoding')) {
print_error ('auth_ldap_no_mbstring', 'auth');
}
-
+
// First create the user account, and mark it as disabled.
$newuser['objectClass'] = array('top','person','user','organizationalPerson');
$newuser['sAMAccountName'] = $extusername;
- $newuser['userAccountControl'] = AUTH_AD_NORMAL_ACCOUNT |
+ $newuser['userAccountControl'] = AUTH_AD_NORMAL_ACCOUNT |
AUTH_AD_ACCOUNTDISABLE;
$userdn = 'cn=' . $this->ldap_addslashes($extusername) .
',' . $this->config->create_context;
if (!ldap_add($ldapconnection, $userdn, $newuser)) {
print_error ('auth_ldap_ad_create_req', 'auth');
}
-
+
// Now set the password
unset($newuser);
$newuser['unicodePwd'] = mb_convert_encoding('"' . $extpassword . '"',
if ($notify) {
global $CFG;
$emailconfirm = get_string('emailconfirm');
- print_header($emailconfirm, $emailconfirm, $emailconfirm);
+ $navlinks = array();
+ $navlinks[] = array('name' => $emailconfirm, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header($emailconfirm, $emailconfirm, $navigation);
notice(get_string('emailconfirmsent', '', $user->email), "$CFG->wwwroot/index.php");
} else {
return true;
$extpassword = mb_convert_encoding('"'.$extpassword.'"', "UCS-2LE", $this->config->ldapencoding);
$result = ldap_modify($ldapconnection, $user_dn, array('unicodePwd' => $extpassword));
if (!$result) {
- error_log('LDAP Error in user_update_password(). Error code: '
+ error_log('LDAP Error in user_update_password(). Error code: '
. ldap_errno($ldapconnection) . '; Error string : '
. ldap_err2str(ldap_errno($ldapconnection)));
}
define ('ROOTDSE', '');
// UF_DONT_EXPIRE_PASSWD value taken from MSDN directly
define ('UF_DONT_EXPIRE_PASSWD', 0x00010000);
-
+
global $CFG;
if (!function_exists('bcsub')) {
// expired or not.
return 0;
}
-
+
$info = $this->ldap_get_entries($ldapconn, $sr);
$useraccountcontrol = $info[0]['userAccountControl'][0];
if ($useraccountcontrol & UF_DONT_EXPIRE_PASSWD) {
// password doesn't expire.
return 0;
}
-
+
// If pwdLastSet is zero, the user must change his/her password now
// (unless UF_DONT_EXPIRE_PASSWD flag is set, but we already
// tested this above)
// password has expired
return -1;
}
-
+
// ----------------------------------------------------------------
// Password expiration time in Active Directory is the composition of
// two values:
// So we need to convert the values to Unix timestamps (see
// details below).
// ----------------------------------------------------------------
-
+
$sr = ldap_read($ldapconn, ROOTDSE, 'objectclass=*',
array('defaultNamingContext'));
if (!$sr) {
error_log("ldap: error querying rootDSE for Active Directory");
return 0;
}
-
+
$info = $this->ldap_get_entries($ldapconn, $sr);
$domaindn = $info[0]['defaultNamingContext'][0];
-
+
$sr = ldap_read ($ldapconn, $domaindn, 'objectclass=*',
array('maxPwdAge'));
$info = $this->ldap_get_entries($ldapconn, $sr);
//
// As a last remark, if the low 32 bits of maxPwdAge are equal to 0,
// the maximum password age in the domain is set to 0, which means
- // passwords do not expire (see
+ // passwords do not expire (see
// http://msdn2.microsoft.com/en-us/library/ms974598.aspx)
//
// As the quantities involved are too big for PHP integers, we
// need to use BCMath functions to work with arbitrary precision
// numbers.
// ----------------------------------------------------------------
-
+
// If the low order 32 bits are 0, then passwords do not expire in
// the domain. Just do '$maxpwdage mod 2^32' and check the result
// time, in MS time units. Remember maxPwdAge is stored as a
// _negative_ quantity, so we need to substract it in fact.
$pwdexpire = bcsub ($pwdlastset, $maxpwdage);
-
+
// Scale the result to convert it to Unix time units and return
// that value.
return bcsub( bcdiv($pwdexpire, '10000000'), '11644473600');
//If no course has been selected, show a list of available courses
+ $navlinks = array();
if (!$id) {
- print_header("$site->shortname: $strcoursebackup", $site->fullname,
- "<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> $strcoursebackup");
+ $navlinks[] = array('name' => $stradministration, 'link' => "$CFG->wwwroot/$CFG->admin/index.php", 'type' => 'misc');
+ $navlinks[] = array('name' => $strcoursebackup, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header("$site->shortname: $strcoursebackup", $site->fullname, $navigation);
if ($courses = get_courses('all','c.shortname','c.id,c.shortname,c.fullname')) {
print_heading(get_string("choosecourse"));
//Print header
if (has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
- print_header("$site->shortname: $strcoursebackup", $site->fullname,
- "<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> ->
- <a href=\"backup.php\">$strcoursebackup</a> -> $course->fullname ($course->shortname)");
+ $navlinks[] = array('name' => $stradministration, 'link' => "$CFG->wwwroot/$CFG->admin/index.php", 'type' => 'misc');
+ $navlinks[] = array('name' => $strcoursebackup, 'link' => 'backup.php', 'type' => 'misc');
+ $navlinks[] = array('name' => "$course->fullname ($course->shortname)", 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header("$site->shortname: $strcoursebackup", $site->fullname, $navigation);
} else {
- print_header("$course->shortname: $strcoursebackup", $course->fullname,
- "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
- $strcoursebackup");
+ $navlinks[] = array('name' => $course->fullname, 'link' => "$CFG->wwwroot/course/view.php?id=$course->id", 'type' => 'misc');
+ $navlinks[] = array('name' => $strcoursebackup, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$course->shortname: $strcoursebackup", $course->fullname, $navigation);
}
//Print form
if (empty($CFG->backup_version)) { // Backup has never been installed.
$strdatabaseupgrades = get_string("databaseupgrades");
- print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, "",
+ $navlinks = array();
+ $navlinks[] = array('name' => $strdatabaseupgrades, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header($strdatabaseupgrades, $strdatabaseupgrades, $navigation, "",
upgrade_get_javascript(), false, " ", " ");
upgrade_log_start();
function backup_todb ($data) {
// MDL-10770
if ($data === '$@NULL@$') {
- return null;
+ return null;
} else {
return restore_decode_absolute_links(addslashes($data));
}
//Decide when to show last execution logs or detailed logs
//Lastlog view
if (!$courseid) {
- print_header("$site->shortname: $strconfiguration: $strbackup", $site->fullname,
- "<a href=\"../$CFG->admin/index.php\">$stradmin</a> -> ".
- "<a href=\"../$CFG->admin/configure.php\">$strconfiguration</a> -> ".
- "<a href=\"../$CFG->admin/backup.php?sesskey=$USER->sesskey\">$strbackup</a> -> ".
- $strlogs);
+ $navlinks = array();
+ $navlinks[] = array('name' => $stradmin, 'link' => "../$CFG->admin/index.php", 'type' => 'misc');
+ $navlinks[] = array('name' => $strconfiguration, 'link' => "../$CFG->admin/configure.php", 'type' => 'misc');
+ $navlinks[] = array('name' => $strbackup, 'link' => "../$CFG->admin/backup.php?sesskey=$USER->sesskey", 'type' => 'misc');
+ $navlinks[] = array('name' => $strlogs, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header("$site->shortname: $strconfiguration: $strbackup", $site->fullname, $navigation);
print_heading($backuploglaststatus);
print_simple_box_start('center');
print_simple_box_end();
//Detailed View !!
} else {
- print_header("$site->shortname: $strconfiguration: $strbackup", $site->fullname,
- "<a href=\"../$CFG->admin/index.php\">$stradmin</a> -> ".
- "<a href=\"../$CFG->admin/configure.php\">$strconfiguration</a> -> ".
- "<a href=\"../$CFG->admin/backup.php?sesskey=$USER->sesskey\">$strbackup</a> -> ".
- "<a href=\"log.php\">$strlogs</a> -> ".
- $strbackupdetails);
+ $navlinks = array();
+ $navlinks[] = array('name' => $stradmin, 'link' => "../$CFG->admin/index.php", 'type' => 'misc');
+ $navlinks[] = array('name' => $strconfiguration, 'link' => "../$CFG->admin/configure.php", 'type' => 'misc');
+ $navlinks[] = array('name' => $strbackup, 'link' => "../$CFG->admin/backup.php?sesskey=$USER->sesskey", 'type' => 'misc');
+ $navlinks[] = array('name' => $strlogs, 'link' => 'log.php', 'type' => 'misc');
+ $navlinks[] = array('name' => $strbackupdetails, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header("$site->shortname: $strconfiguration: $strbackup", $site->fullname, $navigation);
print_heading($backuplogdetailed);
print_heading("$strcourse: $coursename");
print_simple_box_start('center');
-
+
//First, me get all the distinct backups for that course in backup_log
$executions = get_records_sql("SELECT DISTINCT laststarttime,laststarttime
FROM {$CFG->prefix}backup_log
print_simple_box("<center>".userdate($execution->laststarttime)."</center>", "center");
echo "</td>";
echo "</tr>";
- $logs = get_records_sql("SELECT *
+ $logs = get_records_sql("SELECT *
FROM {$CFG->prefix}backup_log
WHERE courseid = '$courseid' AND
laststarttime = '$execution->laststarttime'
$method = optional_param( 'method' );
$backup_unique_code = optional_param('backup_unique_code',0,PARAM_INT);
- //Check login
+ //Check login
require_login();
/// With method=manual, we come from the FileManager so we delete all the backup/restore/import session structures
//Check necessary functions exists. Thanks to gregb@crowncollege.edu
backup_required_functions();
-
+
//Check backup_version
if ($file) {
$linkto = "restore.php?id=".$id."&file=".$file;
$stradministration = get_string("administration");
//If no file has been selected from the FileManager, inform and end
+ $navlinks = array();
+ $navlinks[] = array('name' => $stradministration, 'link' => "$CFG->wwwroot/$CFG->admin/index.php", 'type' => 'misc');
+ $navlinks[] = array('name' => $strcourserestore, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
if (!$file) {
- print_header("$site->shortname: $strcourserestore", $site->fullname,
- "<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> $strcourserestore");
+ print_header("$site->shortname: $strcourserestore", $site->fullname, $navigation);
print_heading(get_string("nofilesselected"));
print_continue("$CFG->wwwroot/$CFG->admin/index.php");
print_footer();
//If cancel has been selected, inform and end
if ($cancel) {
- print_header("$site->shortname: $strcourserestore", $site->fullname,
- "<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> $strcourserestore");
+ print_header("$site->shortname: $strcourserestore", $site->fullname, $navigation);
print_heading(get_string("restorecancelled"));
print_continue("$CFG->wwwroot/$CFG->admin/index.php");
print_footer();
//Print header
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
- print_header("$site->shortname: $strcourserestore", $site->fullname,
- "<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> ->
- $strcourserestore -> ".basename($file));
+ $navlinks[] = array('name' => basename($file), 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header("$site->shortname: $strcourserestore", $site->fullname, $navigation);
} else {
- print_header("$course->shortname: $strcourserestore", $course->fullname,
- "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
- $strcourserestore");
+ $navlinks = array();
+ $navlinks[] = array('name' => $course->shortname, 'link' => "$CFG->wwwroot/course/view.php?id=$course->id", 'type' => 'misc');
+ $navlinks[] = array('name' => $strcourserestore, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$course->shortname: $strcourserestore", $course->fullname, $navigation);
}
//Print form
print_heading("$strcourserestore".((empty($to) ? ': '.basename($file) : '')));
print_simple_box_start('center');
-
+
//Adjust some php variables to the execution of this script
@ini_set("max_execution_time","3000");
raise_memory_limit("192M");
include_once("restore_check.html");
//To avoid multiple restore executions...
$SESSION->cancontinue = true;
- } else if ($launch == "execute") {
+ } else if ($launch == "execute") {
//Prevent multiple restore executions...
if (empty($SESSION->cancontinue)) {
error("Multiple restore execution not allowed!");
}
print_simple_box_end();
- //Print footer
+ //Print footer
print_footer();
?>
if (!$user = get_record('user', 'id', $userid)) {
error('Incorrect user id');
}
+$navlinks = array();
+$navlinks[] = array('name' => fullname($user), 'link' => "$CFG->wwwroot/user/view.php?id=$userid", 'type' => 'misc');
+$navlinks[] = array('name' => $strblogs, 'link' => "$CFG->wwwroot/blog/index.php?userid=$userid", 'type' => 'misc');
+$navlinks[] = array('name' => $strformheading, 'link' => null, 'type' => 'misc');
+$navigation = build_navigation($navlinks);
-print_header("$SITE->shortname: $strblogs", $SITE->fullname,
- '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$userid.'">'.fullname($user).'</a> ->
- <a href="'.$CFG->wwwroot.'/blog/index.php?userid='.$userid.'">'.$strblogs.'</a> -> '.$strformheading,'','',true);
+print_header("$SITE->shortname: $strblogs", $SITE->fullname, $navigation,'','',true);
$blogeditform->set_data($post);
$blogeditform->display();
$status = delete_records('post', 'id', $post->id);
$status = delete_records('blog_tag_instance', 'entryid', $post->id) and $status;
-
+
blog_delete_old_attachments($post);
-
+
add_to_log(SITEID, 'blog', 'delete', 'index.php?userid='. $post->userid, 'deleted blog entry with entry id# '. $post->id);
if (!$status) {
}
}
}
-?>
\ No newline at end of file
+?>
$mform->setAdvanced('otagsgrp');
}
- $mform->addElement('textarea', 'ptags', get_string('ptags', 'blog'), array('wrap'=>'soft'));
+ $mform->addElement('textarea', 'ptags', get_string('ptags', 'blog'), array('cols'=>'40', 'rows'=>'5'));
$mform->setType('ptagsadd', PARAM_NOTAGS);
$this->add_action_buttons();
$otagsselect->removeOptions();
if ($otags = get_records_sql_menu('SELECT id, text from '.$CFG->prefix.'tags WHERE type=\'official\' ORDER by text ASC')){
$otagsselect->loadArray($otags);
+ } else {
+ $mform->removeElement('otags');
}
}
define('BLOCK_L_MAX_WIDTH', $lmax);
define('BLOCK_R_MIN_WIDTH', $rmin);
define('BLOCK_R_MAX_WIDTH', $rmax);
-
+
//_____________ new page class code ________
$pagetype = PAGE_BLOG_VIEW;
$pageclass = 'page_blog';
error('Wrong course id');
}
+$navlinks = array();
/// This is very messy atm.
switch ($filtertype) {
case 'site':
if ($tagid || !empty($tag)) {
- print_header("$SITE->shortname: $blogstring", $SITE->fullname,
- '<a href="index.php?filtertype=site">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
+ $navlinks[] = array('name' => $blogstring, 'link' => "index.php?filtertype=site", 'type' => 'misc');
+ $navlinks[] = array('name' => "$tagstring: $taginstance->text", 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$SITE->shortname: $blogstring", $SITE->fullname, $navigation,'','',true,$PAGE->get_extra_header_string());
} else {
- print_header("$SITE->shortname: $blogstring", $SITE->fullname,
- $blogstring,'','',true,$PAGE->get_extra_header_string());
+ $navlinks[] = array('name' => $blogstring, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$SITE->shortname: $blogstring", $SITE->fullname, $navigation,'','',true,$PAGE->get_extra_header_string());
}
break;
case 'course':
if ($tagid || !empty($tag)) {
- print_header("$course->shortname: $blogstring", $course->fullname,
- '<a href="index.php?filtertype=course&filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
+ $navlinks[] = array('name' => $blogstring,
+ 'link' => "index.php?filtertype=course&filterselect=$filterselect",
+ 'type' => 'misc');
+ $navlinks[] = array('name' => "$tagstring: $taginstance->text", 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$course->shortname: $blogstring", $course->fullname, $navigation,'','',true,$PAGE->get_extra_header_string());
} else {
- print_header("$course->shortname: $blogstring", $course->fullname,
- $blogstring,'','',true,$PAGE->get_extra_header_string());
+ $navlinks[] = array('name' => $blogstring, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$course->shortname: $blogstring", $course->fullname, $navigation,'','',true,$PAGE->get_extra_header_string());
}
break;
if ($thisgroup = groups_get_group($filterselect, false)) { //TODO:
if ($tagid || !empty($tag)) {
- print_header("$course->shortname: $blogstring", $course->fullname,
- '<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&group='.$filterselect.'">'.$thisgroup->name.'</a> ->
- <a href="index.php?filtertype=group&filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
+ $navlinks[] = array('name' => $thisgroup->name,
+ 'link' => "$CFG->wwwroot/user/index.php?id=$course->id&group=$filterselect",
+ 'type' => 'misc');
+ $navlinks[] = array('name' => $blogstring,
+ 'link' => "index.php?filtertype=group&filterselect=$filterselect",
+ 'type' => 'misc');
+ $navlinks[] = array('name' => "$tagstring: $taginstance->text", 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$course->shortname: $blogstring", $course->fullname, $navigation,'','',true,$PAGE->get_extra_header_string());
} else {
- print_header("$course->shortname: $blogstring", $course->fullname,
- '<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&group='.$filterselect.'">'.$thisgroup->name."</a> ->
- $blogstring",'','',true,$PAGE->get_extra_header_string());
+ $navlinks[] = array('name' => $thisgroup->name,
+ 'link' => "$CFG->wwwroot/user/index.php?id=$course->id&group=$filterselect",
+ 'type' => 'misc');
+ $navlinks[] = array('name' => $blogstring, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$course->shortname: $blogstring", $course->fullname, $navigation,'','',true,$PAGE->get_extra_header_string());
}
} else {
print_error('Unable to find group');
if ($course->id != SITEID) {
if ($tagid || !empty($tag)) {
- print_header("$course->shortname: $blogstring", $course->fullname,
- '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->
- <a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'">'.$participants.'</a> ->
- <a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'&course='.$course->id.'">'.fullname($user).'</a> ->
- <a href="index.php?courseid='.$course->id.'&filtertype=user&filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
+ $navlinks[] = array('name' => $course->shortname,
+ 'link' => "$CFG->wwwroot/course/view.php?id=$course->id",
+ 'type' => 'misc');
+ $navlinks[] = array('name' => $participants,
+ 'link' => "$CFG->wwwroot/user/index.php?id=$course->id",
+ 'type' => 'misc');
+ $navlinks[] = array('name' => fullname($user),
+ 'link' => "$CFG->wwwroot/user/view.php?id=$filterselect&course=$course->id",
+ 'type' => 'misc');
+ $navlinks[] = array('name' => $blogstring,
+ 'link' => "index.php?courseid=$course->id&filtertype=user&filterselect=$filterselect",
+ 'type' => 'misc');
+ $navlinks[] = array('name' => "$tagstring: $taginstance->text", 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header("$course->shortname: $blogstring", $course->fullname, $navigation,'','',true,$PAGE->get_extra_header_string());
} else {
+ $navlinks[] = array('name' => $course->shortname,
+ 'link' => "$CFG->wwwroot/course/view.php?id=$course->id",
+ 'type' => 'misc');
+ $navlinks[] = array('name' => $participants,
+ 'link' => "$CFG->wwwroot/user/index.php?id=$course->id",
+ 'type' => 'misc');
+ $navlinks[] = array('name' => fullname($user),
+ 'link' => "$CFG->wwwroot/user/view.php?id=$filterselect&course=$course->id",
+ 'type' => 'misc');
+ $navlinks[] = array('name' => $blogstring, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
print_header("$course->shortname: $blogstring", $course->fullname,
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->
<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'">'.$participants.'</a> ->
//in top view
if ($tagid || !empty($tag)) {
- print_header("$SITE->shortname: $blogstring", $SITE->fullname,
- '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'">'.fullname($user).'</a> ->
- <a href="index.php?filtertype=user&filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
+ $navlinks[] = array('name' => fullname($user),
+ 'link' => "$CFG->wwwroot/user/view.php?id=$filterselect",
+ 'type' => 'misc');
+ $navlinks[] = array('name' => $blogstring,
+ 'link' => "index.php?filtertype=user&filterselect=$filterselect",
+ 'type' => 'misc');
+ $navlinks[] = array('name' => "$tagstring: $taginstance->text", 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header("$SITE->shortname: $blogstring", $SITE->fullname, $navigation,'','',true,$PAGE->get_extra_header_string());
} else {
- print_header("$SITE->shortname: $blogstring", $SITE->fullname,
- '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'">'.fullname($user).'</a> ->
- '.$blogstring,'','',true,$PAGE->get_extra_header_string());
+ $navlinks[] = array('name' => fullname($user),
+ 'link' => "$CFG->wwwroot/user/view.php?id=$filterselect",
+ 'type' => 'misc');
+ $navlinks[] = array('name' => $blogstring, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$SITE->shortname: $blogstring", $SITE->fullname, $navigation,'','',true,$PAGE->get_extra_header_string());
}
calendar_session_vars();
$now = usergetdate(time());
- $nav = calendar_get_link_tag($strcalendar, CALENDAR_URL.'view.php?view=upcoming&course='.$urlcourse.'&', $now['mday'], $now['mon'], $now['year']);
+ $navlinks = array();
+ $calendar_navlink = array('name' => $strcalendar,
+ 'link' =>calendar_get_link_href(CALENDAR_URL.'view.php?view=upcoming&course='.$urlcourse.'&',
+ $now['mday'], $now['mon'], $now['year']),
+ 'type' => 'misc');
+
$day = intval($now['mday']);
$mon = intval($now['mon']);
$yr = intval($now['year']);
'timestart = '.$timestartoffset.','.
'timeduration = '.$form->timeduration.','.
'timemodified = '.time().' WHERE repeatid = '.$event->repeatid);
-
+
/// Log the event update.
$form->name = stripslashes($form->name); //To avoid double-slashes
add_to_log($form->courseid, 'calendar', 'edit all', 'event.php?action=edit&id='.$form->id, $form->name);
// Update this
$form->timemodified = time();
update_record('event', $form);
-
+
/// Log the event update.
$form->name = stripslashes($form->name); //To avoid double-slashes
add_to_log($form->courseid, 'calendar', 'edit', 'event.php?action=edit&id='.$form->id, $form->name);
break;
}
- // Let's see if we are supposed to provide a referring course link
- // but NOT for the "main page" course
- if($SESSION->cal_course_referer != SITEID &&
- ($shortname = get_field('course', 'shortname', 'id', $SESSION->cal_course_referer)) !== false) {
- // If we know about the referring course, show a return link
- $nav = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$SESSION->cal_course_referer.'">'.$shortname.'</a> -> '.$nav;
- }
if (!empty($SESSION->cal_course_referer)) {
// TODO: This is part of the Great $course Hack in Moodle. Replace it at some point.
}
require_login($course, false);
- print_header($site->shortname.': '.$strcalendar.': '.$title, $strcalendar, $nav.' -> '.$title,
+ $navlinks[] = $calendar_navlink;
+ $navlinks[] = array('name' => $title, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header($site->shortname.': '.$strcalendar.': '.$title, $strcalendar, $navigation,
'eventform.name', '', true, '', user_login_string($site));
echo calendar_overlib_html();
else {
$repeatcount = 0;
}
-
+
// Display confirmation form
echo '<div class="header">'.get_string('deleteevent', 'calendar').': '.$event->name.'</div>';
echo '<h2>'.get_string('confirmeventdelete', 'calendar').'</h2>';
calendar_set_filters($courses, $groups, $users, $defaultcourses, $defaultcourses);
list($prevmon, $prevyr) = calendar_sub_month($mon, $yr);
list($nextmon, $nextyr) = calendar_add_month($mon, $yr);
-
+
echo '<td class="sidecalendar">';
echo '<div class="sideblock">';
echo '<div class="header">'.get_string('eventskey', 'calendar').'</div>';
echo calendar_filter_controls('event', 'action='.$action.'&type='.$eventtype.'&id='.$eventid);
echo '</div>';
echo '</div>';
-
+
echo '<div class="sideblock">';
echo '<div class="header">'.get_string('monthlyview', 'calendar').'</div>';
echo '<div class="minicalendarblock minicalendartop">';
// can not be using guest account
if (empty($USER->id) or $USER->username == 'guest') {
- return false;
+ return false;
}
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
case 'group':
if (! groups_group_exists($event->groupid)) { //TODO:check.
return false;
- }
- // this is ok because if you have this capability at course level, you should be able
+ }
+ // this is ok because if you have this capability at course level, you should be able
// to edit group calendar too
// there is no need to check membership, because if you have this capability
// you will have a role in this group context
<form method="post" action="event.php">
-<table class="formtable">
- <tr>
- <td>
- <?php if(!empty($allowed->user)) { ?><div><input type='radio' name='type' value='user' id='type_user' checked='checked' /><label for='type_user'><?php print_string('typeuser', 'calendar') ?></label></div>
- <?php } ?>
- <?php if(!empty($allowed->groups)) { ?><div><input type='radio' name='type' value='group' id='type_group' /><label for='type_group'><?php echo get_string('typegroup', 'calendar').' '.get_string('groupfor'); ?></label>
- <select name='groupid'>
- <option value=''></option>
+ <table class="formtable">
+ <tr>
+ <td>
+
+<?php if(!empty($allowed->user)) { ?>
+ <div>
+ <input type='radio' name='type' value='user' id='type_user' checked='checked' />
+ <label for='type_user'><?php print_string('typeuser', 'calendar') ?></label>
+ </div>
+<?php } ?>
+
+<?php if(!empty($allowed->groups) && is_array($allowed->groups)) { ?>
+ <div>
+ <input type='radio' name='type' value='group' id='type_group' />
+ <label for='type_group'><?php echo get_string('typegroup', 'calendar').' '.get_string('groupfor'); ?></label>
+ <select name='groupid'>
+ <option value=''></option>
<?php foreach($allowed->groups as $group) {?>
- <option value='<?php echo $group->id; ?>' <?php if($group->id == $groupid) echo 'selected="selected"';?>><?php echo $group->name; ?></option>
+ <option value='<?php echo $group->id; ?>'
+ <?php if($group->id == $groupid) {
+ echo 'selected="selected"';
+ }
+ echo '>' . $group->name; ?></option>
<?php }?>
- </select>
- </div>
- <?php } ?>
- <?php if(!empty($allowed->courses)) { ?>
- <div><input type='radio' name='type' value='course' id='type_course' /><input type="hidden" name="courseid" value="<?php echo($courseid) ?>" /><label for='type_course'><?php print_string('typecourse', 'calendar') ?></label></div>
- <?php } ?>
- <?php if(!empty($allowed->site)) { ?>
- <div><input type='radio' name='type' value='site' id='type_site' /><label for='type_site'><?php print_string('typesite', 'calendar') ?></label></div>
- <?php } ?>
- </td>
- </tr>
- <tr>
- <td style="text-align: center;">
- <input type="submit" value=" <?php print_string('ok') ?> " />
- <input type="button" onclick="document.location.href='view.php?view=upcoming';" value=" <?php print_string('cancel') ?> " />
- </td>
- </tr>
-</table>
-<p>
-<input type="hidden" name="action" value="new" />
-<input type="hidden" name="timestart" value="<?php echo $form->timestart; ?>" />
-<input type="hidden" name="course" value="<?php p($urlcourse); ?>" />
-</p>
-</form>
\ No newline at end of file
+ </select>
+ </div>
+<?php } ?>
+
+<?php if(!empty($allowed->courses)) { ?>
+ <div>
+ <input type='radio' name='type' value='course' id='type_course' />
+ <input type="hidden" name="courseid" value="<?php echo($courseid) ?>" />
+ <label for='type_course'><?php print_string('typecourse', 'calendar') ?></label>
+ </div>
+<?php } ?>
+
+<?php if(!empty($allowed->site)) { ?>
+ <div>
+ <input type='radio' name='type' value='site' id='type_site' />
+ <label for='type_site'><?php print_string('typesite', 'calendar') ?></label>
+ </div>
+<?php } ?>
+ </td>
+ </tr>
+ <tr>
+ <td style="text-align: center;">
+ <input type="submit" value=" <?php print_string('ok') ?> " />
+ <input type="button" onclick="document.location.href='view.php?view=upcoming';" value=" <?php print_string('cancel') ?> " />
+ </td>
+ </tr>
+ </table>
+ <p>
+ <input type="hidden" name="action" value="new" />
+ <input type="hidden" name="timestart" value="<?php echo $form->timestart; ?>" />
+ <input type="hidden" name="course" value="<?php p($urlcourse); ?>" />
+ </p>
+</form>
calendar_session_vars();
$pagetitle = get_string('export', 'calendar');
+$navlinks = array();
$now = usergetdate(time());
-$nav = calendar_get_link_tag(get_string('calendar', 'calendar'), CALENDAR_URL.'view.php?view=upcoming&course='.$course.'&', $now['mday'], $now['mon'], $now['year']).' -> '.$pagetitle;
+
+$navlinks[] = array('name' => get_string('calendar', 'calendar'),
+ 'link' =>calendar_get_link_href(CALENDAR_URL.'view.php?view=upcoming&course='.$course.'&',
+ $now['mday'], $now['mon'], $now['year']),
+ 'type' => 'misc');
+$navlinks[] = array('name' => $pagetitle, 'link' => null, 'type' => 'misc');
+$navigation = build_navigation($navlinks);
if(!checkdate($mon, $day, $yr)) {
$day = intval($now['mday']);
$prefsbutton = calendar_preferences_button();
// Print title and header
-print_header("$site->shortname: $strcalendar: $pagetitle", $strcalendar, $nav,
+print_header("$site->shortname: $strcalendar: $pagetitle", $strcalendar, $navigation,
'', '', true, $prefsbutton, user_login_string($site));
echo calendar_overlib_html();
<fieldset>
<legend><?php print_string('commontasks', 'calendar'); ?></legend>
<form method="get" action="export_execute.php">
-<?php print_string('iwanttoexport', 'calendar'); ?>:
+<div><?php print_string('iwanttoexport', 'calendar'); ?>:</div>
<div class="indent">
<input type="radio" name="preset_what" id="pw_all" value="all" checked="checked"/><label for="pw_all"><?php print_string('eventsall', 'calendar'); ?></label><br />
<input type="radio" name="preset_what" id="pw_course" value="courses" /><label for="pw_course"><?php print_string('eventsrelatedtocourses', 'calendar'); ?></label><br />
</div>
-<?php print_string('for', 'calendar'); ?>:
+<div><?php print_string('for', 'calendar'); ?>:</div>
<div class="indent">
<?php if($allowthisweek) { ?>
<input type="radio" name="preset_time" id="pt_wknow" value="weeknow" checked="checked"/><label for="pt_wknow"><?php print_string('weekthis', 'calendar'); ?></label><br />
} else {
preset_what = "all";
}
-
+
if (<?php echo (int) $allowthisweek; ?> && document.getElementById("pt_wknow").checked) {
preset_time = "weeknow";
} else if (<?php echo (int) $allownextweek; ?> && document.getElementById("pt_wknext").checked) {
} else {
preset_time = "recentupcoming";
}
-
+
url = "<?php echo $CFG->wwwroot; ?>/calendar/export_execute.php?preset_what=" + preset_what + "&preset_time=" + preset_time + "&username=<?php echo $usernameencoded; ?>&authtoken=<?php echo $authtoken; ?>";
document.getElementById("url").innerText = url;
document.getElementById("url").innerHTML = url; //Need this as well, for Firefox
-
+
document.getElementById("urlbox").style.display = "block";
}
//]]>
// Fetch the correct values from admin settings/lang pack
// If no such settings found, use the above defaults
$firstday = isset($CFG->calendar_startwday) ? $CFG->calendar_startwday : get_string('firstdayofweek');
-if(!is_numeric($firstday)) {
+if(!is_numeric($firstday)) {
define ('CALENDAR_STARTING_WEEKDAY', CALENDAR_DEFAULT_STARTING_WEEKDAY);
}
else {
}
$popupcontent .= '<div><img class="icon" src="'.$popupicon.'" alt="'.$popupalt.'" /><a href="'.$dayhref.'#event_'.$event->id.'">'.format_string($event->name, true).'</a></div>';
}
-
+
//Accessibility: functionality moved to calendar_get_popup.
if($display->thismonth && $day == $d) {
$popup = calendar_get_popup(true, $events[$eventid]->timestart, $popupcontent);
} else {
$popup = calendar_get_popup(false, $events[$eventid]->timestart, $popupcontent);
- }
+ }
// Class and cell content
if(isset($typesbyday[$day]['startglobal'])) {
if($display->thismonth && $day == $d) {
$class .= ' today';
$today = get_string('today', 'calendar').' '.userdate(time(), get_string('strftimedayshort'));
-
+
if(! isset($eventsbyday[$day])) {
$class .= ' eventnone';
$popup = calendar_get_popup(true, false);
* @param $is_today bool, false except when called on the current day.
* @param $event_timestart mixed, $events[$eventid]->timestart, OR false if there are no events.
* @param $popupcontent string.
- * @return $popup string, contains onmousover and onmouseout events.
+ * @return $popup string, contains onmousover and onmouseout events.
*/
function calendar_get_popup($is_today, $event_timestart, $popupcontent='') {
$popupcaption = '';
$popupcaption .= get_string('eventsfor', 'calendar', userdate($event_timestart, get_string('strftimedayshort')));
}
$popupcontent = str_replace("'", "\'", htmlspecialchars($popupcontent));
- $popupcaption = str_replace("'", "\'", htmlspecialchars($popupcaption));
+ $popupcaption = str_replace("'", "\'", htmlspecialchars($popupcaption));
$popup = 'onmouseover="return overlib(\''.$popupcontent.'\', CAPTION, \''.$popupcaption.'\');" onmouseout="return nd();"';
return $popup;
}
function calendar_add_event_metadata($event) {
global $CFG;
- //Support multilang in event->name
+ //Support multilang in event->name
$event->name = format_string($event->name,true);
-
+
if(!empty($event->modulename)) { // Activity event
// The module name is set. I will assume that it has to be displayed, and
// also that it is an automatically-generated event. And of course that the
$event->cssclass = 'event_user';
}
return $event;
-}
+}
function calendar_print_event($event) {
global $CFG, $USER;
$time = make_timestamp($data['y'], $data['m'], $data['d']);
}
$date = usergetdate($time);
-
+
$data['m'] = $date['mon'];
$data['y'] = $date['year'];
$nextname = calendar_wday_name($CALENDARDAYS[$nextdate['wday']]);
$content .= "\n".'<div class="calendar-controls">';
$content .= calendar_get_link_previous($prevname, 'view.php?view=day'.$courseid.'&', $prevdate['mday'], $prevdate['mon'], $prevdate['year']);
-
+
// Get the format string
$text = get_string('strftimedaydate');
/*
$groupevents = true;
$getvars = '';
-
+
$id = optional_param( 'id',0,PARAM_INT );
switch($type) {
}
if ($n) {
-
+
$content .= $tr;
$tr = $tr ? '' : "</tr>\n<tr>";
-
+
if ($n < 2) {
$strcourse = get_string('course', 'calendar');
} else {
return userdate($time, empty($timeformat) ? $langtimeformat : $timeformat);
}
+/**
+ * TODO document
+ */
function calendar_get_link_href($linkbase, $d, $m, $y) {
if(empty($linkbase)) return '';
$paramstr = '';
return $linkbase.$paramstr;
}
+/**
+ * TODO document
+ */
function calendar_get_link_tag($text, $linkbase, $d, $m, $y) {
$href = calendar_get_link_href($linkbase, $d, $m, $y);
if(empty($href)) return $text;
else {
$courses = false;
}
- //BUG 6130 clean $courses array as SESSION has bad entries.
+ //BUG 6130 clean $courses array as SESSION has bad entries.
// [pj] TODO: See if this has to do with my new change in get_default_courses and can be taken out
if (is_array($courses)) {
foreach ($courses as $index => $value) {
}
}
}
-
+
if (!empty($groupids)) {
- $sql = "SELECT id
+ $sql = "SELECT id
FROM {$CFG->prefix}groups
WHERE courseid IN (".implode(',', $groupids).')';
-
+
if ($grouprecords= get_records_sql($sql)) {
$grouparray = array_merge($grouparray, array_keys($grouprecords));
}
}
-
+
if(empty($grouparray)) {
$group = false;
}
$group = $grouparray;
}
}
-
+
}
else {
$group = false;
}
function calendar_edit_event_allowed($event) {
-
+
global $USER;
// can not be using guest account
if ($USER->username == "guest") {
- return false;
+ return false;
}
-
+
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
// if user has manageentries at site level, return true
if (has_capability('moodle/calendar:manageentries', $sitecontext)) {
return true;
}
-
+
// if groupid is set, it's definitely a group event
if ($event->groupid) {
//TODO:check.
if (! groups_group_exists($event->groupid)) {
return false;
- }
-
- // this is ok because if you have this capability at course level, you should be able
+ }
+
+ // this is ok because if you have this capability at course level, you should be able
// to edit group calendar too
// there is no need to check membership, because if you have this capability
// you will have a role in this group context
- return has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_GROUP, $event->groupid));
+ return has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_GROUP, $event->groupid));
} else if ($event->courseid) {
// if groupid is not set, but course is set,
// it's definiely a course event
- return has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_COURSE, $event->courseid));
- } else if ($event->userid && $event->userid == $USER->id) {
+ return has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_COURSE, $event->courseid));
+ } else if ($event->userid && $event->userid == $USER->id) {
// if course is not set, but userid id set, it's a user event
return (has_capability('moodle/calendar:manageownentries', $sitecontext));
- }
+ }
return false;
}
return $courses;
}
}
-
+
if (isset($CFG->adminseesall)) {
$courses = get_my_courses($USER->id, null, null, $CFG->adminseesall);
}
}
function calendar_print_month_selector($name, $selected) {
-
+
$months = array();
for ($i=1; $i<=12; $i++) {
$SESSION->cal_show_global = ($packed_bitfield & 1);
$SESSION->cal_show_course = ($packed_bitfield & 2);
- $SESSION->cal_show_groups = ($packed_bitfield & 4);
+ $SESSION->cal_show_groups = ($packed_bitfield & 4);
$SESSION->cal_show_user = ($packed_bitfield & 8);
return true;
*/
function calendar_user_can_add_event() {
calendar_get_allowed_types($allowed);
- return (bool)($allowed->user || $allowed->groups || $allowed->courses || $allowed->site);
+ return (bool)($allowed->user || $allowed->groups || $allowed->courses || $allowed->site);
}
?>
$now = usergetdate(time());
$pagetitle = '';
- $nav = calendar_get_link_tag(get_string('calendar', 'calendar'), CALENDAR_URL.'view.php?view=upcoming&course='.$courseid.'&', $now['mday'], $now['mon'], $now['year']);
+ $strcalendar = get_string('calendar', 'calendar');
+ $navlinks = array();
+ $navlinks[] = array('name' => $strcalendar,
+ 'link' =>calendar_get_link_href(CALENDAR_URL.'view.php?view=upcoming&course='.$courseid.'&',
+ $now['mday'], $now['mon'], $now['year']),
+ 'type' => 'misc');
+
-
if(!checkdate($mon, $day, $yr)) {
$day = intval($now['mday']);
$mon = intval($now['mon']);
switch($view) {
case 'day':
- $nav .= ' -> '.userdate($time, get_string('strftimedate'));
+ $navlinks[] = array('name' => userdate($time, get_string('strftimedate')), 'link' => null, 'type' => 'misc');
$pagetitle = get_string('dayview', 'calendar');
break;
case 'month':
- $nav .= ' -> '.userdate($time, get_string('strftimemonthyear'));
+ $navlinks[] = array('name' => userdate($time, get_string('strftimemonthyear')), 'link' => null, 'type' => 'misc');
$pagetitle = get_string('detailedmonthview', 'calendar');
break;
case 'upcoming':
// but NOT for the "main page" course
if ($SESSION->cal_course_referer != SITEID &&
($shortname = get_field('course', 'shortname', 'id', $SESSION->cal_course_referer)) !== false) {
- // If we know about the referring course, show a return link and ALSO require login!
require_login();
- $nav = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$SESSION->cal_course_referer.'">'.$shortname.'</a> -> '.$nav;
if (empty($course)) {
$course = get_record('course', 'id', $SESSION->cal_course_referer); // Useful to have around
}
$prefsbutton = calendar_preferences_button();
// Print title and header
- print_header("$site->shortname: $strcalendar: $pagetitle", $strcalendar, $nav,
+ $navigation = build_navigation($navlinks);
+ print_header("$site->shortname: $strcalendar: $pagetitle", $strcalendar, $navigation,
'', '', true, $prefsbutton, user_login_string($site));
echo calendar_overlib_html();
if (!$site = get_site()) {
error("Site isn't defined!");
}
-
+
$context = get_context_instance(CONTEXT_COURSECAT, $id);
-
+
if ($CFG->forcelogin) {
require_login();
}
$strcategory = get_string("category");
$strcourses = get_string("courses");
+ $navlinks = array();
+ $navlinks[] = array('name' => $strcategories, 'link' => 'index.php', 'type' => 'misc');
+ $navlinks[] = array('name' => $category->name, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
if ($creatorediting) {
if ($adminediting) {
// modify this to treat this as an admin page
admin_externalpage_setup('coursemgmt');
admin_externalpage_print_header();
} else {
- print_header("$site->shortname: $category->name", "$site->fullname: $strcourses",
- "<a href=\"index.php\">$strcategories</a> -> $category->name", "", "", true, $navbaritem);
+ print_header("$site->shortname: $category->name", "$site->fullname: $strcourses", $navigation, "", "", true, $navbaritem);
}
} else {
- print_header("$site->shortname: $category->name", "$site->fullname: $strcourses",
- "<a href=\"index.php\">$strcategories</a> -> $category->name", "", "", true, $navbaritem);
+ print_header("$site->shortname: $category->name", "$site->fullname: $strcourses", $navigation, "", "", true, $navbaritem);
}
/// Print button to turn editing off
/// Print link to roles
- if (has_capability('moodle/role:assign', $context)) {
+ if (has_capability('moodle/role:assign', $context)) {
echo '<div class="rolelink"><a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.
$context->id.'">'.get_string('assignroles','role').'</a></div>';
}
// user must have category update in both cats to perform this
require_capability('moodle/category:update', $context);
- require_capability('moodle/category:update', get_context_instance(CONTEXT_COURSECAT, $moveto));
-
+ require_capability('moodle/category:update', get_context_instance(CONTEXT_COURSECAT, $moveto));
+
if (! $destcategory = get_record("course_categories", "id", $data->moveto)) {
error("Error finding the category");
}
-
- $courses = array();
+
+ $courses = array();
foreach ( $data as $key => $value ) {
if (preg_match('/^c\d+$/', $key)) {
array_push($courses, substr($key, 1));
}
- }
+ }
move_courses($courses, $data->moveto);
}
}
/// print option to add a subcategory
- if (has_capability('moodle/category:create', $context)) {
+ if (has_capability('moodle/category:create', $context)) {
$cat->id = $id;
- $mform->set_data($cat);
+ $mform->set_data($cat);
$mform->display();
}
}
foreach ($courses as $acourse) {
-
+
$coursecontext = get_context_instance(CONTEXT_COURSE, $acourse->id);
-
+
$count++;
$up = ($count > 1 || !$atfirstpage);
$down = ($count < $numcourses || !$atlastpage);
echo '<a title="'.$strsettings.'" href="'.$CFG->wwwroot.'/course/edit.php?id='.
$acourse->id.'">'.
'<img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'.$stredit.'" /></a> '; }
-
- // role assignment link
- if (has_capability('moodle/role:assign', $coursecontext)) {
+
+ // role assignment link
+ if (has_capability('moodle/role:assign', $coursecontext)) {
echo'<a title="'.get_string('assignroles', 'role').'" href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$coursecontext->id.'"><img src="'.$CFG->pixpath.'/i/roles.gif" class="iconsmall" alt="'.get_string('assignroles', 'role').'" /></a>';
- }
-
+ }
+
if (can_delete_course($acourse->id)) {
echo '<a title="'.$strdelete.'" href="delete.php?id='.$acourse->id.'">'.
'<img src="'.$CFG->pixpath.'/t/delete.gif" class="iconsmall" alt="'.$strdelete.'" /></a> ';
echo '<a title="'.$strbackup.'" href="../backup/backup.php?id='.$acourse->id.'">'.
'<img src="'.$CFG->pixpath.'/t/backup.gif" class="iconsmall" alt="'.$strbackup.'" /></a> ';
}
-
+
if (has_capability('moodle/site:restore', $coursecontext)) {
echo '<a title="'.$strrestore.'" href="../files/index.php?id='.$acourse->id.
'&wdir=/backupdata">'.
}
$abletomovecourses = true;
}
-
+
echo '</td>';
echo '<td align="center">';
echo '<input type="checkbox" name="c'.$acourse->id.'" />';
- echo '</td>';
+ echo '</td>';
} else {
echo '<td align="right">';
if (!empty($acourse->guest)) {
if ($abletomovecourses) {
echo '<tr><td colspan="3" align="right">';
- echo '<br />';
+ echo '<br />';
unset($displaylist[$category->id]);
// loop and unset categories the user can't move into
-
+
foreach ($displaylist as $did=>$dlist) {
if (!has_capability('moodle/category:update', get_context_instance(CONTEXT_COURSECAT, $did))) {
- unset($displaylist[$did]);
+ unset($displaylist[$did]);
}
}
-
+
choose_from_menu ($displaylist, "moveto", "", get_string("moveselectedcoursesto"), "javascript: submitFormById('movecourses')");
echo '<input type="hidden" name="id" value="'.$category->id.'" />';
echo '</td></tr>';
echo '</div></form>';
echo '<br />';
}
-
+
if (has_capability('moodle/category:update', get_context_instance(CONTEXT_SYSTEM, SITEID)) and $numcourses > 1) { /// Print button to re-sort courses by name
unset($options);
$options['id'] = $category->id;
}
}
-
+
print_course_search();
-
+
print_footer();
?>
}
$category = get_record("course_categories", "id", $course->category);
+ $navlinks = array();
if (! $delete) {
$strdeletecheck = get_string("deletecheck", "", $course->shortname);
$strdeletecoursecheck = get_string("deletecoursecheck");
-
- print_header("$site->shortname: $strdeletecheck", $site->fullname,
- "<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> ".
- "<a href=\"index.php\">$strcategories</a> -> ".
- "<a href=\"category.php?id=$course->category\">$category->name</a> -> ".
- "$strdeletecheck");
+ $navlinks[] = array('name' => $stradministration, 'link' => "../$CFG->admin/index.php", 'type' => 'misc');
+ $navlinks[] = array('name' => $strcategories, 'link' => "index.php", 'type' => 'misc');
+ $navlinks[] = array('name' => $category->name, 'link' => "category.php?id=$course->category", 'type' => 'misc');
+ $navlinks[] = array('name' => $strdeletecheck, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
- notice_yesno("$strdeletecoursecheck<br /><br />" . format_string($course->fullname) .
- " (" . format_string($course->shortname) . ")",
- "delete.php?id=$course->id&delete=".md5($course->timemodified)."&sesskey=$USER->sesskey",
+ print_header("$site->shortname: $strdeletecheck", $site->fullname, $navigation);
+
+ notice_yesno("$strdeletecoursecheck<br /><br />" . format_string($course->fullname) .
+ " (" . format_string($course->shortname) . ")",
+ "delete.php?id=$course->id&delete=".md5($course->timemodified)."&sesskey=$USER->sesskey",
"category.php?id=$course->category");
print_footer($course);
$strdeletingcourse = get_string("deletingcourse", "", format_string($course->shortname));
- print_header("$site->shortname: $strdeletingcourse", $site->fullname,
- "<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> ".
- "<a href=\"index.php\">$strcategories</a> -> ".
- "<a href=\"category.php?id=$course->category\">$category->name</a> -> ".
- "$strdeletingcourse");
+ $navlinks[] = array('name' => $stradministration, 'link' => "../$CFG->admin/index.php", 'type' => 'misc');
+ $navlinks[] = array('name' => $strcategories, 'link' => "index.php", 'type' => 'misc');
+ $navlinks[] = array('name' => $category->name, 'link' => "category.php?id=$course->category", 'type' => 'misc');
+ $navlinks[] = array('name' => $strdeletingcourse, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header("$site->shortname: $strdeletingcourse", $site->fullname, $navigation);
print_heading($strdeletingcourse);