public function getTypes()
 {
     $types = ActivityType::all();
     $results = array();
     foreach ($types as $type) {
         $results[$type['id']] = $type['name'];
     }
     return $results;
 }
示例#2
0
 public function getActivityTypeThemeColorById($id)
 {
     $raw = ActivityType::findOne($id);
     return $raw['color'];
 }
示例#3
0
</span><br>
                                    <span class="time"><?php 
        echo date("g:i A", strtotime($row['startDatetime']));
        ?>
</span>
                                </td>
                                <td class="activity-schedule-detail" style="border-left-color: <?php 
        echo \app\models\ActivityType::getActivityTypeThemeColorById($row['ActivityType_id']);
        ?>
">
                                    <span class="title"><?php 
        echo $row['Activity_name'];
        ?>
</span><br>
                                    <span class="type"><?php 
        echo \app\models\ActivityType::getActivityTypeNameById($row['ActivityType_id']);
        ?>
</span>
                                </td>
                                <td class="activity-schedule-venue"><?php 
        echo \app\models\Venue::getVenueNameById($row['Venue_id']);
        ?>
</td>

                            </tr>
                        </table>
                    </a>
            <?php 
    }
    ?>
    <?php 
示例#4
0
    ?>
</h1>
                    <p><?php 
    echo $model->description;
    ?>
</p>
                    <?php 
    $imgLink = '@web/../resources/activities/activity_' . $model->id . '.jpg';
    ?>
                    <p class="text-center"><?php 
    echo Html::img($imgLink, ['class' => 'activity-detail-img']);
    ?>
</p>
                </div>
                <div class="col-sm-4 activity-detail-technical" style="background-color: <?php 
    echo \app\models\ActivityType::getActivityTypeThemeColorById($model->ActivityType_id);
    ?>
">
                    <?php 
    if (!Yii::$app->user->isGuest && strtotime($model->startDatetime) - time() > 0) {
        ?>
                        <?php 
        if (!\app\models\ParticipantHasActivity::checkHasJoin($model->id)) {
            ?>
                            <?php 
            echo Html::a('Add to your Schedule', ['/participant-has-activity/join', 'activityId' => $model->id], ['class' => 'btn btn-default']);
            ?>
                        <?php 
        } else {
            ?>
                            <?php 
 /**
  * Finds the ActivityType model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return ActivityType the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = ActivityType::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#6
0
echo $form->field($model, 'startDatetime')->widget(DateTimePicker::className(), ['language' => 'en', 'template' => '{input}', 'pickButtonIcon' => 'glyphicon glyphicon-time', 'inline' => false, 'clientOptions' => ['startDate' => date("Y-m-d"), 'autoclose' => true, 'linkFormat' => 'yyyy-mm-dd hh:ii:ss']]);
?>

    <?php 
echo $form->field($model, 'endDatetime')->widget(DateTimePicker::className(), ['language' => 'en', 'template' => '{input}', 'pickButtonIcon' => 'glyphicon glyphicon-time', 'inline' => false, 'clientOptions' => ['startDate' => date("Y-m-d"), 'endDate' => date("2017-01-01"), 'autoclose' => true, 'linkFormat' => 'yyyy-mm-dd hh:ii:ss']]);
?>

    <?php 
echo $form->field($model, 'Venue_id')->dropDownList(\app\models\Venue::getVenueOptions(), array('prompt' => '-- Select a Venue --'));
?>

    <?php 
echo $form->field($model, 'Topic_id')->dropDownList(\app\models\Topic::getTopicOptions(), array('prompt' => '-- Select a Topic --'));
?>

    <?php 
echo $form->field($model, 'ActivityType_id')->dropDownList(\app\models\ActivityType::getActivityTypeOptions(), array('prompt' => '-- Select a Type --'));
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
示例#7
0
 public function getActivityType()
 {
     return $this->hasOne(ActivityType::className(), ['id' => 'ActivityType_id']);
 }