Browse Source

Adding group events + colors

Julio Montoya 13 years ago
parent
commit
0fcb988ab7
2 changed files with 13 additions and 6 deletions
  1. 10 4
      main/calendar/agenda.lib.php
  2. 3 2
      main/inc/ajax/agenda.ajax.php

+ 10 - 4
main/calendar/agenda.lib.php

@@ -7,10 +7,11 @@ class Agenda {
 		$this->tbl_personal_agenda 	= Database::get_user_personal_table(TABLE_PERSONAL_AGENDA);
 		$this->events				= array();
 		
-		$this->event_platform_color = 'red';
-		$this->event_course_color 	= 'green';
-		$this->event_session_color 	= 'blue';
-		$this->event_personal_color = 'light blue';
+		$this->event_platform_color = 'red';//red
+		$this->event_course_color 	= '#6B8E23'; //green
+		$this->event_group_color 	= '#A0522D'; //siena
+		$this->event_session_color 	= '#000080'; // blue
+		$this->event_personal_color = 'steel blue'; //steel blue
 		
 	}
 	
@@ -195,11 +196,16 @@ class Agenda {
 				$event['title'] 		= $row['title'];
 				$event['className'] 	= 'course';
 				$event['allDay'] 	  	= 'false';
+			//	var_dump($row);
 				$event['borderColor'] 	= $event['backgroundColor'] = $this->event_course_color;
 				if (isset($row['session_id']) && !empty($row['session_id'])) {
 					$event['borderColor'] 	= $event['backgroundColor'] = $this->event_session_color;
 				}
 				
+				if (isset($row['to_group_id']) && !empty($row['to_group_id'])) {
+					$event['borderColor'] 	= $event['backgroundColor'] = $this->event_group_color;
+				}
+				
 				$event['editable'] 		= false;
 				
 				if (!empty($row['start_date']) && $row['start_date'] != '0000-00-00 00:00:00') {

+ 3 - 2
main/inc/ajax/agenda.ajax.php

@@ -10,8 +10,6 @@ require_once api_get_path(SYS_CODE_PATH).'calendar/agenda.inc.php';
 require_once api_get_path(SYS_CODE_PATH).'calendar/myagenda.inc.php';
 require_once api_get_path(SYS_CODE_PATH).'calendar/agenda.lib.php';
 
-api_protect_admin_script();
-
 $action = $_REQUEST['a'];
 $agenda = new Agenda();
 
@@ -33,6 +31,9 @@ switch ($action) {
 		echo $events;		
 		break;
     case 'get_user_agenda':
+    	
+    	api_protect_admin_script();
+    	 
         if (api_is_allowed_to_edit(null, true)) {
             //@todo move this in the agenda class
             $DaysShort  = api_get_week_days_short();