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


PHP Events类代码示例

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


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

示例1: bindToShutdown

 /**
  *
  */
 protected function bindToShutdown()
 {
     if (!$this->shutdownBound) {
         $this->shutdownBound = true;
         $this->Events->bindEvent('shutdown', $this, 'handleShutdown');
     }
 }
开发者ID:wb-crowdfusion,项目名称:crowdfusion-advanced-media,代码行数:10,代码来源:ImagesQuickAddHandler.php

示例2: run

 public function run($id)
 {
     $formModel = new EventCommentPublisherFormModel();
     $profile = Yii::app()->params->profile;
     $model = $this->controller->lookUpModel($id, 'Events');
     $this->controller->dataUrl = Yii::app()->request->url;
     if ($model->checkPermissions('view')) {
         if (isset($_POST['EventCommentPublisherFormModel'])) {
             $formModel->setAttributes($_POST['EventCommentPublisherFormModel']);
             if (isset($_FILES['EventCommentPublisherFormModel'])) {
                 $model->photo = CUploadedFile::getInstance($model, 'photo');
             }
             if ($formModel->validate()) {
                 $event = new Events();
                 $event->setAttributes(array('visibility' => X2PermissionsBehavior::VISIBILITY_PUBLIC, 'user' => $profile->username, 'type' => 'structured-feed', 'associationType' => 'Events', 'associationId' => $id, 'text' => $formModel->text, 'photo' => $formModel->photo), false);
                 if ($event->save()) {
                     $formModel->text = '';
                     if (!isset($_FILES['EventCommentPublisherFormModel'])) {
                     } else {
                         Yii::app()->end();
                     }
                 } else {
                     throw new CHttpException(500, implode(';', $event->getAllErrorMessages()));
                 }
             }
         }
         $dataProvider = new CActiveDataProvider('Events', array('criteria' => array('order' => 'timestamp ASC', 'condition' => "type in ('comment', 'structured-feed') AND \n                         associationType='Events' AND associationId={$id}"), 'pagination' => array('pageSize' => 30)));
         $this->controller->render($this->pathAliasBase . 'views.mobile.viewEvent', array('model' => $model, 'dataProvider' => $dataProvider, 'formModel' => $formModel));
     } else {
         $this->controller->denied();
     }
 }
开发者ID:dsyman2,项目名称:X2CRM,代码行数:32,代码来源:MobileViewEventAction.php

示例3: main

 function main()
 {
     $events = new Events();
     $person = (new Facebook())->person(S()->id());
     $events->signUp($_GET['event_id'], S()->id(), $person['name'], $person['link']);
     R('/');
 }
开发者ID:jthemphill,项目名称:tournament,代码行数:7,代码来源:index.php

