[ Index ]
 

Code source de vtiger CRM 5.0.2

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

title

Body

[fermer]

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

   1  <?php
   2  /*********************************************************************************
   3   * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
   4   * ("License"); You may not use this file except in compliance with the
   5   * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
   6   * Software distributed under the License is distributed on an  "AS IS"  basis,
   7   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   8   * the specific language governing rights and limitations under the License.
   9   * The Original Code is:  SugarCRM Open Source
  10   * The Initial Developer of the Original Code is SugarCRM, Inc.
  11   * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
  12   * All Rights Reserved.
  13   * Contributor(s): ______________________________________.
  14   ********************************************************************************/
  15  /*********************************************************************************
  16   * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Activities/EditView.php,v 1.11 2005/03/24 16:18:38 samk Exp $
  17   * Description: TODO:  To be written.
  18   * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
  19   * All Rights Reserved.
  20   * Contributor(s): ______________________________________..
  21   ********************************************************************************/
  22  
  23  require_once ('Smarty_setup.php');
  24  require_once ('data/Tracker.php');
  25  require_once ('modules/Calendar/Activity.php');
  26  require_once ('include/database/PearDatabase.php');
  27  require_once ('include/CustomFieldUtil.php');
  28  require_once ('include/ComboUtil.php');
  29  require_once ('include/utils/utils.php');
  30  require_once ('include/FormValidationUtil.php');
  31  require_once ('modules/Calendar/calendarLayout.php'); 
  32  require_once ("modules/Emails/mail.php");
  33  include_once  'modules/Calendar/header.php';
  34  global $app_strings;
  35  global $mod_strings,$current_user;
  36  // Unimplemented until jscalendar language vtiger_files are fixed
  37  $focus = new Activity();
  38  $smarty =  new vtigerCRM_Smarty();
  39  $activity_mode = $_REQUEST['activity_mode'];
  40  if($activity_mode == 'Task')
  41  {
  42      $tab_type = 'Calendar';
  43      $smarty->assign("SINGLE_MOD",$mod_strings['LBL_TODO']);
  44  }
  45  elseif($activity_mode == 'Events')
  46  {
  47      $tab_type = 'Events';
  48      $smarty->assign("SINGLE_MOD",$mod_strings['LBL_EVENT']);
  49  }
  50  
  51  if(isset($_REQUEST['record']) && $_REQUEST['record']!='') {
  52      $focus->id = $_REQUEST['record'];
  53      $focus->mode = 'edit';
  54      $focus->retrieve_entity_info($_REQUEST['record'],$tab_type);        
  55      $focus->name=$focus->column_fields['subject'];
  56      $sql = 'select vtiger_users.user_name,vtiger_invitees.* from vtiger_invitees left join vtiger_users on vtiger_invitees.inviteeid=vtiger_users.id where activityid='.$focus->id;
  57      $result = $adb->query($sql);
  58      $num_rows=$adb->num_rows($result);
  59      $invited_users=Array();
  60      for($i=0;$i<$num_rows;$i++)
  61      {
  62          $userid=$adb->query_result($result,$i,'inviteeid');
  63          $username=$adb->query_result($result,$i,'user_name');
  64          $invited_users[$userid]=$username;
  65      }
  66      $smarty->assign("INVITEDUSERS",$invited_users);
  67      $smarty->assign("UPDATEINFO",updateInfo($focus->id));
  68      $related_array = getRelatedLists("Calendar", $focus);
  69      $cntlist = $related_array['Contacts']['entries'];
  70      $cnt_idlist = '';
  71      $cnt_namelist = '';
  72      if($cntlist != '')
  73      {
  74          $i = 0;
  75          foreach($cntlist as $key=>$cntvalue)
  76          {
  77              if($i != 0)
  78              {
  79                  $cnt_idlist .= ';';
  80                  $cnt_namelist .= "\n";
  81              }
  82              $cnt_idlist .= $key;
  83              $cnt_namelist .= eregi_replace("(<a[^>]*>)(.*)(</a>)", "\\2", $cntvalue[0]).' '.eregi_replace("(<a[^>]*>)(.*)(</a>)", "\\2", $cntvalue[1]);
  84              $i++;
  85          }
  86      }
  87      $smarty->assign("CONTACTSID",$cnt_idlist);
  88      $smarty->assign("CONTACTSNAME",$cnt_namelist);
  89      $query = 'select vtiger_recurringevents.recurringfreq,vtiger_recurringevents.recurringinfo from vtiger_recurringevents where vtiger_recurringevents.activityid = '.$focus->id;
  90      $res = $adb->query($query);
  91      $rows = $adb->num_rows($res);
  92      if($rows != 0)
  93      {
  94          $value['recurringcheck'] = 'Yes';
  95          $value['repeat_frequency'] = $adb->query_result($res,0,'recurringfreq');
  96          $recurringinfo =  explode("::",$adb->query_result($res,0,'recurringinfo'));
  97          $value['eventrecurringtype'] = $recurringinfo[0];
  98          if($recurringinfo[0] == 'Weekly')
  99          {
 100             for($i=0;$i<6;$i++)
 101             {
 102                 $label = 'week'.$recurringinfo[$i+1];
 103                 $value[$label] = 'checked';
 104             }
 105          }
 106          elseif($recurringinfo[0] == 'Monthly')
 107          {
 108              $value['repeatMonth'] = $recurringinfo[1];
 109              if($recurringinfo[1] == 'date')
 110              {
 111                  $value['repeatMonth_date'] = $recurringinfo[2];
 112              }
 113              else
 114              {
 115                  $value['repeatMonth_daytype'] = $recurringinfo[2];
 116                  $value['repeatMonth_day'] = $recurringinfo[3];
 117              }
 118          }
 119      }
 120      else
 121      {
 122          $value['recurringcheck'] = 'No';
 123      }
 124  
 125  }
 126  if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
 127      $focus->id = "";
 128          $focus->mode = '';     
 129  }
 130  $userDetails=getOtherUserName($current_user->id,true);
 131  //echo '<pre>';print_r($userDetails);echo '</pre>';
 132  $to_email = getUserEmailId('id',$current_user->id);
 133  $smarty->assign("CURRENTUSERID",$current_user->id);
 134  
 135  $disp_view = getView($focus->mode);
 136  if($disp_view == 'edit_view')
 137  {
 138      $act_data = getBlocks($tab_type,$disp_view,$mode,$focus->column_fields);
 139  }
 140  else    
 141  {
 142      $act_data = getBlocks($tab_type,$disp_view,$mode,$focus->column_fields,'BAS');
 143  }
 144  $smarty->assign("BLOCKS",$act_data);
 145  foreach($act_data as $header=>$blockitem)
 146  {
 147      foreach($blockitem as $row=>$data)
 148      {
 149          foreach($data as $key=>$maindata)
 150          {
 151              $uitype[$maindata[2][0]] = $maindata[0][0];
 152              $fldlabel[$maindata[2][0]] = $maindata[1][0];
 153              $fldlabel_sel[$maindata[2][0]] = $maindata[1][1];
 154              $fldlabel_combo[$maindata[2][0]] = $maindata[1][2];
 155              $value[$maindata[2][0]] = $maindata[3][0];
 156              $secondvalue[$maindata[2][0]] = $maindata[3][1];
 157              $thirdvalue[$maindata[2][0]] = $maindata[3][2];
 158          }
 159      }
 160  }
 161  if($current_user->hour_format == '')
 162      $format = 'am/pm';
 163  else
 164      $format = $current_user->hour_format;
 165  //echo '<pre>';print_r($value);echo '</pre>';
 166  $stdate = key($value['date_start']);
 167  $enddate = key($value['due_date']);
 168  $sttime = $value['date_start'][$stdate];
 169  $endtime = $value['due_date'][$enddate];
 170  $time_arr = getaddEventPopupTime($sttime,$endtime,$format);
 171  $value['starthr'] = $time_arr['starthour'];
 172  $value['startmin'] = $time_arr['startmin'];
 173  $value['startfmt'] = $time_arr['startfmt'];
 174  $value['endhr'] = $time_arr['endhour'];
 175  $value['endmin'] = $time_arr['endmin'];
 176  $value['endfmt'] = $time_arr['endfmt'];
 177  $smarty->assign("STARTHOUR",getTimeCombo($format,'start',$time_arr['starthour'],$time_arr['startmin'],$time_arr['startfmt']));
 178  $smarty->assign("ENDHOUR",getTimeCombo($format,'end',$time_arr['endhour'],$time_arr['endmin'],$time_arr['endfmt']));
 179  //echo '<pre>';print_r($value);echo '</pre>';
 180  $smarty->assign("ACTIVITYDATA",$value);
 181  $smarty->assign("LABEL",$fldlabel);
 182  $smarty->assign("secondvalue",$secondvalue);
 183  $smarty->assign("thirdvalue",$thirdvalue);
 184  $smarty->assign("fldlabel_combo",$fldlabel_combo);
 185  $smarty->assign("fldlabel_sel",$fldlabel_sel);
 186  $smarty->assign("OP_MODE",$disp_view);
 187  $smarty->assign("ACTIVITY_MODE",$activity_mode);
 188  $smarty->assign("HOURFORMAT",$format);
 189  $smarty->assign("USERSLIST",$userDetails);
 190  $smarty->assign("USEREMAILID",$to_email);
 191  $smarty->assign("MODULE",$currentModule);
 192  
 193  global $theme;
 194  $theme_path="themes/".$theme."/";
 195  $image_path=$theme_path."images/";
 196  require_once ($theme_path.'layout_utils.php');
 197  
 198  $log->info("Activity detail view");
 199  
 200  $smarty->assign("MOD", $mod_strings);
 201  $smarty->assign("APP", $app_strings);
 202  
 203  if (isset($focus->name))
 204  $smarty->assign("NAME", $focus->name);
 205  else
 206  $smarty->assign("NAME", "");
 207  
 208  if($focus->mode == 'edit')
 209  {
 210          $smarty->assign("MODE", $focus->mode);
 211  }
 212  
 213  $category = getParentTab();
 214  $smarty->assign("CATEGORY",$category);
 215  
 216  // Unimplemented until jscalendar language vtiger_files are fixed
 217  $smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']);
 218  $smarty->assign("CALENDAR_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
 219  
 220  if (isset($_REQUEST['return_module']))
 221  $smarty->assign("RETURN_MODULE", $_REQUEST['return_module']);
 222  if (isset($_REQUEST['return_action']))
 223  $smarty->assign("RETURN_ACTION", $_REQUEST['return_action']);
 224  if (isset($_REQUEST['return_id']))
 225  $smarty->assign("RETURN_ID", $_REQUEST['return_id']);
 226  if (isset($_REQUEST['ticket_id']))
 227  $smarty->assign("TICKETID", $_REQUEST['ticket_id']);
 228  if (isset($_REQUEST['product_id']))
 229  $smarty->assign("PRODUCTID", $_REQUEST['product_id']);
 230  if (isset($_REQUEST['return_viewname']))
 231  $smarty->assign("RETURN_VIEWNAME", $_REQUEST['return_viewname']);
 232  $smarty->assign("THEME", $theme);
 233  $smarty->assign("IMAGE_PATH", $image_path);
 234  $smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
 235  $smarty->assign("ID", $focus->id);
 236  
 237   $tabid = getTabid($tab_type);
 238   $validationData = getDBValidationData($focus->tab_name,$tabid);
 239   $data = split_validationdataArray($validationData);
 240  
 241  $check_button = Button_Check($module);
 242  $smarty->assign("CHECK", $check_button);
 243  
 244  $smarty->display("ActivityEditView.tpl");
 245  
 246  ?>


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