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


PHP CommonFunctions::getCurrentGroup方法代码示例

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


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

示例1: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  *
  * Typical usecase:
  * - Initialize the model fields with values from filter form.
  * - Execute this method to get CActiveDataProvider instance which will filter
  * models according to data in model fields.
  * - Pass data provider to CGridView, CListView or any similar widget.
  *
  * @return CActiveDataProvider the data provider that can return the models
  * based on the search/filter conditions.
  */
 public function search()
 {
     // @todo Please modify the following code to remove attributes that should not be searched.
     $criteria = new CDbCriteria();
     $criteria->compare('id', $this->id);
     $criteria->compare('username', $this->username, true);
     $criteria->compare('password', $this->password, true);
     $criteria->compare('email', $this->email, true);
     $criteria->compare('login_attempts', $this->login_attempts);
     $criteria->compare('last_login_time', $this->last_login_time, true);
     $criteria->compare('create_time', $this->create_time, true);
     $criteria->compare('update_time', $this->update_time, true);
     $group = CommonFunctions::getCurrentGroup();
     if (null === $group) {
         throw new CHttpException(404, 'The current group is not specified.');
     }
     $criteria->compare('group_id', $group->id);
     return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => false));
 }
开发者ID:vanminh0910,项目名称:shangri-la,代码行数:31,代码来源:User.php

示例2: array

<?php

/* @var $this EventController */
/* @var $dataProvider CActiveDataProvider */
$this->breadcrumbs = array('Events');
$this->menu = array(array('label' => 'Create Event', 'url' => array('create')), array('label' => 'Manage Event', 'url' => array('admin')));
?>

<h1>Matches</h1>
<h3>Group: <?php 
echo CommonFunctions::getCurrentGroup()->name;
?>
</h3>
<div>
<table id="table_events" class="table">
    <?php 
foreach ($data as $d) {
    if ($d['type'] == 'date') {
        echo '<tr class="date">' . '<td colspan="4"><h3>' . $d['data'] . '</h3></td>' . '</tr>';
    } else {
        if ($d['type'] == 'event') {
            $event = $d['data'];
            echo '<tr class="event">' . '<td></td>' . '<td>' . date('h:i A', strtotime($event->start_time)) . '</td>' . '<td>' . $event->name . '</td>' . '<td><button type="button" class="btn btn-primary" id="' . $event->id . '">Show Bets</button></td>' . '</tr>';
        } else {
            if ($d['type'] == 'bet') {
                echo '<tr class="bet">' . '<td colspan="4">' . $d['type'] . '</td>' . '</tr>';
            }
        }
    }
}
?>
开发者ID:vanminh0910,项目名称:shangri-la,代码行数:31,代码来源:listing.php

示例3: getEventsList

 public static function getEventsList()
 {
     // select all matches starting in next 2 days
     //$gid = CommonFunctions::getCurrentGroup()->id;
     $group = CommonFunctions::getCurrentGroup();
     if (null === $group) {
         throw new CHttpException(404, 'The current group is not specified.');
     }
     $criteria = new CDbCriteria();
     $criteria->addCondition("start_time BETWEEN '" . date('Y-m-d') . "' AND '" . date('Y-m-d', strtotime('5 days')) . "'");
     $criteria->addColumnCondition(array("group_id" => $group->id, "status" => Event::STATUS_PUBLISHED));
     $criteria->order = 'start_time';
     $events = Event::model()->findAll($criteria);
     $result = new CList();
     $last_date = NULL;
     $format = "d_m_y";
     foreach ($events as $e) {
         // date row
         $current_date = date('m/d/y', strtotime($e->start_time));
         if ($current_date != $last_date) {
             $data = new CMap();
             $data['type'] = 'date';
             $data['data'] = $current_date;
             $result[] = $data;
             $last_date = $current_date;
         }
         // event data row
         $data = new CMap();
         $data['type'] = 'event';
         $data['data'] = $e;
         $result[] = $data;
         // bet detail row
         $data = new CMap();
         $data['type'] = 'bet';
         $data['data'] = $e;
         $result[] = $data;
     }
     return $result;
 }
开发者ID:vanminh0910,项目名称:shangri-la,代码行数:39,代码来源:Event.php


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