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


PHP Notifier::notifEvent方法代码示例

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


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

示例1: edit


//.........这里部分代码省略.........
			*/
			
			try {
				$data = $this->getData($event_data);
				// run the query to set the event data
                                $event->setFromAttributes($data);

                                $this->registerInvitations($data, $event, false);
				if (isset($data['confirmAttendance'])) {
                                    $this->change_invitation_state($data['confirmAttendance'], $event->getId(), $user_filter);
                                }
				    
                                DB::beginWork();
                                $event->save();  

                                if($event->getSpecialID() != ""){
                                    $this->sync_calendar_extern($event);
                                }

                                $member_ids = json_decode(array_var($_POST, 'members'));

                                $object_controller = new ObjectController();
                                $object_controller->add_to_members($event, $member_ids);
                                $object_controller->add_subscribers($event);

                                $object_controller->link_to_new_object($event);
                                $object_controller->add_custom_properties($event);
                                									
								$old_reminders = ObjectReminders::getByObject($event);
								if($old_reminders != null){								
									$object_controller->add_reminders($event); //adding the new reminders, if any								
									$object_controller->update_reminders($event, $old_reminders); //updating the old ones
								}else if(user_config_option("add_event_autoreminder")){
									$reminder = new ObjectReminder();
									$def = explode(",",user_config_option("reminders_events"));
									$minutes = $def[2] * $def[1];
				          			$reminder->setMinutesBefore($minutes);
				                    $reminder->setType($def[0]);
				                    $reminder->setContext("start");
				                    $reminder->setObject($event);
				                    $reminder->setUserId(0);
				                    $date = $event->getStart();
									if ($date instanceof DateTimeValue) {
										$rdate = new DateTimeValue($date->getTimestamp() - $minutes * 60);
										$reminder->setDate($rdate);
									}
									$reminder->save();
								}

                                $event->resetIsRead();
                                DB::commit();
                                
                                $is_silent = false;
                                if (isset($data['send_notification']) && $data['send_notification']) {
                                                    $users_to_inv = array();
                                    foreach ($data['users_to_invite'] as $us => $v) {
                                            if ($us != logged_user()->getId()) {
                                                    $users_to_inv[] = Contacts::findById(array('id' => $us));
                                            }
                                    }
                                    Notifier::notifEvent($event, $users_to_inv, 'modified', logged_user());
                                    $is_silent = true;
                                }

                                ApplicationLogs::createLog($event, ApplicationLogs::ACTION_EDIT, false, $is_silent);
                                
                                $opt_rep_day = array();
                                if(array_var($event_data, 'repeat_saturdays')){
                                    $opt_rep_day['saturday'] = true;
                                }else{
                                    $opt_rep_day['saturday'] = false;
                                }
                                if(array_var($event_data, 'repeat_sundays')){
                                    $opt_rep_day['sunday'] = true;
                                }else{
                                    $opt_rep_day['sunday'] = false;
                                }
                                
                                //$this->repetitive_event($event, $opt_rep_day);
                                
                                if($_POST['type_related'] == "all" || $_POST['type_related'] == "news"){
                                    $data['members'] = json_decode(array_var($_POST, 'members'));
                                    $this->repetitive_event_related($event,"edit",$_POST['type_related'],$data);
                                }
                                
                                flash_success(lang('success edit event', clean($event->getObjectName())));

                                if (array_var($_POST, 'popup', false)) {
                                                ajx_current("reload");
                                } else {
                                        ajx_current("back");
                                }
                                ajx_add("overview-panel", "reload");          	
                    } catch(Exception $e) {
                            DB::rollback();
                                    flash_error($e->getMessage());
                                    ajx_current("empty");
                    } // try
		} // if
	} // edit
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:EventController.class.php

示例2: edit


