Make week numbers available in calendar, month view.
Change setting for calendar panel
UPDATE `opengoo`.`og_user_ws_config_categories` SET `is_system` = '0' WHERE `og_user_ws_config_categories`.`id` = 5;
Add option in user_config
INSERT INTO `opengoo`.`og_user_ws_config_options` (
`id` ,
`category_name` ,
`name` ,
`default_value` ,
`config_handler_class` ,
`is_system` ,
`option_order` ,
`dev_comment`
)
VALUES (
NULL , 'calendar panel', 'show_week_numbers', '0', 'BoolConfigHandler', '0', '0', NULL
);
Add in language/en_us/administrations.php (Or whatever language folder you are using)(in my file I've added it as line 95)
'user ws config category name calendar panel' => 'Calendar',
Add in language/en_us/administrations.php (Or whatever language folder you are using)(in my file I've added it as line 115-116)
'user ws config option name show_week_numbers' => 'Show week numbers',
'user ws config option desc show_week_numbers' => 'Will show week numbers in calendar',
Add in language/en_us/calendar.php (Or whatever language folder you are using)(in my file I've added it as line 134)
"week" => "week",
Add in application/views/event/calendar.php (line 45 in my file)
$firstweek = date("W", mktime(0, 0, 0, $month, 1, $year));
Change in application/views/event/calendar.php (line 91 to 113 in my file)
<tr>
<?php
if(!cal_option("start_monday")) {
?>
<th width="14%"> <?php echo lang('sunday short') ?> </th>
<?php } ?>
<th width="14%"><?php echo lang('monday short') ?></th>
<th width="14%"><?php echo lang('tuesday short') ?></th>
<th width="14%"><?php echo lang('wednesday short') ?></th>
<th width="14%"><?php echo lang('thursday short') ?></th>
<th width="14%"><?php echo lang('friday short') ?></th>
<th width="14%"><?php echo lang('saturday short') ?></th>
<?php
$output = '';
if(cal_option("start_monday")) {
?>
<th width="14%"> <?php echo lang('sunday short') ?> </th>
<?php } ?>
to
<tr>
<?php
if(cal_option("show_week_numbers")) {
?>
<th width="2%"> <?php echo lang('week') ?> </th>
<?php }
if(!cal_option("start_monday")) {
?>
<th width="14%"> <?php echo lang('sunday short') ?> </th>
<?php } ?>
<th width="14%"><?php echo lang('monday short') ?></th>
<th width="14%"><?php echo lang('tuesday short') ?></th>
<th width="14%"><?php echo lang('wednesday short') ?></th>
<th width="14%"><?php echo lang('thursday short') ?></th>
<th width="14%"><?php echo lang('friday short') ?></th>
<th width="14%"><?php echo lang('saturday short') ?></th>
<?php
$output = '';
if(cal_option("start_monday")) {
?>
<th width="14%"> <?php echo lang('sunday short') ?> </th>
<?php } ?>
change function
function cal_load_options(){
global $cal_db, $cal_options;
// Find current user id
$id = $_SESSION['cal_userid'];
// call the DB for options
$result = cal_query_getoptions($id);
// get all options
$d = array();
while($t = $cal_db->sql_fetchrow($result)){
$d[$t['name']] = $t['value'];
}
// set the options that have values
if(array_var($d,'timeout')!="") $cal_options['timeout'] = $d['timeout'];
if(array_var($d,'skin')!="") $cal_options['skin'] = $d['skin'];
if(array_var($d,'language')!="") $cal_options['language'] = $d['language'];
if(array_var($d,'root_password')!="") $cal_options['root_password'] = $d['root_password'];
// set the options that are true or false
if(array_var($d,'show_times')=='y') $cal_options['show_times'] = TRUE;
else $cal_options['show_times'] = FALSE;
if(array_var($d,'hours_24')=='y') $cal_options['hours_24'] = TRUE;
else $cal_options['hours_24'] = FALSE;
if(array_var($d,'start_monday')=='1') $cal_options['start_monday'] = TRUE;
else $cal_options['start_monday'] = FALSE;
if(array_var($d,'anon_naming')=='y') $cal_options['anon_naming'] = TRUE;
else $cal_options['anon_naming'] = FALSE;
}
in library/cal/cal_gatekeeper.php to
function cal_load_options(){
global $cal_db, $cal_options;
// Find current user id
$id = $_SESSION['cal_userid'];
// call the DB for options
$result = cal_query_getoptions($id);
// get all options
$d = array();
while($t = $cal_db->sql_fetchrow($result)){
$d[$t['name']] = $t['value'];
}
// set the options that have values
if(array_var($d,'timeout')!="") $cal_options['timeout'] = $d['timeout'];
if(array_var($d,'skin')!="") $cal_options['skin'] = $d['skin'];
if(array_var($d,'language')!="") $cal_options['language'] = $d['language'];
if(array_var($d,'root_password')!="") $cal_options['root_password'] = $d['root_password'];
// set the options that are true or false
if(array_var($d,'show_times')=='y') $cal_options['show_times'] = TRUE;
else $cal_options['show_times'] = FALSE;
if(array_var($d,'hours_24')=='y') $cal_options['hours_24'] = TRUE;
else $cal_options['hours_24'] = FALSE;
if(array_var($d,'start_monday')=='1') $cal_options['start_monday'] = TRUE;
else $cal_options['start_monday'] = FALSE;
if(array_var($d,'show_week_numbers')=='1') $cal_options['show_week_numbers'] = TRUE;
else $cal_options['show_week_numbers'] = FALSE;
if(array_var($d,'anon_naming')=='y') $cal_options['anon_naming'] = TRUE;
else $cal_options['anon_naming'] = FALSE;
}
change function cal_query_getoptions in library/cal/queries/mysql.php from whatever it is to
function cal_query_getoptions($id){
global $cal_db;
$q = 'SELECT name, value
FROM `og_user_ws_config_options`
INNER JOIN `og_user_ws_config_option_values` ON `id` = `option_id`
WHERE `category_name` = "calendar panel" AND `user_id` = ' . $id . '
LIMIT 0 , 30';
$r = $cal_db->sql_query($q);
if(!$r AND DEBUG){
echo $cal_db->sql_error();
}
return $r;
}
Add following lines in public/assets/themes/default/stylesheets/custom.css (if it does not exist, it needs to be created)
#calendar td.weeknumber{
text-align: center;
color: white;
background-color: #339;
border: #999999 1px solid;
}
It will take some time to set in, there is a cached css file that doesn't update until I've restarted my computer.