5 * Repondez s'il vous plait - an answer to an invitation
7 * @author Christian Weiske <cweiske@cweiske.de>
8 * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3
9 * @link http://cweiske.de/shpub.htm
11 class Command_Rsvp extends Command_AbstractProps
13 public static function opts(\Console_CommandLine $optParser)
15 $cmd = $optParser->addCommand('rsvp');
16 $cmd->description = 'Create a reservation';
17 static::addOptHtml($cmd);
18 static::optsGeneric($cmd);
23 'description' => 'URL that is replied to',
31 'description' => 'Answer: yes, no, maybe',
39 'description' => 'Answer text',
44 public function run(\Console_CommandLine_Result $cmdRes)
46 $url = Validator::url($cmdRes->args['url'], 'url');
50 $rsvp = Validator::rsvp($cmdRes->args['rsvp']);
51 if ($rsvp === false) {
55 $req = new Request($this->cfg->host, $this->cfg);
56 $req->setType('entry');
57 $req->addProperty('in-reply-to', $url);
58 $req->addProperty('rsvp', $rsvp);
59 if ($cmdRes->args['text']) {
60 $req->addContent($cmdRes->args['text'], $cmdRes->options['html']);
62 $this->handleGenericOptions($cmdRes, $req);
65 $postUrl = $res->getHeader('Location');
66 Log::info('RSVP created at server');