![]() |
It's kind of exciting—soon, Meeting Planner will be delivering invitations to invited participants. However, to support that, we need to make sure that the meeting view page is properly configured. If you created the meeting, you have certain powers, such as inviting participants, adding proposed meeting places, dates and times, and choosing the final selections. In some cases, the organizer may want to offer some or all of these powers to participants as well.
Essentially, we have to make the application aware of who's viewing the meeting page and then customize the appearance and commands available. Yii makes most of this pretty easy, but there's a lot of detail involved.
A Brief Caveat About the User Experience
And let me say up front, there is a lot of user experience rework and polish that will need to be done iteratively over time on the way to the minimum viable product (MVP). Most of what I'm building right now is core functionality to get the alpha running for actual usage. I know it looks rough in places and won't always seem as intuitive as you want. There are also coding inefficiencies that will need to be optimized in the future. Please feel free to post your thoughts and comments below and I will take them into account for ongoing work.
The Current Meeting View
Here's a look at the existing meeting view that the creator (or owner) sees:
![]() |
Certainly, as the product matures, we'll want to improve the user experience in a number of ways and polish it a lot, but here are a handful of functional elements we'd like to modify for participants:
- The Send button won't be needed after the owner delivers the invitation.
- Participants may or may not be allowed to Finalize meeting options.
- Participants won't be able to Edit (pencil icon) the meeting detail text.
- Participants won't be able to add People at this time (for our MVP).
- Participants may or may not be allowed to add Places (plus icon).
- Participants may or may not be allowed to add Dates & Times (plus icon).
- In both Places and Dates & Times panels, we'll want to show the current viewer's choices under the You column and the other person's data in Them.
- In both Places and Dates & Times panels, participants may or may not be able to Choose the final location and time.
Requirements Implementation
If you're following along with the code, the updates described here are included in this release on GitHub.
Who's the Current Viewer
The Yii Framework provides the current user_id for the viewer here:
- $user_id = Yii::$app->user->getId()
I've created a couple of helper functions in the Meeting model to make this faster:
- public function setViewer() {
- $this->viewer_id = Yii::$app->user->getId();
- if ($this->owner_id == $this->viewer_id) {
- $this->viewer = Meeting::VIEWER_ORGANIZER;
- } else {
- $this->viewer = Meeting::VIEWER_PARTICIPANT;
- }
- }
Building for Meeting Settings
Every meeting you create will likely have different characteristics. Sometimes, you'll want to limit the participant from suggesting different times and places or finalizing the details. Other times, you won't care. When we eventually create Meeting Templates for reusing common types of meetings, e.g. morning coffee business meetings, the Templates will likely need to retain these kinds of custom settings as well. How should we implement this?
First, I'd like to create a set of default preferences for users with respect to the meetings they create.
Then, I'll create a set of MeetingSettings for every meeting. When a meeting is created from scratch, they'll inherit the default preferences from the user that creates it. Editing the settings for individual meetings can be postponed until later.
In the future, when we implement the Meeting Templates, we'll add Meeting settings for the Templates too. However, this can also be postponed.
Here are the preferences that we'd like to create to start:
- Allow participants to add Places.
- Allow participants to add Dates & Times.
- Allow participants to choose Places.
- Allow participants to choose Dates & Times.
- Allow participants to Finalize the meeting.
First, we'll create the Meeting Settings migration:
- $ ./yii migrate/create meeting_setting_table
- Yii Migration Tool (based on Yii v2.0.7)
- Create new migration '/Users/Jeff/Sites/mp/console/migrations/m160401_203412_meeting_setting_table.php'? (yes|no) [no]:yes
- New migration created successfully.
- <?php
- use yii\db\Schema;
- use yii\db\Migration;
- class m160401_203412_meeting_setting_table extends Migration
- {
- public function up()
- {
- $tableOptions = null;
- if ($this->db->driverName === 'mysql') {
- $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
- }
- $this->createTable('{{%meeting_setting}}', [
- 'id' => Schema::TYPE_PK,
- 'meeting_id' => Schema::TYPE_INTEGER.' NOT NULL',
- 'participant_add_place' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 0',
- 'participant_add_date_time' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 0',
- 'participant_choose_place' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 0',
- 'participant_choose_date_time' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 0',
- 'participant_finalize' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 0',
- 'created_at' => Schema::TYPE_INTEGER . ' NOT NULL',
- 'updated_at' => Schema::TYPE_INTEGER . ' NOT NULL',
- ], $tableOptions);
- $this->addForeignKey('fk_meeting_setting', '{{%meeting_setting}}', 'meeting_id', '{{%meeting}}', 'id', 'CASCADE', 'CASCADE');
- }
- public function down()
- {
- $this->dropForeignKey('fk_meeting_setting', '{{%meeting_setting}}');
- $this->dropTable('{{%meeting_setting}}');
- }
- }
Each meeting essentially has a row of MeetingSettings with boolean properties for the various participant options I've shown above.
Then, we instruct Yii to migrate up and create the table:
- $ ./yii migrate/up
- Yii Migration Tool (based on Yii v2.0.7)
- Total 1 new migration to be applied:
- m160401_203412_meeting_setting_table
- Apply the above migration? (yes|no) [no]:yes
- *** applying m160401_203412_meeting_setting_table
- > create table {{%meeting_setting}} ... done (time: 0.010s)
- > add foreign key fk_meeting_setting: {{%meeting_setting}} (meeting_id) references {{%meeting}} (id) ... done (time: 0.011s)
- *** applied m160401_203412_meeting_setting_table (time: 0.040s)
- 1 migration was applied.
- Migrated up successfully.
Next, we'll use Yii's Gii to auto-generate code for viewing and updating the settings. To begin, I return to http://localhost:8888/mp/index.php/gii/. We'll start with generating the model:
![]() |
![]() |
![]() |
![]() |
Extending the User Preferences
For that, we'll add parallel meeting setting properties to the user_setting table. Again, we'll create a migration:
- $ ./yii migrate/create extend_user_setting_table
- Yii Migration Tool (based on Yii v2.0.7)
- Create new migration '/Users/Jeff/Sites/mp/console/migrations/m160401_210852_extend_user_setting_table.php'? (yes|no) [no]:yes
- New migration created successfully.
- class m160401_210852_extend_user_setting_table extends Migration
- {
- public function up()
- {
- $tableOptions = null;
- if ($this->db->driverName === 'mysql') {
- $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
- }
- $this->addColumn('{{%user_setting}}','participant_add_place',Schema::TYPE_SMALLINT.' NOT NULL');
- $this->addColumn('{{%user_setting}}','participant_add_date_time',Schema::TYPE_SMALLINT.' NOT NULL');
- $this->addColumn('{{%user_setting}}','participant_choose_place',Schema::TYPE_SMALLINT.' NOT NULL');
- $this->addColumn('{{%user_setting}}','participant_choose_date_time',Schema::TYPE_SMALLINT.' NOT NULL');
- $this->addColumn('{{%user_setting}}','participant_finalize',Schema::TYPE_SMALLINT.' NOT NULL');
- }
- public function down()
- {
- $this->dropColumn('{{%user_setting}}','participant_finalize');
- $this->dropColumn('{{%user_setting}}','participant_choose_date_time');
- $this->dropColumn('{{%user_setting}}','participant_choose_place');
- $this->dropColumn('{{%user_setting}}','participant_add_date_time');
- $this->dropColumn('{{%user_setting}}','participant_add_place');
- }
- }
- $ ./yii migrate/up
- Yii Migration Tool (based on Yii v2.0.7)
- Total 1 new migration to be applied:
- m160401_210852_extend_user_setting_table
- Apply the above migration? (yes|no) [no]:yes
- *** applying m160401_210852_extend_user_setting_table
- > add column participant_add_place smallint NOT NULL to table {{%user_setting}} ... done (time: 0.012s)
- > add column participant_add_date_time smallint NOT NULL to table {{%user_setting}} ... done (time: 0.007s)
- > add column participant_choose_place smallint NOT NULL to table {{%user_setting}} ... done (time: 0.010s)
- > add column participant_choose_date_time smallint NOT NULL to table {{%user_setting}} ... done (time: 0.009s)
- > add column participant_finalize smallint NOT NULL to table {{%user_setting}} ... done (time: 0.009s)
- *** applied m160401_210852_extend_user_setting_table (time: 0.061s)
- 1 migration was applied.
- Migrated up successfully.
![]() |
![]() |
![]() |
| Add caption |
- <div class="col-md-8">
- <!-- Nav tabs -->
- <ul class="nav nav-tabs" role="tablist">
- <li class="active"><a href="#general" role="tab" data-toggle="tab"><?= Yii::t('frontend','General Settings') ?></a></li>
- <li><a href="#preferences" role="tab" data-toggle="tab"><?= Yii::t('frontend','Meeting Preferences') ?></a></li>
- <li><a href="#photo" role="tab" data-toggle="tab"><?= Yii::t('frontend','Upload Photo') ?></a></li>
- </ul>
- <!-- Tab panes -->
- <div class="tab-content">
- ...
- </div>
- <div class="tab-pane vertical-pad" id="preferences">
- <?= $form->field($model, 'participant_add_place')->checkbox(['uncheck' => $model::SETTING_NO, 'checked' => $model::SETTING_YES]); ?>
- <?= $form->field($model, 'participant_add_date_time')->checkbox(['uncheck' => $model::SETTING_NO, 'checked' => $model::SETTING_YES]); ?>
- <?= $form->field($model, 'participant_choose_place')->checkbox(['uncheck' => $model::SETTING_NO, 'checked' => $model::SETTING_YES]); ?>
- <?= $form->field($model, 'participant_choose_date_time')->checkbox(['uncheck' => $model::SETTING_NO, 'checked' => $model::SETTING_YES]); ?>
- <?= $form->field($model, 'participant_finalize')->checkbox(['uncheck' => $model::SETTING_NO, 'checked' => $model::SETTING_YES]); ?>
- </div> <!-- end of upload meeting-settings tab -->
- <div class="tab-pane vertical-pad" id="photo">
- ...
![]() |
If you found this post interesting, please follow and support us.
Suggest for you:
Learning PHP 7: From the Basics to Application Development
The Complete PHP 7 Guide for Web Developers
Up to Speed with PHP 7
Learn PHP 7 This Way to Rise Above & Beyond Competion!
The Complete PHP with MySQL Developer Course (New)










No comments:
Post a Comment