當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。