[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Calendar/ -> ActivityAjax.php (source)

   1  <?php
   2  /*********************************************************************************
   3  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9   *
  10   ********************************************************************************/
  11  global $theme,$mod_strings,$current_language,$currentModule,$current_user;
  12  $theme_path = "themes/".$theme."/";
  13  $image_path = $theme_path."images/";
  14  require_once($theme_path."layout_utils.php");
  15  require_once ("modules/Calendar/calendarLayout.php");
  16  require_once ('include/utils/utils.php');
  17  require_once ("modules/Calendar/Calendar.php");
  18  require_once ('include/logging.php');
  19  $cal_log =& LoggerManager::getLogger('calendar');
  20  $cal_log->debug("In CalendarAjax file");
  21  $mysel = $_REQUEST['view'];
  22  if($_REQUEST['file'] == 'OpenListView')
  23  {
  24      require_once ('Smarty_setup.php');
  25      $smarty = new vtigerCRM_Smarty;
  26      require_once ("modules/Calendar/OpenListView.php");
  27      $smarty->assign("APP",$app_strings);
  28      $smarty->assign("IMAGE_PATH",$image_path);
  29      if($_REQUEST['mode'] == '0')
  30      {
  31          $activities[0] = getPendingActivities(0);
  32          $smarty->assign("ACTIVITIES",$activities);
  33          $smarty->display("upcomingActivities.tpl");
  34      }
  35      else if($_REQUEST['mode'] == '1')
  36      {
  37          $activities[1] = getPendingActivities(1);
  38          $smarty->assign("ACTIVITIES",$activities);
  39          $smarty->display("pendingActivities.tpl");
  40      }
  41      die();
  42  }
  43  $calendar_arr = Array();
  44  $calendar_arr['IMAGE_PATH'] = $image_path;
  45  $date_data = array();
  46  if ( isset($_REQUEST['day']))
  47  {
  48      $date_data['day'] = $_REQUEST['day'];
  49  }
  50  if ( isset($_REQUEST['month']))
  51  {
  52      $date_data['month'] = $_REQUEST['month'];
  53  }
  54  if ( isset($_REQUEST['week']))
  55  {
  56      $date_data['week'] = $_REQUEST['week'];
  57  }
  58  if ( isset($_REQUEST['year']))
  59  {
  60      if ($_REQUEST['year'] > 2037 || $_REQUEST['year'] < 1970)
  61      {
  62          print("<font color='red'>Sorry, Year must be between 1970 and 2037</font>");
  63          exit;
  64      }
  65      $date_data['year'] = $_REQUEST['year'];
  66  }
  67  
  68          
  69  if(isset($_REQUEST['type']) && ($_REQUEST['type'] !=''))
  70  {
  71      $type = $_REQUEST['type'];
  72      $cal_log->debug("type value is:".$type);
  73      if($type == 'minical')
  74      {
  75          $cal_log->debug("going to get mini calendar");
  76              $temp_module = $currentModule;
  77              $mod_strings = return_module_language($current_language,'Calendar');
  78              $currentModule = 'Calendar';
  79          $calendar_arr['IMAGE_PATH'] = $image_path;
  80              $calendar_arr['calendar'] = new Calendar('month',$date_data);
  81              $calendar_arr['view'] = 'month';
  82              $calendar_arr['size'] = 'small';
  83          $calendar_arr['calendar']->add_Activities($current_user);
  84              calendar_layout($calendar_arr);
  85              $mod_strings = return_module_language($current_language,$temp_module);
  86              $currentModule = $_REQUEST['module'];
  87      }
  88      elseif($type == 'settings')
  89      {
  90          $cal_log->debug("going to get calendar Settings");
  91          require_once ('modules/Calendar/calendar_share.php');    
  92      }
  93      else
  94      {
  95          $subtab = $_REQUEST['subtab']; 
  96          if(empty($mysel))
  97          {
  98              $mysel = 'day';
  99          }
 100          $calendar_arr['calendar'] = new Calendar($mysel,$date_data);
 101          
 102          if ($mysel == 'day' || $mysel == 'week' || $mysel == 'month' || $mysel == 'year')
 103          {
 104              $calendar_arr['calendar']->add_Activities($current_user);
 105          }
 106          $calendar_arr['view'] = $mysel;
 107          if($calendar_arr['calendar']->view == 'day')
 108              $start_date = $end_date = $calendar_arr['calendar']->date_time->get_formatted_date();
 109          elseif($calendar_arr['calendar']->view == 'week')
 110          {
 111              $start_date = $calendar_arr['calendar']->slices[0];
 112              $end_date = $calendar_arr['calendar']->slices[6];
 113          }
 114          elseif($calendar_arr['calendar']->view == 'month')
 115          {
 116              $start_date = $calendar_arr['calendar']->date_time->getThismonthDaysbyIndex(0);
 117              $end_date = $calendar_arr['calendar']->date_time->getThismonthDaysbyIndex($calendar_arr['calendar']->date_time->daysinmonth - 1);
 118              $start_date = $start_date->get_formatted_date();
 119              $end_date = $end_date->get_formatted_date();
 120          }
 121          elseif($calendar_arr['calendar']->view == 'year')
 122          {
 123              $start_date = $calendar_arr['calendar']->date_time->getThisyearMonthsbyIndex(0);
 124              $end_date = $calendar_arr['calendar']->date_time->get_first_day_of_changed_year('increment');
 125              $start_date = $start_date->get_formatted_date();
 126              $end_date = $end_date->get_formatted_date();
 127          }
 128          else
 129          {
 130              die("view:".$calendar_arr['calendar']->view." is not defined");
 131          }
 132          
 133          if($type == 'change_owner' || $type == 'activity_delete' || $type == 'change_status' || $type == 'activity_postpone')
 134          {
 135              if($type == 'change_status')
 136              {
 137                  $return_id = $_REQUEST['record'];
 138                  if(isset($_REQUEST['status']))
 139                  {
 140                      $status = $_REQUEST['status'];
 141                      $activity_type = "Task";
 142                  }
 143                  elseif(isset($_REQUEST['eventstatus']))
 144                  {
 145                      $status = $_REQUEST['eventstatus'];
 146                      $activity_type = "Events";
 147                  }
 148                  ChangeStatus($status,$return_id,$activity_type);
 149              }
 150              if($type == 'activity_postpone')
 151              {
 152              }
 153              if(isset($_REQUEST['viewOption']) && $_REQUEST['viewOption'] != null && $subtab == 'event')
 154              {
 155                  if($_REQUEST['viewOption'] == 'hourview')
 156                  {
 157                      $cal_log->debug("going to get calendar Event HourView");
 158                      if($calendar_arr['view'] == 'day')
 159                      {
 160                          echo getDayViewLayout($calendar_arr);
 161                      }
 162                      elseif($calendar_arr['view'] == 'week')
 163                      {
 164                          echo getWeekViewLayout($calendar_arr);    
 165                      }
 166                      elseif($calendar_arr['view'] == 'month')
 167                      {
 168                          echo getMonthViewLayout($calendar_arr);
 169                      }
 170                      elseif($calendar_arr['view'] == 'year')
 171                      {
 172                          echo getYearViewLayout($calendar_arr);
 173                      }
 174                      else
 175                      {
 176                          die("view:".$view['view']." is not defined");
 177                      }
 178                  }
 179                  elseif($_REQUEST['viewOption'] == 'listview')
 180                  {
 181                      $cal_log->debug("going to get calendar Event ListView");
 182                      //To get Events List
 183                      $activity_list = getEventList($calendar_arr, $start_date, $end_date);
 184                      echo constructEventListView($calendar_arr,$activity_list);
 185                  }
 186              }
 187              elseif($subtab == 'todo')
 188              {
 189                  $cal_log->debug("going to get calendar Todo ListView");
 190                  //To get Todos List
 191                  $todo_list = getTodoList($calendar_arr, $start_date, $end_date);
 192                  echo constructTodoListView($todo_list,$calendar_arr,$subtab);
 193              }
 194          }
 195          elseif($type == 'view')
 196          {
 197              require_once('modules/Calendar/'.$_REQUEST['file'].'.php');
 198          }
 199          else
 200          {
 201              die("View option is not defined");
 202          }
 203      }
 204  }
 205  else
 206  {
 207      require_once ('include/Ajax/CommonAjax.php');
 208      //die("type is not set");
 209  }
 210  
 211  ?>


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7