diff --git a/GoogleClientAPI.module b/GoogleClientAPI.module index 23e7d10..8a967ed 100644 --- a/GoogleClientAPI.module +++ b/GoogleClientAPI.module @@ -30,14 +30,6 @@ class GoogleClientAPI extends WireData implements Module, ConfigurableModule { const debug = false; - /** - * Name for log file - * - * @var string - * - */ - protected $logName = 'google-client'; - /** * Construct by setup of default config values * @@ -246,8 +238,7 @@ class GoogleClientAPI extends WireData implements Module, ConfigurableModule { if(!$client) throw new WireException("The GoogleClientAPI module is not yet configured"); $service = new \Google_Service_Calendar($client); } catch(\Exception $e) { - $this->log($e->getMessage()); - $this->error($e->getMessage()); + $this->error($e->getMessage(), Notice::log); return false; } diff --git a/README.md b/README.md index e46ae06..b86fbc5 100644 --- a/README.md +++ b/README.md @@ -1 +1,63 @@ -Google Client library for use with ProcessWire CMS/CMF \ No newline at end of file +# Google Client API and Markup Google Calendar modules + +## Requirements + +- ProcessWire 3.0.10 or newer +- PHP 5.4 or newer +- Composer + +## Google Client API module + +This module is also created as a demonstration for installation of modules via Composer. +In this case, this module requires installation via Composer since it has external +dependencies, though we'll be adding support for other installation methods soon. + +### Installation + +In your ProcessWire installation root execute the following command from the terminal: + +```````` +composer require processwire/google-client-api +```````` + +Login to your ProcessWire admin and go to: Modules > Refresh. Click "Install" next to +the Google Client API module (which should appear on the "Site" tab). + +The module now needs to be connected with a Google account. Full instructions on how +to do this will be posted shortly at https://processwire.com/blog/. + +---------------------- + +# Markup Google Calendar module for ProcessWire + +Renders a calendar with data from google. This module demonstrates use of +and requires the GoogleClientAPI module, which must be installed and configured +prior to using this module. + +See the "_mgc-event.php" file which is what handles the output markup. You should +copy this file to /site/templates/_mgc-event.php and modify it as you see fit. +If you do not copy to your /site/templates/ directory then it will use the +default one in the module directory. + +Please note that all render methods cache output by default for 1 hour. You can +change this by adjusting the $cacheExpire property of the module. + +## Usage + +````````````````` +$cal = $modules->get('MarkupGoogleCalendar'); +$cal->calendarID = 'your-calendar-id'; // Your Google Calendar ID (default=primary) +$cal->cacheExpire = 3600; // how many seconds to cache output (default=3600) +$cal->maxResults = 100; // maximum number of results to render (default=100) + +// use any one of the following +echo $cal->renderMonth(); // render events for this month +echo $cal->renderMonth($month, $year); // render events for given month +echo $cal->renderDay(); // render events for today +echo $cal->renderDay($day, $month, $year); // render events for given day +echo $cal->renderUpcoming(10); // render next 10 upcoming events +echo $cal->renderRange($timeMin, $timeMax); // render events between given min/max dates/times +`````````````````` + +More details and options can be found in the phpdoc comments for each +of the above mentioned methods. \ No newline at end of file diff --git a/composer.json b/composer.json index 9b6a030..6b66e4f 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "hari/pw-module": "dev-master", + "hari/pw-module": "~1.0", "google/apiclient": "^2.0.0@RC" } }