未加星标

Building Your Startup: Requesting Scheduling Changes

字体大小 | |
[开发(php) 所属分类 开发(php) | 发布者 店小二04 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

Building Your Startup: Requesting Scheduling Changes
What You'll Be Creating

This tutorial is part of the Envato Tuts+ Building Your Startup Withphp series . In this series, I'm guiding you through launching a startup from concept to reality using my Meeting Planner app as a real-life example. Every step along the way, I'll release the Meeting Planner code as open-source examples you can learn from. I'll also address startup-related business issues as they arise.

Changing Your Meeting Plans

As the Meeting Planner alpha testing phase began, the clearest feature gap was the inability to change a meeting after it had been scheduled. It's not an easy problem. Is it okay to just change a meeting without a participant's permission? Or should you ask? Or do either, depending on your role in organizing the meeting? What if you just want to ask if it's okay to meet 15 minutes later―that should be easy, right?

Solving all this required some reflecting on the social aspects of adjusting a meeting.

Over time, I realized that the ability to adjust meetings easily after they've been scheduled could make or break the Meeting Planner brand.

In our last episode on Advanced Scheduling , I implemented Make Changes , which allows an organizer or participant with organizing permissions to essentially reschedule the meeting without asking permission. In today's tutorial, I'll walk you through building the Request Changes infrastructure. It requires thatparticipants request change(s) and then others can accept or decline them, affecting the final meeting calendar details.

While you're reading, I hope you'll try out the new "request a change" feature on the live site and share your thoughts and feedback in the comments below.I do participate in the discussions, but you can also reach me @reifman on Twitter. I'm always open to newfeature ideas for Meeting Planner as well as suggestions for future series episodes.

As a reminder, all the code for Meeting Planner is provided open source and written in the Yii2 Framework for PHP. If you'd like to learn more about Yii2, check out my parallel series Programming With Yii2 .

Let's get started.

Building Request Changes A Tall Mountain to Climb

Aside from the meeting view and scheduling features, Request Changes required more time and new code than any other feature on this project.

As I mentioned in the last episode, coding everything with basic security takes a bit longer than rapid prototyping, but designing and building this feature also touched a lot of other platform areas:

Designing with the social engineering of requesting and making schedule changes. Keeping the UX for change requests simple, helping people request and respond to change requests without cluttering the interface. Handling requests for 1:1 meetings would be easy, but coding for the upcoming multiple participants feature would require a much more sophisticated infrastructure. Handling the responses to requests with multiple participants ahead. Emailing notifications of new and withdrawn requests, accepted and declined responses. Updating the meeting confirmation and calendar details when accepted requests affect the schedule.

So, while this isn't a perfect picture of the changes just for this feature, here are screenshots of the eventual production server code pull.

Here are the changes to existing code:


Building Your Startup: Requesting Scheduling Changes

And here are the new files:


Building Your Startup: Requesting Scheduling Changes

There was a lot of new code involved with this feature.

The Tables and Their Migrations

Ultimately, I decided on an architecture built around two tables. The first was Requests :

$this->createTable('{{%request}}', [
'id' => Schema::TYPE_PK,
'meeting_id' => Schema::TYPE_INTEGER.' NOT NULL DEFAULT 0',
'requestor_id' => Schema::TYPE_BIGINT.' NOT NULL DEFAULT 0',
'completed_by' => Schema::TYPE_BIGINT.' NOT NULL DEFAULT 0',
'time_adjustment' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 0',
'alternate_time' => Schema::TYPE_BIGINT.' NOT NULL DEFAULT 0',
'meeting_time_id' => Schema::TYPE_BIGINT.' NOT NULL DEFAULT 0',
'place_adjustment' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 0',
'meeting_place_id' => Schema::TYPE_BIGINT.' NOT NULL DEFAULT 0',
'note' => Schema::TYPE_TEXT.' NOT NULL DEFAULT ""',
'status' => 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_request_meeting', '{{%request}}', 'meeting_id', '{{%meeting}}', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_request_user', '{{%request}}', 'requestor_id', '{{%user}}', 'id', 'CASCADE', 'CASCADE');

Here are the constants that explain the model further:

const STATUS_OPEN = 0;
const STATUS_ACCEPTED = 10;
const STATUS_REJECTED = 20;
const STATUS_WITHDRAWN = 30;
const TIME_ADJUST_NONE = 50;
const TIME_ADJUST_ABIT = 60;
const TIME_ADJUST_OTHER = 70;
const PLACE_ADJUST_NONE = 80;
const PLACE_ADJUST_OTHER = 90;

There would be two ways to adjust the time: TIME_ADJUST_ABIT , i.e. intervals of minutes or hours earlier or later than the chosen time, or TIME_ADJUST_OTHER , a different meeting time altogether.

And the second table was RequestResponses :

$this->createTable('{{%request_response}}', [
'id' => Schema::TYPE_PK,
'request_id' => Schema::TYPE_INTEGER.' NOT NULL DEFAULT 0',
'responder_id' => Schema::TYPE_BIGINT.' NOT NULL DEFAULT 0',
'note' => Schema::TYPE_TEXT.' NOT NULL DEFAULT ""',
'response' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 0',
'created_at' => Schema::TYPE_INTEGER . ' NOT NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NOT NULL',
], $tableOptions);

Basically, who requested the change, who responded to it and what the response was: accept or decline.

The second table is needed for a multiple participant environment.

Requesting a Change

Meeting organizers and participants can access Request Changes via the dropdown Options menu that we built in the last episode:


Building Your Startup: Requesting Scheduling Changes
The Request Change Form

RequestController.php's actionCreate() loads the form from which the user's request changes:


Building Your Startup: Requesting Scheduling Changes
And here's where the complexity began. What kinds of changes could participants req

本文开发(php)相关术语:php代码审计工具 php开发工程师 移动开发者大会 移动互联网开发 web开发工程师 软件开发流程 软件开发工程师

主题: AUPHPTITwitter
分页:12
转载请注明
本文标题:Building Your Startup: Requesting Scheduling Changes
本站链接:http://www.codesec.net/view/531299.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 开发(php) | 评论(0) | 阅读(15)