示例4: getInstance

 /**
  * Allow one instance only!
  *
  * @return Events instance
  */
 public static function getInstance()
 {
     static $instance = false;
     if (!$instance) {
         $instance = new Events();
         $instance->initializeListeners();
     }
     return $instance;
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:14,代码来源:Events.php

示例5: listAction

 /**
  * Render data for view on list action
  */
 public function listAction()
 {
     if ($this->_getParam('day', false)) {
         $this->view->day = $this->_getParam('day');
         $events = new Events();
         $this->view->events = $events->getEventsDate($this->_getParam('day'));
     } else {
         throw new Pas_Exception_Param($this->_missingParameter);
     }
 }
开发者ID:rwebley,项目名称:Beowulf---PAS,代码行数:13,代码来源:UpcomingController.php

示例6: testFire

 /**
  * @todo Implement testFire().
  */
 public function testFire()
 {
     $observer = new EventsTestObserver();
     $this->object->extend('fire', $observer, 'invoke', null);
     $this->object->fire('dontfire', array('a' => 1, 'b' => 2));
     $this->assertEquals(0, $observer->invoked);
     $this->object->fire('fire', array('a' => 18, 'b' => 81));
     $this->assertEquals(1, $observer->invoked);
     $this->assertEquals(81, $observer->lastArgs['b']);
 }
开发者ID:notzen,项目名称:concrete5-tests,代码行数:13,代码来源:EventsTest.php

示例7: calendar_cron

function calendar_cron()
{
    require 'includes/classes/events.class.php';
    require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php';
    //Iterate through each member's preference
    $sql = "SELECT * FROM %scalendar_notification WHERE 1=1";
    $rows_notify = queryDB($sql, array(TABLE_PREFIX));
    $event_obj = new Events();
    foreach ($rows_notify as $row) {
        //Send email only when preference is 1
        if ($row['status'] == 1) {
            $all_events = array();
            $mail = new ATutorMailer();
            //Get personal events
            $personal_events = $event_obj->get_personal_events($row['memberid']);
            foreach ($personal_events as $event) {
                $all_events[] = $event;
            }
            //Get course events
            $sql_q = "SELECT course_id FROM %scourse_enrollment WHERE member_id = %d";
            $rows_enrolled = queryDB($sql_q, array(TABLE_PREFIX, TABLE_PREFIX));
            foreach ($rows_enrolled as $row_q) {
                $course_events = $event_obj->get_atutor_events($row['memberid'], $row_q['course_id']);
                foreach ($course_events as $event) {
                    $all_events[] = $event;
                }
            }
            //Iterate through each event and keep only those events which will start tomorrow
            $email_msg = _AT('calendar_noti_mail_1') . "\n";
            $index = 1;
            foreach ($all_events as $id => $event) {
                if (strtotime(substr($event['start'], 0, 10)) == strtotime('tomorrow')) {
                    $email_msg .= _AT('calendar_noti_mail_2') . " #" . $index . " \n";
                    $email_msg .= _AT('calendar_noti_mail_3') . ": " . substr($event['start'], 0, 10) . " \n";
                    $email_msg .= _AT('calendar_noti_mail_4') . ": " . substr($event['end'], 0, 10) . " \n";
                    $email_msg .= _AT('calendar_noti_mail_5') . ": " . $event['title'] . " \n\n";
                    $index++;
                }
            }
            //Send email using ATutor mailer
            $mail->From = $_config['contact_email'];
            $mail->FromName = $_config['site_name'];
            $mail->AddAddress($_config['contact_email']);
            $mail->Subject = $stripslashes(_AT('calendar_noti_title'));
            $mail->Body = $email_msg;
            $sql_email = "SELECT email FROM %smembers WHERE member_id = %d";
            $row_email = queryDB($sql_email, array(TABLE_PREFIX, $row['memberid']), TRUE);
            $mail->AddBCC($row_email['email']);
            $mail->Send();
            unset($mail);
            //For testing
            // echo "<br/>".$email_msg."<br/>".$row_email['mail'];
        }
    }
}
开发者ID:genaromendezl,项目名称:ATutor,代码行数:55,代码来源:module_cron.php

示例8: testEvent

 public function testEvent()
 {
     Client::relateIQ(GlobalVar::KEY, GlobalVar::SECRET);
     $event = new Events([]);
     $event->subject("Support Ticket #12345: How do I create an event?");
     $event->body("Just called Tim and walked him through how to create an event with the new API.\n    He'll reach out to support@relateiq.com with any questions he might have.\n    Resolving.\n    - James");
     $participantIds = [["type" => "email", "value" => "james.mcsales@relateiq.com"], ["type" => "email", "value" => "tim.archer@avocado.com"], ["type" => "phone", "value" => "8001235555"]];
     $event->participantIds($participantIds);
     $res = $event->update();
     $this->assertInstanceOf('Events', $res);
 }
开发者ID:vicioux,项目名称:apisdk,代码行数:11,代码来源:events_test.php

示例9: testFire

 /**
  * @todo Implement testFire().
  */
 public function testFire()
 {
     $observer = new EventsTestObserver();
     $this->object->addListener('fire', array($observer, 'invoke'));
     $event = new GenericEvent('dontfire', array('a' => 1, 'b' => 2));
     $this->object->dispatch('dontfire');
     $this->assertEquals(0, $observer->invoked);
     $event = new GenericEvent('fire', array('a' => 18, 'b' => 81));
     $this->object->dispatch('fire', $event);
     $this->assertEquals(1, $observer->invoked);
     $this->assertEquals('81', $observer->event['b']);
 }
开发者ID:masteramuk,项目名称:concrete5,代码行数:15,代码来源:EventsTest.php

示例10: actionIndex

 public function actionIndex()
 {
     $event = new Events();
     $event->attributes = $_GET;
     if (!isset($_GET['content_id'])) {
         $content = Content::model()->findByAttributes(array('slug' => Cii::get($_GET, 'uri', NULL)));
         if ($content !== NULL) {
             $event->content_id = $content->id;
         }
     }
     if ($event->save()) {
         Yii::app()->end();
     }
     return $this->returnError(400, NULL, $event->getErrors());
 }
开发者ID:fandikurnia,项目名称:CiiMS,代码行数:15,代码来源:EventController.php

示例11: addEvent

 static function addEvent($inputs)
 {
     $event = new Events();
     $event->name = $inputs['eventName'];
     $event->event_description = $inputs['eventDescription'];
     $event->event_date = date("Y-m-d", strtotime($inputs['eventDate']));
     $event->area = $inputs['eventLocation'];
     $event->type = $inputs['eventType'];
     $event->state = $inputs['state'];
     $event->city = $inputs['city'];
     $event->created_by = Session::get('userId');
     $event->created_at = date("Y-m-d H:i:s");
     $event->save();
     return $event;
 }
开发者ID:Headrun-php,项目名称:TLG,代码行数:15,代码来源:Events.php

示例12: testIteratorReturnsWrappedEvents

 /** @dataProvider provideIterators */
 public function testIteratorReturnsWrappedEvents($startKey, $expected)
 {
     $this->events->set('2009', '1');
     $this->events->set('2009', '2');
     $this->events->set('2009 12', '3');
     $this->events->set('2010', '4');
     $this->events->set('2011 12', '5');
     $this->events->set('2011 12 20', '6');
     $this->events->set('2013 7 7 7 7', '7');
     $iterator = $this->events->iterate($startKey);
     assertThat(iterator_to_array($iterator), identicalTo($expected));
 }
开发者ID:scortescz,项目名称:calendar,代码行数:13,代码来源:EventsTest.php

示例13: on_start

 public function on_start()
 {
     Loader::helper('ms_route', 'multisite');
     if (!User::isLoggedIn()) {
         Events::extend('on_before_render', 'MsRouter', 'render', 'packages/' . $this->pkgHandle . '/models/ms_router.php');
     }
 }
开发者ID:rmxdave,项目名称:multisite,代码行数:7,代码来源:controller.php

示例14: getEvent

 public function getEvent($id)
 {
     if (Session::has('in') && !strcmp(Session::get('in'), 'gautepJ9')) {
         return View::make('events.eventDisplay')->with('entries', Events::find($id));
     }
     return Redirect::to('admin/login')->with('isErr', true)->with('msg', 'You need to login first.');
 }
开发者ID:bullbuxter,项目名称:anandotsava.in,代码行数:7,代码来源:EventsController.php

示例15: group

 /**
  * Shows the permissions for a specific user group.
  *
  * @param int $group_id The id of the group to show permissions for.
  */
 public function group($group_id)
 {
     $this->load->library('form_validation');
     if ($_POST) {
         $modules = $this->input->post('modules');
         $roles = $this->input->post('module_roles');
         // Save the permissions.
         if ($this->permission_m->save($group_id, $modules, $roles)) {
             // Fire an event. Permissions have been saved.
             Events::trigger('permissions_saved', array($group_id, $modules, $roles));
         }
         $this->session->set_flashdata('success', lang('permissions:message_group_saved_success'));
         $this->input->post('btnAction') === 'save_exit' ? redirect('admin/permissions') : redirect('admin/permissions/group/' . $group_id);
     }
     // Get the group data
     $group = $this->group_m->get($group_id);
     // If the group data could not be retrieved
     if (!$group) {
         // Set a message to notify the user.
         $this->session->set_flashdata('error', lang('permissions:message_no_group_id_provided'));
         // Send him to the main index to select a proper group.
         redirect('admin/permissions');
     }
     // See if this is the admin group
     $group_is_admin = (bool) ($this->config->item('admin_group', 'ion_auth') == $group->name);
     // Get the groups permission rules (no need if this is the admin group)
     $edit_permissions = $group_is_admin ? array() : $this->permission_m->get_group($group_id);
     // Get all the possible permission rules from the installed modules
     $permission_modules = $this->module_m->get_all(array('is_backend' => true, 'installed' => true));
     foreach ($permission_modules as &$permission_module) {
         $permission_module['roles'] = $this->module_m->roles($permission_module['slug']);
     }
     $this->template->append_js('module::group.js')->set('edit_permissions', $edit_permissions)->set('group_is_admin', $group_is_admin)->set('permission_modules', $permission_modules)->set('group', $group)->build('admin/group');
 }
开发者ID:nockout,项目名称:tshpro,代码行数:39,代码来源:admin.php


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