コード例 #1
0
 /**
  * Finds the ObjectGroupRecord model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return ObjectGroupRecord the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = ObjectGroupRecord::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #2
0
 public function actionCreateGroup()
 {
     $model = \Yii::createObject(ObjectGroupRecord::className());
     if (($errors = $this->performAjaxValidation($model)) !== null) {
         return $errors;
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['index', 'groupId' => $model->ID]);
     }
     return $this->render('index', ['content' => $this->renderPartial('_groupForm', ['model' => $model])]);
 }
コード例 #3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = ObjectGroupRecord::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['ID' => $this->ID, 'Deleted' => $this->Deleted, 'RoomID' => $this->RoomID, 'IsWicket' => $this->IsWicket, 'WicketCounter' => $this->WicketCounter, 'WicketLimit' => $this->WicketLimit]);
     $query->andFilterWhere(['like', 'Name', $this->Name])->andFilterWhere(['like', 'Description', $this->Description])->andFilterWhere(['like', 'Image', $this->Image]);
     return $dataProvider;
 }
コード例 #4
0
ファイル: index.php プロジェクト: just-leo/cardgame-serial
 *
 * (c) Dektrium project <http://github.com/dektrium>
 *
 * For the full copyright and license information, please view the LICENSE.md
 * file that was distributed with this source code.
 */
use common\models\cf\ObjectGroupRecord;
use yii\bootstrap\Nav;
use yii\helpers\Html;
use yii\web\View;
/**
 * @var View $this
 */
$this->title = Yii::t('app', 'Object Records');
$this->params['breadcrumbs'][] = $this->title;
$objectGroups = ObjectGroupRecord::find()->all();
$tabs = [];
$tabs[] = ['label' => 'Без группы', 'url' => ['/objects/index'], 'active' => isset($groupId) && $groupId === 0];
foreach ($objectGroups as $group) {
    $tabs[] = ['label' => $group->Name, 'url' => ['/objects/index', 'groupId' => $group->ID]];
}
?>
<div class="row">
    <div class="btn-group pull-right">
        <?php 
echo Html::a('<i class="glyphicon glyphicon-plus"></i> ' . Yii::t('app', 'Create Object'), ['create', 'groupId' => isset($groupId) ? $groupId : 0], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a('<i class="fa fa-object-ungroup"></i> ' . Yii::t('app', 'Create Object group'), ['/objects/create-group'], ['class' => 'btn btn-default']);
?>
        <?php 
コード例 #5
0
ファイル: _form.php プロジェクト: just-leo/cardgame-serial
/* @var $model common\models\cf\ObjectRecord */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="object-record-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'Name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'GroupID')->dropdownList(\common\models\cf\ObjectGroupRecord::find()->select(['Name', 'ID'])->indexBy('ID')->column(), ['prompt' => 'Без группы']);
?>

    <?php 
echo $form->field($model, 'RoomID')->dropdownList(\common\models\cf\RoomRecord::find()->select(['Name', 'ID'])->indexBy('ID')->column(), ['prompt' => 'Выберите зал']);
?>

    <?php 
echo $form->field($model, 'HardID')->textInput();
?>

    <?php 
echo $form->field($model, 'CoinPrice')->textInput();
?>

    <?php 
コード例 #6
0
 /**
  * @return ObjectGroupRecord
  */
 public function getGroup()
 {
     return $this->hasOne(ObjectGroupRecord::className(), ['ID' => 'GroupID']);
 }