當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Current_User::getEmail方法代碼示例

本文整理匯總了PHP中Current_User::getEmail方法的典型用法代碼示例。如果您正苦於以下問題:PHP Current_User::getEmail方法的具體用法?PHP Current_User::getEmail怎麽用?PHP Current_User::getEmail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Current_User的用法示例。


在下文中一共展示了Current_User::getEmail方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: userSignup

 public function userSignup()
 {
     if (!$this->signup->sheet->id) {
         PHPWS_Core::errorPage('404');
     }
     $sheet = $this->signup->sheet;
     $peep = $this->signup->peep;
     if (Current_User::isLogged() && empty($peep->email)) {
         $peep->email = Current_User::getEmail();
     }
     if ($sheet->end_time < time()) {
         $this->signup->title = dgettext('signup', 'Sorry');
         $this->signup->content = dgettext('signup', 'We are no longer accepting applications.');
         return;
     }
     $slots = $sheet->getAllSlots();
     $slots_filled = $sheet->totalSlotsFilled();
     if (empty($slots)) {
         $this->signup->title = dgettext('signup', 'Sorry');
         $this->signup->content = dgettext('signup', 'There is a problem with this signup sheet. Please check back later.');
         return;
     }
     $this->signup->title =& $sheet->title;
     foreach ($slots as $slot) {
         // if the slots are filled, don't offer it
         if ($slots_filled && isset($slots_filled[$slot->id])) {
             $filled =& $slots_filled[$slot->id];
             if ($filled >= $slot->openings) {
                 continue;
             } else {
                 $openings_left = $slot->openings - $filled;
             }
         } else {
             $openings_left =& $slot->openings;
         }
         $options[$slot->id] = sprintf(dngettext('signup', '%s (%s opening)', '%s (%s openings)', $openings_left), $slot->title, $openings_left);
     }
     if (!isset($options)) {
         $this->signup->content = dgettext('signup', 'Sorry, but all available slots are full. Please check back later for possible cancellations.');
         return;
     } else {
         $form = new PHPWS_Form('slots');
         $form->useFieldset();
         $form->setLegend(dgettext('signup', 'Signup form'));
         $form->addHidden('module', 'signup');
         $form->addHidden('uop', 'slot_signup');
         $form->addHidden('sheet_id', $this->signup->sheet->id);
         $form->addSelect('slot_id', $options);
         $form->setLabel('slot_id', dgettext('signup', 'Available slots'));
         $form->setMatch('slot_id', $peep->slot_id);
         $form->addText('first_name', $peep->first_name);
         $form->setLabel('first_name', dgettext('signup', 'First name'));
         $form->addText('last_name', $peep->last_name);
         $form->setLabel('last_name', dgettext('signup', 'Last name'));
         $form->addText('email', $peep->email);
         $form->setSize('email', 30);
         $form->setLabel('email', dgettext('signup', 'Email address'));
         $form->addText('phone', $peep->getPhone());
         $form->setSize('phone', 15);
         $form->setLabel('phone', dgettext('signup', 'Phone number'));
         if (!empty($this->signup->sheet->extra1)) {
             $form->addText('extra1', $peep->extra1);
             $form->setLabel('extra1', $this->signup->sheet->extra1);
         }
         if (!empty($this->signup->sheet->extra2)) {
             $form->addText('extra2', $peep->extra2);
             $form->setLabel('extra2', $this->signup->sheet->extra2);
         }
         if (!empty($this->signup->sheet->extra3)) {
             $form->addText('extra3', $peep->extra3);
             $form->setLabel('extra3', $this->signup->sheet->extra3);
         }
         $form->addSubmit(dgettext('signup', 'Submit'));
         $tpl = $form->getTemplate();
     }
     $tpl['DESCRIPTION'] = $sheet->getDescription();
     $this->signup->content = PHPWS_Template::process($tpl, 'signup', 'signup_form.tpl');
     $this->signup->sheet->flag();
 }
開發者ID:HaldunA,項目名稱:phpwebsite,代碼行數:79,代碼來源:Forms.php

示例2: send_emails

 public function send_emails()
 {
     if (empty($_REQUEST['subject'])) {
         return Notification::show_edit_email('You must fill in the subject line of the email.', '', $_REQUEST['body']);
     } else {
         if (empty($_REQUEST['body'])) {
             return Notification::show_edit_email('You must fill in the message to be sent.', $_REQUEST['subject'], '');
         }
     }
     $from = isset($_REQUEST['anonymous']) && Current_User::allow('hms', 'anonymous_notification') ? FROM_ADDRESS : Current_User::getEmail();
     $subject = $_REQUEST['subject'];
     $body = $_REQUEST['body'];
     //Consider using a batch process instead of doing this this inline
     PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
     PHPWS_Core::initModClass('hms', 'HMS_Email.php');
     PHPWS_Core::initModClass('hms', 'HMS_Activity_Log.php');
     // Log that this is happening
     if ($from == FROM_ADDRESS) {
         HMS_Activity_Log::log_activity(Current_User::getUsername(), ACTIVITY_ANON_NOTIFICATION_SENT, Current_User::getUsername());
     } else {
         HMS_Activity_Log::log_activity(Current_User::getUsername(), ACTIVITY_NOTIFICATION_SENT, Current_User::getUsername());
     }
     if (is_array($_REQUEST['hall'])) {
         foreach ($_REQUEST['hall'] as $hall_id) {
             $hall = new HMS_Residence_Hall($hall_id);
             $floors = $hall->get_floors();
             foreach ($floors as $floor) {
                 $rooms = $floor->get_rooms();
                 foreach ($rooms as $room) {
                     $students = $room->get_assignees();
                     foreach ($students as $student) {
                         HMS_Email::send_email($student->asu_username . '@appstate.edu', $from, $subject, $body);
                     }
                 }
             }
             if ($from == FROM_ADDRESS) {
                 HMS_Activity_Log::log_activity(Current_User::getUsername(), ACTIVITY_HALL_NOTIFIED_ANONYMOUSLY, Current_User::getUsername(), $hall->hall_name);
             } else {
                 HMS_Activity_Log::log_activity(Current_User::getUsername(), ACTIVITY_HALL_NOTIFIED, Current_User::getUsername(), $hall->hall_name);
             }
         }
     } else {
         $hall = new HMS_Residence_Hall($_REQUEST['hall']);
         $floors = $hall->get_floors();
         foreach ($floors as $floor) {
             $rooms = $floor->get_rooms();
             foreach ($rooms as $room) {
                 $students = $room->get_assignees();
                 foreach ($students as $student) {
                     HMS_Email::send_email($student->asu_username . '@appstate.edu', $from, $subject, $body);
                 }
             }
         }
         if ($from == FROM_ADDRESS) {
             HMS_Activity_Log::log_activity(Current_User::getUsername(), ACTIVITY_HALL_NOTIFIED_ANONYMOUSLY, Current_User::getUsername(), $hall->hall_name);
         } else {
             HMS_Activity_Log::log_activity(Current_User::getUsername(), ACTIVITY_HALL_NOTIFIED, Current_User::getUsername(), $hall->hall_name);
         }
     }
     return Notification::show_confirmation();
 }
開發者ID:jlbooker,項目名稱:homestead,代碼行數:61,代碼來源:Notification.php


注:本文中的Current_User::getEmail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。