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


PHP Meeting::retrieve_by_string_fields方法代码示例

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


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

示例1: createSugarEvents

 /**
  * Create Sugar meetings from calendar events
  * @param SugarBean $parent related object to associate with meetings
  */
 function createSugarEvents($parent = NULL)
 {
     require_once 'modules/Meetings/Meeting.php';
     // if email description contains a meeting id that exists, don't create new meeting
     if (isset($parent) && !empty($parent->description)) {
         preg_match('/record=(.*)&gt/', $parent->description, $match);
         if (!empty($match[1])) {
             $meeting = new Meeting();
             $meeting->disable_row_level_security = true;
             $prev_meeting = $meeting->retrieve_by_string_fields(array("id" => $match[1]));
             if (isset($prev_meeting)) {
                 return;
             }
         }
     }
     foreach ($this->data['calendar'] as $calendar_key => $calendar_val) {
         foreach ($calendar_val->stack as $key => $val) {
             if (!$val instanceof vEvent) {
                 continue;
             }
             $meeting = BeanFactory::getBean('Meetings');
             // Hack - we don't care about this bean's permissions
             $meeting->disable_row_level_security = true;
             $prev_seq = 0;
             $prev_exists = false;
             $prev_meeting = $meeting->retrieve_by_string_fields(array("outlook_id" => $val->event->uid));
             if (isset($prev_meeting) && !empty($prev_meeting->id)) {
                 $prev_seq = (int) $prev_meeting->sequence;
                 $prev_exists = true;
             }
             if (isset($val->event->status) && $val->event->status == 'CANCELLED' && !$prev_exists) {
                 // can't cancel non-existing event, skip
                 continue;
             }
             if (!$prev_exists || $prev_exists && $val->event->sequence > $prev_seq) {
                 // insert if doesn't exist, otherwise overwrite it with newer data if current meeting's sequence is greater than prev. sequence
                 if ($parent) {
                     $meeting->assigned_user_id = $parent->assigned_user_id;
                     $meeting->team_set_id = $parent->team_set_id;
                     $meeting->team_id = $parent->team_id;
                     $meeting->parent_id = $parent->id;
                     $meeting->parent_type = $parent->module_dir;
                 }
                 $meeting->date_start = $val->event->date_start;
                 $meeting->date_end = $val->event->date_end;
                 $meeting->name = $val->event->name;
                 $meeting->date_entered = $val->event->date_created;
                 $meeting->date_modified = $val->event->date_modified;
                 $meeting->location = $val->event->location;
                 $dateDiff = strtotime($val->event->date_end) - strtotime($val->event->date_start);
                 $diffHours = floor($dateDiff / (60 * 60));
                 $diffMinutes = $dateDiff % (60 * 60) / (60 * 60) * 60;
                 $meeting->duration_hours = $diffHours;
                 $meeting->duration_minutes = $diffMinutes;
                 $meeting->outlook_id = $val->event->uid;
                 $meeting->sequence = $val->event->sequence;
                 if ($prev_exists && $val->event->status == 'CANCELLED') {
                     $meeting->deleted = 1;
                     $meeting->mark_deleted($meeting->id);
                     continue;
                 }
                 $meeting_id = $meeting->save();
                 // invite people
                 $emails = array();
                 foreach ($val->event->attendees as $attendee) {
                     if (!empty($attendee['email'])) {
                         $emails[] = "ea.email_address_caps=" . $meeting->db->quoted($this->cleanEmail($attendee['email']));
                     }
                 }
                 if (!empty($val->event->organizer) && !empty($val->event->organizer['email'])) {
                     $emails[] = "ea.email_address_caps=" . $meeting->db->quoted($this->cleanEmail($val->event->organizer['email']));
                 }
                 if (!empty($emails)) {
                     $query = join(" OR ", $emails);
                     $invitees = $meeting->db->query("SELECT eabr.bean_id, eabr.bean_module FROM email_addr_bean_rel eabr\n\t\t\t\t\t    JOIN email_addresses ea ON eabr.email_address_id=ea.id\n\t\t\t\t\t    WHERE eabr.deleted=0 AND ea.deleted=0 AND eabr.bean_module IN ('Users','Contacts','Leads') AND ({$query})\n\t\t\t\t\t    ");
                     $ids = array_flip($meeting->relationship_fields);
                     while ($inv = $meeting->db->fetchByAssoc($invitees)) {
                         $module = strtolower($inv['bean_module']);
                         $relname = "meetings_{$module}";
                         $linkfields = VardefManager::getLinkFieldForRelationship("Meetings", "Meeting", $relname);
                         $bean = BeanFactory::getBean($inv['bean_module']);
                         if (empty($bean)) {
                             $GLOBALS['log']->info("createSugarEvents: Don't know how to create bean {$inv['bean_module']}");
                             continue;
                         }
                         // Hack - we don't care about this bean's permissions
                         $bean->disable_row_level_security = true;
                         $bean->retrieve($inv["bean_id"]);
                         $linkname = $linkfields['name'];
                         $meeting->load_relationship($linkname);
                         if (empty($meeting->{$linkname})) {
                             $GLOBALS['log']->info("createSugarEvents: Unknown module {$module} with link {$linkname} encountered for id {$inv["bean_id"]}");
                             continue;
                         }
                         $GLOBALS['log']->info("Adding link for {$inv["bean_id"]} module {$module} relname {$relname} linkname {$linkname}");
                         $meeting->{$linkname}->add($bean);
//.........这里部分代码省略.........
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:101,代码来源:iCalParser.php


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