• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Events类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Events类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 [email protected] with any questions he might have.\n    Resolving.\n    - James");
     $participantIds = [["type" => "email", "value" => "[email protected]"], ["type" => "email", "value" => "[email protected]"], ["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


示例16: create

 /**
  * Vytvori entity, nebo vrati tuto existujici.
  * @param array
  * @return IEntity
  * @see IRepository::hydrateEntity()
  */
 public function create($data)
 {
     if ($this->conventional === NULL) {
         $this->conventional = $this->repository->getMapper()->getConventional();
         // speedup
         $this->primaryKey = $this->conventional->getPrimaryKey();
     }
     if (!isset($data[$this->primaryKey])) {
         throw new BadReturnException("Data, that is returned from storage, doesn't contain id.");
     }
     $id = $data[$this->primaryKey];
     if (!isset($this->entities[$id]) or !$this->entities[$id]) {
         $data = (array) $this->conventional->formatStorageToEntity($data);
         $entityName = $this->repository->getEntityClassName($data);
         $this->checkEntityClassName($entityName);
         $entity = unserialize("O:" . strlen($entityName) . ":\"{$entityName}\":0:{}");
         if (!$entity instanceof IEntity) {
             throw new InvalidEntityException('Unserialize error');
         }
         $args = array('data' => $data);
         $this->events->fireEvent(Events::HYDRATE_BEFORE, $entity, $args);
         $id = $entity->id;
         $this->entities[$id] = $entity;
         $this->events->fireEvent(Events::HYDRATE_AFTER, $entity, $args);
     }
     return $this->entities[$id];
 }
开发者ID:clevis,项目名称:orm,代码行数:33,代码来源:IdentityMap.php


示例17: build

 public static function build($statistic, $page = 1)
 {
     if ($statistic['type'] === 'all') {
         $bestPodiums = array();
         $eventIds = array_keys(Events::getNormalEvents());
         $temp = $statistic;
         $temp['type'] = 'single';
         foreach ($eventIds as $eventId) {
             $temp['eventId'] = $eventId;
             $bestPodiums[$eventId] = self::build($temp);
         }
         return self::makeStatisticsData($statistic, array('statistic' => $bestPodiums, 'select' => Events::getNormalEvents(), 'selectHandler' => 'Yii::t("event", "$name")', 'selectKey' => 'event'));
     }
     $eventId = $statistic['eventId'];
     $type = self::getType($eventId);
     $command = Yii::app()->wcaDb->createCommand();
     $command->select(array('r.competitionId', 'r.eventId', 'r.roundId', self::getSelectSum($eventId, $type), 'c.cellName', 'c.cityName', 'c.year', 'c.month', 'c.day'))->from('Results r')->leftJoin('Competitions c', 'r.competitionId=c.id')->where('r.eventId=:eventId', array(':eventId' => $eventId))->andWhere('r.roundId IN ("c", "f")')->andWhere('r.pos IN (1,2,3)')->andWhere('c.countryId="China"')->andWhere("r.{$type} > 0");
     $cmd = clone $command;
     $command->group('r.competitionId')->order('sum ASC')->having('count(DISTINCT pos)<=3 AND count(pos)>=3')->limit(self::$limit)->offset(($page - 1) * self::$limit);
     $columns = array(array('header' => 'Yii::t("common", "Competition")', 'value' => 'CHtml::link(ActiveRecord::getModelAttributeValue($data, "name"), $data["url"])', 'type' => 'raw'), array('header' => 'Yii::t("Competition", "Date")', 'value' => '$data["date"]', 'type' => 'raw'), array('header' => 'Yii::t("statistics", "Sum")', 'value' => 'CHtml::tag("b", array(), $data["formatedSum"])', 'type' => 'raw'), array('header' => 'Yii::t("common", "Average")', 'value' => '$data["formatedAverage"]', 'type' => 'raw'), array('header' => 'Yii::t("statistics", "First")', 'value' => self::makePosValue('first'), 'type' => 'raw'), array('header' => '', 'value' => self::makePosResultValue('first')), array('header' => 'Yii::t("statistics", "Second")', 'value' => self::makePosValue('second'), 'type' => 'raw'), array('header' => '', 'value' => self::makePosResultValue('second')), array('header' => 'Yii::t("statistics", "Third")', 'value' => self::makePosValue('third'), 'type' => 'raw'), array('header' => '', 'value' => self::makePosResultValue('third')));
     $rows = array();
     foreach ($command->queryAll() as $row) {
         $row = self::getCompetition($row);
         self::setPodiumsResults($row, $type);
         $row['formatedSum'] = self::formatSum($row);
         $row['formatedAverage'] = self::formatAverage($row);
         $row['date'] = sprintf("%d-%02d-%02d", $row['year'], $row['month'], $row['day']);
         $rows[] = $row;
     }
     $statistic['count'] = $cmd->select('count(DISTINCT r.competitionId) AS count')->queryScalar();
     $statistic['rank'] = ($page - 1) * self::$limit;
     $statistic['rankKey'] = 'sum';
     return self::makeStatisticsData($statistic, $columns, $rows);
 }
开发者ID:sunshy360,项目名称:cubingchina,代码行数:34,代码来源:BestPodiums.php


示例18: index

 public function index()
 {
     $this->load->parser();
     $validation_rules = array(array('field' => 'email_test_form_captcha', 'label' => 'Captcha', 'rules' => 'nohtml|trim|callback__captcha'));
     $success = false;
     $messages = array();
     $this->form_validation->set_rules($validation_rules);
     if ($this->form_validation->run()) {
         $custom_text = $this->input->post('custom_text');
         $custom_html = trim($custom_text) != '' ? $this->parser->parse_string($custom_text, null, true, array('textile' => array('restricted_mode' => true))) : '';
         $success = (bool) Events::trigger('email_test', array('custom_text' => $custom_html));
         if ($success) {
             $messages[] = $this->lang->line('mailer_your_message_has_been_sent');
         } else {
             if ($this->registry->get('email_debugger') != '') {
                 $messages[] = $this->lang->line('mailer_error') . '<br /><br />' . $this->registry->get('email_debugger');
             } else {
                 $messages[] = $this->lang->line('mailer_error');
             }
         }
     } else {
         $messages = validation_errors_array();
     }
     extract(Modules::run('email/test/get_message'));
     $has_logo = file_exists(DEFAULTFCPATH . 'apple-touch-icon-precomposed.png');
     $body = $this->parser->parse_string($body, array('has_logo' => $has_logo, 'logo_src' => default_base_url('apple-touch-icon-precomposed.png')), true, 'mustache');
     $this->captcha->clear();
     $this->template->set(compact('success', 'messages', 'subject', 'body'))->enable_parser_body('i18n')->build('email_test');
 }
开发者ID:Qnatz,项目名称:starter-public-edition-4,代码行数:29,代码来源:Email_test_controller.php


示例19: afterDelete

 public function afterDelete()
 {
     parent::afterDelete();
     if ($this->countByAttributes(['event_id' => $this->event_id]) == 0) {
         Events::model()->deleteByPk($this->event_id);
     }
 }
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:7,代码来源:Moderate.php


示例20: Cache

 /**
  * Função para definir uso de cache na Query
  * 
  * @access public
  * @return \MySQLTableCached
  */
 public function Cache($iTimeout = 3600)
 {
     Storage::Set("cachedb.timeout", $iTimeout);
     Events::Set("BeforeQuery", function ($sSQL, $fCallback) {
         if (Storage::Get("cachedb.enabled", false)) {
             $mCache = @CacheDB::Get(sha1($sSQL));
             if ($mCache !== false && !is_null($mCache)) {
                 if ($fCallback) {
                     $fCallback(json_decode($mCache, true), null);
                 }
                 return true;
             } else {
                 return false;
             }
         } else {
             return false;
         }
     });
     Events::Set("AfterQuery", function ($sSQL, $aResult) {
         if (Storage::Get("cachedb.enabled", false)) {
             @CacheDB::Set(sha1($sSQL), json_encode($aResult), Storage::Get("cachedb.timeout", 3600));
         }
     });
     return $this;
 }
开发者ID:magicphp,项目名称:cachedb,代码行数:31,代码来源:mysqlcache.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ExampleForm类代码示例发布时间:2022-05-23
下一篇:
PHP Evento类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap