当前位置: 首页>>代码示例>>PHP>>正文


PHP Appointment::readResult方法代码示例

本文整理汇总了PHP中Appointment::readResult方法的典型用法代码示例。如果您正苦于以下问题:PHP Appointment::readResult方法的具体用法?PHP Appointment::readResult怎么用?PHP Appointment::readResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Appointment的用法示例。


在下文中一共展示了Appointment::readResult方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: readAppointment

 /** To get the events of the specified user and shared events
  * @param $userid -- The user Id:: Type integer
  * @param $from_datetime -- The start date Obj :: Type Array
  * @param $to_datetime -- The end date Obj :: Type Array
  * @param $view -- The calendar view :: Type String
  * @returns $list :: Type Array
  */
 function readAppointment($userid, &$from_datetime, &$to_datetime, $view)
 {
     global $current_user, $adb;
     require 'user_privileges/user_privileges_' . $current_user->id . '.php';
     require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
     $and = "AND (\n\t\t\t\t\t(\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t(CAST(CONCAT(date_start,' ',time_start) AS DATETIME) >= ? AND CAST(CONCAT(date_start,' ',time_start) AS DATETIME) <= ?)\n\t\t\t\t\t\t\tOR\t(CAST(CONCAT(due_date,' ',time_end) AS DATETIME) >= ? AND CAST(CONCAT(due_date,' ',time_end) AS DATETIME) <= ? )\n\t\t\t\t\t\t\tOR\t(CAST(CONCAT(date_start,' ',time_start) AS DATETIME) <= ? AND CAST(CONCAT(due_date,' ',time_end) AS DATETIME) >= ?)\n\t\t\t\t\t\t)\n\t\t\t\t\t\tAND vtiger_recurringevents.activityid is NULL\n\t\t\t\t\t)\n\t\t\t\tOR (\n\t\t\t\t\t\t(CAST(CONCAT(vtiger_recurringevents.recurringdate,' ',time_start) AS DATETIME) >= ?\n\t\t\t\t\t\t\tAND CAST(CONCAT(vtiger_recurringevents.recurringdate,' ',time_start) AS DATETIME) <= ?)\n\t\t\t\t\t\tOR\t(CAST(CONCAT(due_date,' ',time_end) AS DATETIME) >= ? AND CAST(CONCAT(due_date,' ',time_end) AS DATETIME) <= ?)\n\t\t\t\t\t\tOR\t(CAST(CONCAT(vtiger_recurringevents.recurringdate,' ',time_start) AS DATETIME) <= ?\n\t\t\t\t\t\t\tAND CAST(CONCAT(due_date,' ',time_end) AS DATETIME) >= ?)\n\t\t\t\t\t)\n\t\t\t\t)";
     $userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
     $q = "select vtiger_activity.*, vtiger_crmentity.*,\n\t\t\t\t\tcase when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end as user_name\n\t\t\t\t\tFROM vtiger_activity\n\t\t\t\t\t\tinner join vtiger_crmentity on vtiger_activity.activityid = vtiger_crmentity.crmid\n\t\t\t\t\t\tleft join vtiger_recurringevents on vtiger_activity.activityid=vtiger_recurringevents.activityid\n\t\t\t\t\t\tleft join vtiger_groups on vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\t\tWHERE vtiger_crmentity.deleted = 0 and vtiger_activity.activitytype not in ('Emails','Task') {$and} ";
     // User Select Customization: Changes should made also in (calendayLaout getEventList) and one more BELOW
     $query_filter_prefix = calendarview_getSelectedUserFilterQuerySuffix();
     $q .= $query_filter_prefix;
     // END
     $h = $from_datetime->z_hour;
     $m = $from_datetime->min;
     if (empty($m)) {
         $m = '00';
     }
     $startDate = new DateTimeField($from_datetime->year . "-" . $from_datetime->z_month . "-" . $from_datetime->z_day . " {$h}:{$m}");
     $h = '23';
     $m = '59';
     $endDate = new DateTimeField($to_datetime->year . "-" . $to_datetime->z_month . "-" . $to_datetime->z_day . " {$h}:{$m}");
     $params = array($startDate->getDBInsertDateTimeValue(), $endDate->getDBInsertDateTimeValue(), $startDate->getDBInsertDateTimeValue(), $endDate->getDBInsertDateTimeValue(), $startDate->getDBInsertDateTimeValue(), $endDate->getDBInsertDateTimeValue(), $startDate->getDBInsertDateTimeValue(), $endDate->getDBInsertDateTimeValue(), $startDate->getDBInsertDateTimeValue(), $endDate->getDBInsertDateTimeValue(), $startDate->getDBInsertDateTimeValue(), $endDate->getDBInsertDateTimeValue());
     if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[16] == 3) {
         //Added for User Based Custom View for Calendar
         $sec_parameter = getCalendarViewSecurityParameter();
         $q .= $sec_parameter;
     }
     $q .= " AND vtiger_recurringevents.activityid is NULL ";
     $q .= " group by vtiger_activity.activityid ORDER by vtiger_activity.date_start,vtiger_activity.time_start";
     $r = $adb->pquery($q, $params);
     $n = $adb->getRowCount($r);
     $a = 0;
     $list = array();
     while ($a < $n) {
         $result = $adb->fetchByAssoc($r);
         $from = strtotime($result['date_start']);
         $to = strtotime($result['due_date'] . ' ' . $result["time_end"]);
         $windowTo = strtotime($endDate->getDBInsertDateTimeValue());
         for ($j = $from; $j <= $to; $j = $j + 60 * 60 * 24) {
             $obj = new Appointment();
             $temp_start = date("Y-m-d", $j);
             $endTime = strtotime($temp_start . ' ' . $result['time_start']);
             if ($endTime > $windowTo) {
                 break;
             }
             $result["date_start"] = $temp_start;
             list($obj->temphour, $obj->tempmin) = explode(":", $result["time_start"]);
             if ($start_timestamp != $end_timestamp && $view == 'day') {
                 if ($j == $start_timestamp) {
                     $result["duration_hours"] = 24 - $obj->temphour;
                 } elseif ($j > $start_timestamp && $j < $end_timestamp) {
                     list($obj->temphour, $obj->tempmin) = $current_user->start_hour != '' ? explode(":", $current_user->start_hour) : explode(":", "08:00");
                     $result["duration_hours"] = 24 - $obj->temphour;
                 } elseif ($j == $end_timestamp) {
                     list($obj->temphour, $obj->tempmin) = $current_user->start_hour != '' ? explode(":", $current_user->start_hour) : explode(":", "08:00");
                     list($ehr, $emin) = explode(":", $result["time_end"]);
                     $result["duration_hours"] = $ehr - $obj->temphour;
                 }
             }
             $obj->readResult($result, $view);
             $list[] = $obj;
             unset($obj);
         }
         $a++;
     }
     //Get Recurring events
     $q = "SELECT vtiger_activity.*, vtiger_crmentity.*, case when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end as user_name , vtiger_recurringevents.recurringid, vtiger_recurringevents.recurringdate as date_start ,vtiger_recurringevents.recurringtype,vtiger_groups.groupname from vtiger_activity inner join vtiger_crmentity on vtiger_activity.activityid = vtiger_crmentity.crmid inner join vtiger_recurringevents on vtiger_activity.activityid=vtiger_recurringevents.activityid left join vtiger_groups on vtiger_groups.groupid = vtiger_crmentity.smownerid LEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid";
     $q .= getNonAdminAccessControlQuery('Calendar', $current_user);
     $q .= " where vtiger_crmentity.deleted = 0 and vtiger_activity.activitytype not in ('Emails','Task') AND (cast(concat(recurringdate, ' ', time_start) as datetime) between ? and ?) ";
     // User Select Customization
     $q .= $query_filter_prefix;
     // END
     $params = array($startDate->getDBInsertDateTimeValue(), $endDate->getDBInsertDateTimeValue());
     $q .= " ORDER by vtiger_recurringevents.recurringid";
     $r = $adb->pquery($q, $params);
     $n = $adb->getRowCount($r);
     $a = 0;
     while ($a < $n) {
         $obj = new Appointment();
         $result = $adb->fetchByAssoc($r);
         list($obj->temphour, $obj->tempmin) = explode(":", $result["time_start"]);
         $obj->readResult($result, $view);
         $a++;
         $list[] = $obj;
         unset($obj);
     }
     usort($list, 'compare');
     return $list;
 }
开发者ID:kduqi,项目名称:corebos,代码行数:96,代码来源:Appointment.php


注:本文中的Appointment::readResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。