//.........这里部分代码省略.........
                 }
             }
         }
         //repeat until
         //if(isset($rend) AND $rend=="9999-00-00") $rend = "";
         // organize the time and date data for the html select drop downs.
         $thetime = $event->getStart()->getTimestamp() + logged_user()->getTimezone() * 3600;
         $durtime = $event->getDuration()->getTimestamp() + logged_user()->getTimezone() * 3600 - $thetime;
         $hour = date('G', $thetime);
         // format time to 24-hour or 12-hour clock.
         if (!user_config_option('time_format_use_24')) {
             if ($hour >= 12) {
                 $pm = 1;
                 $hour = $hour - 12;
             } else {
                 $pm = 0;
             }
         }
         $event_data = array('subject' => $event->getSubject(), 'description' => $event->getDescription(), 'name' => $event->getCreatedById(), 'username' => $event->getCreatedById(), 'typeofevent' => $event->getTypeId(), 'forever' => $event->getRepeatForever(), 'usetimeandduration' => $event->getTypeId() == 3 ? 0 : 1, 'occ' => $occ, 'rjump' => $rjump, 'setlastweek' => $setlastweek, 'rend' => isset($rend) ? $rend : NULL, 'rnum' => isset($rnum) ? $rnum : NULL, 'rsel1' => $rsel1, 'rsel2' => $rsel2, 'rsel3' => $rsel3, 'thetime' => $event->getStart()->getTimestamp(), 'hour' => $hour, 'minute' => date('i', $thetime), 'month' => date('n', $thetime), 'year' => date('Y', $thetime), 'day' => date('j', $thetime), 'durtime' => $event->getDuration()->getTimestamp() - $thetime, 'durationmin' => $durtime / 60 % 60, 'durationhour' => $durtime / 3600 % 24, 'durday' => floor($durtime / 86400), 'pm' => isset($pm) ? $pm : 0, 'tags' => is_array($tag_names) ? implode(', ', $tag_names) : '', 'repeat_dow' => $event->getRepeatDow(), 'repeat_wnum' => $event->getRepeatWnum(), 'repeat_mjump' => $event->getRepeatMjump());
         // array
     }
     // if
     tpl_assign('event_data', $event_data);
     tpl_assign('event', $event);
     if (is_array(array_var($_POST, 'event'))) {
         //	MANAGE CONCURRENCE WHILE EDITING
         $upd = array_var($_POST, 'updatedon');
         if ($upd && $event->getUpdatedOn()->getTimestamp() > $upd && !array_var($_POST, 'merge-changes') == 'true') {
             ajx_current('empty');
             evt_add("handle edit concurrence", array("updatedon" => $event->getUpdatedOn()->getTimestamp(), "genid" => array_var($_POST, 'genid')));
             return;
         }
         if (array_var($_POST, 'merge-changes') == 'true') {
             $this->setTemplate('view_event');
             $editedEvent = ProjectEvents::findById($event->getId());
             $this->viewevent();
             ajx_set_panel(lang('tab name', array('name' => $editedEvent->getTitle())));
             ajx_extra_data(array("title" => $editedEvent->getTitle(), 'icon' => 'ico-event'));
             ajx_set_no_toolbar(true);
             ajx_set_panel(lang('tab name', array('name' => $editedEvent->getTitle())));
             return;
         }
         try {
             $data = $this->getData($event_data);
             // run the query to set the event data
             $event->setFromAttributes($data);
             $this->registerInvitations($data, $event, false);
             if (isset($data['confirmAttendance'])) {
                 $this->change_invitation_state($data['confirmAttendance'], $event->getId(), $user_filter);
             }
             if (isset($data['send_notification']) && $data['send_notification']) {
                 $users_to_inv = array();
                 foreach ($data['users_to_invite'] as $us => $v) {
                     if ($us != logged_user()->getId()) {
                         $users_to_inv[] = Users::findById(array('id' => $us));
                     }
                 }
                 Notifier::notifEvent($event, $users_to_inv, 'modified', logged_user());
             }
             foreach ($data['users_to_invite'] as $user_id => $v) {
                 $user = Users::findById(array('id' => $user_id));
                 if ($user instanceof User) {
                     $phone_num = Users::getPhoneNumberCustomProperty($user_id);
                     $sms_obj = new SmsController();
                     $sms_obj->prepareEventInvitee($user->getDisplayName(), $event->getTitle(), get_class($event));
                     $sms_obj->sendSms($phone_num);
                 }
             }
             if (!logged_user()->isMemberOfOwnerCompany()) {
                 $event->setIsPrivate(false);
             }
             DB::beginWork();
             $event->save();
             $event->setTagsFromCSV(array_var($event_data, 'tags'));
             $object_controller = new ObjectController();
             $object_controller->add_to_workspaces($event);
             $object_controller->link_to_new_object($event);
             $object_controller->add_subscribers($event);
             $object_controller->add_custom_properties($event);
             $object_controller->add_reminders($event);
             $event->resetIsRead();
             ApplicationLogs::createLog($event, $event->getWorkspaces(), ApplicationLogs::ACTION_EDIT);
             DB::commit();
             flash_success(lang('success edit event', clean($event->getObjectName())));
             if (array_var($_POST, 'popup', false)) {
                 ajx_current("reload");
             } else {
                 ajx_current("back");
             }
             ajx_add("overview-panel", "reload");
         } catch (Exception $e) {
             DB::rollback();
             flash_error($e->getMessage());
             ajx_current("empty");
             //tpl_assign('error', $e);
         }
         // try
     }
     // if
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:101,代码来源:EventController.class.php


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